refactor: hungarian notation (wip)
This commit is contained in:
parent
d8f68619d6
commit
eb24cb88c2
|
@ -1,6 +1,9 @@
|
||||||
CR = 0x0D
|
CR = 0x0D
|
||||||
LF = 0x0A
|
LF = 0x0A
|
||||||
|
|
||||||
|
TRUE = 1
|
||||||
|
FALSE = 0
|
||||||
|
|
||||||
; -------- Address ----------
|
; -------- Address ----------
|
||||||
MBR_BASE = 0x0600
|
MBR_BASE = 0x0600
|
||||||
BOOTSECT_BASE = 0x7C00
|
BOOTSECT_BASE = 0x7C00
|
||||||
|
|
|
@ -31,8 +31,20 @@ efimain:
|
||||||
mov ebx, [eax + EFI_SYSTEM_TABLE.BootServices]
|
mov ebx, [eax + EFI_SYSTEM_TABLE.BootServices]
|
||||||
mov [pBootServices], ebx
|
mov [pBootServices], ebx
|
||||||
|
|
||||||
;mov ecx, [ebx + EFI_BOOT_SERVICES.OpenProtocol]
|
mov ecx, [ebx + EFI_BOOT_SERVICES.AllocatePool]
|
||||||
;mov [fnOpenProtocol], ecx
|
mov [fnAllocatePool], ecx
|
||||||
|
|
||||||
|
mov ecx, [ebx + EFI_BOOT_SERVICES.FreePool]
|
||||||
|
mov [fnFreePool], ecx
|
||||||
|
|
||||||
|
mov ecx, [ebx + EFI_BOOT_SERVICES.GetMemoryMap]
|
||||||
|
mov [fnGetMemoryMap], ecx
|
||||||
|
|
||||||
|
mov ecx, [ebx + EFI_BOOT_SERVICES.OpenProtocol]
|
||||||
|
mov [fnOpenProtocol], ecx
|
||||||
|
|
||||||
|
mov ecx, [ebx + EFI_BOOT_SERVICES.Exit]
|
||||||
|
mov [fnExit], ecx
|
||||||
|
|
||||||
mov ebx, [eax + EFI_SYSTEM_TABLE.ConOut]
|
mov ebx, [eax + EFI_SYSTEM_TABLE.ConOut]
|
||||||
mov [pConOut], ebx
|
mov [pConOut], ebx
|
||||||
|
@ -53,8 +65,7 @@ efimain:
|
||||||
call [fnOutputStr]
|
call [fnOutputStr]
|
||||||
add esp, 8
|
add esp, 8
|
||||||
|
|
||||||
; load config
|
|
||||||
|
|
||||||
; #=======================#
|
; #=======================#
|
||||||
; search and load kernel
|
; search and load kernel
|
||||||
; openVolume()
|
; openVolume()
|
||||||
|
@ -93,11 +104,12 @@ pSystemTable dd ?
|
||||||
|
|
||||||
;; Variable: pBootServices
|
;; Variable: pBootServices
|
||||||
pBootServices dd ?
|
pBootServices dd ?
|
||||||
fnAllocatePages dd ?
|
fnAllocatePool dd ?
|
||||||
fnFreePages dd ?
|
fnFreePool dd ?
|
||||||
fnGetMemoryMap dd ?
|
fnGetMemoryMap dd ?
|
||||||
fnOpenProtocol dd ?
|
fnOpenProtocol dd ?
|
||||||
fnCloseProtocol dd ?
|
fnCloseProtocol dd ?
|
||||||
|
fnExit dd ?
|
||||||
|
|
||||||
;; Variable: pRuntimeServices
|
;; Variable: pRuntimeServices
|
||||||
pRuntimeServices dd ?
|
pRuntimeServices dd ?
|
||||||
|
|
|
@ -210,6 +210,7 @@ struc EFI_BOOT_SERVICES
|
||||||
.SetMem UINTPTR
|
.SetMem UINTPTR
|
||||||
.CreateEventEx UINTPTR
|
.CreateEventEx UINTPTR
|
||||||
}
|
}
|
||||||
|
defn EFI_BOOT_SERVICES
|
||||||
|
|
||||||
;; ========================================================================
|
;; ========================================================================
|
||||||
;; EFI_RUNTIMES_SERVICES
|
;; EFI_RUNTIMES_SERVICES
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
disk_read_sectors:
|
disk_read_sectors:
|
||||||
test byte [drive_lba], 1
|
test byte [bDriveLBA], TRUE
|
||||||
je .lba_read
|
je .lba_read
|
||||||
push ax
|
push ax
|
||||||
push bx
|
push bx
|
||||||
|
@ -18,7 +18,7 @@ disk_read_sectors:
|
||||||
mov ch, byte [C]
|
mov ch, byte [C]
|
||||||
mov cl, byte [S]
|
mov cl, byte [S]
|
||||||
mov dh, byte [H]
|
mov dh, byte [H]
|
||||||
mov dl, [drive_number]
|
mov dl, [uDrive]
|
||||||
int 0x13
|
int 0x13
|
||||||
jc @f
|
jc @f
|
||||||
pop cx
|
pop cx
|
||||||
|
@ -29,7 +29,7 @@ disk_read_sectors:
|
||||||
loop disk_read_sectors
|
loop disk_read_sectors
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
mov si, msg_error_sector
|
mov si, szMsgErrorSector
|
||||||
call bios_print
|
call bios_print
|
||||||
ret
|
ret
|
||||||
.lba_read:
|
.lba_read:
|
||||||
|
@ -38,12 +38,11 @@ disk_read_sectors:
|
||||||
mov word [disk_packet.offset], bx
|
mov word [disk_packet.offset], bx
|
||||||
mov word [disk_packet.lba], ax
|
mov word [disk_packet.lba], ax
|
||||||
mov ds, [disk_packet]
|
mov ds, [disk_packet]
|
||||||
mov dl, [drive_number]
|
mov dl, [uDrive]
|
||||||
mov ah, 0x42
|
mov ah, 0x42
|
||||||
int 0x13
|
int 0x13
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
C dw 0x00
|
C dw 0x00
|
||||||
H dw 0x00
|
H dw 0x00
|
||||||
S dw 0x00
|
S dw 0x00
|
||||||
|
|
|
@ -27,9 +27,9 @@ _start:
|
||||||
push cs
|
push cs
|
||||||
pop ds
|
pop ds
|
||||||
|
|
||||||
mov [drive_number], dl
|
mov [uDrive], dl
|
||||||
|
|
||||||
mov si, msg_stage2
|
mov si, szMsgStage2
|
||||||
call bios_log
|
call bios_log
|
||||||
|
|
||||||
; enable A20 line
|
; enable A20 line
|
||||||
|
@ -43,7 +43,7 @@ _start:
|
||||||
; dl >= 0x80 == hard drive
|
; dl >= 0x80 == hard drive
|
||||||
; dl == 0xE0 ~= CD/DVD
|
; dl == 0xE0 ~= CD/DVD
|
||||||
; dl <= 0xFF == hard drive
|
; dl <= 0xFF == hard drive
|
||||||
mov dl, [drive_number]
|
mov dl, [uDrive]
|
||||||
cmp dl, 0x7F
|
cmp dl, 0x7F
|
||||||
; skip disk extension check
|
; skip disk extension check
|
||||||
jle @f
|
jle @f
|
||||||
|
@ -53,19 +53,19 @@ _start:
|
||||||
mov bx, 0x55AA
|
mov bx, 0x55AA
|
||||||
int 0x13
|
int 0x13
|
||||||
jc @f
|
jc @f
|
||||||
mov [drive_lba], 1
|
mov [bDriveLBA], TRUE
|
||||||
@@:
|
@@:
|
||||||
; detect filesystem (FAT12/16 or StpdFS)
|
; detect filesystem (FAT12/16 or StpdFS)
|
||||||
; load kernel from filesystem
|
; load kernel from filesystem
|
||||||
; +---------+--------+---------+
|
; +---------+--------+---------+
|
||||||
; | bootsec | sect 1 | stpd sb |
|
; | bootsec | sect 1 | stpd sb |
|
||||||
; +---------+--------+---------+
|
; +---------+--------+---------+
|
||||||
; 0 512 1024
|
; 0 512 1024
|
||||||
;
|
;
|
||||||
; for now fat12 is asumed
|
; for now fat12 is asumed
|
||||||
call fat_load_root
|
call fat_load_root
|
||||||
|
|
||||||
mov si, kernel_fat12_file
|
mov si, szKernelFile
|
||||||
call fat_search_root
|
call fat_search_root
|
||||||
jc .error_not_found
|
jc .error_not_found
|
||||||
|
|
||||||
|
@ -95,13 +95,13 @@ _start:
|
||||||
jmp 0x8:common32
|
jmp 0x8:common32
|
||||||
|
|
||||||
.error_not_found:
|
.error_not_found:
|
||||||
mov si, msg_error_not_found
|
mov si, szMsgErrorNotFound
|
||||||
jmp .error
|
jmp .error
|
||||||
.error_memory:
|
.error_memory:
|
||||||
mov si, msg_error_memory
|
mov si, szMsgErrorMemory
|
||||||
jmp .error
|
jmp .error
|
||||||
.error_a20:
|
.error_a20:
|
||||||
mov si, msg_error_a20
|
mov si, szMsgErrorA20
|
||||||
.error:
|
.error:
|
||||||
call bios_log
|
call bios_log
|
||||||
|
|
||||||
|
@ -118,15 +118,15 @@ _start:
|
||||||
include 'video.inc'
|
include 'video.inc'
|
||||||
include 'gdt.inc'
|
include 'gdt.inc'
|
||||||
|
|
||||||
drive_number rb 1
|
uDrive rb 1
|
||||||
drive_lba db 0
|
bDriveLBA db FALSE
|
||||||
|
|
||||||
msg_stage2 db "StupidOS Loader", 0
|
szMsgStage2 db "StupidOS Loader", 0
|
||||||
kernel_fat12_file db "VMSTUPIDSYS", 0
|
szKernelFile db "VMSTUPIDSYS", 0
|
||||||
msg_error_a20 db "ERROR: can't enable a20 line", 0
|
szMsgErrorA20 db "ERROR: can't enable a20 line", 0
|
||||||
msg_error_memory db "ERROR: can't detect available memory", 0
|
szMsgErrorMemory db "ERROR: can't detect available memory", 0
|
||||||
msg_error_sector db "ERROR: reading sector", CR, LF, 0
|
szMsgErrorSector db "ERROR: reading sector", CR, LF, 0
|
||||||
msg_error_not_found db "ERROR: kernel not found", 0
|
szMsgErrorNotFound db "ERROR: kernel not found", 0
|
||||||
|
|
||||||
use32
|
use32
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
|
@ -143,11 +143,12 @@ multiboot:
|
||||||
|
|
||||||
|
|
||||||
common32:
|
common32:
|
||||||
|
|
||||||
mov [0xB8000], dword 0x07690748
|
mov [0xB8000], dword 0x07690748
|
||||||
|
|
||||||
; paging
|
; paging
|
||||||
; identity map first 1MB
|
; identity map first 1MB
|
||||||
; map kernel to 0xC0000000
|
; map kernel to 0xC000000
|
||||||
|
; -----------------------
|
||||||
|
|
||||||
push STPDBOOT_MAGIC
|
push STPDBOOT_MAGIC
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue