Re: [SSI-devel] Need help on x86_64 "ret_from_rproc" assembly code
Brought to you by:
brucewalker,
rogertsang
From: John S. <joh...@gm...> - 2006-10-13 20:12:44
|
Resend in plain text: Hi All, Using the code work that John Byrne did for x86_64 for 2.4 I came up with the following for 2.6: /* * A newly forked process directly context switches into this. */ /* rdi: prev */ ENTRY(ret_from_fork) CFI_STARTPROC CFI_DEFAULT_STACK call schedule_tail GET_THREAD_INFO(%rcx) ret_from_fork_common: testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),threadinfo_flags(%rcx) jnz rff_trace rff_action: RESTORE_REST testl $3,CS-ARGOFFSET(%rsp) # from kernel_thread? je int_ret_from_sys_call testl $_TIF_IA32,threadinfo_flags(%rcx) jnz int_ret_from_sys_call RESTORE_TOP_OF_STACK %rdi,ARGOFFSET jmp ret_from_sys_call rff_trace: movq %rsp,%rdi call syscall_trace_leave GET_THREAD_INFO(%rcx) jmp rff_action CFI_ENDPROC #ifdef CONFIG_SSI ENTRY(ret_from_rproc) CFI_STARTPROC CFI_DEFAULT_STACK GET_THREAD_INFO(%rcx) subq $SS+8,%rax # destination for new regs movl %esi,%ebx # save signal flag movq %rdi,%rsi # pointer to regs (assumed on stack) cmpq %rsp,%rax # stack above register destination? jae 10f movq %rax,%rsp # no, make room on stack 10: # Copy registers onto stack; taken from memmove() movq $(SS+8)/8,%rcx movq %rax,%rdi cmpq %rdi,%rsi # dst before src? jae 20f movq $SS,%rdx # no, copy backwards addq %rdx,%rsi addq %rdx,%rdi std 20: rep movsq cld movq %rax,%rsp # set correct stack address movq %r8,%rcx test %ebx,%ebx # %ebx != 0 => signal return jne ret_from_fork_common movq $0,RAX(%rsp) # set the syscall return value (success) jmp ret_from_fork_common CFI_ENDPROC #endif John Byrne, This line troubles me. The registers are i386 format. It compiles but is this correct? It is what you had for 2.4: movl %esi,%ebx # save signal flag Thanks in advance, John Steinman -- John F. Steinman |