Problems with e820 mapping
Posted: Wed Aug 13, 2008 7:23 pm
Hey,
I've been working on a bootloader for a bit now, and currently I'm stuck at memory mapping; I've written an implementation for getting a memory map using function e820, but it fails in QEMU 0.9.1 and bochs 2.3.5. It doesn't crash, it just seems like function e820 doesn't exist. Now, this can't be the case, since both of these emulators can run operating systems which use function e820 for a memory map, so does anyone know where I could be going wrong? Here's my implementation:
Thanks in advance.
Edit: Welp, turns out is not the same as Thanks NASM.
I've been working on a bootloader for a bit now, and currently I'm stuck at memory mapping; I've written an implementation for getting a memory map using function e820, but it fails in QEMU 0.9.1 and bochs 2.3.5. It doesn't crash, it just seems like function e820 doesn't exist. Now, this can't be the case, since both of these emulators can run operating systems which use function e820 for a memory map, so does anyone know where I could be going wrong? Here's my implementation:
Code: Select all
me820:
xor ebx,ebx
mov ecx,20
mov es,bx
mov di,BEGIN
.next:
mov eax,0xe820
mov edx,'SMAP'
xor di,di
int 0x15
jc stopmap ;Function unsupported
cmp ecx,20
jne stopmap ;Wrong structure size
cmp eax,'SMAP'
jne stopmap ;Incorrect BIOS revision
inc dword [mem_e820n]
add di,cx
cmp di,BEGIN+0x1000
jae stopmap ;Memory map longer than 4kb, error(?)
cmp ebx,0
jne .next
Edit: Welp, turns out
Code: Select all
mov edx,'SMAP'
Code: Select all
mov edx,0x534d4150