Compare commits

..

3 Commits

3 changed files with 27 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
# configuration file generated by Bochs # 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 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 config_interface: textconfig
display_library: wx display_library: x, options=gui_debug
memory: guest=64, host=64, block_size=128 memory: guest=64, host=64, block_size=128
romimage: file="/usr/share/bochs/BIOS-bochs-legacy", address=0x00000000, options=none, flash_data=none romimage: file="/usr/share/bochs/BIOS-bochs-legacy", address=0x00000000, options=none, flash_data=none
vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest" vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest"
@@ -10,7 +10,7 @@ floppy_bootsig_check: disabled=0
floppya: type=1_44 floppya: type=1_44
# no floppyb # no floppyb
ata0: enabled=true, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14 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 ata0-slave: type=none
ata1: enabled=false ata1: enabled=false
ata1-master: type=none ata1-master: type=none

View File

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

View File

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