1/* $OpenBSD: tfork_thread.S,v 1.6 2020/10/19 17:57:40 naddy Exp $ */ 2/* 3 * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17#include <sys/syscall.h> 18#include <machine/asm.h> 19#include "SYS.h" 20 21/* 22 * r0 r1 r2 r3 23 * __tfork_thread(param, psize, start_fnc, start_arg); 24 */ 25 26ENTRY(__tfork_thread) 27 SYSTRAP(__tfork) 28 bcs CERROR 29 30 /* check if we are parent or child */ 31 cmp r0, #0 32 movne pc, lr 33 34 /* child */ 35 mov r0, r3 36 mov lr, pc 37 mov pc, r2 38 nop 39 SYSTRAP(__threxit) 40 udf #0 41END(__tfork_thread) 42