Closed PorterLu closed 1 year ago
The phenomenon is user_shell will print characters until the heap space is exhausted. Is this just the fault of opensbi ? If so, I will close the pull.
We only tested our code based on RustSBI. What kind of problem you met related to RustSBI and on which branch you met the problem? A possible problem is that you are not using QEMU version 7.0.0 since the RustSBI binary in this repo only supports this version.
Rust user shell
>> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Panicked at src/lib.rs:23, Heap allocation error, layout = Layout { size: 16384, align: 1 (1 << 0) }
I use qemu 7.2.0 and opensbi. I am doing experiments of ch5. It seems that someone who uses opensbi has encounter this problem. The above is the error, and the following is the sbi text fragment.
5.3. Extension: Console Getchar (EID #0x02)
long sbi_console_getchar(void)
Read a byte from debug console.
The SBI call returns the byte on success, or -1 for failure.
Sorry, I type wrong version. It's qemu7.0.0 and the problem is just like above descriptions. I change 0 to usize::MAX to solve problem. I just want to reply you quickly, and rest is more important, you can consider it in your spare time. 😀
I issue at repo of rustsbi-qemu, but I don't get reply. It seems rustsbi's getchar will wait a char, while opensbi's getchar will return -1 if it don't get char. So rustsbi' get char don't need a loop and opensbi's getchar() should check the result whether the return result is -1. I sure rustsbi will run successfully but I strongly recommend modify the code to if c == usize::MAX {
to fit sbi doc. Thanks for your general time.
When I'm doing the experment of ch5, the user_shell will run out of heap space. I find the cause is that sbi_return_value -1 means error instead of 0. I change 0 to usize::MAX, and then os can run normally.