Made the KPanic routine switch back to 0xB8000 text mode
[tpg/acess2.git] / Kernel / arch / x86 / desctab.asm
index 969752c..43bd8e4 100644 (file)
@@ -3,10 +3,10 @@
 ; desctab.asm
 [BITS 32]
 
-%if ARCH == "i386"
-MAX_CPUS       equ     1
-%else
+%if USE_MP
 MAX_CPUS       equ     8
+%else
+MAX_CPUS       equ     1
 %endif
 GDT_SIZE       equ     (1+2*2+1+MAX_CPUS)*8
 
@@ -21,24 +21,28 @@ gGDT:
        dd 0x0000FFFF, 0x00CF9200       ; 10 PL0 Data
        dd 0x0000FFFF, 0x00CFFA00       ; 18 PL3 Code
        dd 0x0000FFFF, 0x00CFF200       ; 20 PL3 Data
-       dd 0, 0 ; Double Fault TSS
-       times MAX_CPUS  dd 0, 0
-gGDTptr:
+       dd 26*4-1, 0x00408900   ; Double Fault TSS
+       times MAX_CPUS  dd 26*4-1, 0x00408900
+[global gGDTPtr]
+gGDTPtr:
        dw      GDT_SIZE-1
        dd      gGDT
 ; IDT
 ALIGN 8
+[global gIDT]
 gIDT:
        times   256     dd      0x00080000,0x00000F00
+[global gIDTPtr]
 gIDTPtr:
        dw      256 * 16 - 1    ; Limit
        dd      gIDT            ; Base
 
 [section .text]
+
 [global Desctab_Install]
 Desctab_Install:
        ; Set GDT
-       lgdt [gGDTptr]
+       lgdt [gGDTPtr]
        mov ax, 0x10    ; PL0 Data
        mov ss, ax
        mov ds, ax
@@ -143,7 +147,6 @@ Isr%1:
 %macro DEF_IRQ 1
 [global Isr%1]
 Isr%1:
-       ;cli    ; HACK!
        push    0
        push    %1
        jmp     IRQCommon
@@ -202,12 +205,19 @@ Isr240:
 ; ---------------------
 [extern ErrorHandler]
 ErrorCommon:
+       ;xchg bx, bx
        pusha
        push ds
        push es
        push fs
        push gs
        
+       mov ax, 0x10
+       mov ds, ax
+       mov es, ax
+       mov fs, ax
+       mov gs, ax
+       
        push esp
        call ErrorHandler
        add esp, 4
@@ -254,6 +264,12 @@ IRQCommon:
        push fs
        push gs
        
+       mov ax, 0x10
+       mov ds, ax
+       mov es, ax
+       mov fs, ax
+       mov gs, ax
+       
        push esp
        call IRQ_Handler
        add esp, 4
@@ -277,6 +293,12 @@ SchedulerBase:
        push fs
        push gs
        
+       mov ax, 0x10
+       mov ds, ax
+       mov es, ax
+       mov fs, ax
+       mov gs, ax
+       
        mov eax, [esp+12*4]     ; CPU Number
        push eax        ; Pus as argument
        

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