send serial to stdio

This commit is contained in:
Charles Perkins 2020-12-23 16:59:48 -08:00
parent 6b9516c67e
commit 1a33f7b382
3 changed files with 46 additions and 10 deletions

View file

@ -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

View file

@ -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

32
toe.asm Normal file
View file

@ -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 $