[vbox-dev] Creating Handler Pointers in R0 and RC contexts

Adam Pridgen adam.pridgen at thecoverofnight.com
Mon Oct 29 16:36:55 PDT 2012


I know my questions have been alittle complex or non-sensical, but
hopefully this one makes more sense sense.  I am attempting to
register a write access callback with PGMR3HandlerPhysicalRegister.
Currently, my R0 handler function's symbol cannot be found by the
PDMR3LdrGetSymbolR0, and I get the following assertion error:

PGMR3ChangeMode: Guest mode: Protected -> AMD64
VBox.Main.Foo: SetRCPhysHandler, The address of FooRCPhysWriteHandler:
HWR0: 0020:00348FE9 ESP=00183C74 IF=0 IOPL=0 CR0=80000011 CR4=220 EFER=500
PGMR3ChangeMode: Guest mode: AMD64 -> Protected
HWR0: 0020:00348FBE ESP=00183CBC IF=0 IOPL=0 CR0=11 CR4=220 EFER=100

!!Assertion Failed!!
Expression: RT_SUCCESS_NP(rc)
Location  : /research_data/code/svn/vbox/src/VBox/VMM/VMMR3/PDMLdr.cpp(808)
int PDMR3LdrGetSymbolR0(PVM, const char*, const char*, PRTR0PTR)
PGMR3ChangeMode: Guest mode: Protected -> Real
Couldn't find symbol 'FooR0PhysWriteHandler' in module 'VMMR0.r0'
HMR3PagingModeChanged missed Protected->Real transition (prev Real)
HWR0: 0050:000008A0 ESP=0000146A IF=0 IOPL=0 CR0=10 CR4=220 EFER=0

So I was wondering two things:

1) How do I include my handlers (e.g. FooR0PhysWriteHandler or
FooRCPhysWriteHandler) so that they can be found by
PDMR3LdrGetSymbolR0/PDMR3LdrGetSymbolRC at runtime?  Do I need to
place the source files somewhere in the VMMR0 directory?  Do I need to
export symbols somewhere?

2) How do I copy my user/R3 objects or addresses into the HMA?
Specifically, I am trying to create structures that can be accessed
from an R3 context outside of the hypervisor and from within the
hypervisor when my handlers are called.

Right now, I am using the pgmR3PhysRomWriteHandler in
src/VBox/VMM/VMMR3/PGMPhys.cpp as an example handler function, but I
am not sure how it makes itself accessible in the HMA.  Also for
handler registration, I am  using pgmR3PhysRomRegister in the same
file as an example of how to register PFNPGMR*PHYSHANDLERs.

Thanks in advance for any help or feedback,

-- Adam

More information about the vbox-dev mailing list