c - Why the entry file for uboot is written in assembly? -
why entry point (start.s) of uboot written in assembly? performance reason or there other issues. why not written in c?
unless entry point guaranteed initial state fits form of c function call in abi c compiler uses, c cannot express entry point. if there relevant state in registers, (1) potentially-clobbered prologue code compiler generates, call-clobbered registers, , (2) if registers call-saved, compiler might move them somewhere not exposed c code, if c code has access inline assembly extensions. (a side note: uclibc's setjmp implementation archs buggy in regard; wrongly written inline asm, rather asm function, , assumes compiler has not modified/moved call-saved registers when inline asm reached.) many entry points (e.g. elf binaries) have initial state positioned on stack in ways not representable c.
Comments
Post a Comment