Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/csu Assert that ps_strings is valid. Use it to drop the ...
details: https://anonhg.NetBSD.org/src/rev/25add6a7d939
branches: trunk
changeset: 766700:25add6a7d939
user: joerg <joerg%NetBSD.org@localhost>
date: Thu Jun 30 19:48:43 2011 +0000
description:
Assert that ps_strings is valid. Use it to drop the first three
arguments to ___start to make the assembler callers simpler.
diffstat:
lib/csu/arch/i386/crt0.S | 10 ++--------
lib/csu/arch/x86_64/crt0.S | 18 +++++++-----------
lib/csu/common/crt0-common.c | 30 ++++++++++++++++--------------
3 files changed, 25 insertions(+), 33 deletions(-)
diffs (139 lines):
diff -r 1a80873a0061 -r 25add6a7d939 lib/csu/arch/i386/crt0.S
--- a/lib/csu/arch/i386/crt0.S Thu Jun 30 19:46:07 2011 +0000
+++ b/lib/csu/arch/i386/crt0.S Thu Jun 30 19:48:43 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.S,v 1.1 2010/08/07 18:01:33 joerg Exp $ */
+/* $NetBSD: crt0.S,v 1.2 2011/06/30 19:48:43 joerg Exp $ */
/*
* Copyright (c) 1998 Christos Zoulas
@@ -37,17 +37,11 @@
#include <machine/asm.h>
-RCSID("$NetBSD: crt0.S,v 1.1 2010/08/07 18:01:33 joerg Exp $")
+RCSID("$NetBSD: crt0.S,v 1.2 2011/06/30 19:48:43 joerg Exp $")
STRONG_ALIAS(_start,__start)
_ENTRY(__start)
pushl %ebx
pushl %ecx
pushl %edx
- movl 12(%esp),%eax
- leal 16(%esp),%edx
- leal 20(%esp,%eax,4),%ecx
- pushl %ecx
- pushl %edx
- pushl %eax
call ___start
diff -r 1a80873a0061 -r 25add6a7d939 lib/csu/arch/x86_64/crt0.S
--- a/lib/csu/arch/x86_64/crt0.S Thu Jun 30 19:46:07 2011 +0000
+++ b/lib/csu/arch/x86_64/crt0.S Thu Jun 30 19:48:43 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.S,v 1.1 2010/08/07 18:01:34 joerg Exp $ */
+/* $NetBSD: crt0.S,v 1.2 2011/06/30 19:48:43 joerg Exp $ */
/*
* Copyright (c) 1998 Christos Zoulas
@@ -35,18 +35,14 @@
#include <machine/asm.h>
-RCSID("$NetBSD: crt0.S,v 1.1 2010/08/07 18:01:34 joerg Exp $")
+RCSID("$NetBSD: crt0.S,v 1.2 2011/06/30 19:48:43 joerg Exp $")
STRONG_ALIAS(_start,__start)
_ENTRY(__start)
- movq %rbx,%r9
- movq %rcx,%r8
- movq %rdx,%rcx
- movq (%rsp),%rdi
- leaq 16(%rsp,%rdi,8),%rdx
- leaq 8(%rsp),%rsi
- subq $8,%rsp
- andq $~15,%rsp
- addq $8,%rsp
+ andq $~15,%rsp
+ subq $8,%rsp
+ movq %rdx, %rdi
+ movq %rcx, %rsi
+ movq %rbx, %rdx
jmp ___start
diff -r 1a80873a0061 -r 25add6a7d939 lib/csu/common/crt0-common.c
--- a/lib/csu/common/crt0-common.c Thu Jun 30 19:46:07 2011 +0000
+++ b/lib/csu/common/crt0-common.c Thu Jun 30 19:48:43 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.5 2011/03/07 05:09:09 joerg Exp $ */
+/* $NetBSD: crt0-common.c,v 1.6 2011/06/30 19:48:43 joerg Exp $ */
/*
* Copyright (c) 1998 Christos Zoulas
@@ -36,9 +36,10 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: crt0-common.c,v 1.5 2011/03/07 05:09:09 joerg Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.6 2011/06/30 19:48:43 joerg Exp $");
#include <sys/types.h>
+#include <sys/exec.h>
#include <sys/syscall.h>
#include <machine/profile.h>
#include <stdlib.h>
@@ -73,8 +74,8 @@
static char empty_string[] = "";
char *__progname = empty_string;
-void ___start(int, char **, char **, void (*)(void),
- const Obj_Entry *, struct ps_strings *);
+void ___start(void (*)(void), const Obj_Entry *,
+ struct ps_strings *);
#define write(fd, s, n) __syscall(SYS_write, (fd), (s), (n))
@@ -85,17 +86,21 @@
} while (0)
void
-___start(int argc, char **argv, char **envp,
- void (*cleanup)(void), /* from shared loader */
+___start(void (*cleanup)(void), /* from shared loader */
const Obj_Entry *obj, /* from shared loader */
struct ps_strings *ps_strings)
{
- environ = envp;
+
+ if (ps_strings == NULL)
+ _FATAL("ps_strings missing\n");
+ __ps_strings = ps_strings;
- if (argv[0] != NULL) {
+ environ = ps_strings->ps_envstr;
+
+ if (ps_strings->ps_argvstr[0] != NULL) {
char *c;
- __progname = argv[0];
- for (c = argv[0]; *c; ++c) {
+ __progname = ps_strings->ps_argvstr[0];
+ for (c = ps_strings->ps_argvstr[0]; *c; ++c) {
if (*c == '/')
__progname = c + 1;
}
@@ -103,9 +108,6 @@
__progname = empty_string;
}
- if (ps_strings != NULL)
- __ps_strings = ps_strings;
-
if (&rtld_DYNAMIC != NULL) {
if (obj == NULL)
_FATAL("NULL Obj_Entry pointer in GOT\n");
@@ -126,5 +128,5 @@
atexit(_fini);
_init();
- exit(main(argc, argv, environ));
+ exit(main(ps_strings->ps_nargvstr, ps_strings->ps_argvstr, environ));
}
Home |
Main Index |
Thread Index |
Old Index