On 14/09/2016 22:59, Brijesh Singh wrote:
> I will look into hooking up the callback into ROM read/write ops. I was
> thinking about adding a new argument in
> cpu_physical_memory_write_rom_internal()
> 
> void cpu_physical_memory_write_rom(AddressSpace *as, hwaddr addr,
>                                    const uint8_t *buf, int len,
>                                    WriteCB *cb)
> {
>    ....
>    ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
> 
>    if (cb)
>      cb(ptr, buf, len)
>    else
>      memcpy(ptr, buf, len)
> ....
> 
> }
> 
> In case of SEV, we pass a CB function pointer which calls SEV API's to
> encrypt memory. Does this make sense?

I think a global as you have it in this series is just fine---just don't
hook it into address_space_read and address_space_write.

Paolo

Reply via email to