use bochs magic breakpoints in the error printer
makes it easier to get a good state to do some investigating before reseting.
This commit is contained in:
@@ -20,7 +20,8 @@
|
|||||||
|
|
||||||
%ifndef __INC_BOCHS_DEBUG_MAGIC
|
%ifndef __INC_BOCHS_DEBUG_MAGIC
|
||||||
|
|
||||||
;
|
; for things like the error printer, opperate differently when we are targeting a dev (bochs) build
|
||||||
|
%define __STEVIA_DEV_DEBUG
|
||||||
; port_e9_hack: enabled=1 needs to be set in bochsrc.txt/bxrc
|
; port_e9_hack: enabled=1 needs to be set in bochsrc.txt/bxrc
|
||||||
;
|
;
|
||||||
%ifnmacro __BOCHS_PRINTC
|
%ifnmacro __BOCHS_PRINTC
|
||||||
|
|||||||
@@ -22,7 +22,12 @@
|
|||||||
|
|
||||||
%macro ERROR 1
|
%macro ERROR 1
|
||||||
mov al, %1 ; al = 1 byte error code mapped to ascii values
|
mov al, %1 ; al = 1 byte error code mapped to ascii values
|
||||||
|
%ifdef __STEVIA_DEV_DEBUG
|
||||||
|
__BOCHS_MAGIC_DEBUG
|
||||||
|
%endif
|
||||||
jmp error
|
jmp error
|
||||||
|
|
||||||
|
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
; pass error as ascii character in al, errors a-zA-Z or 0-9
|
; pass error as ascii character in al, errors a-zA-Z or 0-9
|
||||||
|
|||||||
@@ -86,11 +86,13 @@ init:
|
|||||||
mov ss, ax ; Set Stack Segment to data segment
|
mov ss, ax ; Set Stack Segment to data segment
|
||||||
mov sp, stack_top ; Set Stack Pointer
|
mov sp, stack_top ; Set Stack Pointer
|
||||||
|
|
||||||
|
mov ax, init
|
||||||
|
push ax ; simulate a return value to the begining of the stage2 loader
|
||||||
|
|
||||||
|
push bp
|
||||||
mov bp, sp
|
mov bp, sp
|
||||||
sub sp, 0x20 ; 32 bytes for local varibles
|
sub sp, 0x20 ; 32 bytes for local varibles
|
||||||
|
|
||||||
sti
|
sti
|
||||||
|
|
||||||
jmp word __STAGE2_SEGMENT:main
|
jmp word __STAGE2_SEGMENT:main
|
||||||
|
|
||||||
; ###############
|
; ###############
|
||||||
@@ -106,11 +108,6 @@ init:
|
|||||||
; FAT32 Driver
|
; FAT32 Driver
|
||||||
; ###############
|
; ###############
|
||||||
|
|
||||||
boot_drive_ptr:
|
|
||||||
dw 0x0000
|
|
||||||
partition_offset_ptr:
|
|
||||||
dw 0x0000
|
|
||||||
|
|
||||||
%include 'fat32/FAT32_SYS.inc'
|
%include 'fat32/FAT32_SYS.inc'
|
||||||
|
|
||||||
; ###############
|
; ###############
|
||||||
@@ -191,7 +188,6 @@ main:
|
|||||||
call InitFATDriver
|
call InitFATDriver
|
||||||
print_string InitFATSYS_OK_cstr
|
print_string InitFATSYS_OK_cstr
|
||||||
|
|
||||||
ERROR STEVIA_DEBUG_HALT
|
|
||||||
;
|
;
|
||||||
; Find first cluster of bootable file
|
; Find first cluster of bootable file
|
||||||
;
|
;
|
||||||
@@ -201,11 +197,9 @@ main:
|
|||||||
push dword eax
|
push dword eax
|
||||||
call PrintDWORD ; void PrintDWORD(uint32_t dword)
|
call PrintDWORD ; void PrintDWORD(uint32_t dword)
|
||||||
add sp, 0x4
|
add sp, 0x4
|
||||||
print_string NewLine_cstr
|
print_string NewLine_cstr
|
||||||
|
|
||||||
hcf:
|
hcf:
|
||||||
hlt
|
ERROR STEVIA_DEBUG_OK
|
||||||
jmp short (hcf - $$)
|
|
||||||
|
|
||||||
; ##############################
|
; ##############################
|
||||||
;
|
;
|
||||||
@@ -505,6 +499,10 @@ stack_top:
|
|||||||
stage2_main_redzone:
|
stage2_main_redzone:
|
||||||
resb 32
|
resb 32
|
||||||
|
|
||||||
|
;
|
||||||
|
; structures
|
||||||
|
;
|
||||||
|
|
||||||
align 16, resb 1
|
align 16, resb 1
|
||||||
partition_table resb PartTable_t_size
|
partition_table resb PartTable_t_size
|
||||||
|
|
||||||
@@ -518,19 +516,25 @@ fat32_nc_data resb 16
|
|||||||
align 16, resb 1
|
align 16, resb 1
|
||||||
lba_packet resb LBAPkt_t_size
|
lba_packet resb LBAPkt_t_size
|
||||||
|
|
||||||
align 16, resb 1
|
|
||||||
SteviaInfo:
|
|
||||||
resd 4
|
|
||||||
align 16, resb 1
|
align 16, resb 1
|
||||||
fat32_state:
|
fat32_state:
|
||||||
resb FAT32_State_t_size
|
resb FAT32_State_t_size
|
||||||
|
|
||||||
align 16, resb 1
|
align 16, resb 1
|
||||||
mbr_sector_data:
|
SteviaInfo:
|
||||||
resb 512
|
resd 4
|
||||||
vbr_sector_data:
|
|
||||||
resb 512
|
|
||||||
|
|
||||||
|
;
|
||||||
|
; locals
|
||||||
|
;
|
||||||
|
boot_drive_ptr:
|
||||||
|
resw 1
|
||||||
|
partition_offset_ptr:
|
||||||
|
resw 1
|
||||||
|
|
||||||
|
;
|
||||||
|
; large continuous allocations
|
||||||
|
;
|
||||||
align 16, resb 1
|
align 16, resb 1
|
||||||
disk_buffer:
|
disk_buffer:
|
||||||
resb 512
|
resb 512
|
||||||
|
|||||||
Reference in New Issue
Block a user