From 3340831e5e6a5a87f5e67c5ac9d64b0d47d1e4c6 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Fri, 9 Mar 2012 12:55:55 +0000 Subject: [PATCH] acpi:print e820 memory map git-svn-id: svn://kolibrios.org@2442 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/Kolibri-acpi/core/apic.inc | 2 +- kernel/branches/Kolibri-acpi/core/memory.inc | 25 +++++++++++++++++++ .../branches/Kolibri-acpi/detect/biosmem.inc | 4 +-- kernel/branches/Kolibri-acpi/init.inc | 7 ++++++ kernel/branches/Kolibri-acpi/kernel.asm | 4 ++- 5 files changed, 38 insertions(+), 4 deletions(-) diff --git a/kernel/branches/Kolibri-acpi/core/apic.inc b/kernel/branches/Kolibri-acpi/core/apic.inc index 531f652ffc..b472d7f6b0 100644 --- a/kernel/branches/Kolibri-acpi/core/apic.inc +++ b/kernel/branches/Kolibri-acpi/core/apic.inc @@ -429,7 +429,7 @@ start_ap: jz .exit cmp eax, [cpu_count] - ja .exit + jae .exit mov eax, [smpt+eax*4] shl eax, 24 diff --git a/kernel/branches/Kolibri-acpi/core/memory.inc b/kernel/branches/Kolibri-acpi/core/memory.inc index 8ec76978b9..ab65e891dd 100644 --- a/kernel/branches/Kolibri-acpi/core/memory.inc +++ b/kernel/branches/Kolibri-acpi/core/memory.inc @@ -8,6 +8,7 @@ $Revision$ + align 4 proc alloc_page @@ -1554,3 +1555,27 @@ proc create_ring_buffer stdcall, size:dword, flags:dword .fail: ret endp + + +align 4 +print_mem: + mov edi, BOOT_VAR + 0x9104 + mov ecx, [edi-4] + test ecx, ecx + jz .done + +@@: + mov eax, [edi] + mov edx, [edi+4] + add eax, [edi+8] + adc edx, [edi+12] + + DEBUGF 1, "K : E820 %x%x - %x%x type %d\n", \ + [edi+4], [edi],\ + edx, eax, [edi+16] + add edi, 20 + dec ecx + jnz @b +.done: + ret + diff --git a/kernel/branches/Kolibri-acpi/detect/biosmem.inc b/kernel/branches/Kolibri-acpi/detect/biosmem.inc index 7b66cd4b66..85557ed619 100644 --- a/kernel/branches/Kolibri-acpi/detect/biosmem.inc +++ b/kernel/branches/Kolibri-acpi/detect/biosmem.inc @@ -23,8 +23,8 @@ cmp eax, 0x534D4150 jnz no_E820 e820_mem_loop: - cmp byte [di+16], 1 ; ignore non-free areas - jnz e820_mem_next +; cmp byte [di+16], 1 ; ignore non-free areas +; jnz e820_mem_next inc byte [0x9100] add di, 20 e820_mem_next: diff --git a/kernel/branches/Kolibri-acpi/init.inc b/kernel/branches/Kolibri-acpi/init.inc index 88cbecd770..26acda978d 100644 --- a/kernel/branches/Kolibri-acpi/init.inc +++ b/kernel/branches/Kolibri-acpi/init.inc @@ -45,8 +45,12 @@ proc mem_test ret endp + align 4 proc init_mem + + xchg bx, bx + ; calculate maximum allocatable address and number of allocatable pages mov edi, BOOT_VAR-OS_BASE + 0x9104 mov ecx, [edi-4] @@ -55,6 +59,9 @@ proc init_mem .calcmax: ; round all to pages mov eax, [edi] + cmp [edi+16], byte 1 + jne .unusable + test eax, 0xFFF jz @f neg eax diff --git a/kernel/branches/Kolibri-acpi/kernel.asm b/kernel/branches/Kolibri-acpi/kernel.asm index 5fccd81038..7777b59a7a 100644 --- a/kernel/branches/Kolibri-acpi/kernel.asm +++ b/kernel/branches/Kolibri-acpi/kernel.asm @@ -1056,10 +1056,12 @@ end if mov eax, [cpu_count] test eax, eax jnz @F - mov al, 1 ; at least one CPU + mov al, 1 ; at least one CPU @@: DEBUGF 1, "K : %d CPU detected\n", eax + call print_mem + ; START MULTITASKING ; A 'All set - press ESC to start' messages if need