File: assembler.h

package info (click to toggle)
kernel-source-sparc-2.2.1 2.2.1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 62,800 kB
  • ctags: 188,320
  • sloc: ansic: 1,114,164; asm: 49,922; makefile: 8,272; sh: 1,831; perl: 1,584; tcl: 409; lisp: 218; cpp: 186; awk: 133; sed: 72
file content (84 lines) | stat: -rw-r--r-- 1,769 bytes parent folder | download | duplicates (5)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * linux/asm-arm/proc-armv/assembler.h
 *
 * Copyright (C) 1996 Russell King
 *
 * This file contains arm architecture specific defines
 * for the different processors
 */

/*
 * LOADREGS: multiple register load (ldm) with pc in register list
 *		(takes account of ARM6 not using ^)
 *
 * RETINSTR: return instruction: adds the 's' in at the end of the
 *		instruction if this is not an ARM6
 *
 * SAVEIRQS: save IRQ state (not required on ARM2/ARM3 - done
 *		implicitly
 *
 * RESTOREIRQS: restore IRQ state (not required on ARM2/ARM3 - done
 *		implicitly with ldm ... ^ or movs.
 *
 * These next two need thinking about - can't easily use stack... (see system.S)
 * DISABLEIRQS: disable IRQS in SVC mode
 *
 * ENABLEIRQS: enable IRQS in SVC mode
 *
 * USERMODE: switch to USER mode
 *
 * SVCMODE: switch to SVC mode
 */

#define N_BIT	(1 << 31)
#define Z_BIT	(1 << 30)
#define C_BIT	(1 << 29)
#define V_BIT	(1 << 28)

#define PCMASK	0

#ifdef __ASSEMBLER__

#define I_BIT	(1 << 7)
#define F_BIT	(1 << 6)

#define MODE_FIQ26	0x01
#define MODE_FIQ32	0x11

#define DEFAULT_FIQ	MODE_FIQ32

#define LOADREGS(cond, base, reglist...)\
	ldm##cond	base,reglist

#define RETINSTR(instr, regs...)\
	instr	regs

#define MODENOP

#define MODE(savereg,tmpreg,mode) \
	mrs	savereg, cpsr; \
	bic	tmpreg, savereg, $0x1f; \
	orr	tmpreg, tmpreg, $mode; \
	msr	cpsr, tmpreg

#define RESTOREMODE(savereg) \
	msr	cpsr, savereg
	
#define SAVEIRQS(tmpreg)\
	mrs	tmpreg, cpsr; \
	str	tmpreg, [sp, $-4]!

#define RESTOREIRQS(tmpreg)\
	ldr	tmpreg, [sp], $4; \
	msr	cpsr, tmpreg

#define DISABLEIRQS(tmpreg)\
	mrs	tmpreg , cpsr; \
	orr	tmpreg , tmpreg , $I_BIT; \
	msr	cpsr, tmpreg

#define ENABLEIRQS(tmpreg)\
	mrs	tmpreg , cpsr; \
	bic	tmpreg , tmpreg , $I_BIT; \
	msr	cpsr, tmpreg
#endif