From: <ai...@us...> - 2004-02-26 11:51:18
|
Update of /cvsroot/linux-vax/glibc/sysdeps/vax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3519 Modified Files: dl-machine.h Added Files: __longjmp.S setjmp.S Log Message: Another batch of linker and setjmp changes --- NEW FILE: __longjmp.S --- /* Copyright (C) 1991, 1992, 1994, 1997 Free Software Foundation, Inc. Derived from @(#)_setjmp.s 5.7 (Berkeley) 6/27/88, Copyright (c) 1980 Regents of the University of California. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "DEFS.h" ENTRY(__longjmp, R6) movl 0x4(%ap), %r0 # our scratch reg # movl $0,%r0 # movl (%r0),%r0 # we are going to modify our stack frame # to the same as that of the setjmp we called earlier movl (%r0), (%fp) # cond handler movl 0x4(%r0), 0x4(%fp) # psw movl 0x8(%r0), 0x8(%fp) # ap movl 0xc(%r0), 0xc(%fp) # fp movl 0x10(%r0), 0x10(%fp) # pc # # restore the regs movl 0x14(%r0) , %r1 movl 0x18(%r0) , %r2 movl 0x1c(%r0) , %r3 movl 0x20(%r0) , %r4 movl 0x24(%r0) , %r5 movl 0x28(%r0) , %r6 movl 0x2c(%r0) , %r7 movl 0x30(%r0) , %r8 movl 0x34(%r0) , %r9 movl 0x38(%r0) , %r10 movl 0x3c(%r0) , %r11 # # check val and set to 1 if set to zero movl 0x8(%ap), %r0 tstl %r0 bneq exit_ok movl $0x1, %r0 exit_ok: ret END(__longjmp) --- NEW FILE: setjmp.S --- # setjmp.S atp. Sept. 2001 # save regs and info needed for a longjmp #include "DEFS.h" ENTRY(__sigsetjmp, 0) movl 0x4(%ap), %r0 # our scratch reg # kenn would probably use movq here. :-) movl %r1, 0x14(%r0) # save regs movl %r2, 0x18(%r0) movl %r3, 0x1c(%r0) movl %r4, 0x20(%r0) movl %r5, 0x24(%r0) movl %r6, 0x28(%r0) movl %r7, 0x2c(%r0) movl %r8, 0x30(%r0) movl %r9, 0x34(%r0) movl %r10, 0x38(%r0) movl %r11, 0x3c(%r0) # now save our call frame movl (%fp), (%r0) # condition handler (for VMS emulation) movl 0x4(%fp), 0x4(%r0) # psw movl 0x8(%fp), 0x8(%r0) # ap movl 0xc(%fp), 0xc(%r0) # fp movl 0x10(%fp), 0x10(%r0) # pc # call the sigjmp save routine pushl 8(%ap) pushl %r0 calls $2,__sigjmp_save # done ret END(__sigsetjmp) Index: dl-machine.h =================================================================== RCS file: /cvsroot/linux-vax/glibc/sysdeps/vax/dl-machine.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- dl-machine.h 25 Feb 2004 06:48:37 -0000 1.10 +++ dl-machine.h 26 Feb 2004 11:35:35 -0000 1.11 @@ -133,10 +133,14 @@ #if 1 //"; Trampoline for " #fixup_name " #define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \ -asm( ".globl " #tramp_name "\n\t \ +asm( ".text\n\ + .globl " #tramp_name "\n\t \ .type " #tramp_name ", @function\n\t \ " #tramp_name ": \n\t \ - .size " #tramp_name ", . - " #tramp_name "\n"); + calls $2, " #fixup_name "\n\ + .size " #tramp_name ", . - " #tramp_name "\n\ + .previous\n\ +"); #if 0 @@ -176,7 +180,7 @@ //#define ELF_MACHINE_RUNTIME_TRAMPOLINE /* Mask identifying addresses reserved for the user program, where the dynamic linker should not map anything. */ -#define ELF_MACHINE_USER_ADDRESS_MASK 0xf8000000UL +#define ELF_MACHINE_USER_ADDRESS_MASK 0x80000000UL /* Initial entry point code for the dynamic linker. The C function `_dl_start' is the real entry point; @@ -192,7 +196,21 @@ .globl _dl_start_user\n\ .type _dl_start_user,@function _dl_start_user:\n\ - .word 0x0000\n\ + # save the user entry point address in r6.\n\ + movl %r0, %r6\n\ + # store the highest stack address \n\ + moval __libc_stack_end, %r0\n\ + movl %sp, (%r0)\n\ + # see if we were run as a command with the executable file\n\ + moval _dl_skip_args, %r0\n\ + movl (%r0), %r0\n\ + # pop the original argument count\n\ + movl (%sp)+, %r1\n\ + ashl $2, %r0, %r2\n\ + addl2 %r2, %sp\n\ + subl2 %r0, %r1 + pushl %r1\n\ + jmp (%r6)\n\ .size _dl_start_user, . - _dl_start_user\n \ .previous"); @@ -205,10 +223,10 @@ /* Nonzero iff TYPE describes relocation of a PLT entry, so PLT entries should not be allowed to define the value. */ -#define elf_machine_lookup_noplt_p(type) ((type) == R_VAX_JUMP_SLOT) +#define elf_machine_lookup_noplt_p(type) ((type) == R_VAX_JMP_SLOT) /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */ -#define ELF_MACHINE_JMP_SLOT R_VAX_JUMP_SLOT +#define ELF_MACHINE_JMP_SLOT R_VAX_JMP_SLOT /* CRIS never uses Elf32_Rel relocations. */ #define ELF_MACHINE_NO_REL 1 @@ -314,7 +332,7 @@ case R_VAX_32: #endif case R_VAX_GLOB_DAT: - case R_VAX_JUMP_SLOT: + case R_VAX_JMP_SLOT: *reloc_addr = value; break; #ifndef RTLD_BOOTSTRAP @@ -354,8 +372,8 @@ Elf32_Addr l_addr, const Elf32_Rela *reloc) { Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset); - if (__builtin_expect (ELF32_R_TYPE (reloc->r_info), R_VAX_JUMP_SLOT) - == R_VAX_JUMP_SLOT) + if (__builtin_expect (ELF32_R_TYPE (reloc->r_info), R_VAX_JMP_SLOT) + == R_VAX_JMP_SLOT) *reloc_addr += l_addr; else _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 1); |