Rev 195 | Rev 251 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 195 | Rev 226 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | #include <arch/asm.h> |
34 | #include <arch/asm.h> |
35 | #include <memstr.h> |
35 | #include <memstr.h> |
36 | 36 | ||
37 | 37 | ||
38 | void page_init(void) |
38 | void page_init(void) |
39 | { |
39 | { |
40 | page_arch_init(); |
40 | page_arch_init(); |
41 | map_page_to_frame(0x0, 0x0, PAGE_NOT_PRESENT, 0); |
41 | map_page_to_frame(0x0, 0x0, PAGE_NOT_PRESENT, 0); |
42 | } |
42 | } |
43 | 43 | ||
44 | /** Map memory structure |
44 | /** Map memory structure |
Line 52... | Line 52... | ||
52 | */ |
52 | */ |
53 | void map_structure(__address s, size_t size) |
53 | void map_structure(__address s, size_t size) |
54 | { |
54 | { |
55 | int i, cnt, length; |
55 | int i, cnt, length; |
56 | 56 | ||
57 | /* TODO: implement portable way of computing page address from address */ |
- | |
58 | length = size + (s - (s & 0xfffff000)); |
57 | length = size + (s - (s & ~(PAGE_SIZE-1))); |
59 | cnt = length/PAGE_SIZE + (length%PAGE_SIZE>0); |
58 | cnt = length/PAGE_SIZE + (length%PAGE_SIZE>0); |
60 | 59 | ||
61 | for (i = 0; i < cnt; i++) |
60 | for (i = 0; i < cnt; i++) |
62 | map_page_to_frame(s + i*PAGE_SIZE, s + i*PAGE_SIZE, PAGE_NOT_CACHEABLE, 0); |
61 | map_page_to_frame(s + i*PAGE_SIZE, s + i*PAGE_SIZE, PAGE_NOT_CACHEABLE, 0); |
63 | 62 |