<div dir="ltr"><div>Ok, thanks about the hint: modify VBoxManage to write a way for change VM struct fields...but i can't find a way. I understand that every change is made by COMSETTER, but what about this function? There's no documentation about this, i tried to search a similar situation in VBoxManage, but i can't.<br>
</div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-06-13 19:44 GMT+02:00 Klaus Espenlaub <span dir="ltr"><<a href="mailto:klaus.espenlaub@oracle.com" target="_blank">klaus.espenlaub@oracle.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Johannes,<br>
<div class=""><br>
On 11.06.2014 14:38, Johannes DeWitt wrote:<br>
> Thanks you for your perfect explanation.<br>
> I wanted to use stdio.h because i was looking for a way to read some<br>
> values from outside, while a virtual machine is in runtime; so my idea<br>
> was to use the fopen function to read values from a normal file (txt or<br>
> something).<br>
> But now i understand why i can't use stdio.h (kernel mode etc).<br>
><br>
> So, in VMMAll/ is it IMPOSSIBILE to read a value from another file? I<br>
> read your answer, i understand that a possibile way is from tm struct,<br>
> but if i need to use a value that can change in rumtime? My achievement<br>
> is to read (in VMMAll/ ) value from an external file, and read this<br>
> value more times, and this value can change during the execution.<br>
<br>
</div>I'm not following... you talked about modifying VMMAll/TMAll.cpp, which<br>
is about timekeeping for the VM - and if you think you can read a file<br>
(kernel or not) in such a context without seriously messing up the time<br>
behavior then the understatement I can find is "optimist" :)<br>
<br>
In any case, accessing a file from kernel mode is not portable in any<br>
way, and thus I don't even want to think about it.<br>
<div class=""><br>
> For example, i need to execute a part code ONLY when i want, so my idea<br>
> was to write ( in a VMMALL/ .cpp file) code like this:<br>
><br>
> x= get value from external file MYVALUE (xml or somehting) (in this<br>
> file, the value is 0)<br>
> if (x) { do something;}<br>
><br>
> every time virtualbox execute this code, nothing happend.<br>
><br>
> after a while, from extern i change the value in the file MYVALUE (from<br>
> 0 to 1)<br>
> Now, when virtualbox execute the code above, it enters in the {do<br>
> something;}<br>
><br>
> I hope you can understand my example.<br>
<br>
</div>I think I do... it's super abstract and I can't be sure.<br>
<br>
The proposal in my previous mail still applies: put variable x in the<br>
VM/... structure, and add a way to tweak it from userland, e.g. with<br>
"VBoxManage debugvm" (something inspired by "VBoxManage debugvm<br>
injectnmi" maybe, or by hacking the handling of "VBoxManage debugvm<br>
info", as that'd have already parameters, and you can register such<br>
internal info handlers with DBGFR3InfoRegisterInternal - see<br>
VMMR3/TM.cpp - which of course isn't meant to change anything<br>
significant related to the VM etc. structures, but I can't see any<br>
police :) ). The machine debugger is where I would add such hacks, as<br>
the rest of the code has more clearly defined interfaces which<br>
intentionally aren't as easily abusable.<br>
<br>
I know this is more than 2 minutes of work, and I humbly ask for<br>
apologies that we don't have the "do what I want" feature implemented (yet).<br>
<br>
Klaus<br>
<div class=""><br>
> 2014-06-11 13:51 GMT+02:00 Klaus Espenlaub <<a href="mailto:klaus.espenlaub@oracle.com">klaus.espenlaub@oracle.com</a><br>
</div>> <mailto:<a href="mailto:klaus.espenlaub@oracle.com">klaus.espenlaub@oracle.com</a>>>:<br>
<div><div class="h5">><br>
>     On 09.06.2014 12:51, Johannes DeWitt wrote:<br>
>      > I tried to use this function in VMM/VMMAll/TMAll.cpp, but when i<br>
>      > compile, i receive this: ‘CFGMR3GetRoot’ was not declared in this<br>
>     scope<br>
>      > I added #include <VBox/vmm/cfgm.h, but atill have this error.<br>
><br>
>     TMAll.cpp is code which is compiled several times, once for the<br>
>     userland, once for kernel mode etc etc., which shares data. In this code<br>
>     it's impossible to deal with CFGM settings. Everything must be already<br>
>     stored in the VM or VMCPU structure or somewhere reachable from there<br>
>     while in userland. See VMMR3/TM.cpp how the TM settings are handled (it<br>
>     already uses CFGM), your needs probably can be covered by adding a few<br>
>     such settings.<br>
><br>
>     Note that all extradata keys (see documentation of VBoxManage extradata)<br>
>     starting with VBoxInternal/ are stored in CFGM automatically, i.e. you<br>
>     need to set VBoxInternal/TM/foo to some value in order to have it<br>
>     available in VMMR3/TM.cpp.<br>
><br>
>      > Any ideas? I tried also to include <stdio.h> for others achievements,<br>
>      > but i recieve an error too (however in others .cpp files i can use<br>
>      > stdio.h without any problems): i don't understand why<br>
><br>
>     See above. One can't use the normal stdio.h functionality from kernel. A<br>
>     subset of the Runtime functionality is available, and I don't think you<br>
>     need anything which isn't already used by VMMAll/*.cpp.<br>
><br>
>     Klaus<br>
><br>
>      > 2014-06-06 14:51 GMT+02:00 Frank Mehnert<br>
>     <<a href="mailto:frank.mehnert@oracle.com">frank.mehnert@oracle.com</a> <mailto:<a href="mailto:frank.mehnert@oracle.com">frank.mehnert@oracle.com</a>><br>
</div></div>>      > <mailto:<a href="mailto:frank.mehnert@oracle.com">frank.mehnert@oracle.com</a> <mailto:<a href="mailto:frank.mehnert@oracle.com">frank.mehnert@oracle.com</a>>>>:<br>
<div class="HOEnZb"><div class="h5">>      ><br>
>      >     Johannes,<br>
>      ><br>
>      >     On Friday 06 June 2014 14:46:46 Johannes DeWitt wrote:<br>
>      >      > I, i need to use come IMachine methods in source code. For<br>
>      >     example, if a<br>
>      >      > want to use the GetSettingsFilePath() function (used in<br>
>      >      > tstVBoxAPIXPCOM.cpp) in a cpp file of the source code, for<br>
>      >     example in a cpp<br>
>      >      > file in /src/VBox/VMM/VMMAll/, how can i do it?<br>
>      >      > And which headers files i need to include?<br>
>      ><br>
>      >     that's actually not the intended way to use !VirtualBox. VMM<br>
>     and Main<br>
>      >     are strictly separated, and in particular the IMachine code<br>
>     you are<br>
>      >     talking about lives in VBoxSVC while the VMM code lives in<br>
>     the VBoxSVC<br>
>      >     client (either the VirtualBox process or the VBoxHeadless<br>
>     process).<br>
>      ><br>
>      >     Inside VMM you should always have a pRoot handle,<br>
>      ><br>
>      >        pRoot = CFGMR3GetRoot(pVM);<br>
>      ><br>
>      >     Using this pRoot handle you can access the CFGM tree for that<br>
>     particular<br>
>      >     VM.<br>
>      ><br>
>      >     Kind regards,<br>
>      ><br>
>      >     Frank<br>
<br>
_______________________________________________<br>
vbox-dev mailing list<br>
<a href="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</a><br>
<a href="https://www.virtualbox.org/mailman/listinfo/vbox-dev" target="_blank">https://www.virtualbox.org/mailman/listinfo/vbox-dev</a><br>
</div></div></blockquote></div><br></div>