From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 29 19:58:53 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A1CDC16A4E0 for ; Sat, 29 Jul 2006 19:58:53 +0000 (UTC) (envelope-from kip.macy@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.181]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0CCA343DD5 for ; Sat, 29 Jul 2006 19:57:53 +0000 (GMT) (envelope-from kip.macy@gmail.com) Received: by py-out-1112.google.com with SMTP id b36so142616pyb for ; Sat, 29 Jul 2006 12:57:52 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=M8zoLtkfoy2f8QCpQ0AKT7M6FRsQgibvp9FGU0f/zfHAeZiI4mCZM73kwOcWoXzqA25Ilt8FIga4l2h3CMGoUSCsbetG3vdH49pz95K0x9j905eHUpto/THlvelgzdB5bfqRY0C140h4P02bcqvNZnXNREYi2GQG2KXAxny4uRg= Received: by 10.35.114.16 with SMTP id r16mr1204753pym; Sat, 29 Jul 2006 12:57:52 -0700 (PDT) Received: by 10.35.16.20 with HTTP; Sat, 29 Jul 2006 12:57:52 -0700 (PDT) Message-ID: Date: Sat, 29 Jul 2006 12:57:52 -0700 From: "Kip Macy" To: "Tijl Coosemans" In-Reply-To: <200607292110.37733.tijl@ulyssis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200607292110.37733.tijl@ulyssis.org> Cc: freebsd-hackers@freebsd.org Subject: Re: i386 page fault clobbers error code in trap frame X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: kmacy@fsmware.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2006 19:58:53 -0000 Looking at siginfo it isn't clear that there is a "right way" to provide SIGSEGV, eva, and the error code. _fault._trapno should contain the machine's error code and si_signo should contain SIGSEGV, and si_addr contains the faulting pc. Maybe one could abuse si_code to contain eva. Sorry for asking a question that has already been answered but where is eva being put currently? typedef struct __siginfo { int si_signo; /* signal number */ int si_errno; /* errno association */ /* * Cause of signal, one of the SI_ macros or signal-specific * values, i.e. one of the FPE_... values for SIGFPE. This * value is equivalent to the second argument to an old-style * FreeBSD signal handler. */ int si_code; /* signal code */ __pid_t si_pid; /* sending process */ __uid_t si_uid; /* sender's ruid */ int si_status; /* exit value */ void *si_addr; /* faulting instruction */ union sigval si_value; /* signal value */ union { struct { int _trapno;/* machine specific trap code */ } _fault; /* .... */ On 7/29/06, Tijl Coosemans wrote: > I'm refering to the following two lines in sys/i386/i386/trap.c > > /* kludge to pass faulting virtual address to sendsig */ > frame->tf_err = eva; > > Isn't there some other way to do this? Wouldn't the address still be > available in %cr2 inside sendsig? Or could there have been other page > faults by then? > > The reason I'm asking this is that Wine wants to know the error code in > case of a page fault (the No eXec bit (AMD) and the read/write bit > specifically). > > >