From c4eb4212c12c52f5ef81c8ac683d1bff9ff6be75 Mon Sep 17 00:00:00 2001 From: Wenda Zhang Date: Thu, 26 Oct 2023 15:01:49 +0800 Subject: [PATCH 1/3] deps: update clap clap-4.1 depends on wrong proc_macro2 version, so update to clap-4.4. --- Cargo.lock | 290 +++++++++++++++++------------------------------ xtask/Cargo.toml | 2 +- 2 files changed, 102 insertions(+), 190 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1bb0314..4a00592 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,6 +8,54 @@ version = "0.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a01ba40421eca6c4f1afcedd8465fba6d9e5ef8e0e13060d0141e4cded4ab4a" +[[package]] +name = "anstream" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +dependencies = [ + "anstyle", + "windows-sys", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -36,12 +84,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" - [[package]] name = "cfg-if" version = "1.0.0" @@ -50,27 +92,33 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.1.4" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" dependencies = [ - "bitflags", + "clap_builder", "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" +dependencies = [ + "anstream", + "anstyle", "clap_lex", - "is-terminal", - "once_cell", "strsim", - "termcolor", ] [[package]] name = "clap_derive" -version = "4.1.0" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", "syn", @@ -78,12 +126,15 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.3.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" -dependencies = [ - "os_str_bytes", -] +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "critical-section" @@ -107,27 +158,6 @@ dependencies = [ "void", ] -[[package]] -name = "errno" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" -dependencies = [ - "errno-dragonfly", - "libc", - "winapi", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "fast-trap" version = "0.0.1" @@ -140,15 +170,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - [[package]] name = "hsm-cell" version = "0.1.0" @@ -156,40 +177,6 @@ dependencies = [ "sbi-spec", ] -[[package]] -name = "io-lifetimes" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] -name = "is-terminal" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" -dependencies = [ - "hermit-abi", - "io-lifetimes", - "rustix", - "windows-sys", -] - -[[package]] -name = "libc" -version = "0.2.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" - -[[package]] -name = "linux-raw-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" - [[package]] name = "lock_api" version = "0.4.9" @@ -239,50 +226,20 @@ dependencies = [ "once_cell", ] -[[package]] -name = "os_str_bytes" -version = "6.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" -version = "1.0.50" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -308,20 +265,6 @@ dependencies = [ "embedded-hal", ] -[[package]] -name = "rustix" -version = "0.36.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys", -] - [[package]] name = "rustsbi" version = "0.3.1" @@ -419,24 +362,15 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.107" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - [[package]] name = "test-kernel" version = "0.2.0" @@ -468,10 +402,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] -name = "version_check" -version = "0.9.4" +name = "utf8parse" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "void" @@ -486,41 +420,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "442887c63f2c839b346c192d047a7c87e73d0689c9157b00b53dcc27dd5ea793" [[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" +name = "windows-sys" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "winapi", + "windows-targets", ] [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.42.0" +name = "windows-targets" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -533,45 +445,45 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "x86_64" diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index ecd8976..3a73b3f 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -9,6 +9,6 @@ publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -clap = { version = "4.1", features = ["derive"] } +clap = { version = "4.4", features = ["derive"] } os-xtask-utils = "0.0.0" once_cell = "1.17" From 3cf1777f09584888ba0a407a64dfd8b6852de8c7 Mon Sep 17 00:00:00 2001 From: Zhouqi Jiang Date: Wed, 27 Dec 2023 10:33:13 +0800 Subject: [PATCH 2/3] lib: use derive macro based RustSBI Signed-off-by: Zhouqi Jiang --- CHANGELOG.md | 2 +- Cargo.lock | 172 +++++++++++++++++++++------------------ Cargo.toml | 1 + hsm-cell/Cargo.toml | 5 ++ rustsbi-qemu/Cargo.toml | 6 +- rustsbi-qemu/src/main.rs | 45 ++++------ 6 files changed, 121 insertions(+), 110 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7e4fcc..06f3f21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Modified -- Use instance based RustSBI interface, with separate functions for legacy stdio +- Use derive macro based RustSBI interface, with separate functions for legacy stdio - Update sbi-testing to version 0.0.1 - Use crate fast-trap version 0.0.1 in rustsbi-qemu for trap handling - Use crate rcore-console version 0.0.0 in rustsbi-qemu and test-kernel for `print!` and `println!` diff --git a/Cargo.lock b/Cargo.lock index 4a00592..66accc3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,9 +10,9 @@ checksum = "8a01ba40421eca6c4f1afcedd8465fba6d9e5ef8e0e13060d0141e4cded4ab4a" [[package]] name = "anstream" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" dependencies = [ "anstyle", "anstyle-parse", @@ -30,27 +30,27 @@ checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", "windows-sys", @@ -74,9 +74,9 @@ dependencies = [ [[package]] name = "bit_field" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" [[package]] name = "bitflags" @@ -85,16 +85,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] -name = "cfg-if" -version = "1.0.0" +name = "bitflags" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "clap" -version = "4.4.7" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" +checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" dependencies = [ "clap_builder", "clap_derive", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.7" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" +checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" dependencies = [ "anstream", "anstyle", @@ -138,9 +138,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "critical-section" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" +checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" [[package]] name = "dtb-walker" @@ -166,22 +166,22 @@ checksum = "7fbe69badc2e0dc98ad2787648fa140b5772d24b49e9a6b180a67e1348f7544c" [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hsm-cell" version = "0.1.0" dependencies = [ - "sbi-spec", + "sbi-spec 0.0.4", ] [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -189,12 +189,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "nb" @@ -202,20 +199,20 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" dependencies = [ - "nb 1.0.0", + "nb 1.1.0", ] [[package]] name = "nb" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] name = "once_cell" -version = "1.17.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "os-xtask-utils" @@ -228,9 +225,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" dependencies = [ "unicode-ident", ] @@ -267,17 +264,27 @@ dependencies = [ [[package]] name = "rustsbi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92aa8dfaaa1376f99da2979fc8393137c1b8a4aa6023369191e179c420e9487d" +version = "0.4.0-alpha.1" +source = "git+https://github.com/rustsbi/rustsbi#88199112d615ba69612a19375407d423b0f062dc" dependencies = [ "riscv", - "sbi-spec", + "rustsbi-macros", + "sbi-spec 0.0.7-alpha.3", + "static_assertions", +] + +[[package]] +name = "rustsbi-macros" +version = "0.4.0-alpha.1" +source = "git+https://github.com/rustsbi/rustsbi#88199112d615ba69612a19375407d423b0f062dc" +dependencies = [ + "quote", + "syn", ] [[package]] name = "rustsbi-qemu" -version = "0.2.0-alpha.2" +version = "0.2.0-alpha.3" dependencies = [ "aclint", "dtb-walker", @@ -286,7 +293,7 @@ dependencies = [ "rcore-console", "riscv", "rustsbi", - "sbi-spec", + "sbi-spec 0.0.7-alpha.3", "sifive-test-device", "spin", "uart_16550", @@ -294,9 +301,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "sbi-rt" @@ -304,7 +311,7 @@ version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c113c53291db8ac141e01f43224ed488b8d6001ab66737b82e04695a43a42b7" dependencies = [ - "sbi-spec", + "sbi-spec 0.0.4", ] [[package]] @@ -316,6 +323,15 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "sbi-spec" +version = "0.0.7-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c890910c48a523b53b7cb0a27f20d169facd2281a2cae2220cddd314c7bee951" +dependencies = [ + "static_assertions", +] + [[package]] name = "sbi-testing" version = "0.0.2" @@ -324,14 +340,14 @@ dependencies = [ "log", "riscv", "sbi-rt", - "sbi-spec", + "sbi-spec 0.0.4", ] [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sifive-test-device" @@ -341,9 +357,9 @@ checksum = "ba50a6fd7cb5cdb2645fb93fb2bbae7d8d78390677a889bdcfaf13c3d29286d0" [[package]] name = "spin" -version = "0.9.4" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" dependencies = [ "lock_api", ] @@ -362,9 +378,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "2.0.38" +version = "2.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" dependencies = [ "proc-macro2", "quote", @@ -386,20 +402,20 @@ dependencies = [ [[package]] name = "uart_16550" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b074eb9300ad949edd74c529c0e8d451625af71bb948e6b65fe69f72dc1363d9" +checksum = "614ff2a87880d4bd4374722268598a970bbad05ced8bf630439417347254ab2e" dependencies = [ - "bitflags", + "bitflags 1.3.2", "rustversion", "x86_64", ] [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "utf8parse" @@ -421,18 +437,18 @@ checksum = "442887c63f2c839b346c192d047a7c87e73d0689c9157b00b53dcc27dd5ea793" [[package]] name = "windows-sys" -version = "0.48.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -445,54 +461,54 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" [[package]] name = "windows_aarch64_msvc" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" [[package]] name = "windows_i686_gnu" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" [[package]] name = "windows_i686_msvc" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" [[package]] name = "windows_x86_64_gnu" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" [[package]] name = "windows_x86_64_msvc" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "x86_64" -version = "0.14.10" +version = "0.14.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "100555a863c0092238c2e0e814c1096c1e5cf066a309c696a87e907b5f8c5d69" +checksum = "3b835097a84e4457323331ec5d6eb23d096066cbfb215d54096dcb4b2e85f500" dependencies = [ "bit_field", - "bitflags", + "bitflags 2.4.1", "rustversion", "volatile", ] diff --git a/Cargo.toml b/Cargo.toml index 34f72d8..43fdb43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,4 @@ [workspace] +resolver = "2" members = ["rustsbi-qemu", "hsm-cell", "test-kernel", "bench-kernel", "xtask"] default-members = ["xtask"] diff --git a/hsm-cell/Cargo.toml b/hsm-cell/Cargo.toml index 350a150..63ef0d2 100644 --- a/hsm-cell/Cargo.toml +++ b/hsm-cell/Cargo.toml @@ -7,3 +7,8 @@ edition = "2021" [dependencies] sbi-spec = "0.0.4" + +[lib] +name = "hsm_cell" +test = false +bench = false diff --git a/rustsbi-qemu/Cargo.toml b/rustsbi-qemu/Cargo.toml index 7039b45..c47e54a 100644 --- a/rustsbi-qemu/Cargo.toml +++ b/rustsbi-qemu/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustsbi-qemu" description = "RustSBI support package for QEMU" -version = "0.2.0-alpha.2" +version = "0.2.0-alpha.3" authors = [ "Luo Jia ", "YdrMaster ", @@ -17,8 +17,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rustsbi = "0.3.1" -sbi-spec = { version = "0.0.4", features = ["legacy"] } +rustsbi = { git = "https://github.com/rustsbi/rustsbi", features = ["machine"] } +sbi-spec = { version = "0.0.7-alpha.3", features = ["legacy"] } riscv = "0.10.1" spin = "0.9" uart_16550 = "0.2" diff --git a/rustsbi-qemu/src/main.rs b/rustsbi-qemu/src/main.rs index f17239b..0b2f912 100644 --- a/rustsbi-qemu/src/main.rs +++ b/rustsbi-qemu/src/main.rs @@ -26,14 +26,13 @@ extern crate rcore_console; use constants::*; use core::{ arch::asm, - convert::Infallible, mem::MaybeUninit, sync::atomic::{AtomicBool, Ordering}, }; use device_tree::BoardInfo; use fast_trap::{FastContext, FastResult}; use riscv_spec::*; -use rustsbi::{spec::binary::SbiRet, RustSBI}; +use rustsbi::{RustSBI, SbiRet}; use spin::{Mutex, Once}; use trap_stack::{local_hsm, local_remote_hsm, remote_hsm}; use trap_vec::trap_vec; @@ -112,14 +111,11 @@ extern "C" fn rust_main(hartid: usize, opaque: usize) { ); // 初始化 SBI unsafe { - SBI = MaybeUninit::new( - rustsbi::Builder::new_machine() - .with_ipi(&clint::Clint) - .with_timer(&clint::Clint) - .with_hsm(Hsm) - .with_reset(qemu_test::get()) - .build(), - ); + SBI = MaybeUninit::new(FixedRustSBI { + clint: &clint::Clint, + hsm: Hsm, + reset: qemu_test::get(), + }); } // 设置并打印 pmp set_pmp(board_info); @@ -222,7 +218,7 @@ extern "C" fn fast_handler( _ => match mcause::read().cause() { // SBI call T::Exception(E::SupervisorEnvCall) => { - use rustsbi::spec::{base, hsm, legacy}; + use sbi_spec::{base, hsm, legacy}; let mut ret = unsafe { SBI.assume_init_mut() }.handle_ecall( a7, a6, @@ -234,10 +230,7 @@ extern "C" fn fast_handler( (hsm::EID_HSM, hsm::HART_STOP) => continue, // 不可恢复挂起 (hsm::EID_HSM, hsm::HART_SUSPEND) - if matches!( - ctx.a0() as u32, - hsm::HART_SUSPEND_TYPE_NON_RETENTIVE - ) => + if matches!(ctx.a0() as u32, hsm::suspend_type::NON_RETENTIVE) => { break boot(ctx, a1, a2); } @@ -333,14 +326,13 @@ impl rcore_console::Console for Console { static mut SBI: MaybeUninit = MaybeUninit::uninit(); -type FixedRustSBI<'a> = RustSBI< - &'a clint::Clint, - &'a clint::Clint, - Infallible, - Hsm, - &'a qemu_test::QemuTest, - Infallible, ->; +#[derive(RustSBI)] +struct FixedRustSBI<'a> { + #[rustsbi(ipi, timer)] + clint: &'a clint::Clint, + hsm: Hsm, + reset: &'a qemu_test::QemuTest, +} struct Hsm; @@ -374,11 +366,8 @@ impl rustsbi::Hsm for Hsm { } fn hart_suspend(&self, suspend_type: u32, _resume_addr: usize, _opaque: usize) -> SbiRet { - use rustsbi::spec::hsm::{HART_SUSPEND_TYPE_NON_RETENTIVE, HART_SUSPEND_TYPE_RETENTIVE}; - if matches!( - suspend_type, - HART_SUSPEND_TYPE_NON_RETENTIVE | HART_SUSPEND_TYPE_RETENTIVE - ) { + use rustsbi::spec::hsm::suspend_type::{NON_RETENTIVE, RETENTIVE}; + if matches!(suspend_type, NON_RETENTIVE | RETENTIVE) { local_hsm().suspend(); unsafe { riscv::asm::wfi() }; local_hsm().resume(); From ff15b5a51a3fde41a25cbdb4766fe2c57f394176 Mon Sep 17 00:00:00 2001 From: Zhouqi Jiang Date: Wed, 27 Dec 2023 10:48:09 +0800 Subject: [PATCH 3/3] lib: update dependency sbi-rt and sbi-spec Signed-off-by: Zhouqi Jiang --- Cargo.lock | 15 ++++++++++++--- Cargo.toml | 3 +++ bench-kernel/Cargo.toml | 2 +- hsm-cell/Cargo.toml | 2 +- hsm-cell/src/lib.rs | 22 ++++++++++++---------- rustsbi-qemu/src/main.rs | 2 +- 6 files changed, 30 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 66accc3..bc7895b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -68,7 +68,7 @@ version = "0.0.1" dependencies = [ "rcore-console", "riscv", - "sbi-rt", + "sbi-rt 0.0.3-rc.5", "uart_16550", ] @@ -174,7 +174,7 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" name = "hsm-cell" version = "0.1.0" dependencies = [ - "sbi-spec 0.0.4", + "sbi-spec 0.0.7-alpha.3", ] [[package]] @@ -314,6 +314,15 @@ dependencies = [ "sbi-spec 0.0.4", ] +[[package]] +name = "sbi-rt" +version = "0.0.3-rc.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16fd1c8d9255a1cc094f2dde32da32dbae1ab945656a684b168bf75ed5dccbb6" +dependencies = [ + "sbi-spec 0.0.7-alpha.3", +] + [[package]] name = "sbi-spec" version = "0.0.4" @@ -339,7 +348,7 @@ source = "git+https://github.com/rustsbi/sbi-testing?rev=7a5e920#7a5e9204f62f9cf dependencies = [ "log", "riscv", - "sbi-rt", + "sbi-rt 0.0.2", "sbi-spec 0.0.4", ] diff --git a/Cargo.toml b/Cargo.toml index 43fdb43..a926be4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,3 +2,6 @@ resolver = "2" members = ["rustsbi-qemu", "hsm-cell", "test-kernel", "bench-kernel", "xtask"] default-members = ["xtask"] + +[profile.release] +opt-level = 3 diff --git a/bench-kernel/Cargo.toml b/bench-kernel/Cargo.toml index 3f264d7..9c23f18 100644 --- a/bench-kernel/Cargo.toml +++ b/bench-kernel/Cargo.toml @@ -8,7 +8,7 @@ publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -sbi-rt = "0.0.2" +sbi-rt = "0.0.3-rc.5" riscv = "0.10.1" uart_16550 = "0.2" rcore-console = "0.0.0" diff --git a/hsm-cell/Cargo.toml b/hsm-cell/Cargo.toml index 63ef0d2..e357157 100644 --- a/hsm-cell/Cargo.toml +++ b/hsm-cell/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -sbi-spec = "0.0.4" +sbi-spec = "0.0.7-alpha.3" [lib] name = "hsm_cell" diff --git a/hsm-cell/src/lib.rs b/hsm-cell/src/lib.rs index 1a009ae..75e9a81 100644 --- a/hsm-cell/src/lib.rs +++ b/hsm-cell/src/lib.rs @@ -31,7 +31,7 @@ impl HsmCell { /// 创建一个新的共享对象。 pub const fn new() -> Self { Self { - status: AtomicUsize::new(HART_STATE_STOPPED), + status: AtomicUsize::new(hart_state::STOPPED), val: UnsafeCell::new(None), } } @@ -59,8 +59,8 @@ impl LocalHsmCell<'_, T> { pub fn start(&self) -> Result { loop { match self.0.status.compare_exchange( - HART_STATE_START_PENDING, - HART_STATE_STARTED, + hart_state::START_PENDING, + hart_state::STARTED, Ordering::AcqRel, Ordering::Relaxed, ) { @@ -74,19 +74,21 @@ impl LocalHsmCell<'_, T> { /// 关闭。 #[inline] pub fn stop(&self) { - self.0.status.store(HART_STATE_STOPPED, Ordering::Release) + self.0.status.store(hart_state::STOPPED, Ordering::Release) } /// 关闭。 #[inline] pub fn suspend(&self) { - self.0.status.store(HART_STATE_SUSPENDED, Ordering::Relaxed) + self.0 + .status + .store(hart_state::SUSPENDED, Ordering::Relaxed) } /// 关闭。 #[inline] pub fn resume(&self) { - self.0.status.store(HART_STATE_STARTED, Ordering::Relaxed) + self.0.status.store(hart_state::STARTED, Ordering::Relaxed) } } @@ -98,7 +100,7 @@ impl RemoteHsmCell<'_, T> { .0 .status .compare_exchange( - HART_STATE_STOPPED, + hart_state::STOPPED, HART_STATE_START_PENDING_EXT, Ordering::Acquire, Ordering::Relaxed, @@ -108,7 +110,7 @@ impl RemoteHsmCell<'_, T> { unsafe { *self.0.val.get() = Some(t) }; self.0 .status - .store(HART_STATE_START_PENDING, Ordering::Release); + .store(hart_state::START_PENDING, Ordering::Release); true } else { false @@ -119,7 +121,7 @@ impl RemoteHsmCell<'_, T> { #[inline] pub fn sbi_get_status(&self) -> usize { match self.0.status.load(Ordering::Relaxed) { - HART_STATE_START_PENDING_EXT => HART_STATE_START_PENDING, + HART_STATE_START_PENDING_EXT => hart_state::START_PENDING, normal => normal, } } @@ -129,7 +131,7 @@ impl RemoteHsmCell<'_, T> { pub fn allow_ipi(&self) -> bool { matches!( self.0.status.load(Ordering::Relaxed), - HART_STATE_STARTED | HART_STATE_SUSPENDED + hart_state::STARTED | hart_state::SUSPENDED ) } } diff --git a/rustsbi-qemu/src/main.rs b/rustsbi-qemu/src/main.rs index 0b2f912..19aff7f 100644 --- a/rustsbi-qemu/src/main.rs +++ b/rustsbi-qemu/src/main.rs @@ -89,7 +89,7 @@ extern "C" fn rust_main(hartid: usize, opaque: usize) { // 打印启动信息 print!( "\ -[rustsbi] RustSBI version {ver_sbi}, adapting to RISC-V SBI v1.0.0 +[rustsbi] RustSBI version {ver_sbi}, adapting to RISC-V SBI v2.0.0 {logo} [rustsbi] Implementation : RustSBI-QEMU Version {ver_impl} [rustsbi] Platform Name : {model}