build.rs: clean up and rewrite using proc-quote + minor tweaks

add vendor repository
parent de0f6d70
cargo-fel4-dummy
target
vendor
debug
sel4/.cargo/env
[submodule "external/sel4"]
path = external/sel4
url = ../sel4-rbg
branch = rbg-hacks-10.1.0
url = ../sel4
[submodule "external/ixy.rs"]
path = external/ixy.rs
url = https://github.com/ixy-languages/ixy.rs
[submodule "external/ixy"]
path = external/ixy
url = https://github.com/emmericp/ixy
[submodule "vendor"]
path = vendor
url = ../vendor
......@@ -103,6 +103,11 @@ dependencies = [
"cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "compiler_builtins"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "embedded-hal"
version = "0.2.2"
......@@ -192,6 +197,16 @@ name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "proc-macro-hack"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro2"
version = "0.3.5"
......@@ -200,6 +215,35 @@ dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro2"
version = "0.4.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-quote"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-quote-impl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-quote-impl"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quick-error"
version = "1.2.2"
......@@ -213,6 +257,14 @@ dependencies = [
"proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quote"
version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "redox_syscall"
version = "0.1.40"
......@@ -262,6 +314,8 @@ dependencies = [
"cmake 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"embedded-hal 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"nb 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-quote 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"roxmltree 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_morph 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"test 0.1.0 (git+https://github.com/japaric/utest)",
......@@ -284,6 +338,16 @@ name = "strsim"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "syn"
version = "0.15.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "termcolor"
version = "1.0.4"
......@@ -361,6 +425,13 @@ name = "vec_map"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "vendor-hack"
version = "0.0.0"
dependencies = [
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "version_check"
version = "0.1.5"
......@@ -432,6 +503,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum clang-sys 0.26.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b5ca71038e58142b85c1b4f06a61f3b7a6e3ca035330a249f80164d37ea44de0"
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
"checksum cmake 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "6ec65ee4f9c9d16f335091d23693457ed4928657ba4982289d7fafee03bc614a"
"checksum compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6711d51cb46744dd8305293cc3fbc392aaff7a8f5095a7c4fae1e5113ef07c96"
"checksum embedded-hal 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9880e55238830314d41d88f1ac7a819d495799c3cc3bc392cc172bab26428c33"
"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
......@@ -444,9 +516,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum nb 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "69f380b5fe9fab8c0d7a6a99cda23e2cc0463bedb2cbc3aada0813b98496ecdc"
"checksum nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9c349f68f25f596b9f44cf0e7c69752a5c633b0550c3ff849518bfba0233774a"
"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
"checksum proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3e90aa19cd73dedc2d0e1e8407473f073d735fef0ab521438de6da8ee449ab66"
"checksum proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "77997c53ae6edd6d187fec07ec41b207063b5ee6f33680e9fa86d405cdd313d4"
"checksum proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "38fddd23d98b2144d197c0eca5705632d4fe2667d14a6be5df8934f8d74f1978"
"checksum proc-quote 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41ef1a65cb655bad43159b8cf577c57e35081a8f421317c4bd59bb3d4387553e"
"checksum proc-quote-impl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b395d8e0c477058bc1f044b96230a66107b1df44a2b136370b5cb7470b8b3301"
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
"checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8"
"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1"
"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1"
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
"checksum regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ee84f70c8c08744ea9641a731c7fadb475bf2ecc52d7f627feb833e0b3990467"
......@@ -455,6 +532,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef"
"checksum string_morph 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "183aaf7fa637cc7b5f54c45b8f7cb6e8d73831f9f75a56b6defa5bf8c51d1699"
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9"
"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
"checksum test 0.1.0 (git+https://github.com/japaric/utest)" = "<none>"
......
......@@ -2,7 +2,5 @@
members = [
"bitmap",
"sel4",
# "sel4-start",
# "cmake-rs",
# "bindgen",
"vendor-hack",
]
Subproject commit 5b3cfae0a76564ea6fdf97be5b1d18551b2c1a28
Subproject commit f88d58aa8dc599e372a6138a29df19e456eacf74
#!/bin/sh
objcopy -O elf32-i386 kernel.elf kernel-x86_64-pc99
source $CARGO_MANIFEST_DIR/.cargo/env
[[ -z "$OUT_DIR" ]] && echo \$OUT_DIR not found && exit
objcopy -O elf32-i386 $OUT_DIR/build/kernel.elf $OUT_DIR/build/kernel-x86_64-pc99
# -cpu Nehalem,kvm64,vme,vmx,fsgsbase,pdpe1gb,invpcid,pcid,xsaveopt,xsave,enforce \
qemu-system-x86_64 \
-cpu Nehalem,vme,vmx,fsgsbase,pdpe1gb,invpcid,pcid,xsaveopt,xsave,enforce \
-machine q35,accel=kvm \
-nographic \
-kernel $CARGO_MANIFEST_DIR/kernel-x86_64-pc99 \
-kernel $OUT_DIR/build/kernel-x86_64-pc99 \
-initrd $@
......@@ -27,3 +27,5 @@ string_morph = "*"
cmake = "*"
toml = "*"
bindgen = "*"
proc-quote = "*"
proc-macro2 = "*"
......@@ -18,6 +18,6 @@ $ cargo run --example hello-world --features root-task
.If KernelVTX is enabled:
----
# rmmod intel_kvm kvm
# modprobe intel_kvm nested=1
# rmmod kvm_intel kvm
# modprobe kmv_intel nested=1
----
This diff is collapsed.
......@@ -19,7 +19,7 @@ impl IOPort<u8> for (u16, sel4::X86IOPort) {
fn write(&mut self, offset: u16, word: u8) -> nb::Result<(), Self::Error> {
self.1
.write8(self.0 + offset, word)
.write8((self.0 + offset) as usize, word as usize)
.map_err(nb::Error::Other)
}
}
......
use core::{intrinsics, panic};
use core::{intrinsics, panic, sync};
#[panic_handler]
fn panic_handler(_: &panic::PanicInfo) -> ! {
......@@ -12,7 +12,7 @@ fn eh_personality() -> ! {
#[lang = "oom"]
fn oom(_layout: core::alloc::Layout) -> ! {
unsafe { core::intrinsics::abort() }
unsafe { intrinsics::abort() }
}
#[lang = "termination"]
......@@ -37,7 +37,7 @@ fn lang_start<T: Termination>(main: fn() -> T, _argc: isize, _argv: *const *cons
#[no_mangle]
pub unsafe extern "C" fn __sel4_start_init_boot_info(bootinfo: *mut ()) {
use core::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
use sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
static RUN_ONCE: AtomicBool = ATOMIC_BOOL_INIT;
......
use core::mem;
use crate::{Error, Time};
use crate::Error;
/// An unowned capability pointer. Use `Cap` for owned handles.
#[derive(Clone, Copy)]
pub struct CPtr(pub(crate) usize);
pub struct CPtr(crate usize);
/// An owned CPtr. Unsafe to construct and safe to invoke.
pub struct Cap(CPtr);
......@@ -124,157 +122,3 @@ impl Cap {
unimplemented!()
}
}
pub(crate) trait ReaderWriter {
const DATA_SIZE: usize;
const CAPS_SIZE: usize;
fn read(words: &mut &[usize], caps: &mut &[CPtr]) -> Self;
fn write(&self, words: &mut &mut [usize], caps: &mut &mut [CPtr]);
}
impl<T> ReaderWriter for T
where
T: AsRef<Cap> + From<Cap>,
{
const DATA_SIZE: usize = 0;
const CAPS_SIZE: usize = 1;
#[inline]
fn write(&self, _words: &mut &mut [usize], caps: &mut &mut [CPtr]) {
let (l, r) = mem::replace(caps, &mut []).split_at_mut(Self::CAPS_SIZE);
*caps = r;
l[0] = self.as_ref().as_cptr();
}
#[inline]
fn read(_words: &mut &[usize], caps: &mut &[CPtr]) -> Self {
let (l, r) = mem::replace(caps, &[]).split_at(Self::CAPS_SIZE);
*caps = r;
T::from(Cap(l[0]))
}
}
impl ReaderWriter for CPtr {
const DATA_SIZE: usize = 0;
const CAPS_SIZE: usize = 1;
#[inline]
fn write(&self, _words: &mut &mut [usize], caps: &mut &mut [CPtr]) {
let (l, r) = mem::replace(caps, &mut []).split_at_mut(Self::CAPS_SIZE);
*caps = r;
l[0] = *self;
}
#[inline]
fn read(_words: &mut &[usize], caps: &mut &[CPtr]) -> Self {
let (l, r) = mem::replace(caps, &[]).split_at(Self::CAPS_SIZE);
*caps = r;
l[0]
}
}
impl ReaderWriter for Cap {
const DATA_SIZE: usize = 0;
const CAPS_SIZE: usize = 1;
#[inline]
fn write(&self, _words: &mut &mut [usize], caps: &mut &mut [CPtr]) {
let (l, r) = mem::replace(caps, &mut []).split_at_mut(Self::CAPS_SIZE);
*caps = r;
l[0] = self.as_cptr();
}
#[inline]
fn read(_words: &mut &[usize], caps: &mut &[CPtr]) -> Self {
let (l, r) = mem::replace(caps, &[]).split_at(Self::CAPS_SIZE);
*caps = r;
unsafe { Cap::from_cptr(l[0]) }
}
}
impl ReaderWriter for Time {
const DATA_SIZE: usize = 1;
const CAPS_SIZE: usize = 0;
#[inline]
fn write(&self, words: &mut &mut [usize], _caps: &mut &mut [CPtr]) {
let (l, r) = mem::replace(words, &mut []).split_at_mut(Self::DATA_SIZE);
*words = r;
l[0] = self.0 as usize;
}
#[inline]
fn read(words: &mut &[usize], _caps: &mut &[CPtr]) -> Self {
let (l, r) = mem::replace(words, &[]).split_at(Self::DATA_SIZE);
*words = r;
Time(l[0] as u64)
}
}
impl ReaderWriter for usize {
const DATA_SIZE: usize = 1;
const CAPS_SIZE: usize = 0;
#[inline]
fn write(&self, words: &mut &mut [usize], _caps: &mut &mut [CPtr]) {
let (l, r) = mem::replace(words, &mut []).split_at_mut(Self::DATA_SIZE);
*words = r;
l[0] = *self;
}
#[inline]
fn read(words: &mut &[usize], _caps: &mut &[CPtr]) -> Self {
let (l, r) = mem::replace(words, &[]).split_at(Self::DATA_SIZE);
*words = r;
l[0]
}
}
impl ReaderWriter for bool {
const DATA_SIZE: usize = 1;
const CAPS_SIZE: usize = 0;
#[inline]
fn write(&self, words: &mut &mut [usize], _caps: &mut &mut [CPtr]) {
let (l, r) = mem::replace(words, &mut []).split_at_mut(Self::DATA_SIZE);
*words = r;
l[0] = *self as usize;
}
#[inline]
fn read(words: &mut &[usize], _caps: &mut &[CPtr]) -> Self {
let (l, r) = mem::replace(words, &[]).split_at(Self::DATA_SIZE);
*words = r;
l[0] == 1
}
}
macro_rules! simple {
($($tt:tt)*) => {
$(
impl ReaderWriter for $tt {
const DATA_SIZE: usize = 1;
const CAPS_SIZE: usize = 0;
#[inline]
fn write(&self, words: &mut &mut [usize], _caps: &mut &mut [CPtr]) {
let (l, r) = mem::replace(words, &mut [])
.split_at_mut(Self::DATA_SIZE);
*words = r;
l[0] = *self as usize;
}
#[inline]
fn read(words: &mut &[usize], _caps: &mut &[CPtr]) -> Self {
let (l, r) = mem::replace(words, &[])
.split_at(Self::DATA_SIZE);
*words = r;
l[0] as $tt
}
}
)*
}
}
simple!(isize u8 i8 u16 i16 u32 i32 u64 i64);
use crate::*;
// 10.1.0 does not use mcs-style reply
//
// A reply should borrow the endpoint. Conveniently no mutability is necessary, so there may exist
// many reply-handles.
// A reply should borrow the endpoint to prevent receiving without explicitly deciding to either
// invoke, drop, or stash a reply capability.
impl Endpoint {}
#![feature(asm, doc_cfg)]
#![feature(
asm,
doc_cfg,
crate_visibility_modifier,
const_raw_ptr_to_usize_cast,
const_raw_ptr_deref
)]
#![no_std]
#![cfg_attr(feature = "cargo-clippy", warn(unsafe_code))]
......@@ -8,22 +14,33 @@ compile_error!("target_os /= sel4. Did you forget --target x86_64-sel4-robigalia
#[cfg(not(target_arch = "x86_64"))]
compile_error!("target_arch /= x86_64. Sorry, this sel4 crate only supports x86_64 for now.");
#[allow(non_camel_case_types)]
#[allow(non_camel_case_types, dead_code)]
mod c_types {
pub type c_uint = u32;
pub type c_int = i32;
pub type c_ulong = u64;
pub type c_long = u32;
pub type c_uchar = u8;
pub type c_char = i8;
pub type c_schar = i8;
pub type c_ushort = u16;
pub type c_short = i16;
pub type c_ulonglong = u64;
pub type c_longlong = i64;
}
#[allow(
non_snake_case
non_camel_case_types
non_snake_case,
non_camel_case_types,
clippy::needless_pass_by_value,
clippy::unused_unit,
clippy::too_many_arguments
)]
mod generated {
use core::mem;
use crate::cap::ReaderWriter;
use crate::*;
include!(concat!(env!("OUT_DIR"), "/generated.rs"));
......@@ -33,9 +50,7 @@ mod cap;
mod debug;
mod endpoint;
mod notification;
#[cfg(target_os = "sel4")]
mod syscalls;
use crate::cap::ReaderWriter;
pub use crate::cap::{CPtr, Cap};
pub use crate::debug::Debug;
pub use crate::generated::*;
......@@ -106,7 +121,8 @@ impl TCB {
suspend_source: bool,
arch_flags: u8,
) -> Result<UserContext, Error> {
self.read_registers_internal(suspend_source, arch_flags, UserContext::DATA_SIZE)
unimplemented!()
// self.read_registers_internal(suspend_source, arch_flags, UserContext::DATA_SIZE)
}
// OVERRIDE: TCB::write_registers
......@@ -117,12 +133,13 @@ impl TCB {
arch_flags: u8,
user_context: UserContext,
) -> Result<(), Error> {
self.write_registers_internal(
suspend_source,
arch_flags,
UserContext::DATA_SIZE,
user_context,
)
unimplemented!()
// self.write_registers_internal(
// suspend_source,
// arch_flags,
// UserContext::DATA_SIZE,
// user_context,
// )
}
// OVERRIDE-: TCB::get_breakpoint
......@@ -137,7 +154,8 @@ impl SchedContext {
// WEAK: should only accept TCB or Notification
cap: impl AsRef<Cap>,
) -> Result<(), Error> {
self.bind_internal(cap.as_ref().as_cptr())
unimplemented!()
// self.bind_internal(cap.as_ref().as_cptr())
}
// OVERRIDE: SchedContext::unbind_object
......@@ -146,7 +164,8 @@ impl SchedContext {
// WEAK: should only accept TCB or Notification
cap: impl AsRef<Cap>,
) -> Result<(), Error> {
self.unbind_object_internal(cap.as_ref().as_cptr())
unimplemented!()
// self.unbind_object_internal(cap.as_ref().as_cptr())
}
}
......
<!--
Copyright 2017, Data61
Commonwealth Scientific and Industrial Research Organisation (CSIRO)
ABN 41 687 119 230.
This software may be distributed and modified according to the terms of
the BSD 2-Clause license. Note that NO WARRANTY is provided.
See "LICENSE_BSD2.txt" for details.
@TAG(DATA61_BSD)
-->
<!ELEMENT api (struct*,interface*)>
<!ATTLIST api name CDATA #IMPLIED>
<!ATTLIST api label_prefix CDATA #IMPLIED>
<!ELEMENT struct (member*)>
<!ATTLIST struct name CDATA #REQUIRED>
<!ELEMENT member EMPTY>
<!ATTLIST member name CDATA #REQUIRED>
<!ELEMENT interface (method*)>
<!ATTLIST interface name CDATA #REQUIRED>
<!ATTLIST interface manual_name CDATA #IMPLIED>
<!ATTLIST interface cap_description CDATA #IMPLIED>
<!ELEMENT method (brief?,description?,return?,cap_param?,param*)>
<!ATTLIST method name CDATA #REQUIRED>
<!ATTLIST method id CDATA #REQUIRED>
<!ATTLIST method condition CDATA #IMPLIED>
<!ATTLIST method manual_name CDATA #IMPLIED>
<!ATTLIST method manual_label CDATA #IMPLIED>
<!ELEMENT param ANY>
<!ATTLIST param type CDATA #REQUIRED>
<!ATTLIST param name CDATA #REQUIRED>
<!ATTLIST param dir CDATA #REQUIRED>
<!ATTLIST param description CDATA #IMPLIED>
<!ELEMENT brief ANY>
<!ELEMENT description ANY>
<!ELEMENT return ANY>
<!ELEMENT docref ANY>
<!ELEMENT texttt EMPTY>
<!ATTLIST texttt text CDATA #REQUIRED>
<!ELEMENT autoref EMPTY>
<!ATTLIST autoref label CDATA #REQUIRED>
<!ELEMENT shortref EMPTY>
<!ATTLIST shortref sec CDATA #REQUIRED>
<!ELEMENT obj EMPTY>
<!ATTLIST obj name CDATA #REQUIRED>
<!ELEMENT errorenumdesc EMPTY>
<!ELEMENT cap_param EMPTY>
<!ATTLIST cap_param append_description CDATA #IMPLIED>
#![allow(dead_code, clippy::too_many_arguments)]
use core::{mem, slice};
use crate::generated::{seL4_IPCBuffer, Syscall};
use crate::CPtr;
// TODO: generate these...
#[repr(isize)]
#[derive(Debug)]
pub enum Syscall {
Call = -1,
ReplyRecv = -2,
NBSendRecv = -3,
NBSendWait = -4,
Send = -5,
NBSend = -6,
Recv = -7,
NBRecv = -8,
Wait = -9,
NBWait = -10,
Yield = -11,
DebugPutChar = -12,
DebugHalt = -13,
DebugCapIdentify = -14,
DebugSnapshot = -15,
DebugNameThread = -16,
DebugRun = -17,
BenchmarkFlushCaches = -18,
BenchmarkResetLog = -19,
BenchmarkFinalizeLog = -20,
BenchmarkSetLogBuffer = -21,
BenchmarkNullSyscall = -22,
BenchmarkGetThreadUtilisation = -23,
BenchmarkResetThreadUtilisation = -24,
VMEnter = -25,
enum GS {}
impl GS {
#[inline]
unsafe fn read_ty<T>(offset: usize, buf: &mut T) {
assert_eq!(mem::align_of::<T>(), mem::align_of::<usize>());
let slice = slice::from_raw_parts_mut(
buf as *mut T as *mut usize,
mem::size_of_val(buf) / mem::size_of::<usize>(),
);
GS::read(offset, slice);
}
#[inline]
unsafe fn write_ty<T>(offset: usize, buf: &T) {
assert_eq!(mem::align_of::<T>(), mem::align_of::<usize>());
let slice = slice::from_raw_parts(
buf as *const T as *const usize,
mem::size_of_val(buf) / mem::size_of::<usize>(),
);
GS::write(offset, slice);
}
#[inline]
unsafe fn read(offset: usize, buf: &mut [usize]) {
// FIXME: use LLVM-IR for optimized @llvm.memcpy from address spaces 256 to 0
assert!(offset + buf.len() * 8 <= 256);
for (i, word) in buf.iter_mut().enumerate() {
asm!("movq %gs:${1:c}, $0"
: "=r"(*word)
: "ri"(offset + i * 8)
:
: "volatile"
);
}
}
#[inline]
unsafe fn write(offset: usize, buf: &[usize]) {
// FIXME: use LLVM-IR for optimized @llvm.memcpy from address spaces 0 to 256
assert!(offset + buf.len() * 8 <= 256);
for (i, word) in buf.iter().enumerate() {
asm!("movq $0, %gs:${1:c}"
:
: "ri"(*word), "ri"(offset + i * 8)
: "memory"
: "volatile"
);
}
}
}
#[inline(always)]
......
......@@ -7,8 +7,9 @@ unset RUSTFLAGS RUSTDOCFLAGS
TARGET=${1:-x86_64-sel4-robigalia}
which cargo-xrustc && SYSROOT=$(cargo xrustc --target $TARGET -- --print sysroot) \
|| which xargo && SYSROOT=$(xargo rustc --target $TARGET -- --print sysroot)
which cargo-xrustc > /dev/null && SYSROOT=$(cargo xrustc --target $TARGET -- --print sysroot)
which cargo-xrustc > /dev/null || { which xargo && \
SYSROOT=$(xargo rustc --target $TARGET -- --print sysroot) }
export RUSTFLAGS="--sysroot $SYSROOT"
export RUSTDOCFLAGS="$RUSTFLAGS"
......
Subproject commit 5934e1b48ff299d46df6d8e29a50cb7fb5da3b16
[package]
name = "vendor-hack"
version = "0.0.0"
publish = false
[lib]
path = "lib.rs"
[dependencies]
compiler_builtins = "*"
// dummy crate to convince cargo-vendor to fetch compiler-builtins
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