Cleaning up raw32 thread context switching functions (use consistent coding style)
This commit is contained in:
parent
d80bd18157
commit
0ab0e28bdb
3 changed files with 30 additions and 30 deletions
|
@ -83,9 +83,9 @@
|
||||||
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
||||||
// Calculate where to generate the new context
|
// Calculate where to generate the new context
|
||||||
// newt->cxt = (char *)newt + newt->size;
|
// newt->cxt = (char *)newt + newt->size;
|
||||||
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
||||||
add r2,r2,r1
|
add r2,r2,r1
|
||||||
str r2,[r1,#__cpp(offsetof(thread,cxt))]
|
str r2,[r1,#__cpp(offsetof(thread,cxt))]
|
||||||
|
|
||||||
// Save the old context
|
// Save the old context
|
||||||
push {r4, r5, r6, r7, lr}
|
push {r4, r5, r6, r7, lr}
|
||||||
|
@ -101,13 +101,13 @@
|
||||||
|
|
||||||
// Run the users function - we save some code because gfxThreadExit() never returns
|
// Run the users function - we save some code because gfxThreadExit() never returns
|
||||||
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
||||||
LDR r2,__cpp(&_gfxCurrentThread)
|
ldr r2,__cpp(&_gfxCurrentThread)
|
||||||
LDR r2,[r2,#0]
|
ldr r2,[r2,#0]
|
||||||
LDR r0,[r2,#__cpp(offsetof(thread,param))]
|
ldr r0,[r2,#__cpp(offsetof(thread,param))]
|
||||||
LDR r1,[r2,#__cpp(offsetof(thread,fn))]
|
ldr r1,[r2,#__cpp(offsetof(thread,fn))]
|
||||||
BLX r1
|
blx r1
|
||||||
MOV r4,r0
|
mov r4,r0
|
||||||
BL gfxThreadExit
|
bl gfxThreadExit
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -59,9 +59,9 @@
|
||||||
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
||||||
// Calculate where to generate the new context
|
// Calculate where to generate the new context
|
||||||
// newt->cxt = (char *)newt + newt->size;
|
// newt->cxt = (char *)newt + newt->size;
|
||||||
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
||||||
add r2,r2,r1
|
add r2,r2,r1
|
||||||
str r2,[r1,#__cpp(offsetof(thread,cxt))]
|
str r2,[r1,#__cpp(offsetof(thread,cxt))]
|
||||||
|
|
||||||
// Save the old context
|
// Save the old context
|
||||||
push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
|
push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
|
||||||
|
@ -72,13 +72,13 @@
|
||||||
|
|
||||||
// Run the users function - we save some code because gfxThreadExit() never returns
|
// Run the users function - we save some code because gfxThreadExit() never returns
|
||||||
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
||||||
LDR r2,__cpp(&_gfxCurrentThread)
|
ldr r2,__cpp(&_gfxCurrentThread)
|
||||||
LDR r2,[r2,#0]
|
ldr r2,[r2,#0]
|
||||||
LDR r0,[r2,#__cpp(offsetof(thread,param))]
|
ldr r0,[r2,#__cpp(offsetof(thread,param))]
|
||||||
LDR r1,[r2,#__cpp(offsetof(thread,fn))]
|
ldr r1,[r2,#__cpp(offsetof(thread,fn))]
|
||||||
BLX r1
|
blx r1
|
||||||
MOV r4,r0
|
mov r4,r0
|
||||||
BL gfxThreadExit
|
bl gfxThreadExit
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -63,9 +63,9 @@
|
||||||
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
static __asm void _gfxStartThread(thread *oldt, thread *newt) {
|
||||||
// Calculate where to generate the new context
|
// Calculate where to generate the new context
|
||||||
// newt->cxt = (char *)newt + newt->size;
|
// newt->cxt = (char *)newt + newt->size;
|
||||||
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
ldr r2,[r1,#__cpp(offsetof(thread,size))]
|
||||||
add r2,r2,r1
|
add r2,r2,r1
|
||||||
str r2,[r1,#__cpp(offsetof(thread,cxt))]
|
str r2,[r1,#__cpp(offsetof(thread,cxt))]
|
||||||
|
|
||||||
// Save the old context
|
// Save the old context
|
||||||
push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
|
push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
|
||||||
|
@ -77,13 +77,13 @@
|
||||||
|
|
||||||
// Run the users function - we save some code because gfxThreadExit() never returns
|
// Run the users function - we save some code because gfxThreadExit() never returns
|
||||||
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
// gfxThreadExit(_gfxCurrentThread->fn(_gfxCurrentThread->param));
|
||||||
LDR r2,__cpp(&_gfxCurrentThread)
|
ldr r2,__cpp(&_gfxCurrentThread)
|
||||||
LDR r2,[r2,#0]
|
ldr r2,[r2,#0]
|
||||||
LDR r0,[r2,#__cpp(offsetof(thread,param))]
|
ldr r0,[r2,#__cpp(offsetof(thread,param))]
|
||||||
LDR r1,[r2,#__cpp(offsetof(thread,fn))]
|
ldr r1,[r2,#__cpp(offsetof(thread,fn))]
|
||||||
BLX r1
|
blx r1
|
||||||
MOV r4,r0
|
mov r4,r0
|
||||||
BL gfxThreadExit
|
bl gfxThreadExit
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Reference in a new issue