Commit 01d3bc3d authored by Stefan Lankes's avatar Stefan Lankes
Browse files

experiments to use libhermit-rs as crate

parent d7419425
Pipeline #207943 failed with stages
in 7 seconds
......@@ -3,12 +3,20 @@
[[package]]
name = "bit_field"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "git+https://github.com/hermitcore/rust-bit-field.git?branch=hermit#76a803090c0b836094582431c4318dee89ce2e41"
dependencies = [
"compiler_builtins 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-std-workspace-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bitflags"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "git+https://github.com/hermitcore/bitflags.git?branch=hermit#8381fe363cf4ad74c4b81295b70b45f3abd70f78"
dependencies = [
"compiler_builtins 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-std-workspace-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cc"
......@@ -19,6 +27,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"compiler_builtins 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-std-workspace-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "compiler_builtins"
......@@ -31,26 +43,39 @@ dependencies = [
[[package]]
name = "log"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "git+https://github.com/hermitcore/log.git?branch=hermit#bd48cf7e9f3163d8f14c224563e5d6569401fb52"
dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-std-workspace-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "multiboot"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
version = "0.5.0"
source = "git+https://github.com/hermitcore/rust-multiboot.git?branch=hermit#782f9b333d065c5027662f7b5eca48aae66fcf73"
dependencies = [
"compiler_builtins 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-std-workspace-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "raw-cpuid"
version = "7.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "git+https://github.com/hermitcore/rust-cpuid.git?branch=hermit#8e24f4d90117517bd793d27d3e203d0969661747"
dependencies = [
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (git+https://github.com/hermitcore/bitflags.git?branch=hermit)",
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-std-workspace-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustc-std-workspace-alloc"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rustc-std-workspace-core"
version = "1.0.0"
......@@ -68,12 +93,13 @@ dependencies = [
name = "rusty-hermit"
version = "0.3.11"
dependencies = [
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (git+https://github.com/hermitcore/bitflags.git?branch=hermit)",
"compiler_builtins 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"multiboot 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (git+https://github.com/hermitcore/log.git?branch=hermit)",
"multiboot 0.5.0 (git+https://github.com/hermitcore/rust-multiboot.git?branch=hermit)",
"rustc-std-workspace-alloc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-std-workspace-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"x86 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)",
"x86 0.27.0 (git+https://github.com/hermitcore/rust-x86.git?branch=hermit)",
]
[[package]]
......@@ -92,24 +118,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "x86"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "git+https://github.com/hermitcore/rust-x86.git?branch=hermit#f6643e9c32636aa964f5e56bb2ca002716ae50da"
dependencies = [
"bit_field 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"raw-cpuid 7.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bit_field 0.10.0 (git+https://github.com/hermitcore/rust-bit-field.git?branch=hermit)",
"bitflags 1.2.1 (git+https://github.com/hermitcore/bitflags.git?branch=hermit)",
"compiler_builtins 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
"raw-cpuid 7.0.3 (git+https://github.com/hermitcore/rust-cpuid.git?branch=hermit)",
"rustc-std-workspace-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[metadata]
"checksum bit_field 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a165d606cf084741d4ac3a28fb6e9b1eb0bd31f6cd999098cfddb0b2ab381dc0"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum bit_field 0.10.0 (git+https://github.com/hermitcore/rust-bit-field.git?branch=hermit)" = "<none>"
"checksum bitflags 1.2.1 (git+https://github.com/hermitcore/bitflags.git?branch=hermit)" = "<none>"
"checksum cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "0213d356d3c4ea2c18c40b037c3be23cd639825c18f25ee670ac7813beeef99c"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum compiler_builtins 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "4e32b9fc11fdb3aefbd0a4761a8d3a2b7419608b759fa14a26525df4ea5deaba"
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
"checksum multiboot 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "745e351d4f128ea9e266fe2dd04a1bd7349c60441d45ec8677520bae08e25d43"
"checksum raw-cpuid 7.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4a349ca83373cfa5d6dbb66fd76e58b2cca08da71a5f6400de0a0a6a9bceeaf"
"checksum log 0.4.8 (git+https://github.com/hermitcore/log.git?branch=hermit)" = "<none>"
"checksum multiboot 0.5.0 (git+https://github.com/hermitcore/rust-multiboot.git?branch=hermit)" = "<none>"
"checksum raw-cpuid 7.0.3 (git+https://github.com/hermitcore/rust-cpuid.git?branch=hermit)" = "<none>"
"checksum rustc-std-workspace-alloc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff66d57013a5686e1917ed6a025d54dd591fcda71a41fe07edf4d16726aefa86"
"checksum rustc-std-workspace-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1956f5517128a2b6f23ab2dadf1a976f4f5b27962e7724c2bf3d45e539ec098c"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum x86 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)" = "271bc2de3f2f7a7c416377205b86e2ed1098eddfbc44098a1e1ac41d50951e7a"
"checksum x86 0.27.0 (git+https://github.com/hermitcore/rust-x86.git?branch=hermit)" = "<none>"
......@@ -25,25 +25,32 @@ name = "hermit"
[features]
vga = []
newlib = []
rustc-dep-of-std = ['core', 'compiler_builtins/rustc-dep-of-std']
rustc-dep-of-std = ['core', 'compiler_builtins/rustc-dep-of-std', 'compiler_builtins/mem', 'x86/rustc-dep-of-std', 'log/rustc-dep-of-std', 'bitflags/rustc-dep-of-std', 'multiboot/rustc-dep-of-std']
[target.'cfg(target_arch = "x86_64")']
rustflags = ["-C", "target-features", "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float"]
[dependencies]
core = { version = '1.0.0', optional = true, package = 'rustc-std-workspace-core' }
alloc = { version = '1.0.0', package = 'rustc-std-workspace-alloc' }
compiler_builtins = { version = '0.1.10', optional = true }
bitflags = "1.2"
#cfg-if = "0.1"
#byteorder = { version = "1.0", default-features = false }
bitflags = { git = "https://github.com/hermitcore/bitflags.git", branch = "hermit" }
[dependencies.log]
version = "0.4"
git = "https://github.com/hermitcore/log.git"
branch = "hermit"
#version = "0.4"
default-features = false
#features = ["release_max_level_info"]
[target.'cfg(target_arch = "x86_64")'.dependencies.multiboot]
version = "0.*"
git = "https://github.com/hermitcore/rust-multiboot.git"
branch = "hermit"
[target.'cfg(target_arch = "x86_64")'.dependencies.x86]
version = "0.*"
#version = "0.*"
git = "https://github.com/hermitcore/rust-x86.git"
branch = "hermit"
default-features = false
[package.metadata.cargo-xbuild]
......
......@@ -37,10 +37,10 @@ pub struct ExceptionStackFrame {
}
impl fmt::Debug for ExceptionStackFrame {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
struct Hex(u64);
impl fmt::Debug for Hex {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:#x}", self.0)
}
}
......
......@@ -13,7 +13,7 @@ use core::sync::atomic::{AtomicBool, Ordering};
use core::{ptr, str};
use drivers::net::NetworkInterface;
use synch;
use syscalls::sys_sem_post;
//use syscalls::sys_sem_post;
#[cfg(target_arch = "x86_64")]
use arch::x86_64::kernel::apic;
......@@ -68,9 +68,9 @@ impl NetworkInterface for UhyveNetwork {
fn set_polling(&mut self, mode: bool) {
self.polling.store(mode, Ordering::SeqCst);
if mode && !self.sem.is_null() {
/*if mode && !self.sem.is_null() {
sys_sem_post(self.sem as *const synch::semaphore::Semaphore);
}
}*/
}
fn init(
......
......@@ -23,6 +23,7 @@
#![allow(clippy::cognitive_complexity)]
#![allow(clippy::forget_copy)]
#![feature(abi_x86_interrupt)]
#![feature(alloc_error_handler)]
#![feature(allocator_api)]
#![feature(asm)]
#![feature(const_fn)]
......@@ -40,7 +41,6 @@
extern crate std;
// EXTERNAL CRATES
#[macro_use]
extern crate alloc;
#[macro_use]
extern crate bitflags;
......@@ -68,7 +68,7 @@ mod kernel_message_buffer;
mod mm;
mod runtime_glue;
mod scheduler;
mod synch;
pub mod synch;
mod syscalls;
pub use arch::*;
......
......@@ -12,7 +12,7 @@ use log::{set_logger, set_max_level, LevelFilter, Metadata, Record};
struct KernelLogger;
impl log::Log for KernelLogger {
fn enabled(&self, _: &Metadata) -> bool {
fn enabled(&self, _: &Metadata<'_>) -> bool {
true
}
......@@ -20,7 +20,7 @@ impl log::Log for KernelLogger {
// nothing to do
}
fn log(&self, record: &Record) {
fn log(&self, record: &Record<'_>) {
if self.enabled(record.metadata()) {
println!(
"[{}][{}] {}",
......
......@@ -220,6 +220,7 @@ pub fn print_information() {
arch::mm::virtualmem::print_information();
}
#[allow(dead_code)]
pub fn allocate_iomem(sz: usize) -> usize {
let size = align_up!(sz, BasePageSize::SIZE);
......
......@@ -16,7 +16,7 @@ use core::panic::PanicInfo;
// see https://users.rust-lang.org/t/psa-breaking-change-panic-fmt-language-item-removed-in-favor-of-panic-implementation/17875
#[cfg(not(test))]
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
fn panic(info: &PanicInfo<'_>) -> ! {
print!("[{}][!!!PANIC!!!] ", arch::percore::core_id());
if let Some(location) = info.location() {
......@@ -35,8 +35,8 @@ fn panic(info: &PanicInfo) -> ! {
}
#[cfg(not(test))]
#[lang = "oom"]
#[no_mangle]
#[doc(hidden)]
#[alloc_error_handler]
pub fn rust_oom(layout: Layout) -> ! {
println!(
"[{}][!!!OOM!!!] Memory allocation of {} bytes failed",
......
......@@ -53,7 +53,7 @@ pub struct Spinlock<T: ?Sized> {
/// A guard to which the protected data can be accessed
///
/// When the guard falls out of scope it will release the lock.
pub struct SpinlockGuard<'a, T: ?Sized + 'a> {
pub struct SpinlockGuard<'a, T: ?Sized> {
//queue: &'a AtomicUsize,
dequeue: &'a AtomicUsize,
data: &'a mut T,
......@@ -90,7 +90,7 @@ impl<T: ?Sized> Spinlock<T> {
}
}
pub fn lock(&self) -> SpinlockGuard<T> {
pub fn lock(&self) -> SpinlockGuard<'_, T> {
self.obtain_lock();
SpinlockGuard {
//queue: &self.queue,
......@@ -176,7 +176,7 @@ pub struct SpinlockIrqSave<T: ?Sized> {
/// A guard to which the protected data can be accessed
///
/// When the guard falls out of scope it will release the lock.
pub struct SpinlockIrqSaveGuard<'a, T: ?Sized + 'a> {
pub struct SpinlockIrqSaveGuard<'a, T: ?Sized> {
//queue: &'a AtomicUsize,
dequeue: &'a AtomicUsize,
irq: &'a AtomicBool,
......@@ -219,7 +219,7 @@ impl<T: ?Sized> SpinlockIrqSave<T> {
self.irq.store(irq, Ordering::SeqCst);
}
pub fn lock(&self) -> SpinlockIrqSaveGuard<T> {
pub fn lock(&self) -> SpinlockIrqSaveGuard<'_, T> {
self.obtain_lock();
SpinlockIrqSaveGuard {
//queue: &self.queue,
......
......@@ -12,8 +12,11 @@ mod interfaces;
mod lwip;
mod processor;
mod random;
#[cfg(feature = "newlib")]
mod recmutex;
#[cfg(feature = "newlib")]
mod semaphore;
#[cfg(feature = "newlib")]
mod spinlock;
mod system;
mod tasks;
......@@ -22,8 +25,11 @@ mod timer;
pub use self::condvar::*;
pub use self::processor::*;
pub use self::random::*;
#[cfg(feature = "newlib")]
pub use self::recmutex::*;
#[cfg(feature = "newlib")]
pub use self::semaphore::*;
#[cfg(feature = "newlib")]
pub use self::spinlock::*;
pub use self::system::*;
pub use self::tasks::*;
......
......@@ -20,7 +20,7 @@ pub struct SpinlockIrqSaveContainer<'a> {
}
#[no_mangle]
pub extern "C" fn sys_spinlock_init(lock: *mut *mut SpinlockContainer) -> i32 {
pub extern "C" fn sys_spinlock_init(lock: *mut *mut SpinlockContainer<'_>) -> i32 {
if lock.is_null() {
return -EINVAL;
}
......@@ -36,7 +36,7 @@ pub extern "C" fn sys_spinlock_init(lock: *mut *mut SpinlockContainer) -> i32 {
}
#[no_mangle]
pub extern "C" fn sys_spinlock_destroy(lock: *mut SpinlockContainer) -> i32 {
pub extern "C" fn sys_spinlock_destroy(lock: *mut SpinlockContainer<'_>) -> i32 {
if lock.is_null() {
return -EINVAL;
}
......@@ -49,7 +49,7 @@ pub extern "C" fn sys_spinlock_destroy(lock: *mut SpinlockContainer) -> i32 {
}
#[no_mangle]
pub extern "C" fn sys_spinlock_lock(lock: *mut SpinlockContainer) -> i32 {
pub extern "C" fn sys_spinlock_lock(lock: *mut SpinlockContainer<'_>) -> i32 {
if lock.is_null() {
return -EINVAL;
}
......@@ -64,7 +64,7 @@ pub extern "C" fn sys_spinlock_lock(lock: *mut SpinlockContainer) -> i32 {
}
#[no_mangle]
pub extern "C" fn sys_spinlock_unlock(lock: *mut SpinlockContainer) -> i32 {
pub extern "C" fn sys_spinlock_unlock(lock: *mut SpinlockContainer<'_>) -> i32 {
if lock.is_null() {
return -EINVAL;
}
......@@ -79,7 +79,7 @@ pub extern "C" fn sys_spinlock_unlock(lock: *mut SpinlockContainer) -> i32 {
}
#[no_mangle]
pub extern "C" fn sys_spinlock_irqsave_init(lock: *mut *mut SpinlockIrqSaveContainer) -> i32 {
pub extern "C" fn sys_spinlock_irqsave_init(lock: *mut *mut SpinlockIrqSaveContainer<'_>) -> i32 {
if lock.is_null() {
return -EINVAL;
}
......@@ -95,7 +95,7 @@ pub extern "C" fn sys_spinlock_irqsave_init(lock: *mut *mut SpinlockIrqSaveConta
}
#[no_mangle]
pub extern "C" fn sys_spinlock_irqsave_destroy(lock: *mut SpinlockIrqSaveContainer) -> i32 {
pub extern "C" fn sys_spinlock_irqsave_destroy(lock: *mut SpinlockIrqSaveContainer<'_>) -> i32 {
if lock.is_null() {
return -EINVAL;
}
......@@ -108,7 +108,7 @@ pub extern "C" fn sys_spinlock_irqsave_destroy(lock: *mut SpinlockIrqSaveContain
}
#[no_mangle]
pub extern "C" fn sys_spinlock_irqsave_lock(lock: *mut SpinlockIrqSaveContainer) -> i32 {
pub extern "C" fn sys_spinlock_irqsave_lock(lock: *mut SpinlockIrqSaveContainer<'_>) -> i32 {
if lock.is_null() {
return -EINVAL;
}
......@@ -123,7 +123,7 @@ pub extern "C" fn sys_spinlock_irqsave_lock(lock: *mut SpinlockIrqSaveContainer)
}
#[no_mangle]
pub extern "C" fn sys_spinlock_irqsave_unlock(lock: *mut SpinlockIrqSaveContainer) -> i32 {
pub extern "C" fn sys_spinlock_irqsave_unlock(lock: *mut SpinlockIrqSaveContainer<'_>) -> i32 {
if lock.is_null() {
return -EINVAL;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment