From d4674ed3b7cd98fab499d0d94d364bdb060df3ff Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Mon, 2 Apr 2012 15:20:02 +0200 Subject: 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 --- lib/unwarminder/backtrace.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/unwarminder/backtrace.c') 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 @@ ***************************************************************************/ #include "backtrace.h" +#include "safe_read.h" /*************************************************************************** * Prototypes @@ -86,20 +87,17 @@ static Boolean CliReport(void *data, Int32 address) static Boolean CliReadW(const Int32 a, Int32 *v) { - *v = *(Int32 *)a; - return TRUE; + return safe_read32((uint32_t *)a, (uint32_t *)v); } static Boolean CliReadH(const Int32 a, Int16 *v) { - *v = *(Int16 *)a; - return TRUE; + return safe_read16((void *)a, (uint16_t *)v); } static Boolean CliReadB(const Int32 a, Int8 *v) { - *v = *(Int8 *)a; - return TRUE; + return safe_read8((void *)a, (uint8_t *)v); } Boolean CliInvalidateW(const Int32 a) -- cgit v1.2.3