diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2014-11-18 23:27:26 +0100 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2014-11-18 23:30:44 +0100 |
commit | cd04a5f1aadc8e2ec4e787f5ba4cc8c38a579314 (patch) | |
tree | 63e9f095451aeba0139152c8742d0af67413690a /utils/hwstub/stub/asm/mips/atomic_rw.S | |
parent | 794169a18f644eea32de20b26646381137545e2d (diff) | |
download | rockbox-cd04a5f1aadc8e2ec4e787f5ba4cc8c38a579314.tar.gz rockbox-cd04a5f1aadc8e2ec4e787f5ba4cc8c38a579314.zip |
hwstub/qeditor: add support for atomic read/writes
The current code assumed that READ/WRITE would produce atomic read/writes for
8/16/32-bit words, which in turned put assumption on the memcpy function.
Since some memcpy implementation do not always guarantee such strong assumption,
introduce two new operation READ/WRITE_ATOMIC which provide the necessary
tools to do correct read and write to register in a single memory access.
Change-Id: I37451bd5057bb0dcaf5a800d8aef8791c792a090
Diffstat (limited to 'utils/hwstub/stub/asm/mips/atomic_rw.S')
-rw-r--r-- | utils/hwstub/stub/asm/mips/atomic_rw.S | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/utils/hwstub/stub/asm/mips/atomic_rw.S b/utils/hwstub/stub/asm/mips/atomic_rw.S new file mode 100644 index 0000000000..47c4213a5d --- /dev/null +++ b/utils/hwstub/stub/asm/mips/atomic_rw.S | |||
@@ -0,0 +1,61 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2014 by Marcin Bukat | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | #include "mips.h" | ||
21 | |||
22 | .set noreorder | ||
23 | .section .text, "ax", %progbits | ||
24 | .global target_read8 | ||
25 | .type target_read8, %function | ||
26 | .global target_read16 | ||
27 | .type target_read16, %function | ||
28 | .global target_read32 | ||
29 | .type target_read32, %function | ||
30 | .global target_write8 | ||
31 | .type target_write8, %function | ||
32 | .global target_write16 | ||
33 | .type target_write16, %function | ||
34 | .global target_write32 | ||
35 | .type target_write32, %function | ||
36 | |||
37 | target_read8: | ||
38 | jr ra | ||
39 | lbu v0, 0(a0) | ||
40 | |||
41 | target_read16: | ||
42 | jr ra | ||
43 | lhu v0, 0(a0) | ||
44 | |||
45 | target_read32: | ||
46 | jr ra | ||
47 | lw v0, 0(a0) | ||
48 | |||
49 | target_write8: | ||
50 | jr ra | ||
51 | sb a1, 0(a0) | ||
52 | |||
53 | target_write16: | ||
54 | jr ra | ||
55 | sh a1, 0(a0) | ||
56 | |||
57 | target_write32: | ||
58 | jr ra | ||
59 | sw a1, 0(a0) | ||
60 | |||
61 | .set reorder | ||