1
0
Fork 0
forked from len0rd/rockbox

Coldfire: Made the MACSR register part of the thread context to allow easier handling in the codecs.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7445 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-09-01 20:06:38 +00:00
parent 4172a009f6
commit 904f7fd970

View file

@ -27,6 +27,7 @@
#ifdef CPU_COLDFIRE
struct regs
{
unsigned int macsr; /* EMAC status register */
unsigned int d[6]; /* d2-d7 */
unsigned int a[5]; /* a2-a6 */
void *sp; /* Stack pointer (a7) */
@ -77,8 +78,9 @@ static inline void load_context(const void* addr) __attribute__ ((always_inline)
static inline void store_context(void* addr)
{
asm volatile (
"movem.l %%d2-%%d7/%%a2-%%a7,(%0)\n"
: : "a" (addr)
"move.l %%macsr,%%d0 \n"
"movem.l %%d0/%%d2-%%d7/%%a2-%%a7,(%0) \n"
: : "a" (addr) : "d0" /* only! */
);
}
@ -89,10 +91,11 @@ static inline void store_context(void* addr)
static inline void load_context(const void* addr)
{
asm volatile (
"movem.l (%0),%%d2-%%d7/%%a2-%%a7\n" /* Load context */
"move.l (48,%0),%%d0 \n" /* Get start address */
"movem.l (%0),%%d0/%%d2-%%d7/%%a2-%%a7 \n" /* Load context */
"move.l %%d0,%%macsr \n"
"move.l (52,%0),%%d0 \n" /* Get start address */
"beq.b .running \n" /* NULL -> already running */
"clr.l (48,%0) \n" /* Clear start address.. */
"clr.l (52,%0) \n" /* Clear start address.. */
"move.l %%d0,%0 \n"
"jmp (%0) \n" /* ..and start the thread */
".running: \n"