Skip to content

Commit

Permalink
cfia_assert_eq_N_words: Use explicit registers.
Browse files Browse the repository at this point in the history
This allows for smaller code because we can guarantee the register ids
fit in the 16-bit encoding.
  • Loading branch information
korran committed Nov 8, 2023
1 parent 1671ebb commit 6518adf
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions FROZEN_IMAGES.sha384sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# WARNING: Do not update this file without the approval of the Caliptra TAC
6b280ebd87f2343c2deeef3f5707d15b112ff6369a1d233dd261667bbf43b4477a51702a300de4d554a3da389e9f1342 caliptra-rom-no-log.bin
9cfd467b59716222a6462d3d3ba11c2b0978938782f4fc3b6478a5f6cab4a9f8eeb63fb98e97c105eb1c3cf6bce8877b caliptra-rom-with-log.bin
9748500734dd3a8be5322398c0cb93b323f6cd129733a93613242d0d798fa6413c9df4069e4b9ee2836e607afe7d93b1 caliptra-rom-no-log.bin
83d889a24c51177220a2074c1153e3aaf49e01dd7f44b999044c60057394ee9cf71ac30d62025da3112f2fee56e8fad5 caliptra-rom-with-log.bin
80 changes: 40 additions & 40 deletions cfi/lib/src/cfi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,44 +212,44 @@ pub fn cfi_assert_eq_12_words(a: &[u32; 12], b: &[u32; 12]) {
"li a0, 0x01040055",
"j cfi_panic_handler",
"3:",
"lw {tmp0}, 0({a})",
"lw {tmp1}, 0({b})",
"lw {tmp0}, 0(a4)",
"lw {tmp1}, 0(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 4({a})",
"lw {tmp1}, 4({b})",
"lw {tmp0}, 4(a4)",
"lw {tmp1}, 4(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 8({a})",
"lw {tmp1}, 8({b})",
"lw {tmp0}, 8(a4)",
"lw {tmp1}, 8(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 12({a})",
"lw {tmp1}, 12({b})",
"lw {tmp0}, 12(a4)",
"lw {tmp1}, 12(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 16({a})",
"lw {tmp1}, 16({b})",
"lw {tmp0}, 16(a4)",
"lw {tmp1}, 16(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 20({a})",
"lw {tmp1}, 20({b})",
"lw {tmp0}, 20(a4)",
"lw {tmp1}, 20(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 24({a})",
"lw {tmp1}, 24({b})",
"lw {tmp0}, 24(a4)",
"lw {tmp1}, 24(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 28({a})",
"lw {tmp1}, 28({b})",
"lw {tmp0}, 28(a4)",
"lw {tmp1}, 28(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 32({a})",
"lw {tmp1}, 32({b})",
"lw {tmp0}, 32(a4)",
"lw {tmp1}, 32(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 36({a})",
"lw {tmp1}, 36({b})",
"lw {tmp0}, 36(a4)",
"lw {tmp1}, 36(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 40({a})",
"lw {tmp1}, 40({b})",
"lw {tmp0}, 40(a4)",
"lw {tmp1}, 40(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 44({a})",
"lw {tmp1}, 44({b})",
"lw {tmp0}, 44(a4)",
"lw {tmp1}, 44(a5)",
"bne {tmp0}, {tmp1}, 2b",
a = in(reg) a.as_ptr(),
b = in(reg) b.as_ptr(),
in("a4") a.as_ptr(),
in("a5") b.as_ptr(),
tmp0 = out(reg) _,
tmp1 = out(reg) _);
}
Expand All @@ -276,26 +276,26 @@ pub fn cfi_assert_eq_6_words(a: &[u32; 6], b: &[u32; 6]) {
"li a0, 0x01040055",
"j cfi_panic_handler",
"3:",
"lw {tmp0}, 0({a})",
"lw {tmp1}, 0({b})",
"lw {tmp0}, 0(a4)",
"lw {tmp1}, 0(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 4({a})",
"lw {tmp1}, 4({b})",
"lw {tmp0}, 4(a4)",
"lw {tmp1}, 4(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 8({a})",
"lw {tmp1}, 8({b})",
"lw {tmp0}, 8(a4)",
"lw {tmp1}, 8(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 12({a})",
"lw {tmp1}, 12({b})",
"lw {tmp0}, 12(a4)",
"lw {tmp1}, 12(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 16({a})",
"lw {tmp1}, 16({b})",
"lw {tmp0}, 16(a4)",
"lw {tmp1}, 16(a5)",
"bne {tmp0}, {tmp1}, 2b",
"lw {tmp0}, 20({a})",
"lw {tmp1}, 20({b})",
"lw {tmp0}, 20(a4)",
"lw {tmp1}, 20(a5)",
"bne {tmp0}, {tmp1}, 2b",
a = in(reg) a.as_ptr(),
b = in(reg) b.as_ptr(),
in("a4") a.as_ptr(),
in("a5") b.as_ptr(),
tmp0 = out(reg) _,
tmp1 = out(reg) _);
}
Expand Down

0 comments on commit 6518adf

Please sign in to comment.