3 #include "entry_frame.h"
5 #include "member_offs.h"
18 Continuation() : _ip(~0UL) {}
20 typedef Return_frame User_return_frame;
23 { return _ip != ~0UL; }
25 Address ip() const { return _ip; }
26 void ip(Address ip) { _ip = ip; }
28 Mword flags(Return_frame const *) const { return _flags; }
29 void flags(Return_frame *, Mword flags) { _flags = flags; }
31 Mword sp(Return_frame const *o) const { return o->sp(); }
32 void sp(Return_frame *o, Mword sp) { o->sp(sp); }
34 void save(Return_frame const *regs)
37 _flags = regs->flags();
38 // LOG_MSG_3VAL(current(), "sav", _ip, _flags, 0);
41 void activate(Return_frame *regs, void *cont_func)
44 regs->ip(Mword(cont_func));
45 // interrupts must stay off, do not singlestep in kernel code
46 regs->flags(regs->flags() & ~(EFLAGS_TF | EFLAGS_IF));
47 regs->cs(Gdt::gdt_code_kernel | Gdt::Selector_kernel);
48 // LOG_MSG_3VAL(current(), "act", regs->ip(), regs->flags(), regs->cs());
51 void set(Return_frame *dst, User_return_frame const *src)
54 _flags = src->flags();
58 void get(User_return_frame *dst, Return_frame const *src) const
65 void clear() { _ip = ~0UL; }
67 void restore(Return_frame *regs)
69 // LOG_MSG_3VAL(current(), "rst", _ip, _flags, 0);
72 regs->cs(Gdt::gdt_code_user | Gdt::Selector_user);