Skip to content
This repository was archived by the owner on Nov 28, 2023. It is now read-only.

Commit 72c33a7

Browse files
committed
Pass a0..a2 to main()
1 parent 8a6deca commit 72c33a7

29 files changed

+57
-23
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ license = "ISC"
1212
[dependencies]
1313
r0 = "1.0.0"
1414
riscv = "0.8"
15-
riscv-rt-macros = { path = "macros", version = "0.1.6" }
15+
riscv-rt-macros = { path = "macros", version = "0.2.0" }
1616

1717
[dev-dependencies]
1818
panic-halt = "0.2.0"

asm.S

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ _abs_start:
5858
li x7, 0
5959
li x8, 0
6060
li x9, 0
61-
li x10,0
62-
li x11,0
63-
li x12,0
61+
// a0..a2 (x10..x12) skipped
6462
li x13,0
6563
li x14,0
6664
li x15,0
@@ -87,23 +85,23 @@ _abs_start:
8785
.option pop
8886

8987
// Check hart id
90-
csrr a2, mhartid
88+
csrr t2, mhartid
9189
lui t0, %hi(_max_hart_id)
9290
add t0, t0, %lo(_max_hart_id)
93-
bgtu a2, t0, abort
91+
bgtu t2, t0, abort
9492

9593
// Allocate stacks
9694
la sp, _stack_start
9795
lui t0, %hi(_hart_stack_size)
9896
add t0, t0, %lo(_hart_stack_size)
9997
#ifdef __riscv_mul
100-
mul t0, a2, t0
98+
mul t0, t2, t0
10199
#else
102-
beqz a2, 2f // Jump if single-hart
103-
mv t1, a2
104-
mv t2, t0
100+
beqz t2, 2f // Jump if single-hart
101+
mv t1, t2
102+
mv t3, t0
105103
1:
106-
add t0, t0, t2
104+
add t0, t0, t3
107105
addi t1, t1, -1
108106
bnez t1, 1b
109107
2:

bin/riscv32i-unknown-none-elf.a

-268 Bytes
Binary file not shown.

bin/riscv32ic-unknown-none-elf.a

-256 Bytes
Binary file not shown.

bin/riscv32if-unknown-none-elf.a

-268 Bytes
Binary file not shown.

bin/riscv32ifc-unknown-none-elf.a

-256 Bytes
Binary file not shown.

bin/riscv32ifd-unknown-none-elf.a

-268 Bytes
Binary file not shown.

bin/riscv32ifdc-unknown-none-elf.a

-256 Bytes
Binary file not shown.

bin/riscv32im-unknown-none-elf.a

-276 Bytes
Binary file not shown.

bin/riscv32imc-unknown-none-elf.a

-264 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)