Date: Sun, 14 Aug 2011 15:17:09 +0000 From: xxp@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r225113 - in soc2011/xxp/xxp-head/libexec/rtld-elf: amd64 i386 Message-ID: <20110814151709.5862A1065670@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: xxp Date: Sun Aug 14 15:17:09 2011 New Revision: 225113 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225113 Log: review rtld Modified: soc2011/xxp/xxp-head/libexec/rtld-elf/amd64/rtld_start.S soc2011/xxp/xxp-head/libexec/rtld-elf/i386/rtld_start.S Modified: soc2011/xxp/xxp-head/libexec/rtld-elf/amd64/rtld_start.S ============================================================================== --- soc2011/xxp/xxp-head/libexec/rtld-elf/amd64/rtld_start.S Sun Aug 14 14:36:32 2011 (r225112) +++ soc2011/xxp/xxp-head/libexec/rtld-elf/amd64/rtld_start.S Sun Aug 14 15:17:09 2011 (r225113) @@ -31,16 +31,13 @@ .type .rtld_start,@function .rtld_start: xorq %rbp,%rbp # Clear frame pointer for good form - cfi_def_cfa(%rsp,0) subq $24,%rsp # A place to store exit procedure addr - cfi_adjust_cfa_offset(24) movq %rdi,%r12 movq %rsp,%rsi # save address of exit proc movq %rsp,%rdx # construct address of obj_main addq $8,%rdx call _rtld@PLT # Call rtld(sp); returns entry point popq %rsi # Get exit procedure address - cfi_adjust_cfa_offset(-8) movq %r12,%rdi # *ap /* * At this point, %rax contains the entry point of the main program, and @@ -83,27 +80,16 @@ .type _rtld_bind_start,@function _rtld_bind_start: subq $8,%rsp - cfi_adjust_cfa_offset(8) pushfq # Save rflags - cfi_adjust_cfa_offset(8) pushq %rax # Save %rax - cfi_adjust_cfa_offset(8) pushq %rdx # Save %rdx - cfi_adjust_cfa_offset(8) pushq %rcx # Save %rcx - cfi_adjust_cfa_offset(8) pushq %rsi # Save %rsi - cfi_adjust_cfa_offset(8) pushq %rdi # Save %rdi - cfi_adjust_cfa_offset(8) pushq %r8 # Save %r8 - cfi_adjust_cfa_offset(8) pushq %r9 # Save %r9 - cfi_adjust_cfa_offset(8) pushq %r10 # Save %r10 - cfi_adjust_cfa_offset(8) pushq %r11 # Save %r11 - cfi_adjust_cfa_offset(8) movq 0x58(%rsp),%rdi # Fetch obj argument movq 0x60(%rsp),%rsi # Fetch reloff argument @@ -115,25 +101,15 @@ movq %rax,0x60(%rsp) # Store target over reloff argument popq %r11 # Restore %r11 - cfi_adjust_cfa_offset(-8) popq %r10 # Restore %r10 - cfi_adjust_cfa_offset(-8) popq %r9 # Restore %r9 - cfi_adjust_cfa_offset(-8) popq %r8 # Restore %r8 - cfi_adjust_cfa_offset(-8) popq %rdi # Restore %rdi - cfi_adjust_cfa_offset(-8) popq %rsi # Restore %rsi - cfi_adjust_cfa_offset(-8) popq %rcx # Restore %rcx - cfi_adjust_cfa_offset(-8) popq %rdx # Restore %rdx - cfi_adjust_cfa_offset(-8) popq %rax # Restore %rax - cfi_adjust_cfa_offset(-8) popfq # Restore rflags - cfi_adjust_cfa_offset(-8) leaq 16(%rsp),%rsp # Discard spare, obj, do not change rflags ret # "Return" to target address Modified: soc2011/xxp/xxp-head/libexec/rtld-elf/i386/rtld_start.S ============================================================================== --- soc2011/xxp/xxp-head/libexec/rtld-elf/i386/rtld_start.S Sun Aug 14 14:36:32 2011 (r225112) +++ soc2011/xxp/xxp-head/libexec/rtld-elf/i386/rtld_start.S Sun Aug 14 15:17:09 2011 (r225113) @@ -34,27 +34,18 @@ movl %esp,%eax # Save initial stack pointer movl %esp,%esi # Save initial stack pointer andl $0xfffffff0,%esp # Align stack pointer - cfi_def_cfa(%esp,0) subl $16,%esp # A place to store exit procedure addr - cfi_adjust_cfa_offset(16) movl %esp,%ebx # save address of exit proc movl %esp,%ecx # construct address of obj_main addl $4,%ecx subl $4,%esp # Keep stack aligned - cfi_adjust_cfa_offset(4) pushl %ecx # Pass address of obj_main - cfi_adjust_cfa_offset(4) pushl %ebx # Pass address of exit proc - cfi_adjust_cfa_offset(4) pushl %eax # Pass initial stack pointer to rtld - cfi_adjust_cfa_offset(4) call _rtld@PLT # Call rtld(sp); returns entry point addl $16,%esp # Remove arguments from stack - cfi_adjust_cfa_offset(-16) popl %edx # Get exit procedure address - cfi_adjust_cfa_offset(-4) movl %esi,%esp # Ignore obj_main - cfi_def_cfa(%esp,0) /* * At this point, %eax contains the entry point of the main program, and * %edx contains a pointer to a termination function that should be @@ -81,32 +72,21 @@ .type _rtld_bind_start,@function _rtld_bind_start: pushf # Save eflags - cfi_adjust_cfa_offset(4) pushl %eax # Save %eax - cfi_adjust_cfa_offset(4) pushl %edx # Save %edx - cfi_adjust_cfa_offset(4) pushl %ecx # Save %ecx - cfi_adjust_cfa_offset(4) pushl 20(%esp) # Copy reloff argument - cfi_adjust_cfa_offset(4) pushl 20(%esp) # Copy obj argument - cfi_adjust_cfa_offset(4) call _rtld_bind@PLT # Transfer control to the binder /* Now %eax contains the entry point of the function being called. */ addl $8,%esp # Discard binder arguments - cfi_adjust_cfa_offset(-8) movl %eax,20(%esp) # Store target over obj argument popl %ecx # Restore %ecx - cfi_adjust_cfa_offset(-4) popl %edx # Restore %edx - cfi_adjust_cfa_offset(-4) popl %eax # Restore %eax - cfi_adjust_cfa_offset(-4) popf # Restore eflags - cfi_adjust_cfa_offset(-4) leal 4(%esp),%esp # Discard reloff, do not change eflags ret # "Return" to target address
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110814151709.5862A1065670>