From ba1501075d81ce42c88707021eb8c2befa0fe4a4 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Thu, 29 May 2008 20:45:48 +0000 Subject: libhurd-mm/ 2008-05-29 Neal H. Walfield * 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 . (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 * sysdeps/l4/hurd/pt-sysdep.h Include . (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 and . (__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 , and . (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 * exceptions.h: Include . [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 * as.c: Include . (ensure_stack): Change SPACE to be EXCEPTION_STACK_SIZE - PAGESIZE bytes large. Write to each page. * cap-lookup.c: Include . (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. --- sysdeps/l4/hurd/ia32/pt-setup.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'sysdeps/l4/hurd/ia32/pt-setup.c') 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; -- cgit v1.2.3