#include "threads/interrupt.h"
#include "threads/thread.h"
+/* Number of page faults processed. */
+static long long page_fault_cnt;
+
static void kill (struct intr_frame *);
static void page_fault (struct intr_frame *);
intr_register (14, 0, INTR_OFF, page_fault, "#PF Page-Fault Exception");
}
+/* Prints exception statistics. */
+void
+exception_print_stats (void)
+{
+ printf ("Exception: %lld page faults\n", page_fault_cnt);
+}
+
/* Handler for an exception (probably) caused by a user process. */
static void
kill (struct intr_frame *f)
be assured of reading CR2 before it changed). */
intr_enable ();
+ /* Count page faults. */
+ page_fault_cnt++;
+
/* Determine cause. */
not_present = (f->error_code & PF_P) == 0;
write = (f->error_code & PF_W) != 0;