Initial commit
[kk_librfid.git] / firmware / include / asm / assembler.h
blobb43f9d17d595ec43b0c6c5535fcec04ef2bcbab7
1 /*
2 * linux/include/asm-arm/assembler.h
4 * Copyright (C) 1996-2000 Russell King
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * This file contains arm architecture specific defines
11 * for the different processors.
13 * Do not include any C declarations in this file - it is included by
14 * assembler source.
16 #ifndef __ASSEMBLY__
17 #error "Only include this from assembly code"
18 #endif
20 #include <asm/ptrace.h>
22 #define pull lsl
23 #define push lsr
24 #define get_byte_0 lsr #24
25 #define get_byte_1 lsr #16
26 #define get_byte_2 lsr #8
27 #define get_byte_3 lsl #0
28 #define put_byte_0 lsl #24
29 #define put_byte_1 lsl #16
30 #define put_byte_2 lsl #8
31 #define put_byte_3 lsl #0
33 #define PLD(code...)
35 #define MODE_USR USR_MODE
36 #define MODE_FIQ FIQ_MODE
37 #define MODE_IRQ IRQ_MODE
38 #define MODE_SVC SVC_MODE
40 #define DEFAULT_FIQ MODE_FIQ
43 * LOADREGS - ldm with PC in register list (eg, ldmfd sp!, {pc})
45 #ifdef __STDC__
46 #define LOADREGS(cond, base, reglist...)\
47 ldm##cond base,reglist
48 #else
49 #define LOADREGS(cond, base, reglist...)\
50 ldm/**/cond base,reglist
51 #endif
54 * Build a return instruction for this processor type.
56 #define RETINSTR(instr, regs...)\
57 instr regs
60 * Enable and disable interrupts
62 .macro disable_irq
63 msr cpsr_c, #PSR_I_BIT | SVC_MODE
64 .endm
66 .macro enable_irq
67 msr cpsr_c, #SVC_MODE
68 .endm
71 * Save the current IRQ state and disable IRQs. Note that this macro
72 * assumes FIQs are enabled, and that the processor is in SVC mode.
74 .macro save_and_disable_irqs, oldcpsr
75 mrs \oldcpsr, cpsr
76 disable_irq
77 .endm
80 * Restore interrupt state previously stored in a register. We don't
81 * guarantee that this will preserve the flags.
83 .macro restore_irqs, oldcpsr
84 msr cpsr_c, \oldcpsr
85 .endm
88 * These two are used to save LR/restore PC over a user-based access.
89 * The old 26-bit architecture requires that we do. On 32-bit
90 * architecture, we can safely ignore this requirement.
92 .macro save_lr
93 .endm
95 .macro restore_pc
96 mov pc, lr
97 .endm