mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-06 05:41:37 +00:00
[LibOS] Add getters and setters for shim context's syscall number
This commit is contained in:
committed by
Michał Kowalczyk
parent
20fe60dc46
commit
c9cd84dfa9
@@ -32,4 +32,12 @@ static inline void shim_regs_set_sp(struct shim_regs* sr, uint64_t sp) {
|
||||
sr->rsp = sp;
|
||||
}
|
||||
|
||||
static inline uint64_t shim_regs_get_syscallnr(struct shim_regs* sr) {
|
||||
return sr->orig_rax;
|
||||
}
|
||||
|
||||
static inline void shim_regs_set_syscallnr(struct shim_regs* sr, uint64_t sc_num) {
|
||||
sr->orig_rax = sc_num;
|
||||
}
|
||||
|
||||
#endif /* _SHIM_TCB_ARCH_H_ */
|
||||
|
||||
@@ -24,6 +24,14 @@ static inline void shim_context_set_sp(struct shim_context* sc, unsigned long sp
|
||||
shim_regs_set_sp(sc->regs, sp);
|
||||
}
|
||||
|
||||
static inline unsigned long shim_context_get_syscallnr(struct shim_context* sc) {
|
||||
return shim_regs_get_syscallnr(sc->regs);
|
||||
}
|
||||
|
||||
static inline void shim_context_set_syscallnr(struct shim_context* sc, unsigned long sc_num) {
|
||||
shim_regs_set_syscallnr(sc->regs, sc_num);
|
||||
}
|
||||
|
||||
struct debug_buf;
|
||||
|
||||
typedef struct shim_tcb shim_tcb_t;
|
||||
|
||||
@@ -175,7 +175,7 @@ void __store_context (shim_tcb_t * tcb, PAL_CONTEXT * pal_context,
|
||||
{
|
||||
ucontext_t * context = &signal->context;
|
||||
|
||||
if (tcb && tcb->context.regs && tcb->context.regs->orig_rax) {
|
||||
if (tcb && tcb->context.regs && shim_context_get_syscallnr(&tcb->context)) {
|
||||
struct shim_context * ct = &tcb->context;
|
||||
|
||||
if (ct->regs) {
|
||||
@@ -741,10 +741,10 @@ __handle_one_signal(shim_tcb_t* tcb, int sig, struct shim_signal* signal) {
|
||||
|
||||
struct shim_context * context = NULL;
|
||||
|
||||
if (tcb->context.regs && tcb->context.regs->orig_rax) {
|
||||
if (tcb->context.regs && shim_context_get_syscallnr(&tcb->context)) {
|
||||
context = __alloca(sizeof(struct shim_context));
|
||||
memcpy(context, &tcb->context, sizeof(struct shim_context));
|
||||
tcb->context.regs->orig_rax = 0;
|
||||
shim_context_set_syscallnr(&tcb->context, 0);
|
||||
tcb->context.next = context;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user