mirror of
https://github.com/reactos/reactos.git
synced 2025-06-06 18:00:41 +00:00
[HAL]
- Implement IrqlToSoftVector() macro and use it in HalRequestSoftwareInterrupt, so that on amd64 the correct interrupt is triggered. - Really start at the lowest vector for the IRQL in HalpAllocateSystemInterrupt - Small code refactoring svn path=/trunk/; revision=55014
This commit is contained in:
parent
13baf6cb0b
commit
2191cf1a2d
2 changed files with 12 additions and 12 deletions
|
@ -186,7 +186,7 @@ ApicGetCurrentIrql(VOID)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
ApicRaiseIrql(KIRQL Irql)
|
ApicSetIrql(KIRQL Irql)
|
||||||
{
|
{
|
||||||
#ifdef _M_AMD64
|
#ifdef _M_AMD64
|
||||||
__writecr8(Irql);
|
__writecr8(Irql);
|
||||||
|
@ -197,14 +197,13 @@ ApicRaiseIrql(KIRQL Irql)
|
||||||
ApicWrite(APIC_TPR, IrqlToTpr(Irql));
|
ApicWrite(APIC_TPR, IrqlToTpr(Irql));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#define ApicRaiseIrql ApicSetIrql
|
||||||
|
|
||||||
|
#ifdef APIC_LAZY_IRQL
|
||||||
VOID
|
VOID
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
ApicLowerIrql(KIRQL Irql)
|
ApicLowerIrql(KIRQL Irql)
|
||||||
{
|
{
|
||||||
#ifdef _M_AMD64
|
|
||||||
__writecr8(Irql);
|
|
||||||
#elif defined(APIC_LAZY_IRQL)
|
|
||||||
__writefsbyte(FIELD_OFFSET(KPCR, Irql), Irql);
|
__writefsbyte(FIELD_OFFSET(KPCR, Irql), Irql);
|
||||||
|
|
||||||
/* Is the new Irql lower than set in the TPR? */
|
/* Is the new Irql lower than set in the TPR? */
|
||||||
|
@ -216,11 +215,10 @@ ApicLowerIrql(KIRQL Irql)
|
||||||
/* Need to lower it back */
|
/* Need to lower it back */
|
||||||
ApicWrite(APIC_TPR, IrqlToTpr(Irql));
|
ApicWrite(APIC_TPR, IrqlToTpr(Irql));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
/* Convert IRQL and write the TPR */
|
|
||||||
ApicWrite(APIC_TPR, IrqlToTpr(Irql));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define ApicLowerIrql ApicSetIrql
|
||||||
|
#endif
|
||||||
|
|
||||||
UCHAR
|
UCHAR
|
||||||
FASTCALL
|
FASTCALL
|
||||||
|
@ -394,7 +392,7 @@ ApicInitializeLocalApic(ULONG Cpu)
|
||||||
ApicWrite(APIC_ERRLVTR, LvtEntry.Long);
|
ApicWrite(APIC_ERRLVTR, LvtEntry.Long);
|
||||||
|
|
||||||
/* Set the IRQL from the PCR */
|
/* Set the IRQL from the PCR */
|
||||||
ApicWrite(APIC_TPR, IrqlToTpr(KeGetPcr()->Irql));
|
ApicSetIrql(KeGetPcr()->Irql);
|
||||||
#ifdef APIC_LAZY_IRQL
|
#ifdef APIC_LAZY_IRQL
|
||||||
/* Save the new hard IRQL in the IRR field */
|
/* Save the new hard IRQL in the IRR field */
|
||||||
KeGetPcr()->IRR = KeGetPcr()->Irql;
|
KeGetPcr()->IRR = KeGetPcr()->Irql;
|
||||||
|
@ -410,8 +408,8 @@ HalpAllocateSystemInterrupt(
|
||||||
IOAPIC_REDIRECTION_REGISTER ReDirReg;
|
IOAPIC_REDIRECTION_REGISTER ReDirReg;
|
||||||
IN UCHAR Vector;
|
IN UCHAR Vector;
|
||||||
|
|
||||||
/* Start with low vector */
|
/* Start with lowest vector */
|
||||||
Vector = IrqlToTpr(Irql);
|
Vector = IrqlToTpr(Irql) & 0xF0;
|
||||||
|
|
||||||
/* Find an empty vector */
|
/* Find an empty vector */
|
||||||
while (HalpVectorToIndex[Vector] != 0xFF)
|
while (HalpVectorToIndex[Vector] != 0xFF)
|
||||||
|
@ -653,7 +651,7 @@ FASTCALL
|
||||||
HalRequestSoftwareInterrupt(IN KIRQL Irql)
|
HalRequestSoftwareInterrupt(IN KIRQL Irql)
|
||||||
{
|
{
|
||||||
/* Convert irql to vector and request an interrupt */
|
/* Convert irql to vector and request an interrupt */
|
||||||
ApicRequestInterrupt(IrqlToTpr(Irql), APIC_TGM_Edge);
|
ApicRequestInterrupt(IrqlToSoftVector(Irql), APIC_TGM_Edge);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#define APIC_PROFILE_VECTOR 0xFD // IRQL 31
|
#define APIC_PROFILE_VECTOR 0xFD // IRQL 31
|
||||||
#define APIC_NMI_VECTOR 0xFF
|
#define APIC_NMI_VECTOR 0xFF
|
||||||
#define IrqlToTpr(Irql) (Irql << 4)
|
#define IrqlToTpr(Irql) (Irql << 4)
|
||||||
|
#define IrqlToSoftVector(Irql) ((Irql << 4)|0xf)
|
||||||
#define TprToIrql(Tpr) ((KIRQL)(Tpr >> 4))
|
#define TprToIrql(Tpr) ((KIRQL)(Tpr >> 4))
|
||||||
#define CLOCK2_LEVEL CLOCK_LEVEL
|
#define CLOCK2_LEVEL CLOCK_LEVEL
|
||||||
#else
|
#else
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
#define APIC_PROFILE_VECTOR 0xFD // IRQL 31
|
#define APIC_PROFILE_VECTOR 0xFD // IRQL 31
|
||||||
#define APIC_NMI_VECTOR 0xFF
|
#define APIC_NMI_VECTOR 0xFF
|
||||||
#define IrqlToTpr(Irql) (HalpIRQLtoTPR[Irql])
|
#define IrqlToTpr(Irql) (HalpIRQLtoTPR[Irql])
|
||||||
|
#define IrqlToSoftVector(Irql) IrqlToTpr(Irql)
|
||||||
#define TprToIrql(Tpr) (HalVectorToIRQL[Tpr >> 4])
|
#define TprToIrql(Tpr) (HalVectorToIRQL[Tpr >> 4])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue