Date: Sun, 26 Sep 2004 07:46:32 -0700 (PDT) From: Jon Passki <cykyc@yahoo.com> To: David Xu <davidxu@freebsd.org>, freebsd-current@freebsd.org Subject: Re: Interesting code in exec_setregs Message-ID: <20040926144632.70365.qmail@web50305.mail.yahoo.com> In-Reply-To: <41565673.7050504@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--- David Xu <davidxu@freebsd.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040926144632.70365.qmail>
