m68k code.

We will use SRP (supervisor root pointer) register to hold the current thread pointer.
Its use by the pmmu is optional and I don't plan on using it.
There are 32 other bits left.
Wonder if weshouldn't use it for system_time() instead... will see, but there are no other usable regs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22696 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2007-10-23 23:48:02 +00:00
parent 1bd446cc44
commit d40bcaab8e
1 changed files with 7 additions and 4 deletions

View File

@ -23,16 +23,19 @@ struct iframe *m68k_get_user_iframe(void);
extern inline struct thread *
arch_thread_get_current_thread(void)
{
struct thread *t;
asm volatile("mfsprg2 %0" : "=r"(t));
return t;
uint64 v = 0;
asm volatile("pmove %%srp,(%0)" : : "a"(&v));
return (struct thread *)(v & 0xffffffff);
}
extern inline void
arch_thread_set_current_thread(struct thread *t)
{
asm volatile("mtsprg2 %0" : : "r"(t));
uint64 v;
asm volatile("pmove %%srp,(%0)\n" \
"move %1,(4,%0)\n" \
"pmove (%0),%%srp" : : "a"(&v), "d"(t));
}