Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
docs
help
help-venv
lib
python3.12
site-packages
greenlet
platform
switch_s390_unix.h
1
/*
2
* this is the internal transfer function.
3
*
4
* HISTORY
5
* 25-Jan-12 Alexey Borzenkov <snaury@gmail.com>
6
* Fixed Linux/S390 port to work correctly with
7
* different optimization options both on 31-bit
8
* and 64-bit. Thanks to Stefan Raabe for lots
9
* of testing.
10
* 24-Nov-02 Christian Tismer <tismer@tismer.com>
11
* needed to add another magic constant to insure
12
* that f in slp_eval_frame(PyFrameObject *f)
13
* STACK_REFPLUS will probably be 1 in most cases.
14
* gets included into the saved stack area.
15
* 06-Oct-02 Gustavo Niemeyer <niemeyer@conectiva.com>
16
* Ported to Linux/S390.
17
*/
18
19
#define STACK_REFPLUS 1
20
21
#ifdef SLP_EVAL
22
23
#ifdef __s390x__
24
#define STACK_MAGIC 20
/* 20 * 8 = 160 bytes of function call area */
25
#else
26
#define STACK_MAGIC 24
/* 24 * 4 = 96 bytes of function call area */
27
#endif
28
29
/* Technically, r11-r13 also need saving, but function prolog starts
30
with stm(g) and since there are so many saved registers already
31
it won't be optimized, resulting in all r6-r15 being saved */
32
#define REGS_TO_SAVE "r6", "r7", "r8", "r9", "r10", "r14", \
33
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
34
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15"
35
36
static
int
37
slp_switch(
void
)
38
{
39
int
ret;
40
long
*stackref, stsizediff;
41
__asm__
volatile
(
""
: : : REGS_TO_SAVE);
42
#ifdef __s390x__
43
__asm__
volatile
(
"lgr %0, 15"
:
"=r"
(stackref) : );
44
#else
45
__asm__
volatile
(
"lr %0, 15"
:
"=r"
(stackref) : );
46
#endif
47
{
48
SLP_SAVE_STATE(stackref, stsizediff);
49
/* N.B.
50
r11 may be used as the frame pointer, and in that case it cannot be
51
clobbered and needs offsetting just like the stack pointer (but in cases
52
where frame pointer isn't used we might clobber it accidentally). What's
53
scary is that r11 is 2nd (and even 1st when GOT is used) callee saved
54
register that gcc would chose for surviving function calls. However,
55
since r6-r10 are clobbered above, their cost for reuse is reduced, so
56
gcc IRA will chose them over r11 (not seeing r11 is implicitly saved),
57
making it relatively safe to offset in all cases. :) */
58
__asm__
volatile
(
59
#ifdef __s390x__
60
"agr 15, %0\n\t"
61
"agr 11, %0"
62
#else
63
"ar 15, %0\n\t"
64
"ar 11, %0"
65
#endif
66
:
/* no outputs */
67
:
"r"
(stsizediff)
68
);
69
SLP_RESTORE_STATE();
70
}
71
__asm__
volatile
(
""
: : : REGS_TO_SAVE);
72
__asm__
volatile
(
"lhi %0, 0"
:
"=r"
(ret) : );
73
return
ret;
74
}
75
76
#endif
77
78
/*
79
* further self-processing support
80
*/
81
82
/*
83
* if you want to add self-inspection tools, place them
84
* here. See the x86_msvc for the necessary defines.
85
* These features are highly experimental und not
86
* essential yet.
87
*/
Generated by
1.9.8