-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasm.s
More file actions
executable file
·81 lines (75 loc) · 1.47 KB
/
asm.s
File metadata and controls
executable file
·81 lines (75 loc) · 1.47 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
.global out,in,outw,inw,indw,outdw,adjust_kernel_stack,syscall
.section .text
# void out(unsigned char value,unsigned int address)
out:
push %rbp
mov %rsp,%rbp
# Da calling convention non dovrebbe essere necessario preservare edx e eax (vedi OSDev)
# Verificare cosa succede disassemblando kernel.bin
# push %edx
# push %eax
mov %edi,%eax # value
mov %esi,%edx # address
out %al,%dx
# pop %eax
# pop %edx
pop %rbp
ret
# unsigned char in(unsigned int address)
in:
push %rbp
mov %rsp,%rbp
# push %edx
mov %edi,%edx # address
in %dx,%al
# pop %edx
pop %rbp
ret
# void out(unsigned short value,unsigned int address)
outw:
push %rbp
mov %rsp,%rbp
# push %edx
# push %eax
mov %edi,%eax # value
mov %esi,%edx # address
out %ax,%dx
# pop %eax
# pop %edx
pop %rbp
ret
# unsigned short in(unsigned int address)
inw:
push %rbp
mov %rsp,%rbp
# push %edx
mov $0x0,%eax
mov %edi,%edx # address
in %dx,%ax
# pop %edx
pop %rbp
ret
# void outdw(unsigend int value,unsigned int address)
outdw:
push %rbp
mov %rsp,%rbp
# push %edx
# push %eax
mov %edi,%eax # value
mov %esi,%edx # address
outl %eax,%dx
# pop %eax
# pop %edx
pop %rbp
ret
# unsigned int indw(unsigned int address)
indw:
push %rbp
mov %rsp,%rbp
# push %edx
mov $0x0,%eax
mov %edi,%edx # address
inl %dx,%eax
# pop %edx
pop %rbp
ret