Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
switch_ppc_aix.h
1/*
2 * this is the internal transfer function.
3 *
4 * HISTORY
5 * 07-Mar-11 Floris Bruynooghe <flub@devork.be>
6 * Do not add stsizediff to general purpose
7 * register (GPR) 30 as this is a non-volatile and
8 * unused by the PowerOpen Environment, therefore
9 * this was modifying a user register instead of the
10 * frame pointer (which does not seem to exist).
11 * 07-Sep-05 (py-dev mailing list discussion)
12 * removed 'r31' from the register-saved. !!!! WARNING !!!!
13 * It means that this file can no longer be compiled statically!
14 * It is now only suitable as part of a dynamic library!
15 * 14-Jan-04 Bob Ippolito <bob@redivi.com>
16 * added cr2-cr4 to the registers to be saved.
17 * Open questions: Should we save FP registers?
18 * What about vector registers?
19 * Differences between darwin and unix?
20 * 24-Nov-02 Christian Tismer <tismer@tismer.com>
21 * needed to add another magic constant to insure
22 * that f in slp_eval_frame(PyFrameObject *f)
23 * STACK_REFPLUS will probably be 1 in most cases.
24 * gets included into the saved stack area.
25 * 04-Oct-02 Gustavo Niemeyer <niemeyer@conectiva.com>
26 * Ported from MacOS version.
27 * 17-Sep-02 Christian Tismer <tismer@tismer.com>
28 * after virtualizing stack save/restore, the
29 * stack size shrunk a bit. Needed to introduce
30 * an adjustment STACK_MAGIC per platform.
31 * 15-Sep-02 Gerd Woetzel <gerd.woetzel@GMD.DE>
32 * slightly changed framework for sparc
33 * 29-Jun-02 Christian Tismer <tismer@tismer.com>
34 * Added register 13-29, 31 saves. The same way as
35 * Armin Rigo did for the x86_unix version.
36 * This seems to be now fully functional!
37 * 04-Mar-02 Hye-Shik Chang <perky@fallin.lv>
38 * Ported from i386.
39 */
40
41#define STACK_REFPLUS 1
42
43#ifdef SLP_EVAL
44
45#define STACK_MAGIC 3
46
47/* !!!!WARNING!!!! need to add "r31" in the next line if this header file
48 * is meant to be compiled non-dynamically!
49 */
50#define REGS_TO_SAVE "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", \
51 "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", \
52 "cr2", "cr3", "cr4"
53static int
54slp_switch(void)
55{
56 int err;
57 int *stackref, stsizediff;
58 __asm__ volatile ("" : : : REGS_TO_SAVE);
59 __asm__ ("mr %0, 1" : "=r" (stackref) : );
60 {
61 SLP_SAVE_STATE(stackref, stsizediff);
62 __asm__ volatile (
63 "mr 11, %0\n"
64 "add 1, 1, 11\n"
65 : /* no outputs */
66 : "r" (stsizediff)
67 : "11"
68 );
69 SLP_RESTORE_STATE();
70 }
71 __asm__ volatile ("" : : : REGS_TO_SAVE);
72 __asm__ volatile ("li %0, 0" : "=r" (err));
73 return err;
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 */