diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2012-04-02 15:20:02 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2012-04-06 13:48:09 +0200 |
commit | d4674ed3b7cd98fab499d0d94d364bdb060df3ff (patch) | |
tree | 9c698c566e071091e08acdb5911be66c327f726c /lib/unwarminder/backtrace.c | |
parent | f33330c0ff90adad8855250877a4a3d0a407bba4 (diff) | |
download | rockbox-d4674ed3b7cd98fab499d0d94d364bdb060df3ff.tar.gz rockbox-d4674ed3b7cd98fab499d0d94d364bdb060df3ff.zip |
arm: implement safe reads by intercepting the data abort handler.
Implement functions to read from a memory location and indicate
failure in case this is not possible. Since we do not have a MMU,
intercept the data abort handler and simply return when the abort
comes from the safe read routines.
Change-Id: I08f2e59898dcac893319a8150d4cf626f3adabbd
Reviewed-on: http://gerrit.rockbox.org/207
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
Diffstat (limited to 'lib/unwarminder/backtrace.c')
-rw-r--r-- | lib/unwarminder/backtrace.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/unwarminder/backtrace.c b/lib/unwarminder/backtrace.c index 4e1609137c..294b7f66f4 100644 --- a/lib/unwarminder/backtrace.c +++ b/lib/unwarminder/backtrace.c | |||
@@ -23,6 +23,7 @@ | |||
23 | ***************************************************************************/ | 23 | ***************************************************************************/ |
24 | 24 | ||
25 | #include "backtrace.h" | 25 | #include "backtrace.h" |
26 | #include "safe_read.h" | ||
26 | 27 | ||
27 | /*************************************************************************** | 28 | /*************************************************************************** |
28 | * Prototypes | 29 | * Prototypes |
@@ -86,20 +87,17 @@ static Boolean CliReport(void *data, Int32 address) | |||
86 | 87 | ||
87 | static Boolean CliReadW(const Int32 a, Int32 *v) | 88 | static Boolean CliReadW(const Int32 a, Int32 *v) |
88 | { | 89 | { |
89 | *v = *(Int32 *)a; | 90 | return safe_read32((uint32_t *)a, (uint32_t *)v); |
90 | return TRUE; | ||
91 | } | 91 | } |
92 | 92 | ||
93 | static Boolean CliReadH(const Int32 a, Int16 *v) | 93 | static Boolean CliReadH(const Int32 a, Int16 *v) |
94 | { | 94 | { |
95 | *v = *(Int16 *)a; | 95 | return safe_read16((void *)a, (uint16_t *)v); |
96 | return TRUE; | ||
97 | } | 96 | } |
98 | 97 | ||
99 | static Boolean CliReadB(const Int32 a, Int8 *v) | 98 | static Boolean CliReadB(const Int32 a, Int8 *v) |
100 | { | 99 | { |
101 | *v = *(Int8 *)a; | 100 | return safe_read8((void *)a, (uint8_t *)v); |
102 | return TRUE; | ||
103 | } | 101 | } |
104 | 102 | ||
105 | Boolean CliInvalidateW(const Int32 a) | 103 | Boolean CliInvalidateW(const Int32 a) |