Use CC64FSZ instead of magic constant for stack frame size.

Frob the clone's stack pointer to be BIASed - it is 64 bit code too.
Use "carry set" as test for a failed syscall.
This commit is contained in:
martin 2003-12-31 15:56:26 +00:00
parent d21d97a649
commit 586bc581af

View File

@ -1,4 +1,4 @@
/* $NetBSD: __clone.S,v 1.2 2002/05/07 01:34:22 eeh Exp $ */
/* $NetBSD: __clone.S,v 1.3 2003/12/31 15:56:26 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -48,7 +48,7 @@ WEAK_ALIAS(clone, __clone)
* int __clone(int (*fn)(void *), void *stack, int flags, void *arg);
*/
ENTRY(__clone)
save %sp, -176, %sp
save %sp, -CC64FSZ, %sp
/*
* Sanity checks: func and stack may not be NULL.
@ -60,23 +60,24 @@ ENTRY(__clone)
mov %i2, %o0 ! setup flags arg for syscall
/*
* Store the function and the argument on our child's stack
* Store the function and the argument on our child's stack,
* subtract BIAS from childs stack pointer - it will be 64 bit
* code too.
*/
sub %o1, 16, %o1 ! make space on the child's stack
stx %i0, [%o1] ! save func
stx %i3, [%o1+8] ! save arg
sub %o1, 16+BIAS, %o1 ! make space on the child's stack
stx %i0, [%o1+BIAS] ! save func
stx %i3, [%o1+8+BIAS] ! save arg
/*
* Args are now set up for system call as (flags, stack).
*/
mov SYS___clone, %g1
t ST_SYSCALL
be 9f
bcs 9f
tst %o1 ! %o1 (rv[1]) == 0 in parent
1: bz 2f ! yes, parent
ldx [%sp], %l0 ! grab the function
ldx [%sp+8], %o0 ! and the argument from the stack
ldx [%sp+BIAS], %l0 ! grab the function
ldx [%sp+8+BIAS], %o0 ! and the argument from the stack
add %sp, 16, %sp ! restore the stack
call %l0 ! Call the clone's entry point.
nop