From 1a33f7b382a81283380c4e58af8a3e90bb9ff130 Mon Sep 17 00:00:00 2001 From: Charles Perkins Date: Wed, 23 Dec 2020 16:59:48 -0800 Subject: [PATCH] send serial to stdio --- README.md | 6 +++++- shoe.asm | 18 +++++++++--------- toe.asm | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 toe.asm diff --git a/README.md b/README.md index 16a7d42..72015d0 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ bare-bones nasm uefi application build with: * nasm -f bin shoe.asm -o shoe.efi +* dd if=toe.bin of=shoe.efi bs=1 seek=20480 conv=notrunc * sudo mount disk.iso mnt * sudo cp shoe.efi mnt/EFI/BOOT/BOOTX64.EFI * sudo umount mnt @@ -10,9 +11,12 @@ build with: get asm listing with: * objdump -Mintel -d shoe.efi +show the bytes of the payload: +* hexdump -ve '1/1 "%.2x "' toe.bin + Launch QEMU with: -* /usr/bin/qemu-system-x86_64 -machine accel=kvm -name guest=uefiguest -machine pc,accel=kvm,usb=off,dump-guest-core=off -smp 2,sockets=2,cores=1,threads=1 -uuid 515645b7-ab3a-4e82-ba62-25751e4b523f -bios ./OVMF.fd -m 1G -vga qxl -spice port=5900,addr=127.0.0.1,disable-ticketing -drive file=disk.iso +* /usr/bin/qemu-system-x86_64 -machine accel=kvm -name guest=uefiguest -machine pc,accel=kvm,usb=off,dump-guest-core=off -smp 2,sockets=2,cores=1,threads=1 -uuid 515645b7-ab3a-4e82-ba62-25751e4b523f -bios ./OVMF.fd -m 1G -vga qxl -spice port=5900,addr=127.0.0.1,disable-ticketing -drive file=disk.iso -serial stdio Launch the Spice viewer with: * remote-viewer spice://localhost:5900 diff --git a/shoe.asm b/shoe.asm index b3cd445..83616e2 100644 --- a/shoe.asm +++ b/shoe.asm @@ -286,15 +286,15 @@ codesize equ $ - $$ section .data follows=.text -dmagic dq 0x1122334455667788 -Handle dq 0 -SystemTable dq 0 -Interface dq 0 -BS dq 0 -RTS dq 0 -STK dq 0 -FB dq 0 -FBS dq 0 +dmagic dq 0x1122334455667788 ;0 +Handle dq 0 ;8 +SystemTable dq 0 ;16 +Interface dq 0 ;24 +BS dq 0 ;32 +RTS dq 0 ;40 +STK dq 0 ;48 +FB dq 0 ;56 +FBS dq 0 ;64 HR dq 0 VR dq 0 PPS dq 0 diff --git a/toe.asm b/toe.asm new file mode 100644 index 0000000..4a6cb8e --- /dev/null +++ b/toe.asm @@ -0,0 +1,32 @@ +bits 64 +org 0x8005000 +section .text +global _start +_start: + +FB equ 0x8003000 + 56 +FBS equ 0x8003000 + 64 + +jmp begin + +dw 0 +dd 1 +dd 2 +dd 3 +dd 4 +dd 5 +dd 6 +dd 7 + +begin: +mov r8, 0x1111BBBB66660000 +mov rcx, [FB] +mov rax, [FBS] +Q: +sub rax, 8 +mov [rcx+rax],r8 +jnz Q + +jmp $ + +