From ad08a5b62b63158a7e0291e59583a6955ba60264 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Fri, 31 Mar 2000 12:35:44 +0000 Subject: Update. * sysdeps/mips/dl-machine.h (RTLD_START): Rewritten to match new init function interface. * sysdeps/mips/mips64/dl-machine.h (RTLD_START): Likewise. 2000-03-31 Andreas Jaeger --- sysdeps/mips/dl-machine.h | 53 ++++++++++------------------------------ sysdeps/mips/mips64/dl-machine.h | 46 +++++++++++++++++++--------------- 2 files changed, 39 insertions(+), 60 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h index 188e9ae136..ce5f0f94f2 100644 --- a/sysdeps/mips/dl-machine.h +++ b/sysdeps/mips/dl-machine.h @@ -342,8 +342,10 @@ _dl_start_user:\n\ .cpload $25\n\ .set reorder\n\ move $16, $28\n\ - # Save the user entry point address in saved register.\n\ + # Save the user entry point address in a saved register.\n\ move $17, $2\n\ + # Store the highest stack address\n\ + sw $29, __libc_stack_end\n\ # See if we were run as a command with the executable file\n\ # name as an extra leading argument.\n\ lw $2, _dl_skip_args\n\ @@ -353,48 +355,19 @@ _dl_start_user:\n\ # Subtract _dl_skip_args from it.\n\ subu $4, $2\n\ # Adjust the stack pointer to skip _dl_skip_args words.\n\ - sll $2,2\n\ + sll $2, 2\n\ addu $29, $2\n\ # Save back the modified argument count.\n\ sw $4, 0($29)\n\ -1: subu $29, 16\n\ -2: # Push the searchlist of the main object as argument in\n\ - # the _dl_preinit_next and _dl_init_next calls below.\n\ - lw $4, _dl_main_searchlist\n\ - # First run the pre-initializers.\n\ - # Call _dl_preinit_next to return the address of an initializer\n\ - # function to run.\n\ - jal _dl_preinit_next - move $28, $16\n\ - # Check for zero return, when out of initializers.\n\ - beq $2, $0, 4f\n\ - # Call the pre-initializer.\n\ - move $25, $2\n\ - jalr $25\n\ - move $28, $16\n - # Loop to call _dl_preinit_next for the next initializer.\n\ - b 2b\n -4: lw $4, _dl_main_searchlist\n\ - # Call _dl_init_next to return the address of an initializer\n\ - # function to run.\n\ - jal _dl_init_next\n\ - move $28, $16\n\ - # Check for zero return, when out of initializers.\n\ - beq $2, $0, 2f\n\ - # Call the shared object initializer function.\n\ - move $25, $2\n\ - # XXX This looks broken ###.\n\ - lw $4, 0($29)\n\ - lw $5, 4($29)\n\ - lw $6, 8($29)\n\ - lw $7, 12($29)\n\ - jalr $25\n\ - move $28, $16\n\ - # Loop to call _dl_init_next for the next initializer.\n\ - b 4b\n\ -2: addiu $29, 16\n\ - # Clear the startup flag. Assumes 32 bit ints.\n\ - sw $0, _dl_starting_up\n\ +1: # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\ + lw $4, _dl_loaded\n\ + lw $5, 0($29)\n\ + la $6, 4($29)\n\ + la $7, 8($29)\n\ + subu $29, 16\n\ + # Call the function to run the initializers.\n\ + jal _dl_init + addiu $29, 16\n\ # Pass our finalizer function to the user in ra.\n\ la $31, _dl_fini\n\ # Jump to the user entry point.\n\ diff --git a/sysdeps/mips/mips64/dl-machine.h b/sysdeps/mips/mips64/dl-machine.h index 01f9a95f12..c2f2f6e939 100644 --- a/sysdeps/mips/mips64/dl-machine.h +++ b/sysdeps/mips/mips64/dl-machine.h @@ -445,8 +445,10 @@ _RTLD_PROLOGUE (ENTRY_POINT)\ # doesn't say nothing about this, I emulate this here.\n\ dla $4, _DYNAMIC\n\ sd $4, -0x7ff0($28)\n\ + dsubu $29, 16\n\ move $4, $29\n\ jal _dl_start\n\ + daddiu $29, 16\n\ # Get the value of label '_dl_start_user' in t9 ($25).\n\ dla $25, _dl_start_user\n\ _dl_start_user:\n\ @@ -456,6 +458,8 @@ _dl_start_user:\n\ move $16, $28\n\ # Save the user entry point address in saved register.\n\ move $17, $2\n\ + # Store the highest stack address\n\ + sd $29, __libc_stack_end\n\ # See if we were run as a command with the executable file\n\ # name as an extra leading argument.\n\ ld $2, _dl_skip_args\n\ @@ -469,27 +473,29 @@ _dl_start_user:\n\ daddu $29, $2\n\ # Save back the modified argument count.\n\ sd $4, 0($29)\n\ - # Get _dl_default_scope[2] as argument in _dl_init_next call below.\n\ -1: dla $2, _dl_default_scope\n\ - ld $4, 2*8($2)\n\ - # Call _dl_init_next to return the address of an initializer\n\ - # function to run.\n\ - jal _dl_init_next\n\ - move $28, $16\n\ - # Check for zero return, when out of initializers.\n\ - beq $2, $0, 2f\n\ - # Call the shared object initializer function.\n\ - move $25, $2\n\ - ld $4, 0($29)\n\ - ld $5, 1*8($29)\n\ - ld $6, 2*8($29)\n\ - ld $7, 3*8($29)\n\ - jalr $25\n\ - move $28, $16\n\ - # Loop to call _dl_init_next for the next initializer.\n\ - b 1b\n\ +1: # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\ + ld $4, _dl_loaded\n\ + ld $5, 0($29)\n\ + dla $6, 4($29)\n\ + dla $7, 8($29)\n\ + dsubu $29, 16\n\ + # Call the function to run the initializers.\n\ + jal _dl_init + daddiu $29, 16\n\ + # Pass our finalizer function to the user in ra.\n\ + dla $31, _dl_fini\n\ + # Jump to the user entry point.\n\ +1: # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\ + lw $4, _dl_loaded\n\ + lw $5, 0($29)\n\ + la $6, 4($29)\n\ + la $7, 8($29)\n\ + subu $29, 16\n\ + # Call the function to run the initializers.\n\ + jal _dl_init + addiu $29, 16\n\ # Pass our finalizer function to the user in ra.\n\ -2: dla $31, _dl_fini\n\ + dla $31, _dl_fini\n\ # Jump to the user entry point.\n\ move $25, $17\n\ ld $4, 0($29)\n\ -- cgit v1.2.3