1 /* Save and set current context. C-SKY ABIV2 version.
2 Copyright (C) 2018-2020 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 swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
26 /* Save params and lr. */
32 /* Call getcontext. */
36 lrw t0, .Lgetpc1@GOTPC
38 lrw t0, __getcontext@GOT
39 ldr.w t0, (t1, t0 << 0)
45 mov a3, a0 /* Save return value. */
47 /* Restore params and lr. */
56 /* Fix up LR and the PC. */
57 stw sp, (a0, MCONTEXT_CSKY_SP)
58 stw r15, (a0, MCONTEXT_CSKY_LR)
59 stw r15, (a0, MCONTEXT_CSKY_PC)
61 /* Set setcontext's arg. */
67 lrw a3, .Lgetpc2@GOTPC
69 lrw a3, __setcontext@GOT
70 ldr.w a3, (t1, a3 << 0)