diff options
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r-- | src/kernel/syscalls.c | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 42f548e..e94f886 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -488,43 +488,12 @@ long _sys_duplex(hid_t from, hid_t to, int flags) { } void _sys_intr_return(struct intr_data __user *intr, int flags) { - CpuRegs *r = &proc_cur->regs; struct intr_data d; if (flags != 0 || pcpy_from(proc_cur, &d, intr, sizeof(d)) < sizeof(d)) { proc_kill(proc_cur, EFAULT); proc_switch_any(); /* doesn't return */ } - r->r15 = d.r15; - r->r14 = d.r14; - r->r13 = d.r13; - r->r12 = d.r12; - r->r11 = d.r11; - r->r10 = d.r10; - r->r9 = d.r9; - r->r8 = d.r8; - r->rdi = d.rdi; - r->rsi = d.rsi; - r->rbp = d.rbp; - r->rsp = d.rsp; - r->rbx = d.rbx; - r->rdx = d.rdx; - r->rcx = d.rcx; - r->rax = d.rax; - r->rip = d.rip; - /* preserved flags: (see intel vol 1 3.4.3.) - * 1<<0 = CF, carry flag - * 1<<2 = PF, parity flag - * 1<<4 = AC, auxilary carry - * 1<<6 = ZF, zero flag - * 1<<7 = SF, sign flag - * 1<<11 = OF, overflow flag - * 1<<10 = DF, direction flag - */ - static_assert( - ((1<<0) | (1<<2) | (1<<4) | (1<<6) | (1<<7) | (1<<10) | (1<<11)) - == 0xCD5 - ); - r->flags = (d.flags & 0xCD5) | (r->flags & ~0xCD5); + regs_safecopy(&proc_cur->regs, &d.reg); } long _sys_execbuf(void __user *ubuf, size_t len) { |