diff options
author | neal <neal> | 2008-01-02 15:41:01 +0000 |
---|---|---|
committer | neal <neal> | 2008-01-02 15:41:01 +0000 |
commit | da6c87a2e1a94b0f31029c2616119be8597edafc (patch) | |
tree | e61606e5845307a1e2a8d8b2540c965f28d71a5f /viengoos/as.c | |
parent | b358735a6cfacaa948ac875c654e3914d1a2b6f4 (diff) |
viengoos/
2008-01-02 Neal H. Walfield <neal@gnu.org>
* Makefile.am (libhurd_cap_a_CPPFLAGS): Add
-mpreferred-stack-boundary=2.
* as.c (ensure_stack) [! RM_INTERN]: New function.
(AS_LOCK) [! RM_INTERN]: Call it.
* cap-lookup.c (ensure_stack) [! RM_INTERN]: New function.
(AS_LOCK): New macro.
(AS_UNLOCK): Likewise.
(cap_lookup_rel): Use AS_LOCK and AS_UNOCK rather than
pthread_rwlock_rdlock and pthread_rwlock_unlock, respectively.
(object_lookup_rel): Likewise.
(slot_lookup_rel): Likewise.
libhurd-mm/
2008-01-02 Neal H. Walfield <neal@gnu.org>
* exceptions.c (exception_handler_activated): Move the debug
statement after the call to utcb_state_save.
* Makefile.am (COMMON_CPPFLAGS): Add -mpreferred-stack-boundary=2.
Use -O2.
Diffstat (limited to 'viengoos/as.c')
-rw-r--r-- | viengoos/as.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/viengoos/as.c b/viengoos/as.c index df903a3..4fd61e6 100644 --- a/viengoos/as.c +++ b/viengoos/as.c @@ -1,5 +1,5 @@ /* as.c - Address space composition helper functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. Written by Neal H. Walfield <neal@gnu.org>. This file is part of the GNU Hurd. @@ -37,7 +37,27 @@ #ifndef RM_INTERN pthread_rwlock_t as_lock = __PTHREAD_RWLOCK_INITIALIZER; -# define AS_LOCK pthread_rwlock_wrlock (&as_lock) + +static void __attribute__ ((noinline)) +ensure_stack(int i) +{ + /* XXX: If we fault on the stack while we have the address space + lock, we deadlock. Ensure that we have some stack space and hope + it is enough. (This can't be too much as we may be running on + the exception handler's stack.) */ + volatile char space[1024 + 512]; + space[0] = 0; + space[sizeof (space) - 1] = 0; +} + +# define AS_LOCK \ + do \ + { \ + ensure_stack (1); \ + pthread_rwlock_wrlock (&as_lock); \ + } \ + while (0) + # define AS_UNLOCK pthread_rwlock_unlock (&as_lock) # define AS_DUMP rm_as_dump (ADDR_VOID, ADDR_VOID) |