Fix target #[cfg]s

This commit is contained in:
Mark Poliakov 2024-03-03 01:59:05 +02:00
parent a057630186
commit c8399685ff
3 changed files with 5 additions and 4 deletions

View File

@ -10,10 +10,10 @@ authors = ["Mark Poliakov <mark@alnyan.me>"]
core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" }
compiler_builtins = { version = "0.1", optional = true }
[target.'cfg(unix)'.dependencies]
libc = { version = "0.2.140", default-features = false }
[target.'cfg(target_os = "yggdrasil")'.dependencies]
[target.'cfg(not(unix))'.dependencies]
yggdrasil-rt = { git = "https://git.alnyan.me/yggdrasil/yggdrasil-rt.git", default-features = false }
[features]

View File

@ -2,6 +2,7 @@
generic_const_exprs,
arbitrary_self_types,
strict_provenance,
exposed_provenance,
let_chains,
test,
allocator_api

View File

@ -49,7 +49,7 @@ pub fn map_pages(count: usize) -> Option<NonNull<u8>> {
NonNull::new(address as *mut u8)
}
#[cfg(target_os = "yggdrasil")]
#[cfg(not(unix))]
{
use yggdrasil_rt::mem::MappingSource;
@ -67,7 +67,7 @@ pub fn unmap_pages(address: NonNull<u8>, count: usize) {
unsafe {
libc::munmap(address.as_ptr() as _, count * PAGE_SIZE);
}
#[cfg(target_os = "yggdrasil")]
#[cfg(not(unix))]
{
unsafe {
yggdrasil_rt::sys::unmap_memory(address.addr().into(), count * PAGE_SIZE).unwrap();