1*1da177e4SLinus Torvalds/* 2*1da177e4SLinus Torvalds * linux/arch/arm/lib/testsetbit.S 3*1da177e4SLinus Torvalds * 4*1da177e4SLinus Torvalds * Copyright (C) 1995-1996 Russell King 5*1da177e4SLinus Torvalds * 6*1da177e4SLinus Torvalds * This program is free software; you can redistribute it and/or modify 7*1da177e4SLinus Torvalds * it under the terms of the GNU General Public License version 2 as 8*1da177e4SLinus Torvalds * published by the Free Software Foundation. 9*1da177e4SLinus Torvalds */ 10*1da177e4SLinus Torvalds#include <linux/linkage.h> 11*1da177e4SLinus Torvalds#include <asm/assembler.h> 12*1da177e4SLinus Torvalds .text 13*1da177e4SLinus Torvalds 14*1da177e4SLinus TorvaldsENTRY(_test_and_set_bit_be) 15*1da177e4SLinus Torvalds eor r0, r0, #0x18 @ big endian byte ordering 16*1da177e4SLinus TorvaldsENTRY(_test_and_set_bit_le) 17*1da177e4SLinus Torvalds add r1, r1, r0, lsr #3 @ Get byte offset 18*1da177e4SLinus Torvalds and r3, r0, #7 @ Get bit offset 19*1da177e4SLinus Torvalds mov r0, #1 20*1da177e4SLinus Torvalds save_and_disable_irqs ip, r2 21*1da177e4SLinus Torvalds ldrb r2, [r1] 22*1da177e4SLinus Torvalds tst r2, r0, lsl r3 23*1da177e4SLinus Torvalds orr r2, r2, r0, lsl r3 24*1da177e4SLinus Torvalds strb r2, [r1] 25*1da177e4SLinus Torvalds restore_irqs ip 26*1da177e4SLinus Torvalds moveq r0, #0 27*1da177e4SLinus Torvalds RETINSTR(mov,pc,lr) 28*1da177e4SLinus Torvalds 29*1da177e4SLinus Torvalds 30