kernel: Determine kernel vs. user page fault depending on iframe.

The action vm_page_fault takes should depend on whether the iframe to be
handled is a user iframe or not. The check for the user flag in the
error code does however only check if the fault happend in user or
kernel space. Use IFRAME_IS_USER() instead which checks the privilege
level of the iframe. Under 32 bit x86 this also handles vm86
compatibility mode properly.

This is the same logic as used on FreeBSD (TRAPF_USERMODE).

Fixes #13930.

Change-Id: I9c348b6ab4c60daaaaa2c0fe33bcc3336aa29f7b
Reviewed-on: https://review.haiku-os.org/560
Reviewed-by: Axel Dörfler <[email protected]>
This commit is contained in:
Michael Lotz
2018-09-14 10:08:03 +00:00
committed by Axel Dörfler
parent 0de5a83940
commit 8c005190c4
+1 -1
View File
@@ -349,7 +349,7 @@ x86_page_fault_exception(struct iframe* frame)
vm_page_fault(cr2, frame->ip,
(frame->error_code & PGFAULT_W) != 0, // write access
(frame->error_code & PGFAULT_I) != 0, // instruction fetch
(frame->error_code & PGFAULT_U) != 0, // userland
IFRAME_IS_USER(frame), // userland
&newip);
if (newip != 0) {
// the page fault handler wants us to modify the iframe to set the