direct-io.hg
changeset 2920:90b094417ff3
bitkeeper revision 1.1159.1.394 (4190a152C0zjusRSriDG4srGifYk1A)
Merge freefall.cl.cam.ac.uk:/auto/groups/xeno/users/cl349/BK/xen.bk-smp
into freefall.cl.cam.ac.uk:/local/scratch/cl349/xen.bk-smp
Merge freefall.cl.cam.ac.uk:/auto/groups/xeno/users/cl349/BK/xen.bk-smp
into freefall.cl.cam.ac.uk:/local/scratch/cl349/xen.bk-smp
author | cl349@freefall.cl.cam.ac.uk |
---|---|
date | Tue Nov 09 10:52:02 2004 +0000 (2004-11-09) |
parents | fe5933507ca5 764b406523af |
children | e809b69fa26a |
files | .rootkeys xen/arch/x86/pdb-stub.c xen/arch/x86/traps.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_32/seg_fixup.c xen/include/asm-x86/irq.h xen/include/asm-x86/x86_32/asm_defns.h xen/include/asm-x86/x86_32/current.h xen/include/asm-x86/x86_32/regs.h xen/include/public/arch-x86_32.h xen/include/public/dom0_ops.h xen/include/xen/sched.h |
line diff
1.1 --- a/.rootkeys Tue Nov 09 10:51:49 2004 +0000 1.2 +++ b/.rootkeys Tue Nov 09 10:52:02 2004 +0000 1.3 @@ -735,6 +735,7 @@ 40e1966akOHWvvunCED7x3HPv35QvQ xen/inclu 1.4 3ddb79c3ezddh34MdelJpa5tNR00Dw xen/include/asm-x86/system.h 1.5 3ddb79c4HugMq7IYGxcQKFBpKwKhzA xen/include/asm-x86/types.h 1.6 40cf1596saFaHD5DC5zvrSn7CDCWGQ xen/include/asm-x86/uaccess.h 1.7 +418fbcfe_WliJPToeVM-9VStvym-hw xen/include/asm-x86/x86_32/asm_defns.h 1.8 3ddb79c2ADvRmdexd9y3AYK9_NTx-Q xen/include/asm-x86/x86_32/current.h 1.9 3ddb79c3mbqEM7QQr3zVq7NiBNhouA xen/include/asm-x86/x86_32/regs.h 1.10 3e7f358aG11EvMI9VJ4_9hD4LUO7rQ xen/include/asm-x86/x86_32/string.h
2.1 --- a/xen/arch/x86/pdb-stub.c Tue Nov 09 10:51:49 2004 +0000 2.2 +++ b/xen/arch/x86/pdb-stub.c Tue Nov 09 10:52:02 2004 +0000 2.3 @@ -255,17 +255,17 @@ pdb_x86_to_gdb_regs (char *buffer, struc 2.4 idx += sizeof(regs->eip) * 2; 2.5 mem2hex ((char *)®s->eflags, &buffer[idx], sizeof(regs->eflags)); 2.6 idx += sizeof(regs->eflags) * 2; 2.7 - mem2hex ((char *)®s->xcs, &buffer[idx], sizeof(regs->xcs)); 2.8 - idx += sizeof(regs->xcs) * 2; 2.9 - mem2hex ((char *)®s->xss, &buffer[idx], sizeof(regs->xss)); 2.10 - idx += sizeof(regs->xss) * 2; 2.11 - mem2hex ((char *)®s->xds, &buffer[idx], sizeof(regs->xds)); 2.12 - idx += sizeof(regs->xds) * 2; 2.13 - mem2hex ((char *)®s->xes, &buffer[idx], sizeof(regs->xes)); 2.14 - idx += sizeof(regs->xes) * 2; 2.15 - mem2hex ((char *)®s->xfs, &buffer[idx], sizeof(regs->xfs)); 2.16 - idx += sizeof(regs->xfs) * 2; 2.17 - mem2hex ((char *)®s->xgs, &buffer[idx], sizeof(regs->xgs)); 2.18 + mem2hex ((char *)®s->cs, &buffer[idx], sizeof(regs->cs)); 2.19 + idx += sizeof(regs->cs) * 2; 2.20 + mem2hex ((char *)®s->ss, &buffer[idx], sizeof(regs->ss)); 2.21 + idx += sizeof(regs->ss) * 2; 2.22 + mem2hex ((char *)®s->ds, &buffer[idx], sizeof(regs->ds)); 2.23 + idx += sizeof(regs->ds) * 2; 2.24 + mem2hex ((char *)®s->es, &buffer[idx], sizeof(regs->es)); 2.25 + idx += sizeof(regs->es) * 2; 2.26 + mem2hex ((char *)®s->fs, &buffer[idx], sizeof(regs->fs)); 2.27 + idx += sizeof(regs->fs) * 2; 2.28 + mem2hex ((char *)®s->gs, &buffer[idx], sizeof(regs->gs)); 2.29 } 2.30 2.31 /* at this point we allow any register to be changed, caveat emptor */ 2.32 @@ -292,17 +292,17 @@ pdb_gdb_to_x86_regs (struct xen_regs *re 2.33 buffer += sizeof(regs->eip) * 2; 2.34 hex2mem(buffer, (char *)®s->eflags, sizeof(regs->eflags)); 2.35 buffer += sizeof(regs->eflags) * 2; 2.36 - hex2mem(buffer, (char *)®s->xcs, sizeof(regs->xcs)); 2.37 - buffer += sizeof(regs->xcs) * 2; 2.38 - hex2mem(buffer, (char *)®s->xss, sizeof(regs->xss)); 2.39 - buffer += sizeof(regs->xss) * 2; 2.40 - hex2mem(buffer, (char *)®s->xds, sizeof(regs->xds)); 2.41 - buffer += sizeof(regs->xds) * 2; 2.42 - hex2mem(buffer, (char *)®s->xes, sizeof(regs->xes)); 2.43 - buffer += sizeof(regs->xes) * 2; 2.44 - hex2mem(buffer, (char *)®s->xfs, sizeof(regs->xfs)); 2.45 - buffer += sizeof(regs->xfs) * 2; 2.46 - hex2mem(buffer, (char *)®s->xgs, sizeof(regs->xgs)); 2.47 + hex2mem(buffer, (char *)®s->cs, sizeof(regs->cs)); 2.48 + buffer += sizeof(regs->cs) * 2; 2.49 + hex2mem(buffer, (char *)®s->ss, sizeof(regs->ss)); 2.50 + buffer += sizeof(regs->ss) * 2; 2.51 + hex2mem(buffer, (char *)®s->ds, sizeof(regs->ds)); 2.52 + buffer += sizeof(regs->ds) * 2; 2.53 + hex2mem(buffer, (char *)®s->es, sizeof(regs->es)); 2.54 + buffer += sizeof(regs->es) * 2; 2.55 + hex2mem(buffer, (char *)®s->fs, sizeof(regs->fs)); 2.56 + buffer += sizeof(regs->fs) * 2; 2.57 + hex2mem(buffer, (char *)®s->gs, sizeof(regs->gs)); 2.58 } 2.59 2.60 int 2.61 @@ -1088,11 +1088,11 @@ int pdb_handle_exception(int exceptionVe 2.62 This occurs when leaving a system call from a domain. 2.63 */ 2.64 if ( exceptionVector == 3 && 2.65 - (xen_regs->xcs & 3) == 3 && 2.66 + (xen_regs->cs & 3) == 3 && 2.67 xen_regs->eip != pdb_system_call_next_addr + 1) 2.68 { 2.69 TRC(printf("pdb: user bkpt (0x%x) at 0x%x:0x%lx:0x%lx\n", 2.70 - exceptionVector, xen_regs->xcs & 3, cr3, xen_regs->eip)); 2.71 + exceptionVector, xen_regs->cs & 3, cr3, xen_regs->eip)); 2.72 return 1; 2.73 } 2.74
3.1 --- a/xen/arch/x86/traps.c Tue Nov 09 10:51:49 2004 +0000 3.2 +++ b/xen/arch/x86/traps.c Tue Nov 09 10:52:02 2004 +0000 3.3 @@ -166,25 +166,35 @@ void show_stack(unsigned long *esp) 3.4 void show_registers(struct xen_regs *regs) 3.5 { 3.6 unsigned long esp; 3.7 - unsigned short ss; 3.8 + unsigned short ss, ds, es, fs, gs; 3.9 3.10 - esp = (unsigned long)(®s->esp); 3.11 - ss = __HYPERVISOR_DS; 3.12 - if ( regs->xcs & 3 ) 3.13 + if ( regs->cs & 3 ) 3.14 { 3.15 esp = regs->esp; 3.16 - ss = regs->xss & 0xffff; 3.17 + ss = regs->ss & 0xffff; 3.18 + ds = regs->ds & 0xffff; 3.19 + es = regs->es & 0xffff; 3.20 + fs = regs->fs & 0xffff; 3.21 + gs = regs->gs & 0xffff; 3.22 + } 3.23 + else 3.24 + { 3.25 + esp = (unsigned long)(®s->esp); 3.26 + ss = __HYPERVISOR_DS; 3.27 + ds = __HYPERVISOR_DS; 3.28 + es = __HYPERVISOR_DS; 3.29 + fs = __HYPERVISOR_DS; 3.30 + gs = __HYPERVISOR_DS; 3.31 } 3.32 3.33 printk("CPU: %d\nEIP: %04x:[<%08lx>] \nEFLAGS: %08lx\n", 3.34 - smp_processor_id(), 0xffff & regs->xcs, regs->eip, regs->eflags); 3.35 + smp_processor_id(), 0xffff & regs->cs, regs->eip, regs->eflags); 3.36 printk("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", 3.37 regs->eax, regs->ebx, regs->ecx, regs->edx); 3.38 printk("esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", 3.39 regs->esi, regs->edi, regs->ebp, esp); 3.40 printk("ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n", 3.41 - regs->xds & 0xffff, regs->xes & 0xffff, 3.42 - regs->xfs & 0xffff, regs->xgs & 0xffff, ss); 3.43 + ds, es, fs, gs, ss); 3.44 3.45 show_stack(®s->esp); 3.46 } 3.47 @@ -212,7 +222,7 @@ static inline void do_trap(int trapnr, c 3.48 trap_info_t *ti; 3.49 unsigned long fixup; 3.50 3.51 - if (!(regs->xcs & 3)) 3.52 + if (!(regs->cs & 3)) 3.53 goto xen_fault; 3.54 3.55 ti = current->thread.traps + trapnr; 3.56 @@ -230,7 +240,6 @@ static inline void do_trap(int trapnr, c 3.57 { 3.58 DPRINTK("Trap %d: %08lx -> %08lx\n", trapnr, regs->eip, fixup); 3.59 regs->eip = fixup; 3.60 - regs->xds = regs->xes = regs->xfs = regs->xgs = __HYPERVISOR_DS; 3.61 return; 3.62 } 3.63 3.64 @@ -276,9 +285,9 @@ asmlinkage void do_int3(struct xen_regs 3.65 return; 3.66 #endif 3.67 3.68 - if ( (regs->xcs & 3) != 3 ) 3.69 + if ( (regs->cs & 3) != 3 ) 3.70 { 3.71 - if ( unlikely((regs->xcs & 3) == 0) ) 3.72 + if ( unlikely((regs->cs & 3) == 0) ) 3.73 { 3.74 show_registers(regs); 3.75 panic("CPU%d FATAL TRAP: vector = 3 (Int3)\n" 3.76 @@ -374,7 +383,7 @@ asmlinkage void do_page_fault(struct xen 3.77 return; /* successfully copied the mapping */ 3.78 } 3.79 3.80 - if ( unlikely(!(regs->xcs & 3)) ) 3.81 + if ( unlikely(!(regs->cs & 3)) ) 3.82 goto xen_fault; 3.83 3.84 ti = ed->thread.traps + 14; 3.85 @@ -395,7 +404,6 @@ asmlinkage void do_page_fault(struct xen 3.86 if ( !ed->mm.shadow_mode ) 3.87 DPRINTK("Page fault: %08lx -> %08lx\n", regs->eip, fixup); 3.88 regs->eip = fixup; 3.89 - regs->xds = regs->xes = regs->xfs = regs->xgs = __HYPERVISOR_DS; 3.90 return; 3.91 } 3.92 3.93 @@ -443,7 +451,7 @@ asmlinkage void do_general_protection(st 3.94 unsigned long fixup; 3.95 3.96 /* Badness if error in ring 0, or result of an interrupt. */ 3.97 - if ( !(regs->xcs & 3) || (error_code & 1) ) 3.98 + if ( !(regs->cs & 3) || (error_code & 1) ) 3.99 goto gp_in_kernel; 3.100 3.101 /* 3.102 @@ -470,7 +478,7 @@ asmlinkage void do_general_protection(st 3.103 { 3.104 /* This fault must be due to <INT n> instruction. */ 3.105 ti = current->thread.traps + (error_code>>3); 3.106 - if ( TI_GET_DPL(ti) >= (regs->xcs & 3) ) 3.107 + if ( TI_GET_DPL(ti) >= (regs->cs & 3) ) 3.108 { 3.109 #ifdef XEN_DEBUGGER 3.110 if ( pdb_initialized && (pdb_ctx.system_call != 0) ) 3.111 @@ -511,7 +519,6 @@ asmlinkage void do_general_protection(st 3.112 { 3.113 DPRINTK("GPF (%04lx): %08lx -> %08lx\n", error_code, regs->eip, fixup); 3.114 regs->eip = fixup; 3.115 - regs->xds = regs->xes = regs->xfs = regs->xgs = __HYPERVISOR_DS; 3.116 return; 3.117 } 3.118 3.119 @@ -657,7 +664,7 @@ asmlinkage void do_debug(struct xen_regs 3.120 return; 3.121 } 3.122 3.123 - if ( (regs->xcs & 3) == 0 ) 3.124 + if ( (regs->cs & 3) == 0 ) 3.125 { 3.126 /* Clear TF just for absolute sanity. */ 3.127 regs->eflags &= ~EF_TF;
4.1 --- a/xen/arch/x86/x86_32/entry.S Tue Nov 09 10:51:49 2004 +0000 4.2 +++ b/xen/arch/x86/x86_32/entry.S Tue Nov 09 10:52:02 2004 +0000 4.3 @@ -59,76 +59,9 @@ 4.4 #include <xen/config.h> 4.5 #include <xen/errno.h> 4.6 #include <xen/softirq.h> 4.7 +#include <asm/x86_32/asm_defns.h> 4.8 #include <public/xen.h> 4.9 4.10 -EBX = 0x00 4.11 -ECX = 0x04 4.12 -EDX = 0x08 4.13 -ESI = 0x0C 4.14 -EDI = 0x10 4.15 -EBP = 0x14 4.16 -EAX = 0x18 4.17 -DS = 0x1C 4.18 -ES = 0x20 4.19 -FS = 0x24 4.20 -GS = 0x28 4.21 -ORIG_EAX = 0x2C 4.22 -EIP = 0x30 4.23 -CS = 0x34 4.24 -EFLAGS = 0x38 4.25 -OLDESP = 0x3C 4.26 -OLDSS = 0x40 4.27 - 4.28 -/* Offsets in domain structure */ 4.29 -PROCESSOR = 0 4.30 -SHARED_INFO = 4 4.31 -EVENT_SEL = 8 4.32 -EVENT_ADDR = 12 4.33 -FAILSAFE_BUFFER = 16 4.34 -FAILSAFE_SEL = 32 4.35 -FAILSAFE_ADDR = 36 4.36 - 4.37 -/* Offsets in shared_info_t */ 4.38 -#define UPCALL_PENDING /* 0 */ 4.39 -#define UPCALL_MASK 1 4.40 - 4.41 -/* Offsets in guest_trap_bounce */ 4.42 -GTB_ERROR_CODE = 0 4.43 -GTB_CR2 = 4 4.44 -GTB_FLAGS = 8 4.45 -GTB_CS = 10 4.46 -GTB_EIP = 12 4.47 -GTBF_TRAP = 1 4.48 -GTBF_TRAP_NOCODE = 2 4.49 -GTBF_TRAP_CR2 = 4 4.50 - 4.51 -CF_MASK = 0x00000001 4.52 -IF_MASK = 0x00000200 4.53 -NT_MASK = 0x00004000 4.54 - 4.55 -#define SAVE_ALL_NOSEGREGS \ 4.56 - cld; \ 4.57 - pushl %gs; \ 4.58 - pushl %fs; \ 4.59 - pushl %es; \ 4.60 - pushl %ds; \ 4.61 - pushl %eax; \ 4.62 - pushl %ebp; \ 4.63 - pushl %edi; \ 4.64 - pushl %esi; \ 4.65 - pushl %edx; \ 4.66 - pushl %ecx; \ 4.67 - pushl %ebx; \ 4.68 - 4.69 -#define SAVE_ALL \ 4.70 - SAVE_ALL_NOSEGREGS \ 4.71 - movl $(__HYPERVISOR_DS),%edx; \ 4.72 - movl %edx,%ds; \ 4.73 - movl %edx,%es; \ 4.74 - movl %edx,%fs; \ 4.75 - movl %edx,%gs; \ 4.76 - sti; 4.77 - 4.78 #define GET_CURRENT(reg) \ 4.79 movl $4096-4, reg; \ 4.80 orl %esp, reg; \ 4.81 @@ -226,17 +159,10 @@ multicall_fixup1: 4.82 4.83 ALIGN 4.84 restore_all_guest: 4.85 - # First, may need to restore %ds if clobbered by create_bounce_frame 4.86 - pushl %ss 4.87 - popl %ds 4.88 - # Second, create a failsafe copy of DS,ES,FS,GS in case any are bad 4.89 - leal DS(%esp),%esi 4.90 - leal FAILSAFE_BUFFER(%ebx),%edi 4.91 - movsl 4.92 - movsl 4.93 - movsl 4.94 - movsl 4.95 - # Finally, restore guest registers -- faults will cause failsafe 4.96 +1: movl XREGS_ds(%esp),%ds 4.97 +2: movl XREGS_es(%esp),%es 4.98 +3: movl XREGS_fs(%esp),%fs 4.99 +4: movl XREGS_gs(%esp),%gs 4.100 popl %ebx 4.101 popl %ecx 4.102 popl %edx 4.103 @@ -244,62 +170,50 @@ restore_all_guest: 4.104 popl %edi 4.105 popl %ebp 4.106 popl %eax 4.107 -1: popl %ds 4.108 -2: popl %es 4.109 -3: popl %fs 4.110 -4: popl %gs 4.111 addl $4,%esp 4.112 5: iret 4.113 .section .fixup,"ax" 4.114 -10: subl $4,%esp 4.115 - pushl %gs 4.116 -9: pushl %fs 4.117 -8: pushl %es 4.118 -7: pushl %ds 4.119 -6: pushl %eax 4.120 +6: subl $4,%esp 4.121 + pushl %eax 4.122 pushl %ebp 4.123 pushl %edi 4.124 pushl %esi 4.125 pushl %edx 4.126 pushl %ecx 4.127 pushl %ebx 4.128 - pushl %ss 4.129 - popl %ds 4.130 - pushl %ss 4.131 - popl %es 4.132 - jmp failsafe_callback 4.133 +7: SET_XEN_SEGMENTS(a) 4.134 + jmp failsafe_callback 4.135 .previous 4.136 .section __ex_table,"a" 4.137 .align 4 4.138 - .long 1b,6b 4.139 + .long 1b,7b 4.140 .long 2b,7b 4.141 - .long 3b,8b 4.142 - .long 4b,9b 4.143 - .long 5b,10b 4.144 + .long 3b,7b 4.145 + .long 4b,7b 4.146 + .long 5b,6b 4.147 .previous 4.148 4.149 /* No special register assumptions */ 4.150 failsafe_callback: 4.151 GET_CURRENT(%ebx) 4.152 - movl PROCESSOR(%ebx),%eax 4.153 + movl DOMAIN_processor(%ebx),%eax 4.154 shl $4,%eax 4.155 lea guest_trap_bounce(%eax),%edx 4.156 - movl FAILSAFE_ADDR(%ebx),%eax 4.157 - movl %eax,GTB_EIP(%edx) 4.158 - movl FAILSAFE_SEL(%ebx),%eax 4.159 - movw %ax,GTB_CS(%edx) 4.160 + movl DOMAIN_failsafe_addr(%ebx),%eax 4.161 + movl %eax,GTB_eip(%edx) 4.162 + movl DOMAIN_failsafe_sel(%ebx),%eax 4.163 + movw %ax,GTB_cs(%edx) 4.164 call create_bounce_frame 4.165 subl $16,%esi # add DS/ES/FS/GS to failsafe stack frame 4.166 - leal FAILSAFE_BUFFER(%ebx),%ebp 4.167 - movl 0(%ebp),%eax # DS 4.168 -FAULT1: movl %eax,(%esi) 4.169 - movl 4(%ebp),%eax # ES 4.170 -FAULT2: movl %eax,4(%esi) 4.171 - movl 8(%ebp),%eax # FS 4.172 -FAULT3: movl %eax,8(%esi) 4.173 - movl 12(%ebp),%eax # GS 4.174 -FAULT4: movl %eax,12(%esi) 4.175 - movl %esi,OLDESP(%esp) 4.176 + movl XREGS_ds(%esp),%eax 4.177 +FAULT1: movl %eax,%gs:(%esi) 4.178 + movl XREGS_es(%esp),%eax 4.179 +FAULT2: movl %eax,%gs:4(%esi) 4.180 + movl XREGS_fs(%esp),%eax 4.181 +FAULT3: movl %eax,%gs:8(%esi) 4.182 + movl XREGS_gs(%esp),%eax 4.183 +FAULT4: movl %eax,%gs:12(%esi) 4.184 + movl %esi,XREGS_esp(%esp) 4.185 popl %ebx 4.186 popl %ecx 4.187 popl %edx 4.188 @@ -307,15 +221,10 @@ FAULT4: movl %eax,12(%esi) 4.189 popl %edi 4.190 popl %ebp 4.191 popl %eax 4.192 - addl $20,%esp # skip DS/ES/FS/GS/ORIG_EAX 4.193 + addl $4,%esp 4.194 FAULT5: iret 4.195 4.196 - 4.197 ALIGN 4.198 -# Simple restore -- we should never fault as we we will only interrupt ring 0 4.199 -# when sane values have been placed in all registers. The only exception is 4.200 -# NMI, which may interrupt before good values have been placed in DS-GS. 4.201 -# The NMI return code deals with this problem itself. 4.202 restore_all_xen: 4.203 popl %ebx 4.204 popl %ecx 4.205 @@ -324,48 +233,45 @@ restore_all_xen: 4.206 popl %edi 4.207 popl %ebp 4.208 popl %eax 4.209 - popl %ds 4.210 - popl %es 4.211 - popl %fs 4.212 - popl %gs 4.213 addl $4,%esp 4.214 iret 4.215 4.216 ALIGN 4.217 ENTRY(hypercall) 4.218 pushl %eax # save orig_eax 4.219 - SAVE_ALL 4.220 - GET_CURRENT(%ebx) 4.221 + SAVE_ALL(b) 4.222 + sti 4.223 + GET_CURRENT(%ebx) 4.224 andl $(NR_hypercalls-1),%eax 4.225 call *SYMBOL_NAME(hypercall_table)(,%eax,4) 4.226 4.227 ret_from_hypercall: 4.228 - movl %eax,EAX(%esp) # save the return value 4.229 + movl %eax,XREGS_eax(%esp) # save the return value 4.230 4.231 test_all_events: 4.232 xorl %ecx,%ecx 4.233 notl %ecx 4.234 cli # tests must not race interrupts 4.235 /*test_softirqs:*/ 4.236 - movl PROCESSOR(%ebx),%eax 4.237 + movl DOMAIN_processor(%ebx),%eax 4.238 shl $6,%eax # sizeof(irq_cpustat) == 64 4.239 test %ecx,SYMBOL_NAME(irq_stat)(%eax,1) 4.240 jnz process_softirqs 4.241 /*test_guest_events:*/ 4.242 - movl SHARED_INFO(%ebx),%eax 4.243 - testb $0xFF,UPCALL_MASK(%eax) 4.244 + movl DOMAIN_shared_info(%ebx),%eax 4.245 + testb $0xFF,SHINFO_upcall_mask(%eax) 4.246 jnz restore_all_guest 4.247 - testb $0xFF,UPCALL_PENDING(%eax) 4.248 + testb $0xFF,SHINFO_upcall_pending(%eax) 4.249 jz restore_all_guest 4.250 - movb $1,UPCALL_MASK(%eax) # Upcalls are masked during delivery 4.251 + movb $1,SHINFO_upcall_mask(%eax) # Upcalls are masked during delivery 4.252 /*process_guest_events:*/ 4.253 - movl PROCESSOR(%ebx),%edx 4.254 - shl $4,%edx # sizeof(guest_trap_bounce) == 16 4.255 + movl DOMAIN_processor(%ebx),%edx 4.256 + shl $4,%edx # sizeof(guest_trap_bounce) == 16 4.257 lea guest_trap_bounce(%edx),%edx 4.258 - movl EVENT_ADDR(%ebx),%eax 4.259 - movl %eax,GTB_EIP(%edx) 4.260 - movl EVENT_SEL(%ebx),%eax 4.261 - movw %ax,GTB_CS(%edx) 4.262 + movl DOMAIN_event_addr(%ebx),%eax 4.263 + movl %eax,GTB_eip(%edx) 4.264 + movl DOMAIN_event_sel(%ebx),%eax 4.265 + movw %ax,GTB_cs(%edx) 4.266 call create_bounce_frame 4.267 jmp restore_all_guest 4.268 4.269 @@ -375,16 +281,16 @@ process_softirqs: 4.270 call SYMBOL_NAME(do_softirq) 4.271 jmp test_all_events 4.272 4.273 -/* CREATE A BASIC EXCEPTION FRAME ON GUEST OS (RING-1) STACK: */ 4.274 -/* {EIP, CS, EFLAGS, [ESP, SS]} */ 4.275 -/* %edx == guest_trap_bounce, %ebx == task_struct */ 4.276 -/* %eax,%ecx are clobbered. %ds:%esi contain new OLDSS/OLDESP. */ 4.277 +/* CREATE A BASIC EXCEPTION FRAME ON GUEST OS (RING-1) STACK: */ 4.278 +/* {EIP, CS, EFLAGS, [ESP, SS]} */ 4.279 +/* %edx == guest_trap_bounce, %ebx == task_struct */ 4.280 +/* %eax,%ecx are clobbered. %gs:%esi contain new XREGS_ss/XREGS_esp. */ 4.281 create_bounce_frame: 4.282 - mov CS+4(%esp),%cl 4.283 + mov XREGS_cs+4(%esp),%cl 4.284 test $2,%cl 4.285 jz 1f /* jump if returning to an existing ring-1 activation */ 4.286 /* obtain ss/esp from TSS -- no current ring-1 activations */ 4.287 - movl PROCESSOR(%ebx),%eax 4.288 + movl DOMAIN_processor(%ebx),%eax 4.289 /* next 4 lines multiply %eax by 8320, which is sizeof(tss_struct) */ 4.290 movl %eax, %ecx 4.291 shll $7, %ecx 4.292 @@ -392,38 +298,37 @@ create_bounce_frame: 4.293 addl %ecx,%eax 4.294 addl $init_tss + 12,%eax 4.295 movl (%eax),%esi /* tss->esp1 */ 4.296 -FAULT6: movl 4(%eax),%ds /* tss->ss1 */ 4.297 +FAULT6: movl 4(%eax),%gs /* tss->ss1 */ 4.298 /* base of stack frame must contain ss/esp (inter-priv iret) */ 4.299 subl $8,%esi 4.300 - movl OLDESP+4(%esp),%eax 4.301 -FAULT7: movl %eax,(%esi) 4.302 - movl OLDSS+4(%esp),%eax 4.303 -FAULT8: movl %eax,4(%esi) 4.304 + movl XREGS_esp+4(%esp),%eax 4.305 +FAULT7: movl %eax,%gs:(%esi) 4.306 + movl XREGS_ss+4(%esp),%eax 4.307 +FAULT8: movl %eax,%gs:4(%esi) 4.308 jmp 2f 4.309 1: /* obtain ss/esp from oldss/oldesp -- a ring-1 activation exists */ 4.310 - movl OLDESP+4(%esp),%esi 4.311 -FAULT9: movl OLDSS+4(%esp),%ds 4.312 + movl XREGS_esp+4(%esp),%esi 4.313 +FAULT9: movl XREGS_ss+4(%esp),%gs 4.314 2: /* Construct a stack frame: EFLAGS, CS/EIP */ 4.315 subl $12,%esi 4.316 - movl EIP+4(%esp),%eax 4.317 -FAULT10:movl %eax,(%esi) 4.318 - movl CS+4(%esp),%eax 4.319 -FAULT11:movl %eax,4(%esi) 4.320 - movl EFLAGS+4(%esp),%eax 4.321 -FAULT12:movl %eax,8(%esi) 4.322 + movl XREGS_eip+4(%esp),%eax 4.323 +FAULT10:movl %eax,%gs:(%esi) 4.324 + movl XREGS_cs+4(%esp),%eax 4.325 +FAULT11:movl %eax,%gs:4(%esi) 4.326 + movl XREGS_eflags+4(%esp),%eax 4.327 +FAULT12:movl %eax,%gs:8(%esi) 4.328 /* Rewrite our stack frame and return to ring 1. */ 4.329 /* IA32 Ref. Vol. 3: TF, VM, RF and NT flags are cleared on trap. */ 4.330 andl $0xfffcbeff,%eax 4.331 - movl %eax,EFLAGS+4(%esp) 4.332 - movl %ds,OLDSS+4(%esp) 4.333 - movl %esi,OLDESP+4(%esp) 4.334 - movzwl %es:GTB_CS(%edx),%eax 4.335 - movl %eax,CS+4(%esp) 4.336 - movl %es:GTB_EIP(%edx),%eax 4.337 - movl %eax,EIP+4(%esp) 4.338 + movl %eax,XREGS_eflags+4(%esp) 4.339 + movl %gs,XREGS_ss+4(%esp) 4.340 + movl %esi,XREGS_esp+4(%esp) 4.341 + movzwl GTB_cs(%edx),%eax 4.342 + movl %eax,XREGS_cs+4(%esp) 4.343 + movl GTB_eip(%edx),%eax 4.344 + movl %eax,XREGS_eip+4(%esp) 4.345 ret 4.346 - 4.347 - 4.348 + 4.349 .section __ex_table,"a" 4.350 .align 4 4.351 .long FAULT1, crash_domain_fixup3 # Fault writing to ring-1 stack 4.352 @@ -446,45 +351,42 @@ FAULT12:movl %eax,8(%esi) 4.353 .section .fixup,"ax" 4.354 crash_domain_fixup1: 4.355 subl $4,%esp 4.356 - SAVE_ALL 4.357 + SAVE_ALL(a) 4.358 + sti 4.359 jmp domain_crash 4.360 crash_domain_fixup2: 4.361 addl $4,%esp 4.362 crash_domain_fixup3: 4.363 - pushl %ss 4.364 - popl %ds 4.365 jmp domain_crash 4.366 .previous 4.367 4.368 ALIGN 4.369 process_guest_exception_and_events: 4.370 - movl PROCESSOR(%ebx),%eax 4.371 + movl DOMAIN_processor(%ebx),%eax 4.372 shl $4,%eax 4.373 lea guest_trap_bounce(%eax),%edx 4.374 - testb $~0,GTB_FLAGS(%edx) 4.375 + testb $~0,GTB_flags(%edx) 4.376 jz test_all_events 4.377 call create_bounce_frame # just the basic frame 4.378 - mov %es:GTB_FLAGS(%edx),%cl 4.379 + mov GTB_flags(%edx),%cl 4.380 test $GTBF_TRAP_NOCODE,%cl 4.381 jnz 2f 4.382 subl $4,%esi # push error_code onto guest frame 4.383 - movl %es:GTB_ERROR_CODE(%edx),%eax 4.384 -FAULT13:movl %eax,(%esi) 4.385 + movl GTB_error_code(%edx),%eax 4.386 +FAULT13:movl %eax,%gs:(%esi) 4.387 test $GTBF_TRAP_CR2,%cl 4.388 jz 1f 4.389 subl $4,%esi # push %cr2 onto guest frame 4.390 - movl %es:GTB_CR2(%edx),%eax 4.391 -FAULT14:movl %eax,(%esi) 4.392 -1: movl %esi,OLDESP(%esp) 4.393 -2: push %es # unclobber %ds 4.394 - pop %ds 4.395 - movb $0,GTB_FLAGS(%edx) 4.396 + movl GTB_cr2(%edx),%eax 4.397 +FAULT14:movl %eax,%gs:(%esi) 4.398 +1: movl %esi,XREGS_esp(%esp) 4.399 +2: movb $0,GTB_flags(%edx) 4.400 jmp test_all_events 4.401 4.402 ALIGN 4.403 ENTRY(ret_from_intr) 4.404 GET_CURRENT(%ebx) 4.405 - movb CS(%esp),%al 4.406 + movb XREGS_cs(%esp),%al 4.407 testb $3,%al # return to non-supervisor? 4.408 jne test_all_events 4.409 jmp restore_all_xen 4.410 @@ -494,36 +396,31 @@ ENTRY(divide_error) 4.411 pushl $ SYMBOL_NAME(do_divide_error) 4.412 ALIGN 4.413 error_code: 4.414 - pushl %fs 4.415 - pushl %es 4.416 - pushl %ds 4.417 - pushl %eax 4.418 - xorl %eax,%eax 4.419 - pushl %ebp 4.420 + cld 4.421 + pushl %ebp 4.422 pushl %edi 4.423 pushl %esi 4.424 pushl %edx 4.425 - decl %eax # eax = -1 4.426 pushl %ecx 4.427 pushl %ebx 4.428 - cld 4.429 - movl %gs,%ecx 4.430 - movl ORIG_EAX(%esp), %esi # get the error code 4.431 - movl GS(%esp), %edi # get the function address 4.432 - movl %eax, ORIG_EAX(%esp) 4.433 - movl %ecx, GS(%esp) 4.434 - movl $(__HYPERVISOR_DS),%edx 4.435 - movl %edx,%ds 4.436 - movl %edx,%es 4.437 - movl %edx,%fs 4.438 - movl %edx,%gs 4.439 + movb XREGS_cs(%esp),%bl 4.440 + testb $3,%bl 4.441 + je 1f 4.442 + movl %ds,XREGS_ds(%esp) 4.443 + movl %es,XREGS_es(%esp) 4.444 + movl %fs,XREGS_fs(%esp) 4.445 + movl %gs,XREGS_gs(%esp) 4.446 +1: SET_XEN_SEGMENTS(b) 4.447 + movl XREGS_orig_eax(%esp),%esi # get the error code 4.448 + movl XREGS_eax(%esp),%edi # get the function address 4.449 + movl %eax,XREGS_eax(%esp) 4.450 movl %esp,%edx 4.451 pushl %esi # push the error code 4.452 pushl %edx # push the xen_regs pointer 4.453 GET_CURRENT(%ebx) 4.454 - call *%edi 4.455 + call *%edi 4.456 addl $8,%esp 4.457 - movb CS(%esp),%al 4.458 + movb XREGS_cs(%esp),%al 4.459 testb $3,%al 4.460 je restore_all_xen 4.461 jmp process_guest_exception_and_events 4.462 @@ -611,7 +508,7 @@ ENTRY(nmi) 4.463 # Save state but do not trash the segment registers! 4.464 # We may otherwise be unable to reload them or copy them to ring 1. 4.465 pushl %eax 4.466 - SAVE_ALL_NOSEGREGS 4.467 + SAVE_ALL_NOSEGREGS(a) 4.468 4.469 # Check for hardware problems. 4.470 inb $0x61,%al 4.471 @@ -628,21 +525,21 @@ ENTRY(nmi) 4.472 # In all other cases we bail without touching DS-GS, as we have 4.473 # interrupted an enclosing Xen activation in tricky prologue or 4.474 # epilogue code. 4.475 - movb CS(%esp),%al 4.476 + movb XREGS_cs(%esp),%al 4.477 testb $3,%al 4.478 jne do_watchdog_tick 4.479 - movl DS(%esp),%eax 4.480 + movl XREGS_ds(%esp),%eax 4.481 cmpw $(__HYPERVISOR_DS),%ax 4.482 - jne nmi_badseg 4.483 - movl ES(%esp),%eax 4.484 + jne restore_all_xen 4.485 + movl XREGS_es(%esp),%eax 4.486 cmpw $(__HYPERVISOR_DS),%ax 4.487 - jne nmi_badseg 4.488 - movl FS(%esp),%eax 4.489 + jne restore_all_xen 4.490 + movl XREGS_fs(%esp),%eax 4.491 cmpw $(__HYPERVISOR_DS),%ax 4.492 - jne nmi_badseg 4.493 - movl GS(%esp),%eax 4.494 + jne restore_all_xen 4.495 + movl XREGS_gs(%esp),%eax 4.496 cmpw $(__HYPERVISOR_DS),%ax 4.497 - jne nmi_badseg 4.498 + jne restore_all_xen 4.499 4.500 do_watchdog_tick: 4.501 movl $(__HYPERVISOR_DS),%edx 4.502 @@ -653,34 +550,23 @@ do_watchdog_tick: 4.503 pushl %edx # regs 4.504 call SYMBOL_NAME(do_nmi) 4.505 addl $8,%esp 4.506 - movb CS(%esp),%al 4.507 + movb XREGS_cs(%esp),%al 4.508 testb $3,%al 4.509 je restore_all_xen 4.510 GET_CURRENT(%ebx) 4.511 jmp restore_all_guest 4.512 4.513 -nmi_badseg: 4.514 - popl %ebx 4.515 - popl %ecx 4.516 - popl %edx 4.517 - popl %esi 4.518 - popl %edi 4.519 - popl %ebp 4.520 - popl %eax 4.521 - addl $20,%esp 4.522 - iret 4.523 - 4.524 nmi_parity_err: 4.525 # Clear and disable the parity-error line 4.526 andb $0xf,%al 4.527 orb $0x4,%al 4.528 outb %al,$0x61 4.529 cmpb $'i',%ss:SYMBOL_NAME(opt_nmi) # nmi=ignore 4.530 - je nmi_badseg 4.531 + je restore_all_xen 4.532 bts $0,%ss:SYMBOL_NAME(nmi_softirq_reason) 4.533 bts $NMI_SOFTIRQ,%ss:SYMBOL_NAME(irq_stat) 4.534 cmpb $'d',%ss:SYMBOL_NAME(opt_nmi) # nmi=dom0 4.535 - je nmi_badseg 4.536 + je restore_all_xen 4.537 movl $(__HYPERVISOR_DS),%edx # nmi=fatal 4.538 movl %edx,%ds 4.539 movl %edx,%es 4.540 @@ -696,11 +582,11 @@ nmi_io_err: 4.541 orb $0x8,%al 4.542 outb %al,$0x61 4.543 cmpb $'i',%ss:SYMBOL_NAME(opt_nmi) # nmi=ignore 4.544 - je nmi_badseg 4.545 + je restore_all_xen 4.546 bts $1,%ss:SYMBOL_NAME(nmi_softirq_reason) 4.547 bts $NMI_SOFTIRQ,%ss:SYMBOL_NAME(irq_stat) 4.548 cmpb $'d',%ss:SYMBOL_NAME(opt_nmi) # nmi=dom0 4.549 - je nmi_badseg 4.550 + je restore_all_xen 4.551 movl $(__HYPERVISOR_DS),%edx # nmi=fatal 4.552 movl %edx,%ds 4.553 movl %edx,%es
5.1 --- a/xen/arch/x86/x86_32/seg_fixup.c Tue Nov 09 10:51:49 2004 +0000 5.2 +++ b/xen/arch/x86/x86_32/seg_fixup.c Tue Nov 09 10:52:02 2004 +0000 5.3 @@ -297,15 +297,15 @@ int gpf_emulate_4gb(struct xen_regs *reg 5.4 unsigned int *pseg = NULL; /* segment for memory operand (NULL=default) */ 5.5 5.6 /* WARNING: We only work for ring-3 segments. */ 5.7 - if ( unlikely((regs->xcs & 3) != 3) ) 5.8 + if ( unlikely((regs->cs & 3) != 3) ) 5.9 { 5.10 - DPRINTK("Taken fault at bad CS %04x\n", regs->xcs); 5.11 + DPRINTK("Taken fault at bad CS %04x\n", regs->cs); 5.12 goto fail; 5.13 } 5.14 5.15 - if ( !linearise_address((u16)regs->xcs, regs->eip, (unsigned long *)&eip) ) 5.16 + if ( !linearise_address((u16)regs->cs, regs->eip, (unsigned long *)&eip) ) 5.17 { 5.18 - DPRINTK("Cannot linearise %04x:%08lx\n", regs->xcs, regs->eip); 5.19 + DPRINTK("Cannot linearise %04x:%08lx\n", regs->cs, regs->eip); 5.20 goto fail; 5.21 } 5.22 5.23 @@ -332,22 +332,22 @@ int gpf_emulate_4gb(struct xen_regs *reg 5.24 case 0x66: /* Operand-size override */ 5.25 break; 5.26 case 0x2e: /* CS override */ 5.27 - pseg = ®s->xcs; 5.28 + pseg = ®s->cs; 5.29 break; 5.30 case 0x3e: /* DS override */ 5.31 - pseg = ®s->xds; 5.32 + pseg = ®s->ds; 5.33 break; 5.34 case 0x26: /* ES override */ 5.35 - pseg = ®s->xes; 5.36 + pseg = ®s->es; 5.37 break; 5.38 case 0x64: /* FS override */ 5.39 - pseg = ®s->xfs; 5.40 + pseg = ®s->fs; 5.41 break; 5.42 case 0x65: /* GS override */ 5.43 - pseg = ®s->xgs; 5.44 + pseg = ®s->gs; 5.45 break; 5.46 case 0x36: /* SS override */ 5.47 - pseg = ®s->xss; 5.48 + pseg = ®s->ss; 5.49 break; 5.50 default: /* Not a prefix byte */ 5.51 goto done_prefix; 5.52 @@ -409,7 +409,7 @@ int gpf_emulate_4gb(struct xen_regs *reg 5.53 { 5.54 case 0: 5.55 if ( pseg == NULL ) 5.56 - pseg = ®s->xds; 5.57 + pseg = ®s->ds; 5.58 disp32 = 0; 5.59 if ( rm == 5 ) /* disp32 rather than (EBP) */ 5.60 { 5.61 @@ -425,7 +425,7 @@ int gpf_emulate_4gb(struct xen_regs *reg 5.62 5.63 case 1: 5.64 if ( pseg == NULL ) /* NB. EBP defaults to SS */ 5.65 - pseg = (rm == 5) ? ®s->xss : ®s->xds; 5.66 + pseg = (rm == 5) ? ®s->ss : ®s->ds; 5.67 if ( get_user(disp8, pb) ) 5.68 { 5.69 DPRINTK("Fault while extracting <disp8>.\n"); 5.70 @@ -437,7 +437,7 @@ int gpf_emulate_4gb(struct xen_regs *reg 5.71 5.72 case 2: 5.73 if ( pseg == NULL ) /* NB. EBP defaults to SS */ 5.74 - pseg = (rm == 5) ? ®s->xss : ®s->xds; 5.75 + pseg = (rm == 5) ? ®s->ss : ®s->ds; 5.76 if ( get_user(disp32, (u32 *)pb) ) 5.77 { 5.78 DPRINTK("Fault while extracting <disp8>.\n"); 5.79 @@ -482,7 +482,7 @@ int gpf_emulate_4gb(struct xen_regs *reg 5.80 "caused GPF(0) at %04x:%08lx\n", 5.81 eip[0], eip[1], eip[2], eip[3], 5.82 eip[4], eip[5], eip[6], eip[7], 5.83 - regs->xcs, regs->eip); 5.84 + regs->cs, regs->eip); 5.85 fail: 5.86 return 0; 5.87 }
6.1 --- a/xen/include/asm-x86/irq.h Tue Nov 09 10:51:49 2004 +0000 6.2 +++ b/xen/include/asm-x86/irq.h Tue Nov 09 10:52:02 2004 +0000 6.3 @@ -5,6 +5,7 @@ 6.4 6.5 #include <xen/config.h> 6.6 #include <asm/atomic.h> 6.7 +#include <asm/x86_32/asm_defns.h> 6.8 6.9 extern void disable_irq(unsigned int); 6.10 extern void disable_irq_nosync(unsigned int); 6.11 @@ -83,36 +84,6 @@ extern char _stext, _etext; 6.12 6.13 #define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs)) 6.14 6.15 -#define __STR(x) #x 6.16 -#define STR(x) __STR(x) 6.17 - 6.18 -#if defined(__i386__) 6.19 - 6.20 -#define SAVE_ALL \ 6.21 - "cld\n\t" \ 6.22 - "pushl %gs\n\t" \ 6.23 - "pushl %fs\n\t" \ 6.24 - "pushl %es\n\t" \ 6.25 - "pushl %ds\n\t" \ 6.26 - "pushl %eax\n\t" \ 6.27 - "pushl %ebp\n\t" \ 6.28 - "pushl %edi\n\t" \ 6.29 - "pushl %esi\n\t" \ 6.30 - "pushl %edx\n\t" \ 6.31 - "pushl %ecx\n\t" \ 6.32 - "pushl %ebx\n\t" \ 6.33 - "movl $" STR(__HYPERVISOR_DS) ",%edx\n\t" \ 6.34 - "movl %edx,%ds\n\t" \ 6.35 - "movl %edx,%es\n\t" \ 6.36 - "movl %edx,%fs\n\t" \ 6.37 - "movl %edx,%gs\n\t" 6.38 - 6.39 -#else 6.40 - 6.41 -#define SAVE_ALL 6.42 - 6.43 -#endif 6.44 - 6.45 #define BUILD_SMP_INTERRUPT(x,v) XBUILD_SMP_INTERRUPT(x,v) 6.46 #define XBUILD_SMP_INTERRUPT(x,v)\ 6.47 asmlinkage void x(void); \ 6.48 @@ -121,7 +92,7 @@ asmlinkage void call_##x(void); \ 6.49 "\n"__ALIGN_STR"\n" \ 6.50 SYMBOL_NAME_STR(x) ":\n\t" \ 6.51 "push"__OS" $"#v"\n\t" \ 6.52 - SAVE_ALL \ 6.53 + SAVE_ALL(a) \ 6.54 SYMBOL_NAME_STR(call_##x)":\n\t" \ 6.55 "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \ 6.56 "jmp ret_from_intr\n"); 6.57 @@ -134,7 +105,7 @@ asmlinkage void call_##x(void); \ 6.58 "\n"__ALIGN_STR"\n" \ 6.59 SYMBOL_NAME_STR(x) ":\n\t" \ 6.60 "push"__OS" $"#v"\n\t" \ 6.61 - SAVE_ALL \ 6.62 + SAVE_ALL(a) \ 6.63 "mov %"__OP"sp,%"__OP"ax\n\t" \ 6.64 "push %"__OP"ax\n\t" \ 6.65 SYMBOL_NAME_STR(call_##x)":\n\t" \ 6.66 @@ -147,7 +118,7 @@ asmlinkage void call_do_IRQ(void); \ 6.67 __asm__( \ 6.68 "\n" __ALIGN_STR"\n" \ 6.69 "common_interrupt:\n\t" \ 6.70 - SAVE_ALL \ 6.71 + SAVE_ALL(a) \ 6.72 SYMBOL_NAME_STR(call_do_IRQ)":\n\t" \ 6.73 "call " SYMBOL_NAME_STR(do_IRQ) "\n\t" \ 6.74 "jmp ret_from_intr\n");
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/xen/include/asm-x86/x86_32/asm_defns.h Tue Nov 09 10:52:02 2004 +0000 7.3 @@ -0,0 +1,122 @@ 7.4 +#ifndef __ASM_DEFNS_H__ 7.5 +#define __ASM_DEFNS_H__ 7.6 + 7.7 +/* Offsets in 'struct xen_regs' --- AUTO-GENERATE ME! */ 7.8 +#define XREGS_ebx 0x00 7.9 +#define XREGS_ecx 0x04 7.10 +#define XREGS_edx 0x08 7.11 +#define XREGS_esi 0x0C 7.12 +#define XREGS_edi 0x10 7.13 +#define XREGS_ebp 0x14 7.14 +#define XREGS_eax 0x18 7.15 +#define XREGS_orig_eax 0x1C 7.16 +#define XREGS_eip 0x20 7.17 +#define XREGS_cs 0x24 7.18 +#define XREGS_eflags 0x28 7.19 +#define XREGS_esp 0x2C 7.20 +#define XREGS_ss 0x30 7.21 +#define XREGS_es 0x34 7.22 +#define XREGS_ds 0x38 7.23 +#define XREGS_fs 0x3C 7.24 +#define XREGS_gs 0x40 7.25 + 7.26 +/* Offsets in 'struct domain' --- AUTO-GENERATE ME! */ 7.27 +#define DOMAIN_processor 0 7.28 +#define DOMAIN_shared_info 4 7.29 +#define DOMAIN_event_sel 8 7.30 +#define DOMAIN_event_addr 12 7.31 +#define DOMAIN_failsafe_sel 16 7.32 +#define DOMAIN_failsafe_addr 20 7.33 + 7.34 +/* Offsets in shared_info_t --- AUTO-GENERATE ME! */ 7.35 +#define SHINFO_upcall_pending /* 0 */ 7.36 +#define SHINFO_upcall_mask 1 7.37 + 7.38 +/* Offsets in 'struct guest_trap_bounce' --- AUTO-GENERATE ME! */ 7.39 +#define GTB_error_code 0 7.40 +#define GTB_cr2 4 7.41 +#define GTB_flags 8 7.42 +#define GTB_cs 10 7.43 +#define GTB_eip 12 7.44 +#define GTBF_TRAP 1 7.45 +#define GTBF_TRAP_NOCODE 2 7.46 +#define GTBF_TRAP_CR2 4 7.47 + 7.48 +/* EFLAGS masks. */ 7.49 +#define CF_MASK 0x00000001 7.50 +#define IF_MASK 0x00000200 7.51 +#define NT_MASK 0x00004000 7.52 + 7.53 +#define __STR(x) #x 7.54 +#define STR(x) __STR(x) 7.55 + 7.56 +/* AUTO-GENERATE the following two cases (quoted vs. unquoted). */ 7.57 +#ifndef __ASSEMBLY__ 7.58 + 7.59 +#define __SAVE_ALL_PRE(_reg) \ 7.60 + "cld;" \ 7.61 + "pushl %eax;" \ 7.62 + "pushl %ebp;" \ 7.63 + "pushl %edi;" \ 7.64 + "pushl %esi;" \ 7.65 + "pushl %edx;" \ 7.66 + "pushl %ecx;" \ 7.67 + "pushl %ebx;" \ 7.68 + "movb "STR(XREGS_cs)"(%esp),%"STR(_reg)"l;" \ 7.69 + "testb $3,%"STR(_reg)"l;" \ 7.70 + "je 1f;" \ 7.71 + "movl %ds,"STR(XREGS_ds)"(%esp);" \ 7.72 + "movl %es,"STR(XREGS_es)"(%esp);" \ 7.73 + "movl %fs,"STR(XREGS_fs)"(%esp);" \ 7.74 + "movl %gs,"STR(XREGS_gs)"(%esp);" 7.75 + 7.76 +#define SAVE_ALL_NOSEGREGS(_reg) \ 7.77 + __SAVE_ALL_PRE(_reg) \ 7.78 + "1:" 7.79 + 7.80 +#define SET_XEN_SEGMENTS(_reg) \ 7.81 + "movl $("STR(__HYPERVISOR_DS)"),%e"STR(_reg)"x;" \ 7.82 + "movl %e"STR(_reg)"x,%ds;" \ 7.83 + "movl %e"STR(_reg)"x,%es;" 7.84 + 7.85 +#define SAVE_ALL(_reg) \ 7.86 + __SAVE_ALL_PRE(_reg) \ 7.87 + SET_XEN_SEGMENTS(_reg) \ 7.88 + "1:" 7.89 + 7.90 +#else 7.91 + 7.92 +#define __SAVE_ALL_PRE(_reg) \ 7.93 + cld; \ 7.94 + pushl %eax; \ 7.95 + pushl %ebp; \ 7.96 + pushl %edi; \ 7.97 + pushl %esi; \ 7.98 + pushl %edx; \ 7.99 + pushl %ecx; \ 7.100 + pushl %ebx; \ 7.101 + movb XREGS_cs(%esp),% ## _reg ## l; \ 7.102 + testb $3,% ## _reg ## l; \ 7.103 + je 1f; \ 7.104 + movl %ds,XREGS_ds(%esp); \ 7.105 + movl %es,XREGS_es(%esp); \ 7.106 + movl %fs,XREGS_fs(%esp); \ 7.107 + movl %gs,XREGS_gs(%esp); 7.108 + 7.109 +#define SAVE_ALL_NOSEGREGS(_reg) \ 7.110 + __SAVE_ALL_PRE(_reg) \ 7.111 + 1: 7.112 + 7.113 +#define SET_XEN_SEGMENTS(_reg) \ 7.114 + movl $(__HYPERVISOR_DS),%e ## _reg ## x; \ 7.115 + movl %e ## _reg ## x,%ds; \ 7.116 + movl %e ## _reg ## x,%es; 7.117 + 7.118 +#define SAVE_ALL(_reg) \ 7.119 + __SAVE_ALL_PRE(_reg) \ 7.120 + SET_XEN_SEGMENTS(_reg) \ 7.121 + 1: 7.122 + 7.123 +#endif 7.124 + 7.125 +#endif /* __ASM_DEFNS_H__ */
8.1 --- a/xen/include/asm-x86/x86_32/current.h Tue Nov 09 10:51:49 2004 +0000 8.2 +++ b/xen/include/asm-x86/x86_32/current.h Tue Nov 09 10:52:02 2004 +0000 8.3 @@ -31,11 +31,17 @@ static inline execution_context_t *get_e 8.4 return execution_context; 8.5 } 8.6 8.7 +/* 8.8 + * Get the top-of-stack, as stored in the per-CPU TSS. This is actually 8.9 + * 20 bytes below the real top of the stack to allow space for: 8.10 + * domain pointer, DS, ES, FS, GS. 8.11 + */ 8.12 static inline unsigned long get_stack_top(void) 8.13 { 8.14 unsigned long p; 8.15 - __asm__ ( "orl %%esp,%0; andl $~3,%0" 8.16 - : "=r" (p) : "0" (STACK_SIZE-4) ); 8.17 + __asm__ ( "andl %%esp,%0; addl %2,%0" 8.18 + : "=r" (p) 8.19 + : "0" (~(STACK_SIZE-1)), "i" (STACK_SIZE-20) ); 8.20 return p; 8.21 } 8.22
9.1 --- a/xen/include/asm-x86/x86_32/regs.h Tue Nov 09 10:51:49 2004 +0000 9.2 +++ b/xen/include/asm-x86/x86_32/regs.h Tue Nov 09 10:52:02 2004 +0000 9.3 @@ -1,47 +1,51 @@ 9.4 #ifndef _I386_REGS_H 9.5 #define _I386_REGS_H 9.6 9.7 -struct xen_regs { 9.8 - long ebx; 9.9 - long ecx; 9.10 - long edx; 9.11 - long esi; 9.12 - long edi; 9.13 - long ebp; 9.14 - long eax; 9.15 - int xds; 9.16 - int xes; 9.17 - int xfs; 9.18 - int xgs; 9.19 - long orig_eax; 9.20 - long eip; 9.21 - int xcs; 9.22 - long eflags; 9.23 - long esp; 9.24 - int xss; 9.25 +struct xen_regs 9.26 +{ 9.27 + /* All saved activations contain the following fields. */ 9.28 + long ebx; 9.29 + long ecx; 9.30 + long edx; 9.31 + long esi; 9.32 + long edi; 9.33 + long ebp; 9.34 + long eax; 9.35 + long orig_eax; 9.36 + long eip; 9.37 + int cs; 9.38 + long eflags; 9.39 + 9.40 + /* Only saved guest activations contain the following fields. */ 9.41 + long esp; 9.42 + int ss; 9.43 + int es; 9.44 + int ds; 9.45 + int fs; 9.46 + int gs; 9.47 }; 9.48 9.49 enum EFLAGS { 9.50 - EF_CF = 0x00000001, 9.51 - EF_PF = 0x00000004, 9.52 - EF_AF = 0x00000010, 9.53 - EF_ZF = 0x00000040, 9.54 - EF_SF = 0x00000080, 9.55 - EF_TF = 0x00000100, 9.56 - EF_IE = 0x00000200, 9.57 - EF_DF = 0x00000400, 9.58 - EF_OF = 0x00000800, 9.59 - EF_IOPL = 0x00003000, 9.60 - EF_IOPL_RING0 = 0x00000000, 9.61 - EF_IOPL_RING1 = 0x00001000, 9.62 - EF_IOPL_RING2 = 0x00002000, 9.63 - EF_NT = 0x00004000, /* nested task */ 9.64 - EF_RF = 0x00010000, /* resume */ 9.65 - EF_VM = 0x00020000, /* virtual mode */ 9.66 - EF_AC = 0x00040000, /* alignment */ 9.67 - EF_VIF = 0x00080000, /* virtual interrupt */ 9.68 - EF_VIP = 0x00100000, /* virtual interrupt pending */ 9.69 - EF_ID = 0x00200000, /* id */ 9.70 + EF_CF = 0x00000001, 9.71 + EF_PF = 0x00000004, 9.72 + EF_AF = 0x00000010, 9.73 + EF_ZF = 0x00000040, 9.74 + EF_SF = 0x00000080, 9.75 + EF_TF = 0x00000100, 9.76 + EF_IE = 0x00000200, 9.77 + EF_DF = 0x00000400, 9.78 + EF_OF = 0x00000800, 9.79 + EF_IOPL = 0x00003000, 9.80 + EF_IOPL_RING0 = 0x00000000, 9.81 + EF_IOPL_RING1 = 0x00001000, 9.82 + EF_IOPL_RING2 = 0x00002000, 9.83 + EF_NT = 0x00004000, /* nested task */ 9.84 + EF_RF = 0x00010000, /* resume */ 9.85 + EF_VM = 0x00020000, /* virtual mode */ 9.86 + EF_AC = 0x00040000, /* alignment */ 9.87 + EF_VIF = 0x00080000, /* virtual interrupt */ 9.88 + EF_VIP = 0x00100000, /* virtual interrupt pending */ 9.89 + EF_ID = 0x00200000, /* id */ 9.90 }; 9.91 9.92 #endif
10.1 --- a/xen/include/public/arch-x86_32.h Tue Nov 09 10:51:49 2004 +0000 10.2 +++ b/xen/include/public/arch-x86_32.h Tue Nov 09 10:52:02 2004 +0000 10.3 @@ -92,16 +92,16 @@ typedef struct 10.4 unsigned long edi; 10.5 unsigned long ebp; 10.6 unsigned long eax; 10.7 - unsigned long ds; 10.8 - unsigned long es; 10.9 - unsigned long fs; 10.10 - unsigned long gs; 10.11 unsigned long _unused; 10.12 unsigned long eip; 10.13 unsigned long cs; 10.14 unsigned long eflags; 10.15 unsigned long esp; 10.16 unsigned long ss; 10.17 + unsigned long es; 10.18 + unsigned long ds; 10.19 + unsigned long fs; 10.20 + unsigned long gs; 10.21 } PACKED execution_context_t; 10.22 10.23 typedef u64 tsc_timestamp_t; /* RDTSC timestamp */
11.1 --- a/xen/include/public/dom0_ops.h Tue Nov 09 10:51:49 2004 +0000 11.2 +++ b/xen/include/public/dom0_ops.h Tue Nov 09 10:52:02 2004 +0000 11.3 @@ -19,7 +19,7 @@ 11.4 * This makes sure that old versions of dom0 tools will stop working in a 11.5 * well-defined way (rather than crashing the machine, for instance). 11.6 */ 11.7 -#define DOM0_INTERFACE_VERSION 0xAAAA0019 11.8 +#define DOM0_INTERFACE_VERSION 0xAAAA001A 11.9 11.10 /************************************************************************/ 11.11
12.1 --- a/xen/include/xen/sched.h Tue Nov 09 10:51:49 2004 +0000 12.2 +++ b/xen/include/xen/sched.h Tue Nov 09 10:52:02 2004 +0000 12.3 @@ -75,15 +75,8 @@ struct exec_domain 12.4 unsigned long event_selector; /* 08: entry CS */ 12.5 unsigned long event_address; /* 12: entry EIP */ 12.6 12.7 - /* Saved DS,ES,FS,GS immediately before return to guest OS. */ 12.8 - unsigned long failsafe_selectors[4]; /* 16-32 */ 12.9 - 12.10 - /* 12.11 - * END OF FIRST CACHELINE. Stuff above is touched a lot! 12.12 - */ 12.13 - 12.14 - unsigned long failsafe_selector; /* 32: entry CS */ 12.15 - unsigned long failsafe_address; /* 36: entry EIP */ 12.16 + unsigned long failsafe_selector; /* 16: entry CS */ 12.17 + unsigned long failsafe_address; /* 20: entry EIP */ 12.18 12.19 /* 12.20 * From here on things can be added and shuffled without special attention