summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authord <d@openbsd.org>2000-02-26 13:34:51 +0000
committerd <d@openbsd.org>2000-02-26 13:34:51 +0000
commit1a079113200747c59bedd601ddc001ada854d9d3 (patch)
tree4c00423d2b839917120b7e3dfbc8399a6d784a50 /lib/libpthread
parentbetter column titles. show prioq and scheduler timing information (diff)
downloadwireguard-openbsd-1a079113200747c59bedd601ddc001ada854d9d3.tar.xz
wireguard-openbsd-1a079113200747c59bedd601ddc001ada854d9d3.zip
alpha
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/uthread/uthread_stack.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libpthread/uthread/uthread_stack.c b/lib/libpthread/uthread/uthread_stack.c
index 62474173495..8933d389701 100644
--- a/lib/libpthread/uthread/uthread_stack.c
+++ b/lib/libpthread/uthread/uthread_stack.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_stack.c,v 1.5 2000/02/10 11:47:15 d Exp $ */
+/* $OpenBSD: uthread_stack.c,v 1.6 2000/02/26 13:34:51 d Exp $ */
/*
* Copyright 1999, David Leonard. All rights reserved.
* <insert BSD-style license&disclaimer>
@@ -68,8 +68,12 @@ _thread_stack_alloc(base, size)
return NULL;
}
- /* The red zone is the first physical page of the storage: */
- stack->redzone = (void*)(((int)stack->storage + nbpg - 1) &
+ /*
+ * The red zone is the first physical page of the storage.
+ * I'm using _BSD_PTRDIFF_T_ to convert the storage base pointer
+ * into an integer so that I can do page alignment on it.
+ */
+ stack->redzone = (void*)(((_BSD_PTRDIFF_T_)stack->storage + nbpg - 1) &
~(nbpg - 1));
if (mprotect(stack->redzone, nbpg, 0) == -1)
PANIC("Cannot protect stack red zone");