Add a skeleton file for eventual assembly port of hex0.

This commit is contained in:
Andrius Štikonas 2022-07-10 16:05:05 +01:00
parent 571ea5e8f0
commit 081a890e05
4 changed files with 47 additions and 1 deletions

6
.gitignore vendored
View File

@ -1,4 +1,8 @@
# SPDX-License-Identifier: MIT
*~
Development/build/
*/build/
*.d
*.lib
*.efi
*.o

View File

@ -0,0 +1,5 @@
# kaem
# Rebuild hex0
EFI\BOOT\hex0.efi hex0_AMD64_POSIX.hex0 hex0 # hex0

View File

@ -0,0 +1,23 @@
# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
#
# SPDX-License-Identifier: GPL-3.0-or-later
cc = clang
cflags = -ffreestanding -MMD -mno-red-zone -std=c11 -target x86_64-unknown-windows
ld = lld-link
lflags = -subsystem:efi_application -nodefaultlib -dll
build = build
all: $(build)/hex0.efi
$(build)/%.o : %.S
mkdir -p $(build)
$(cc) $(cflags) -c $< -o $@
$(build)/%.efi : $(build)/%.o
$(ld) $(lflags) -entry:efi_main $< -out:$@
. PHONY : clean all
clean:
rm -f $(build)

14
amd64/Development/hex0.S Normal file
View File

@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
#
# SPDX-License-Identifier: GPL-3.0-or-later
.text
.globl efi_main
efi_main:
sub $16, %rsp
mov %rdx, 8(%rsp)
mov %rcx, (%rsp)
mov $42, %eax
add $16, %rsp
ret