mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
inconsistencies in cargo fmt
running `cargo +nightly fmt -p app-loader` gives you one result. running `cargo +nightly fmt --check` gives you another result. manually opening and saving the files causes a result to agree with the check.
This commit is contained in:
parent
00bb37186a
commit
710da30952
2 changed files with 4 additions and 12 deletions
|
|
@ -22,10 +22,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put the linker script somewhere the linker can find it
|
// Put the linker script somewhere the linker can find it
|
||||||
fs::File::create(out_dir.join("link.x"))
|
fs::File::create(out_dir.join("link.x")).unwrap().write_all(include_bytes!("link.x")).unwrap();
|
||||||
.unwrap()
|
|
||||||
.write_all(include_bytes!("link.x"))
|
|
||||||
.unwrap();
|
|
||||||
println!("cargo:rustc-link-search={}", out_dir.display());
|
println!("cargo:rustc-link-search={}", out_dir.display());
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed=build.rs");
|
println!("cargo:rerun-if-changed=build.rs");
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ pub extern "C" fn init(server1: u32, server2: u32, server3: u32, server4: u32) -
|
||||||
StartupCommand::LoadElf => {
|
StartupCommand::LoadElf => {
|
||||||
let entry_point = read_elf(envelope.body.memory_message_mut());
|
let entry_point = read_elf(envelope.body.memory_message_mut());
|
||||||
drop(envelope); // we have to get rid of all messages to destroy the server
|
drop(envelope); // we have to get rid of all messages to destroy the server
|
||||||
// destroy the server
|
// destroy the server
|
||||||
xous::destroy_server(server).expect("Couldn't destroy spawn server");
|
xous::destroy_server(server).expect("Couldn't destroy spawn server");
|
||||||
jump(entry_point);
|
jump(entry_point);
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +90,7 @@ fn read_elf(memory: Option<&mut xous::MemoryMessage>) -> usize {
|
||||||
|
|
||||||
// get the elf binary from the message
|
// get the elf binary from the message
|
||||||
// safety: buf should be aligned and correctly sized inside the MemoryMessage
|
// safety: buf should be aligned and correctly sized inside the MemoryMessage
|
||||||
let mut bin = unsafe {memory.buf.as_slice::<u8>()};
|
let mut bin = unsafe { memory.buf.as_slice::<u8>() };
|
||||||
|
|
||||||
// go to the beginning of the ELF file using the provided offset
|
// go to the beginning of the ELF file using the provided offset
|
||||||
bin = &bin[memory.offset.and_then(|n| Some(n.get())).unwrap_or(0)..];
|
bin = &bin[memory.offset.and_then(|n| Some(n.get())).unwrap_or(0)..];
|
||||||
|
|
@ -132,12 +132,7 @@ fn read_elf(memory: Option<&mut xous::MemoryMessage>) -> usize {
|
||||||
let file_size = to_usize(start + 0x10, 4);
|
let file_size = to_usize(start + 0x10, 4);
|
||||||
let mem_size = to_usize(start + 0x14, 4);
|
let mem_size = to_usize(start + 0x14, 4);
|
||||||
let mem_size = mem_size + padding;
|
let mem_size = mem_size + padding;
|
||||||
let mem_size = mem_size
|
let mem_size = mem_size + if mem_size & 0xFFF == 0 { 0 } else { 0x1000 - (mem_size & 0xFFF) };
|
||||||
+ if mem_size & 0xFFF == 0 {
|
|
||||||
0
|
|
||||||
} else {
|
|
||||||
0x1000 - (mem_size & 0xFFF)
|
|
||||||
};
|
|
||||||
|
|
||||||
assert_eq!(0, mem_size & 0xFFF);
|
assert_eq!(0, mem_size & 0xFFF);
|
||||||
assert_eq!(0, (vaddr - padding) & 0xFFF);
|
assert_eq!(0, (vaddr - padding) & 0xFFF);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue