2020-03-29 12:05:52 +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 09:03:07 +00:00
|
|
|
ALIAS(setcontext, libucontext_setcontext)
|
2021-01-08 09:30:50 +00:00
|
|
|
ALIAS(__setcontext, libucontext_setcontext)
|
2020-03-29 14:37:13 +00:00
|
|
|
|
2020-12-06 09:03:07 +00:00
|
|
|
FUNC(libucontext_setcontext)
|
|
|
|
PUSH_FRAME(libucontext_setcontext)
|
2020-03-29 12:05:52 +00:00
|
|
|
|
|
|
|
/* move the context to $v0 */
|
|
|
|
move $v0, $a0
|
|
|
|
|
|
|
|
/* load the registers */
|
2020-03-30 04:05:00 +00:00
|
|
|
ld $a0, REG_OFFSET(4)($v0)
|
|
|
|
ld $a1, REG_OFFSET(5)($v0)
|
|
|
|
ld $a2, REG_OFFSET(6)($v0)
|
|
|
|
ld $a3, REG_OFFSET(7)($v0)
|
|
|
|
ld $a4, REG_OFFSET(8)($v0)
|
|
|
|
ld $a5, REG_OFFSET(9)($v0)
|
|
|
|
ld $a6, REG_OFFSET(10)($v0)
|
|
|
|
ld $a7, REG_OFFSET(11)($v0)
|
|
|
|
|
|
|
|
ld $s0, REG_OFFSET(16)($v0)
|
|
|
|
ld $s1, REG_OFFSET(17)($v0)
|
|
|
|
ld $s2, REG_OFFSET(18)($v0)
|
|
|
|
ld $s3, REG_OFFSET(19)($v0)
|
|
|
|
ld $s4, REG_OFFSET(20)($v0)
|
|
|
|
ld $s5, REG_OFFSET(21)($v0)
|
|
|
|
ld $s6, REG_OFFSET(22)($v0)
|
|
|
|
ld $s7, REG_OFFSET(23)($v0)
|
|
|
|
|
|
|
|
ld $gp, REG_OFFSET(28)($v0)
|
|
|
|
ld $sp, REG_OFFSET(29)($v0)
|
|
|
|
ld $fp, REG_OFFSET(30)($v0)
|
|
|
|
ld $ra, REG_OFFSET(31)($v0)
|
2020-03-29 12:05:52 +00:00
|
|
|
ld $t9, (MCONTEXT_PC)($v0)
|
|
|
|
|
|
|
|
move $v0, $zero
|
|
|
|
jr $t9
|
|
|
|
|
2020-12-06 09:03:07 +00:00
|
|
|
POP_FRAME(libucontext_setcontext)
|
|
|
|
END(libucontext_setcontext)
|