Rev 1382 | Rev 1702 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1382 | Rev 1411 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | #include <debug.h> |
41 | #include <debug.h> |
42 | #include <memstr.h> |
42 | #include <memstr.h> |
43 | #include <print.h> |
43 | #include <print.h> |
44 | #include <interrupt.h> |
44 | #include <interrupt.h> |
45 | 45 | ||
46 | - | ||
47 | void page_arch_init(void) |
46 | void page_arch_init(void) |
48 | { |
47 | { |
49 | __address cur; |
48 | __address cur; |
50 | int flags; |
49 | int flags; |
51 | 50 | ||
Line 85... | Line 84... | ||
85 | 84 | ||
86 | last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); |
85 | last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); |
87 | 86 | ||
88 | return virtaddr; |
87 | return virtaddr; |
89 | } |
88 | } |
- | 89 | ||
- | 90 | void page_fault(int n, istate_t *istate) |
|
- | 91 | { |
|
- | 92 | __address page; |
|
- | 93 | pf_access_t access; |
|
- | 94 | ||
- | 95 | page = read_cr2(); |
|
- | 96 | ||
- | 97 | if (istate->error_word & PFERR_CODE_RSVD) |
|
- | 98 | panic("Reserved bit set in page directory.\n"); |
|
- | 99 | ||
- | 100 | if (istate->error_word & PFERR_CODE_RW) |
|
- | 101 | access = PF_ACCESS_WRITE; |
|
- | 102 | else |
|
- | 103 | access = PF_ACCESS_READ; |
|
- | 104 | ||
- | 105 | if (as_page_fault(page, access, istate) == AS_PF_FAULT) { |
|
- | 106 | PRINT_INFO_ERRCODE(istate); |
|
- | 107 | printf("page fault address: %#x\n", page); |
|
- | 108 | panic("page fault\n"); |
|
- | 109 | } |
|
- | 110 | } |