IMPLEMENTATION[ia32 || ux]:
-PRIVATE inline
+PROTECTED inline
void FIASCO_NORETURN
-Thread::fast_return_to_user(Mword ip, Mword sp, bool = true)
+Thread::fast_return_to_user(Mword ip, Mword sp)
{
assert_kdb(cpu_lock.test());
assert_kdb(current() == this);
}
IMPLEMENT inline
-Mword
+Mword
Thread::user_sp() const
{ return regs()->sp(); }
Thread::user_sp(Mword sp)
{ regs()->sp(sp); }
-PRIVATE inline
+PROTECTED inline
int
Thread::do_trigger_exception(Entry_frame *r, void *ret_handler)
{
#endif
}
-IMPLEMENTATION[(ia32 || ux) && segments]:
-
-PRIVATE static inline
-void
-Thread::copy_utcb_to_ts_reset_segments(Thread *rcv)
-{ rcv->_gs = rcv->_fs = 0; }
-
-IMPLEMENTATION[(ia32 || ux) && !segments]:
-
-PRIVATE static inline
-void
-Thread::copy_utcb_to_ts_reset_segments(Thread *)
-{}
-
-IMPLEMENTATION[ia32 || ux]:
-
PRIVATE static inline
Return_frame *
Thread::trap_state_to_rf(Trap_state *ts)
return reinterpret_cast<Return_frame*>(im)-1;
}
-PRIVATE static inline NEEDS[Thread::copy_utcb_to_ts_reset_segments,
- Thread::trap_is_privileged,
+PRIVATE static inline NEEDS[Thread::trap_is_privileged,
Thread::trap_state_to_rf]
bool FIASCO_WARN_RESULT
Thread::copy_utcb_to_ts(L4_msg_tag const &tag, Thread *snd, Thread *rcv,
if (EXPECT_FALSE(rcv->exception_triggered()))
{
// triggered exception pending
- Mem::memcpy_mwords (&ts->_gs, snd_utcb->values, s > 12 ? 12 : s);
+ Mem::memcpy_mwords(&ts->_gs, snd_utcb->values, s > 12 ? 12 : s);
if (EXPECT_TRUE(s > 15))
{
Continuation::User_return_frame const *s
else
Mem::memcpy_mwords (&ts->_gs, snd_utcb->values, s > 16 ? 16 : s);
- copy_utcb_to_ts_reset_segments(rcv);
+ // reset segments
+ rcv->_gs = rcv->_fs = 0;
if (tag.transfer_fpu() && (rights & L4_fpage::W))
snd->transfer_fpu(rcv);
IMPLEMENT inline NEEDS[Thread::exception_triggered]
void
Thread::user_ip(Mword ip)
-{
+{
if (exception_triggered())
_exc_cont.ip(ip);
else
PRIVATE inline
int
-Thread::check_trap13_kernel (Trap_state *ts)
+Thread::check_trap13_kernel(Trap_state *ts)
{
- if (EXPECT_FALSE (ts->_trapno == 13 && (ts->_err & 3) == 0))
+ if (EXPECT_FALSE(ts->_trapno == 13 && (ts->_err & 3) == 0))
{
// First check if user loaded a segment register with 0 because the
// resulting exception #13 can be raised from user _and_ kernel. If
// the user tried to load another segment selector, the thread gets
// killed.
// XXX Should we emulate this too? Michael Hohmuth: Yes, we should.
- if (EXPECT_FALSE (!(ts->_ds & 0xffff)))
+ if (EXPECT_FALSE(!(ts->_ds & 0xffff)))
{
- Cpu::set_ds (Gdt::data_segment ());
+ Cpu::set_ds(Gdt::data_segment());
return 0;
}
- if (EXPECT_FALSE (!(ts->_es & 0xffff)))
+ if (EXPECT_FALSE(!(ts->_es & 0xffff)))
{
- Cpu::set_es (Gdt::data_segment ());
+ Cpu::set_es(Gdt::data_segment());
return 0;
}
- if (EXPECT_FALSE (!(ts->_fs & 0xffff)))
+ if (EXPECT_FALSE(!(ts->_fs & 0xffff)))
{
ts->_fs = Utcb_init::utcb_segment();
return 0;
}
- if (EXPECT_FALSE (!(ts->_gs & 0xffff)))
+ if (EXPECT_FALSE(!(ts->_gs & 0xffff)))
{
ts->_gs = Utcb_init::utcb_segment();
return 0;
}
- if (EXPECT_FALSE (ts->_ds & 0xfff8) == Gdt::gdt_code_user)
+ if (EXPECT_FALSE(ts->_ds & 0xfff8) == Gdt::gdt_code_user)
{
WARN("%p eip=%08lx: code selector ds=%04lx",
this, ts->ip(), ts->_ds & 0xffff);
- Cpu::set_ds (Gdt::data_segment ());
+ Cpu::set_ds(Gdt::data_segment());
return 0;
}
- if (EXPECT_FALSE (ts->_ds & 0xfff8) == Gdt::gdt_code_user)
+ if (EXPECT_FALSE(ts->_es & 0xfff8) == Gdt::gdt_code_user)
{
WARN("%p eip=%08lx: code selector es=%04lx",
this, ts->ip(), ts->_es & 0xffff);
- Cpu::set_es (Gdt::data_segment ());
+ Cpu::set_es(Gdt::data_segment());
return 0;
}
- if (EXPECT_FALSE (ts->_ds & 0xfff8) == Gdt::gdt_code_user)
+ if (EXPECT_FALSE(ts->_fs & 0xfff8) == Gdt::gdt_code_user)
{
WARN("%p eip=%08lx: code selector fs=%04lx",
this, ts->ip(), ts->_fs & 0xffff);
ts->_fs = Utcb_init::utcb_segment();
return 0;
}
- if (EXPECT_FALSE (ts->_ds & 0xfff8) == Gdt::gdt_code_user)
+ if (EXPECT_FALSE(ts->_gs & 0xfff8) == Gdt::gdt_code_user)
{
WARN("%p eip=%08lx: code selector gs=%04lx",
this, ts->ip(), ts->_gs & 0xffff);
}
//---------------------------------------------------------------------------
-IMPLEMENTATION [ia32 & segments]:
+IMPLEMENTATION [ia32]:
#include <feature.h>
KIP_KERNEL_FEATURE("segments");
-PRIVATE inline
+PROTECTED inline
bool
Thread::invoke_arch(L4_msg_tag &tag, Utcb *utcb)
{
};
}
-//---------------------------------------------------------------------------
-IMPLEMENTATION [ia32 && !segments]:
-
-PRIVATE inline
-bool
-Thread::invoke_arch(L4_msg_tag &tag, Utcb *utcb)
-{
- (void)tag; (void)utcb;
- return false; // not our business
-}
-
//---------------------------------------------------------------------------
IMPLEMENTATION [ia32 & (debug | kdb)]:
unsigned long &ntr = nested_trap_recover.cpu(log_cpu);
#if 0
- printf("%s: lcpu%u sp=%p t=%u nested_trap_recover=%ld\n",
- __func__, log_cpu, (void*)Proc::stack_pointer(), ts->_trapno,
- ntr);
+ printf("%s: lcpu%u sp=%p t=%lu nested_trap_recover=%ld\n",
+ __func__, log_cpu, (void*)Proc::stack_pointer(), ts->_trapno, ntr);
#endif
int ret;
struct
{
Mword pdir;
- int (*handler)(Trap_state*, unsigned int);
+ FIASCO_FASTCALL int (*handler)(Trap_state*, unsigned);
void *stack;
} p;
return ret == 0 ? 0 : -1;
}
-