From: "Rémi Denis-Courmont" <remi@remlab.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH] checkasm/riscv: preserve T1 whilst calling...
Date: Mon, 29 Jul 2024 22:43:58 +0300
Message-ID: <20240729194358.129575-1-remi@remlab.net> (raw)
This preserves T1 whilst calling the instrumented function. In a Sci-Fi
setting where type-based Control Flow Integrity (CFI) is supported, the
calling code (i.e., the `checkasm` test case) will set T1 to the expected
value of the landing pad label (LPL) of the instrumented function.
The call wrapper will always use LPL zero which is a wild card. We should
preserve the value of T1 at least until the indirect call to the
instrumented function. Of course this is Sci-Fi, because:
1) there is no hardware (or even QEMU) support yet,
2) all our assembler functions currently use LPL zero anyway.
This uses T3 rather than T2 because indirect branches with T2 is reserved
for notionally direct calls made with an indirect call instruction (e.g.
due to GOT indirection), and are exempted from forward-edge CFI checks.
---
tests/checkasm/riscv/checkasm.S | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/checkasm/riscv/checkasm.S b/tests/checkasm/riscv/checkasm.S
index e8bcbb271e..c4b034ae23 100644
--- a/tests/checkasm/riscv/checkasm.S
+++ b/tests/checkasm/riscv/checkasm.S
@@ -89,8 +89,8 @@ func checkasm_get_wrapper, v
/* Clobber the vector configuration */
li t0, 0 /* Vector length: zero */
- li t1, -1 << 31 /* Vector type: illegal */
- vsetvl zero, t0, t1
+ li t2, -4 /* Vector type: illegal */
+ vsetvl zero, t0, t2
csrwi vxrm, 3 /* Rounding mode: round-to-odd */
csrwi vxsat, 1 /* Saturation: encountered */
@@ -120,7 +120,7 @@ func checkasm_get_wrapper, v
/* Clobber the saved and temporary registers */
.irp n, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
- .if (\n > 0 && \n < 7)
+ .if (\n > 1 && \n < 7)
mv t\n, t0
.endif
fmv.d.x ft\n, t0
@@ -131,9 +131,9 @@ func checkasm_get_wrapper, v
/* Call the tested function */
la.tls.ie t0, checked_func
add t0, tp, t0
- ld t1, (t0)
+ ld t3, (t0)
sd zero, (t0)
- jalr t1
+ jalr t3
/* Check special register values */
la.tls.ie t0, saved_regs
--
2.45.2
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
reply other threads:[~2024-07-29 19:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240729194358.129575-1-remi@remlab.net \
--to=remi@remlab.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git