From owner-freebsd-arch Sat Jun 10 1:37:29 2000 Delivered-To: freebsd-arch@freebsd.org Received: from finch-post-11.mail.demon.net (finch-post-11.mail.demon.net [194.217.242.39]) by hub.freebsd.org (Postfix) with ESMTP id 5BB2837B74A for ; Sat, 10 Jun 2000 01:37:18 -0700 (PDT) (envelope-from dfr@nlsystems.com) Received: from nlsys.demon.co.uk ([158.152.125.33] helo=herring.nlsystems.com) by finch-post-11.mail.demon.net with esmtp (Exim 2.12 #1) id 130glS-000K5K-0B; Sat, 10 Jun 2000 08:37:10 +0000 Received: from salmon.nlsystems.com (salmon.nlsystems.com [10.0.0.3]) by herring.nlsystems.com (8.9.3/8.8.8) with ESMTP id JAA00714; Sat, 10 Jun 2000 09:38:15 +0100 (BST) (envelope-from dfr@nlsystems.com) Date: Sat, 10 Jun 2000 09:42:11 +0100 (BST) From: Doug Rabson To: Luoqi Chen Cc: dillon@apollo.backplane.com, arch@FreeBSD.ORG Subject: Re: Syscalls and execve In-Reply-To: <200006091239.e59Cd9T08096@lor.watermarkgroup.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 9 Jun 2000, Luoqi Chen wrote: > > > Why not have the new exec()'d process, when it gets the cpu in supervisor > > > mode, clear the registers in supervisor mode before returning > > > to user mode? e.g. near the end of kern/kern_exec.c's execve(). > > > (or somewhere similar). Then at least the 'garbage' will be more > > > like what you see on return from a syscall rather then something > > > inherited from another process. > > > > > Here the current process *is* the process calling exec() (unlike fork()), so > > why not just zero those registers in setregs()? > > > > -lq > > > I take back what I've just said, this won't guarantee zeros in those volatile > registers. Moreover doesn't the new process image expect to see argc, argv, > envp in the argument registers? Exec() needs special treatment, maybe an > exec_trampoline()? The entry point for execve on alpha expects $pc and $pv to point to the start instruction, $a0 to be the new stack pointer and $a3 to point at ps_strings. Values for argc, argv etc are calculated by examining the stack. -- Doug Rabson Mail: dfr@nlsystems.com Nonlinear Systems Ltd. Phone: +44 20 8442 9037 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message