-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support loading initialized data memory from asm tests #725
Support loading initialized data memory from asm tests #725
Conversation
test/test_core.py
Outdated
|
||
return { | ||
"text": load_section(".text"), | ||
"data": load_section(".data") + load_section(".bss"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is OK because of the link.ld
script? What about alignment, what happens if .data
's length is not an integer multiple of 4 bytes? Can this happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was a problem, now i moved everything to .data
inside liker script, so it is address-independent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that the way we handle memory in these tests is kind of broken. The reason it didn't come out yet is that .bss and .data sections are always empty for our hand-written assembly tests.
Also having two separate memories (instructions and data separately) is just probably left over from the ancient times of the project.
I would suggest using the same structures as we use in regression/benchmarks/signature tests, i.e. CoreMemoryModel
and friends. Storing and accessing the initial values of the registers could be solved by creating our own section in the assembly (and the linker script) and then associating it with a new MemorySegment
test/asm/interrupt.asm
Outdated
@@ -98,3 +100,6 @@ fail: | |||
.org 0x200 | |||
j int_handler | |||
li x31, 0xae # should never happen | |||
|
|||
.bss | |||
INIT_REGS_ALLOCATION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.bss section should be always zeroed, so we shouldn't put any preloaded data there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also: setting the location of .bss in the linker script and then overriding it using .orig
is just bad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with separate section with origin in liker script
ab57393
to
f888611
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I am not blocking this. The further refactor should be done in another PR.
Initialized data can be now declared in internal asm tests. Data memory size (also with
.bss
) is now determined from asm source file, instead of default fixed value.