Commit 6cd900f4 authored by Lyude Paul's avatar Lyude Paul
Browse files

bifrost: Note that Port 3 == Port 2 when not in use

When writing the assembler, this appeared to be exactly what the compiler
always does as most of our encoded wouldn't match the compiler's output
otherwise. It's likely this wasn't noticed with the disassembler due
to the fact it wouldn't need to log the register assignment for Port 3
if it's not actually being used for anything.
parent 0bd88fc6
......@@ -327,6 +327,8 @@ Control is what ARM calls the "register access descriptor." To save bits, if the
ARM has one additional trick to save a bit. Port 0 only has 5 bits, so it would seem that when Port 0 and Port 1 are in use, then both can't load a register greater than 31 at the same time. But it turns out that this isn't the case. The hardware compares the register numbers being loaded, and if Port 0 is greater than Port 1, it subtracts 63 from both numbers to get the real register. This lets software encode every possible combination of registers loaded in Port 0 and Port 1, possibly requiring it to swap Port 0 and Port 1.
Additionally, if the register control field writes to Port 2 but doesn't read or write from Port 3, the compiler appers to copy the value in Port 2 over to Port 3. The reason for this is unknown.
Before we get to the actual format of the Control field, though, we need to describe one more subtlety. Each instruction's register field contains the writes for the previous instruction, but what about the writes of the last instruction in the clause? Clauses should be entirely self-contained, so we can't look at the first instruction in the next clause. The answer turns out to be that the first instruction in the clause contains the writes for the last instruction. There are a few extra values for the control field, marked "first instruction," which are only used for the first instruction of a clause. The reads are processed normally, but the writes are delayed until the very end of the clause, after the last instruction. The list of values for the control field is below:
[options="header"]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment