From: Ben Pfaff Date: Wed, 4 Jan 2006 18:56:16 +0000 (+0000) Subject: Move PF_* from exception.c to exception.h, because some students may X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d06d40f329821486474d70a26f985254e2c19f1;p=pintos-anon Move PF_* from exception.c to exception.h, because some students may wish to pass them around. Suggested by Godmar Back. --- 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);