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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [sparc-getcontext-1.c] - Blame information for rev 853

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

Line No. Rev Author Line
1 149 jeremybenn
/* PR middle-end/22127 */
2
/* Testcase by <akr@m17n.org> */
3
 
4
/* { dg-do run { target sparc*-sun-solaris2.* } } */
5
/* { dg-require-effective-target ilp32 } */
6
/* { dg-options "-O" } */
7
 
8
typedef unsigned int size_t;
9
extern int printf(const char *, ...);
10
typedef unsigned char uint8_t;
11
typedef unsigned int uint32_t;
12
typedef unsigned int uint_t;
13
typedef char *caddr_t;
14
typedef int greg_t;
15
typedef greg_t gregset_t[19];
16
struct rwindow {
17
 greg_t rw_local[8];
18
 greg_t rw_in[8];
19
};
20
typedef struct gwindows {
21
 int wbcnt;
22
 greg_t *spbuf[31];
23
 struct rwindow wbuf[31];
24
} gwindows_t;
25
struct fpu {
26
 union {
27
  uint32_t fpu_regs[32];
28
  double fpu_dregs[16];
29
 } fpu_fr;
30
 struct fq *fpu_q;
31
 uint32_t fpu_fsr;
32
 uint8_t fpu_qcnt;
33
 uint8_t fpu_q_entrysize;
34
 uint8_t fpu_en;
35
};
36
typedef struct fpu fpregset_t;
37
typedef struct {
38
 unsigned int xrs_id;
39
 caddr_t xrs_ptr;
40
} xrs_t;
41
typedef struct {
42
 gregset_t gregs;
43
 gwindows_t *gwins;
44
 fpregset_t fpregs;
45
 xrs_t xrs;
46
 long filler[19];
47
} mcontext_t;
48
typedef struct {
49
 unsigned int __sigbits[4];
50
} sigset_t;
51
typedef struct sigaltstack {
52
 void *ss_sp;
53
 size_t ss_size;
54
 int ss_flags;
55
} stack_t;
56
typedef struct ucontext ucontext_t;
57
struct ucontext {
58
 uint_t uc_flags;
59
 ucontext_t *uc_link;
60
 sigset_t uc_sigmask;
61
 stack_t uc_stack;
62
 mcontext_t uc_mcontext;
63
 long uc_filler[23];
64
};
65
extern int getcontext(ucontext_t *);
66
extern int setcontext(const ucontext_t *);
67
 
68
int flag;
69
ucontext_t cont;
70
int pad[100];
71
typedef void (*fun_t)(int);
72
fun_t p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12;
73
 
74
int global;
75
 
76
extern void abort(void);
77
 
78
void h1(int v)
79
{
80
  global = v;
81
}
82
 
83
void h2(int v)
84
{
85
  if (v != 1)
86
    abort();
87
}
88
 
89
void f(void)
90
{
91
  flag = 1;
92
  setcontext(&cont);
93
}
94
 
95
int g(void)
96
{
97
  int ret;
98
 
99
  flag = 0;
100
  getcontext(&cont);
101
  ret = flag;
102
  if (ret == 0) {
103
    h1 (flag);
104
    p0 = p1 = p2 = p3 = p4 = p5 = p6 = p7 = p8 = h1;
105
    f();
106
    p0(ret); p1(ret); p2(ret); p3(ret); p4(ret); p5(ret); p6(ret); p7(ret); p8(ret);
107
  }
108
  else {
109
    h2 (flag);
110
  }
111
  return ret;
112
}
113
 
114
int main(void)
115
{
116
  g();
117
  return 0;
118
}

powered by: WebSVN 2.1.0

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