1 /* Set saved user context to current context. C-SKY ABIV2 version.
2 Copyright (C) 2018-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
21 #include "ucontext_i.h"
23 /* int setcontext (const ucontext_t *ucp) */
32 addi a1, t0, UCONTEXT_SIGMASK
35 /* Do sigprocmask syscall. */
41 lrw a3, .Lgetpc1@GOTPC
43 lrw a3, __sigprocmask@PLT
44 ldr.w a3, (gb, a3 << 0)
54 /* Set r0-r11. Load a0-a3, for makecontext requires. */
55 addi t1, t0, MCONTEXT_CSKY_A0
57 ldw sp, (t0, MCONTEXT_CSKY_SP) /* Load sp. */
58 ldw r15, (t0, MCONTEXT_CSKY_LR) /* Load lr. */
59 ldw t0, (t0, MCONTEXT_CSKY_PC) /* Load start addr. */
62 weak_alias (__setcontext, setcontext)
64 ENTRY (__startcontext)
68 cmpnei r9, 0 /* r9 was set in makecontext. */
69 bf 1f /* null, then exit. */
71 /* Call setcontext. */
75 lrw t0, .Lgetpc2@GOTPC
77 lrw t0, __setcontext@GOT
78 ldr.w t0, (t1, t0 << 0)
89 lrw t0, .Lgetpc3@GOTPC
92 ldr.w t0, (t1, t0 << 0)