1 1 # 1 "lib/changebit.S"
5 2 * linux/arch/arm/lib/changebit.S
7 4 * Copyright (C) 1995-1996 Russell King
9 6 * This program is free software; you can redistribute it and/or modify
10 7 * it under the terms of the GNU General Public License version 2 as
11 8 * published by the Free Software Foundation.
13 10 #include <asm/linkage.h>
14 1 #ifndef __ASM_LINKAGE_H
15 11 #include <asm/assembler.h>
17 2 * linux/include/asm-arm/assembler.h
19 4 * Copyright (C) 1996-2000 Russell King
21 6 * This program is free software; you can redistribute it and/or modify
22 7 * it under the terms of the GNU General Public License version 2 as
23 8 * published by the Free Software Foundation.
25 10 * This file contains arm architecture specific defines
26 11 * for the different processors.
28 13 * Do not include any C declarations in this file - it is included by
29 14 * assembler source.
31 16 #ifndef __ASSEMBLY__
32 17 #error "Only include this from assembly code"
35 20 #include <asm/ptrace.h>
40 24 #define get_byte_0 lsr #24
41 25 #define get_byte_1 lsr #16
42 26 #define get_byte_2 lsr #8
43 27 #define get_byte_3 lsl #0
44 28 #define put_byte_0 lsl #24
45 29 #define put_byte_1 lsl #16
46 30 #define put_byte_2 lsl #8
47 31 #define put_byte_3 lsl #0
49 33 #define PLD(code...)
51 35 #define MODE_USR USR_MODE
52 36 #define MODE_FIQ FIQ_MODE
53 37 #define MODE_IRQ IRQ_MODE
54 38 #define MODE_SVC SVC_MODE
56 40 #define DEFAULT_FIQ MODE_FIQ
59 43 * LOADREGS - ldm with PC in register list (eg, ldmfd sp!, {pc})
62 46 #define LOADREGS(cond, base, reglist...)\
63 47 ldm##cond base,reglist
65 49 #define LOADREGS(cond, base, reglist...)\
66 50 ldm/**/cond base,reglist
70 54 * Build a return instruction for this processor type.
72 56 #define RETINSTR(instr, regs...)\
76 60 * Enable and disable interrupts
79 63 msr cpsr_c, #PSR_I_BIT | SVC_MODE
83 67 msr cpsr_c, #SVC_MODE
87 71 * Save the current IRQ state and disable IRQs. Note that this macro
88 72 * assumes FIQs are enabled, and that the processor is in SVC mode.
90 74 .macro save_and_disable_irqs, oldcpsr
96 80 * Restore interrupt state previously stored in a register. We don't
97 81 * guarantee that this will preserve the flags.
99 83 .macro restore_irqs, oldcpsr
100 84 msr cpsr_c, \oldcpsr
104 88 * These two are used to save LR/restore PC over a user-based access.
105 89 * The old 26-bit architecture requires that we do. On 32-bit
106 90 * architecture, we can safely ignore this requirement.
115 12 #include "bitops.h"
116 1 .macro bitop, instr
120 5 save_and_disable_irqs ip
121 6 ldrb r2, [r1, r0, lsr #3]
123 8 strb r2, [r1, r0, lsr #3]
129 14 * testop - implement a test_and_xxx_bit operation.
130 15 * @instr: operational instruction
131 16 * @store: store instruction
133 18 * Note: we can trivially conditionalise the store instruction
134 19 * to avoid dirting the data cache.
136 21 .macro testop, instr, store
137 22 add r1, r1, r0, lsr #3
140 25 save_and_disable_irqs ip
142 27 tst r2, r0, lsl r3
143 28 \instr r2, r2, r0, lsl r3
152 15 /* Purpose : Function to change a bit
153 16 * Prototype: int change_bit(int bit, void *addr)
155 18 ENTRY(_change_bit_be)
156 19 0000 180020E2 eor r0, r0, #0x18 @ big endian byte ordering
157 20 ENTRY(_change_bit_le)
158 21 0004 072000E2 bitop eor
164 lib/changebit.S:18 .text:0000000000000000 _change_bit_be
165 lib/changebit.S:19 .text:0000000000000000 $a
166 lib/changebit.S:20 .text:0000000000000004 _change_bit_le