From owner-p4-projects@FreeBSD.ORG Fri May 23 14:09:51 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1C9BC37B404; Fri, 23 May 2003 14:09:51 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B0C9837B401 for ; Fri, 23 May 2003 14:09:50 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3A62143F85 for ; Fri, 23 May 2003 14:09:50 -0700 (PDT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h4NL9o0U089538 for ; Fri, 23 May 2003 14:09:50 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h4NL9nN5089535 for perforce@freebsd.org; Fri, 23 May 2003 14:09:49 -0700 (PDT) Date: Fri, 23 May 2003 14:09:49 -0700 (PDT) Message-Id: <200305232109.h4NL9nN5089535@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Subject: PERFORCE change 31728 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 May 2003 21:09:52 -0000 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