Date: Fri, 14 May 2004 09:51:35 -0700 From: "Peter S. Housel" <housel@acm.org> To: <freebsd-emulation@freebsd.org>, <freebsd-hackers@freebsd.org> Subject: Page fault traps in the linuxulator Message-ID: <001701c439d3$b88df410$dd22010a@housel7352a>
next in thread | raw e-mail | index | archive | help
In 5.2-CURRENT I'm running some Linux code (a garbage collector) that needs to trap page faults. There are a couple of problems with the i386 code that builds linux signal context: /* ... */ frame.sf_sc.sc_err = regs->tf_err; frame.sf_sc.sc_trapno = bsd_to_linux_trapcode(code); The first problem is that the sc_cr2 field of the linux sigcontext is not initialized with the faulting address (obtained at page fault time from the cr2 register). The second problem is that sc_err is being initialized incorrectly, because in trap_pfault the original tf_err field provided by the processor has already been overwritten: /* kludge to pass faulting virtual address to sendsig */ frame->tf_err = eva; The trap handler has worked this way since trap.c revision 1.25 (soon to be having its tenth anniversary). Surely there is some better way to pass eva to sendsig so thtat the 3-bit err field is not lost. (It would be nice if said field were available in the FreeBSD sigcontext, too, but that would likely involve an ABI change.) -Peter-
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001701c439d3$b88df410$dd22010a>