From owner-freebsd-current@FreeBSD.ORG Sun Sep 26 05:40:28 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 0104516A4CE for ; Sun, 26 Sep 2004 05:40:28 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D4EEE43D31 for ; Sun, 26 Sep 2004 05:40:27 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from [127.0.0.1] (davidxu@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i8Q5eQJL049547 for ; Sun, 26 Sep 2004 05:40:27 GMT (envelope-from davidxu@freebsd.org) Message-ID: <41565673.7050504@freebsd.org> Date: Sun, 26 Sep 2004 13:41:07 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.7.1) Gecko/20040730 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-current@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Interesting code in exec_setregs X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list 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 05:40:28 -0000 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 ? David Xu