blob: 63ba78526038b8a09411256be02a0805afffd5b9 (
plain)
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
|
/* $OpenBSD: uthread_machdep_asm.S,v 1.3 2002/01/02 23:05:53 art Exp $ */
/* David Leonard <d@csee.uq.edu.au>. Public domain. */
#include <machine/asm.h>
#include <machine/trap.h>
#include <machine/frame.h>
/*
* Switch stacks.
* On sparc this also means we switch register windows.
*/
#ifdef __sparcv9__
#define flushw .word 0x81580000
#else
#define flushw t T_FLUSHWIN
#endif
/* void _thread_switch(long newstate[2], long savestate[2], int flags); */
ENTRY(_thread_machdep_switch)
/* new window */
save %sp, -CC64FSZ, %sp
/* flush all windows (except current one) into memory frames */
flushw
/* switch the stack pointer and return address */
stx %fp, [%i1 + 0]
stx %i7, [%i1 + 8]
ldx [%i0 + 0], %fp
ldx [%i0 + 8], %i7
/* return to saved window at new %fp */
ret
restore
|