Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add AuxInfo record with the base address of the main thr...
details: https://anonhg.NetBSD.org/src/rev/f1ca947d5dc7
branches: trunk
changeset: 773512:f1ca947d5dc7
user: joerg <joerg%NetBSD.org@localhost>
date: Sat Feb 04 18:12:02 2012 +0000
description:
Add AuxInfo record with the base address of the main thread.
diffstat:
sys/kern/exec_elf.c | 12 +++++++++---
sys/sys/exec_elf.h | 5 +++--
2 files changed, 12 insertions(+), 5 deletions(-)
diffs (66 lines):
diff -r 8471b86227c7 -r f1ca947d5dc7 sys/kern/exec_elf.c
--- a/sys/kern/exec_elf.c Sat Feb 04 17:56:16 2012 +0000
+++ b/sys/kern/exec_elf.c Sat Feb 04 18:12:02 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_elf.c,v 1.35 2012/02/03 20:11:54 matt Exp $ */
+/* $NetBSD: exec_elf.c,v 1.36 2012/02/04 18:12:02 joerg Exp $ */
/*-
* Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.35 2012/02/03 20:11:54 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.36 2012/02/04 18:12:02 joerg Exp $");
#ifdef _KERNEL_OPT
#include "opt_pax.h"
@@ -238,6 +238,10 @@
a->a_v = kauth_cred_getgid(l->l_cred);
a++;
+ a->a_type = AT_STACKBASE;
+ a->a_v = l->l_proc->p_stackbase;
+ a++;
+
if (pack->ep_path) {
execname = a;
a->a_type = AT_SUN_EXECNAME;
@@ -251,7 +255,9 @@
a->a_v = 0;
a++;
- vlen = (a - ai) * sizeof(AuxInfo);
+ vlen = (a - ai) * sizeof(ai[0]);
+
+ KASSERT(vlen <= sizeof(ai));
if (execname) {
char *path = pack->ep_path;
diff -r 8471b86227c7 -r f1ca947d5dc7 sys/sys/exec_elf.h
--- a/sys/sys/exec_elf.h Sat Feb 04 17:56:16 2012 +0000
+++ b/sys/sys/exec_elf.h Sat Feb 04 18:12:02 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_elf.h,v 1.121 2012/01/21 21:44:03 njoly Exp $ */
+/* $NetBSD: exec_elf.h,v 1.122 2012/02/04 18:12:02 joerg Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -714,6 +714,7 @@
#define AT_DCACHEBSIZE 10 /* Data cache block size */
#define AT_ICACHEBSIZE 11 /* Instruction cache block size */
#define AT_UCACHEBSIZE 12 /* Unified cache block size */
+#define AT_STACKBASE 13 /* Base address of the main thread */
/* Vendor specific */
#define AT_MIPS_NOTELF 10 /* XXX a_val != 0 -> MIPS XCOFF executable */
@@ -1138,7 +1139,7 @@
#ifdef _KERNEL
-#define ELF_AUX_ENTRIES 14 /* Max size of aux array passed to loader */
+#define ELF_AUX_ENTRIES 15 /* Max size of aux array passed to loader */
#define ELF32_NO_ADDR (~(Elf32_Addr)0) /* Indicates addr. not yet filled in */
#define ELF32_LINK_ADDR ((Elf32_Addr)-2) /* advises to use link address */
#define ELF64_NO_ADDR (~(Elf64_Addr)0) /* Indicates addr. not yet filled in */
Home |
Main Index |
Thread Index |
Old Index