X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fhal%2Fhalx86%2Fmp%2Fapic.c;h=651500a2f614ad118bd87123a9794a3ccd5baa73;hp=c74661fe16df640f6991eaa1c3e79095fc1a098f;hb=250d69afc8ac852f48e37da147132ea1f6268532;hpb=6182f013fe13ca650470cb9c2922037dff65ad50 diff --git a/reactos/hal/halx86/mp/apic.c b/reactos/hal/halx86/mp/apic.c index c74661fe16d..651500a2f61 100644 --- a/reactos/hal/halx86/mp/apic.c +++ b/reactos/hal/halx86/mp/apic.c @@ -708,6 +708,9 @@ VOID MpsIRQTrapFrameToTrapFrame(PKIRQ_TRAPFRAME IrqTrapFrame, PKTRAP_FRAME TrapFrame) { +#ifdef _M_AMD64 + UNIMPLEMENTED; +#else TrapFrame->SegGs = (USHORT)IrqTrapFrame->Gs; TrapFrame->SegFs = (USHORT)IrqTrapFrame->Fs; TrapFrame->SegEs = (USHORT)IrqTrapFrame->Es; @@ -723,6 +726,7 @@ MpsIRQTrapFrameToTrapFrame(PKIRQ_TRAPFRAME IrqTrapFrame, TrapFrame->Eip = IrqTrapFrame->Eip; TrapFrame->SegCs = IrqTrapFrame->Cs; TrapFrame->EFlags = IrqTrapFrame->Eflags; +#endif } VOID @@ -797,7 +801,7 @@ APICCalibrateTimer(ULONG CPU) APICSetupLVTT(1000000000); - TSCPresent = ((PKIPCR)KeGetPcr())->PrcbData.FeatureBits & KF_RDTSC ? TRUE : FALSE; + TSCPresent = KeGetCurrentPrcb()->FeatureBits & KF_RDTSC ? TRUE : FALSE; /* * The timer chip counts down to zero. Let's wait @@ -826,7 +830,7 @@ APICCalibrateTimer(ULONG CPU) DPRINT("CPU clock speed is %ld.%04ld MHz.\n", CPUMap[CPU].CoreSpeed/1000000, CPUMap[CPU].CoreSpeed%1000000); - ((PKIPCR)KeGetPcr())->PrcbData.MHz = CPUMap[CPU].CoreSpeed/1000000; + KeGetCurrentPrcb()->MHz = CPUMap[CPU].CoreSpeed/1000000; } CPUMap[CPU].BusSpeed = (HZ * (long)(tt1 - tt2) * APIC_DIVISOR); @@ -842,8 +846,25 @@ APICCalibrateTimer(ULONG CPU) } VOID -SetInterruptGate(ULONG index, ULONG address) +SetInterruptGate(ULONG index, ULONG_PTR address) { +#ifdef _M_AMD64 + KIDTENTRY64 *idt; + + idt = &KeGetPcr()->IdtBase[index]; + + idt->OffsetLow = address & 0xffff; + idt->Selector = KGDT_64_R0_CODE; + idt->IstIndex = 0; + idt->Reserved0 = 0; + idt->Type = 0x0e; + idt->Dpl = 0; + idt->Present = 1; + idt->OffsetMiddle = (address >> 16) & 0xffff; + idt->OffsetHigh = address >> 32; + idt->Reserved1 = 0; + idt->Alignment = 0; +#else KIDTENTRY *idt; KIDT_ACCESS Access; @@ -859,6 +880,7 @@ SetInterruptGate(ULONG index, ULONG address) idt->Selector = KGDT_R0_CODE; idt->Access = Access.Value; idt->ExtendedOffset = address >> 16; +#endif } VOID HaliInitBSP(VOID) @@ -879,13 +901,13 @@ VOID HaliInitBSP(VOID) BSPInitialized = TRUE; /* Setup interrupt handlers */ - SetInterruptGate(LOCAL_TIMER_VECTOR, (ULONG)MpsTimerInterrupt); - SetInterruptGate(ERROR_VECTOR, (ULONG)MpsErrorInterrupt); - SetInterruptGate(SPURIOUS_VECTOR, (ULONG)MpsSpuriousInterrupt); + SetInterruptGate(LOCAL_TIMER_VECTOR, (ULONG_PTR)MpsTimerInterrupt); + SetInterruptGate(ERROR_VECTOR, (ULONG_PTR)MpsErrorInterrupt); + SetInterruptGate(SPURIOUS_VECTOR, (ULONG_PTR)MpsSpuriousInterrupt); #ifdef CONFIG_SMP - SetInterruptGate(IPI_VECTOR, (ULONG)MpsIpiInterrupt); + SetInterruptGate(IPI_VECTOR, (ULONG_PTR)MpsIpiInterrupt); #endif - DPRINT("APIC is mapped at 0x%X\n", APICBase); + DPRINT1("APIC is mapped at 0x%p\n", (PVOID)APICBase); if (VerifyLocalAPIC()) { @@ -893,7 +915,7 @@ VOID HaliInitBSP(VOID) } else { - DPRINT("No APIC found\n"); + DPRINT1("No APIC found\n"); ASSERT(FALSE); } @@ -912,18 +934,18 @@ VOID HaliInitBSP(VOID) CommonBase = (PULONG)COMMON_AREA; /* Copy bootstrap code to common area */ - memcpy((PVOID)((ULONG)CommonBase + PAGE_SIZE), + memcpy((PVOID)((ULONG_PTR)CommonBase + PAGE_SIZE), &APstart, - (ULONG)&APend - (ULONG)&APstart + 1); + (ULONG_PTR)&APend - (ULONG_PTR)&APstart + 1); /* Set shutdown code */ CMOS_WRITE(0xF, 0xA); /* Set warm reset vector */ - ps = (PUSHORT)((ULONG)BIOSBase + 0x467); + ps = (PUSHORT)((ULONG_PTR)BIOSBase + 0x467); *ps = (COMMON_AREA + PAGE_SIZE) & 0xF; - ps = (PUSHORT)((ULONG)BIOSBase + 0x469); + ps = (PUSHORT)((ULONG_PTR)BIOSBase + 0x469); *ps = (COMMON_AREA + PAGE_SIZE) >> 4; #endif