chore: sync repo

This commit is contained in:
d0p1 🏳️‍⚧️ 2024-09-08 12:01:20 +02:00
parent d1927d8180
commit aaf6fbccdf
8 changed files with 69 additions and 17 deletions

View file

@ -19,7 +19,7 @@ jobs:
- name: Run shellcheck
run: |
shellcheck ./releasetools/cdimage.sh ./releasetools/floppyimage.sh ./releasetools/hdimage.sh ./releasetools/image.defaults ./releasetools/image.functions
shellcheck ./releasetools/cdimage.sh ./releasetools/floppyimage.sh ./releasetools/hdimage.sh ./releasetools/image.defaults ./releasetools/image.functions ./tools/version.sh
- name: Run CppCheck
run: |

View file

@ -3,6 +3,8 @@ TARGET = BOOTIA32.EFI
BOOTIA32_EFI_SRCS = bootia32.asm \
uefi.inc \
logger.inc \
memory.inc \
fs.inc \
../common/const.inc \
../common/macro.inc

View file

@ -7,6 +7,8 @@
include 'uefi.inc'
include '../../kernel/sys/bootinfo.inc'
include 'logger.inc'
include 'memory.inc'
include 'fs.inc'
section '.text' code executable readable
@ -33,26 +35,20 @@ efimain:
mov ebx, [eax + EFI_SYSTEM_TABLE.BootServices]
mov [pBootServices], ebx
mov ecx, [ebx + EFI_BOOT_SERVICES.AllocatePool]
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
call efi_memory_init
call efi_log_init
mov esi, szHelloMsg
call efi_log
call efi_fs_init
; #=======================#
; search and load kernel
; openVolume()
@ -93,9 +89,6 @@ pSystemTable dd ?
;; Variable: pBootServices
pBootServices dd ?
fnAllocatePool dd ?
fnFreePool dd ?
fnGetMemoryMap dd ?
fnOpenProtocol dd ?
fnCloseProtocol dd ?
fnExit dd ?

29
boot/efi/fs.inc Normal file
View file

@ -0,0 +1,29 @@
;; File: fs.inc
section '.text' code executable readable
efi_fs_init:
; OpenProtocol(EFI_HANDLE Handle, EFI_GUID *proto, VOID **Interface, EFI_HANDLE AgentHandle, UINT32 Attrs)
push 0
push [hImage]
push pLoadedImage
push aFSProtoGUID
push [hImage]
call [fnOpenProtocol]
add esp, 20
or eax, eax
jnz .error
ret
.error:
mov esi, szErrTmp
call efi_log
ret
section '.data' data readable writeable
szErrTmp du "Can't OpenProtocol(Simple fs)", 0
aFSProtoGUID db EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID
pLoadedImage dd 0

View file

@ -1,3 +1,5 @@
;; File: logger.inc
section '.text' code executable readable
;; Function: efi_log_init

25
boot/efi/memory.inc Normal file
View file

@ -0,0 +1,25 @@
;; File: memory.inc
section '.text' code executable readable
efi_memory_init:
mov eax, [pBootServices]
mov ecx, [eax + EFI_BOOT_SERVICES.AllocatePool]
mov [fnAllocatePool], ecx
mov ecx, [eax + EFI_BOOT_SERVICES.FreePool]
mov [fnFreePool], ecx
mov ecx, [eax + EFI_BOOT_SERVICES.GetMemoryMap]
mov [fnGetMemoryMap], ecx
ret
section '.data' data readable writeable
;; Variable: fnAllocatePool
fnAllocatePool dd ?
;; Variable: fnFreePool
fnFreePool dd ?
;; Variable: fnGetMemoryMap
fnGetMemoryMap dd ?

View file

@ -364,7 +364,8 @@ EFI_LOAD_FILE2_PROTOCOL equ EFI_LOAD_FILE_PROTOCOL
;; ========================================================================
;; EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
;; ========================================================================
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 0x022, 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_REVISION = 0x00010000

View file

@ -2,12 +2,12 @@
vers="$(git describe --abbrev=4 --match='v[0-9]*' HEAD 2>/dev/null)"
if [ ! -n "$vers" ]; then
if [ -z "$vers" ]; then
vers="0.0"
fi
major="$(echo -n "${vers}" | cut -d. -f1)"
minor="$(echo -n "${vers}" | cut -d. -f1)"
major="$(printf "%s" "${vers}" | cut -d. -f1)"
minor="$(printf "%s" "${vers}" | cut -d. -f1)"
commit="$(git rev-parse --short HEAD)"