summaryrefslogtreecommitdiff
path: root/firmware/thread.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-09-01 20:06:38 +0000
committerJens Arnold <amiconn@rockbox.org>2005-09-01 20:06:38 +0000
commit904f7fd970aac651474bcc071df53068a866014f (patch)
tree6da10b4a2f224ab39b9c245d1853836c0cecf5d3 /firmware/thread.c
parent4172a009f626f032962085a981b7fc2accbdc2e4 (diff)
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
Diffstat (limited to 'firmware/thread.c')
-rw-r--r--firmware/thread.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/firmware/thread.c b/firmware/thread.c
index a8c5ab752f..5bbea31d53 100644
--- a/firmware/thread.c
+++ b/firmware/thread.c
@@ -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,31 +78,33 @@ 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! */
);
}
-/*---------------------------------------------------------------------------
+/*---------------------------------------------------------------------------
* Load non-volatile context.
*---------------------------------------------------------------------------
*/
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 */
- "beq.b .running \n" /* NULL -> already running */
- "clr.l (48,%0) \n" /* Clear start address.. */
- "move.l %%d0,%0 \n"
- "jmp (%0) \n" /* ..and start the thread */
- ".running: \n"
+ "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 (52,%0) \n" /* Clear start address.. */
+ "move.l %%d0,%0 \n"
+ "jmp (%0) \n" /* ..and start the thread */
+ ".running: \n"
: : "a" (addr) : "d0" /* only! */
);
}
#elif CONFIG_CPU == SH7034
-/*---------------------------------------------------------------------------
+/*---------------------------------------------------------------------------
* Store non-volatile context.
*---------------------------------------------------------------------------
*/