Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
switch_ppc_linux.h
1/*
2 * this is the internal transfer function.
3 *
4 * HISTORY
5 * 07-Sep-05 (py-dev mailing list discussion)
6 * removed 'r31' from the register-saved. !!!! WARNING !!!!
7 * It means that this file can no longer be compiled statically!
8 * It is now only suitable as part of a dynamic library!
9 * 14-Jan-04 Bob Ippolito <bob@redivi.com>
10 * added cr2-cr4 to the registers to be saved.
11 * Open questions: Should we save FP registers?
12 * What about vector registers?
13 * Differences between darwin and unix?
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 * 04-Oct-02 Gustavo Niemeyer <niemeyer@conectiva.com>
20 * Ported from MacOS version.
21 * 17-Sep-02 Christian Tismer <tismer@tismer.com>
22 * after virtualizing stack save/restore, the
23 * stack size shrunk a bit. Needed to introduce
24 * an adjustment STACK_MAGIC per platform.
25 * 15-Sep-02 Gerd Woetzel <gerd.woetzel@GMD.DE>
26 * slightly changed framework for sparc
27 * 29-Jun-02 Christian Tismer <tismer@tismer.com>
28 * Added register 13-29, 31 saves. The same way as
29 * Armin Rigo did for the x86_unix version.
30 * This seems to be now fully functional!
31 * 04-Mar-02 Hye-Shik Chang <perky@fallin.lv>
32 * Ported from i386.
33 * 31-Jul-12 Trevor Bowen <trevorbowen@gmail.com>
34 * Changed memory constraints to register only.
35 */
36
37#define STACK_REFPLUS 1
38
39#ifdef SLP_EVAL
40
41#define STACK_MAGIC 3
42
43/* !!!!WARNING!!!! need to add "r31" in the next line if this header file
44 * is meant to be compiled non-dynamically!
45 */
46#define REGS_TO_SAVE "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", \
47 "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", \
48 "cr2", "cr3", "cr4"
49static int
50slp_switch(void)
51{
52 int err;
53 int *stackref, stsizediff;
54 __asm__ volatile ("" : : : REGS_TO_SAVE);
55 __asm__ ("mr %0, 1" : "=r" (stackref) : );
56 {
57 SLP_SAVE_STATE(stackref, stsizediff);
58 __asm__ volatile (
59 "mr 11, %0\n"
60 "add 1, 1, 11\n"
61 "add 30, 30, 11\n"
62 : /* no outputs */
63 : "r" (stsizediff)
64 : "11"
65 );
66 SLP_RESTORE_STATE();
67 }
68 __asm__ volatile ("" : : : REGS_TO_SAVE);
69 __asm__ volatile ("li %0, 0" : "=r" (err));
70 return err;
71}
72
73#endif
74
75/*
76 * further self-processing support
77 */
78
79/*
80 * if you want to add self-inspection tools, place them
81 * here. See the x86_msvc for the necessary defines.
82 * These features are highly experimental und not
83 * essential yet.
84 */