Skip to content

Commit d6d87a3

Browse files
committed
Update ss test
1 parent d6b680d commit d6d87a3

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

tests/programs/cfi_ss_success

72 Bytes
Binary file not shown.

tests/programs/cfi_ss_success.S

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ _start:
1010
li t1, 0x10000
1111
beq t0, t1, 1f
1212
exit_imm 1
13-
13+
1414
1:
1515
li ra, 42
1616
sspush ra
@@ -24,13 +24,18 @@ _start:
2424

2525
sspush t0
2626
sspopchk t0
27-
27+
2828
c.sspush ra
2929
sspopchk ra
3030

3131
sspush t0
3232
c.sspopchk t0
3333

34+
li ra, 42
35+
mv t0, ra
36+
.byte 0x73, 0x40, 0x10, 0xce # sspush ra, avoid automatic conversion to compression instructions
37+
.byte 0x73, 0xc0, 0xc2, 0xcd # sspopchk t0, avoid automatic conversion to compression instructions
38+
3439
li t0, 42
3540
beq ra, t0, 1f
3641
exit_imm 2
@@ -46,20 +51,20 @@ _start:
4651
// First push a value (100) onto shadow stack
4752
li t0, 100
4853
sspush t0
49-
54+
5055
ssrdp t3
51-
56+
5257
// Prepare new value (200) to swap
5358
li t4, 200
54-
59+
5560
// Perform atomic swap: load from [t3] into t5, store t4 to [t3]
5661
ssamoswap.d t5, t4, (t3)
57-
62+
5863
// Verify that t5 now contains the old value (100)
5964
li t6, 100
6065
beq t5, t6, 1f
6166
exit_imm 4
62-
67+
6368
1:
6469
// Pop the value and verify it's the new value (200)
6570
li t0, 200

0 commit comments

Comments
 (0)