summaryrefslogtreecommitdiff
path: root/kernel/mem.c
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-09-05 09:34:53 +0200
committerMichal Idziorek <m.i@gmx.at>2014-09-05 09:34:53 +0200
commitc245268812a63bae0610de9a416dc7de97edde07 (patch)
tree1f3707e9d53fbf1d3265feb138d499a58b03cf69 /kernel/mem.c
parentb75c10c9d8c7405ba2f89724b485154d5201c404 (diff)
Moved kernel and reclaimed ACPI memory
finally our 2 stage bootloader also works with LBA loading via BIOS
Diffstat (limited to 'kernel/mem.c')
-rw-r--r--kernel/mem.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/kernel/mem.c b/kernel/mem.c
index ffa56c4..af58877 100644
--- a/kernel/mem.c
+++ b/kernel/mem.c
@@ -159,7 +159,7 @@ void mem_init(uint16_t *memmap,uint16_t entries)
mem_free_blocks=0;
// count available mem
- uint32_t total_mem=0, highest_end=0, high_end_low=0;
+ uint32_t total_mem=0, highest_end=0, high_end_low=0,last_end=0;
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"the memory map contains %d entries.",entries);
@@ -178,18 +178,20 @@ void mem_init(uint16_t *memmap,uint16_t entries)
memmap[8],low_end,high_end);
#endif
- if(memmap[8]==1)
+ if(memmap[8]==1||memmap[8]==3)
{
total_mem+=memmap[4]+(memmap[5]<<16);
- }
- if(memmap[8]==1)
- {
- if(high_end>highest_end){
+ if(high_end>highest_end)
+ {
highest_end=high_end;
- high_end_low=low_end;
+ high_end_low=last_end;
}
}
+ else
+ {
+ last_end=high_end+1;
+ }
memmap+=12;
@@ -201,9 +203,9 @@ void mem_init(uint16_t *memmap,uint16_t entries)
mem_array_size=blocks/32+1;
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Highest end area: 0x%08X - 0x%08X",high_end_low,highest_end);
if(highest_end-high_end_low<mem_array_size*4)
{
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Highest end area: 0x%08X - 0x%08X",high_end_low,highest_end);
panic(FOOLOS_MODULE_NAME,"not enough space at high end :( sorry.");
}
@@ -215,7 +217,7 @@ void mem_init(uint16_t *memmap,uint16_t entries)
for(int i=0;i<entries;i++)
{
- if(memmap[8]==1)
+ if(memmap[8]==1||memmap[8]==3)
{
pmmngr_init_region(memmap[0]+(memmap[1]<<16),memmap[4]+((memmap[5])<<16));
}