From 659cd8adbd940c4a7566cdc4a461ba05b5d2177c Mon Sep 17 00:00:00 2001 From: johannst Date: Sun, 30 May 2021 02:03:21 +0200 Subject: added long mode example with 4 level paging --- guest/guest64.S | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 guest/guest64.S (limited to 'guest/guest64.S') diff --git a/guest/guest64.S b/guest/guest64.S new file mode 100644 index 0000000..1862749 --- /dev/null +++ b/guest/guest64.S @@ -0,0 +1,17 @@ +.intel_syntax noprefix + +.section .boot, "ax", @progbits + // Trigger `KVM_EXIT_IO:KVM_EXIT_IO_OUT` by writing string to output port. + mov rdx, 0x1000 // Output port. + lea rsi, [rip + msg] // Address of string. + mov rcx, [rip + msg_len] // Len of string. + rep outsb // Write ds:rsi to output port rdx. + + // Trigger `KVM_EXIT_HLT`. + hlt + +.section .rodata, "a", @progbits +msg: + .asciz "Hello from Long Mode!\n" +msg_len: + .byte .-msg -- cgit v1.2.3