@@ -52,8 +52,13 @@ void Machine::setup_call(tinykvm_x86regs& regs,
5252 regs = {};
5353 /* Set IOPL=3 to allow I/O instructions in usermode */
5454 regs.rflags = 2 | (3 << 12 );
55- regs.r15 = addr;
56- regs.rip = this ->entry_address ();
55+ if (this ->m_just_reset ) {
56+ this ->m_just_reset = false ;
57+ regs.r15 = addr;
58+ regs.rip = this ->entry_address ();
59+ } else {
60+ regs.rip = addr;
61+ }
5762 regs.rsp = rsp;
5863 [[maybe_unused]] unsigned iargs = 0 ;
5964 ([&] {
@@ -142,29 +147,6 @@ void Machine::timed_vmcall_stack(uint64_t addr, uint64_t stk, float timeout, Arg
142147 this ->run (timeout);
143148}
144149
145- template <typename ... Args> inline constexpr
146- void Machine::timed_reentry (uint64_t addr, float timeout, Args&&... args)
147- {
148- auto & regs = vcpu.registers ();
149- this ->setup_call (regs, addr,
150- this ->stack_address (), std::forward<Args> (args)...);
151- // / This may jump directly to the guest function if DPL=3
152- regs.rip = this ->reentry_address ();
153- vcpu.set_registers (regs);
154- this ->run (timeout);
155- }
156-
157- template <typename ... Args> inline constexpr
158- void Machine::timed_reentry_stack (uint64_t addr, uint64_t stk, float timeout, Args&&... args)
159- {
160- auto & regs = vcpu.registers ();
161- this ->setup_call (regs, addr, stk, std::forward<Args> (args)...);
162- // / This may jump directly to the guest function if DPL=3
163- regs.rip = this ->reentry_address ();
164- vcpu.set_registers (regs);
165- this ->run (timeout);
166- }
167-
168150inline uint64_t Machine::stack_push (__u64& sp, const std::string& string)
169151{
170152 return stack_push (sp, string.data (), string.size ()+1 ); /* zero */
0 commit comments