Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/arm Add byte-swap versions.
details: https://anonhg.NetBSD.org/src/rev/c591d155bc2f
branches: trunk
changeset: 780213:c591d155bc2f
user: matt <matt%NetBSD.org@localhost>
date: Sun Jul 15 20:48:53 2012 +0000
description:
Add byte-swap versions.
Use RET and RETc(c)
Use ENTRY_NP
diffstat:
sys/arch/arm/arm/bus_space_a2x.S | 94 +++++++--
sys/arch/arm/arm/bus_space_a4x.S | 94 +++++++--
sys/arch/arm/arm/bus_space_asm_generic.S | 303 ++++++++++++++++++++++++------
3 files changed, 381 insertions(+), 110 deletions(-)
diffs (truncated from 884 to 300 lines):
diff -r 240c1d5dcce0 -r c591d155bc2f sys/arch/arm/arm/bus_space_a2x.S
--- a/sys/arch/arm/arm/bus_space_a2x.S Sun Jul 15 20:44:20 2012 +0000
+++ b/sys/arch/arm/arm/bus_space_a2x.S Sun Jul 15 20:48:53 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space_a2x.S,v 1.1 2012/06/06 20:21:43 skrll Exp $ */
+/* $NetBSD: bus_space_a2x.S,v 1.2 2012/07/15 20:48:53 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,84 +29,134 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <machine/asm.h>
-#include <machine/cpu.h>
+#include <arm/asm.h>
+#include <arm/cpu.h>
+#include <arm/byte_swap.h>
-RCSID("$NetBSD: bus_space_a2x.S,v 1.1 2012/06/06 20:21:43 skrll Exp $")
+RCSID("$NetBSD: bus_space_a2x.S,v 1.2 2012/07/15 20:48:53 matt Exp $")
/*
* bus_space_read_[124](void *cookie, bus_space_handle_t handle,
* bus_size_t offset);
*/
-ENTRY(a2x_bs_r_1)
+ENTRY_NP(a2x_bs_r_1)
ldrb r0, [r1, r2, lsl #1]
- mov pc, lr
+ RET
+END(a2x_bs_r_1)
#if (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
-ENTRY(a2x_bs_r_2)
+ENTRY_NP(a2x_bs_r_2)
+ lsl r2, r2, #1
+ ldrh r0, [r1, r2]
+ RET
+END(a2x_bs_r_2)
+
+ENTRY_NP(a2x_bs_r_2_swap)
lsl r2, r2, #1
ldrh r0, [r1, r2]
- mov pc, lr
+ BSWAP16(r0, r0, r1)
+ RET
+END(a2x_bs_r_2_swap)
#endif
-ENTRY(a2x_bs_r_4)
+ENTRY_NP(a2x_bs_r_4)
ldr r0, [r1, r2, lsl #1]
- mov pc, lr
+ RET
+END(a2x_bs_r_4)
+
+ENTRY_NP(a2x_bs_r_4_swap)
+ ldr r0, [r1, r2, lsl #1]
+ BSWAP32(r0, r0, r1)
+ RET
+END(a2x_bs_r_4_swap)
/*
* bus_space_read_multi_[124](void *cookie, bus_space_handle_t handle,
* bus_size_t offset, uint{8,16,32}_t *data, bus_size_t count);
*/
-ENTRY(a2x_bs_rm_1)
+ENTRY_NP(a2x_bs_rm_1)
lsl r2, r2, #1
b generic_bs_rm_1
+END(a2x_bs_rm_1)
#if (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
-ENTRY(a2x_bs_rm_2)
+ENTRY_NP(a2x_bs_rm_2)
lsl r2, r2, #1
b generic_armv4_bs_rm_2
+END(a2x_bs_rm_2)
+
+ENTRY_NP(a2x_bs_rm_2_swap)
+ lsl r2, r2, #1
+ b generic_armv4_bs_rm_2_swap
+END(a2x_bs_rm_2_swap)
#endif
-ENTRY(a2x_bs_rm_4)
+ENTRY_NP(a2x_bs_rm_4)
lsl r2, r2, #1
b generic_bs_rm_4
+END(a2x_bs_rm_4)
+
+ENTRY_NP(a2x_bs_rm_4_swap)
+ lsl r2, r2, #1
+ b generic_bs_rm_4_swap
+END(a2x_bs_rm_4_swap)
/*
* bus_space_write_[124](void *cookie, bus_space_handle_t handle,
* bus_size_t offset, uint{8,16,32}_t value);
*/
-ENTRY(a2x_bs_w_1)
+ENTRY_NP(a2x_bs_w_1)
strb r3, [r1, r2, lsl #1]
- mov pc, lr
+ RET
+END(a2x_bs_w_1)
#if (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
-ENTRY(a2x_bs_w_2)
+ENTRY_NP(a2x_bs_w_2_swap)
+ BSWAP16(r3, r3, r0)
+ENTRY_NP(a2x_bs_w_2)
lsl r2, r2, #1
strh r3, [r1, r2]
- mov pc, lr
+ RET
+END(a2x_bs_w_2)
#endif
-ENTRY(a2x_bs_w_4)
+ENTRY_NP(a2x_bs_w_4_swap)
+ BSWAP32(r3, r3, r0)
+ENTRY_NP(a2x_bs_w_4)
str r3, [r1, r2, lsl #1]
- mov pc, lr
+ RET
+END(a2x_bs_w_4)
/*
* bus_space_write_multi_[124](void *cookie, bus_space_handle_t handle,
* bus_size_t offset, uint{8,16,32}_t *data, bus_size_t count);
*/
-ENTRY(a2x_bs_wm_1)
+ENTRY_NP(a2x_bs_wm_1)
lsl r2, r2, #1
b generic_bs_wm_1
+END(a2x_bs_wm_1)
#if (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
-ENTRY(a2x_bs_wm_2)
+ENTRY_NP(a2x_bs_wm_2)
lsl r2, r2, #1
b generic_armv4_bs_wm_2
+END(a2x_bs_wm_2)
+
+ENTRY_NP(a2x_bs_wm_2_swap)
+ lsl r2, r2, #1
+ b generic_armv4_bs_wm_2_swap
+END(a2x_bs_wm_2_swap)
#endif
-ENTRY(a2x_bs_wm_4)
+ENTRY_NP(a2x_bs_wm_4)
lsl r2, r2, #1
b generic_bs_wm_4
+END(a2x_bs_wm_1)
+
+ENTRY_NP(a2x_bs_wm_4_swap)
+ lsl r2, r2, #1
+ b generic_bs_wm_4_swap
+END(a2x_bs_wm_4_swap)
diff -r 240c1d5dcce0 -r c591d155bc2f sys/arch/arm/arm/bus_space_a4x.S
--- a/sys/arch/arm/arm/bus_space_a4x.S Sun Jul 15 20:44:20 2012 +0000
+++ b/sys/arch/arm/arm/bus_space_a4x.S Sun Jul 15 20:48:53 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space_a4x.S,v 1.1 2012/06/06 20:21:43 skrll Exp $ */
+/* $NetBSD: bus_space_a4x.S,v 1.2 2012/07/15 20:48:53 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,84 +29,134 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <machine/asm.h>
-#include <machine/cpu.h>
+#include <arm/asm.h>
+#include <arm/cpu.h>
+#include <arm/byte_swap.h>
-RCSID("$NetBSD: bus_space_a4x.S,v 1.1 2012/06/06 20:21:43 skrll Exp $")
+RCSID("$NetBSD: bus_space_a4x.S,v 1.2 2012/07/15 20:48:53 matt Exp $")
/*
* bus_space_read_[124](void *cookie, bus_space_handle_t handle,
* bus_size_t offset);
*/
-ENTRY(a4x_bs_r_1)
+ENTRY_NP(a4x_bs_r_1)
ldrb r0, [r1, r2, lsl #2]
- mov pc, lr
+ RET
+END(a4x_bs_r_1)
#if (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
-ENTRY(a4x_bs_r_2)
+ENTRY_NP(a4x_bs_r_2)
+ lsl r2, r2, #2
+ ldrh r0, [r1, r2]
+ RET
+END(a4x_bs_r_2)
+
+ENTRY_NP(a4x_bs_r_2_swap)
lsl r2, r2, #2
ldrh r0, [r1, r2]
- mov pc, lr
+ BSWAP16(r0, r0, r1)
+ RET
+END(a4x_bs_r_2_swap)
#endif
-ENTRY(a4x_bs_r_4)
+ENTRY_NP(a4x_bs_r_4)
ldr r0, [r1, r2, lsl #2]
- mov pc, lr
+ RET
+END(a4x_bs_r_4)
+
+ENTRY_NP(a4x_bs_r_4_swap)
+ ldr r0, [r1, r2, lsl #2]
+ BSWAP32(r0, r0, r1)
+ RET
+END(a4x_bs_r_4_swap)
/*
* bus_space_read_multi_[124](void *cookie, bus_space_handle_t handle,
* bus_size_t offset, uint{8,16,32}_t *data, bus_size_t count);
*/
-ENTRY(a4x_bs_rm_1)
+ENTRY_NP(a4x_bs_rm_1)
lsl r2, r2, #2
b generic_bs_rm_1
+END(a4x_bs_rm_1)
#if (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
-ENTRY(a4x_bs_rm_2)
+ENTRY_NP(a4x_bs_rm_2)
lsl r2, r2, #2
b generic_armv4_bs_rm_2
+END(a4x_bs_rm_2)
+
+ENTRY_NP(a4x_bs_rm_2_swap)
+ lsl r2, r2, #2
+ b generic_armv4_bs_rm_2_swap
+END(a4x_bs_rm_2_swap)
#endif
-ENTRY(a4x_bs_rm_4)
+ENTRY_NP(a4x_bs_rm_4)
lsl r2, r2, #2
b generic_bs_rm_4
+END(a4x_bs_rm_4)
+
+ENTRY_NP(a4x_bs_rm_4_swap)
+ lsl r2, r2, #2
+ b generic_bs_rm_4_swap
+END(a4x_bs_rm_4_swap)
/*
* bus_space_write_[124](void *cookie, bus_space_handle_t handle,
* bus_size_t offset, uint{8,16,32}_t value);
*/
-ENTRY(a4x_bs_w_1)
+ENTRY_NP(a4x_bs_w_1)
strb r3, [r1, r2, lsl #2]
- mov pc, lr
+ RET
+END(a4x_bs_w_1)
#if (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
-ENTRY(a4x_bs_w_2)
+ENTRY_NP(a4x_bs_w_2_swap)
+ BSWAP16(r3, r3, r0)
+ENTRY_NP(a4x_bs_w_2)
lsl r2, r2, #2
strh r3, [r1, r2]
- mov pc, lr
+ RET
+END(a4x_bs_w_2)
#endif
-ENTRY(a4x_bs_w_4)
+ENTRY_NP(a4x_bs_w_4_swap)
+ BSWAP32(r3, r3, r0)
+ENTRY_NP(a4x_bs_w_4)
str r3, [r1, r2, lsl #2]
- mov pc, lr
+ RET
+END(a4x_bs_w_4)
/*
* bus_space_write_multi_[124](void *cookie, bus_space_handle_t handle,
* bus_size_t offset, uint{8,16,32}_t *data, bus_size_t count);
*/
Home |
Main Index |
Thread Index |
Old Index