Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
switch_ppc_unix.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 */
34
35#define STACK_REFPLUS 1
36
37#ifdef SLP_EVAL
38
39#define STACK_MAGIC 3
40
41/* !!!!WARNING!!!! need to add "r31" in the next line if this header file
42 * is meant to be compiled non-dynamically!
43 */
44#define REGS_TO_SAVE "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", \
45 "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", \
46 "cr2", "cr3", "cr4"
47static int
48slp_switch(void)
49{
50 int err;
51 int *stackref, stsizediff;
52 __asm__ volatile ("" : : : REGS_TO_SAVE);
53 __asm__ ("mr %0, 1" : "=r" (stackref) : );
54 {
55 SLP_SAVE_STATE(stackref, stsizediff);
56 __asm__ volatile (
57 "mr 11, %0\n"
58 "add 1, 1, 11\n"
59 "add 30, 30, 11\n"
60 : /* no outputs */
61 : "r" (stsizediff)
62 : "11"
63 );
64 SLP_RESTORE_STATE();
65 }
66 __asm__ volatile ("" : : : REGS_TO_SAVE);
67 __asm__ volatile ("li %0, 0" : "=r" (err));
68 return err;
69}
70
71#endif
72
73/*
74 * further self-processing support
75 */
76
77/*
78 * if you want to add self-inspection tools, place them
79 * here. See the x86_msvc for the necessary defines.
80 * These features are highly experimental und not
81 * essential yet.
82 */