[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Delay slots
On Tue, 21 Jun 2016, Warner Losh wrote:
> A big reason is that many bits that are in assembler are somewhat constrained
> in how big they can be or what they can do. Youʼll see lots of .set noat as well
> since there are places you simply canʼt trash the ʽatʼ register when executing
> in trap handler, but addresses need to be loaded so gas has special case code
> to ensure that they are loaded properly (eg by only touching k0 and k1).
FYI, GAS has supported redefining its temporary register for a while now,
to aid software writers with exception handler code among others, although
the use is not necessarily limited to that situation. For this purpose
the `.set at' pseudo-op has been extended to accept an optional assignment
from the register intended to be the new temporary. For example write
`.set at=$k0' to use the $k0 rather than the usual $at register. Revert
with `.set at=$1' or classic `.set at'; other relevant `.set' ops yield
the expected results.
This lets you write e.g. `sw $k1, foo' in an exception handler and forget
what exact relocations (percent-ops) and instructions are needed with a
given ABI to get at `foo' while the assembler sorts out the details using
$k0 as the temporary; also avoiding _MIPS_SIM conditionals if applicable.
Other use cases are possible too, sometimes just to shorten code produced
from CPP or assembly macro expansions without the need to use conditional
You can use the pseudo-op to choose any register as the temporary of
course, with the exception of $0 -- `.set at=$0' is equivalent to `.set
noat', perhaps somewhat predictably.
Main Index |
Thread Index |