diff options
-rw-r--r-- | firmware/thread.c | 25 |
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 @@ | |||
27 | #ifdef CPU_COLDFIRE | 27 | #ifdef CPU_COLDFIRE |
28 | struct regs | 28 | struct regs |
29 | { | 29 | { |
30 | unsigned int macsr; /* EMAC status register */ | ||
30 | unsigned int d[6]; /* d2-d7 */ | 31 | unsigned int d[6]; /* d2-d7 */ |
31 | unsigned int a[5]; /* a2-a6 */ | 32 | unsigned int a[5]; /* a2-a6 */ |
32 | void *sp; /* Stack pointer (a7) */ | 33 | void *sp; /* Stack pointer (a7) */ |
@@ -77,31 +78,33 @@ static inline void load_context(const void* addr) __attribute__ ((always_inline) | |||
77 | static inline void store_context(void* addr) | 78 | static inline void store_context(void* addr) |
78 | { | 79 | { |
79 | asm volatile ( | 80 | asm volatile ( |
80 | "movem.l %%d2-%%d7/%%a2-%%a7,(%0)\n" | 81 | "move.l %%macsr,%%d0 \n" |
81 | : : "a" (addr) | 82 | "movem.l %%d0/%%d2-%%d7/%%a2-%%a7,(%0) \n" |
83 | : : "a" (addr) : "d0" /* only! */ | ||
82 | ); | 84 | ); |
83 | } | 85 | } |
84 | 86 | ||
85 | /*--------------------------------------------------------------------------- | 87 | /*--------------------------------------------------------------------------- |
86 | * Load non-volatile context. | 88 | * Load non-volatile context. |
87 | *--------------------------------------------------------------------------- | 89 | *--------------------------------------------------------------------------- |
88 | */ | 90 | */ |
89 | static inline void load_context(const void* addr) | 91 | static inline void load_context(const void* addr) |
90 | { | 92 | { |
91 | asm volatile ( | 93 | asm volatile ( |
92 | "movem.l (%0),%%d2-%%d7/%%a2-%%a7\n" /* Load context */ | 94 | "movem.l (%0),%%d0/%%d2-%%d7/%%a2-%%a7 \n" /* Load context */ |
93 | "move.l (48,%0),%%d0 \n" /* Get start address */ | 95 | "move.l %%d0,%%macsr \n" |
94 | "beq.b .running \n" /* NULL -> already running */ | 96 | "move.l (52,%0),%%d0 \n" /* Get start address */ |
95 | "clr.l (48,%0) \n" /* Clear start address.. */ | 97 | "beq.b .running \n" /* NULL -> already running */ |
96 | "move.l %%d0,%0 \n" | 98 | "clr.l (52,%0) \n" /* Clear start address.. */ |
97 | "jmp (%0) \n" /* ..and start the thread */ | 99 | "move.l %%d0,%0 \n" |
98 | ".running: \n" | 100 | "jmp (%0) \n" /* ..and start the thread */ |
101 | ".running: \n" | ||
99 | : : "a" (addr) : "d0" /* only! */ | 102 | : : "a" (addr) : "d0" /* only! */ |
100 | ); | 103 | ); |
101 | } | 104 | } |
102 | 105 | ||
103 | #elif CONFIG_CPU == SH7034 | 106 | #elif CONFIG_CPU == SH7034 |
104 | /*--------------------------------------------------------------------------- | 107 | /*--------------------------------------------------------------------------- |
105 | * Store non-volatile context. | 108 | * Store non-volatile context. |
106 | *--------------------------------------------------------------------------- | 109 | *--------------------------------------------------------------------------- |
107 | */ | 110 | */ |