1KiB stack stage2 gets doesn't need extra information from the mbr/vbr now.
This commit is contained in:
@@ -140,15 +140,7 @@ main:
|
|||||||
je main.sig_ok
|
je main.sig_ok
|
||||||
ERROR MBR_ERROR_NO_VBR_SIG ; no signature present
|
ERROR MBR_ERROR_NO_VBR_SIG ; no signature present
|
||||||
.sig_ok:
|
.sig_ok:
|
||||||
push PartTable_t_size ; len
|
|
||||||
push DiskSig ; src -> start of partition table
|
|
||||||
push partition_table ; dst -> addr in bss
|
|
||||||
call kmemcpy ; copy partition table to bss
|
|
||||||
add sp, 0x6
|
|
||||||
|
|
||||||
mov si, word [bp - 4] ; partition_offset address
|
|
||||||
mov dl, byte [bp - 2] ; pass drive # from BIOS to VBR in dl
|
mov dl, byte [bp - 2] ; pass drive # from BIOS to VBR in dl
|
||||||
mov bx, partition_table ; partition_table address
|
|
||||||
jmp word 0x0000:VBR_ENTRY
|
jmp word 0x0000:VBR_ENTRY
|
||||||
|
|
||||||
; ###############
|
; ###############
|
||||||
@@ -181,14 +173,11 @@ BootSig:
|
|||||||
section .bss follows=.text
|
section .bss follows=.text
|
||||||
begin_bss:
|
begin_bss:
|
||||||
|
|
||||||
align 16, resb 1
|
|
||||||
partition_table resb PartTable_t_size
|
|
||||||
|
|
||||||
align 16, resb 1
|
align 16, resb 1
|
||||||
lba_packet resb LBAPkt_t_size
|
lba_packet resb LBAPkt_t_size
|
||||||
|
|
||||||
align 512, resb 1
|
align 512, resb 1
|
||||||
stack_bottom resb 512 - 16 ; 512 byte stack early on
|
stack_bottom resb 1024 - 16 ; 512 byte stack early on
|
||||||
stack_top:
|
stack_top:
|
||||||
mbr_redzone resb 16
|
mbr_redzone resb 16
|
||||||
end_bss:
|
end_bss:
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
%define __STEVIA_VBR
|
%define __STEVIA_VBR
|
||||||
section .text
|
section .text
|
||||||
__ENTRY:
|
__ENTRY:
|
||||||
|
phy_bpb_start:
|
||||||
jmp short (init - $$)
|
jmp short (init - $$)
|
||||||
nop
|
nop
|
||||||
|
|
||||||
@@ -91,25 +92,9 @@ init:
|
|||||||
; ptr partition_table
|
; ptr partition_table
|
||||||
ALIGN 4, db 0x90
|
ALIGN 4, db 0x90
|
||||||
main:
|
main:
|
||||||
mov byte [bp - 2], dl ; boot_drive
|
mov byte [bp - 2], dl ; boot_drive
|
||||||
mov word [bp - 4], si ; part_offset (i.e offset into partition table our boot partition is
|
.check_FAT_size: ; we only support a very specific setup of FAT32
|
||||||
mov word [bp - 6], bx ; partition_table
|
mov bx, phy_bpb_start
|
||||||
|
|
||||||
.load_fs_data:
|
|
||||||
push PartTable_t_size ; count=
|
|
||||||
push word [bp - 6] ; src= ptr partition_table
|
|
||||||
push partition_table ; dst=
|
|
||||||
call kmemcpy ; copy partition table data to bss
|
|
||||||
add sp, 0x6
|
|
||||||
|
|
||||||
push (FAT32_bpb_t_size + FAT32_ebpb_t_size) ; size in byte, should be 90 bytes
|
|
||||||
push __ENTRY ; src
|
|
||||||
push fat32_bpb ; dst
|
|
||||||
call kmemcpy ; copy bpb & ebpb to bss
|
|
||||||
add sp, 0x6
|
|
||||||
|
|
||||||
.check_FAT_size: ; we only support a very specific setup of FAT32
|
|
||||||
mov bx, fat32_bpb
|
|
||||||
test word [bx + FAT32_bpb_t.unused2_ZERO_word], 0 ; TotSectors16 will not be set if FAT32
|
test word [bx + FAT32_bpb_t.unused2_ZERO_word], 0 ; TotSectors16 will not be set if FAT32
|
||||||
jz main.load_stage2
|
jz main.load_stage2
|
||||||
ERROR VBR_ERROR_WRONG_FAT_SIZE
|
ERROR VBR_ERROR_WRONG_FAT_SIZE
|
||||||
@@ -132,11 +117,7 @@ main:
|
|||||||
call read_disk_raw
|
call read_disk_raw
|
||||||
add sp, 0xC
|
add sp, 0xC
|
||||||
.enter_stage2:
|
.enter_stage2:
|
||||||
; TODO: review what we pass to stage2, do we need to do this?
|
mov dl, byte [bp - 2] ; byte boot_drive
|
||||||
mov dl, byte [bp - 2] ; byte boot_drive
|
|
||||||
mov ax, word [bp - 4] ; word part_offset
|
|
||||||
mov si, partition_table ; ptr partition_table
|
|
||||||
mov di, fat32_bpb ; ptr fat32_bpb
|
|
||||||
jmp word 0x0000:STAGE2_ENTRY
|
jmp word 0x0000:STAGE2_ENTRY
|
||||||
|
|
||||||
; ###############
|
; ###############
|
||||||
@@ -157,18 +138,11 @@ BootSig:
|
|||||||
section .bss follows=.text
|
section .bss follows=.text
|
||||||
begin_bss:
|
begin_bss:
|
||||||
|
|
||||||
align 16, resb 1
|
|
||||||
partition_table resb PartTable_t_size
|
|
||||||
|
|
||||||
align 16, resb 1
|
|
||||||
fat32_bpb resb FAT32_bpb_t_size
|
|
||||||
fat32_ebpb resb FAT32_ebpb_t_size
|
|
||||||
|
|
||||||
align 16, resb 1
|
align 16, resb 1
|
||||||
lba_packet resb LBAPkt_t_size
|
lba_packet resb LBAPkt_t_size
|
||||||
|
|
||||||
align 512, resb 1
|
align 512, resb 1
|
||||||
stack_bottom resb (512 - 16) ; 512b stack early on
|
stack_bottom resb (1024 - 16) ; 512b stack early on
|
||||||
stack_top:
|
stack_top:
|
||||||
vbr_redzone resb 16
|
vbr_redzone resb 16
|
||||||
end_bss:
|
end_bss:
|
||||||
Reference in New Issue
Block a user