diff options
author | Neal H. Walfield <neal@gnu.org> | 2008-05-29 20:45:48 +0000 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2009-04-07 23:16:14 +0200 |
commit | ba1501075d81ce42c88707021eb8c2befa0fe4a4 (patch) | |
tree | 9e96100971636a5604027cc28be766389558e35d /sysdeps/l4/hurd/ia32 | |
parent | 9acc87073cfc18eaa2ea5b46fa81f239d6b32b31 (diff) |
libhurd-mm/
2008-05-29 Neal H. Walfield <neal@gnu.org>
* exceptions.c (exception_handler_activated): Assume the fault is
on the stack if it is one page above or three pages below the
stack pointer.
(exception_handler_init): Allocate an area of address space
EXCEPTION_STACK_SIZE bytes larges. Fill it with pages. Set the
first page as the thread's exception page and the top of the area
minus one word as the stack pointer. Set the last word to the
location of the exception page.
* ia32-exception-entry.S: Include <hurd/exceptions.h>.
(PAGESIZE): Don't define.
(_exception_handler_entry): Rewrite to not assume that the
exception page is at the start of the page in which the stack
pointer is, but at the location stored in the word after the bottom
of the stack.
* Makefile.am (libhurd_mm_a_CCASFLAGS): New variable.
* pager.c (ensure_stack): Change SPACE to be EXCEPTION_STACK_SIZE
- PAGESIZE bytes large. Write to each page.
libpthread/
2008-05-29 Neal H. Walfield <neal@gnu.org>
* sysdeps/l4/hurd/pt-sysdep.h Include <hurd/exceptions.h>.
(EXCEPTION_AREA_SIZE): Define.
(EXCEPTION_AREA_SIZE_LOG2): Likewise.
(EXCEPTION_PAGE): Likewise.
(PTHREAD_SYSDEP_MEMBERS): Change object's type to an addr_t.
Update users. Remove field exception_page, replace with
exception_area. Add field exception_area_va.
* sysdeps/l4/hurd/pt-thread-alloc.c: Include <hurd/as.h> and
<hurd/addr.h>.
(__pthread_thread_alloc): Allocate EXCEPTION_AREA_SIZE bytes of
address space. Save it in THREAD->EXCEPTION_AREA_VA. Allocate a
page for each page in that area. Save them in
THREAD->EXCEPTION_AREA.
* sysdeps/l4/hurd/ia32/pt-setup.c (__pthread_setup): Set
EXCEPTION_PAGE->EXCEPTION_HANDLER_SP to the end of
EXCEPTION_PAGE->EXCEPTION_HANDLER_SP minus one word, in which we
save the address of the exception page.
* sysdeps/l4/hurd/pt-thread-start.c (__pthread_thread_start): Set
IN.EXCEPTION_PAGE to the first page in THREAD->EXCEPTION_AREA_VA.
* sysdeps/l4/hurd/pt-thread-halt.c: Include <hurd/mutex.h>,
<hurd/as.h> and <hurd/addr.h>.
(saved_object_lock): New variable.
(__pthread_thread_halt): Lock SAVED_OBJECT_LOCK when accessing
SAVED_OBJECT. Free the address space used by the exception
area (THREAD->EXCEPTION_AREA_VA) and its associated
storage (THREAD->EXCEPTION_AREA).
hurd/
2008-05-29 Neal H. Walfield <neal@gnu.org>
* exceptions.h: Include <hurd/stddef.h>.
[ASM]: Only define relevant macros.
(EXCEPTION_STACK_SIZE_LOG2): Define.
(EXCEPTION_STACK_SIZE): Define.
* stddef.h [ASM]: Only define relevant macros.
(PAGESIZE): Don't append C type specifier.
(PAGESIZE_LOG2): Likewise.
viengoos/
2008-05-29 Neal H. Walfield <neal@gnu.org>
* as.c: Include <hurd/exceptions.h>.
(ensure_stack): Change SPACE to be EXCEPTION_STACK_SIZE - PAGESIZE
bytes large. Write to each page.
* cap-lookup.c: Include <hurd/exceptions.h>.
(ensure_stack): Change SPACE to be EXCEPTION_STACK_SIZE - PAGESIZE
bytes large. Write to each page.
* zalloc.c (ZONE_SIZE): Add suffix the 1 with a U type qualifier.
(ZONES): Include one less zone.
Diffstat (limited to 'sysdeps/l4/hurd/ia32')
-rw-r--r-- | sysdeps/l4/hurd/ia32/pt-setup.c | 16 | ||||
-rw-r--r-- | sysdeps/l4/hurd/ia32/signal-dispatch-lowlevel.c | 6 |
2 files changed, 12 insertions, 10 deletions
diff --git a/sysdeps/l4/hurd/ia32/pt-setup.c b/sysdeps/l4/hurd/ia32/pt-setup.c index f5987797..cc2f0757 100644 --- a/sysdeps/l4/hurd/ia32/pt-setup.c +++ b/sysdeps/l4/hurd/ia32/pt-setup.c @@ -1,4 +1,4 @@ -/* Setup thread stack. Hurd/i386 version. +/* Setup thread stack. Viengoos/i386 version. Copyright (C) 2000, 2002, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -96,14 +96,16 @@ __pthread_setup (struct __pthread *thread, if (__pthread_num_threads == 1) return 0; - assert (! ADDR_IS_VOID (thread->exception_page.addr)); + assert (! ADDR_IS_VOID (thread->exception_area[0])); - struct exception_page *exception_page - = ADDR_TO_PTR (addr_extend (thread->exception_page.addr, - 0, PAGESIZE_LOG2)); + struct exception_page *exception_page = thread->exception_area_va; - /* SP is set to the end of the exception page. */ - exception_page->exception_handler_sp = (uintptr_t) exception_page + PAGESIZE; + /* SP is set to the end of the exception area minus one word, which + is the location of the exception page. */ + exception_page->exception_handler_sp + = (uintptr_t) thread->exception_area_va + EXCEPTION_AREA_SIZE; + exception_page->exception_handler_sp -= sizeof (void *); + * (void **) exception_page->exception_handler_sp = thread->exception_area_va; exception_page->exception_handler_ip = (uintptr_t) &exception_handler_entry; exception_page->exception_handler_end = (uintptr_t) &exception_handler_end; diff --git a/sysdeps/l4/hurd/ia32/signal-dispatch-lowlevel.c b/sysdeps/l4/hurd/ia32/signal-dispatch-lowlevel.c index bb6ac2a5..37ef8215 100644 --- a/sysdeps/l4/hurd/ia32/signal-dispatch-lowlevel.c +++ b/sysdeps/l4/hurd/ia32/signal-dispatch-lowlevel.c @@ -124,13 +124,13 @@ signal_dispatch_lowlevel (struct signal_state *ss, pthread_t tid, struct hurd_thread_exregs_out out; error_t err; - err = rm_thread_exregs (ADDR_VOID, thread->object.addr, + err = rm_thread_exregs (ADDR_VOID, thread->object, HURD_EXREGS_STOP | HURD_EXREGS_ABORT_IPC | HURD_EXREGS_GET_REGS, in, &out); if (err) panic ("Failed to modify thread " ADDR_FMT, - ADDR_PRINTF (thread->object.addr)); + ADDR_PRINTF (thread->object)); intr_sp = out.sp; @@ -205,7 +205,7 @@ signal_dispatch_lowlevel (struct signal_state *ss, pthread_t tid, in.sp = sp; in.ip = (uintptr_t) &_signal_dispatch_entry; - rm_thread_exregs (ADDR_VOID, thread->object.addr, + rm_thread_exregs (ADDR_VOID, thread->object, HURD_EXREGS_SET_SP_IP | HURD_EXREGS_START | HURD_EXREGS_ABORT_IPC, in, &out); |