ia64/xen-unstable

changeset 5419:38e4b3dc8b9c

bitkeeper revision 1.1705.1.9 (42a958fa_rGV-3MvG5pqfsVcnP31ag)

Fixup SYSCALL path correctly in xenlinux when calling into C code.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Jun 10 09:10:18 2005 +0000 (2005-06-10)
parents 5e0480247269
children 8c95b4009c7f
files linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/entry.S
line diff
     1.1 --- a/linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/entry.S	Fri Jun 10 08:42:26 2005 +0000
     1.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/entry.S	Fri Jun 10 09:10:18 2005 +0000
     1.3 @@ -109,7 +109,6 @@ VGCF_IN_SYSCALL = (1<<8)
     1.4  #define preempt_stop
     1.5  #define retint_kernel retint_restore_args
     1.6  #endif	
     1.7 -	
     1.8  
     1.9  /*
    1.10   * C code is not supposed to know about undefined top of stack. Every time 
    1.11 @@ -118,7 +117,15 @@ VGCF_IN_SYSCALL = (1<<8)
    1.12   * RESTORE_TOP_OF_STACK syncs the syscall state after any possible ptregs
    1.13   * manipulation.
    1.14   */        	
    1.15 -		
    1.16 +
    1.17 +	/* %rsp:at FRAMEEND */ 
    1.18 +	.macro FIXUP_TOP_OF_STACK tmp
    1.19 +	movq    $__USER_CS,CS(%rsp)
    1.20 +	movq 	$-1,RCX(%rsp)
    1.21 +	.endm
    1.22 +
    1.23 +	.macro RESTORE_TOP_OF_STACK tmp,offset=0
    1.24 +	.endm
    1.25  
    1.26  	.macro FAKE_STACK_FRAME child_rip
    1.27  	/* push in order ss, rsp, eflags, cs, rip */
    1.28 @@ -209,6 +216,7 @@ rff_action:
    1.29  	je   int_ret_from_sys_call
    1.30  	testl $_TIF_IA32,threadinfo_flags(%rcx)
    1.31  	jnz  int_ret_from_sys_call
    1.32 +	RESTORE_TOP_OF_STACK %rdi,ARGOFFSET
    1.33  	jmp ret_from_sys_call
    1.34  rff_trace:
    1.35  	movq %rsp,%rdi
    1.36 @@ -311,6 +319,7 @@ 1:	movl $_TIF_NEED_RESCHED,%edi
    1.37  tracesys:			 
    1.38  	SAVE_REST
    1.39  	movq $-ENOSYS,RAX(%rsp)
    1.40 +	FIXUP_TOP_OF_STACK %rdi
    1.41  	movq %rsp,%rdi
    1.42  	call syscall_trace_enter
    1.43  	LOAD_ARGS ARGOFFSET  /* reload args from stack in case ptrace changed it */
    1.44 @@ -323,6 +332,7 @@ tracesys:
    1.45  1:	SAVE_REST
    1.46  	movq %rsp,%rdi
    1.47  	call syscall_trace_leave
    1.48 +	RESTORE_TOP_OF_STACK %rbx
    1.49  	RESTORE_REST
    1.50  	jmp ret_from_sys_call
    1.51  		
    1.52 @@ -421,7 +431,9 @@ ENTRY(ptregscall_common)
    1.53  	CFI_ADJUST_CFA_OFFSET	-8
    1.54  	SAVE_REST
    1.55  	movq %r11, %r15
    1.56 +	FIXUP_TOP_OF_STACK %r11
    1.57  	call *%rax
    1.58 +	RESTORE_TOP_OF_STACK %r11
    1.59  	movq %r15, %r11
    1.60  	RESTORE_REST
    1.61  	pushq %r11
    1.62 @@ -435,10 +447,12 @@ ENTRY(stub_execve)
    1.63  	CFI_ADJUST_CFA_OFFSET	-8
    1.64  	SAVE_REST
    1.65  	movq %r11, %r15
    1.66 +	FIXUP_TOP_OF_STACK %r11
    1.67  	call sys_execve
    1.68  	GET_THREAD_INFO(%rcx)
    1.69  	bt $TIF_IA32,threadinfo_flags(%rcx)
    1.70  	jc exec_32bit
    1.71 +	RESTORE_TOP_OF_STACK %r11
    1.72  	movq %r15, %r11
    1.73  	RESTORE_REST
    1.74  	push %r11
    1.75 @@ -460,6 +474,7 @@ ENTRY(stub_rt_sigreturn)
    1.76  	addq $8, %rsp		
    1.77  	SAVE_REST
    1.78  	movq %rsp,%rdi
    1.79 +	FIXUP_TOP_OF_STACK %r11
    1.80  	call sys_rt_sigreturn
    1.81  	movq %rax,RAX(%rsp) # fixme, this could be done at the higher layer
    1.82  	RESTORE_REST