summaryrefslogtreecommitdiffstats
path: root/sys/compat/ia32
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2011-01-08 16:13:44 +0000
committerkib <kib@FreeBSD.org>2011-01-08 16:13:44 +0000
commit06eb8de1e11605ee7d4ae2e5c58cdadccc659f0d (patch)
tree89f01dcb94af1295c1d16e6a0cf6aa53ea8dcefc /sys/compat/ia32
parent12d561f88acf9296f4d7f1ba98ad4d9a8da70bf3 (diff)
downloadFreeBSD-src-06eb8de1e11605ee7d4ae2e5c58cdadccc659f0d.zip
FreeBSD-src-06eb8de1e11605ee7d4ae2e5c58cdadccc659f0d.tar.gz
Create shared (readonly) page. Each ABI may specify the use of page by
setting SV_SHP flag and providing pointer to the vm object and mapping address. Provide simple allocator to carve space in the page, tailored to put the code with alignment restrictions. Enable shared page use for amd64, both native and 32bit FreeBSD binaries. Page is private mapped at the top of the user address space, moving a start of the stack one page down. Move signal trampoline code from the top of the stack to the shared page. Reviewed by: alc
Diffstat (limited to 'sys/compat/ia32')
-rw-r--r--sys/compat/ia32/ia32_sysvec.c15
-rw-r--r--sys/compat/ia32/ia32_util.h8
2 files changed, 17 insertions, 6 deletions
diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c
index d7ac5d0..058e739 100644
--- a/sys/compat/ia32/ia32_sysvec.c
+++ b/sys/compat/ia32/ia32_sysvec.c
@@ -129,7 +129,7 @@ struct sysentvec ia32_freebsd_sysvec = {
.sv_minsigstksz = MINSIGSTKSZ,
.sv_pagesize = IA32_PAGE_SIZE,
.sv_minuser = 0,
- .sv_maxuser = FREEBSD32_USRSTACK,
+ .sv_maxuser = FREEBSD32_MAXUSER,
.sv_usrstack = FREEBSD32_USRSTACK,
.sv_psstrings = FREEBSD32_PS_STRINGS,
.sv_stackprot = VM_PROT_ALL,
@@ -137,12 +137,20 @@ struct sysentvec ia32_freebsd_sysvec = {
.sv_setregs = ia32_setregs,
.sv_fixlimit = ia32_fixlimit,
.sv_maxssiz = &ia32_maxssiz,
- .sv_flags = SV_ABI_FREEBSD | SV_IA32 | SV_ILP32,
+ .sv_flags = SV_ABI_FREEBSD | SV_IA32 | SV_ILP32 |
+#ifdef __amd64__
+ SV_SHP
+#else
+ 0
+#endif
+ ,
.sv_set_syscall_retval = ia32_set_syscall_retval,
.sv_fetch_syscall_args = ia32_fetch_syscall_args,
.sv_syscallnames = freebsd32_syscallnames,
+ .sv_shared_page_base = FREEBSD32_SHAREDPAGE,
+ .sv_shared_page_len = PAGE_SIZE,
};
-
+INIT_SYSENTVEC(elf_ia32_sysvec, &ia32_freebsd_sysvec);
static Elf32_Brandinfo ia32_brand_info = {
.brand = ELFOSABI_FREEBSD,
@@ -191,7 +199,6 @@ SYSINIT(kia32, SI_SUB_EXEC, SI_ORDER_ANY,
(sysinit_cfunc_t) elf32_insert_brand_entry,
&kia32_brand_info);
-
void
elf32_dump_thread(struct thread *td __unused, void *dst __unused,
size_t *off __unused)
diff --git a/sys/compat/ia32/ia32_util.h b/sys/compat/ia32/ia32_util.h
index f1cc6ed..4355daa 100644
--- a/sys/compat/ia32/ia32_util.h
+++ b/sys/compat/ia32/ia32_util.h
@@ -41,9 +41,13 @@
#include <sys/cdefs.h>
#ifdef __ia64__
-#define FREEBSD32_USRSTACK ((1ul << 32) - IA32_PAGE_SIZE * 2)
+#define FREEBSD32_MAXUSER ((1ul << 32) - IA32_PAGE_SIZE * 2)
+#define FREEBSD32_SHAREDPAGE 0
+#define FREEBSD32_USRSTACK FREEBSD32_MAXUSER
#else
-#define FREEBSD32_USRSTACK ((1ul << 32) - IA32_PAGE_SIZE)
+#define FREEBSD32_MAXUSER ((1ul << 32) - IA32_PAGE_SIZE)
+#define FREEBSD32_SHAREDPAGE (FREEBSD32_MAXUSER - IA32_PAGE_SIZE)
+#define FREEBSD32_USRSTACK FREEBSD32_SHAREDPAGE
#endif
#define IA32_PAGE_SIZE 4096
OpenPOWER on IntegriCloud