The indent police strikes again!

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@181 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-04-22 23:41:29 +00:00
parent c7e811bffe
commit 8ded7ca323

View file

@ -20,22 +20,22 @@
typedef union
{
struct regs_t
{
unsigned int r[7]; /* Registers r8 thru r14 */
void *sp; /* Stack pointer (r15) */
unsigned int sr; /* Status register */
void* gbr; /* Global base register */
void* pr; /* Procedure register */
} regs;
unsigned int mem[32];
struct regs_t
{
unsigned int r[7]; /* Registers r8 thru r14 */
void *sp; /* Stack pointer (r15) */
unsigned int sr; /* Status register */
void* gbr; /* Global base register */
void* pr; /* Procedure register */
} regs;
unsigned int mem[32];
} ctx_t;
typedef struct
{
int created;
int current;
ctx_t ctx[MAXTHREADS] __attribute__ ((aligned (32)));
int created;
int current;
ctx_t ctx[MAXTHREADS] __attribute__ ((aligned (32)));
} thread_t;
static thread_t threads = {1, 0};
@ -46,20 +46,20 @@ static thread_t threads = {1, 0};
*/
static inline void stctx(void* addr)
{
asm volatile ("mov.l r8, @(0, %0)\n\t"
"mov.l r9, @(4, %0)\n\t"
"mov.l r10, @(8, %0)\n\t"
"mov.l r11, @(12, %0)\n\t"
"mov.l r12, @(16, %0)\n\t"
"mov.l r13, @(20, %0)\n\t"
"mov.l r14, @(24, %0)\n\t"
"mov.l r15, @(28, %0)\n\t"
"stc sr, r0\n\t"
"mov.l r0, @(32, %0)\n\t"
"stc gbr, r0\n\t"
"mov.l r0, @(36, %0)\n\t"
"sts pr, r0\n\t"
"mov.l r0, @(40, %0)" :: "r" (addr));
asm volatile ("mov.l r8, @(0, %0)\n\t"
"mov.l r9, @(4, %0)\n\t"
"mov.l r10, @(8, %0)\n\t"
"mov.l r11, @(12, %0)\n\t"
"mov.l r12, @(16, %0)\n\t"
"mov.l r13, @(20, %0)\n\t"
"mov.l r14, @(24, %0)\n\t"
"mov.l r15, @(28, %0)\n\t"
"stc sr, r0\n\t"
"mov.l r0, @(32, %0)\n\t"
"stc gbr, r0\n\t"
"mov.l r0, @(36, %0)\n\t"
"sts pr, r0\n\t"
"mov.l r0, @(40, %0)" :: "r" (addr));
}
/*---------------------------------------------------------------------------
@ -68,21 +68,21 @@ static inline void stctx(void* addr)
*/
static inline void ldctx(void* addr)
{
asm volatile ("mov.l @(0, %0), r8\n\t"
"mov.l @(4, %0), r9\n\t"
"mov.l @(8, %0), r10\n\t"
"mov.l @(12, %0), r11\n\t"
"mov.l @(16, %0), r12\n\t"
"mov.l @(20, %0), r13\n\t"
"mov.l @(24, %0), r14\n\t"
"mov.l @(28, %0), r15\n\t"
"mov.l @(32, %0), r0\n\t"
"ldc r0, sr\n\t"
"mov.l @(36, %0), r0\n\t"
"ldc r0, gbr\n\t"
"mov.l @(40, %0), r0\n\t"
"lds r0, pr\n\t"
"mov.l r0, @(0, r15)" :: "r" (addr));
asm volatile ("mov.l @(0, %0), r8\n\t"
"mov.l @(4, %0), r9\n\t"
"mov.l @(8, %0), r10\n\t"
"mov.l @(12, %0), r11\n\t"
"mov.l @(16, %0), r12\n\t"
"mov.l @(20, %0), r13\n\t"
"mov.l @(24, %0), r14\n\t"
"mov.l @(28, %0), r15\n\t"
"mov.l @(32, %0), r0\n\t"
"ldc r0, sr\n\t"
"mov.l @(36, %0), r0\n\t"
"ldc r0, gbr\n\t"
"mov.l @(40, %0), r0\n\t"
"lds r0, pr\n\t"
"mov.l r0, @(0, r15)" :: "r" (addr));
}
/*---------------------------------------------------------------------------
@ -92,16 +92,16 @@ static inline void ldctx(void* addr)
void
switch_thread(void)
{
int ct;
int nt;
thread_t* t = &threads;
int ct;
int nt;
thread_t* t = &threads;
nt = ct = t->current;
if (++nt >= t->created)
nt = 0;
t->current = nt;
stctx(&t->ctx[ct]);
ldctx(&t->ctx[nt]);
nt = ct = t->current;
if (++nt >= t->created)
nt = 0;
t->current = nt;
stctx(&t->ctx[ct]);
ldctx(&t->ctx[nt]);
}
/*---------------------------------------------------------------------------
@ -112,16 +112,16 @@ switch_thread(void)
*/
int create_thread(void* fp, void* sp, int stk_size)
{
thread_t* t = &threads;
thread_t* t = &threads;
if (t->created >= MAXTHREADS)
return -1;
else
{
ctx_t* ctxp = &t->ctx[t->created++];
stctx(ctxp);
ctxp->regs.sp = (void*)(((unsigned int)sp + stk_size) & ~31);
ctxp->regs.pr = fp;
}
return 0;
if (t->created >= MAXTHREADS)
return -1;
else
{
ctx_t* ctxp = &t->ctx[t->created++];
stctx(ctxp);
ctxp->regs.sp = (void*)(((unsigned int)sp + stk_size) & ~31);
ctxp->regs.pr = fp;
}
return 0;
}