Skip to content

Commit 7f38c1e

Browse files
committed
Fix more clobbers
1 parent 8dc751d commit 7f38c1e

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

port/wch/ch32v/src/cpus/main.zig

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,26 @@ pub const startup_logic = struct {
282282
@export(&startup_logic._system_init, .{ .name = "_system_init" });
283283
asm volatile (
284284
\\jal _system_init
285-
);
285+
// We have clobber all caller-saved registers
286+
::: .{
287+
.x1 = true,
288+
.x5 = true,
289+
.x6 = true,
290+
.x7 = true,
291+
.x10 = true,
292+
.x11 = true,
293+
.x12 = true,
294+
.x13 = true,
295+
.x14 = true,
296+
.x15 = true,
297+
.x16 = true,
298+
.x17 = true,
299+
.x28 = true,
300+
.x29 = true,
301+
.x30 = true,
302+
.x31 = true,
303+
.memory = true,
304+
});
286305

287306
// Load the address of the `microzig_main` function into the `mepc` register
288307
// and transfer control to it using the `mret` instruction.

0 commit comments

Comments
 (0)