flat assembler
Message board for the users of flat assembler.
Index
> Non-x86 architectures > [ARM] Regarding register preservation |
Author |
|
Picnic 23 Feb 2016, 09:42
Hi,
I have a question regarding register preservation in ARM. It says here ... r0-r3 are the argument and scratch registers; r0-r1 are also the result registers r4-r8 are callee-save registers r9 might be a callee-save register or not (on some variants of AAPCS it is a special register) r10-r11 are callee-save registers r12-r15 are special register My question is: what registers modified by Linux system calls ? Is it safe to write (a generic approach for a hypothetical syscall with no return value) ... Code: stmfd sp!, {r0-r3,r7,lr} ldmfd sp!, {r0-r3,r7,pc} |
|||
23 Feb 2016, 09:42 |
|
Picnic 27 Feb 2016, 07:40
Thanks revolution. I'll keep an eye on those registers. I report back anything unusual.
To summarize: r0 to r3, r12 and r14 will not be preserved. It's probably best to save also the local registers r4 to r11, afterall is just an STM instruction. |
|||
27 Feb 2016, 07:40 |
|
revolution 27 Feb 2016, 07:52
Picnic wrote: It's probably best to save also the local registers r4 to r11, afterall is just an STM instruction. |
|||
27 Feb 2016, 07:52 |
|
Picnic 15 Mar 2016, 15:41
I have a couple of questions more, sorry if they sound a bit foolish, i'm noob to Android stuff.
Using clone(), does every thread has its own registers copy, like in Windows? What is reasonable size for each child stack? mmap allocates ram in 4KB pages, no less, what other options do i have? (memory must be shared between threads). |
|||
15 Mar 2016, 15:41 |
|
revolution 15 Mar 2016, 16:23
I am assuming you are asking Linux questions?
If you are asking about the ARM architecture then 4kB pages is implementation dependant. The standard MMU implementation has a number of other page size options but whether or not Linux supports the other sizes up to the OS. For threading there would be a requirement that each thread gets its own register copy. There is no way to share program registers and still have a sane multitasking system. Theoretically the OS can do whatever it pleases but having some registers shared is not something I'd ever expect to see in something like Linux. The stack size for each thread is most likely taken from the ELF header, so you could set that to whatever you need. |
|||
15 Mar 2016, 16:23 |
|
Picnic 22 Mar 2016, 15:17
Thank you, helpful reply.
|
|||
22 Mar 2016, 15:17 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.