kernel/loader: fix build arguments

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-08-18 12:10:46 +08:00
parent 9f6d018e20
commit 0ca7fe6f12
5 changed files with 28 additions and 10 deletions

View file

@ -1,16 +1,22 @@
[target.riscv32i-unknown-none-elf]
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker-plugin-lto=yes",
"-C", "force-frame-pointers=no",
]
[target.riscv32imac-unknown-none-elf]
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker-plugin-lto=yes",
"-C", "force-frame-pointers=no",
]
[target.riscv32imac-unknown-xous-elf]
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker-plugin-lto=yes",
"-C", "force-frame-pointers=no",
]
[build]

View file

@ -17,6 +17,7 @@ riscv = "0.5.6"
[features]
debug-print = []
report-memory = ["stats_alloc"]
#default = ["debug-print"]
[target.'cfg(any(windows, unix))'.dependencies]
lazy_static = "1.4"
@ -27,5 +28,4 @@ debug-here = "0.2.2"
[profile.release]
codegen-units = 1 # 1 better optimizations
debug = true # symbols are nice and they don't increase the size on Flash
lto = thin
force-frame-pointers = no
lto = "thin"

View file

@ -164,7 +164,9 @@ impl MemoryManager {
#[cfg(all(baremetal, feature = "print-debug"))]
pub fn print_ownership(&self) {
println!("Ownership ({} bytes in all):", unsafe { MEMORY_ALLOCATIONS.len() });
println!("Ownership ({} bytes in all):", unsafe {
MEMORY_ALLOCATIONS.len()
});
let mut offset = 0;
unsafe {
@ -342,7 +344,8 @@ impl MemoryManager {
) -> Result<xous_kernel::MemoryRange, xous_kernel::Error> {
// If no address was specified, pick the next address that fits
// in the "default" range
let virt = self.find_virtual_address(virt_ptr, size, xous_kernel::MemoryType::Default)? as usize;
let virt =
self.find_virtual_address(virt_ptr, size, xous_kernel::MemoryType::Default)? as usize;
if virt & 0xfff != 0 {
return Err(xous_kernel::Error::BadAlignment);
@ -363,10 +366,16 @@ impl MemoryManager {
/// Attempt to allocate a single page from the default section.
/// Note that this will be backed by a real page.
#[cfg(baremetal)]
pub fn map_zeroed_page(&mut self, pid: PID, is_user: bool) -> Result<*mut usize, xous_kernel::Error> {
let virt =
self.find_virtual_address(core::ptr::null_mut(), PAGE_SIZE, xous_kernel::MemoryType::Default)?
as usize;
pub fn map_zeroed_page(
&mut self,
pid: PID,
is_user: bool,
) -> Result<*mut usize, xous_kernel::Error> {
let virt = self.find_virtual_address(
core::ptr::null_mut(),
PAGE_SIZE,
xous_kernel::MemoryType::Default,
)? as usize;
// Grab the next available page. This claims it for this process.
let phys = self.alloc_page(pid)?;

View file

@ -1,9 +1,13 @@
[target.riscv32i-unknown-none-elf]
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker-plugin-lto=yes",
"-C", "force-frame-pointers=no",
]
[target.riscv32imac-unknown-none-elf]
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker-plugin-lto=yes",
"-C", "force-frame-pointers=no",
]

View file

@ -18,5 +18,4 @@ earlyprintk = []
[profile.release]
codegen-units = 1 # 1 better optimizations
debug = true # symbols are nice and they don't increase the size on Flash
lto = thin
force-frame-pointers = no
lto = "thin"