Date: Fri, 23 May 2003 14:09:49 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 31728 for review Message-ID: <200305232109.h4NL9nN5089535@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=31728 Change 31728 by peter@peter_hammer on 2003/05/23 14:09:06 make this assemble. The arguments have not been updated yet. In particular, need to take the pointer in %rdi, not %rsp Affected files ... .. //depot/projects/hammer/libexec/rtld-elf/amd64/rtld_start.S#5 edit Differences ... ==== //depot/projects/hammer/libexec/rtld-elf/amd64/rtld_start.S#5 (text+ko) ==== @@ -25,25 +25,24 @@ * $FreeBSD: src/libexec/rtld-elf/amd64/rtld_start.S,v 1.3 1999/08/28 00:10:15 peter Exp $ */ -.error finish update please. needs to be updated for calling conventions at the very least .text .align 4 .globl .rtld_start .type .rtld_start,@function .rtld_start: - xorl %rbp,%rbp # Clear frame pointer for good form - movl %rsp,%rax # Save initial stack pointer - subl $8,%rsp # A place to store exit procedure addr - movl %rsp,%rbx # save address of exit proc - movl %rsp,%rcx # construct address of obj_main - addl $4,%rcx - pushl %rcx # Pass address of obj_main - pushl %rbx # Pass address of exit proc - pushl %rax # Pass initial stack pointer to rtld + xorq %rbp,%rbp # Clear frame pointer for good form + movq %rsp,%rax # Save initial stack pointer + subq $16,%rsp # A place to store exit procedure addr + movq %rsp,%rbx # save address of exit proc + movq %rsp,%rcx # construct address of obj_main + addq $8,%rcx + pushq %rcx # Pass address of obj_main + pushq %rbx # Pass address of exit proc + pushq %rax # Pass initial stack pointer to rtld call _rtld@PLT # Call rtld(sp); returns entry point - addl $12,%rsp # Remove arguments from stack - popl %rdx # Get exit procedure address - addl $4,%rsp # Ignore obj_main + addq $24,%rsp # Remove arguments from stack + popq %rdx # Get exit procedure address + addq $8,%rsp # Ignore obj_main /* * At this point, %rax contains the entry point of the main program, and * %rdx contains a pointer to a termination function that should be @@ -69,21 +68,21 @@ .globl _rtld_bind_start .type _rtld_bind_start,@function _rtld_bind_start: - pushf # Save eflags - pushl %rax # Save %rax - pushl %rdx # Save %rdx - pushl %rcx # Save %rcx - pushl 20(%rsp) # Copy reloff argument - pushl 20(%rsp) # Copy obj argument + pushfq # Save eflags + pushq %rax # Save %rax + pushq %rdx # Save %rdx + pushq %rcx # Save %rcx + pushq 20(%rsp) # Copy reloff argument + pushq 20(%rsp) # Copy obj argument call _rtld_bind@PLT # Transfer control to the binder /* Now %rax contains the entry point of the function being called. */ - addl $8,%rsp # Discard binder arguments - movl %rax,20(%rsp) # Store target over obj argument - popl %rcx # Restore %rcx - popl %rdx # Restore %rdx - popl %rax # Restore %rax - popf # Restore eflags - leal 4(%rsp),%rsp # Discard reloff, do not change eflags + addq $16,%rsp # Discard binder arguments + movq %rax,20(%rsp) # Store target over obj argument + popq %rcx # Restore %rcx + popq %rdx # Restore %rdx + popq %rax # Restore %rax + popfq # Restore eflags + leaq 8(%rsp),%rsp # 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?200305232109.h4NL9nN5089535>