WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Fix assumption about size of irq_cpustat_t in assembly c

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix assumption about size of irq_cpustat_t in assembly code.
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Wed, 20 Apr 2005 13:00:18 +0000
Delivery-date: Wed, 20 Apr 2005 14:03:33 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1338.1.1, 2005/04/20 14:00:18+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Fix assumption about size of irq_cpustat_t in assembly code.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 arch/x86/x86_32/asm-offsets.c |   10 ++++++++++
 arch/x86/x86_32/entry.S       |    4 ++--
 arch/x86/x86_64/asm-offsets.c |   10 ++++++++++
 arch/x86/x86_64/entry.S       |   15 ++++++---------
 include/asm-x86/config.h      |   10 +++-------
 5 files changed, 31 insertions(+), 18 deletions(-)


diff -Nru a/xen/arch/x86/x86_32/asm-offsets.c 
b/xen/arch/x86/x86_32/asm-offsets.c
--- a/xen/arch/x86/x86_32/asm-offsets.c 2005-04-20 10:03:50 -04:00
+++ b/xen/arch/x86/x86_32/asm-offsets.c 2005-04-20 10:03:50 -04:00
@@ -15,6 +15,13 @@
 #define OFFSET(_sym, _str, _mem) \
     DEFINE(_sym, offsetof(_str, _mem));
 
+/* base-2 logarithm */
+#define __L2(_x)  (((_x) & 0x00000002) ?   1 : 0)
+#define __L4(_x)  (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x))
+#define __L8(_x)  (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x))
+#define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x))
+#define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x))
+
 void __dummy__(void)
 {
     OFFSET(XREGS_eax, struct xen_regs, eax);
@@ -78,4 +85,7 @@
     BLANK();
 
     DEFINE(FIXMAP_apic_base, fix_to_virt(FIX_APIC_BASE));
+    BLANK();
+
+    DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t)));
 }
diff -Nru a/xen/arch/x86/x86_32/entry.S b/xen/arch/x86/x86_32/entry.S
--- a/xen/arch/x86/x86_32/entry.S       2005-04-20 10:03:50 -04:00
+++ b/xen/arch/x86/x86_32/entry.S       2005-04-20 10:03:50 -04:00
@@ -140,7 +140,7 @@
         cli                             # tests must not race interrupts
 /*test_softirqs:*/  
         movl EDOMAIN_processor(%ebx),%eax
-        shl  $6,%eax                    # sizeof(irq_cpustat) == 64
+        shl  $IRQSTAT_shift,%eax
         test %ecx,SYMBOL_NAME(irq_stat)(%eax,1)
         jnz  vmx_process_softirqs
 
@@ -270,7 +270,7 @@
         cli                             # tests must not race interrupts
 /*test_softirqs:*/  
         movl EDOMAIN_processor(%ebx),%eax
-        shl  $6,%eax                    # sizeof(irq_cpustat) == 64
+        shl  $IRQSTAT_shift,%eax
         test %ecx,SYMBOL_NAME(irq_stat)(%eax,1)
         jnz  process_softirqs
 /*test_guest_events:*/
diff -Nru a/xen/arch/x86/x86_64/asm-offsets.c 
b/xen/arch/x86/x86_64/asm-offsets.c
--- a/xen/arch/x86/x86_64/asm-offsets.c 2005-04-20 10:03:50 -04:00
+++ b/xen/arch/x86/x86_64/asm-offsets.c 2005-04-20 10:03:50 -04:00
@@ -15,6 +15,13 @@
 #define OFFSET(_sym, _str, _mem) \
     DEFINE(_sym, offsetof(_str, _mem));
 
+/* base-2 logarithm */
+#define __L2(_x)  (((_x) & 0x00000002) ?   1 : 0)
+#define __L4(_x)  (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x))
+#define __L8(_x)  (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x))
+#define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x))
+#define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x))
+
 void __dummy__(void)
 {
     OFFSET(XREGS_r15, struct xen_regs, r15);
@@ -77,4 +84,7 @@
     OFFSET(MULTICALL_arg3, multicall_entry_t, args[3]);
     OFFSET(MULTICALL_arg4, multicall_entry_t, args[4]);
     OFFSET(MULTICALL_result, multicall_entry_t, args[5]);
+    BLANK();
+
+    DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t)));
 }
diff -Nru a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
--- a/xen/arch/x86/x86_64/entry.S       2005-04-20 10:03:50 -04:00
+++ b/xen/arch/x86/x86_64/entry.S       2005-04-20 10:03:50 -04:00
@@ -130,7 +130,7 @@
         cli                             # tests must not race interrupts
 /*test_softirqs:*/  
         movl  EDOMAIN_processor(%rbx),%eax
-        shl   $6,%rax                    # sizeof(irq_cpustat) == 64
+        shl   $IRQSTAT_shift,%rax
         leaq  SYMBOL_NAME(irq_stat)(%rip),%rcx
         testl $~0,(%rcx,%rax,1)
         jnz   process_softirqs
@@ -237,16 +237,13 @@
 vmx_test_all_events:
         GET_CURRENT(%rbx)
 /* test_all_events: */
-        xorq %rcx,%rcx
-        notq %rcx
         cli                             # tests must not race interrupts
 /*test_softirqs:*/  
-        movq EDOMAIN_processor(%rbx),%rax
-#if 0
-        shl  $6,%rax                    # sizeof(irq_cpustat) == 64
-        test %rcx,SYMBOL_NAME(irq_stat)(%rax,1)
-#endif
-        jnz  vmx_process_softirqs
+        movl  EDOMAIN_processor(%rbx),%eax
+        shl   $IRQSTAT_shift,%rax
+        leaq  SYMBOL_NAME(irq_stat)(%rip), %rdx
+        testl $~0,(%rdx,%rax,1)
+        jnz   vmx_process_softirqs
 
 vmx_restore_all_guest:
         call SYMBOL_NAME(load_cr2)
diff -Nru a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h      2005-04-20 10:03:50 -04:00
+++ b/xen/include/asm-x86/config.h      2005-04-20 10:03:50 -04:00
@@ -16,7 +16,9 @@
 #define CONFIG_X86_LOCAL_APIC 1
 #define CONFIG_X86_GOOD_APIC 1
 #define CONFIG_X86_IO_APIC 1
-#define CONFIG_X86_L1_CACHE_SHIFT 5
+
+/* Intel P4 currently has largest cache line (L2 line size is 128 bytes). */
+#define CONFIG_X86_L1_CACHE_SHIFT 7
 
 #define CONFIG_ACPI 1
 #define CONFIG_ACPI_BOOT 1
@@ -53,12 +55,6 @@
 
 #define OPT_CONSOLE_STR "com1,vga"
 
-/*
- * Just to keep compiler happy.
- * NB. DO NOT CHANGE SMP_CACHE_BYTES WITHOUT FIXING arch/i386/entry.S!!!
- * It depends on size of irq_cpustat_t, for example, being 64 bytes. :-)
- */
-#define SMP_CACHE_BYTES 64
 #define NR_CPUS 16
 
 /* Linkage for x86 */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fix assumption about size of irq_cpustat_t in assembly code., BitKeeper Bot <=