direct-io.hg
changeset 4593:d10fe13887d7
bitkeeper revision 1.1338.1.1 (42665262XHUfWrT775PaPvnAkL5qXg)
Fix assumption about size of irq_cpustat_t in assembly code.
Signed-off-by: Keir Fraser <keir@xensource.com>
Fix assumption about size of irq_cpustat_t in assembly code.
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kaf24@firebug.cl.cam.ac.uk |
---|---|
date | Wed Apr 20 13:00:18 2005 +0000 (2005-04-20) |
parents | 35357e323f14 |
children | 05621922c024 50a6d55c49c5 |
files | xen/arch/x86/x86_32/asm-offsets.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_64/asm-offsets.c xen/arch/x86/x86_64/entry.S xen/include/asm-x86/config.h |
line diff
1.1 --- a/xen/arch/x86/x86_32/asm-offsets.c Wed Apr 20 10:39:58 2005 +0000 1.2 +++ b/xen/arch/x86/x86_32/asm-offsets.c Wed Apr 20 13:00:18 2005 +0000 1.3 @@ -15,6 +15,13 @@ 1.4 #define OFFSET(_sym, _str, _mem) \ 1.5 DEFINE(_sym, offsetof(_str, _mem)); 1.6 1.7 +/* base-2 logarithm */ 1.8 +#define __L2(_x) (((_x) & 0x00000002) ? 1 : 0) 1.9 +#define __L4(_x) (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x)) 1.10 +#define __L8(_x) (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x)) 1.11 +#define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x)) 1.12 +#define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x)) 1.13 + 1.14 void __dummy__(void) 1.15 { 1.16 OFFSET(XREGS_eax, struct xen_regs, eax); 1.17 @@ -78,4 +85,7 @@ void __dummy__(void) 1.18 BLANK(); 1.19 1.20 DEFINE(FIXMAP_apic_base, fix_to_virt(FIX_APIC_BASE)); 1.21 + BLANK(); 1.22 + 1.23 + DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t))); 1.24 }
2.1 --- a/xen/arch/x86/x86_32/entry.S Wed Apr 20 10:39:58 2005 +0000 2.2 +++ b/xen/arch/x86/x86_32/entry.S Wed Apr 20 13:00:18 2005 +0000 2.3 @@ -140,7 +140,7 @@ vmx_test_all_events: 2.4 cli # tests must not race interrupts 2.5 /*test_softirqs:*/ 2.6 movl EDOMAIN_processor(%ebx),%eax 2.7 - shl $6,%eax # sizeof(irq_cpustat) == 64 2.8 + shl $IRQSTAT_shift,%eax 2.9 test %ecx,SYMBOL_NAME(irq_stat)(%eax,1) 2.10 jnz vmx_process_softirqs 2.11 2.12 @@ -270,7 +270,7 @@ test_all_events: 2.13 cli # tests must not race interrupts 2.14 /*test_softirqs:*/ 2.15 movl EDOMAIN_processor(%ebx),%eax 2.16 - shl $6,%eax # sizeof(irq_cpustat) == 64 2.17 + shl $IRQSTAT_shift,%eax 2.18 test %ecx,SYMBOL_NAME(irq_stat)(%eax,1) 2.19 jnz process_softirqs 2.20 /*test_guest_events:*/
3.1 --- a/xen/arch/x86/x86_64/asm-offsets.c Wed Apr 20 10:39:58 2005 +0000 3.2 +++ b/xen/arch/x86/x86_64/asm-offsets.c Wed Apr 20 13:00:18 2005 +0000 3.3 @@ -15,6 +15,13 @@ 3.4 #define OFFSET(_sym, _str, _mem) \ 3.5 DEFINE(_sym, offsetof(_str, _mem)); 3.6 3.7 +/* base-2 logarithm */ 3.8 +#define __L2(_x) (((_x) & 0x00000002) ? 1 : 0) 3.9 +#define __L4(_x) (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x)) 3.10 +#define __L8(_x) (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x)) 3.11 +#define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x)) 3.12 +#define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x)) 3.13 + 3.14 void __dummy__(void) 3.15 { 3.16 OFFSET(XREGS_r15, struct xen_regs, r15); 3.17 @@ -77,4 +84,7 @@ void __dummy__(void) 3.18 OFFSET(MULTICALL_arg3, multicall_entry_t, args[3]); 3.19 OFFSET(MULTICALL_arg4, multicall_entry_t, args[4]); 3.20 OFFSET(MULTICALL_result, multicall_entry_t, args[5]); 3.21 + BLANK(); 3.22 + 3.23 + DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t))); 3.24 }
4.1 --- a/xen/arch/x86/x86_64/entry.S Wed Apr 20 10:39:58 2005 +0000 4.2 +++ b/xen/arch/x86/x86_64/entry.S Wed Apr 20 13:00:18 2005 +0000 4.3 @@ -130,7 +130,7 @@ test_all_events: 4.4 cli # tests must not race interrupts 4.5 /*test_softirqs:*/ 4.6 movl EDOMAIN_processor(%rbx),%eax 4.7 - shl $6,%rax # sizeof(irq_cpustat) == 64 4.8 + shl $IRQSTAT_shift,%rax 4.9 leaq SYMBOL_NAME(irq_stat)(%rip),%rcx 4.10 testl $~0,(%rcx,%rax,1) 4.11 jnz process_softirqs 4.12 @@ -237,16 +237,13 @@ ENTRY(vmx_asm_do_resume) 4.13 vmx_test_all_events: 4.14 GET_CURRENT(%rbx) 4.15 /* test_all_events: */ 4.16 - xorq %rcx,%rcx 4.17 - notq %rcx 4.18 cli # tests must not race interrupts 4.19 /*test_softirqs:*/ 4.20 - movq EDOMAIN_processor(%rbx),%rax 4.21 -#if 0 4.22 - shl $6,%rax # sizeof(irq_cpustat) == 64 4.23 - test %rcx,SYMBOL_NAME(irq_stat)(%rax,1) 4.24 -#endif 4.25 - jnz vmx_process_softirqs 4.26 + movl EDOMAIN_processor(%rbx),%eax 4.27 + shl $IRQSTAT_shift,%rax 4.28 + leaq SYMBOL_NAME(irq_stat)(%rip), %rdx 4.29 + testl $~0,(%rdx,%rax,1) 4.30 + jnz vmx_process_softirqs 4.31 4.32 vmx_restore_all_guest: 4.33 call SYMBOL_NAME(load_cr2)
5.1 --- a/xen/include/asm-x86/config.h Wed Apr 20 10:39:58 2005 +0000 5.2 +++ b/xen/include/asm-x86/config.h Wed Apr 20 13:00:18 2005 +0000 5.3 @@ -16,7 +16,9 @@ 5.4 #define CONFIG_X86_LOCAL_APIC 1 5.5 #define CONFIG_X86_GOOD_APIC 1 5.6 #define CONFIG_X86_IO_APIC 1 5.7 -#define CONFIG_X86_L1_CACHE_SHIFT 5 5.8 + 5.9 +/* Intel P4 currently has largest cache line (L2 line size is 128 bytes). */ 5.10 +#define CONFIG_X86_L1_CACHE_SHIFT 7 5.11 5.12 #define CONFIG_ACPI 1 5.13 #define CONFIG_ACPI_BOOT 1 5.14 @@ -53,12 +55,6 @@ 5.15 5.16 #define OPT_CONSOLE_STR "com1,vga" 5.17 5.18 -/* 5.19 - * Just to keep compiler happy. 5.20 - * NB. DO NOT CHANGE SMP_CACHE_BYTES WITHOUT FIXING arch/i386/entry.S!!! 5.21 - * It depends on size of irq_cpustat_t, for example, being 64 bytes. :-) 5.22 - */ 5.23 -#define SMP_CACHE_BYTES 64 5.24 #define NR_CPUS 16 5.25 5.26 /* Linkage for x86 */