mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 20:05:54 +00:00
parent
155621767a
commit
997f5e8e27
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/printf.h>
|
||||
#include <base/log.h>
|
||||
#include <util/string.h>
|
||||
|
||||
/* core includes */
|
||||
@ -159,33 +159,65 @@ int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no)
|
||||
|
||||
void Platform_thread::pause()
|
||||
{
|
||||
PDBG("not implemented");
|
||||
int const ret = seL4_TCB_Suspend(_info.tcb_sel.value());
|
||||
if (ret != seL4_NoError)
|
||||
error("pausing thread failed with ", ret);
|
||||
}
|
||||
|
||||
|
||||
void Platform_thread::resume()
|
||||
{
|
||||
PDBG("not implemented");
|
||||
int const ret = seL4_TCB_Resume(_info.tcb_sel.value());
|
||||
if (ret != seL4_NoError)
|
||||
error("pausing thread failed with ", ret);
|
||||
}
|
||||
|
||||
|
||||
void Platform_thread::state(Thread_state s)
|
||||
{
|
||||
PDBG("not implemented");
|
||||
warning(__PRETTY_FUNCTION__, " not implemented");
|
||||
throw Cpu_thread::State_access_failed();
|
||||
}
|
||||
|
||||
|
||||
Thread_state Platform_thread::state()
|
||||
{
|
||||
PDBG("not implemented");
|
||||
throw Cpu_thread::State_access_failed();
|
||||
seL4_TCB const thread = _info.tcb_sel.value();
|
||||
seL4_Bool const suspend_source = false;
|
||||
seL4_Uint8 const arch_flags = 0;
|
||||
seL4_UserContext registers;
|
||||
seL4_Word const register_count = sizeof(registers) / sizeof(registers.eip);
|
||||
|
||||
int const ret = seL4_TCB_ReadRegisters(thread, suspend_source, arch_flags,
|
||||
register_count, ®isters);
|
||||
if (ret != seL4_NoError) {
|
||||
error("reading thread state ", ret);
|
||||
throw Cpu_thread::State_access_failed();
|
||||
}
|
||||
|
||||
Thread_state state;
|
||||
state.ip = registers.eip;
|
||||
state.sp = registers.esp;
|
||||
state.edi = registers.edi;
|
||||
state.esi = registers.esi;
|
||||
state.ebp = registers.ebp;
|
||||
state.ebx = registers.ebx;
|
||||
state.edx = registers.edx;
|
||||
state.ecx = registers.ecx;
|
||||
state.eax = registers.eax;
|
||||
state.gs = registers.gs;
|
||||
state.fs = registers.fs;
|
||||
state.eflags = registers.eflags;
|
||||
state.trapno = 0; /* XXX detect/track if in exception and report here */
|
||||
/* registers.tls_base unused */
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
void Platform_thread::cancel_blocking()
|
||||
{
|
||||
PDBG("not implemented");
|
||||
warning(__PRETTY_FUNCTION__, " not implemented");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user