]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Save and restore r9 register in arm ubldr. In old gcc 4.2, r9 was a callee-
authorIan Lepore <ian@FreeBSD.org>
Sun, 10 Dec 2017 21:51:27 +0000 (21:51 +0000)
committerIan Lepore <ian@FreeBSD.org>
Sun, 10 Dec 2017 21:51:27 +0000 (21:51 +0000)
commit12b92a343c766fd2db9ebb9e86dff97f26381e6b
treeb945f8a3f91d3016cb155181c797bbe58266c569
parent3102bbe940045618c265d652806ad828f05fab8a
Save and restore r9 register in arm ubldr.  In old gcc 4.2, r9 was a callee-
saved register, but in arm EABI it may be either callee-saved or dedicated
to some special purpose (such as a TLS pointer).  It appears clang does not
treat it as a callee-saved register (instead using it as another work
register, similar to r12).

Another important side effect of these changes is that saving an extra
register in the push/pop statements keeps the stack aligned to an 8-byte
boundary during the self_reloc() call, as it always should have been.

As stated in the PR...

Essentially the important caller-saved registers are pushed (r0, r1, r9, lr)
before the relocation call, and popped after.  Then r8/r9 are saved as usual
for the syscall trampoline, and lr is stored in r8 (now free) as a
callee-saved value before calling into `main`.

The call to `main` can no longer be a tail call because we must restore r9
especially after main returns (although since we have used r8 to hold lr we
must also restore this).

PR: 224008
stand/arm/uboot/start.S