50 lines
706 B
Plaintext
50 lines
706 B
Plaintext
section .rodata
|
|
|
|
invalid_idt:
|
|
dd 0, 0
|
|
|
|
section .text
|
|
|
|
extern flush_irqs
|
|
|
|
global common_spinup
|
|
bits 32
|
|
common_spinup:
|
|
cli
|
|
|
|
lidt [invalid_idt]
|
|
|
|
call flush_irqs
|
|
|
|
xor eax, eax
|
|
lldt ax
|
|
|
|
; We don't need the return address
|
|
add esp, 4
|
|
|
|
; Get function address
|
|
pop edi
|
|
|
|
; We don't need the argument count
|
|
add esp, 4
|
|
|
|
mov eax, 0x00000011
|
|
mov cr0, eax
|
|
|
|
xor eax, eax
|
|
mov cr4, eax
|
|
mov cr3, eax
|
|
|
|
; Clear TSS busy bit and load TR with base 0, limit 0
|
|
sub esp, 8
|
|
sgdt [esp]
|
|
mov eax, [esp + 2]
|
|
add esp, 8
|
|
mov byte [eax + 0x3d], 0x89
|
|
mov ax, 0x38
|
|
ltr ax
|
|
|
|
call edi
|
|
|
|
section .note.GNU-stack noalloc noexec nowrite progbits
|