Skip to content

Commit c9d93e3

Browse files
committed
Use append_panic_message syscall on panic
1 parent ca59c4c commit c9d93e3

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

library/std/src/sys/pal/xous/stdio.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub struct Stdout {}
55
pub struct Stderr;
66

77
use crate::os::xous::ffi::{lend, try_lend, try_scalar, Connection};
8-
use crate::os::xous::services::{log_server, try_connect, LogLend, LogScalar};
8+
use crate::os::xous::services::{log_server, LogLend, LogScalar};
99

1010
impl Stdin {
1111
pub const fn new() -> Stdin {
@@ -87,6 +87,11 @@ pub struct PanicWriter {
8787

8888
impl io::Write for PanicWriter {
8989
fn write(&mut self, s: &[u8]) -> core::result::Result<usize, io::Error> {
90+
// Save the panic text in the kernel in groups of 6 words
91+
for c in s.chunks(core::mem::size_of::<usize>() * 6) {
92+
xous::append_panic_message(c).ok();
93+
}
94+
9095
for c in s.chunks(core::mem::size_of::<usize>() * 4) {
9196
// Text is grouped into 4x `usize` words. The id is 1100 plus
9297
// the number of characters in this message.

library/std/src/sys/pal/xous/thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl Thread {
3535
None,
3636
None,
3737
GUARD_PAGE_SIZE + stack_size + GUARD_PAGE_SIZE,
38-
MemoryFlags::R | MemoryFlags::W | MemoryFlags::X,
38+
MemoryFlags::W | MemoryFlags::X,
3939
)
4040
}
4141
.map_err(|code| io::Error::from_raw_os_error(code as i32))?;

library/std/src/sys/pal/xous/thread_local_key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn tls_table() -> &'static mut [*mut u8] {
104104
None,
105105
None,
106106
TLS_MEMORY_SIZE / core::mem::size_of::<*mut u8>(),
107-
MemoryFlags::R | MemoryFlags::W,
107+
MemoryFlags::W,
108108
)
109109
.expect("Unable to allocate memory for thread local storage")
110110
};

0 commit comments

Comments
 (0)