From owner-freebsd-current@FreeBSD.ORG Sun Sep 26 14:46:33 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8D24016A4CE for ; Sun, 26 Sep 2004 14:46:33 +0000 (GMT) Received: from web50305.mail.yahoo.com (web50305.mail.yahoo.com [206.190.38.59]) by mx1.FreeBSD.org (Postfix) with SMTP id 1BC5D43D58 for ; Sun, 26 Sep 2004 14:46:33 +0000 (GMT) (envelope-from cykyc@yahoo.com) Message-ID: <20040926144632.70365.qmail@web50305.mail.yahoo.com> Received: from [209.98.54.121] by web50305.mail.yahoo.com via HTTP; Sun, 26 Sep 2004 07:46:32 PDT Date: Sun, 26 Sep 2004 07:46:32 -0700 (PDT) From: Jon Passki To: David Xu , freebsd-current@freebsd.org In-Reply-To: <41565673.7050504@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: Interesting code in exec_setregs X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: cykyc@yahoo.com List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2004 14:46:33 -0000 --- David Xu wrote: > I found following code in sys/i386/i386/machdep.c: > function exec_setregs: > > bzero((char *)regs, sizeof(struct trapframe)); > regs->tf_eip = entry; > regs->tf_esp = stack; > regs->tf_eflags = PSL_USER | (regs->tf_eflags & PSL_T); > > the regs is cleared to zero, why do we bother to test it > again ? regs->tf_eflags & PSL_T is useless code. > > AMD64 also has this, I also found it in releng_4, why ? FYI, it's first incarnation was in v1.87 [1] (1994-11-06): ! 864:        bzero(regs, sizeof(struct trapframe)); ! 865:        regs[tEIP] = entry; ! 866:        regs[tESP] = stack; ! 867:        regs[tEFLAGS] = PSL_USERSET | (regs[tEFLAGS] & PSL_T); ! 868:        regs[tSS] = _udatasel; ! 869:        regs[tDS] = _udatasel; ! 870:        regs[tES] = _udatasel; ! 871:        regs[tCS] = _ucodesel; Same issue, it seems. Jon [1] http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/i386/i386/machdep.c?annotate=1.87&only_with_tag=MAIN __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail