jeudi 23 janvier 2020

Inject a memory exception by accessing forbidden memory location

I want to test a exception handler function that I have written for an embedded system and want to write a test code that injects an access to memory that forbidden.

void Test_Mem_exception
{
__asm(
"LDR R0, =0xA0100000\n\t"
"MOV R1, 0x77777777\n\t"
"STR R1, [R0,#0]"
);

This is the code I want to write that access memory location at 0xA010000. Somehow this does not seem a generic test code to me. Is there a standard way of writing such test codes in C or C++. By Generic I mean a code that is independent of the memory map of the system that it runs on.

Aucun commentaire:

Enregistrer un commentaire