Variable arguments on ARM architectures

Hacking around into ARM and thinking about scheduling I was thinking about C functions variable arguments: although not very useful for a small operating system like NxOS, I thought that including the va_* functions into the base library would be cool. Even if it seemed quite simple, I’ve thought to check it out from a reliable source like uClibc.

It’s pretty strange, but the current version of uClibc seems not to include the stdarg.h header file. After a quick google search, I’ve found this source file. It’s not really included in uClibc, but at least it bore out my hypotesis…

The point is that there’s a specific procedure call standard for the ARM architecture. I should read it deeply, but it’s easy to understand that the registers r0, r1 and r2 are used for the first parameters of a function. There’s no way to get a pointer to a register, but the C programming language includes the va_* functions, hence there must be a de-facto standard, or something similar. The document just briefly mentions them into section 7.1.4.

I’d like to investigate on this issue, and maybe, eventually, I’ll put my results on this blog.

Leave a Reply