Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
docs
help
help-venv
lib
python3.12
site-packages
greenlet
platform
switch_x86_unix.h
1
/*
2
* this is the internal transfer function.
3
*
4
* HISTORY
5
* 3-May-13 Ralf Schmitt <ralf@systemexit.de>
6
* Add support for strange GCC caller-save decisions
7
* (ported from switch_aarch64_gcc.h)
8
* 19-Aug-11 Alexey Borzenkov <snaury@gmail.com>
9
* Correctly save ebp, ebx and cw
10
* 07-Sep-05 (py-dev mailing list discussion)
11
* removed 'ebx' from the register-saved. !!!! WARNING !!!!
12
* It means that this file can no longer be compiled statically!
13
* It is now only suitable as part of a dynamic library!
14
* 24-Nov-02 Christian Tismer <tismer@tismer.com>
15
* needed to add another magic constant to insure
16
* that f in slp_eval_frame(PyFrameObject *f)
17
* STACK_REFPLUS will probably be 1 in most cases.
18
* gets included into the saved stack area.
19
* 17-Sep-02 Christian Tismer <tismer@tismer.com>
20
* after virtualizing stack save/restore, the
21
* stack size shrunk a bit. Needed to introduce
22
* an adjustment STACK_MAGIC per platform.
23
* 15-Sep-02 Gerd Woetzel <gerd.woetzel@GMD.DE>
24
* slightly changed framework for spark
25
* 31-Avr-02 Armin Rigo <arigo@ulb.ac.be>
26
* Added ebx, esi and edi register-saves.
27
* 01-Mar-02 Samual M. Rushing <rushing@ironport.com>
28
* Ported from i386.
29
*/
30
31
#define STACK_REFPLUS 1
32
33
#ifdef SLP_EVAL
34
35
/* #define STACK_MAGIC 3 */
36
/* the above works fine with gcc 2.96, but 2.95.3 wants this */
37
#define STACK_MAGIC 0
38
39
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
40
# define ATTR_NOCLONE __attribute__((noclone))
41
#else
42
# define ATTR_NOCLONE
43
#endif
44
45
static
int
46
slp_switch(
void
)
47
{
48
int
err;
49
#ifdef _WIN32
50
void
*seh;
51
#endif
52
void
*ebp, *ebx;
53
unsigned
short
cw;
54
int
*stackref, stsizediff;
55
__asm__
volatile
(
""
: : :
"esi"
,
"edi"
);
56
__asm__
volatile
(
"fstcw %0"
:
"=m"
(cw));
57
__asm__
volatile
(
"movl %%ebp, %0"
:
"=m"
(ebp));
58
__asm__
volatile
(
"movl %%ebx, %0"
:
"=m"
(ebx));
59
#ifdef _WIN32
60
__asm__
volatile
(
61
"movl %%fs:0x0, %%eax\n"
62
"movl %%eax, %0\n"
63
:
"=m"
(seh)
64
:
65
:
"eax"
);
66
#endif
67
__asm__ (
"movl %%esp, %0"
:
"=g"
(stackref));
68
{
69
SLP_SAVE_STATE(stackref, stsizediff);
70
__asm__
volatile
(
71
"addl %0, %%esp\n"
72
"addl %0, %%ebp\n"
73
:
74
:
"r"
(stsizediff)
75
);
76
SLP_RESTORE_STATE();
77
__asm__
volatile
(
"xorl %%eax, %%eax"
:
"=a"
(err));
78
}
79
#ifdef _WIN32
80
__asm__
volatile
(
81
"movl %0, %%eax\n"
82
"movl %%eax, %%fs:0x0\n"
83
:
84
:
"m"
(seh)
85
:
"eax"
);
86
#endif
87
__asm__
volatile
(
"movl %0, %%ebx"
: :
"m"
(ebx));
88
__asm__
volatile
(
"movl %0, %%ebp"
: :
"m"
(ebp));
89
__asm__
volatile
(
"fldcw %0"
: :
"m"
(cw));
90
__asm__
volatile
(
""
: : :
"esi"
,
"edi"
);
91
return
err;
92
}
93
94
#endif
95
96
/*
97
* further self-processing support
98
*/
99
100
/*
101
* if you want to add self-inspection tools, place them
102
* here. See the x86_msvc for the necessary defines.
103
* These features are highly experimental und not
104
* essential yet.
105
*/
Generated by
1.9.8