Mercurial > lcfOS
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 | 1 ; The default interrupt handlers. |
2 ; from 20 - 31 are reserved vectors. | |
3 ; below are the custom ones! | |
4 | |
5 section .text | |
6 align 4 | |
7 | |
25 | 8 ; Function to read the current instruction pointer value: |
9 global read_rip | |
10 read_rip: | |
11 pop rax | |
12 jmp rax | |
13 | |
14 | 14 global loadIDT |
15 loadIDT: | |
17 | 16 extern idtP |
17 ; TODO: make this pointer thing more insightfull: | |
18 lidt [idtP] | |
14 | 19 ret |
20 | |
17 | 21 %macro pushAll 0 |
22 push rax | |
23 push rcx | |
24 push rdx | |
25 push rbx | |
26 push rbp | |
27 push rsi | |
28 push rdi | |
29 %endmacro | |
30 | |
31 %macro popAll 0 | |
32 pop rdi | |
33 pop rsi | |
34 pop rbp | |
35 pop rbx | |
36 pop rdx | |
37 pop rcx | |
38 pop rax | |
39 %endmacro | |
40 | |
14 | 41 ; Define macro with two arguments: |
42 %macro INTX 2 | |
43 global %1 | |
44 %1: | |
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 | 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 | 50 extern %2 |
51 call %2 | |
14 | 52 ; Do restoration |
17 | 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 | 56 iretq |
14 | 57 |
58 %endmacro | |
59 | |
60 ; Exception handlers: | |
61 INTX INTDEF, INTDEF_handler | |
62 INTX INT0, INT0handler | |
63 INTX INT1, INT1handler | |
64 INTX INT2, INT2handler | |
65 INTX INT3, INT3handler | |
66 INTX INT4, INT4handler | |
67 INTX INT5, INT5handler | |
68 INTX INT6, INT6handler | |
69 INTX INT7, INT7handler | |
70 INTX INT8, INT8handler | |
71 INTX INT9, INT9handler | |
72 INTX INT10, INT10handler | |
73 INTX INT11, INT11handler | |
74 INTX INT12, INT12handler | |
75 INTX INT13, INT13handler | |
76 INTX INT14, INT14handler | |
77 INTX INT15, INT15handler | |
78 INTX INT16, INT16handler | |
79 INTX INT17, INT17handler | |
80 INTX INT18, INT18handler | |
81 INTX INT19, INT19handler | |
82 | |
83 INTX INT32, INT32handler | |
84 INTX INT33, INT33handler | |
85 INTX INT34, INT34handler | |
86 |