OpenCores
URL https://opencores.org/ocsvn/hf-risc/hf-risc/trunk

Subversion Repositories hf-risc

[/] [hf-risc/] [trunk/] [tools/] [riscv-gnu-toolchain-master/] [glibc/] [sysdeps/] [unix/] [sysv/] [linux/] [riscv/] [getcontext.S] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 serginhofr
/* Save current context.
2
   Copyright (C) 2009 Free Software Foundation, Inc.
3
   This file is part of the GNU C Library.
4
   Contributed by Maciej W. Rozycki .
5
 
6
   The GNU C Library is free software; you can redistribute it and/or
7
   modify it under the terms of the GNU Lesser General Public
8
   License as published by the Free Software Foundation; either
9
   version 2.1 of the License, or (at your option) any later version.
10
 
11
   The GNU C Library is distributed in the hope that it will be useful,
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
   Lesser General Public License for more details.
15
 
16
   You should have received a copy of the GNU Lesser General Public
17
   License along with the GNU C Library; if not, write to the Free
18
   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
19
   02110-1301, USA.  */
20
 
21
#include 
22
#include 
23
 
24
#include "ucontext_i.h"
25
 
26
/* int getcontext (ucontext_t *ucp) */
27
 
28
        .text
29
LEAF (__getcontext)
30
        REG_S   ra, MCONTEXT_PC(a0)
31
        REG_S   ra, ( 1 * SZREG + MCONTEXT_GREGS)(a0)
32
        REG_S   sp, ( 2 * SZREG + MCONTEXT_GREGS)(a0)
33
        REG_S   s0, ( 8 * SZREG + MCONTEXT_GREGS)(a0)
34
        REG_S   s1, ( 9 * SZREG + MCONTEXT_GREGS)(a0)
35
        REG_S   x0, (10 * SZREG + MCONTEXT_GREGS)(a0)   /* return 0 */
36
        REG_S   s2, (18 * SZREG + MCONTEXT_GREGS)(a0)
37
        REG_S   s3, (19 * SZREG + MCONTEXT_GREGS)(a0)
38
        REG_S   s4, (20 * SZREG + MCONTEXT_GREGS)(a0)
39
        REG_S   s5, (21 * SZREG + MCONTEXT_GREGS)(a0)
40
        REG_S   s6, (22 * SZREG + MCONTEXT_GREGS)(a0)
41
        REG_S   s7, (23 * SZREG + MCONTEXT_GREGS)(a0)
42
        REG_S   s8, (24 * SZREG + MCONTEXT_GREGS)(a0)
43
        REG_S   s9, (25 * SZREG + MCONTEXT_GREGS)(a0)
44
        REG_S   s10,(26 * SZREG + MCONTEXT_GREGS)(a0)
45
        REG_S   s11,(27 * SZREG + MCONTEXT_GREGS)(a0)
46
 
47
#ifdef __riscv_hard_float
48
        frsr    a1
49
 
50
        fsd     fs0, ( 8 * 8 + MCONTEXT_FPREGS)(a0)
51
        fsd     fs1, ( 9 * 8 + MCONTEXT_FPREGS)(a0)
52
        fsd     fs2, (18 * 8 + MCONTEXT_FPREGS)(a0)
53
        fsd     fs3, (19 * 8 + MCONTEXT_FPREGS)(a0)
54
        fsd     fs4, (20 * 8 + MCONTEXT_FPREGS)(a0)
55
        fsd     fs5, (21 * 8 + MCONTEXT_FPREGS)(a0)
56
        fsd     fs6, (22 * 8 + MCONTEXT_FPREGS)(a0)
57
        fsd     fs7, (23 * 8 + MCONTEXT_FPREGS)(a0)
58
        fsd     fs8, (24 * 8 + MCONTEXT_FPREGS)(a0)
59
        fsd     fs9, (25 * 8 + MCONTEXT_FPREGS)(a0)
60
        fsd     fs10,(26 * 8 + MCONTEXT_FPREGS)(a0)
61
        fsd     fs11,(27 * 8 + MCONTEXT_FPREGS)(a0)
62
 
63
        sw      a1, MCONTEXT_FSR(a0)
64
#endif /* __mips_hard_float */
65
 
66
/* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */
67
        li      a3, _NSIG8
68
        add     a2, a0, UCONTEXT_SIGMASK
69
        move    a1, zero
70
        li      a0, SIG_BLOCK
71
 
72
        li      a7, SYS_ify (rt_sigprocmask)
73
        scall
74
        bltz    a0, 99f
75
 
76
        ret
77
 
78
99:     j       __syscall_error
79
 
80
PSEUDO_END (__getcontext)
81
 
82
weak_alias (__getcontext, getcontext)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.