Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Thog committed Apr 7, 2019
1 parent b7548c0 commit 1d03043
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
24 changes: 10 additions & 14 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ script = ["cp linker-scripts/bootstrap.ld link.T"]
workspace = false
script = ["cp linker-scripts/kernel.ld link.T"]

[tasks.userspace-linker]
workspace = false
script = ["cp linker-scripts/userspace.ld link.T"]

[tasks.install-rust-src]
install_crate = { rustup_component_name = "rust-src" }

Expand Down Expand Up @@ -55,70 +51,70 @@ args = ["xbuild", "--target=i386-unknown-none", "--package=kfs-kernel", "--relea
[tasks.vi]
workspace = false
description = "Compiles kfs-vi"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=kfs-vi"]

[tasks.vi-release]
workspace = false
description = "Compiles kfs-vi"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=kfs-vi", "--release"]

[tasks.sm]
workspace = false
description = "Compiles kfs-sm"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=kfs-sm"]

[tasks.sm-release]
workspace = false
description = "Compiles kfs-sm"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=kfs-sm", "--release"]

[tasks.shell]
workspace = false
description = "Compiles kfs-shell"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=kfs-shell"]

[tasks.shell-release]
workspace = false
description = "Compiles kfs-shell"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=kfs-shell", "--release"]

[tasks.clock]
workspace = false
description = "Compiles kfs-clock"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=kfs-clock"]

[tasks.clock-release]
workspace = false
description = "Compiles kfs-clock"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=kfs-clock", "--release"]

[tasks.ahci]
workspace = false
description = "Compiles kfs-ahci"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=kfs-ahci"]

[tasks.ahci-release]
workspace = false
description = "Compiles kfs-ahci"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=kfs-ahci", "--release"]

Expand Down
2 changes: 1 addition & 1 deletion i386-unknown-none-user.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"linker-is-gnu": true,
"pre-link-args": {
"ld.lld": [
"-Tlink.T"
"-Tlinker-scripts/userspace.ld"
]
},
"executables": true,
Expand Down
1 change: 1 addition & 0 deletions libuser/src/crt0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub unsafe extern fn start() {
}

/// Clean module bss.
/// NOTE: Even if the bss should be cleared before calling anything in Rust, all functions used here are guaranteed to not use the bss.
#[cfg(target_os = "none")]
#[no_mangle]
#[link_section = ".text.crt0"]
Expand Down
15 changes: 9 additions & 6 deletions libuser/src/crt0/relocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,32 @@ mod module_header {
"#);
}

/// The definition of a MOD0 header.
/// The definition of a module header.
/// This is used by RTLD to do dynamic linking.
/// See https://switchbrew.org/wiki/NSO#MOD and https://switchbrew.org/wiki/Rtld
#[repr(C)]
#[derive(Debug)]
pub struct ModuleHeader {
/// The magic value of the MOD header.
pub magic: u32,

/// The offset of the dynamic section.
/// The offset of the dynamic section relative to ModuleHeader address.
pub dynamic_off: u32,

/// The offset of the start of the bss section.
/// The offset of the begining of the bss section relative to ModuleHeader address.
pub bss_start_off: u32,

/// The offset of the end of the bss section.
/// The offset of the end of the bss section relative to ModuleHeader address.
pub bss_end_off: u32,

/// The offset of the start of the eh_frame_hdr section.
/// The offset of the begining of the eh_frame_hdr section relative to ModuleHeader address.
pub unwind_start_off: u32,

/// The offset of the end of the eh_frame_hdr section.
/// The offset of the end of the eh_frame_hdr section relative to ModuleHeader address.
pub unwind_end_off: u32,

/// The offset of the module object that will be used by the rtld.
/// This offset is relative to ModuleHeader address.
pub module_object_off: u32
}

Expand Down

0 comments on commit 1d03043

Please sign in to comment.