Rev 623 | Rev 629 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 623 | Rev 624 | ||
|---|---|---|---|
| Line 40... | Line 40... | ||
| 40 | #include <arch.h> |
40 | #include <arch.h> |
| 41 | #include <print.h> |
41 | #include <print.h> |
| 42 | #include <align.h> |
42 | #include <align.h> |
| 43 | 43 | ||
| 44 | SPINLOCK_INITIALIZE(zone_head_lock); /**< this lock protects zone_head list */ |
44 | SPINLOCK_INITIALIZE(zone_head_lock); /**< this lock protects zone_head list */ |
| 45 | link_t zone_head; /**< list of all zones in the system */ |
45 | LIST_INITIALIZE(zone_head); /**< list of all zones in the system */ |
| 46 | 46 | ||
| 47 | /** Blacklist containing non-available areas of memory. |
47 | /** Blacklist containing non-available areas of memory. |
| 48 | * |
48 | * |
| 49 | * This blacklist is used to exclude frames that cannot be allocated |
49 | * This blacklist is used to exclude frames that cannot be allocated |
| 50 | * (e.g. kernel memory) from available memory map. |
50 | * (e.g. kernel memory) from available memory map. |
| Line 66... | Line 66... | ||
| 66 | * Initialize physical memory managemnt. |
66 | * Initialize physical memory managemnt. |
| 67 | */ |
67 | */ |
| 68 | void frame_init(void) |
68 | void frame_init(void) |
| 69 | { |
69 | { |
| 70 | if (config.cpu_active == 1) { |
70 | if (config.cpu_active == 1) { |
| 71 | zone_init(); |
- | |
| 72 | frame_region_not_free(KA2PA(config.base), config.kernel_size); |
71 | frame_region_not_free(KA2PA(config.base), config.kernel_size); |
| 73 | } |
72 | } |
| 74 | 73 | ||
| 75 | frame_arch_init(); |
74 | frame_arch_init(); |
| 76 | } |
75 | } |
| Line 233... | Line 232... | ||
| 233 | ASSERT(index < ZONE_BLACKLIST_SIZE); |
232 | ASSERT(index < ZONE_BLACKLIST_SIZE); |
| 234 | zone_blacklist[index].base = base; |
233 | zone_blacklist[index].base = base; |
| 235 | zone_blacklist[index].size = size; |
234 | zone_blacklist[index].size = size; |
| 236 | } |
235 | } |
| 237 | 236 | ||
| 238 | - | ||
| 239 | /** Initialize zonekeeping |
- | |
| 240 | * |
- | |
| 241 | * Initialize zonekeeping. |
- | |
| 242 | */ |
- | |
| 243 | void zone_init(void) |
- | |
| 244 | { |
- | |
| 245 | list_initialize(&zone_head); |
- | |
| 246 | } |
- | |
| 247 | - | ||
| 248 | /** Create frame zones in region of available memory. |
237 | /** Create frame zones in region of available memory. |
| 249 | * |
238 | * |
| 250 | * Avoid any black listed areas of non-available memory. |
239 | * Avoid any black listed areas of non-available memory. |
| 251 | * Assume that the black listed areas cannot overlap |
240 | * Assume that the black listed areas cannot overlap |
| 252 | * one another or cross available memory region boundaries. |
241 | * one another or cross available memory region boundaries. |