Skip to content

Commit 73cede4

Browse files
committed
Put __etext at address 0 so the decoder knows how much to decode instead of always decoding the entire ROM
1 parent b196225 commit 73cede4

File tree

11 files changed

+38
-6
lines changed

11 files changed

+38
-6
lines changed

asm/branch.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.section .text.start
2+
.word __etext
3+
14
.global _start
25
_start:
36
li x1, 0

asm/large_bin.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.section .text.start
2+
.word __etext
3+
14
.global _start
25
_start:
36
la x1, word1

asm/load.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.section .text.start
2+
.word __etext
3+
14
.global _start
25
_start:
36
la x1, word

asm/math.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.section .text.start
2+
.word __etext
3+
14
.global _start
25
_start:
36
li x1, 0b1

asm/print.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.section .text.start
2+
.word __etext
3+
14
.global _start
25
_start:
36
la s0, msg

asm/store.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.section .text.start
2+
.word __etext
3+
14
.global _start
25
_start:
36
la x1, word

asm/system.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.section .text.start
2+
.word __etext
3+
14
.global _start
25
_start:
36
# PAUSE (apparently not supported by clang)

coremark/mlogv32/entry.s

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.section .text.start
2-
.global _start
2+
.word __etext
33

4+
.global _start
45
_start:
56
la t1, _stack_start
67
andi sp, t1, -16

rust/mlogv32/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ static HEAP: Heap = Heap::empty();
3030
#[rustfmt::skip]
3131
global_asm!("
3232
.section .text.start
33+
.word __etext
34+
3335
la gp, __global_pointer$
3436
3537
la t1, _stack_start

src/decoder.mlog

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,15 @@ reset__find_lookup_start:
8383

8484
set LOOKUP_START i
8585

86-
# start decoding at address 0
87-
set pc 0
86+
# read __etext from address 0
87+
set address 0
88+
op add ret @counter 1
89+
jump load_word always
90+
set __etext result
91+
92+
# start decoding at address 4
93+
# (address 0 is __etext)
94+
set pc 4
8895
set opcache_var null
8996

9097
set START_TIME @time
@@ -370,7 +377,7 @@ reset__skip_locate_pc:
370377
read opcache_var INCR_PROC opcache_var
371378

372379
op add pc pc 4
373-
jump main lessThan pc ROM_END
380+
jump main lessThan pc __etext
374381

375382
# done!
376383
op sub DECODE_DURATION @time START_TIME

0 commit comments

Comments
 (0)