map memory regions accesses to own implementation


I want to use cling (based on clang) to run parts of a bare-metal
software which is

written for an embedded platform. The code uses pointers

of structs to access different device registers at physical addresses


struct reg_map {

int control;

int status;

} *regs = 0xF0000000;

regs->control = r_reg->status + 2;

I want to emulate the external devices by virtual devices.

This would mean I need to implement my own behavior when

the software wants to transfer data to/from the dedicated memory regions.

Can I implement with LLVM this kind of mechanism ?

What would be the LLVM code parts I have to look to ?

Thanks for any hint !