Set up things so that a std binary can be built in cache_utils

This commit is contained in:
guillaume didier 2020-03-09 14:27:32 +01:00
parent a176033851
commit 639299175f
7 changed files with 66 additions and 4 deletions

45
Cargo.lock generated
View File

@ -32,11 +32,23 @@ dependencies = [
name = "cache_utils"
version = "0.1.0"
dependencies = [
"nix 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polling_serial 0.1.0",
"static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"vga_buffer 0.1.0",
"x86_64 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cc"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "dendrobates_tinctoreus_azureus"
version = "0.1.0"
@ -60,6 +72,11 @@ dependencies = [
"spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libc"
version = "0.2.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "linked_list_allocator"
version = "0.7.0"
@ -76,6 +93,18 @@ dependencies = [
"scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "nix"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "polling_serial"
version = "0.1.0"
@ -103,6 +132,11 @@ dependencies = [
"lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "vga_buffer"
version = "0.1.0"
@ -112,6 +146,11 @@ dependencies = [
"volatile 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "volatile"
version = "0.2.6"
@ -132,11 +171,17 @@ dependencies = [
"checksum bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed8765909f9009617974ab6b7d332625b320b33c326b1e9321382ef1999b5d56"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum bootloader 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "37b4577f46430d7dd1f16fa13a3aab5e3b57fe9ce7ff4378aa6b184e268eb60e"
"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)" = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018"
"checksum linked_list_allocator 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "411991593f041990abf72f6715903fe67770e710e3c95a6d2e98a7550270136a"
"checksum lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b"
"checksum nix 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363"
"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
"checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
"checksum spinning_top 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32d801a3a53bcf5071f85fef8d5cab9e5f638fc5580a37e6eb7aba4b37438d24"
"checksum static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum volatile 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6af0edf5b4faacc31fc51159244d78d65ec580f021afcef7bd53c04aeabc7f29"
"checksum x86_64 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7467ff985c75f098f9897ea693141dbb25c8a5ceaf91e4a28ab705765932efb6"

View File

@ -29,7 +29,7 @@ vga_buffer = { path = "vga_buffer" }
polling_serial = { path = "polling_serial" }
volatile = "0.2.6"
linked_list_allocator = "0.7.0"
cache_utils = { path = "cache_utils" }
cache_utils = { path = "cache_utils", features = ["no_std"], default-features = false }
arrayref = "0.3.6"
[dependencies.lazy_static]

View File

@ -0,0 +1,2 @@
[build]
target = "x86_64-unknown-linux-gnu"

View File

@ -7,6 +7,15 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
polling_serial = { path = "../polling_serial" }
vga_buffer = { path = "../vga_buffer" }
polling_serial = { path = "../polling_serial", optional = true }
vga_buffer = { path = "../vga_buffer", optional = true }
x86_64 = "0.9.2"
static_assertions = "1.1.0"
nix = { version = "0.17.0", optional = true }
[features]
std = ["nix"]
no_std = ["polling_serial", "vga_buffer"]
default = ["std"]

View File

@ -1,4 +1,6 @@
use crate::{flush, maccess, rdtsc_fence};
#[cfg(feature = "no_std")]
use polling_serial::serial_println as println;
extern crate alloc;

View File

@ -1,4 +1,4 @@
#![no_std]
#![cfg_attr(feature = "no_std", no_std)]
pub mod cache_info;
pub mod calibration;

View File

@ -1,2 +1,6 @@
// TODO create a nice program that can run on a system and will do the calibration.
// Make multithreaded, with core pinning or single threaded pinned to cores from the shell ?
pub fn main() {
println!("Hello World!");
}