Compare commits

..

3 Commits

3 changed files with 27 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
# configuration file generated by Bochs
plugin_ctrl: voodoo=false, unmapped=true, biosdev=true, speaker=true, extfpuirq=true, parallel=true, serial=true, busmouse=false, e1000=false, es1370=false, gameport=true, ne2k=false, sb16=false, usb_uhci=false, usb_ohci=false, usb_ehci=false, usb_xhci=false
config_interface: textconfig
display_library: wx
display_library: x, options=gui_debug
memory: guest=64, host=64, block_size=128
romimage: file="/usr/share/bochs/BIOS-bochs-legacy", address=0x00000000, options=none, flash_data=none
vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest"
@@ -10,7 +10,7 @@ floppy_bootsig_check: disabled=0
floppya: type=1_44
# no floppyb
ata0: enabled=true, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, path="./disk.img", mode=flat, cylinders=0, heads=0, spt=0, sect_size=512, model="Stevia Disk", biosdetect=auto, translation=lba
ata0-master: type=disk, path="./build/disk.img", mode=flat, cylinders=0, heads=0, spt=0, sect_size=512, model="Stevia Disk", biosdetect=auto, translation=lba
ata0-slave: type=none
ata1: enabled=false
ata1-master: type=none

View File

@@ -40,23 +40,27 @@ GetMemoryMap:
.func:
mov dword [SteviaInfo + SteviaInfoStruct_t.MemoryMapEntries], 0
mov eax, 0xE820 ; select 0xE820 function
xor ebx, ebx ; Continuation value, 0 for the first call
lea dx, [BIOSMemoryMap]
mov dx, BIOSMemoryMap
shr dx, 4
mov es, dx
xor di, di ; (BIOSMemoryMap >> 4):0 makes di an index into BIOSMemoryMap
mov ecx, AddressRangeDescStruct_t_size
mov edx, 0x534D4150 ; 'SMAP' magic
mov ecx, AddressRangeDescStruct_t_size ; hard request ACPI 3.0 table versions (24 bytes)
.loop_L1:
mov eax, 0x0000E820 ; select 0xE820 function
mov edx, 0x534D4150 ; 'SMAP' magic
int 0x15
jc GetMemoryMap.error
cmp eax, 0x534D4150
jne GetMemoryMap.no_smap_returned
.no_error:
inc dword [SteviaInfo + SteviaInfoStruct_t.MemoryMapEntries]
mov eax, dword [SteviaInfo + SteviaInfoStruct_t.MemoryMapEntries]
add eax, 1
mov dword [SteviaInfo + SteviaInfoStruct_t.MemoryMapEntries], eax
cmp ecx, 20 ; TODO: maybe this could be handled better than just panicing
jb GetMemoryMap.nonstandard_e820 ; non-standard entry found
@@ -64,9 +68,11 @@ GetMemoryMap:
cmp ebx, 0
je GetMemoryMap.endp ; 0 in ebx means we have reached the end of memory ranges
add di, AddressRangeDescStruct_t_size ; increment di to next descriptor
mov edx, eax ; 'SMAP' to edx
mov eax, 0xE820 ; select E820 function
; setup for next loop, ebx is our next index and has already been set.
xor ecx, ecx
mov ecx, AddressRangeDescStruct_t_size ; set ecx (requested_size) to 24 bytes
add di, cx ; increment di to next descriptor so es:di points to the next free space
jmp GetMemoryMap.loop_L1
.error:
ERROR STAGE2_MM_E820_MISC_ERR

View File

@@ -504,24 +504,24 @@ section .bss follows=.sign
begin_bss:
; structures
align 8, resb 1
alignb 16
partition_table resb PartTable_t_size
align 8, resb 1
alignb 16
fat32_bpb resb FAT32_bpb_t_size
fat32_ebpb resb FAT32_ebpb_t_size
align 8, resb 1
alignb 16
fat32_nc_data resb 16
align 8, resb 1
alignb 16
lba_packet resb LBAPkt_t_size
align 8, resb 1
alignb 16
fat32_state:
resb FAT32_State_t_size
align 8, resb 1
alignb 16
SteviaInfo:
resd 4
;
@@ -531,7 +531,7 @@ SteviaInfo:
;
; large continuous allocations
;
align 16, resb 1
alignb 16
disk_buffer:
resb 512
fat_buffer:
@@ -541,12 +541,12 @@ dir_buffer:
fat_fsinfo:
resb 512
align 16, resb 1
%define BIOSMemoryMap_SIZE 2048
alignb 16
%define BIOSMemoryMap_SIZE 1024
BIOSMemoryMap:
resb 2048
resb BIOSMemoryMap_SIZE
align 512, resb 1
alignb 512
stack_bottom:
resb 1024
stack_top: