Author: ion
Date: Wed Aug 23 02:10:52 2006
New Revision: 23651
URL:
http://svn.reactos.org/svn/reactos?rev=23651&view=rev
Log:
- Use the IDR in the PCR intead of a local picmask.
- Use ASM version of HalBeginSystemInterrupt.
Modified:
trunk/reactos/hal/halx86/generic/irq.S
trunk/reactos/hal/halx86/generic/irql.c
trunk/reactos/hal/halx86/up/halinit_up.c
trunk/reactos/include/ndk/asm.h
Modified: trunk/reactos/hal/halx86/generic/irq.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/irq.S?r…
==============================================================================
--- trunk/reactos/hal/halx86/generic/irq.S (original)
+++ trunk/reactos/hal/halx86/generic/irq.S Wed Aug 23 02:10:52 2006
@@ -70,7 +70,6 @@
.long 0xFFFFFFFB /* IRQL 30 */
.long 0xFFFFFFFB /* IRQL 31 */
-#if 0
HalpSysIntHandler:
.rept 8
.long GenericIRQ /* IRQ 0-7 */
@@ -83,7 +82,6 @@
.rept 20
.long GenericIRQ /* IRQ 16-35 */
.endr
-#endif
SoftIntByteTable:
.byte PASSIVE_LEVEL /* IRR 0 */
@@ -202,7 +200,7 @@
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 @@
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 @@
ret 12
IRQ7:
-
/* This is IRQ 7, check if it's spurious */
mov al, 0xB
out 0x20, al
@@ -331,10 +328,9 @@
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 @@
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 @@
out 0x20, al
DoneBegin:
-
/* Enable interrupts and return TRUE */
in al, 0x21
sti
@@ -374,6 +369,7 @@
ret 12
.endfunc
+#if 0
.globl _HalEndSystemInterrupt@8
.func HalEndSystemInterrupt@8
_HalEndSystemInterrupt@8:
Modified: trunk/reactos/hal/halx86/generic/irql.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/irql.c?…
==============================================================================
--- trunk/reactos/hal/halx86/generic/irql.c (original)
+++ trunk/reactos/hal/halx86/generic/irql.c Wed Aug 23 02:10:52 2006
@@ -12,6 +12,7 @@
#include <hal.h>
#define NDEBUG
#include <debug.h>
+#include <ndk/asm.h>
/* GLOBALS ******************************************************************/
@@ -25,8 +26,6 @@
1, 1,
2, 2, 2, 2
};
-
-ULONG pic_mask = {0xFFFFFFFA};
static ULONG HalpPendingInterruptCount[NR_IRQS] = {0};
@@ -52,7 +51,7 @@
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 @@
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 @@
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);
Modified: trunk/reactos/hal/halx86/up/halinit_up.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/up/halinit_up.c…
==============================================================================
--- trunk/reactos/hal/halx86/up/halinit_up.c (original)
+++ trunk/reactos/hal/halx86/up/halinit_up.c Wed Aug 23 02:10:52 2006
@@ -21,6 +21,8 @@
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();
Modified: trunk/reactos/include/ndk/asm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/asm.h?rev=2365…
==============================================================================
--- trunk/reactos/include/ndk/asm.h (original)
+++ trunk/reactos/include/ndk/asm.h Wed Aug 23 02:10:52 2006
@@ -432,19 +432,15 @@
#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