mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-19 00:16:29 +08:00
firmware: update rust to 2021-09-01 nightly
This commit is contained in:
parent
c33c1df07f
commit
688e643078
107
artiq/firmware/Cargo.lock
generated
107
artiq/firmware/Cargo.lock
generated
@ -1,10 +1,13 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
|
# And yet, manual edits have been made. Crate yanking should be illegal.
|
||||||
|
version = 3
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "addr2line"
|
name = "addr2line"
|
||||||
version = "0.14.0"
|
version = "0.16.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7c0929d69e78dd9bf5408269919fcbcaeb2e35e5d43e5815517cdc6a8e11a423"
|
checksum = "3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cpp_demangle",
|
"cpp_demangle",
|
||||||
"fallible-iterator",
|
"fallible-iterator",
|
||||||
@ -28,15 +31,20 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ahash"
|
name = "ahash"
|
||||||
version = "0.4.8"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0453232ace82dee0dd0b4c87a59bd90f7b53b314f3e0f61fe2ee7c8a16482289"
|
checksum = "efa60d2eadd8b12a996add391db32bd1153eac697ba4869660c0016353611426"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
"once_cell",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
version = "0.7.15"
|
version = "0.7.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
|
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
@ -105,6 +113,7 @@ name = "bootloader"
|
|||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"addr2line",
|
"addr2line",
|
||||||
|
"ahash",
|
||||||
"board_misoc",
|
"board_misoc",
|
||||||
"build_misoc",
|
"build_misoc",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
@ -114,15 +123,18 @@ dependencies = [
|
|||||||
"dlmalloc",
|
"dlmalloc",
|
||||||
"fortanix-sgx-abi",
|
"fortanix-sgx-abi",
|
||||||
"getopts",
|
"getopts",
|
||||||
|
"getrandom",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
"hermit-abi",
|
"hermit-abi",
|
||||||
"libc 0.2.79",
|
"libc 0.2.99",
|
||||||
"memchr",
|
|
||||||
"miniz_oxide 0.4.0",
|
"miniz_oxide 0.4.0",
|
||||||
|
"object",
|
||||||
|
"once_cell",
|
||||||
"riscv",
|
"riscv",
|
||||||
"rustc-demangle",
|
"rustc-demangle",
|
||||||
"smoltcp",
|
"smoltcp",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
|
"version_check",
|
||||||
"wasi",
|
"wasi",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -144,9 +156,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.60"
|
version = "1.0.69"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c"
|
checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
@ -162,9 +174,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "compiler_builtins"
|
name = "compiler_builtins"
|
||||||
version = "0.1.39"
|
version = "0.1.49"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3748f82c7d366a0b4950257d19db685d4958d2fa27c6d164a3f069fec42b748b"
|
checksum = "20b1438ef42c655665a8ab2c1c6d605a305f031d38d9be689ddfef41a20f3aa2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cpp_demangle"
|
name = "cpp_demangle"
|
||||||
@ -205,7 +217,7 @@ version = "0.2.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "332570860c2edf2d57914987bf9e24835425f75825086b6ba7d1e6a3e4f1f254"
|
checksum = "332570860c2edf2d57914987bf9e24835425f75825086b6ba7d1e6a3e4f1f254"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.79",
|
"libc 0.2.99",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -265,7 +277,7 @@ name = "fringe"
|
|||||||
version = "1.2.1"
|
version = "1.2.1"
|
||||||
source = "git+https://git.m-labs.hk/M-Labs/libfringe.git?rev=3ecbe5#3ecbe53f7644b18ee46ebd5b2ca12c9cbceec43a"
|
source = "git+https://git.m-labs.hk/M-Labs/libfringe.git?rev=3ecbe5#3ecbe53f7644b18ee46ebd5b2ca12c9cbceec43a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.79",
|
"libc 0.2.99",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -278,10 +290,21 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gimli"
|
name = "getrandom"
|
||||||
version = "0.23.0"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce"
|
checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 0.1.10",
|
||||||
|
"libc 0.2.99",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gimli"
|
||||||
|
version = "0.25.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fallible-iterator",
|
"fallible-iterator",
|
||||||
"stable_deref_trait",
|
"stable_deref_trait",
|
||||||
@ -289,20 +312,20 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.9.0"
|
version = "0.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7"
|
checksum = "362385356d610bd1e5a408ddf8d022041774b683f345a1d2cfcb4f60f8ae2db5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.1.17"
|
version = "0.1.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
|
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.79",
|
"libc 0.2.99",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -343,9 +366,9 @@ version = "0.1.0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.79"
|
version = "0.2.99"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743"
|
checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
@ -385,9 +408,9 @@ checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.3.4"
|
version = "2.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
|
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
@ -409,14 +432,20 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "object"
|
name = "object"
|
||||||
version = "0.22.0"
|
version = "0.26.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397"
|
checksum = "39f37e50073ccad23b6d09bcb5b263f4e76d3bb6038e4a3c08e52162ffa8abc2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"flate2",
|
"flate2",
|
||||||
"wasmparser",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proto_artiq"
|
name = "proto_artiq"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
@ -439,9 +468,9 @@ checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.4.6"
|
version = "1.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759"
|
checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
@ -503,9 +532,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-demangle"
|
name = "rustc-demangle"
|
||||||
version = "0.1.18"
|
version = "0.1.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232"
|
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc_version"
|
name = "rustc_version"
|
||||||
@ -638,14 +667,14 @@ dependencies = [
|
|||||||
"unwind",
|
"unwind",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version_check"
|
||||||
|
version = "0.9.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.9.0+wasi-snapshot-preview1"
|
version = "0.9.0+wasi-snapshot-preview1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasmparser"
|
|
||||||
version = "0.57.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "32fddd575d477c6e9702484139cf9f23dcd554b06d185ed0f56c857dd3a47aa6"
|
|
||||||
|
@ -20,18 +20,23 @@ smoltcp = { version = "0.8.2", default-features = false, features = ["medium-eth
|
|||||||
riscv = { version = "0.6.0", features = ["inline-asm"] }
|
riscv = { version = "0.6.0", features = ["inline-asm"] }
|
||||||
|
|
||||||
# insanity required by using cargo build-std over xbuild with nix
|
# insanity required by using cargo build-std over xbuild with nix
|
||||||
|
# cargo update does not work thanks to ahash 0.7 problems
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
getopts = "=0.2.21"
|
getopts = "=0.2.21"
|
||||||
libc = "=0.2.79"
|
libc = "=0.2.99"
|
||||||
unicode-width = "=0.1.8"
|
unicode-width = "=0.1.8"
|
||||||
addr2line = "=0.14.0"
|
addr2line = "=0.16.0"
|
||||||
memchr = "=2.3.4"
|
hashbrown = "=0.11.0" # must be injected into lockfile manually
|
||||||
hashbrown = "=0.9.0"
|
ahash = "=0.7.0" # must be injected into lockfile manually
|
||||||
miniz_oxide = "=0.4.0"
|
miniz_oxide = "=0.4.0"
|
||||||
rustc-demangle = "=0.1.18"
|
rustc-demangle = "=0.1.21"
|
||||||
hermit-abi = "=0.1.17"
|
hermit-abi = "=0.1.19"
|
||||||
dlmalloc = "=0.2.1"
|
dlmalloc = "=0.2.1"
|
||||||
wasi = "=0.9.0"
|
|
||||||
fortanix-sgx-abi = "=0.3.3"
|
fortanix-sgx-abi = "=0.3.3"
|
||||||
cc = "=1.0.60"
|
cc = "=1.0.69"
|
||||||
compiler_builtins = "=0.1.39"
|
compiler_builtins = "=0.1.49"
|
||||||
|
version_check = "=0.9.3"
|
||||||
|
once_cell = "=1.8.0"
|
||||||
|
wasi = "=0.9.0"
|
||||||
|
getrandom = "=0.2.0"
|
||||||
|
object = "=0.26.2"
|
@ -55,12 +55,14 @@ struct ExceptionBuffer {
|
|||||||
exception_count: usize,
|
exception_count: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
static mut EXCEPTION_BUFFER: ExceptionBuffer = ExceptionBuffer {
|
const EXCEPTION: uw::_Unwind_Exception = uw::_Unwind_Exception {
|
||||||
uw_exceptions: [uw::_Unwind_Exception {
|
|
||||||
exception_class: EXCEPTION_CLASS,
|
exception_class: EXCEPTION_CLASS,
|
||||||
exception_cleanup: cleanup,
|
exception_cleanup: cleanup,
|
||||||
private: [0; uw::unwinder_private_data_size],
|
private: [0; uw::unwinder_private_data_size],
|
||||||
}; MAX_INFLIGHT_EXCEPTIONS],
|
};
|
||||||
|
|
||||||
|
static mut EXCEPTION_BUFFER: ExceptionBuffer = ExceptionBuffer {
|
||||||
|
uw_exceptions: [EXCEPTION; MAX_INFLIGHT_EXCEPTIONS],
|
||||||
exceptions: [None; MAX_INFLIGHT_EXCEPTIONS + 1],
|
exceptions: [None; MAX_INFLIGHT_EXCEPTIONS + 1],
|
||||||
exception_stack: [-1; MAX_INFLIGHT_EXCEPTIONS + 1],
|
exception_stack: [-1; MAX_INFLIGHT_EXCEPTIONS + 1],
|
||||||
backtrace: [(0, 0); MAX_BACKTRACE_SIZE],
|
backtrace: [(0, 0); MAX_BACKTRACE_SIZE],
|
||||||
@ -74,11 +76,7 @@ static mut EXCEPTION_BUFFER: ExceptionBuffer = ExceptionBuffer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub unsafe extern fn reset_exception_buffer(payload_addr: usize) {
|
pub unsafe extern fn reset_exception_buffer(payload_addr: usize) {
|
||||||
EXCEPTION_BUFFER.uw_exceptions = [uw::_Unwind_Exception {
|
EXCEPTION_BUFFER.uw_exceptions = [EXCEPTION; MAX_INFLIGHT_EXCEPTIONS];
|
||||||
exception_class: EXCEPTION_CLASS,
|
|
||||||
exception_cleanup: cleanup,
|
|
||||||
private: [0; uw::unwinder_private_data_size],
|
|
||||||
}; MAX_INFLIGHT_EXCEPTIONS];
|
|
||||||
EXCEPTION_BUFFER.exceptions = [None; MAX_INFLIGHT_EXCEPTIONS + 1];
|
EXCEPTION_BUFFER.exceptions = [None; MAX_INFLIGHT_EXCEPTIONS + 1];
|
||||||
EXCEPTION_BUFFER.exception_stack = [-1; MAX_INFLIGHT_EXCEPTIONS + 1];
|
EXCEPTION_BUFFER.exception_stack = [-1; MAX_INFLIGHT_EXCEPTIONS + 1];
|
||||||
EXCEPTION_BUFFER.backtrace_size = 0;
|
EXCEPTION_BUFFER.backtrace_size = 0;
|
||||||
@ -151,8 +149,7 @@ pub extern fn personality(version: c_int,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[export_name="__artiq_raise"]
|
#[export_name="__artiq_raise"]
|
||||||
#[unwind(allowed)]
|
pub unsafe extern "C-unwind" fn raise(exception: *const Exception) -> ! {
|
||||||
pub unsafe extern fn raise(exception: *const Exception) -> ! {
|
|
||||||
let count = EXCEPTION_BUFFER.exception_count;
|
let count = EXCEPTION_BUFFER.exception_count;
|
||||||
let stack = &mut EXCEPTION_BUFFER.exception_stack;
|
let stack = &mut EXCEPTION_BUFFER.exception_stack;
|
||||||
let diff = exception as isize - EXCEPTION_BUFFER.exceptions.as_ptr() as isize;
|
let diff = exception as isize - EXCEPTION_BUFFER.exceptions.as_ptr() as isize;
|
||||||
@ -222,8 +219,7 @@ pub unsafe extern fn raise(exception: *const Exception) -> ! {
|
|||||||
|
|
||||||
|
|
||||||
#[export_name="__artiq_resume"]
|
#[export_name="__artiq_resume"]
|
||||||
#[unwind(allowed)]
|
pub unsafe extern "C-unwind" fn resume() -> ! {
|
||||||
pub unsafe extern fn resume() -> ! {
|
|
||||||
assert!(EXCEPTION_BUFFER.exception_count != 0);
|
assert!(EXCEPTION_BUFFER.exception_count != 0);
|
||||||
let i = EXCEPTION_BUFFER.exception_stack[EXCEPTION_BUFFER.exception_count - 1];
|
let i = EXCEPTION_BUFFER.exception_stack[EXCEPTION_BUFFER.exception_count - 1];
|
||||||
assert!(i != -1);
|
assert!(i != -1);
|
||||||
@ -233,8 +229,7 @@ pub unsafe extern fn resume() -> ! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[export_name="__artiq_end_catch"]
|
#[export_name="__artiq_end_catch"]
|
||||||
#[unwind(allowed)]
|
pub unsafe extern "C-unwind" fn end_catch() {
|
||||||
pub unsafe extern fn end_catch() {
|
|
||||||
let mut count = EXCEPTION_BUFFER.exception_count;
|
let mut count = EXCEPTION_BUFFER.exception_count;
|
||||||
assert!(count != 0);
|
assert!(count != 0);
|
||||||
// we remove all exceptions with SP <= current exception SP
|
// we remove all exceptions with SP <= current exception SP
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#![feature(lang_items, llvm_asm, panic_unwind, libc, unwind_attributes,
|
#![feature(lang_items, asm, panic_unwind, libc,
|
||||||
panic_info_message, nll, const_in_array_repeat_expressions)]
|
panic_info_message, nll, c_unwind)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
@ -30,8 +30,9 @@ fn send(request: &Message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn recv<R, F: FnOnce(&Message) -> R>(f: F) -> R {
|
fn recv<R, F: FnOnce(&Message) -> R>(f: F) -> R {
|
||||||
while mailbox::receive() == 0 {}
|
let mut msg_ptr = 0;
|
||||||
let result = f(unsafe { &*(mailbox::receive() as *const Message) });
|
while msg_ptr == 0 { msg_ptr = mailbox::receive(); }
|
||||||
|
let result = f(unsafe { &*(msg_ptr as *const Message) });
|
||||||
mailbox::acknowledge();
|
mailbox::acknowledge();
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
@ -121,7 +122,6 @@ pub extern fn send_to_rtio_log(text: CSlice<u8>) {
|
|||||||
rtio::log(text.as_ref())
|
rtio::log(text.as_ref())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(aborts)]
|
|
||||||
extern fn rpc_send(service: u32, tag: &CSlice<u8>, data: *const *const ()) {
|
extern fn rpc_send(service: u32, tag: &CSlice<u8>, data: *const *const ()) {
|
||||||
while !rpc_queue::empty() {}
|
while !rpc_queue::empty() {}
|
||||||
send(&RpcSend {
|
send(&RpcSend {
|
||||||
@ -132,7 +132,6 @@ extern fn rpc_send(service: u32, tag: &CSlice<u8>, data: *const *const ()) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(aborts)]
|
|
||||||
extern fn rpc_send_async(service: u32, tag: &CSlice<u8>, data: *const *const ()) {
|
extern fn rpc_send_async(service: u32, tag: &CSlice<u8>, data: *const *const ()) {
|
||||||
while rpc_queue::full() {}
|
while rpc_queue::full() {}
|
||||||
rpc_queue::enqueue(|mut slice| {
|
rpc_queue::enqueue(|mut slice| {
|
||||||
@ -170,8 +169,7 @@ extern fn rpc_send_async(service: u32, tag: &CSlice<u8>, data: *const *const ())
|
|||||||
/// to the maximum required for any of the possible types according to the target ABI).
|
/// to the maximum required for any of the possible types according to the target ABI).
|
||||||
///
|
///
|
||||||
/// If the RPC call resulted in an exception, it is reconstructed and raised.
|
/// If the RPC call resulted in an exception, it is reconstructed and raised.
|
||||||
#[unwind(allowed)]
|
extern "C-unwind" fn rpc_recv(slot: *mut ()) -> usize {
|
||||||
extern fn rpc_recv(slot: *mut ()) -> usize {
|
|
||||||
send(&RpcRecvRequest(slot));
|
send(&RpcRecvRequest(slot));
|
||||||
recv!(&RpcRecvReply(ref result) => {
|
recv!(&RpcRecvReply(ref result) => {
|
||||||
match result {
|
match result {
|
||||||
@ -203,7 +201,6 @@ fn terminate(exceptions: &'static [Option<eh_artiq::Exception<'static>>],
|
|||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(aborts)]
|
|
||||||
extern fn cache_get<'a>(key: &CSlice<u8>) -> *const CSlice<'a, i32> {
|
extern fn cache_get<'a>(key: &CSlice<u8>) -> *const CSlice<'a, i32> {
|
||||||
send(&CacheGetRequest {
|
send(&CacheGetRequest {
|
||||||
key: str::from_utf8(key.as_ref()).unwrap()
|
key: str::from_utf8(key.as_ref()).unwrap()
|
||||||
@ -213,8 +210,7 @@ extern fn cache_get<'a>(key: &CSlice<u8>) -> *const CSlice<'a, i32> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(allowed)]
|
extern "C-unwind" fn cache_put(key: &CSlice<u8>, list: &CSlice<i32>) {
|
||||||
extern fn cache_put(key: &CSlice<u8>, list: &CSlice<i32>) {
|
|
||||||
send(&CachePutRequest {
|
send(&CachePutRequest {
|
||||||
key: str::from_utf8(key.as_ref()).unwrap(),
|
key: str::from_utf8(key.as_ref()).unwrap(),
|
||||||
value: list.as_ref()
|
value: list.as_ref()
|
||||||
@ -247,8 +243,7 @@ fn dma_record_flush() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(allowed)]
|
extern "C-unwind" fn dma_record_start(name: &CSlice<u8>) {
|
||||||
extern fn dma_record_start(name: &CSlice<u8>) {
|
|
||||||
let name = str::from_utf8(name.as_ref()).unwrap();
|
let name = str::from_utf8(name.as_ref()).unwrap();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -267,8 +262,7 @@ extern fn dma_record_start(name: &CSlice<u8>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(allowed)]
|
extern "C-unwind" fn dma_record_stop(duration: i64, enable_ddma: bool) {
|
||||||
extern fn dma_record_stop(duration: i64, enable_ddma: bool) {
|
|
||||||
unsafe {
|
unsafe {
|
||||||
dma_record_flush();
|
dma_record_flush();
|
||||||
|
|
||||||
@ -290,7 +284,6 @@ extern fn dma_record_stop(duration: i64, enable_ddma: bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(aborts)]
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
unsafe fn dma_record_output_prepare(timestamp: i64, target: i32,
|
unsafe fn dma_record_output_prepare(timestamp: i64, target: i32,
|
||||||
words: usize) -> &'static mut [u8] {
|
words: usize) -> &'static mut [u8] {
|
||||||
@ -327,7 +320,6 @@ unsafe fn dma_record_output_prepare(timestamp: i64, target: i32,
|
|||||||
data
|
data
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(aborts)]
|
|
||||||
extern fn dma_record_output(target: i32, word: i32) {
|
extern fn dma_record_output(target: i32, word: i32) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let timestamp = ((csr::rtio::now_hi_read() as i64) << 32) | (csr::rtio::now_lo_read() as i64);
|
let timestamp = ((csr::rtio::now_hi_read() as i64) << 32) | (csr::rtio::now_lo_read() as i64);
|
||||||
@ -341,7 +333,6 @@ extern fn dma_record_output(target: i32, word: i32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(aborts)]
|
|
||||||
extern fn dma_record_output_wide(target: i32, words: &CSlice<i32>) {
|
extern fn dma_record_output_wide(target: i32, words: &CSlice<i32>) {
|
||||||
assert!(words.len() <= 16); // enforce the hardware limit
|
assert!(words.len() <= 16); // enforce the hardware limit
|
||||||
|
|
||||||
@ -360,7 +351,6 @@ extern fn dma_record_output_wide(target: i32, words: &CSlice<i32>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(aborts)]
|
|
||||||
extern fn dma_erase(name: &CSlice<u8>) {
|
extern fn dma_erase(name: &CSlice<u8>) {
|
||||||
let name = str::from_utf8(name.as_ref()).unwrap();
|
let name = str::from_utf8(name.as_ref()).unwrap();
|
||||||
|
|
||||||
@ -374,8 +364,7 @@ struct DmaTrace {
|
|||||||
uses_ddma: bool,
|
uses_ddma: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(allowed)]
|
extern "C-unwind" fn dma_retrieve(name: &CSlice<u8>) -> DmaTrace {
|
||||||
extern fn dma_retrieve(name: &CSlice<u8>) -> DmaTrace {
|
|
||||||
let name = str::from_utf8(name.as_ref()).unwrap();
|
let name = str::from_utf8(name.as_ref()).unwrap();
|
||||||
|
|
||||||
send(&DmaRetrieveRequest { name: name });
|
send(&DmaRetrieveRequest { name: name });
|
||||||
@ -396,8 +385,7 @@ extern fn dma_retrieve(name: &CSlice<u8>) -> DmaTrace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(kernel_has_rtio_dma)]
|
#[cfg(kernel_has_rtio_dma)]
|
||||||
#[unwind(allowed)]
|
extern "C-unwind" fn dma_playback(timestamp: i64, ptr: i32, _uses_ddma: bool) {
|
||||||
extern fn dma_playback(timestamp: i64, ptr: i32, _uses_ddma: bool) {
|
|
||||||
assert!(ptr % 64 == 0);
|
assert!(ptr % 64 == 0);
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -454,15 +442,13 @@ extern fn dma_playback(timestamp: i64, ptr: i32, _uses_ddma: bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(not(kernel_has_rtio_dma), not(has_rtio_dma)))]
|
#[cfg(all(not(kernel_has_rtio_dma), not(has_rtio_dma)))]
|
||||||
#[unwind(allowed)]
|
extern "C-unwind" fn dma_playback(_timestamp: i64, _ptr: i32, _uses_ddma: bool) {
|
||||||
extern fn dma_playback(_timestamp: i64, _ptr: i32, _uses_ddma: bool) {
|
|
||||||
unimplemented!("not(kernel_has_rtio_dma)")
|
unimplemented!("not(kernel_has_rtio_dma)")
|
||||||
}
|
}
|
||||||
|
|
||||||
// for satellite (has_rtio_dma but not in kernel)
|
// for satellite (has_rtio_dma but not in kernel)
|
||||||
#[cfg(all(not(kernel_has_rtio_dma), has_rtio_dma))]
|
#[cfg(all(not(kernel_has_rtio_dma), has_rtio_dma))]
|
||||||
#[unwind(allowed)]
|
extern "C-unwind" fn dma_playback(timestamp: i64, ptr: i32, _uses_ddma: bool) {
|
||||||
extern fn dma_playback(timestamp: i64, ptr: i32, _uses_ddma: bool) {
|
|
||||||
// DDMA is always used on satellites, so the `uses_ddma` setting is ignored
|
// DDMA is always used on satellites, so the `uses_ddma` setting is ignored
|
||||||
// StartRemoteRequest reused as "normal" start request
|
// StartRemoteRequest reused as "normal" start request
|
||||||
send(&DmaStartRemoteRequest { id: ptr as i32, timestamp: timestamp });
|
send(&DmaStartRemoteRequest { id: ptr as i32, timestamp: timestamp });
|
||||||
@ -486,8 +472,7 @@ extern fn dma_playback(timestamp: i64, ptr: i32, _uses_ddma: bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[unwind(allowed)]
|
extern "C-unwind" fn subkernel_load_run(id: u32, destination: u8, run: bool) {
|
||||||
extern fn subkernel_load_run(id: u32, destination: u8, run: bool) {
|
|
||||||
send(&SubkernelLoadRunRequest { id: id, destination: destination, run: run });
|
send(&SubkernelLoadRunRequest { id: id, destination: destination, run: run });
|
||||||
recv!(&SubkernelLoadRunReply { succeeded } => {
|
recv!(&SubkernelLoadRunReply { succeeded } => {
|
||||||
if !succeeded {
|
if !succeeded {
|
||||||
@ -497,8 +482,7 @@ extern fn subkernel_load_run(id: u32, destination: u8, run: bool) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(allowed)]
|
extern "C-unwind" fn subkernel_await_finish(id: u32, timeout: i64) {
|
||||||
extern fn subkernel_await_finish(id: u32, timeout: i64) {
|
|
||||||
send(&SubkernelAwaitFinishRequest { id: id, timeout: timeout });
|
send(&SubkernelAwaitFinishRequest { id: id, timeout: timeout });
|
||||||
recv!(SubkernelAwaitFinishReply { status } => {
|
recv!(SubkernelAwaitFinishReply { status } => {
|
||||||
match status {
|
match status {
|
||||||
@ -515,7 +499,6 @@ extern fn subkernel_await_finish(id: u32, timeout: i64) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(aborts)]
|
|
||||||
extern fn subkernel_send_message(id: u32, is_return: bool, destination: u8,
|
extern fn subkernel_send_message(id: u32, is_return: bool, destination: u8,
|
||||||
count: u8, tag: &CSlice<u8>, data: *const *const ()) {
|
count: u8, tag: &CSlice<u8>, data: *const *const ()) {
|
||||||
send(&SubkernelMsgSend {
|
send(&SubkernelMsgSend {
|
||||||
@ -527,8 +510,7 @@ extern fn subkernel_send_message(id: u32, is_return: bool, destination: u8,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unwind(allowed)]
|
extern "C-unwind" fn subkernel_await_message(id: i32, timeout: i64, tags: &CSlice<u8>, min: u8, max: u8) -> u8 {
|
||||||
extern fn subkernel_await_message(id: i32, timeout: i64, tags: &CSlice<u8>, min: u8, max: u8) -> u8 {
|
|
||||||
send(&SubkernelMsgRecvRequest { id: id, timeout: timeout, tags: tags.as_ref() });
|
send(&SubkernelMsgRecvRequest { id: id, timeout: timeout, tags: tags.as_ref() });
|
||||||
recv!(SubkernelMsgRecvReply { status, count } => {
|
recv!(SubkernelMsgRecvReply { status, count } => {
|
||||||
match status {
|
match status {
|
||||||
@ -653,8 +635,7 @@ pub unsafe fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
#[unwind(allowed)]
|
pub unsafe extern "C-unwind" fn exception(_regs: *const u32) {
|
||||||
pub unsafe extern fn exception(_regs: *const u32) {
|
|
||||||
let pc = mepc::read();
|
let pc = mepc::read();
|
||||||
let cause = mcause::read().cause();
|
let cause = mcause::read().cause();
|
||||||
let mtval = mtval::read();
|
let mtval = mtval::read();
|
||||||
@ -672,7 +653,6 @@ pub unsafe extern fn exception(_regs: *const u32) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
#[unwind(allowed)]
|
pub extern "C-unwind" fn abort() {
|
||||||
pub extern fn abort() {
|
|
||||||
panic!("aborted")
|
panic!("aborted")
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#![feature(lang_items, never_type)]
|
#![feature(asm, lang_items, never_type)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate failure;
|
extern crate failure;
|
||||||
|
@ -6,7 +6,11 @@ static mut LAST: usize = 0;
|
|||||||
|
|
||||||
pub unsafe fn send(data: usize) {
|
pub unsafe fn send(data: usize) {
|
||||||
LAST = data;
|
LAST = data;
|
||||||
write_volatile(MAILBOX, data)
|
// after Rust toolchain update to LLVM12, this empty asm! block is required
|
||||||
|
// to ensure that the compiler doesn't take any shortcuts
|
||||||
|
// otherwise, the comm CPU will read garbage data and crash
|
||||||
|
asm!("", options(preserves_flags, readonly, nostack));
|
||||||
|
write_volatile(MAILBOX, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn acknowledged() -> bool {
|
pub fn acknowledged() -> bool {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#![no_std]
|
#![no_std]
|
||||||
#![feature(llvm_asm)]
|
|
||||||
#![feature(asm)]
|
#![feature(asm)]
|
||||||
|
|
||||||
extern crate byteorder;
|
extern crate byteorder;
|
||||||
|
@ -2,29 +2,26 @@ use super::{cache, pmp};
|
|||||||
use riscv::register::*;
|
use riscv::register::*;
|
||||||
|
|
||||||
pub unsafe fn reset() -> ! {
|
pub unsafe fn reset() -> ! {
|
||||||
llvm_asm!(r#"
|
asm!("j _reset_handler",
|
||||||
j _reset_handler
|
"nop",
|
||||||
nop
|
options(nomem, nostack, noreturn)
|
||||||
"# : : : : "volatile");
|
);
|
||||||
loop {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn jump(addr: usize) -> ! {
|
pub unsafe fn jump(addr: usize) -> ! {
|
||||||
cache::flush_cpu_icache();
|
cache::flush_cpu_icache();
|
||||||
llvm_asm!(r#"
|
asm!("jalr x0, 0({0})",
|
||||||
jalr x0, 0($0)
|
"nop",
|
||||||
nop
|
in(reg) addr,
|
||||||
"# : : "r"(addr) : : "volatile");
|
options(nomem, nostack, noreturn)
|
||||||
loop {}
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn start_user(addr: usize) -> ! {
|
pub unsafe fn start_user(addr: usize) -> ! {
|
||||||
pmp::enable_user_memory();
|
pmp::enable_user_memory();
|
||||||
mstatus::set_mpp(mstatus::MPP::User);
|
mstatus::set_mpp(mstatus::MPP::User);
|
||||||
mepc::write(addr);
|
mepc::write(addr);
|
||||||
llvm_asm!(
|
asm!("mret",
|
||||||
"mret"
|
options(nomem, nostack, noreturn)
|
||||||
: : : : "volatile"
|
|
||||||
);
|
);
|
||||||
unreachable!()
|
|
||||||
}
|
}
|
||||||
|
@ -7,20 +7,24 @@ use mem;
|
|||||||
|
|
||||||
pub fn flush_cpu_icache() {
|
pub fn flush_cpu_icache() {
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm_asm!(r#"
|
asm!(
|
||||||
fence.i
|
"fence.i",
|
||||||
nop
|
"nop",
|
||||||
nop
|
"nop",
|
||||||
nop
|
"nop",
|
||||||
nop
|
"nop",
|
||||||
nop
|
"nop",
|
||||||
"# : : : : "volatile");
|
options(preserves_flags, nostack)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn flush_cpu_dcache() {
|
pub fn flush_cpu_dcache() {
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm_asm!(".word(0x500F)" : : : : "volatile");
|
asm!(
|
||||||
|
".word(0x500F)",
|
||||||
|
options(preserves_flags)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#![feature(lang_items, panic_unwind, libc, unwind_attributes, int_bits_const)]
|
#![feature(lang_items, panic_unwind, libc)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cslice;
|
extern crate cslice;
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
#![feature(link_cfg)]
|
#![feature(link_cfg)]
|
||||||
#![feature(nll)]
|
#![feature(nll)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(unwind_attributes)]
|
|
||||||
#![feature(static_nobundle)]
|
#![feature(static_nobundle)]
|
||||||
|
#![feature(c_unwind)]
|
||||||
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
|
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
|
||||||
|
|
||||||
mod libunwind;
|
mod libunwind;
|
||||||
|
@ -81,9 +81,14 @@ pub type _Unwind_Exception_Cleanup_Fn =
|
|||||||
all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")),
|
all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")),
|
||||||
link(name = "unwind", kind = "static")
|
link(name = "unwind", kind = "static")
|
||||||
)]
|
)]
|
||||||
extern "C" {
|
extern "C-unwind" {
|
||||||
#[unwind(allowed)]
|
|
||||||
pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !;
|
pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !;
|
||||||
|
}
|
||||||
|
#[cfg_attr(
|
||||||
|
all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")),
|
||||||
|
link(name = "unwind", kind = "static")
|
||||||
|
)]
|
||||||
|
extern "C" {
|
||||||
pub fn _Unwind_DeleteException(exception: *mut _Unwind_Exception);
|
pub fn _Unwind_DeleteException(exception: *mut _Unwind_Exception);
|
||||||
pub fn _Unwind_GetLanguageSpecificData(ctx: *mut _Unwind_Context) -> *mut c_void;
|
pub fn _Unwind_GetLanguageSpecificData(ctx: *mut _Unwind_Context) -> *mut c_void;
|
||||||
pub fn _Unwind_GetRegionStart(ctx: *mut _Unwind_Context) -> _Unwind_Ptr;
|
pub fn _Unwind_GetRegionStart(ctx: *mut _Unwind_Context) -> _Unwind_Ptr;
|
||||||
@ -230,9 +235,13 @@ if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
|
|||||||
#[cfg_attr(all(feature = "llvm-libunwind",
|
#[cfg_attr(all(feature = "llvm-libunwind",
|
||||||
any(target_os = "fuchsia", target_os = "linux")),
|
any(target_os = "fuchsia", target_os = "linux")),
|
||||||
link(name = "unwind", kind = "static"))]
|
link(name = "unwind", kind = "static"))]
|
||||||
extern "C" {
|
extern "C-unwind" {
|
||||||
#[unwind(allowed)]
|
|
||||||
pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
|
pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
|
||||||
|
}
|
||||||
|
#[cfg_attr(all(feature = "llvm-libunwind",
|
||||||
|
any(target_os = "fuchsia", target_os = "linux")),
|
||||||
|
link(name = "unwind", kind = "static"))]
|
||||||
|
extern "C" {
|
||||||
pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
|
pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
|
||||||
trace_argument: *mut c_void)
|
trace_argument: *mut c_void)
|
||||||
-> _Unwind_Reason_Code;
|
-> _Unwind_Reason_Code;
|
||||||
@ -242,8 +251,7 @@ if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
|
|||||||
#[cfg_attr(all(feature = "llvm-libunwind",
|
#[cfg_attr(all(feature = "llvm-libunwind",
|
||||||
any(target_os = "fuchsia", target_os = "linux")),
|
any(target_os = "fuchsia", target_os = "linux")),
|
||||||
link(name = "unwind", kind = "static"))]
|
link(name = "unwind", kind = "static"))]
|
||||||
extern "C" {
|
extern "C-unwind" {
|
||||||
#[unwind(allowed)]
|
|
||||||
pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
|
pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,20 +21,6 @@
|
|||||||
},
|
},
|
||||||
"relro-level": "full",
|
"relro-level": "full",
|
||||||
"target-family": "unix",
|
"target-family": "unix",
|
||||||
"target-pointer-width": "32",
|
"target-pointer-width": "32"
|
||||||
"unsupported-abis": [
|
|
||||||
"cdecl",
|
|
||||||
"stdcall",
|
|
||||||
"fastcall",
|
|
||||||
"vectorcall",
|
|
||||||
"thiscall",
|
|
||||||
"aapcs",
|
|
||||||
"win64",
|
|
||||||
"sysv64",
|
|
||||||
"ptx-kernel",
|
|
||||||
"msp430-interrupt",
|
|
||||||
"x86-interrupt",
|
|
||||||
"amdgpu-kernel"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
@ -13,19 +13,5 @@
|
|||||||
"max-atomic-width": 32,
|
"max-atomic-width": 32,
|
||||||
"panic-strategy": "unwind",
|
"panic-strategy": "unwind",
|
||||||
"relocation-model": "static",
|
"relocation-model": "static",
|
||||||
"target-pointer-width": "32",
|
"target-pointer-width": "32"
|
||||||
"unsupported-abis": [
|
|
||||||
"cdecl",
|
|
||||||
"stdcall",
|
|
||||||
"fastcall",
|
|
||||||
"vectorcall",
|
|
||||||
"thiscall",
|
|
||||||
"aapcs",
|
|
||||||
"win64",
|
|
||||||
"sysv64",
|
|
||||||
"ptx-kernel",
|
|
||||||
"msp430-interrupt",
|
|
||||||
"x86-interrupt",
|
|
||||||
"amdgpu-kernel"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
@ -97,25 +97,25 @@ pub mod drtio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn process_async_packets(io: &Io, ddma_mutex: &Mutex, subkernel_mutex: &Mutex,
|
fn process_async_packets(io: &Io, ddma_mutex: &Mutex, subkernel_mutex: &Mutex,
|
||||||
routing_table: &drtio_routing::RoutingTable, linkno: u8, packet: drtioaux::Packet
|
routing_table: &drtio_routing::RoutingTable, linkno: u8, packet: &drtioaux::Packet
|
||||||
) -> Option<drtioaux::Packet> {
|
) -> bool {
|
||||||
match packet {
|
match packet {
|
||||||
// packets to be consumed locally
|
// packets to be consumed locally
|
||||||
drtioaux::Packet::DmaPlaybackStatus { id, source, destination: 0, error, channel, timestamp } => {
|
drtioaux::Packet::DmaPlaybackStatus { id, source, destination: 0, error, channel, timestamp } => {
|
||||||
remote_dma::playback_done(io, ddma_mutex, id, source, error, channel, timestamp);
|
remote_dma::playback_done(io, ddma_mutex, *id, *source, *error, *channel, *timestamp);
|
||||||
None
|
true
|
||||||
},
|
},
|
||||||
drtioaux::Packet::SubkernelFinished { id, destination: 0, with_exception, exception_src } => {
|
drtioaux::Packet::SubkernelFinished { id, destination: 0, with_exception, exception_src } => {
|
||||||
subkernel::subkernel_finished(io, subkernel_mutex, id, with_exception, exception_src);
|
subkernel::subkernel_finished(io, subkernel_mutex, *id, *with_exception, *exception_src);
|
||||||
None
|
true
|
||||||
},
|
},
|
||||||
drtioaux::Packet::SubkernelMessage { id, source: from, destination: 0, status, length, data } => {
|
drtioaux::Packet::SubkernelMessage { id, source: from, destination: 0, status, length, data } => {
|
||||||
subkernel::message_handle_incoming(io, subkernel_mutex, id, status, length as usize, &data);
|
subkernel::message_handle_incoming(io, subkernel_mutex, *id, *status, *length as usize, data);
|
||||||
// acknowledge receiving part of the message
|
// acknowledge receiving part of the message
|
||||||
drtioaux::send(linkno,
|
drtioaux::send(linkno,
|
||||||
&drtioaux::Packet::SubkernelMessageAck { destination: from }
|
&drtioaux::Packet::SubkernelMessageAck { destination: *from }
|
||||||
).unwrap();
|
).unwrap();
|
||||||
None
|
true
|
||||||
},
|
},
|
||||||
// (potentially) routable packets
|
// (potentially) routable packets
|
||||||
drtioaux::Packet::DmaAddTraceRequest { destination, .. } |
|
drtioaux::Packet::DmaAddTraceRequest { destination, .. } |
|
||||||
@ -130,19 +130,19 @@ pub mod drtio {
|
|||||||
drtioaux::Packet::SubkernelMessageAck { destination, .. } |
|
drtioaux::Packet::SubkernelMessageAck { destination, .. } |
|
||||||
drtioaux::Packet::DmaPlaybackStatus { destination, .. } |
|
drtioaux::Packet::DmaPlaybackStatus { destination, .. } |
|
||||||
drtioaux::Packet::SubkernelFinished { destination, .. } => {
|
drtioaux::Packet::SubkernelFinished { destination, .. } => {
|
||||||
if destination == 0 {
|
if *destination == 0 {
|
||||||
Some(packet)
|
false
|
||||||
} else {
|
} else {
|
||||||
let dest_link = routing_table.0[destination as usize][0] - 1;
|
let dest_link = routing_table.0[*destination as usize][0] - 1;
|
||||||
if dest_link == linkno {
|
if dest_link == linkno {
|
||||||
warn!("[LINK#{}] Re-routed packet would return to the same link, dropping: {:?}", linkno, packet);
|
warn!("[LINK#{}] Re-routed packet would return to the same link, dropping: {:?}", linkno, packet);
|
||||||
} else {
|
} else {
|
||||||
drtioaux::send(dest_link, &packet).unwrap();
|
drtioaux::send(dest_link, &packet).unwrap();
|
||||||
}
|
}
|
||||||
None
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
other => Some(other)
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ pub mod drtio {
|
|||||||
drtioaux::send(linkno, request).unwrap();
|
drtioaux::send(linkno, request).unwrap();
|
||||||
loop {
|
loop {
|
||||||
let reply = recv_aux_timeout(io, linkno, 200)?;
|
let reply = recv_aux_timeout(io, linkno, 200)?;
|
||||||
if let Some(reply) = process_async_packets(io, ddma_mutex, subkernel_mutex, routing_table, linkno, reply) {
|
if !process_async_packets(io, ddma_mutex, subkernel_mutex, routing_table, linkno, &reply) {
|
||||||
// returns none if it was an async packet
|
// returns none if it was an async packet
|
||||||
return Ok(reply);
|
return Ok(reply);
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ pub mod drtio {
|
|||||||
loop {
|
loop {
|
||||||
match drtioaux::recv(linkno) {
|
match drtioaux::recv(linkno) {
|
||||||
Ok(Some(packet)) => {
|
Ok(Some(packet)) => {
|
||||||
if let Some(packet) = process_async_packets(&io, ddma_mutex, subkernel_mutex, routing_table, linkno, packet) {
|
if !process_async_packets(&io, ddma_mutex, subkernel_mutex, routing_table, linkno, &packet) {
|
||||||
warn!("[LINK#{}] unsolicited aux packet: {:?}", linkno, packet);
|
warn!("[LINK#{}] unsolicited aux packet: {:?}", linkno, packet);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -243,12 +243,13 @@ pub fn kern_send(io: &Io, request: &kern::Message) -> Result<(), Error<SchedErro
|
|||||||
|
|
||||||
fn kern_recv_notrace<R, F>(io: &Io, f: F) -> Result<R, Error<SchedError>>
|
fn kern_recv_notrace<R, F>(io: &Io, f: F) -> Result<R, Error<SchedError>>
|
||||||
where F: FnOnce(&kern::Message) -> Result<R, Error<SchedError>> {
|
where F: FnOnce(&kern::Message) -> Result<R, Error<SchedError>> {
|
||||||
io.until(|| mailbox::receive() != 0)?;
|
let mut msg_ptr = 0;
|
||||||
if !kernel::validate(mailbox::receive()) {
|
io.until(|| { msg_ptr = mailbox::receive(); msg_ptr != 0 })?;
|
||||||
return Err(Error::InvalidPointer(mailbox::receive()))
|
if !kernel::validate(msg_ptr) {
|
||||||
|
return Err(Error::InvalidPointer(msg_ptr))
|
||||||
}
|
}
|
||||||
|
|
||||||
f(unsafe { &*(mailbox::receive() as *const kern::Message) })
|
f(unsafe { &*(msg_ptr as *const kern::Message) })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn kern_recv_dotrace(reply: &kern::Message) {
|
fn kern_recv_dotrace(reply: &kern::Message) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use core::{mem, option::NoneError};
|
use core::mem;
|
||||||
use alloc::{string::String, format, vec::Vec, collections::btree_map::BTreeMap};
|
use alloc::{string::String, format, vec::Vec, collections::btree_map::BTreeMap};
|
||||||
use cslice::AsCSlice;
|
use cslice::AsCSlice;
|
||||||
|
|
||||||
@ -85,12 +85,6 @@ pub enum Error {
|
|||||||
DmaError(DmaError),
|
DmaError(DmaError),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<NoneError> for Error {
|
|
||||||
fn from(_: NoneError) -> Error {
|
|
||||||
Error::KernelNotFound
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<io::Error<!>> for Error {
|
impl From<io::Error<!>> for Error {
|
||||||
fn from(_value: io::Error<!>) -> Error {
|
fn from(_value: io::Error<!>) -> Error {
|
||||||
Error::SubkernelIoError
|
Error::SubkernelIoError
|
||||||
@ -330,7 +324,7 @@ impl Manager {
|
|||||||
self.kernels.insert(id, KernelLibrary {
|
self.kernels.insert(id, KernelLibrary {
|
||||||
library: Vec::new(),
|
library: Vec::new(),
|
||||||
complete: false });
|
complete: false });
|
||||||
self.kernels.get_mut(&id)?
|
self.kernels.get_mut(&id).unwrap()
|
||||||
} else {
|
} else {
|
||||||
kernel
|
kernel
|
||||||
}
|
}
|
||||||
@ -339,7 +333,7 @@ impl Manager {
|
|||||||
self.kernels.insert(id, KernelLibrary {
|
self.kernels.insert(id, KernelLibrary {
|
||||||
library: Vec::new(),
|
library: Vec::new(),
|
||||||
complete: false });
|
complete: false });
|
||||||
self.kernels.get_mut(&id)?
|
self.kernels.get_mut(&id).unwrap()
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
kernel.library.extend(&data[0..data_len]);
|
kernel.library.extend(&data[0..data_len]);
|
||||||
@ -404,7 +398,7 @@ impl Manager {
|
|||||||
if self.current_id == id && self.session.kernel_state == KernelState::Loaded {
|
if self.current_id == id && self.session.kernel_state == KernelState::Loaded {
|
||||||
return Ok(())
|
return Ok(())
|
||||||
}
|
}
|
||||||
if !self.kernels.get(&id)?.complete {
|
if !self.kernels.get(&id).ok_or(Error::KernelNotFound)?.complete {
|
||||||
return Err(Error::KernelNotFound)
|
return Err(Error::KernelNotFound)
|
||||||
}
|
}
|
||||||
self.current_id = id;
|
self.current_id = id;
|
||||||
@ -414,7 +408,7 @@ impl Manager {
|
|||||||
unsafe {
|
unsafe {
|
||||||
kernel_cpu::start();
|
kernel_cpu::start();
|
||||||
|
|
||||||
kern_send(&kern::LoadRequest(&self.kernels.get(&id)?.library)).unwrap();
|
kern_send(&kern::LoadRequest(&self.kernels.get(&id).unwrap().library)).unwrap();
|
||||||
kern_recv(|reply| {
|
kern_recv(|reply| {
|
||||||
match reply {
|
match reply {
|
||||||
kern::LoadReply(Ok(())) => {
|
kern::LoadReply(Ok(())) => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#![feature(never_type, panic_info_message, llvm_asm, default_alloc_error_handler, try_trait)]
|
#![feature(never_type, panic_info_message, asm, default_alloc_error_handler)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#![feature(libc, panic_unwind, unwind_attributes, rustc_private, int_bits_const, const_in_array_repeat_expressions)]
|
#![feature(libc, panic_unwind, rustc_private, c_unwind)]
|
||||||
#![crate_name = "artiq_support"]
|
#![crate_name = "artiq_support"]
|
||||||
#![crate_type = "cdylib"]
|
#![crate_type = "cdylib"]
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
artiqRev = self.sourceInfo.rev or "unknown";
|
artiqRev = self.sourceInfo.rev or "unknown";
|
||||||
|
|
||||||
rustManifest = pkgs.fetchurl {
|
rustManifest = pkgs.fetchurl {
|
||||||
url = "https://static.rust-lang.org/dist/2021-01-29/channel-rust-nightly.toml";
|
url = "https://static.rust-lang.org/dist/2021-09-01/channel-rust-nightly.toml";
|
||||||
sha256 = "sha256-EZKgw89AH4vxaJpUHmIMzMW/80wAFQlfcxRoBD9nz0c=";
|
sha256 = "sha256-KYLZHfOkotnM6BZd7CU+vBA3w/VtiWxth3ngJlmA41U=";
|
||||||
};
|
};
|
||||||
|
|
||||||
targets = [];
|
targets = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user