MAX_CPUS := 4
CPPFLAGS := -DMAX_CPUS=$(MAX_CPUS)
-CFLAGS := $(KERNEL_CFLAGS)
+CFLAGS := $(KERNEL_CFLAGS) -mno-sse -mno-mmx
ASFLAGS := -f elf64 -D MAX_CPUS=$(MAX_CPUS)
LDFLAGS := -nostdlib -nodefaultlibs
Uint32 Rsvd3[2];
Uint16 Rsvd4;
Uint16 IOMapBase;
-
- // Acess Specific Fields
- Uint8 CPUNumber; // CPU Number
} __attribute__ ((packed)) tTSS;
#endif
#else
pos = 0;
#endif
- gTSSs[pos].CPUNumber = pos;
gTSSs[pos].RSP0 = 0; // Set properly by scheduler
- gGDT[6+pos*2].BaseLow = ((Uint)(&gTSSs[pos])) & 0xFFFF;
- gGDT[6+pos*2].BaseMid = ((Uint)(&gTSSs[pos])) >> 16;
- gGDT[6+pos*2].BaseHi = ((Uint)(&gTSSs[pos])) >> 24;
- gGDT[6+pos*2+1].DWord[0] = ((Uint)(&gTSSs[pos])) >> 32;
+ gGDT[7+pos*2].LimitLow = sizeof(tTSS) & 0xFFFF;
+ gGDT[7+pos*2].BaseLow = ((Uint)(&gTSSs[pos])) & 0xFFFF;
+ gGDT[7+pos*2].BaseMid = ((Uint)(&gTSSs[pos])) >> 16;
+ gGDT[7+pos*2].BaseHi = ((Uint)(&gTSSs[pos])) >> 24;
+ gGDT[7+pos*2+1].DWord[0] = ((Uint)(&gTSSs[pos])) >> 32;
#if USE_MP
}
for(pos=0;pos<giNumCPUs;pos++) {
#endif
- __asm__ __volatile__ ("ltr %%ax"::"a"(0x30+pos*8));
+ __asm__ __volatile__ ("ltr %%ax"::"a"(0x38+pos*16));
#if USE_MP
}
#endif
dd 0x00000000, 0x0000F200 ; 0x20: 64-bit User Data
dd 0x00000000, 0x0040FA00 ; 0x38: 32-bit User Code
dd 0x00000000, 0x0040F200 ; 0x30: 32-bit User Data
- times MAX_CPUS dd 0, 0, 0, 0 ; 0x38+16*n: TSS 0
+ times MAX_CPUS dd 0x00008900, 0, 0, 0 ; 0x38+16*n: TSS 0
gGDTPtr:
dw $-gGDT-1
dd gGDT-KERNEL_BASE
[global GetCPUNum]
GetCPUNum:
- str ax
- mov gs, ax
xor rax, rax
- mov al, [gs:104] ; End of TSS
+ str ax
+ sub ax, 0x38 ; TSS Base
+ shr ax, 4 ; One 16-byte TSS per CPU
ret
KSTACK_USERSTATE_SIZE equ (16+1+5)*8 ; GPRegs, CPU, IRET