From 9e21256a9103dc92035bdef940b342522ea3efb3 Mon Sep 17 00:00:00 2001 From: Jonas Hvid Date: Sun, 8 Mar 2020 14:39:22 +0100 Subject: [PATCH] Add notes about loading files from disk --- README.md | 2 +- uefi/Makefile | 6 +++++- uefi/main.asm | 9 +++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8d3d026..39b9eb6 100644 --- a/README.md +++ b/README.md @@ -286,10 +286,10 @@ Notable sections: * 7\. Services - Boot Services (140) * 8\. Services - Runtime Services (228) * 12\. Protocols - Console Support (429) +* 13\. Protocols - Media Access (493) * Appendix B - Console (2201) * Appendix D - Status Codes (2211) - ## Resources * [UEFI - OSDev Wiki](https://wiki.osdev.org/UEFI) diff --git a/uefi/Makefile b/uefi/Makefile index 1d55f08..aeff045 100644 --- a/uefi/Makefile +++ b/uefi/Makefile @@ -1,5 +1,5 @@ .PHONY: qemu -qemu: out/main OVMF_CODE.fd OVMF_VARS.fd +qemu: out/main out/hello OVMF_CODE.fd OVMF_VARS.fd # Based on https://wiki.osdev.org/UEFI#Emulation_with_QEMU_and_OVMF qemu-system-x86_64 -cpu qemu64 \ -drive if=pflash,format=raw,unit=0,file=OVMF_CODE.fd,readonly=on \ @@ -18,6 +18,10 @@ out/main: main.asm mkdir -p out fasm $< out/main +out/hello: + mkdir -p out + echo -e "Hello!\nThis is a test." > out/hello + .PHONY: clean clean: rm -f main diff --git a/uefi/main.asm b/uefi/main.asm index 62b81df..431a64c 100644 --- a/uefi/main.asm +++ b/uefi/main.asm @@ -11,8 +11,13 @@ entry main ;; - This should allow the user to type in a string, and then feed the ;; buffer to us one character at a time. ;; - [ ] We want to show the user's input on the screen while reading +;; - [ ] Read a file that was bundled with the program +;; - It looks like we can use EFI_LOAD_FILE_PROTOCOL.LoadFile() to load +;; a file into a buffer. In order to be able to use this, we need to +;; have some way of interpreting a static buffer instead of reading as +;; we go. -;; #region Structs +;; EFI struct definitions {{{ EFI_NOT_READY = 0x8000_0000_0000_0000 or 6 @@ -65,7 +70,7 @@ struc EFI_INPUT_KEY { } struct EFI_INPUT_KEY -;; #endregion +;; }}} section '.text' code executable readable -- 2.39.2