xref: /freebsd/lib/libc/riscv/gen/_ctx_start.S (revision 1d386b48a555f61cb7325543adbbb5c3f3407a66)
1*0bfee928SRuslan Bukin/*-
2*0bfee928SRuslan Bukin * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
3*0bfee928SRuslan Bukin * All rights reserved.
4*0bfee928SRuslan Bukin *
5*0bfee928SRuslan Bukin * Portions of this software were developed by SRI International and the
6*0bfee928SRuslan Bukin * University of Cambridge Computer Laboratory under DARPA/AFRL contract
7*0bfee928SRuslan Bukin * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
8*0bfee928SRuslan Bukin *
9*0bfee928SRuslan Bukin * Portions of this software were developed by the University of Cambridge
10*0bfee928SRuslan Bukin * Computer Laboratory as part of the CTSRD Project, with support from the
11*0bfee928SRuslan Bukin * UK Higher Education Innovation Fund (HEIF).
12*0bfee928SRuslan Bukin *
13*0bfee928SRuslan Bukin * Redistribution and use in source and binary forms, with or without
14*0bfee928SRuslan Bukin * modification, are permitted provided that the following conditions
15*0bfee928SRuslan Bukin * are met:
16*0bfee928SRuslan Bukin * 1. Redistributions of source code must retain the above copyright
17*0bfee928SRuslan Bukin *    notice, this list of conditions and the following disclaimer.
18*0bfee928SRuslan Bukin * 2. Redistributions in binary form must reproduce the above copyright
19*0bfee928SRuslan Bukin *    notice, this list of conditions and the following disclaimer in the
20*0bfee928SRuslan Bukin *    documentation and/or other materials provided with the distribution.
21*0bfee928SRuslan Bukin *
22*0bfee928SRuslan Bukin * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23*0bfee928SRuslan Bukin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24*0bfee928SRuslan Bukin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25*0bfee928SRuslan Bukin * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26*0bfee928SRuslan Bukin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27*0bfee928SRuslan Bukin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28*0bfee928SRuslan Bukin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29*0bfee928SRuslan Bukin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30*0bfee928SRuslan Bukin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31*0bfee928SRuslan Bukin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*0bfee928SRuslan Bukin * SUCH DAMAGE.
33*0bfee928SRuslan Bukin */
34*0bfee928SRuslan Bukin
35*0bfee928SRuslan Bukin#include <machine/asm.h>
36*0bfee928SRuslan BukinENTRY(_ctx_start)
37*0bfee928SRuslan Bukin	jalr	s0		/* Call func from makecontext */
38*0bfee928SRuslan Bukin	mv	a0, s1		/* Load ucp saved in makecontext */
39*0bfee928SRuslan Bukin	call	_C_LABEL(ctx_done)
40*0bfee928SRuslan Bukin	call	_C_LABEL(abort)
41*0bfee928SRuslan BukinEND(_ctx_start)
42