File: switch_alpha_unix.h

package info (click to toggle)
python-greenlet 0.4.2-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 488 kB
  • ctags: 588
  • sloc: ansic: 2,162; python: 1,215; makefile: 161; cpp: 89; asm: 82
file content (39 lines) | stat: -rw-r--r-- 798 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * this is the internal transfer function.
 *
 * HISTORY
 * 2012-11-01 M. J. Cree
 *      Ported from extant code for other arches.
 */

#define STACK_REFPLUS 1

#ifdef SLP_EVAL

#define STACK_MAGIC 0


#define REGS_TO_SAVE "$9", "$10", "$11", "$12", "$13", "$14", "$15", \
       "$26"

static int
slp_switch(void)
{
    register int *stackref, stsizediff;
    __asm__ __volatile__ ("" : : : REGS_TO_SAVE);
    __asm__ ("mov $sp, %0" : "=r" (stackref) : );
    {
        SLP_SAVE_STATE(stackref, stsizediff);
        __asm__ __volatile__ (
            "addq $sp, %0, $sp\n"
            "addq $fp, %0, $fp\n"
            : /* no outputs */
            : "r" (stsizediff)
            );
        SLP_RESTORE_STATE();
    }
    __asm__ __volatile__ ("" : : : REGS_TO_SAVE);
    return 0;
}

#endif