summaryrefslogtreecommitdiff
path: root/Kernel/i386.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-08 12:59:16 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-08 12:59:16 +0100
commit3c8064a7872b990c6b48455ed6509d161adf4721 (patch)
tree497c35347f921211d3248222931892b4acf9bdff /Kernel/i386.cpp
parentfdbd9f1e272b97d7d28f9f610be8fbf0bdbd98d9 (diff)
downloadserenity-3c8064a7872b990c6b48455ed6509d161adf4721.zip
Support basic mmap'ing of a file!
All right, we can now mmap() a file and it gets magically paged in from fs in response to an NP page fault. This is really cool :^) I need to refactor this to support sharing of read-only file-backed pages, but it's cool to just have something working.
Diffstat (limited to 'Kernel/i386.cpp')
-rw-r--r--Kernel/i386.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/Kernel/i386.cpp b/Kernel/i386.cpp
index f6e46f7345..6b941592cd 100644
--- a/Kernel/i386.cpp
+++ b/Kernel/i386.cpp
@@ -188,10 +188,11 @@ void exception_14_handler(RegisterDumpWithExceptionCode& regs)
dword faultAddress;
asm ("movl %%cr2, %%eax":"=a"(faultAddress));
- dbgprintf("Ring%u page fault in %s(%u), %s laddr=%p\n",
- regs.cs & 3,
+ dbgprintf("%s(%u): ring%u %s page fault, %s L%x\n",
current->name().characters(),
current->pid(),
+ regs.cs & 3,
+ regs.exception_code & 1 ? "PV" : "NP",
regs.exception_code & 2 ? "write" : "read",
faultAddress);
@@ -231,7 +232,12 @@ void exception_14_handler(RegisterDumpWithExceptionCode& regs)
auto response = MM.handle_page_fault(PageFault(regs.exception_code, LinearAddress(faultAddress)));
if (response == PageFaultResponse::ShouldCrash) {
- kprintf("Crashing after unresolved page fault\n");
+ kprintf("%s(%u) unrecoverable page fault, %s laddr=%p\n",
+ current->name().characters(),
+ current->pid(),
+ regs.exception_code & 2 ? "write" : "read",
+ faultAddress);
+
kprintf("exception code: %w\n", regs.exception_code);
kprintf("pc=%w:%x ds=%w es=%w fs=%w gs=%w\n", regs.cs, regs.eip, regs.ds, regs.es, regs.fs, regs.gs);
kprintf("stk=%w:%x\n", ss, esp);