Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Add a macro to align the length of the stack, not the po...



details:   https://anonhg.NetBSD.org/src/rev/d692accfd1c9
branches:  trunk
changeset: 773048:d692accfd1c9
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jan 25 18:26:26 2012 +0000

description:
Add a macro to align the length of the stack, not the pointer itself, since
we always want the alignment to grow the length.

diffstat:

 sys/kern/kern_exec.c |  6 +++---
 sys/sys/param.h      |  3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r 7264d4e73da9 -r d692accfd1c9 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c      Wed Jan 25 18:09:13 2012 +0000
+++ b/sys/kern/kern_exec.c      Wed Jan 25 18:26:26 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exec.c,v 1.334 2012/01/24 20:03:36 christos Exp $ */
+/*     $NetBSD: kern_exec.c,v 1.335 2012/01/25 18:26:26 christos Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.334 2012/01/24 20:03:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.335 2012/01/25 18:26:26 christos Exp $");
 
 #include "opt_exec.h"
 #include "opt_ktrace.h"
@@ -793,7 +793,7 @@
 #endif /* PAX_ASLR */
 
        /* make the stack "safely" aligned */
-       len = (size_t)STACK_ALIGN(len, STACK_ALIGNBYTES);
+       len = STACK_LEN_ALIGN(len, STACK_ALIGNBYTES);
 
        if (len > pack.ep_ssize) { /* in effect, compare to initial limit */
                DPRINTF(("%s: stack limit exceeded %zu\n", __func__, len));
diff -r 7264d4e73da9 -r d692accfd1c9 sys/sys/param.h
--- a/sys/sys/param.h   Wed Jan 25 18:09:13 2012 +0000
+++ b/sys/sys/param.h   Wed Jan 25 18:26:26 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: param.h,v 1.400 2012/01/24 20:03:36 christos Exp $     */
+/*     $NetBSD: param.h,v 1.401 2012/01/25 18:26:26 christos Exp $     */
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -224,6 +224,7 @@
 #define        STACK_ALLOC(sp, _size)          (((char *)(void *)(sp)) - (_size))
 #define        STACK_MAX(p, _size)             ((char *)(void *)(p))
 #endif
+#define        STACK_LEN_ALIGN(len, bytes)     ((len) + bytes) & ~bytes)
 
 #endif /* defined(_KERNEL) || defined(__EXPOSE_STACK) */
 



Home | Main Index | Thread Index | Old Index