diff --git a/Makefile.toml b/Makefile.toml index 59b010806..1d6efdc80 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -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" @@ -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 ''' ] @@ -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 ''' ] diff --git a/i386-unknown-none-user.json b/i386-unknown-sunrise-user.json similarity index 97% rename from i386-unknown-none-user.json rename to i386-unknown-sunrise-user.json index 7f9b6f109..cfe37c0a1 100644 --- a/i386-unknown-none-user.json +++ b/i386-unknown-sunrise-user.json @@ -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, diff --git a/libuser/src/crt0/mod.rs b/libuser/src/crt0/mod.rs index a835f9182..3ee3a345e 100644 --- a/libuser/src/crt0/mod.rs +++ b/libuser/src/crt0/mod.rs @@ -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"] @@ -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) { diff --git a/libuser/src/crt0/relocation.rs b/libuser/src/crt0/relocation.rs index bf13240b0..a56df8aa3 100644 --- a/libuser/src/crt0/relocation.rs +++ b/libuser/src/crt0/relocation.rs @@ -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 { diff --git a/libuser/src/lib.rs b/libuser/src/lib.rs index dc5f46dbf..b66789762 100644 --- a/libuser/src/lib.rs +++ b/libuser/src/lib.rs @@ -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(); @@ -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"); @@ -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) -> ! { @@ -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 { @@ -135,7 +135,7 @@ 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. @@ -143,13 +143,13 @@ trait Termination { 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(main: fn(), _argc: isize, _argv: *const *const u8) -> isize { diff --git a/libuser/src/syscalls.rs b/libuser/src/syscalls.rs index ab8070232..497285acd 100644 --- a/libuser/src/syscalls.rs +++ b/libuser/src/syscalls.rs @@ -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 @@ -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;