Skip to content

Commit

Permalink
Change user target_os to sunrise
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Guillemard committed Aug 28, 2019
1 parent 84c2529 commit cc5bf90
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 42 deletions.
56 changes: 28 additions & 28 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,85 +72,85 @@ args = ["build", "--target=i386-unknown-none", "--package=sunrise-kernel", "--re
description = "Compiles sunrise-vi"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-vi"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-vi"]

[tasks.vi-release]
description = "Compiles sunrise-vi"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-vi", "--release"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-vi", "--release"]

[tasks.sm]
description = "Compiles sunrise-sm"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-sm"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-sm"]

[tasks.sm-release]
description = "Compiles sunrise-sm"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-sm", "--release"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-sm", "--release"]

[tasks.shell]
description = "Compiles sunrise-shell"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-shell"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-shell"]

[tasks.shell-release]
description = "Compiles sunrise-shell"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-shell", "--release"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-shell", "--release"]

[tasks.wall-clock]
description = "Compiles sunrise-wall-clock"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-wall-clock"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-wall-clock"]

[tasks.wall-clock-release]
description = "Compiles sunrise-wall-clock"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-wall-clock", "--release"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-wall-clock", "--release"]

[tasks.ahci]
description = "Compiles sunrise-ahci"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-ahci"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-ahci"]

[tasks.ahci-release]
description = "Compiles sunrise-ahci"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-ahci", "--release"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-ahci", "--release"]

[tasks.time]
description = "Compiles sunrise-time"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-time"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-time"]

[tasks.time-release]
description = "Compiles sunrise-time"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-time", "--release"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-time", "--release"]

[tasks.fs]
description = "Compiles sunrise-fs"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-fs"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-fs"]

[tasks.fs-release]
description = "Compiles sunrise-fs"
dependencies = ["install-xargo"]
command = "xargo"
args = ["build", "--target=i386-unknown-none-user", "--package=sunrise-fs", "--release"]
args = ["build", "--target=i386-unknown-sunrise-user", "--package=sunrise-fs", "--release"]

