From 6518adf8229c9c0d842b519500ae921c820d2823 Mon Sep 17 00:00:00 2001 From: Kor Nielsen Date: Mon, 6 Nov 2023 16:26:59 -0800 Subject: [PATCH] cfia_assert_eq_N_words: Use explicit registers. This allows for smaller code because we can guarantee the register ids fit in the 16-bit encoding. --- FROZEN_IMAGES.sha384sum | 4 +-- cfi/lib/src/cfi.rs | 80 ++++++++++++++++++++--------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/FROZEN_IMAGES.sha384sum b/FROZEN_IMAGES.sha384sum index 0dae3194ed..7abddf9655 100644 --- a/FROZEN_IMAGES.sha384sum +++ b/FROZEN_IMAGES.sha384sum @@ -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 diff --git a/cfi/lib/src/cfi.rs b/cfi/lib/src/cfi.rs index 94071ec9e7..51b822eb5e 100644 --- a/cfi/lib/src/cfi.rs +++ b/cfi/lib/src/cfi.rs @@ -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) _); } @@ -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) _); }