in makecontext(), sp is unsigned * so don't assign signed *'s to it.

This commit is contained in:
mrg 2006-05-11 00:34:44 +00:00
parent c7dc676533
commit fd07545586
2 changed files with 10 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: makecontext.c,v 1.2 2003/01/18 11:08:11 thorpej Exp $ */
/* $NetBSD: makecontext.c,v 1.3 2006/05/11 00:34:44 mrg Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: makecontext.c,v 1.2 2003/01/18 11:08:11 thorpej Exp $");
__RCSID("$NetBSD: makecontext.c,v 1.3 2006/05/11 00:34:44 mrg Exp $");
#endif
#include <inttypes.h>
@ -72,9 +72,11 @@ makecontext(ucp, func, argc, va_alist)
gr[_REG_EIP] = (__greg_t)func;
/* LINTED uintptr_t is safe */
sp = (int *)((uintptr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
sp = (unsigned int *)((uintptr_t)ucp->uc_stack.ss_sp +
ucp->uc_stack.ss_size);
/* Align on word boundary. */
/* LINTED uintptr_t is safe */
sp = (int *)((uintptr_t)sp & ~0x3); /* Align on word boundary. */
sp = (unsigned int *)((uintptr_t)sp & ~0x3);
sp -= argc + 1; /* Make room for ret and args. */
/* LINTED __greg_t is safe */
gr[_REG_UESP] = (__greg_t)sp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: makecontext.c,v 1.2 2003/01/18 11:17:45 thorpej Exp $ */
/* $NetBSD: makecontext.c,v 1.3 2006/05/11 00:34:44 mrg Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: makecontext.c,v 1.2 2003/01/18 11:17:45 thorpej Exp $");
__RCSID("$NetBSD: makecontext.c,v 1.3 2006/05/11 00:34:44 mrg Exp $");
#endif
#include <inttypes.h>
@ -57,9 +57,9 @@ makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
ulong *sp;
va_list ap;
sp = (ulong *)((caddr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
sp = (ulong *)((caddr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
/* Align on quad-word boundary. */
sp = (long *)((ulong)sp & ~0xf);
sp = (ulong *)((ulong)sp & ~0xf);
/* Make room for: argx, argd, struct return pointer(?), rwindow. */
sp -= (argc > 6 ? argc - 6 : 0) + 6 + 8 + 8;