Thursday, May 22, 2014

Aborts in Windows CE

This article shows how to generate Prefetch Abort, Data Abort and Undefined Exception in Windows CE 6.0 R3

Data Abort

To generate the below exception a NULL pointer is written with some value

unsigned int *pu32Ptr = 23;

Exception 'Data Abort' (4): Thread-Id=08df001a(pth=847b8000), Proc-Id=08de001a(pprc=848059cc) 'Test.exe', VM-active=08de001a(pprc=848059cc) 'Test.exe'
PC=00011020(Test.exe+0x00001020) RA=000110f4(Test.exe+0x000010f4) SP=0002fbb4, BVA=00011040

Prefetch Abort

When a function pointer is assigned with a NULL Pointer Prefetch Abort is generated. This is learned after reading the following blog:

Exception 'Prefetch Abort' (3): Thread-Id=096d005e(pth=847b8000), Proc-Id=096b005e(pprc=848059cc) 'Test_NullFP.exe', VM-active=096b005e(pprc=848059cc) 'Test_NullFP.exe'
PC=00000000(???+0x00000000) RA=0001103c(Test_NullFP.exe+0x0000103c) SP=0002fba4, BVA=00000000

Undefined Instruction

When a function pointer is assigned with a variable's address the below exception is generated
Exception 'Undefined Instruction' (1): Thread-Id=09be0032(pth=8a86e0ac), Proc-Id=09bd0032(pprc=848059cc) 'Test.exe', VM-active=09bd0032(pprc=848059cc) 'Test.exe'
PC=0002fd14(???+0x0002fd14) RA=00011034(Test.exe+0x00001034) SP=0002fbb0, BVA=00000000