OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [machine/] [mips/] [setjmp.S] - Blame information for rev 158

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* This is a simple version of setjmp and longjmp for MIPS 32 and 64.
2
 
3
   Ian Lance Taylor, Cygnus Support, 13 May 1993.  */
4
 
5
#ifdef __mips16
6
/* This file contains 32 bit assembly code.  */
7
        .set nomips16
8
#endif
9
 
10
#define GPR_LAYOUT              \
11
        GPR_OFFSET ($16, 0);    \
12
        GPR_OFFSET ($17, 1);    \
13
        GPR_OFFSET ($18, 2);    \
14
        GPR_OFFSET ($19, 3);    \
15
        GPR_OFFSET ($20, 4);    \
16
        GPR_OFFSET ($21, 5);    \
17
        GPR_OFFSET ($22, 6);    \
18
        GPR_OFFSET ($23, 7);    \
19
        GPR_OFFSET ($29, 8);    \
20
        GPR_OFFSET ($30, 9);    \
21
        GPR_OFFSET ($31, 10)
22
 
23
#define NUM_GPRS_SAVED 11
24
 
25
#ifdef __mips_hard_float
26
#define FPR_LAYOUT              \
27
        FPR_OFFSET ($f20, 0);   \
28
        FPR_OFFSET ($f21, 1);   \
29
        FPR_OFFSET ($f22, 2);   \
30
        FPR_OFFSET ($f23, 3);   \
31
        FPR_OFFSET ($f24, 4);   \
32
        FPR_OFFSET ($f25, 5);   \
33
        FPR_OFFSET ($f26, 6);   \
34
        FPR_OFFSET ($f27, 7);   \
35
        FPR_OFFSET ($f28, 8);   \
36
        FPR_OFFSET ($f29, 9);   \
37
        FPR_OFFSET ($f30, 10);  \
38
        FPR_OFFSET ($f31, 11)
39
#else
40
#define FPR_LAYOUT
41
#endif
42
 
43
#ifdef __mips64
44
#define BYTES_PER_WORD 8
45
#define LOAD_GPR ld
46
#define LOAD_FPR ldc1
47
#define STORE_GPR sd
48
#define STORE_FPR sdc1
49
#else
50
#define BYTES_PER_WORD 4
51
#define LOAD_GPR lw
52
#define LOAD_FPR lwc1
53
#define STORE_GPR sw
54
#define STORE_FPR swc1
55
#endif
56
 
57
#define GPOFF(INDEX) (INDEX * BYTES_PER_WORD)
58
#define FPOFF(INDEX) ((INDEX + NUM_GPRS_SAVED) * BYTES_PER_WORD)
59
 
60
/* int setjmp (jmp_buf);  */
61
        .globl  setjmp
62
        .ent    setjmp
63
setjmp:
64
        .frame  $sp,0,$31
65
 
66
#define GPR_OFFSET(REG, INDEX) STORE_GPR REG,GPOFF(INDEX)($4)
67
#define FPR_OFFSET(REG, INDEX) STORE_FPR REG,FPOFF(INDEX)($4)
68
        GPR_LAYOUT
69
        FPR_LAYOUT
70
#undef GPR_OFFSET
71
#undef FPR_OFFSET
72
 
73
        move    $2,$0
74
        j       $31
75
 
76
        .end    setjmp
77
 
78
/* volatile void longjmp (jmp_buf, int);  */
79
        .globl  longjmp
80
        .ent    longjmp
81
longjmp:
82
        .frame  $sp,0,$31
83
 
84
#define GPR_OFFSET(REG, INDEX) LOAD_GPR REG,GPOFF(INDEX)($4)
85
#define FPR_OFFSET(REG, INDEX) LOAD_FPR REG,FPOFF(INDEX)($4)
86
        GPR_LAYOUT
87
        FPR_LAYOUT
88
#undef GPR_OFFSET
89
#undef FPR_OFFSET
90
 
91
        bne     $5,$0,1f
92
        li      $5,1
93
1:
94
        move    $2,$5
95
        j       $31
96
 
97
        .end longjmp

powered by: WebSVN 2.1.0

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