minor cleanup related to memory refactor

This commit is contained in:
2024-10-12 12:57:56 -04:00
parent 5a74cd86ad
commit d1217182d4
2 changed files with 11 additions and 28 deletions

View File

@@ -25,14 +25,11 @@
[WARNING -reloc-abs-word] ; Yes, we use absolute addresses. surpress these warnings.
[map all mbr.map]
%define __STEVIA_MBR
jmp short (init - $$)
nop
; ###############
;
; Headers/Includes/Definitions
;
; ###############
%include "util/bochs_magic.inc"
@@ -43,11 +40,7 @@ nop
%include "error_codes.inc"
%include "partition_table.inc"
; ###############
; End Section
; ###############
ALIGN 4, db 0x90
ALIGN 4
init:
cli ; We do not want to be interrupted
@@ -69,23 +62,15 @@ init:
jmp 0:main
; ###############
;
; Extra/Shared Functions
;
; ###############
%include "util/kmem_func.nasm"
%include "util/error_func.nasm"
; ###############
; End Section
; ###############
;
; bp - 2 : uint8_t boot_drive
; bp - 4 : uint16_t part_offset
;
ALIGN 4, db 0x90
main:
mov byte [bp - 2], dl ; BIOS passes drive number in DL
@@ -158,7 +143,7 @@ main:
mov si, word [bp - 4]
mov dl, byte [bp - 2]
jmp 0:0x7C00
jmp word 0x0000:0x7C00
; ###############
;
@@ -168,10 +153,6 @@ main:
%include 'BIOS/func/ext_read.nasm'
; ###############
; End Section
; ###############
%assign bytes_remaining (440 - ($ - $$))
%warning MBR has bytes_remaining bytes remaining for code (MAX: 440 bytes)
times ((512 - 72) - ($ - $$)) nop ; Fill the rest of sector with nop

View File

@@ -24,7 +24,7 @@
[WARNING -reloc-abs-word]
[map all vbr.map] ; Yes, we use absolute addresses. surpress these warnings.
%define __STEVIA_VBR
section .text
__ENTRY:
jmp short (init - $$)
nop
@@ -51,11 +51,8 @@ times 54 db 0x00
%include "error_codes.inc"
%include "fat32/bpb_offset_bx.inc"
; ###############
; End Section
; ###############
ALIGN 4, db 0x90
ALIGN 4
init:
cli ; We do not want to be interrupted
@@ -85,6 +82,9 @@ init:
; End Section
; ###############
;
; byte boot_drive @ bp - 2
; word part_offset @ bp - 4
ALIGN 4, db 0x90
main:
mov byte [bp - 2], dl ; boot_drive
@@ -101,7 +101,7 @@ main:
push ax
mov ax, fat32_bpb ; defined in memory.inc, destination
push ax
call kmemcpy ; copy bpb to memory
call kmemcpy ; copy bpb & ebpb to memory
add sp, 0x6
mov bx, fat32_bpb ; bx now points to aligned memory structure
@@ -130,6 +130,8 @@ main:
add sp, 0xC
.check_sig:
; BUG: this is hard coded to check @ ((0x7E0 << 4) + 0x7FFC)...i.e (STAGE2_ENTRY + (STAGE2_MAX_BYTES - 4))
; this should be removed or done properly
mov ax, 0x7E0
mov fs, ax
cmp dword [fs:0x7FFC], 0xDEADBEEF
@@ -140,7 +142,7 @@ main:
.sig_ok:
mov si, word [bp - 4]
mov dl, byte [bp - 2]
jmp 0:0x7E00
jmp word 0x0000:0x7E00
; ###############
; Required BIOS function(s)