Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
switch_mips_unix.h
1/*
2 * this is the internal transfer function.
3 *
4 * HISTORY
5 * 20-Sep-14 Matt Madison <madison@bliss-m.org>
6 * Re-code the saving of the gp register for MIPS64.
7 * 05-Jan-08 Thiemo Seufer <ths@debian.org>
8 * Ported from ppc.
9 */
10
11#define STACK_REFPLUS 1
12
13#ifdef SLP_EVAL
14
15#define STACK_MAGIC 0
16
17#define REGS_TO_SAVE "$16", "$17", "$18", "$19", "$20", "$21", "$22", \
18 "$23", "$30"
19static int
20slp_switch(void)
21{
22 int err;
23 int *stackref, stsizediff;
24#ifdef __mips64
25 uint64_t gpsave;
26#endif
27 __asm__ __volatile__ ("" : : : REGS_TO_SAVE);
28#ifdef __mips64
29 __asm__ __volatile__ ("sd $28,%0" : "=m" (gpsave) : : );
30#endif
31 __asm__ ("move %0, $29" : "=r" (stackref) : );
32 {
33 SLP_SAVE_STATE(stackref, stsizediff);
34 __asm__ __volatile__ (
35#ifdef __mips64
36 "daddu $29, %0\n"
37#else
38 "addu $29, %0\n"
39#endif
40 : /* no outputs */
41 : "r" (stsizediff)
42 );
43 SLP_RESTORE_STATE();
44 }
45#ifdef __mips64
46 __asm__ __volatile__ ("ld $28,%0" : : "m" (gpsave) : );
47#endif
48 __asm__ __volatile__ ("" : : : REGS_TO_SAVE);
49 __asm__ __volatile__ ("move %0, $0" : "=r" (err));
50 return err;
51}
52
53#endif
54
55/*
56 * further self-processing support
57 */
58
59/*
60 * if you want to add self-inspection tools, place them
61 * here. See the x86_msvc for the necessary defines.
62 * These features are highly experimental und not
63 * essential yet.
64 */