mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:45:50 +00:00
- 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:
parent
23b6ae75fb
commit
f5f0688575
4 changed files with 16 additions and 61 deletions
|
@ -70,7 +70,6 @@ _KiI8259MaskTable:
|
||||||
.long 0xFFFFFFFB /* IRQL 30 */
|
.long 0xFFFFFFFB /* IRQL 30 */
|
||||||
.long 0xFFFFFFFB /* IRQL 31 */
|
.long 0xFFFFFFFB /* IRQL 31 */
|
||||||
|
|
||||||
#if 0
|
|
||||||
HalpSysIntHandler:
|
HalpSysIntHandler:
|
||||||
.rept 8
|
.rept 8
|
||||||
.long GenericIRQ /* IRQ 0-7 */
|
.long GenericIRQ /* IRQ 0-7 */
|
||||||
|
@ -83,7 +82,6 @@ HalpSysIntHandler:
|
||||||
.rept 20
|
.rept 20
|
||||||
.long GenericIRQ /* IRQ 16-35 */
|
.long GenericIRQ /* IRQ 16-35 */
|
||||||
.endr
|
.endr
|
||||||
#endif
|
|
||||||
|
|
||||||
SoftIntByteTable:
|
SoftIntByteTable:
|
||||||
.byte PASSIVE_LEVEL /* IRR 0 */
|
.byte PASSIVE_LEVEL /* IRR 0 */
|
||||||
|
@ -202,7 +200,7 @@ _HalDisableSystemInterrupt@8:
|
||||||
mov edx, 1
|
mov edx, 1
|
||||||
shl edx, cl
|
shl edx, cl
|
||||||
cli
|
cli
|
||||||
or [fs+KPCR_IDR], edx
|
or [fs:KPCR_IDR], edx
|
||||||
|
|
||||||
/* Get the current mask */
|
/* Get the current mask */
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
|
@ -292,18 +290,18 @@ Invalid:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret 12
|
ret 12
|
||||||
.endfunc
|
.endfunc
|
||||||
|
#endif
|
||||||
|
|
||||||
.globl _HalBeginSystemInterrupt@12
|
.globl _HalBeginSystemInterrupt@12
|
||||||
.func HalBeginSystemInterrupt@12
|
.func HalBeginSystemInterrupt@12
|
||||||
_HalBeginSystemInterrupt@12:
|
_HalBeginSystemInterrupt@12:
|
||||||
|
|
||||||
/* Convert to vector and call the handler */
|
/* Convert to vector and call the handler */
|
||||||
movzx ebx, byte ptr [esp+8]
|
mov edx, [esp+8]
|
||||||
sub ebx, PRIMARY_VECTOR_BASE
|
sub edx, PRIMARY_VECTOR_BASE
|
||||||
jmp HalpSysIntHandler[ebx*4]
|
jmp HalpSysIntHandler[edx*4]
|
||||||
|
|
||||||
IRQ15:
|
IRQ15:
|
||||||
|
|
||||||
/* This is IRQ 15, check if it's spurious */
|
/* This is IRQ 15, check if it's spurious */
|
||||||
mov al, 0xB
|
mov al, 0xB
|
||||||
out 0xA0, al
|
out 0xA0, al
|
||||||
|
@ -318,7 +316,6 @@ IRQ15:
|
||||||
ret 12
|
ret 12
|
||||||
|
|
||||||
IRQ7:
|
IRQ7:
|
||||||
|
|
||||||
/* This is IRQ 7, check if it's spurious */
|
/* This is IRQ 7, check if it's spurious */
|
||||||
mov al, 0xB
|
mov al, 0xB
|
||||||
out 0x20, al
|
out 0x20, al
|
||||||
|
@ -331,10 +328,9 @@ IRQ7:
|
||||||
ret 12
|
ret 12
|
||||||
|
|
||||||
GenericIRQ:
|
GenericIRQ:
|
||||||
|
|
||||||
/* Return the current IRQL */
|
/* Return the current IRQL */
|
||||||
mov eax, [esp+12]
|
mov eax, [esp+12]
|
||||||
movzx ecx, word ptr [fs:KPCR_IRQL]
|
movzx ecx, byte ptr [fs:KPCR_IRQL]
|
||||||
mov [eax], cl
|
mov [eax], cl
|
||||||
|
|
||||||
/* Set the new IRQL */
|
/* Set the new IRQL */
|
||||||
|
@ -349,7 +345,7 @@ GenericIRQ:
|
||||||
out 0xA1, al
|
out 0xA1, al
|
||||||
|
|
||||||
/* Check to which PIC the EOI was sent */
|
/* Check to which PIC the EOI was sent */
|
||||||
mov eax, ebx
|
mov eax, edx
|
||||||
cmp eax, 8
|
cmp eax, 8
|
||||||
jnb Pic1
|
jnb Pic1
|
||||||
|
|
||||||
|
@ -366,7 +362,6 @@ Pic1:
|
||||||
out 0x20, al
|
out 0x20, al
|
||||||
|
|
||||||
DoneBegin:
|
DoneBegin:
|
||||||
|
|
||||||
/* Enable interrupts and return TRUE */
|
/* Enable interrupts and return TRUE */
|
||||||
in al, 0x21
|
in al, 0x21
|
||||||
sti
|
sti
|
||||||
|
@ -374,6 +369,7 @@ DoneBegin:
|
||||||
ret 12
|
ret 12
|
||||||
.endfunc
|
.endfunc
|
||||||
|
|
||||||
|
#if 0
|
||||||
.globl _HalEndSystemInterrupt@8
|
.globl _HalEndSystemInterrupt@8
|
||||||
.func HalEndSystemInterrupt@8
|
.func HalEndSystemInterrupt@8
|
||||||
_HalEndSystemInterrupt@8:
|
_HalEndSystemInterrupt@8:
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <hal.h>
|
#include <hal.h>
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
#include <ndk/asm.h>
|
||||||
|
|
||||||
/* GLOBALS ******************************************************************/
|
/* GLOBALS ******************************************************************/
|
||||||
|
|
||||||
|
@ -26,8 +27,6 @@ UCHAR Table[8] =
|
||||||
2, 2, 2, 2
|
2, 2, 2, 2
|
||||||
};
|
};
|
||||||
|
|
||||||
ULONG pic_mask = {0xFFFFFFFA};
|
|
||||||
|
|
||||||
static ULONG HalpPendingInterruptCount[NR_IRQS] = {0};
|
static ULONG HalpPendingInterruptCount[NR_IRQS] = {0};
|
||||||
|
|
||||||
#define DIRQL_TO_IRQ(x) (PROFILE_LEVEL - x)
|
#define DIRQL_TO_IRQ(x) (PROFILE_LEVEL - x)
|
||||||
|
@ -52,7 +51,7 @@ VOID HalpEndSystemInterrupt(KIRQL Irql)
|
||||||
Ki386SaveFlags(flags);
|
Ki386SaveFlags(flags);
|
||||||
Ki386DisableInterrupts();
|
Ki386DisableInterrupts();
|
||||||
|
|
||||||
Mask = pic_mask | KiI8259MaskTable[Irql];
|
Mask = KeGetPcr()->IDR | KiI8259MaskTable[Irql];
|
||||||
WRITE_PORT_UCHAR((PUCHAR)0x21, (UCHAR)Mask);
|
WRITE_PORT_UCHAR((PUCHAR)0x21, (UCHAR)Mask);
|
||||||
Mask >>= 8;
|
Mask >>= 8;
|
||||||
WRITE_PORT_UCHAR((PUCHAR)0xa1, (UCHAR)Mask);
|
WRITE_PORT_UCHAR((PUCHAR)0xa1, (UCHAR)Mask);
|
||||||
|
@ -158,44 +157,6 @@ KfLowerIrql (KIRQL NewIrql)
|
||||||
HalpLowerIrql(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)
|
VOID STDCALL HalEndSystemInterrupt (KIRQL Irql, ULONG Unknown2)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Finish a system interrupt and restore the specified irq level.
|
* FUNCTION: Finish a system interrupt and restore the specified irq level.
|
||||||
|
@ -220,9 +181,9 @@ HalEnableSystemInterrupt(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
irq = Vector - IRQ_BASE;
|
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);
|
WRITE_PORT_UCHAR((PUCHAR)0x21, (UCHAR)Mask);
|
||||||
Mask >>= 8;
|
Mask >>= 8;
|
||||||
WRITE_PORT_UCHAR((PUCHAR)0xa1, (UCHAR)Mask);
|
WRITE_PORT_UCHAR((PUCHAR)0xa1, (UCHAR)Mask);
|
||||||
|
|
|
@ -21,6 +21,8 @@ VOID
|
||||||
HalpInitPhase0(PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
HalpInitPhase0(PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
{
|
{
|
||||||
HalpInitPICs();
|
HalpInitPICs();
|
||||||
|
/* FIXME: Big-ass hack. First, should be 0xFFFFFFFF, second, shouldnt' be done here */
|
||||||
|
KeGetPcr()->IDR = 0xFFFFFFFA;
|
||||||
|
|
||||||
/* Setup busy waiting */
|
/* Setup busy waiting */
|
||||||
HalpCalibrateStallExecution();
|
HalpCalibrateStallExecution();
|
||||||
|
|
|
@ -431,20 +431,16 @@ Author:
|
||||||
#define MACHINE_TYPE_EISA 0x0001
|
#define MACHINE_TYPE_EISA 0x0001
|
||||||
#define MACHINE_TYPE_MCA 0x0002
|
#define MACHINE_TYPE_MCA 0x0002
|
||||||
|
|
||||||
//
|
|
||||||
// Vector base
|
|
||||||
// ROS HACK HACK HACK
|
|
||||||
//
|
|
||||||
#define PRIMARY_VECTOR_BASE 0x40
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Kernel Feature Bits
|
// Kernel Feature Bits
|
||||||
//
|
//
|
||||||
#define KF_RDTSC 0x00000002
|
#define KF_RDTSC 0x00000002
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Generic Definitions
|
// Generic Definitions
|
||||||
//
|
//
|
||||||
|
#define PRIMARY_VECTOR_BASE 0x40 // FIXME: HACK
|
||||||
#define MAXIMUM_IDTVECTOR 0xFF
|
#define MAXIMUM_IDTVECTOR 0xFF
|
||||||
#endif // !_ASM_H
|
#endif // !_ASM_H
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue