aboutsummaryrefslogtreecommitdiff
path: root/include/macros.s
blob: 051f1474eaaaa525642415db0c1187ca8912cb97 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

.ifndef _macros_s_file
_macros_s_file:

.macro enter_rbp
	jmp *(%rbp)
.endm

.macro enter x
	mov \x, %rbp
	enter_rbp
.endm

.macro cell x
	.quad \x
.endm

.macro continue
	xchg %rsi, %rbp
	enter_rbp
.endm

.macro thunkenv arg, dest
	mov  (8*(\arg+2))(%rbp), \dest
.endm

.macro enter_thunkenv arg
	mov  (8*(\arg+2))(%rbp), %rbp
	jmp *(%rbp)
.endm

# this needs data.s
.macro .thunkcode name
	.align 8
	__\name\()_info:
		cell THU_evacuate
		cell THU_scavenge
		cell 0
	\name:
.endm

.macro thunk arg,args:vararg
	.ifnb \arg
	thunk \args
	pushq \arg
	.endif
.endm

.macro thunkto reg:req,args:vararg
	thunk \args
	mov %rsp, \reg
.endm

.endif # _macros_s_file