Skip to content

Commit bb87470

Browse files
committed
fix(zemu): add a couple of "safety" pics
chore: add optimization profiles in workspace manifest
1 parent 4f8c0a6 commit bb87470

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Cargo.toml

+9
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,12 @@ members = [
55
]
66

77
resolver = "2"
8+
9+
[profile.dev]
10+
panic = "abort"
11+
12+
[profile.release]
13+
lto = false
14+
codegen-units = 1
15+
debug = true
16+
opt-level = "z"

zemu/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub(self) mod bindings {
3333
pub fn zemu_log(_s: &str) {
3434
#[cfg(zemu_sdk)]
3535
unsafe {
36+
let _s = bolos_sys::pic::PIC::new(_s).into_inner();
3637
let p = _s.as_bytes().as_ptr();
3738
bindings::zemu_log(p)
3839
}
@@ -41,6 +42,7 @@ pub fn zemu_log(_s: &str) {
4142
pub fn zemu_log_stack(_s: &str) {
4243
#[cfg(zemu_sdk)]
4344
unsafe {
45+
let _s = bolos_sys::pic::PIC::new(_s).into_inner();
4446
let p = _s.as_bytes().as_ptr();
4547
bindings::zemu_log_stack(p)
4648
}

zemu/src/ui_toolkit/backends/nanos.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ impl UIBackend<KEY_SIZE> for NanoSBackend {
7373
}
7474

7575
fn message_buf(&self) -> Self::MessageBuf {
76-
ArrayString::from_byte_string(&[0; MESSAGE_SIZE]).expect("0x00 is not valid utf8?")
76+
let init = PIC::new(&[0; MESSAGE_SIZE]).into_inner();
77+
ArrayString::from_byte_string(init).expect("0x00 is not valid utf8?")
7778
}
7879

7980
fn split_value_field(&mut self, message_buf: Self::MessageBuf) {

0 commit comments

Comments
 (0)