Extend base-hw specific vm-session (fix #738)

Introduce pause syscall for VM objects, and extend the vm-session interface
to support it.
This commit is contained in:
Stefan Kalkowski
2013-05-08 15:22:28 +02:00
committed by Norman Feske
parent d8f0392c9f
commit ae291b557d
6 changed files with 61 additions and 7 deletions

View File

@ -67,6 +67,7 @@ namespace Genode {
Dataspace_capability cpu_state(void) { return _ds_cap; }
void exception_handler(Signal_context_capability handler);
void run(void);
void pause(void);
};
}

View File

@ -691,8 +691,13 @@ namespace Kernel
Signal_context * const context)
: _state(state), _context(context) { }
void run() {
cpu_scheduler()->insert(this); }
/**************************
** Vm_session interface **
**************************/
void run() { cpu_scheduler()->insert(this); }
void pause() { cpu_scheduler()->remove(this); }
/**********************
@ -1300,6 +1305,23 @@ namespace Kernel
}
/**
* Do specific syscall for 'user', for details see 'syscall.h'
*/
void do_pause_vm(Thread * const user)
{
/* check permissions */
assert(user->pd_id() == core_id());
/* get targeted vm via its id */
Vm * const vm = Vm::pool()->object(user->user_arg_1());
assert(vm);
/* pause targeted vm */
vm->pause();
}
/**
* Handle a syscall request
*
@ -1344,6 +1366,7 @@ namespace Kernel
/* 28 */ do_resume_faulter,
/* 29 */ do_ack_signal,
/* 30 */ do_kill_signal_context,
/* 31 */ do_pause_vm,
};
enum { MAX_SYSCALL = sizeof(handle_sysc)/sizeof(handle_sysc[0]) - 1 };

View File

@ -44,6 +44,16 @@ void Vm_session_component::run(void)
}
void Vm_session_component::pause(void)
{
if (!_vm_id) {
PWRN("No exception handler registered!");
return;
}
Kernel::pause_vm(_vm_id);
}
Vm_session_component::Vm_session_component(Rpc_entrypoint *ds_ep,
Range_allocator *ram_alloc,
size_t ram_quota)