aboutsummaryrefslogtreecommitdiffhomepage
path: root/guest/guest16.S
blob: 7f0be0e1ddfadc48de76d821cfb124adc9f8c3c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
.code16
.intel_syntax noprefix

.section .boot, "ax", @progbits
    // Trigger `KVM_EXIT_IO:KVM_EXIT_IO_OUT` by writing string to output port.
    mov dx, 0x1000          // Output port.
    lea si, [msg]           // Address of string.
    mov cx, [msg_len]       // Len of string.
    rep outsb dx, ds:[si]   // Write out string bytes.

    // Trigger `KVM_EXIT_MMIO` by writing to non mapped physical address.
    mov byte ptr ds:[0x2000], 0xaa

    // Trigger `KVM_EXIT_HLT`.
    hlt

.section .rodata, "a", @progbits
msg:
    .asciz "Hello from Real Mode!\n"
msg_len:
    .byte .-msg