annotate cos/kernel/asmcode.asm @ 21:66e9c332c845

Forgot crucial adjustment to idt pointer
author windel
date Tue, 29 Nov 2011 19:32:31 +0100
parents 6129643f5c34
children d3c4bf3720a3
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
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
8 global halt
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
9 halt:
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
10 cli
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
11 hlt
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
12
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
13 global magicBochsBreak
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
14 magicBochsBreak:
21
66e9c332c845 Forgot crucial adjustment to idt pointer
windel
parents: 18
diff changeset
15 xchg bx, bx
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
16 ret
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
17
14
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
18 global loadIDT
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
19 loadIDT:
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
20 extern idtP
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
21 ; TODO: make this pointer thing more insightfull:
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
22 ;xchg bx, bx ; For debugging with bochs
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
23 lidt [idtP]
14
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
24 ret
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
25
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
26 %macro pushAll 0
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
27 push rax
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
28 push rcx
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
29 push rdx
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
30 push rbx
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
31 push rbp
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
32 push rsi
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
33 push rdi
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
34 %endmacro
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
35
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
36 %macro popAll 0
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
37 pop rdi
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
38 pop rsi
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
39 pop rbp
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
40 pop rbx
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
41 pop rdx
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
42 pop rcx
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
43 pop rax
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
44 %endmacro
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
45
14
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
46 ; Define macro with two arguments:
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
47 %macro INTX 2
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
48 global %1
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
49 %1:
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
50 ; Do some saving:
18
6129643f5c34 Fixed interrupt issue, ds, es, ss, fs and gs were not initialized to 0
windel
parents: 17
diff changeset
51 cli
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
52 pushAll
18
6129643f5c34 Fixed interrupt issue, ds, es, ss, fs and gs were not initialized to 0
windel
parents: 17
diff changeset
53 ;xchg bx,bx
6129643f5c34 Fixed interrupt issue, ds, es, ss, fs and gs were not initialized to 0
windel
parents: 17
diff changeset
54
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
55 extern %2
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
56 call %2
14
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
57 ; Do restoration
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
58 popAll
18
6129643f5c34 Fixed interrupt issue, ds, es, ss, fs and gs were not initialized to 0
windel
parents: 17
diff changeset
59 ;xchg bx, bx
6129643f5c34 Fixed interrupt issue, ds, es, ss, fs and gs were not initialized to 0
windel
parents: 17
diff changeset
60 sti
17
f3e3e0e9c4bc First attempt IDT loader 64 bits. INT13 occurs
windel
parents: 14
diff changeset
61 iretq
14
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
62
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
63 %endmacro
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
64
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
65 ; Exception handlers:
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
66 INTX INTDEF, INTDEF_handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
67 INTX INT0, INT0handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
68 INTX INT1, INT1handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
69 INTX INT2, INT2handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
70 INTX INT3, INT3handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
71 INTX INT4, INT4handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
72 INTX INT5, INT5handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
73 INTX INT6, INT6handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
74 INTX INT7, INT7handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
75 INTX INT8, INT8handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
76 INTX INT9, INT9handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
77 INTX INT10, INT10handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
78 INTX INT11, INT11handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
79 INTX INT12, INT12handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
80 INTX INT13, INT13handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
81 INTX INT14, INT14handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
82 INTX INT15, INT15handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
83 INTX INT16, INT16handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
84 INTX INT17, INT17handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
85 INTX INT18, INT18handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
86 INTX INT19, INT19handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
87
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
88 INTX INT32, INT32handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
89 INTX INT33, INT33handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
90 INTX INT34, INT34handler
a58904747019 Added asm interrupt handler things, not yet working
windel
parents:
diff changeset
91