8 sub rax, .after_call - start
9 mov rsi, rax ; source address
10 mov rdi, start ; destination
14 rep movsd ; copy code to make it absolute
21 ; switch to 32-bit compatibility long mode
42 DIV_9600 equ 115200 / 9600
45 FIFO_ENABLE_CLEAR equ 0x07
46 MCTL_DTR_RTS_OUT2 equ 0x0b
47 LST_TREG_EMPTY equ 0x20
65 ; clear and enable fifo
66 mov al, FIFO_ENABLE_CLEAR
70 mov al, MCTL_DTR_RTS_OUT2
75 str_hello db 'hello!',13,10,0
82 gdt: ; 0: null segment
84 ; 1: code - base:0, lim:4g, G:4k, 32bit, avl, pres|app, dpl:0, type:code/non-conf/rd
87 ; 2: data - base:0, lim:4g, G:4k, 32bit, avl, pres|app, dpl:0, type:data/rw
101 ; disable paging to deactivate long mode
106 ; disable long mode (EFER.LME = 0)
107 ; TODO: EFER is MSR c0000080, LME is bit 8
122 ; wait until transmit register is empty
125 and al, LST_TREG_EMPTY