1
0
Fork 0
forked from len0rd/rockbox

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>
This commit is contained in:
Amaury Pouly 2012-04-02 15:20:02 +02:00
parent f33330c0ff
commit d4674ed3b7
4 changed files with 181 additions and 6 deletions

View file

@ -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)