[tasks.userspace]
description = "Compiles userspace apps"
Expand All @@ -168,13 +168,13 @@ script = [
'''
cp target/i386-unknown-none/debug/sunrise-bootstrap isofiles/boot/
cp target/i386-unknown-none/debug/sunrise-kernel isofiles/boot/
cp target/i386-unknown-none-user/debug/sunrise-shell isofiles/boot/
cp target/i386-unknown-none-user/debug/sunrise-time isofiles/boot/
cp target/i386-unknown-none-user/debug/sunrise-wall-clock isofiles/boot/
cp target/i386-unknown-none-user/debug/sunrise-sm isofiles/boot/
cp target/i386-unknown-none-user/debug/sunrise-vi isofiles/boot/
cp target/i386-unknown-none-user/debug/sunrise-ahci isofiles/boot/
cp target/i386-unknown-none-user/debug/sunrise-fs isofiles/boot/
cp target/i386-unknown-sunrise-user/debug/sunrise-shell isofiles/boot/
cp target/i386-unknown-sunrise-user/debug/sunrise-time isofiles/boot/
cp target/i386-unknown-sunrise-user/debug/sunrise-wall-clock isofiles/boot/
cp target/i386-unknown-sunrise-user/debug/sunrise-sm isofiles/boot/
cp target/i386-unknown-sunrise-user/debug/sunrise-vi isofiles/boot/
cp target/i386-unknown-sunrise-user/debug/sunrise-ahci isofiles/boot/
cp target/i386-unknown-sunrise-user/debug/sunrise-fs isofiles/boot/
mkisofs-rs external/grub/isofiles isofiles -o os.iso -b boot/grub/i386-pc/eltorito.img --no-emul-boot --boot-info-table --embedded-boot external/grub/embedded.img
'''
]
Expand All @@ -187,13 +187,13 @@ script = [
'''
cp target/i386-unknown-none/release/sunrise-bootstrap isofiles/boot/
cp target/i386-unknown-none/release/sunrise-kernel isofiles/boot/
cp target/i386-unknown-none-user/release/sunrise-shell isofiles/boot/
cp target/i386-unknown-none-user/release/sunrise-time isofiles/boot/
cp target/i386-unknown-none-user/release/sunrise-wall-clock isofiles/boot/
cp target/i386-unknown-none-user/release/sunrise-sm isofiles/boot/
cp target/i386-unknown-none-user/release/sunrise-vi isofiles/boot/
cp target/i386-unknown-none-user/release/sunrise-ahci isofiles/boot/
cp target/i386-unknown-none-user/release/sunrise-fs isofiles/boot/
cp target/i386-unknown-sunrise-user/release/sunrise-shell isofiles/boot/
cp target/i386-unknown-sunrise-user/release/sunrise-time isofiles/boot/
cp target/i386-unknown-sunrise-user/release/sunrise-wall-clock isofiles/boot/
cp target/i386-unknown-sunrise-user/release/sunrise-sm isofiles/boot/
cp target/i386-unknown-sunrise-user/release/sunrise-vi isofiles/boot/
cp target/i386-unknown-sunrise-user/release/sunrise-ahci isofiles/boot/
cp target/i386-unknown-sunrise-user/release/sunrise-fs isofiles/boot/
mkisofs-rs external/grub/isofiles isofiles -o os.iso -b boot/grub/i386-pc/eltorito.img --no-emul-boot --boot-info-table --embedded-boot external/grub/embedded.img
'''
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"target-endian": "little",
"target-pointer-width": "32",
"target-c-int-width": "32",
"os": "none",
"os": "sunrise",
"linker": "rust-lld",
"linker-flavor": "ld.lld",
"linker-is-gnu": true,
Expand Down
4 changes: 2 additions & 2 deletions libuser/src/crt0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
pub mod relocation;

/// Executable entrypoint. Handle relocations and calls real_start.
#[cfg(target_os = "none")]
#[cfg(target_os = "sunrise")]
#[naked]
#[no_mangle]
#[link_section = ".text.crt0"]
Expand Down Expand Up @@ -54,7 +54,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")]
#[cfg(target_os = "sunrise")]
#[no_mangle]
#[link_section = ".text.crt0"]
pub unsafe extern fn clean_bss(module_header: *const relocation::ModuleHeader) {
Expand Down
2 changes: 1 addition & 1 deletion libuser/src/crt0/relocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ struct ElfRela {
const R_386_RELATIVE: usize = 8;

/// Handle basic relocation. Return a non zero value if failed.
#[cfg(target_os = "none")]
#[cfg(target_os = "sunrise")]
#[no_mangle]
#[allow(clippy::cast_ptr_alignment)]
pub unsafe extern fn relocate_self(aslr_base: *mut u8, module_headr: *const ModuleHeader) -> u32 {
Expand Down
16 changes: 8 additions & 8 deletions libuser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ use sunrise_libutils as utils;

/// Global allocator. Every implicit allocation in the rust liballoc library (for
/// instance for Vecs, Arcs, etc...) are allocated with this allocator.
#[cfg(any(all(target_os = "none", not(test)), rustdoc))]
#[cfg(any(all(target_os = "sunrise", not(test)), rustdoc))]
#[global_allocator]
static ALLOCATOR: allocator::Allocator = allocator::Allocator::new();

Expand All @@ -88,12 +88,12 @@ static ALLOCATOR: allocator::Allocator = allocator::Allocator::new();
/// The exception handling personality function for use in the bootstrap.
///
/// We currently have no userspace exception handling, so make it do nothing.
#[cfg(any(all(target_os = "none", not(test)), rustdoc))]
#[cfg(any(all(target_os = "sunrise", not(test)), rustdoc))]
#[lang = "eh_personality"] #[no_mangle] pub extern fn eh_personality() {}

/// Function called on `panic!` invocation. Prints the panic information to the
/// kernel debug logger, and exits the process.
#[cfg(any(all(target_os = "none", not(test)), rustdoc))]
#[cfg(any(all(target_os = "sunrise", not(test)), rustdoc))]
#[panic_handler] #[no_mangle]
pub extern fn panic_fmt(p: &core::panic::PanicInfo<'_>) -> ! {
let _ = syscalls::output_debug_string(&format!("{}", p), 10, "sunrise_libuser::panic_fmt");
Expand All @@ -106,7 +106,7 @@ use core::alloc::Layout;
// BODY: Panicking may allocate, so calling panic in the OOM handler is a
// BODY: terrible idea.
/// OOM handler. Causes a panic.
#[cfg(any(all(target_os = "none", not(test)), rustdoc))]
#[cfg(any(all(target_os = "sunrise", not(test)), rustdoc))]
#[lang = "oom"]
#[no_mangle]
pub fn rust_oom(_: Layout) -> ! {
Expand All @@ -115,7 +115,7 @@ pub fn rust_oom(_: Layout) -> ! {

/// calls logger initialization, main, and finally exits the
/// process.
#[cfg(any(all(target_os = "none", not(test)), rustdoc))]
#[cfg(any(all(target_os = "sunrise", not(test)), rustdoc))]
#[no_mangle]
pub unsafe extern fn real_start() -> ! {
extern {
Expand All @@ -135,21 +135,21 @@ pub unsafe extern fn real_start() -> ! {
///
/// The default implementations are returning 0 to indicate a successful
/// execution. In case of a failure, 1 is returned.
#[cfg(any(all(target_os = "none", not(test)), rustdoc))]
#[cfg(any(all(target_os = "sunrise", not(test)), rustdoc))]
#[lang = "termination"]
trait Termination {
/// Is called to get the representation of the value as status code.
/// This status code is returned to the operating system.
fn report(self) -> i32;
}

#[cfg(any(all(target_os = "none", not(test)), rustdoc))]
#[cfg(any(all(target_os = "sunrise", not(test)), rustdoc))]
impl Termination for () {
#[inline]
fn report(self) -> i32 { 0 }
}

#[cfg(any(all(target_os = "none", not(test)), rustdoc))]
#[cfg(any(all(target_os = "sunrise", not(test)), rustdoc))]
#[lang = "start"]
#[allow(clippy::unit_arg)]
fn main<T: Termination>(main: fn(), _argc: isize, _argv: *const *const u8) -> isize {
Expand Down
4 changes: 2 additions & 2 deletions libuser/src/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::error::KernelError;
// Assembly blob can't get documented, but clippy requires it.
#[allow(clippy::missing_docs_in_private_items)]
mod syscall_inner {
#[cfg(all(target_arch = "x86", target_os = "none", not(test)))]
#[cfg(all(target_arch = "x86", target_os = "sunrise", not(test)))]
global_asm!("
.intel_syntax noprefix
.global syscall_inner
Expand Down Expand Up @@ -55,7 +55,7 @@ syscall_inner:
");

// Should only be used for rustdocs!!!
#[cfg(not(target_os = "none"))]
#[cfg(not(target_os = "sunrise"))]
#[no_mangle]
extern fn syscall_inner(regs: &mut super::Registers) {
regs.eax = crate::error::KernelError::NotImplemented.make_ret() as usize;
Expand Down

0 comments on commit cc5bf90

Please sign in to comment.