Merge branch 'master' into master

This commit is contained in:
Jean-Michel Picod
2020-09-22 17:15:04 +02:00
committed by GitHub
17 changed files with 117 additions and 54 deletions

View File

@@ -7,3 +7,10 @@ mod allocator;
mod panic_handler;
#[cfg(not(feature = "std"))]
mod util;
#[cfg(feature = "std")]
#[no_mangle]
unsafe fn libtock_alloc_init(_app_heap_start: usize, _app_heap_size: usize) {
// Stub so that the symbol is present.
unimplemented!()
}

View File

@@ -17,7 +17,7 @@ mod allow_nr {
pub const SHARE_BUFFER: usize = 1;
}
const BUFFER_SIZE: usize = 1024;
pub const BUFFER_SIZE: usize = 1024;
pub struct Console {
allow_buffer: [u8; BUFFER_SIZE],
@@ -70,11 +70,13 @@ impl Console {
// Clear the buffer even in case of error, to avoid an infinite loop.
self.count_pending = 0;
let result = syscalls::allow(
DRIVER_NUMBER,
allow_nr::SHARE_BUFFER,
&mut self.allow_buffer[..count],
);
Console::write_unbuffered(&mut self.allow_buffer[..count]);
}
pub fn write_unbuffered(buf: &mut [u8]) {
let count = buf.len();
let result = syscalls::allow(DRIVER_NUMBER, allow_nr::SHARE_BUFFER, buf);
if result.is_err() {
return;
}