annotate cos/kernel/asmcode.asm @ 29:7e3bdcb391dc

Added get_page function to mm
author windel
date Thu, 29 Dec 2011 19:34:01 +0100
parents 47b7df514243
children 88590c42320f
rev   line source
14
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
1 ; The default interrupt handlers.
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
2 ; from 20 - 31 are reserved vectors.
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
3 ; below are the custom ones!
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
4
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
5 section .text
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
6 align 4
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
7
25
d3c4bf3720a3 Beginning of multitasking
windel
parents: 21
diff changeset
8 ; Function to read the current instruction pointer value:
d3c4bf3720a3 Beginning of multitasking
windel
parents: 21
diff changeset
9 global read_rip
d3c4bf3720a3 Beginning of multitasking
windel
parents: 21
diff changeset
10 read_rip:
d3c4bf3720a3 Beginning of multitasking
windel
parents: 21
diff changeset
11 pop rax
d3c4bf3720a3 Beginning of multitasking
windel
parents: 21
diff changeset
12 jmp rax
d3c4bf3720a3 Beginning of multitasking
windel
parents: 21
diff changeset
13
14
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
14 global loadIDT
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
15 loadIDT:
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
16 extern idtP
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
17 ; TODO: make this pointer thing more insightfull:
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
18 lidt [idtP]
14
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
19 ret
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
20
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
21 %macro pushAll 0
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
22 push rax
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
23 push rcx
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
24 push rdx
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
25 push rbx
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
26 push rbp
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
27 push rsi
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
28 push rdi
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
29 %endmacro
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
30
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
31 %macro popAll 0
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
32 pop rdi
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
33 pop rsi
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
34 pop rbp
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
35 pop rbx
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
36 pop rdx
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
37 pop rcx
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
38 pop rax
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
39 %endmacro
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
40
14
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
41 ; Define macro with two arguments:
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
42 %macro INTX 2
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
43 global %1
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
44 %1:
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
45 ; Do some saving:
18
6129643f5c34 Fixed interrupt issue, ds, es, ss, fs and gs were not initialized to 0
windel
parents: 17
diff changeset
46 cli
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
47 pushAll
18
6129643f5c34 Fixed interrupt issue, ds, es, ss, fs and gs were not initialized to 0
windel
parents: 17
diff changeset
48 ;xchg bx,bx
6129643f5c34 Fixed interrupt issue, ds, es, ss, fs and gs were not initialized to 0
windel
parents: 17
diff changeset
49
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
50 extern %2
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
51 call %2
14
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
52 ; Do restoration
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
53 popAll
18
6129643f5c34 Fixed interrupt issue, ds, es, ss, fs and gs were not initialized to 0
windel
parents: 17
diff changeset
54 ;xchg bx, bx
6129643f5c34 Fixed interrupt issue, ds, es, ss, fs and gs were not initialized to 0
windel
parents: 17
diff changeset
55 sti
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
56 iretq
14
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
57
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
58 %endmacro
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
59
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
60 ; Exception handlers:
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
61 INTX INTDEF, INTDEF_handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
62 INTX INT0, INT0handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
63 INTX INT1, INT1handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
64 INTX INT2, INT2handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
65 INTX INT3, INT3handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
66 INTX INT4, INT4handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
67 INTX INT5, INT5handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
68 INTX INT6, INT6handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
69 INTX INT7, INT7handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
70 INTX INT8, INT8handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
71 INTX INT9, INT9handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
72 INTX INT10, INT10handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
73 INTX INT11, INT11handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
74 INTX INT12, INT12handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
75 INTX INT13, INT13handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
76 INTX INT14, INT14handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
77 INTX INT15, INT15handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
78 INTX INT16, INT16handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
79 INTX INT17, INT17handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
80 INTX INT18, INT18handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
81 INTX INT19, INT19handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
82
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
83 INTX INT32, INT32handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
84 INTX INT33, INT33handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
85 INTX INT34, INT34handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
86