-
Notifications
You must be signed in to change notification settings - Fork 4
/
asm-defs.h
71 lines (50 loc) · 1.11 KB
/
asm-defs.h
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// vim: ft=asm
#pragma once
.altmacro
.syntax unified
// return and conditional return
.macro ret c= ; bx\c& lr ; .endm
// more or less emulate the simplicity of the Cortex-M series on Cortex-A
//
// for handler mode can use:
// 0b11111 system mode (same stack as thread mode)
// 0b10011 supervisor mode (separate stack, not supported right now)
//
#define MODE_USR 0b10000 // thread-mode, unprivileged
#define MODE_THR 0b11111 // thread-mode, privileged
#define MODE_HND 0b11111 // handler-mode (always privileged)
//-------- macros for defining functions and labeled data --------------------//
// end the current function / data area
.macro .done
.endm
// redefine .done to do nothing
.macro .donedone
.purgem .done
.macro .done
.endm
.endm
// start a function
.macro .fun label
.done
.balign 4
.global \label&
.type \label&, "function"
\label&:
.purgem .done
.macro .done
.size \label&, . - \label&
.donedone
.endm
.endm
.macro .var label
.done
.balign 4
.global \label&
.type \label&, "object"
\label&:
.purgem .done
.macro .done
.size \label&, . - \label&
.donedone
.endm
.endm