summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordrahn <drahn@openbsd.org>2002-10-21 16:01:55 +0000
committerdrahn <drahn@openbsd.org>2002-10-21 16:01:55 +0000
commite513d93f2679eaaea53298a59041414d0f10dbda (patch)
tree321204a72013302a0901fe7c3ffc9e8aea794792
parenttry harder to sync in dmamap_sync (diff)
downloadwireguard-openbsd-e513d93f2679eaaea53298a59041414d0f10dbda.tar.xz
wireguard-openbsd-e513d93f2679eaaea53298a59041414d0f10dbda.zip
Simplify the ld.so asm api, the data is available other ways.
tested by naddy@ and myself.
-rw-r--r--libexec/ld.so/alpha/ldasm.S8
-rw-r--r--libexec/ld.so/i386/ldasm.S9
-rw-r--r--libexec/ld.so/loader.c13
-rw-r--r--libexec/ld.so/powerpc/ldasm.S23
-rw-r--r--libexec/ld.so/sparc/ldasm.S7
-rw-r--r--libexec/ld.so/sparc64/ldasm.S7
6 files changed, 19 insertions, 48 deletions
diff --git a/libexec/ld.so/alpha/ldasm.S b/libexec/ld.so/alpha/ldasm.S
index cc4eac26afa..68659b6e05e 100644
--- a/libexec/ld.so/alpha/ldasm.S
+++ b/libexec/ld.so/alpha/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.9 2002/08/11 18:41:17 drahn Exp $ */
+/* $OpenBSD: ldasm.S,v 1.10 2002/10/21 16:01:55 drahn Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -88,8 +88,7 @@ L2: cmpult t0, t1, t3
br L2
L3:
mov a0, s0
- mov t2, a1 /* relocation displacement */
- mov a1, s1
+ mov t2, s1 /* relocation displacement */
ldq a2, 0(a0) /* argc */
lda a3, 8(a0) /* argv */
mov a3, s3
@@ -97,10 +96,9 @@ L3:
sll t3, 3, t3
addq a3, t3, a4 /* envp */
mov a4, s4
- mov t1, a2 /* dynamic */
mov a5, s5
lda s2, 0(sp)
- mov s2, a3
+ mov s2, a1
CALL(_dl_boot_bind)
mov s3, a0 /* **argv */
mov s4, a1 /* **envp */
diff --git a/libexec/ld.so/i386/ldasm.S b/libexec/ld.so/i386/ldasm.S
index b86048d3768..b7af2be3792 100644
--- a/libexec/ld.so/i386/ldasm.S
+++ b/libexec/ld.so/i386/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.1 2002/08/23 23:02:48 drahn Exp $ */
+/* $OpenBSD: ldasm.S,v 1.2 2002/10/21 16:01:55 drahn Exp $ */
/*
* Copyright (c) 2002 Dale Rahn
@@ -49,14 +49,11 @@ _dl_start:
movl %ebx,%edi # save dl_data arg for dl_boot
pushl %ebx # push dl_data for dl_boot_bind
- pushl $0 # dynp
- pushl $0 # push dummy for loff
-
mov %eax, %esi # save stack for dl_boot
pushl %eax # load saved SP for dl_boot_bind
- call _dl_boot_bind@PLT # _dl_boot_bind(sp,loff,dl_data)
+ call _dl_boot_bind@PLT # _dl_boot_bind(sp,dl_data)
pushl %edi # push saved dl_data
movl %edi,%ebp
@@ -75,7 +72,7 @@ _dl_start:
call _dl_boot@PLT # _dl_boot(argv,envp,loff,dl_data)
- addl $4*6,%esp # pop args
+ addl $4*4,%esp # pop args
addl $DL_DATA_SIZE,%esp # return dl_data
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c
index 49dbeb3bfd2..eb2e4f5f8cf 100644
--- a/libexec/ld.so/loader.c
+++ b/libexec/ld.so/loader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loader.c,v 1.49 2002/08/23 23:02:48 drahn Exp $ */
+/* $OpenBSD: loader.c,v 1.50 2002/10/21 16:01:55 drahn Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -309,7 +309,7 @@ _dl_boot(const char **argv, char **envp, const long loff, long *dl_data)
}
void
-_dl_boot_bind(const long sp, long loff, Elf_Dyn *dynamicp, long *dl_data)
+_dl_boot_bind(const long sp, long *dl_data)
{
AuxInfo *auxstack;
long *stack;
@@ -318,6 +318,7 @@ _dl_boot_bind(const long sp, long loff, Elf_Dyn *dynamicp, long *dl_data)
int argc;
char **argv;
char **envp;
+ long loff;
struct elf_object dynld; /* Resolver data for the loader */
/*
@@ -348,9 +349,7 @@ _dl_boot_bind(const long sp, long loff, Elf_Dyn *dynamicp, long *dl_data)
continue;
dl_data[auxstack->au_id] = auxstack->au_v;
}
-#if defined(__sparc64__) || defined(__sparc__) || defined(__i386__)
loff = dl_data[AUX_base];
-#endif
/*
* We need to do 'selfreloc' in case the code weren't
@@ -360,10 +359,8 @@ _dl_boot_bind(const long sp, long loff, Elf_Dyn *dynamicp, long *dl_data)
* Cache the data for easier access.
*/
-#if defined(__sparc64__) || defined(__sparc__)
- dynp = (Elf_Dyn *)((long)_DYNAMIC + loff);
-#elif defined(__powerpc__) || defined(__alpha__)
- dynp = dynamicp;
+#if defined(__alpha__)
+ dynp = (Elf_Dyn *)((long)_DYNAMIC);
#else
dynp = (Elf_Dyn *)((long)_DYNAMIC + loff);
#endif
diff --git a/libexec/ld.so/powerpc/ldasm.S b/libexec/ld.so/powerpc/ldasm.S
index 30fd67ca021..3d6698c069c 100644
--- a/libexec/ld.so/powerpc/ldasm.S
+++ b/libexec/ld.so/powerpc/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.7 2002/09/09 19:06:18 drahn Exp $ */
+/* $OpenBSD: ldasm.S,v 1.8 2002/10/21 16:01:55 drahn Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -65,7 +65,6 @@ ENTRY(_dl_start)
# this instruction never gets executed but can be used
# to find the virtual address where the page is loaded.
bl _GLOBAL_OFFSET_TABLE_@local-4
- bl _DYNAMIC@local
1:
mflr 5 # this stores where we are (+4)
lwz 18, 0(5) # load the instruction at offset_sym
@@ -87,18 +86,9 @@ ENTRY(_dl_start)
isync
icbi 5, 18 # make certain that the got table addr is
# not in the icache
-
sync
isync
- addi 28, 28, 4
- mr 29, 28
-
- lwz 30, 0(28) # this loads the first entry of the GOT
- # thus forcing it to be paged in when
- # we jump to it below.
-
-
# calculate where we want to be (via the got)
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr 28
@@ -107,22 +97,13 @@ ENTRY(_dl_start)
lwz 4, .L___offset_sym@got(28)
mr 6, 4 # make copy of register for debugging
- /* This cheats and calculates the address of _DYNAMIC
- * the same way that the GLOBAL_OFFSET_TABLE was calcuated
- */
- lwz 18, 4(5)
- rlwinm 18,18,0,8,30 # mask off the offset portion of the instr.
- add 8, 18, 5 # address of _DYNAMIC (arg6 for _dl_boot)
- addi 18, 8, 4 # correction.
sub 4, 5, 4 # calculate offset (arg1 for _dl_boot)
mr 17, 4
subi 3, 21, 4 # Get stack pointer (arg0 for _dl_boot).
- mr 4, 17 # loff
- mr 5, 18 # dynamicp
- addi 6, 1, 8 # dl_data
+ addi 4, 1, 8 # dl_data
bl _dl_boot_bind@local
diff --git a/libexec/ld.so/sparc/ldasm.S b/libexec/ld.so/sparc/ldasm.S
index 785a08b6868..ef8427a451a 100644
--- a/libexec/ld.so/sparc/ldasm.S
+++ b/libexec/ld.so/sparc/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.5 2002/08/11 18:41:17 drahn Exp $ */
+/* $OpenBSD: ldasm.S,v 1.6 2002/10/21 16:01:55 drahn Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -86,10 +86,9 @@ _dl_start:
add %sp, ARGC, %l3
add %l3, DL_DATA_SIZE, %o0
- mov 0, %o2 ! dynp = 0
mov %o0, %l0
- call _dl_boot_bind ! _dl_boot_bind(sp,loff,dynp,dl_data)
- mov %l3, %o3
+ call _dl_boot_bind ! _dl_boot_bind(sp,dl_data)
+ mov %l3, %o1
mov %l3, %o3
ld [%l0], %l3 ! argc = *sp
diff --git a/libexec/ld.so/sparc64/ldasm.S b/libexec/ld.so/sparc64/ldasm.S
index 190778e0c54..5ff2cb99661 100644
--- a/libexec/ld.so/sparc64/ldasm.S
+++ b/libexec/ld.so/sparc64/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.13 2002/08/11 18:41:17 drahn Exp $ */
+/* $OpenBSD: ldasm.S,v 1.14 2002/10/21 16:01:55 drahn Exp $ */
/* $NetBSD: rtld_start.S,v 1.5 2001/08/14 22:17:48 eeh Exp $ */
/*
@@ -104,10 +104,9 @@ _dl_start:
add %sp, BIAS + ARGC, %l3
add %l3, DL_DATA_SIZE, %o0
- mov 0, %o2 ! dynp = 0
mov %o0, %l0
- call _dl_boot_bind ! _dl_boot_bind(sp,loff,dynp,dl_data)
- mov %l3, %o3
+ call _dl_boot_bind ! _dl_boot_bind(sp,dl_data)
+ mov %l3, %o1
mov %l3, %o3
ldx [%l0], %l3 ! argc = *sp