2020-03-29 15:54:32 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 Ariadne Conill <ariadne@dereferenced.org>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* This software is provided 'as is' and without any warranty, express or
|
|
|
|
* implied. In no event shall the authors be liable for any damages arising
|
|
|
|
* from the use of this software.
|
|
|
|
*/
|
|
|
|
|
|
|
|
LOCALSZ = 1
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
2020-12-06 08:59:59 +00:00
|
|
|
FUNC(libucontext_trampoline)
|
2020-03-29 15:54:32 +00:00
|
|
|
move $gp, $s1
|
|
|
|
|
|
|
|
/* we receive our initial ucontext in $s0, so if $s0 is nil, bail */
|
|
|
|
beqz $s0, no_linked_context
|
|
|
|
|
|
|
|
/* call setcontext */
|
|
|
|
move $a0, $s0
|
2021-01-08 10:10:10 +00:00
|
|
|
la $t9, PROC_NAME(libucontext_setcontext)
|
2020-03-29 15:54:32 +00:00
|
|
|
|
|
|
|
jr $t9
|
|
|
|
|
|
|
|
no_linked_context:
|
|
|
|
move $a0, $zero
|
|
|
|
la $t9, exit
|
|
|
|
jalr $t9
|
|
|
|
nop
|
2020-12-06 08:59:59 +00:00
|
|
|
END(libucontext_trampoline)
|