Rev 115 | Rev 195 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 115 | Rev 125 | ||
---|---|---|---|
Line 52... | Line 52... | ||
52 | 52 | ||
53 | static spinlock_t framelock; |
53 | static spinlock_t framelock; |
54 | 54 | ||
55 | void frame_init(void) |
55 | void frame_init(void) |
56 | { |
56 | { |
57 | if (config.cpu_active == 1) { |
57 | if (config.cpu_active == 1) { |
58 | 58 | ||
59 | /* |
59 | /* |
60 | * The bootstrap processor will allocate all necessary memory for frame allocation. |
60 | * The bootstrap processor will allocate all necessary memory for frame allocation. |
61 | */ |
61 | */ |
62 | 62 | ||
63 | frames = config.memory_size / FRAME_SIZE; |
63 | frames = config.memory_size / FRAME_SIZE; |
64 | frame_bitmap_octets = frames / 8 + (frames % 8 > 0); |
64 | frame_bitmap_octets = frames / 8 + (frames % 8 > 0); |
65 | frame_bitmap = (__u8 *) malloc(frame_bitmap_octets); |
65 | frame_bitmap = (__u8 *) malloc(frame_bitmap_octets); |
66 | if (!frame_bitmap) |
66 | if (!frame_bitmap) |
67 | panic("malloc/frame_bitmap\n"); |
67 | panic("malloc/frame_bitmap\n"); |
68 | 68 | ||
69 | /* |
69 | /* |
70 | * Mark all frames free. |
70 | * Mark all frames free. |
71 | */ |
71 | */ |
72 | memsetb((__address) frame_bitmap, frame_bitmap_octets, 0); |
72 | memsetb((__address) frame_bitmap, frame_bitmap_octets, 0); |
73 | frames_free = frames; |
73 | frames_free = frames; |
74 | } |
74 | } |
75 | 75 | ||
76 | /* |
76 | /* |
77 | * No frame allocations/reservations prior this point. |
77 | * No frame allocations/reservations prior this point. |
78 | */ |
78 | */ |
79 | 79 | ||
80 | frame_arch_init(); |
80 | frame_arch_init(); |
81 | 81 | ||
82 | if (config.cpu_active == 1) { |
82 | if (config.cpu_active == 1) { |
83 | /* |
83 | /* |
84 | * Create the memory address space map. Marked frames and frame |
84 | * Create the memory address space map. Marked frames and frame |
85 | * regions cannot be used for allocation. |
85 | * regions cannot be used for allocation. |
86 | */ |
86 | */ |
87 | frame_region_not_free(config.base, config.base + config.kernel_size); |
87 | frame_region_not_free(config.base, config.base + config.kernel_size); |
88 | } |
88 | } |
89 | } |
89 | } |
90 | 90 | ||
91 | /* |
91 | /* |