Line 23... |
Line 23... |
|
|
#define FORCE_RET asm volatile ("")
|
#define FORCE_RET asm volatile ("")
|
|
|
/* Handles the scheduler and PC updateing. Yes, useing MMX is a requirement. It
|
/* Handles the scheduler and PC updateing. Yes, useing MMX is a requirement. It
|
* just won't change. This must be as compact as possible */
|
* just won't change. This must be as compact as possible */
|
static inline void handle_sched(void)
|
#define HANDLE_SCHED(func, jmp) asm("paddd %%mm1, %%mm0\n" \
|
{
|
"\tmovd %%mm0, %%eax\n" \
|
asm("paddd %%mm1, %%mm0\n"
|
"\ttestl %%eax, %%eax\n" \
|
"\tmovd %%mm0, %%eax\n"
|
"\tjg ." jmp "\n" \
|
"\ttestl %%eax, %%eax\n"
|
"\tcall "#func"\n" \
|
"\tjg .no_need_run_sched\n"
|
"\t." jmp ":" : : )
|
"\tcall do_sched_wrap\n"
|
|
"\t.no_need_run_sched:" : : );
|
|
}
|
|
|
|
static inline int32_t do_cycles(void)
|
static inline int32_t do_cycles(void)
|
{
|
{
|
register uint32_t cycles;
|
register uint32_t cycles;
|
|
|
Line 53... |
Line 50... |
"\tpaddd %%mm2, %%mm0"
|
"\tpaddd %%mm2, %%mm0"
|
: : "m" (runtime.sim.mem_cycles));
|
: : "m" (runtime.sim.mem_cycles));
|
runtime.sim.mem_cycles = 0;
|
runtime.sim.mem_cycles = 0;
|
}
|
}
|
|
|
|
static inline void or_longjmp(void *loc) __attribute__((noreturn));
|
|
static inline void or_longjmp(void *loc)
|
|
{
|
|
/* We push a trampoline address (dyn_ret_stack_prot) onto the stack to be able
|
|
* to detect if any ret instructions found their way into an operation. */
|
|
asm("\tmovl %0, %%eax\n"
|
|
"\tmovl %1, %%esp\n"
|
|
"\tmovl $%2, %%ebp\n"
|
|
"\tpush $dyn_ret_stack_prot\n"
|
|
"\tpush $dyn_ret_stack_prot\n"
|
|
"\tpush $dyn_ret_stack_prot\n"
|
|
"\tjmp *%%eax\n"
|
|
:
|
|
: "m" (loc),
|
|
"m" (rec_stack_base),
|
|
"m" (cpu_state));
|
|
}
|
|
|
|
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|