- Use the IDR in the PCR intead of a local picmask.

- Use ASM version of HalBeginSystemInterrupt.

svn path=/trunk/; revision=23651
This commit is contained in:
Alex Ionescu 2006-08-22 22:10:52 +00:00
parent 23b6ae75fb
commit f5f0688575
4 changed files with 16 additions and 61 deletions

View file

@ -70,7 +70,6 @@ _KiI8259MaskTable:
.long 0xFFFFFFFB /* IRQL 30 */
.long 0xFFFFFFFB /* IRQL 31 */
#if 0
HalpSysIntHandler:
.rept 8
.long GenericIRQ /* IRQ 0-7 */
@ -83,7 +82,6 @@ HalpSysIntHandler:
.rept 20
.long GenericIRQ /* IRQ 16-35 */
.endr
#endif
SoftIntByteTable:
.byte PASSIVE_LEVEL /* IRR 0 */
@ -202,7 +200,7 @@ _HalDisableSystemInterrupt@8:
mov edx, 1
shl edx, cl
cli
or [fs+KPCR_IDR], edx
or [fs:KPCR_IDR], edx
/* Get the current mask */
xor eax, eax
@ -292,18 +290,18 @@ Invalid:
xor eax, eax
ret 12
.endfunc
#endif
.globl _HalBeginSystemInterrupt@12
.func HalBeginSystemInterrupt@12
_HalBeginSystemInterrupt@12:
/* Convert to vector and call the handler */
movzx ebx, byte ptr [esp+8]
sub ebx, PRIMARY_VECTOR_BASE
jmp HalpSysIntHandler[ebx*4]
mov edx, [esp+8]
sub edx, PRIMARY_VECTOR_BASE
jmp HalpSysIntHandler[edx*4]
IRQ15:
/* This is IRQ 15, check if it's spurious */
mov al, 0xB
out 0xA0, al
@ -318,7 +316,6 @@ IRQ15:
ret 12
IRQ7:
/* This is IRQ 7, check if it's spurious */
mov al, 0xB
out 0x20, al
@ -331,10 +328,9 @@ IRQ7:
ret 12
GenericIRQ:
/* Return the current IRQL */
mov eax, [esp+12]
movzx ecx, word ptr [fs:KPCR_IRQL]
movzx ecx, byte ptr [fs:KPCR_IRQL]
mov [eax], cl
/* Set the new IRQL */
@ -349,7 +345,7 @@ GenericIRQ:
out 0xA1, al
/* Check to which PIC the EOI was sent */
mov eax, ebx
mov eax, edx
cmp eax, 8
jnb Pic1
@ -366,7 +362,6 @@ Pic1:
out 0x20, al
DoneBegin:
/* Enable interrupts and return TRUE */
in al, 0x21
sti
@ -374,6 +369,7 @@ DoneBegin:
ret 12
.endfunc
#if 0
.globl _HalEndSystemInterrupt@8
.func HalEndSystemInterrupt@8
_HalEndSystemInterrupt@8:

View file

@ -12,6 +12,7 @@
#include <hal.h>
#define NDEBUG
#include <debug.h>
#include <ndk/asm.h>
/* GLOBALS ******************************************************************/
@ -26,8 +27,6 @@ UCHAR Table[8] =
2, 2, 2, 2
};
ULONG pic_mask = {0xFFFFFFFA};
static ULONG HalpPendingInterruptCount[NR_IRQS] = {0};
#define DIRQL_TO_IRQ(x) (PROFILE_LEVEL - x)
@ -52,7 +51,7 @@ VOID HalpEndSystemInterrupt(KIRQL Irql)
Ki386SaveFlags(flags);
Ki386DisableInterrupts();
Mask = pic_mask | KiI8259MaskTable[Irql];
Mask = KeGetPcr()->IDR | KiI8259MaskTable[Irql];
WRITE_PORT_UCHAR((PUCHAR)0x21, (UCHAR)Mask);
Mask >>= 8;
WRITE_PORT_UCHAR((PUCHAR)0xa1, (UCHAR)Mask);
@ -158,44 +157,6 @@ KfLowerIrql (KIRQL NewIrql)
HalpLowerIrql(NewIrql);
}
BOOLEAN STDCALL
HalBeginSystemInterrupt (KIRQL Irql,
ULONG Vector,
PKIRQL OldIrql)
{
ULONG irq;
ULONG Mask;
if (Vector < IRQ_BASE || Vector >= IRQ_BASE + NR_IRQS)
{
return(FALSE);
}
irq = Vector - IRQ_BASE;
Mask = pic_mask | KiI8259MaskTable[Irql];
WRITE_PORT_UCHAR((PUCHAR)0x21, (UCHAR)Mask);
Mask >>= 8;
WRITE_PORT_UCHAR((PUCHAR)0xa1, (UCHAR)Mask);
if (irq < 8)
{
WRITE_PORT_UCHAR((PUCHAR)0x20, 0x60 | irq);
}
else
{
/* Send EOI to the PICs */
WRITE_PORT_UCHAR((PUCHAR)0x20,0x62);
WRITE_PORT_UCHAR((PUCHAR)0xa0,0x20);
}
*OldIrql = KeGetPcr()->Irql;
KeGetPcr()->Irql = Irql;
return(TRUE);
}
VOID STDCALL HalEndSystemInterrupt (KIRQL Irql, ULONG Unknown2)
/*
* FUNCTION: Finish a system interrupt and restore the specified irq level.
@ -220,9 +181,9 @@ HalEnableSystemInterrupt(
return FALSE;
irq = Vector - IRQ_BASE;
pic_mask &= ~(1 << irq);
KeGetPcr()->IDR &= ~(1 << irq);
Mask = pic_mask | KiI8259MaskTable[KeGetPcr()->Irql];
Mask = KeGetPcr()->IDR | KiI8259MaskTable[KeGetPcr()->Irql];
WRITE_PORT_UCHAR((PUCHAR)0x21, (UCHAR)Mask);
Mask >>= 8;
WRITE_PORT_UCHAR((PUCHAR)0xa1, (UCHAR)Mask);

View file

@ -21,6 +21,8 @@ VOID
HalpInitPhase0(PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
{
HalpInitPICs();
/* FIXME: Big-ass hack. First, should be 0xFFFFFFFF, second, shouldnt' be done here */
KeGetPcr()->IDR = 0xFFFFFFFA;
/* Setup busy waiting */
HalpCalibrateStallExecution();

View file

@ -431,20 +431,16 @@ Author:
#define MACHINE_TYPE_EISA 0x0001
#define MACHINE_TYPE_MCA 0x0002
//
// Vector base
// ROS HACK HACK HACK
//
#define PRIMARY_VECTOR_BASE 0x40
//
// Kernel Feature Bits
//
#define KF_RDTSC 0x00000002
#endif
//
// Generic Definitions
//
#define PRIMARY_VECTOR_BASE 0x40 // FIXME: HACK
#define MAXIMUM_IDTVECTOR 0xFF
#endif // !_ASM_H