From 142ead7f1795db4e92db90eb322735631d8d454f Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 4 Jan 2006 18:56:16 +0000 Subject: [PATCH] Move PF_* from exception.c to exception.h, because some students may wish to pass them around. Suggested by Godmar Back. --- src/userprog/exception.c | 2 +- src/userprog/exception.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/userprog/exception.c b/src/userprog/exception.c index 47bfbc2..985cd17 100644 --- a/src/userprog/exception.c +++ b/src/userprog/exception.c @@ -114,7 +114,7 @@ kill (struct intr_frame *f) At entry, the address that faulted is in CR2 (Control Register 2) and information about the fault, formatted as described in - the PF_* macros above, is in F's error_code member. The + the PF_* macros in exception.h, is in F's error_code member. The example code here shows how to parse that information. You can find more information about both of these in the description of "Interrupt 14--Page Fault Exception (#PF)" in diff --git a/src/userprog/exception.h b/src/userprog/exception.h index f1a1537..f83e615 100644 --- a/src/userprog/exception.h +++ b/src/userprog/exception.h @@ -1,6 +1,11 @@ #ifndef USERPROG_EXCEPTION_H #define USERPROG_EXCEPTION_H +/* Page fault error code bits that describe the cause of the exception. */ +#define PF_P 0x1 /* 0: not-present page. 1: access rights violation. */ +#define PF_W 0x2 /* 0: read, 1: write. */ +#define PF_U 0x4 /* 0: kernel, 1: user process. */ + void exception_init (void); void exception_print_stats (void); -- 2.30.2