Working on separating architecture dependent and independent stuff,
[tpg/acess2.git] / Kernel / arch / x86_64 / desctab.asm
1 ;
2 ;
3 ;
4 [BITS 64]
5
6 MM_LOCALAPIC    equ     0xFFFFFD0000000000
7
8 [section .text]
9 Desctab_Init:
10         ; Install IRQ Handlers
11
12 [section .data]
13 gIDT:
14         times 256       dw      0x00080000, 0x00008E00, 0, 0    ; 64-bit Interrupt Gate, CS = 0x8, IST0
15
16 %macro DEFERR   1
17 Isr%1:
18         push    0
19         push    %1
20         jmp     ErrorCommon
21 %endmacro
22 %macro DEFERRNO 1
23 Isr%1:
24         push    %1
25         jmp     ErrorCommon
26 %endmacro
27
28 %macro DEFIRQ   1
29 Irq%1:
30         push    0
31         push    %1
32         jmp     IrqCommon
33 %endmacro
34
35 %macro PUSH_EX  1-*
36         %rep %0
37         push %1
38         %rotate 1
39         %endrep
40 %endmacro
41 %macro POP_EX   1-*
42         %rep %0
43         %rotate -1
44         pop %1
45         %endrep
46 %endmacro
47
48 %macro PUSH_GPR 0
49         PUSH_EX r15, r14, r13, r12, r11, r10, r9, r8
50         PUSH_EX rsi, rdi, rbp, rsp, rbx, rdx, rcx, rax
51 %endmacro
52 %macro POP_GPR  0
53         POP_EX  rsi, rdi, rbp, rsp, rbx, rdx, rcx, rax
54         POP_EX  r15, r14, r13, r12, r11, r10, r9, r8
55 %endmacro
56
57 [extern Proc_Scheduler]
58 SchedulerIRQ:
59         ; TODO: Find Current CPU
60         PUSH_GPR
61         ;PUSH_FPU
62         ;PUSH_XMM
63         
64         xor rsi, rsi
65         mov rdi, MM_LOCALAPIC+0x20
66         mov esi, [rdi]
67         call Proc_Scheduler
68         
69         ;POP_XMM
70         ;POP_FPU
71         POP_GPR
72         iret

UCC git Repository :: git.ucc.asn.au