Compare commits
3 Commits
86d966811b
...
f5e4927d70
| Author | SHA1 | Date | |
|---|---|---|---|
| f5e4927d70 | |||
| b106eae066 | |||
| f2657fdc01 |
@@ -32,7 +32,7 @@ InitFATDriver:
|
|||||||
mov ax, fat32_state
|
mov ax, fat32_state
|
||||||
push ax ; address of structure
|
push ax ; address of structure
|
||||||
call kmemset
|
call kmemset
|
||||||
sub sp, 0x6
|
add sp, 0x6
|
||||||
|
|
||||||
.calc_active_part:
|
.calc_active_part:
|
||||||
mov ax, word [partition_offset]
|
mov ax, word [partition_offset]
|
||||||
@@ -221,7 +221,7 @@ NextCluster:
|
|||||||
mov ax, fat32_nc_data
|
mov ax, fat32_nc_data
|
||||||
push ax ; address of structure
|
push ax ; address of structure
|
||||||
call kmemset
|
call kmemset
|
||||||
sub sp, 0x6
|
add sp, 0x6
|
||||||
|
|
||||||
mov edx, dword [bp + 4]
|
mov edx, dword [bp + 4]
|
||||||
mov si, fat32_nc_data ; instead of push/pop and moving the data back
|
mov si, fat32_nc_data ; instead of push/pop and moving the data back
|
||||||
|
|||||||
@@ -9,11 +9,29 @@ struc ArenaStateStruc_t
|
|||||||
.mark resw 1
|
.mark resw 1
|
||||||
endstruc
|
endstruc
|
||||||
|
|
||||||
; void arena_init(void *mem, size_t bytes)
|
; void arena_init(ArenaState *a)
|
||||||
;
|
;
|
||||||
arena_init:
|
arena_init:
|
||||||
__CDECL16_ENTRY
|
__CDECL16_ENTRY
|
||||||
.func:
|
.func:
|
||||||
|
movzx eax, word [bp + 4] ; ptr to state structure
|
||||||
|
mov di, ax
|
||||||
|
|
||||||
|
xor eax, eax
|
||||||
|
mov word [di + ArenaStateStruc_t.mark], eax
|
||||||
|
mov word [di + ArenaStateStruc_t.end], word (__ARENA_HEAP_START + __ARENA_HEAP_SIZE)
|
||||||
|
mov word [di + ArenaStateStruc_t.start], __ARENA_HEAP_START
|
||||||
|
|
||||||
|
; zero out heap area on init
|
||||||
|
; void* kmemset_byte(void* dst, uint8_t val, uint16_t len);
|
||||||
|
mov ax, __ARENA_HEAP_SIZE
|
||||||
|
push ax ; len
|
||||||
|
xor ax, ax
|
||||||
|
push ax ; val = 0
|
||||||
|
mov ax, __ARENA_HEAP_START
|
||||||
|
push ax ; dst
|
||||||
|
call kmemset
|
||||||
|
add sp, 0x6
|
||||||
|
|
||||||
.endp:
|
.endp:
|
||||||
__CDECL16_EXIT
|
__CDECL16_EXIT
|
||||||
|
|||||||
@@ -361,13 +361,13 @@ begin_data:
|
|||||||
%define CRLF 0Dh, 0Ah
|
%define CRLF 0Dh, 0Ah
|
||||||
|
|
||||||
%macro define_cstr 2
|
%macro define_cstr 2
|
||||||
ALIGN 16
|
align 16
|
||||||
%1_cstr:
|
%1_cstr:
|
||||||
db %2, 00h
|
db %2, 00h
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
%macro define_info 2
|
%macro define_info 2
|
||||||
ALIGN 16
|
align 16
|
||||||
%1_info:
|
%1_info:
|
||||||
db %2, CRLF, 00h
|
db %2, CRLF, 00h
|
||||||
%endmacro
|
%endmacro
|
||||||
@@ -386,7 +386,7 @@ define_info MaybeFound_Boot, "Maybe found a file...checking..."
|
|||||||
|
|
||||||
define_cstr BootTarget, "BOOT BIN"
|
define_cstr BootTarget, "BOOT BIN"
|
||||||
|
|
||||||
ALIGN 16, db 0
|
align 16, db 0
|
||||||
BootTarget:
|
BootTarget:
|
||||||
db 'BOOT BIN'
|
db 'BOOT BIN'
|
||||||
|
|
||||||
@@ -394,28 +394,28 @@ BootTarget:
|
|||||||
; pre-bss init globals (generally const...but there are exceptions)
|
; pre-bss init globals (generally const...but there are exceptions)
|
||||||
;
|
;
|
||||||
|
|
||||||
align 8, db 0x00
|
align 8, db 0
|
||||||
boot_drive:
|
boot_drive:
|
||||||
db 0x00
|
db 0x00
|
||||||
|
|
||||||
align 8, db 0x00
|
align 8, db 0
|
||||||
partition_offset:
|
partition_offset:
|
||||||
dw 0x0000
|
dw 0x0000
|
||||||
|
|
||||||
align 8, db 0x00
|
align 8, db 0
|
||||||
vbr_fat32_bpb_ptr:
|
vbr_fat32_bpb_ptr:
|
||||||
dw 0x0000
|
dw 0x0000
|
||||||
|
|
||||||
align 8, db 0x00
|
align 8, db 0
|
||||||
vbr_part_table_ptr:
|
vbr_part_table_ptr:
|
||||||
dw 0x0000
|
dw 0x0000
|
||||||
|
|
||||||
ALIGN 16
|
align 16, db 0
|
||||||
IntToHex_table:
|
IntToHex_table:
|
||||||
db '0123456789ABCDEF'
|
db '0123456789ABCDEF'
|
||||||
|
|
||||||
; see docs/gdt.txt for a quick refresher on GDT
|
; see docs/gdt.txt for a quick refresher on GDT
|
||||||
ALIGN 16, db 0
|
align 16, db 0
|
||||||
unreal_gdt_info:
|
unreal_gdt_info:
|
||||||
unreal_gdt_size: dw (unreal_gdt_end - unreal_gdt_start) - 1
|
unreal_gdt_size: dw (unreal_gdt_end - unreal_gdt_start) - 1
|
||||||
unreal_gdt_ptr: dd ((__STAGE2_SEGMENT << 4) + unreal_gdt_start)
|
unreal_gdt_ptr: dd ((__STAGE2_SEGMENT << 4) + unreal_gdt_start)
|
||||||
@@ -438,7 +438,7 @@ unreal_gdt_start:
|
|||||||
db 0x00 ; Base Address(31:24)
|
db 0x00 ; Base Address(31:24)
|
||||||
unreal_gdt_end:
|
unreal_gdt_end:
|
||||||
|
|
||||||
ALIGN 16, db 0
|
align 16, db 0
|
||||||
gdt32_info:
|
gdt32_info:
|
||||||
gdt32_size: dw (gdt32_end - gdt32_start) - 1
|
gdt32_size: dw (gdt32_end - gdt32_start) - 1
|
||||||
gdt32_ptr: dd ((__STAGE2_SEGMENT << 4) + gdt32_start)
|
gdt32_ptr: dd ((__STAGE2_SEGMENT << 4) + gdt32_start)
|
||||||
@@ -474,19 +474,19 @@ gdt32_start:
|
|||||||
db 0x00
|
db 0x00
|
||||||
gdt32_end:
|
gdt32_end:
|
||||||
|
|
||||||
ALIGN 8,db 0x00
|
align 16,db 0
|
||||||
BUILD_NASM_VER:
|
BUILD_NASM_VER:
|
||||||
db "Stevia Stage2 built with NASM - ", __NASM_VER__, 00h
|
db "Stevia Stage2 built with NASM - ", __NASM_VER__, 00h
|
||||||
|
|
||||||
ALIGN 8,db 0x00
|
align 16,db 0
|
||||||
BUILD_DATETIME:
|
BUILD_DATETIME:
|
||||||
db 'Assembled - ', __DATE__, ' ', __TIME__, 00h
|
db 'Assembled - ', __DATE__, ' ', __TIME__, 00h
|
||||||
|
|
||||||
ALIGN 8,db 0x00
|
align 16,db 0
|
||||||
BUILD_GIT_VER:
|
BUILD_GIT_VER:
|
||||||
db __GIT_VER__, 00h
|
db __GIT_VER__, 00h
|
||||||
|
|
||||||
ALIGN 8,db 0x00
|
align 16,db 0
|
||||||
BUILD_GIT_HASH:
|
BUILD_GIT_HASH:
|
||||||
db __GIT_HASH__, 00h
|
db __GIT_HASH__, 00h
|
||||||
end_data:
|
end_data:
|
||||||
@@ -504,24 +504,29 @@ section .bss follows=.sign
|
|||||||
begin_bss:
|
begin_bss:
|
||||||
; structures
|
; structures
|
||||||
|
|
||||||
alignb 16
|
align 16, resb 1
|
||||||
partition_table resb PartTable_t_size
|
partition_table:
|
||||||
|
resb PartTable_t_size
|
||||||
|
|
||||||
alignb 16
|
align 16, resb 1
|
||||||
fat32_bpb resb FAT32_bpb_t_size
|
fat32_bpb:
|
||||||
fat32_ebpb resb FAT32_ebpb_t_size
|
resb FAT32_bpb_t_size
|
||||||
|
fat32_ebpb:
|
||||||
|
resb FAT32_ebpb_t_size
|
||||||
|
|
||||||
alignb 16
|
align 16, resb 1
|
||||||
fat32_nc_data resb 16
|
fat32_nc_data:
|
||||||
|
resb 16
|
||||||
|
|
||||||
alignb 16
|
align 16, resb 1
|
||||||
lba_packet resb LBAPkt_t_size
|
lba_packet:
|
||||||
|
resb LBAPkt_t_size
|
||||||
|
|
||||||
alignb 16
|
align 16, resb 1
|
||||||
fat32_state:
|
fat32_state:
|
||||||
resb FAT32_State_t_size
|
resb FAT32_State_t_size
|
||||||
|
|
||||||
alignb 16
|
align 16, resb 1
|
||||||
SteviaInfo:
|
SteviaInfo:
|
||||||
resd 4
|
resd 4
|
||||||
;
|
;
|
||||||
@@ -531,7 +536,7 @@ SteviaInfo:
|
|||||||
;
|
;
|
||||||
; large continuous allocations
|
; large continuous allocations
|
||||||
;
|
;
|
||||||
alignb 16
|
align 16, resb 1
|
||||||
disk_buffer:
|
disk_buffer:
|
||||||
resb 512
|
resb 512
|
||||||
fat_buffer:
|
fat_buffer:
|
||||||
@@ -541,12 +546,15 @@ dir_buffer:
|
|||||||
fat_fsinfo:
|
fat_fsinfo:
|
||||||
resb 512
|
resb 512
|
||||||
|
|
||||||
alignb 16
|
; TODO: this will hold 42 entries from the map function
|
||||||
|
; the e820 function needs to check that it doesn't overflow
|
||||||
|
; but realisticly 42 entries is enough for dev work
|
||||||
|
align 16, resb 1
|
||||||
%define BIOSMemoryMap_SIZE 1024
|
%define BIOSMemoryMap_SIZE 1024
|
||||||
BIOSMemoryMap:
|
BIOSMemoryMap:
|
||||||
resb BIOSMemoryMap_SIZE
|
resb BIOSMemoryMap_SIZE
|
||||||
|
|
||||||
alignb 512
|
align 16, resb 1
|
||||||
stack_bottom:
|
stack_bottom:
|
||||||
resb 1024
|
resb 1024
|
||||||
stack_top:
|
stack_top:
|
||||||
|
|||||||
Reference in New Issue
Block a user