[ros-diffs] [navaraf] 19438: Change the FS read/write functions to macros and use constant addressing instead of register.

navaraf at svn.reactos.com navaraf at svn.reactos.com
Tue Nov 22 01:35:06 CET 2005


Change the FS read/write functions to macros and use constant addressing
instead of register.
Modified: trunk/reactos/hal/halx86/include/halp.h
Modified: trunk/reactos/hal/halx86/mp/mpsirql.c
  _____  

Modified: trunk/reactos/hal/halx86/include/halp.h
--- trunk/reactos/hal/halx86/include/halp.h	2005-11-22 00:29:22 UTC
(rev 19437)
+++ trunk/reactos/hal/halx86/include/halp.h	2005-11-22 00:34:46 UTC
(rev 19438)
@@ -60,22 +60,12 @@

 #define Ki386DisableInterrupts()    __asm__ __volatile__("cli\n\t")
 #define Ki386EnableInterrupts()	    __asm__
__volatile__("sti\n\t")
 #define Ki386HaltProcessor()	    __asm__ __volatile__("hlt\n\t")
-#define Ki386RdTSC(x)		    __asm__ __volatile__("rdtsc\n\t" :
"=A" (x.u.LowPart), "=d" (x.u.HighPart));
+#define Ki386RdTSC(x)		    __asm__ __volatile__("rdtsc\n\t" :
"=A" (x.u.LowPart), "=d" (x.u.HighPart))
 #define Ki386Rdmsr(msr,val1,val2)   __asm__ __volatile__("rdmsr" : "=a"
(val1), "=d" (val2) : "c" (msr))
 #define Ki386Wrmsr(msr,val1,val2)   __asm__ __volatile__("wrmsr" : /*
no outputs */ : "c" (msr), "a" (val1), "d" (val2))
+#define Ki386ReadFsByte(offset,x)   __asm__ __volatile__("movb
%%fs:%c1,%0" : "=q" (x) : "i" (offset))
+#define Ki386WriteFsByte(offset,x)  __asm__ __volatile__("movb
%0,%%fs:%c1" : : "q" ((UCHAR)x), "i" (offset))
 
-static inline BYTE Ki386ReadFsByte(ULONG offset)
-{
-   BYTE b;
-   __asm__ __volatile__("movb %%fs:(%1),%0":"=q" (b):"r" (offset));
-   return b;
-}
-
-static inline VOID Ki386WriteFsByte(ULONG offset, BYTE value)
-{
-   __asm__ __volatile__("movb %0,%%fs:(%1)"::"q" (value), "r"
(offset));
-}
-
 #elif defined(_MSC_VER)
 #define Ki386SaveFlags(x)	    __asm pushfd  __asm pop x;
 #define Ki386RestoreFlags(x)	    __asm push x  __asm popfd;
  _____  

Modified: trunk/reactos/hal/halx86/mp/mpsirql.c
--- trunk/reactos/hal/halx86/mp/mpsirql.c	2005-11-22 00:29:22 UTC
(rev 19437)
+++ trunk/reactos/hal/halx86/mp/mpsirql.c	2005-11-22 00:34:46 UTC
(rev 19438)
@@ -33,7 +33,7 @@

   Ki386SaveFlags(Flags);
   Ki386DisableInterrupts();
 
-  irql = Ki386ReadFsByte(FIELD_OFFSET(KPCR, Irql));
+  Ki386ReadFsByte(FIELD_OFFSET(KPCR, Irql), irql);
   if (irql > HIGH_LEVEL)
     {
       DPRINT1 ("CurrentIrql %x\n", irql);
@@ -72,6 +72,7 @@
 HalpLowerIrql(KIRQL NewIrql, BOOL FromHalEndSystemInterrupt)
 {
   ULONG Flags;
+  UCHAR DpcRequested;
   if (NewIrql >= DISPATCH_LEVEL)
     {
       KeSetCurrentIrql (NewIrql);
@@ -83,7 +84,8 @@
     {
       KeSetCurrentIrql (DISPATCH_LEVEL);
       APICWrite(APIC_TPR, IRQL2TPR (DISPATCH_LEVEL) & APIC_TPR_PRI);
-      if (FromHalEndSystemInterrupt ||
Ki386ReadFsByte(FIELD_OFFSET(KIPCR, HalReserved[HAL_DPC_REQUEST])))
+      Ki386ReadFsByte(FIELD_OFFSET(KIPCR,
HalReserved[HAL_DPC_REQUEST]), DpcRequested);
+      if (FromHalEndSystemInterrupt || DpcRequested)
         {
           Ki386WriteFsByte(FIELD_OFFSET(KIPCR,
HalReserved[HAL_DPC_REQUEST]), 0);
           Ki386EnableInterrupts();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20051122/3b80aef8/attachment.html


More information about the Ros-diffs mailing list