arm
This commit is contained in:
parent
6912efc49c
commit
9aa463c541
2 changed files with 35 additions and 34 deletions
|
|
@ -11,43 +11,43 @@ _tas:
|
||||||
|
|
||||||
.globl getmcontext
|
.globl getmcontext
|
||||||
getmcontext:
|
getmcontext:
|
||||||
/* r0 will be overwritten */
|
str r1, [r0,#4]
|
||||||
str r1, [r0,#4]!
|
str r2, [r0,#8]
|
||||||
str r2, [r0,#4]!
|
str r3, [r0,#12]
|
||||||
str r3, [r0,#4]!
|
str r4, [r0,#16]
|
||||||
str r4, [r0,#4]!
|
str r5, [r0,#20]
|
||||||
str r5, [r0,#4]!
|
str r6, [r0,#24]
|
||||||
str r6, [r0,#4]!
|
str r7, [r0,#28]
|
||||||
str r7, [r0,#4]!
|
str r8, [r0,#32]
|
||||||
str r8, [r0,#4]!
|
str r9, [r0,#36]
|
||||||
str r9, [r0,#4]!
|
str r10, [r0,#40]
|
||||||
str r10, [r0,#4]!
|
str r11, [r0,#44]
|
||||||
str r11, [r0,#4]!
|
str r12, [r0,#48]
|
||||||
str r12, [r0,#4]!
|
str r13, [r0,#52]
|
||||||
str r13, [r0,#4]!
|
str r14, [r0,#56]
|
||||||
str r14, [r0,#4]!
|
/* store 1 as r0-to-restore */
|
||||||
/* r15 is pc */
|
mov r1, #1
|
||||||
|
str r1, [r0]
|
||||||
|
/* return 0 */
|
||||||
mov r0, #0
|
mov r0, #0
|
||||||
mov pc, lr
|
mov pc, lr
|
||||||
|
|
||||||
.globl setmcontext
|
.globl setmcontext
|
||||||
setmcontext:
|
setmcontext:
|
||||||
/* r0 will be overwritten */
|
ldr r1, [r0,#4]
|
||||||
ldr r1, [r0,#4]!
|
ldr r2, [r0,#8]
|
||||||
ldr r2, [r0,#4]!
|
ldr r3, [r0,#12]
|
||||||
ldr r3, [r0,#4]!
|
ldr r4, [r0,#16]
|
||||||
ldr r4, [r0,#4]!
|
ldr r5, [r0,#20]
|
||||||
ldr r5, [r0,#4]!
|
ldr r6, [r0,#24]
|
||||||
ldr r6, [r0,#4]!
|
ldr r7, [r0,#28]
|
||||||
ldr r7, [r0,#4]!
|
ldr r8, [r0,#32]
|
||||||
ldr r8, [r0,#4]!
|
ldr r9, [r0,#36]
|
||||||
ldr r9, [r0,#4]!
|
ldr r10, [r0,#40]
|
||||||
ldr r10, [r0,#4]!
|
ldr r11, [r0,#44]
|
||||||
ldr r11, [r0,#4]!
|
ldr r12, [r0,#48]
|
||||||
ldr r12, [r0,#4]!
|
ldr r13, [r0,#52]
|
||||||
ldr r13, [r0,#4]!
|
ldr r14, [r0,#56]
|
||||||
ldr r14, [r0,#4]!
|
ldr r0, [r0]
|
||||||
/* r15 is pc */
|
|
||||||
mov r0, #1
|
|
||||||
mov pc, lr
|
mov pc, lr
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,8 @@ makecontext(ucontext_t *uc, void (*fn)(void), int argc, ...)
|
||||||
sp = (int*)uc->uc_stack.ss_sp+uc->uc_stack.ss_size/4;
|
sp = (int*)uc->uc_stack.ss_sp+uc->uc_stack.ss_size/4;
|
||||||
va_start(arg, argc);
|
va_start(arg, argc);
|
||||||
for(i=0; i<4 && i<argc; i++)
|
for(i=0; i<4 && i<argc; i++)
|
||||||
uc->uc_mcontext.gregs[0] = va_arg(arg, uint);
|
uc->uc_mcontext.gregs[i] = va_arg(arg, uint);
|
||||||
|
va_end(arg);
|
||||||
uc->uc_mcontext.gregs[13] = (uint)sp;
|
uc->uc_mcontext.gregs[13] = (uint)sp;
|
||||||
uc->uc_mcontext.gregs[14] = (uint)fn;
|
uc->uc_mcontext.gregs[14] = (uint)fn;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue