blob: 4e85e368a31c29f170621cf5b98a0111dc2c4d5c (
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
38
39
|
/* $OpenBSD: uthread_machdep_asm.S,v 1.3 2001/12/18 03:44:40 marc Exp $ */
/* David Leonard <d@csee.uq.edu.au>. Public domain. */
#include <machine/asm.h>
#include <machine/trap.h>
/*
* Switch stacks.
* On sparc this also means we switch register windows.
*/
#ifdef __sparcv9__
#define flushw .word 0x81580000
#else
#define flushw t ST_FLUSHWIN
#endif
#define SA(x) (((x)+7)&(~0x7))
#define MINFRAME ((16+1+6)*4)
/* void _thread_switch(int newstate[2], int savestate[2], int flags); */
ENTRY(_thread_machdep_switch)
/* new window */
save %sp, -SA(MINFRAME), %sp
/* flush all windows (except current one) into memory frames */
flushw
/* switch the stack pointer and return address */
st %fp, [%i1 + 0]
st %i7, [%i1 + 4]
ld [%i0 + 0], %fp
ld [%i0 + 4], %i7
/* return to saved window at new %fp */
ret
restore
|