-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.asm
60 lines (40 loc) · 1.03 KB
/
main.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
format PE64 dll EFI
; align37Must âûçûâàòü íå îáÿçàòåëüíî. Ýòî ÷èñòî ïî ïðèêîëó
stack 65536*2
entry EntryPoint
section '.text' code readable executable
include 'uefi_ini.asm'
align37Must 16
; RCX, RDX, R8 and R9
EntryPoint:
; Ñîõðàíÿåì ðåãèñòðû, êîòîðûå äîëæíû ñîõðàíèòü ïî calling convention,
; åñëè áóäåì ïåðåäàâàòü óïðàâëåíèå íàçàä â UEFI (åñëè ìû íå çàãðóæàåì ÎÑ)
call saveRegisters
call init
jc error
;uefi_call_wrapper ConOut, OutputString, ConOut, BootString
mov rdx, BootStartString
call Console.Write
; Óáèðàåì 5-òèìèíóòíûé òàéìåð, êîòîðûé âåðí¸ò óïðàâëåíèå UEFI
call DisableWatchdogTimer
mov rdx, PressAnyKey
call Console.Write
call Console.WaitForKey
;mov rcx, 100
;call halt
; Âîññòàíàâëèâàåì ðåãèñðû, êîòîðûå äîëæíû âîññòàíîâèòü
call loadRegisters
xor rax, rax
RET
error:
call loadRegisters
mov rax, 0x8000000000000000
RET
align37Must 16
; rcx - êîëè÷åñòâî öèêëîâ îæèäàíèÿ
halt:
HLT
loop halt
RET
align37Must 512
include 'main_data.asm'