diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-07-28 08:47:13 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-07-28 08:47:13 +0000 |
commit | 367dfb39173fd1367eacbb49f271ab85219ba6c7 (patch) | |
tree | a287cb6dad1a498cb47c6ffeacc59a3589be478b /sys/arch/m88k | |
parent | 29d9755677826cab29a9ab4d011aa5ff43d0017c (diff) |
In the never-ending saga of getting gcc to work reliably on m88k, today's
changes address incorrect stack usage, when optimization needs more
nameless temporary values than available registers, and has to save them
on stack.
In some (rare) circumstances, it will compute a stack address _outside_
the current function local storage space, overwriting the caller's stack.
Most of the time, this only affects the "outgoing argument area", which is
harmless if it has not been populated; this explains why it has not been
noticed earlier.
Since I see no easy way to fix this, I decided to go the simpler way of
removing this ougoing argument area. This not only reduces stack usage,
but also makes varargs/stdarg code smaller and faster; also functions which
get their first few arguments in registers, then some on the stack, then
some in registers again, will not allocate stack space for the second
set of arguments passed through registers.
This is an ABI change, we are no longer 88Open compliant (have we ever
been?).
Diffstat (limited to 'sys/arch/m88k')
-rw-r--r-- | sys/arch/m88k/include/va-m88k.h | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/sys/arch/m88k/include/va-m88k.h b/sys/arch/m88k/include/va-m88k.h index 0303d9184c6..ae4493e7f13 100644 --- a/sys/arch/m88k/include/va-m88k.h +++ b/sys/arch/m88k/include/va-m88k.h @@ -1,4 +1,4 @@ -/* $OpenBSD: va-m88k.h,v 1.4 2004/06/09 23:08:19 miod Exp $ */ +/* $OpenBSD: va-m88k.h,v 1.5 2004/07/28 08:47:12 miod Exp $ */ /* Define __gnuc_va_list. */ @@ -9,7 +9,6 @@ typedef struct __va_list_tag { unsigned int __va_arg; /* argument number */ unsigned int *__va_stk; /* start of args passed on stack */ unsigned int *__va_reg; /* start of args passed in regs */ - unsigned int __va_tomfoolery; /* do we need to eat stack for regs */ } __va_list[1], __gnuc_va_list[1]; #endif /* not __GNUC_VA_LIST */ @@ -22,9 +21,6 @@ typedef struct __va_list_tag { __extension__ ({ \ (AP) = (struct __va_list_tag *)__builtin_alloca(sizeof(__gnuc_va_list)); \ __builtin_memcpy ((AP), __builtin_saveregs (), sizeof(__gnuc_va_list)); \ - if ((AP)->__va_arg > 8) \ - (AP)->__va_stk += ((AP)->__va_arg - 8); \ - (AP)->__va_tomfoolery = 0; \ }) #ifdef _STDARG_H /* stdarg.h support */ @@ -67,8 +63,6 @@ __extension__(*({ \ if ((AP)->__va_arg <= 8 && __va_reg_p(TYPE)) { \ __ptr = (TYPE *) (void *) ((AP)->__va_reg + \ (AP)->__va_arg - __va_size(TYPE)); \ - if ((AP)->__va_tomfoolery) \ - (AP)->__va_stk += __va_size(TYPE); \ } else { \ if (((unsigned int)((AP)->__va_stk) & 4) != 0 && \ __alignof__(*(TYPE *)0) > 4) { \ @@ -76,7 +70,6 @@ __extension__(*({ \ } \ __ptr = (TYPE *) (AP)->__va_stk; \ (AP)->__va_stk += __va_size(TYPE); \ - (AP)->__va_tomfoolery = 1; \ } \ __ptr; \ })) |