Compare commits
2 commits
f84f328828
...
db96f2a59e
Author | SHA1 | Date | |
---|---|---|---|
db96f2a59e | |||
a9863cbd52 |
10 changed files with 344 additions and 109 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -36,3 +36,4 @@ bochsrc.bxrc
|
||||||
webring.json
|
webring.json
|
||||||
webring.txt
|
webring.txt
|
||||||
kernel/const.inc
|
kernel/const.inc
|
||||||
|
boot/common/const.inc
|
||||||
|
|
|
@ -3,21 +3,26 @@ TARGET = boot_floppy1440.bin \
|
||||||
boot_mbr.bin \
|
boot_mbr.bin \
|
||||||
boot_hdd.bin
|
boot_hdd.bin
|
||||||
|
|
||||||
|
COMMON_DIR = ../common
|
||||||
|
|
||||||
|
COMMON_SRCS = const.inc \
|
||||||
|
fat12.inc
|
||||||
|
|
||||||
FLOPPY_SRCS = floppy.asm \
|
FLOPPY_SRCS = floppy.asm \
|
||||||
../common/const.inc \
|
$(addprefix $(COMMON_DIR)/, $(COMMON_SRCS))
|
||||||
../common/fat12.inc
|
|
||||||
|
|
||||||
HDD_SRCS = hdd.asm \
|
HDD_SRCS = hdd.asm \
|
||||||
../common/const.inc \
|
$(addprefix $(COMMON_DIR)/, $(COMMON_SRCS))
|
||||||
../common/fat12.inc
|
|
||||||
|
|
||||||
MBR_SRCS = mbr.asm \
|
MBR_SRCS = mbr.asm \
|
||||||
../common/const.inc \
|
$(addprefix $(COMMON_DIR)/, $(COMMON_SRCS))
|
||||||
../common/fat12.inc
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
|
%.inc: %.inc.in
|
||||||
|
sh $(TOOLSDIR)/version.sh $< $@
|
||||||
|
|
||||||
boot_floppy1440.bin: $(FLOPPY_SRCS)
|
boot_floppy1440.bin: $(FLOPPY_SRCS)
|
||||||
$(AS) floppy.asm $@
|
$(AS) floppy.asm $@
|
||||||
|
|
||||||
|
|
|
@ -22,3 +22,10 @@ STPDFS_MAGIC = 0x44505453
|
||||||
VIDEO_WIDTH = 1024
|
VIDEO_WIDTH = 1024
|
||||||
VIDEO_HEIGHT = 768
|
VIDEO_HEIGHT = 768
|
||||||
VIDEO_DEPTH = 32
|
VIDEO_DEPTH = 32
|
||||||
|
|
||||||
|
; --------- Version -----------
|
||||||
|
VERSION_MAJOR = @MAJOR@
|
||||||
|
VERSION_MINOR = @MINOR@
|
||||||
|
VERSION_COMMIT equ "@COMMIT@"
|
||||||
|
VERSION_FULL equ "@FULLVERSION@"
|
||||||
|
BUILD_DATE equ "@DATE@"
|
|
@ -1,16 +1,25 @@
|
||||||
TARGET = BOOTIA32.EFI
|
TARGET = BOOTIA32.EFI
|
||||||
|
|
||||||
|
|
||||||
|
COMMON_DIR = ../common
|
||||||
|
|
||||||
|
COMMON_SRCS = const.inc \
|
||||||
|
macro.inc
|
||||||
|
|
||||||
|
|
||||||
BOOTIA32_EFI_SRCS = bootia32.asm \
|
BOOTIA32_EFI_SRCS = bootia32.asm \
|
||||||
uefi.inc \
|
uefi.inc \
|
||||||
logger.inc \
|
logger.inc \
|
||||||
memory.inc \
|
memory.inc \
|
||||||
fs.inc \
|
fs.inc \
|
||||||
../common/const.inc \
|
$(addprefix $(COMMON_DIR)/, $(COMMON_SRCS))
|
||||||
../common/macro.inc
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
|
%.inc: %.inc.in
|
||||||
|
sh $(TOOLSDIR)/version.sh $< $@
|
||||||
|
|
||||||
BOOTIA32.EFI: $(BOOTIA32_EFI_SRCS)
|
BOOTIA32.EFI: $(BOOTIA32_EFI_SRCS)
|
||||||
$(AS) bootia32.asm $@
|
$(AS) bootia32.asm $@
|
||||||
|
|
||||||
|
|
|
@ -14,38 +14,25 @@
|
||||||
|
|
||||||
;; Function: efimain
|
;; Function: efimain
|
||||||
;;
|
;;
|
||||||
;; Parameters:
|
;; In:
|
||||||
|
;; [ESP+4] - handle
|
||||||
|
;; [ESP+8] - <EFI_SYSTEM_TABLE>
|
||||||
;;
|
;;
|
||||||
;; [esp+4] - handle
|
;; Out:
|
||||||
;; [esp+8] - <EFI_SYSTEM_TABLE>
|
;; EAX - efi status
|
||||||
;;
|
|
||||||
;; Returns:
|
|
||||||
;;
|
|
||||||
;; eax - efi status
|
|
||||||
;;
|
;;
|
||||||
efimain:
|
efimain:
|
||||||
mov eax, [esp+4]
|
push ebp
|
||||||
mov [hImage], eax
|
mov ebp, esp
|
||||||
mov eax, [esp+8]
|
|
||||||
mov [pSystemTable], eax
|
|
||||||
|
|
||||||
mov ebx, [eax + EFI_SYSTEM_TABLE.RuntimeServices]
|
EFI_INIT [ebp + 8], [ebp + 12]
|
||||||
mov [pRuntimeServices], ebx
|
|
||||||
|
|
||||||
mov ebx, [eax + EFI_SYSTEM_TABLE.BootServices]
|
|
||||||
mov [pBootServices], ebx
|
|
||||||
|
|
||||||
mov ecx, [ebx + EFI_BOOT_SERVICES.OpenProtocol]
|
|
||||||
mov [fnOpenProtocol], ecx
|
|
||||||
|
|
||||||
mov ecx, [ebx + EFI_BOOT_SERVICES.Exit]
|
|
||||||
mov [fnExit], ecx
|
|
||||||
|
|
||||||
call efi_memory_init
|
|
||||||
call efi_log_init
|
call efi_log_init
|
||||||
|
|
||||||
mov esi, szHelloMsg
|
call efi_memory_init
|
||||||
call efi_log
|
|
||||||
|
LOG szHelloMsg
|
||||||
|
|
||||||
|
|
||||||
call efi_fs_init
|
call efi_fs_init
|
||||||
|
|
||||||
|
@ -83,20 +70,3 @@ szKernelFile du 'vmstupid.sys', 0
|
||||||
szConfigFile du 'stpdboot.ini', 0
|
szConfigFile du 'stpdboot.ini', 0
|
||||||
|
|
||||||
stBootInfo BootInfo
|
stBootInfo BootInfo
|
||||||
|
|
||||||
hImage dd ?
|
|
||||||
pSystemTable dd ?
|
|
||||||
|
|
||||||
;; Variable: pBootServices
|
|
||||||
pBootServices dd ?
|
|
||||||
fnOpenProtocol dd ?
|
|
||||||
fnCloseProtocol dd ?
|
|
||||||
fnExit dd ?
|
|
||||||
|
|
||||||
;; Variable: pRuntimeServices
|
|
||||||
pRuntimeServices dd ?
|
|
||||||
|
|
||||||
;; Variable: pLoadFileProtocol
|
|
||||||
;; Pointer to EFI_LOAD_FILE_PROTOCOL
|
|
||||||
pLoadFileProtocol dd ?
|
|
||||||
fnLoadFile dd ?
|
|
||||||
|
|
|
@ -3,21 +3,16 @@
|
||||||
section '.text' code executable readable
|
section '.text' code executable readable
|
||||||
|
|
||||||
efi_fs_init:
|
efi_fs_init:
|
||||||
|
mov eax, [pEfiBootServices + EFI_BOOT_SERVICES.OpenProtocol]
|
||||||
|
|
||||||
; OpenProtocol(EFI_HANDLE Handle, EFI_GUID *proto, VOID **Interface, EFI_HANDLE AgentHandle, UINT32 Attrs)
|
; OpenProtocol(EFI_HANDLE Handle, EFI_GUID *proto, VOID **Interface, EFI_HANDLE AgentHandle, UINT32 Attrs)
|
||||||
push 0
|
EFI_CALL [fnOpenProtocol], [hEfiImage], aFSProtoGUID, pLoadedImage, [hEfiImage], 0, 2
|
||||||
push [hImage]
|
|
||||||
push pLoadedImage
|
|
||||||
push aFSProtoGUID
|
|
||||||
push [hImage]
|
|
||||||
call [fnOpenProtocol]
|
|
||||||
add esp, 20
|
|
||||||
|
|
||||||
or eax, eax
|
or eax, eax
|
||||||
jnz .error
|
jnz .error
|
||||||
ret
|
ret
|
||||||
.error:
|
.error:
|
||||||
mov esi, szErrTmp
|
mov eax, szErrTmp
|
||||||
call efi_log
|
call efi_log
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
@ -27,3 +22,5 @@ efi_fs_init:
|
||||||
szErrTmp du "Can't OpenProtocol(Simple fs)", 0
|
szErrTmp du "Can't OpenProtocol(Simple fs)", 0
|
||||||
aFSProtoGUID db EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID
|
aFSProtoGUID db EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID
|
||||||
pLoadedImage dd 0
|
pLoadedImage dd 0
|
||||||
|
hSimpleFSProtocol dd 0
|
||||||
|
fnOpenProtocol dd 0
|
||||||
|
|
|
@ -1,38 +1,120 @@
|
||||||
;; File: logger.inc
|
;; File: logger.inc
|
||||||
|
|
||||||
|
macro LOG msg, [arg] {
|
||||||
|
common
|
||||||
|
_ARGS = 0
|
||||||
|
reverse
|
||||||
|
match anything, arg \{
|
||||||
|
_ARGS = _ARGS + 4
|
||||||
|
push dword arg
|
||||||
|
\}
|
||||||
|
common
|
||||||
|
mov eax, msg
|
||||||
|
call efi_log
|
||||||
|
if _ARGS
|
||||||
|
add esp, _ARGS
|
||||||
|
end if
|
||||||
|
}
|
||||||
|
|
||||||
|
;; XXX: use StdErr instead of ConOut
|
||||||
|
macro ERROR msg, [arg] {
|
||||||
|
common
|
||||||
|
_ARGS = 0
|
||||||
|
reverse
|
||||||
|
match anything, arg \{
|
||||||
|
_ARGS = _ARGS + 4
|
||||||
|
push dword arg
|
||||||
|
\}
|
||||||
|
common
|
||||||
|
EFI_CALL [fnSetAttribute], [pConOut], EFI_RED
|
||||||
|
mov eax, msg
|
||||||
|
call efi_log
|
||||||
|
if _ARGS
|
||||||
|
add esp, _ARGS
|
||||||
|
end if
|
||||||
|
EFI_CALL [fnSetAttribute], [pConOut], EFI_LIGHTGRAY
|
||||||
|
}
|
||||||
|
|
||||||
|
macro WARN msg, [arg] {
|
||||||
|
common
|
||||||
|
_ARGS = 0
|
||||||
|
reverse
|
||||||
|
match anything, arg \{
|
||||||
|
_ARGS = _ARGS + 4
|
||||||
|
push dword arg
|
||||||
|
\}
|
||||||
|
common
|
||||||
|
EFI_CALL [fnSetAttribute], [pConOut], EFI_YELLOW
|
||||||
|
mov eax, msg
|
||||||
|
call efi_log
|
||||||
|
if _ARGS
|
||||||
|
add esp, _ARGS
|
||||||
|
end if
|
||||||
|
EFI_CALL [fnSetAttribute], [pConOut], EFI_LIGHTGRAY
|
||||||
|
}
|
||||||
|
|
||||||
section '.text' code executable readable
|
section '.text' code executable readable
|
||||||
|
|
||||||
;; Function: efi_log_init
|
;; Function: efi_log_init
|
||||||
efi_log_init:
|
efi_log_init:
|
||||||
mov eax, [pSystemTable]
|
mov eax, [pEfiSystemTable]
|
||||||
add eax, EFI_SYSTEM_TABLE.ConOut
|
mov eax, [eax + EFI_SYSTEM_TABLE.ConOut]
|
||||||
mov eax, [eax]
|
|
||||||
mov [pConOut], eax
|
mov [pConOut], eax
|
||||||
|
|
||||||
mov ecx, [eax + EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset]
|
mov edx, [eax + EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset]
|
||||||
mov [fnOutputReset], ecx
|
mov [fnOutputReset], edx
|
||||||
|
|
||||||
mov ecx, [eax + EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString]
|
mov edx, [eax + EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString]
|
||||||
mov [fnOutputStr], ecx
|
mov [fnOutputStr], edx
|
||||||
|
|
||||||
mov eax, [pRuntimeServices]
|
mov edx, [eax + EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute]
|
||||||
mov ecx, [eax + EFI_RUNTIMES_SERVICES.GetTime]
|
mov [fnSetAttribute], edx
|
||||||
mov [fnGetTime], ecx
|
|
||||||
|
|
||||||
push 1
|
mov eax, [pEfiRuntimeServices]
|
||||||
push [pConOut]
|
mov eax, [eax + EFI_RUNTIMES_SERVICES.GetTime]
|
||||||
call [fnOutputReset]
|
mov [fnGetTime], eax
|
||||||
add esp, 8
|
|
||||||
|
|
||||||
|
EFI_CALL [fnOutputReset], [pConOut], 1
|
||||||
|
EFI_CALL [fnSetAttribute], [pConOut], EFI_LIGHTGRAY
|
||||||
|
|
||||||
|
EFI_CALL [fnOutputStr], [pConOut], szBanner
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
efi_log_hex:
|
||||||
|
push ebp
|
||||||
|
mov ebp, esp
|
||||||
|
push edi
|
||||||
|
|
||||||
|
mov edi, eax
|
||||||
|
mov eax, szHexPrefix
|
||||||
|
EFI_CALL [fnOutputStr], [pConOut], szHexPrefix
|
||||||
|
|
||||||
|
xor ecx, ecx
|
||||||
|
@@:
|
||||||
|
cmp ecx, 16
|
||||||
|
je @f
|
||||||
|
rol edi, 4
|
||||||
|
mov eax, edi
|
||||||
|
and eax, 0xF
|
||||||
|
shl eax, 1
|
||||||
|
mov ax, [sDigit + eax]
|
||||||
|
mov [szLogBuffer + ecx], ax
|
||||||
|
add ecx, 2
|
||||||
|
jmp @b
|
||||||
|
|
||||||
|
@@:
|
||||||
|
mov [szLogBuffer + ecx], word 0
|
||||||
|
EFI_CALL [fnOutputStr], [pConOut], szLogBuffer
|
||||||
|
|
||||||
|
pop edi
|
||||||
|
leave
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;; Function: efi_log_time
|
;; Function: efi_log_time
|
||||||
efi_log_time:
|
efi_log_time:
|
||||||
; GetTime(EFI_TIME *time, EFI_TIME_CAPS *cap)
|
; GetTime(EFI_TIME *time, EFI_TIME_CAPS *cap)
|
||||||
push 0
|
EFI_CALL [fnGetTime], stEfiTime, 0
|
||||||
push stEfiTime
|
|
||||||
call [fnGetTime]
|
|
||||||
add esp, 8
|
|
||||||
|
|
||||||
; Hours
|
; Hours
|
||||||
mov al, [stEfiTime + EFI_TIME.Hour]
|
mov al, [stEfiTime + EFI_TIME.Hour]
|
||||||
|
@ -79,43 +161,105 @@ efi_log_time:
|
||||||
movzx cx, ah
|
movzx cx, ah
|
||||||
mov [szTime + 16], cx
|
mov [szTime + 16], cx
|
||||||
|
|
||||||
push szTime
|
EFI_CALL [fnOutputStr], [pConOut], szTime
|
||||||
push [pConOut]
|
|
||||||
call [fnOutputStr]
|
|
||||||
add esp, 8
|
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;; Function: efi_log
|
;; Function: efi_log
|
||||||
;;
|
;;
|
||||||
;; In:
|
;; In:
|
||||||
;; ESI - string to print
|
;; EAX - string to print
|
||||||
efi_log:
|
efi_log:
|
||||||
call efi_log_time
|
push ebp
|
||||||
|
mov ebp, esp
|
||||||
|
|
||||||
push esi
|
push esi
|
||||||
push [pConOut]
|
push edi
|
||||||
call [fnOutputStr]
|
push ebx
|
||||||
add esp, 8
|
|
||||||
|
|
||||||
|
mov esi, eax
|
||||||
|
mov edi, eax
|
||||||
|
lea ebx, [ebp + 8]
|
||||||
|
|
||||||
|
call efi_log_time
|
||||||
|
|
||||||
|
.loop:
|
||||||
|
mov dx, [edi]
|
||||||
|
or dx, dx
|
||||||
|
jz .end
|
||||||
|
|
||||||
|
cmp dx, '%'
|
||||||
|
jne .next
|
||||||
|
|
||||||
|
mov word [edi], 0
|
||||||
|
EFI_CALL [fnOutputStr], [pConOut], esi
|
||||||
|
add edi, 2
|
||||||
|
mov esi, edi
|
||||||
|
mov dx, [edi]
|
||||||
|
|
||||||
|
; check if another '%'
|
||||||
|
cmp dx, '%'
|
||||||
|
je .next
|
||||||
|
|
||||||
|
; check string format
|
||||||
|
cmp dx, 's'
|
||||||
|
jne @f
|
||||||
|
EFI_CALL [fnOutputStr], [pConOut], [ebx]
|
||||||
|
add esi, 2
|
||||||
|
add ebx, 4
|
||||||
|
jmp .next
|
||||||
|
|
||||||
|
; check if hex format
|
||||||
|
@@:
|
||||||
|
cmp dx, 'x'
|
||||||
|
jne @f
|
||||||
|
mov eax, [ebx]
|
||||||
|
call efi_log_hex
|
||||||
|
add esi, 2
|
||||||
|
add ebx, 4
|
||||||
|
jmp .next
|
||||||
|
|
||||||
|
; unknown format
|
||||||
|
@@:
|
||||||
|
mov dx, '?'
|
||||||
|
mov [edi], dx
|
||||||
|
|
||||||
|
.next:
|
||||||
|
add edi, 2
|
||||||
|
jmp .loop
|
||||||
|
.end:
|
||||||
|
|
||||||
|
mov dx, [esi]
|
||||||
|
or dx, dx
|
||||||
|
jz @f
|
||||||
|
EFI_CALL [fnOutputStr], [pConOut], esi
|
||||||
|
@@:
|
||||||
; print CRLF
|
; print CRLF
|
||||||
push szEndLine
|
EFI_CALL [fnOutputStr], [pConOut], szEndLine
|
||||||
push [pConOut]
|
|
||||||
call [fnOutputStr]
|
|
||||||
add esp, 8
|
|
||||||
|
|
||||||
|
pop ebx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
|
||||||
|
leave
|
||||||
ret
|
ret
|
||||||
|
|
||||||
section '.data' data readable writable
|
section '.data' data readable writable
|
||||||
|
|
||||||
szTime du '[00:00:00] ', 0
|
szTime du '[00:00:00] ', 0
|
||||||
szEndLine du CR, LF, 0
|
szEndLine du CR, LF, 0
|
||||||
|
szBanner du 0x2554, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2557 , CR, LF, \
|
||||||
|
0x2551, ' ', 'S', 't', 'u', 'p', 'i', 'd', ' ', 'L', 'o', 'a', 'd', 'e', 'r', ' ', 0x2551 , CR, LF, \
|
||||||
|
0x255a, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x2550, 0x255d , CR, LF, 0
|
||||||
|
szHexPrefix du '0x', 0
|
||||||
|
sDigit du '0123456789ABCDEF'
|
||||||
|
szLogBuffer du '00000000', 0
|
||||||
;; Variable: pConOut
|
;; Variable: pConOut
|
||||||
;; Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
|
;; Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
|
||||||
pConOut dd ?
|
pConOut dd ?
|
||||||
fnOutputReset dd ?
|
fnOutputReset dd ?
|
||||||
fnOutputStr dd ?
|
fnOutputStr dd ?
|
||||||
|
fnSetAttribute dd ?
|
||||||
|
|
||||||
stEfiTime EFI_TIME
|
stEfiTime EFI_TIME
|
||||||
fnGetTime dd ?
|
fnGetTime dd ?
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
section '.text' code executable readable
|
section '.text' code executable readable
|
||||||
|
|
||||||
efi_memory_init:
|
efi_memory_init:
|
||||||
mov eax, [pBootServices]
|
mov eax, [pEfiBootServices]
|
||||||
mov ecx, [eax + EFI_BOOT_SERVICES.AllocatePool]
|
mov ecx, [eax + EFI_BOOT_SERVICES.AllocatePool]
|
||||||
mov [fnAllocatePool], ecx
|
mov [fnAllocatePool], ecx
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,88 @@
|
||||||
;; File: uefi.inc
|
;; File: uefi.inc
|
||||||
|
|
||||||
|
macro EFI_CALL fn, [arg] {
|
||||||
|
common
|
||||||
|
_ARGS = 0
|
||||||
|
reverse
|
||||||
|
match anything, arg \{
|
||||||
|
_ARGS = _ARGS + 4
|
||||||
|
push dword arg
|
||||||
|
\}
|
||||||
|
common
|
||||||
|
call fn
|
||||||
|
if _ARGS
|
||||||
|
add esp, _ARGS
|
||||||
|
end if
|
||||||
|
}
|
||||||
|
|
||||||
|
macro EFI_GET_INTERFACE reg, interface {
|
||||||
|
if interface in <ConsoleInHandle,ConIn,ConsOutHandle,ConOut,StandardErrorHandle,StdErr>
|
||||||
|
mov reg, [pEfiSystemTable]
|
||||||
|
mov reg, [reg + EFI_SYSTEM_TABLE.#interface]
|
||||||
|
end if
|
||||||
|
}
|
||||||
|
|
||||||
|
macro EFI_INIT handle, table {
|
||||||
|
local efi_init_bad
|
||||||
|
local efi_init_end
|
||||||
|
clc
|
||||||
|
; image handle
|
||||||
|
mov eax, handle
|
||||||
|
or eax, eax
|
||||||
|
jz efi_init_bad
|
||||||
|
mov [hEfiImage], eax
|
||||||
|
mov eax, table
|
||||||
|
mov [pEfiSystemTable], eax
|
||||||
|
|
||||||
|
mov edx, [eax + EFI_SYSTEM_TABLE.BootServices]
|
||||||
|
mov [pEfiBootServices], edx
|
||||||
|
|
||||||
|
mov edx, [eax + EFI_SYSTEM_TABLE.RuntimeServices]
|
||||||
|
mov [pEfiRuntimeServices], edx
|
||||||
|
|
||||||
|
jmp efi_init_end
|
||||||
|
efi_init_bad:
|
||||||
|
stc
|
||||||
|
efi_init_end:
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_SUCCESS = 0x0
|
||||||
|
EFI_ERR = 0x80000000
|
||||||
|
|
||||||
|
EFI_LOAD_ERROR = (EFI_ERR or 1)
|
||||||
|
EFI_INVALID_PARAMETER = (EFI_ERR or 2)
|
||||||
|
EFI_UNSUPPORTED = (EFI_ERR or 3)
|
||||||
|
EFI_BAD_BUFFER_SIZE = (EFI_ERR or 4)
|
||||||
|
EFI_BUFFER_TOO_SMALL = (EFI_ERR or 5)
|
||||||
|
EFI_NOT_READY = (EFI_ERR or 6)
|
||||||
|
EFI_DEVICE_ERROR = (EFI_ERR or 7)
|
||||||
|
EFI_WRITE_PROTECTED = (EFI_ERR or 8)
|
||||||
|
EFI_OUT_OF_RESOURCEs = (EFI_ERR or 9)
|
||||||
|
EFI_VOLUME_CORRUPTED = (EFI_ERR or 10)
|
||||||
|
EFI_VOLUME_FULL = (EFI_ERR or 11)
|
||||||
|
EFI_NO_MEDIA = (EFI_ERR or 12)
|
||||||
|
EFI_MEDIA_CHANGED = (EFI_ERR or 13)
|
||||||
|
EFI_NOT_FOUND = (EFI_ERR or 14)
|
||||||
|
EFI_ACCESS_DEBIED = (EFI_ERR or 15)
|
||||||
|
EFI_NO_RESPONSE = (EFI_ERR or 16)
|
||||||
|
EFI_NO_MAPPING = (EFI_ERR or 17)
|
||||||
|
EFI_TIMEOUT = (EFI_ERR or 18)
|
||||||
|
EFI_NOT_STARTED = (EFI_ERR or 19)
|
||||||
|
EFI_ALREADY_STARTED = (EFI_ERR or 20)
|
||||||
|
EFI_ABORTED = (EFI_ERR or 21)
|
||||||
|
EFI_ICMP_ERROR = (EFI_ERR or 22)
|
||||||
|
EFI_TFTP_ERROR = (EFI_ERR or 23)
|
||||||
|
EFI_PROTOCOL_ERROR = (EFI_ERR or 24)
|
||||||
|
EFI_INCOMPATIBLE_VERSION = (EFI_ERR or 25)
|
||||||
|
EFI_SECURITY_VIOLATION = (EFI_ERR or 26)
|
||||||
|
EFI_CRC_ERROR = (EFI_ERR or 27)
|
||||||
|
EFI_END_OF_MEDIA = (EFI_ERR or 28)
|
||||||
|
EFI_END_OF_FILE = (EFI_ERR or 31)
|
||||||
|
EFI_INVALID_LANGUAGE = (EFI_ERR or 32)
|
||||||
|
EFI_COMPROMISED_DATA = (EFI_ERR or 33)
|
||||||
|
EFI_IP_ADDRESS_CONFLICT = (EFI_ERR or 34)
|
||||||
|
EFI_HTTP_ERROR = (EFI_ERR or 35)
|
||||||
|
|
||||||
struc BOOLEAN
|
struc BOOLEAN
|
||||||
{
|
{
|
||||||
. db ?
|
. db ?
|
||||||
|
@ -58,14 +141,6 @@ struc UINTPTR
|
||||||
. dd ?
|
. dd ?
|
||||||
}
|
}
|
||||||
|
|
||||||
struc EFI_GUID
|
|
||||||
{
|
|
||||||
.Data1 dd ?
|
|
||||||
.Data2 dw ?
|
|
||||||
.Data3 dw ?
|
|
||||||
.Data4 db 8 dup(?)
|
|
||||||
}
|
|
||||||
|
|
||||||
struc EFI_TIME
|
struc EFI_TIME
|
||||||
{
|
{
|
||||||
.Year UINT16
|
.Year UINT16
|
||||||
|
@ -212,6 +287,17 @@ struc EFI_BOOT_SERVICES
|
||||||
}
|
}
|
||||||
DEFN EFI_BOOT_SERVICES
|
DEFN EFI_BOOT_SERVICES
|
||||||
|
|
||||||
|
EFI_LOCATE_SEARCH_ALL_HANDLES = 0x0
|
||||||
|
EFI_LOCATE_SEARCH_BY_REGISTER_NOTIFY = 0x1
|
||||||
|
EFI_LOCATE_SEARCH_BY_PROTOCOL = 0x2
|
||||||
|
|
||||||
|
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL = 0x00000001
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL = 0x00000002
|
||||||
|
EFI_OPEN_PROTOCOL_TEST_PROTOCOL = 0x00000004
|
||||||
|
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER = 0x00000008
|
||||||
|
EFI_OPEN_PROTOCOL_BY_DRIVER = 0x00000010
|
||||||
|
EFI_OPEN_PROTOCOL_EXCLUSIVE = 0x00000020
|
||||||
|
|
||||||
;; ========================================================================
|
;; ========================================================================
|
||||||
;; EFI_RUNTIMES_SERVICES
|
;; EFI_RUNTIMES_SERVICES
|
||||||
;; ========================================================================
|
;; ========================================================================
|
||||||
|
@ -364,7 +450,7 @@ EFI_LOAD_FILE2_PROTOCOL equ EFI_LOAD_FILE_PROTOCOL
|
||||||
;; ========================================================================
|
;; ========================================================================
|
||||||
;; EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
|
;; EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
|
||||||
;; ========================================================================
|
;; ========================================================================
|
||||||
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID equ 0x022, 0x5b, 0x4e, 0x96, 0x59, 0x64, 0xd2, 0x11, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b
|
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID equ 0x22, 0x5b, 0x4e, 0x96, 0x59, 0x64, 0xd2, 0x11, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b
|
||||||
;EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID equ 0x0964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b
|
;EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID equ 0x0964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b
|
||||||
|
|
||||||
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION = 0x00010000
|
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION = 0x00010000
|
||||||
|
@ -417,3 +503,10 @@ EFI_FILE_RESERVED = 0x0000000000000008
|
||||||
EFI_FILE_DIRECTORY = 0x0000000000000010
|
EFI_FILE_DIRECTORY = 0x0000000000000010
|
||||||
EFI_FILE_ARCHIVE = 0x0000000000000020
|
EFI_FILE_ARCHIVE = 0x0000000000000020
|
||||||
EFI_FILE_VALID_ATTR = 0x0000000000000037
|
EFI_FILE_VALID_ATTR = 0x0000000000000037
|
||||||
|
|
||||||
|
section '.data' data readable writeable
|
||||||
|
|
||||||
|
hEfiImage dd 0
|
||||||
|
pEfiSystemTable dd 0
|
||||||
|
pEfiBootServices dd 0
|
||||||
|
pEfiRuntimeServices dd 0
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
TARGET = stpdldr.sys
|
TARGET = stpdldr.sys
|
||||||
|
|
||||||
|
COMMON_DIR = ../common
|
||||||
|
SYS_DIR = ../../kernel/sys
|
||||||
|
|
||||||
|
COMMON_SRCS = const.inc \
|
||||||
|
bootinfo.inc
|
||||||
|
|
||||||
|
SYS_SRCS = bootinfo.inc \
|
||||||
|
register.inc
|
||||||
|
|
||||||
LOADER_SRCS = loader.asm \
|
LOADER_SRCS = loader.asm \
|
||||||
../common/const.inc \
|
$(addprefix $(COMMON_DIR)/, $(COMMON_SRCS)) \
|
||||||
../common/bootinfo.inc \
|
$(addprefix $(SYS_DIR)/, $(SYS_SRCS)) \
|
||||||
../../kernel/sys/bootinfo.inc \
|
|
||||||
../../kernel/sys/register.inc \
|
|
||||||
fat.inc \
|
fat.inc \
|
||||||
video.inc \
|
video.inc \
|
||||||
memory.inc \
|
memory.inc \
|
||||||
|
@ -17,6 +24,8 @@ LOADER_SRCS = loader.asm \
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
|
%.inc: %.inc.in
|
||||||
|
sh $(TOOLSDIR)/version.sh $< $@
|
||||||
|
|
||||||
stpdldr.sys: $(LOADER_SRCS)
|
stpdldr.sys: $(LOADER_SRCS)
|
||||||
$(AS) loader.asm $@
|
$(AS) loader.asm $@
|
||||||
|
|
Loading…
Add table
Reference in a new issue