NVlabs / NVBit

220 stars 20 forks source link

Can constant value be read from nvbit? #35

Open leiwen83 opened 3 years ago

leiwen83 commented 3 years ago

Hi,

I see we could use nvbit could r/w register, but I wonder whether we could do global or constant memory reading inside the injection function?

Thx, Lei

ovilla commented 3 years ago

Hi,

At this point we don't have that capability, but you can do the equivalent (although with a less powerful mechanism) by passing constant values as arguments to the injected function using:

/* Add uint32_t argument to last injected call, constant bank value at c[bankid][bankoffset] */
void nvbit_add_call_arg_cbank_val(const Instr* instr, int bankid, int bankoffset, bool is_variadic_arg = false);

We agree this mechanism is less powerful as it could require passing a lot of arguments when reading many constant bank values, so a new function (similar to those that read/write registers) makes a lot of sense. We will consider that in the next releases. Thanks,

--Oreste