diff --git a/README.md b/README.md index 6752ab8..1e72f38 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,112 @@ by symlinking CMakeLists.txt. It also symlinks settings.cmake, and so retains the notion of "apps," which enables the build system to switch which assembly it builds using the CAMKES\_APP CMake cache value. KataOS just has one app, *system*. + +## Sparrow Rust crates (what's included here). + +[More software will be published as we deem it ready for sharing until eventually +all of Sparrow (software and hardware designs) will be available.] + +Many KataOS Rust crates are in the *apps/system/components* directory. +Common/shared code is in *kata-os-common*: + +- *allocator*: a heap allocator built on the linked-list-allocator crate +- *camkes*: support for writing CAmkES components in Rust +- *capdl*: support for reading the capDL specification generated by capDL-tool +- *copyregion*: a helper for temporarily mapping physical pages into a thread's VSpace +- *cspace-slot*: an RAII helper for the *slot-allocator* +- *logger*: seL4 integration with the Rust logger crate +- *model*: support for processing capDL; used by the kata-os-rootserver +- *panic*: an seL4-specific panic handler +- *sel4-config*: build glue for seL4 kernel configuration +- *sel4-sys*: seL4 system interfaces & glue +- *slot-allocator*: an allocator for slots in the top-level CNode + +### Depending on Rust crates + +To use crates from Sparrow you can reference them from a local repository or +directly from GitHub using git; e.g. in a Config.toml: +``` +kata-os-common = { path = "../system/components/kata-os-common" } +kata-os-common = { git = "https://github.com/google/AmbiML/sparrow/kata" } +``` +NB: the git usage depends on cargo's support for searching for a crate +named "kata-os-common" in the kata repo. +When using a git dependency a git tag can be used to lock the crate version. + +Note that many Sparrow crates need the seL4 kernel configuration +(e.g. to know whether MCS is configured). This is handled by the +kata-os-common/sel4-config crate that is used by a build.rs to import +kernel configuration parameters as Cargo features. In a Cargo.toml create +a features manifest with the kernel parameters you need e.g. + +``` +[features] +default = [] +# Used by sel4-config to extract kernel config +CONFIG_PRINTING = [] +``` + +then specify build-dependencies: + +``` +[build-dependencies] +# build.rs depends on SEL4_OUT_DIR = "${ROOTDIR}/out/kata/kernel" +sel4-config = { path = "../../kata/apps/system/components/kata-os-common/src/sel4-config" } +``` + +and use a build.rs that includes at least: + +``` +extern crate sel4_config; +use std::env; + +fn main() { + // If SEL4_OUT_DIR is not set we expect the kernel build at a fixed + // location relative to the ROOTDIR env variable. + println!("SEL4_OUT_DIR {:?}", env::var("SEL4_OUT_DIR")); + let sel4_out_dir = env::var("SEL4_OUT_DIR") + .unwrap_or_else(|_| format!("{}/out/kata/kernel", env::var("ROOTDIR").unwrap())); + println!("sel4_out_dir {}", sel4_out_dir); + + // Dredge seL4 kernel config for settings we need as features to generate + // correct code: e.g. CONFIG_KERNEL_MCS enables MCS support which changes + // the system call numbering. + let features = sel4_config::get_sel4_features(&sel4_out_dir); + println!("features={:?}", features); + for feature in features { + println!("cargo:rustc-cfg=feature=\"{}\"", feature); + } +} +``` + +Note how build.rs expects an SEL4_OUT_DIR environment variable that has the path to +the top of the kernel build area. The build-sparrow.sh script sets this for you but, for +example, if you choose to run ninja directly you will need it set in your environment. + +Similar to SEL4_OUT_DIR the kata-os-common/src/sel4-sys crate that has the seL4 system +call wrappers for Rust programs requires an SEL4_DIR envronment variable that has the +path to the top of the kernel sources. This also is set by build-sparrow.sh. + +## Source Code Headers + +Every file containing source code includes copyright and license +information. For dependent / non-Google code these are inherited from +the upstream repositories. If there are Google modifications you may find +the Google Apache license found below. + +Apache header: + + Copyright 2022 Google LLC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/apps/system/components/kata-os-common/Cargo.toml b/apps/system/components/kata-os-common/Cargo.toml index b4d6ca6..790cddc 100644 --- a/apps/system/components/kata-os-common/Cargo.toml +++ b/apps/system/components/kata-os-common/Cargo.toml @@ -1,3 +1,17 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + [package] name = "kata-os-common" version = "0.1.0" diff --git a/apps/system/components/kata-os-common/src/allocator/src/lib.rs b/apps/system/components/kata-os-common/src/allocator/src/lib.rs index 359f76e..9660a04 100644 --- a/apps/system/components/kata-os-common/src/allocator/src/lib.rs +++ b/apps/system/components/kata-os-common/src/allocator/src/lib.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + //! An allocator for Kata OS (derived from CortexM). #![no_std] diff --git a/apps/system/components/kata-os-common/src/camkes/build.rs b/apps/system/components/kata-os-common/src/camkes/build.rs index d637d08..69753b1 100644 --- a/apps/system/components/kata-os-common/src/camkes/build.rs +++ b/apps/system/components/kata-os-common/src/camkes/build.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + extern crate sel4_config; use std::env; diff --git a/apps/system/components/kata-os-common/src/camkes/src/lib.rs b/apps/system/components/kata-os-common/src/camkes/src/lib.rs index 854c78e..59d11f1 100644 --- a/apps/system/components/kata-os-common/src/camkes/src/lib.rs +++ b/apps/system/components/kata-os-common/src/camkes/src/lib.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + //! Kata OS CAmkES component helpers #![no_std] diff --git a/apps/system/components/kata-os-common/src/capdl/build.rs b/apps/system/components/kata-os-common/src/capdl/build.rs index d637d08..69753b1 100644 --- a/apps/system/components/kata-os-common/src/capdl/build.rs +++ b/apps/system/components/kata-os-common/src/capdl/build.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + extern crate sel4_config; use std::env; diff --git a/apps/system/components/kata-os-common/src/capdl/mod.rs b/apps/system/components/kata-os-common/src/capdl/mod.rs index 918e9e4..7543d88 100644 --- a/apps/system/components/kata-os-common/src/capdl/mod.rs +++ b/apps/system/components/kata-os-common/src/capdl/mod.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // capDL specification support. // // This code started from a bindgen conversion of capdl.h; some vestiges diff --git a/apps/system/components/kata-os-common/src/copyregion/src/lib.rs b/apps/system/components/kata-os-common/src/copyregion/src/lib.rs index 50b8c75..607b799 100644 --- a/apps/system/components/kata-os-common/src/copyregion/src/lib.rs +++ b/apps/system/components/kata-os-common/src/copyregion/src/lib.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + //! RAII wrapper for using a KataOS copyregion object. #![no_std] diff --git a/apps/system/components/kata-os-common/src/cspace-slot/src/lib.rs b/apps/system/components/kata-os-common/src/cspace-slot/src/lib.rs index 723e0e1..eeb895e 100644 --- a/apps/system/components/kata-os-common/src/cspace-slot/src/lib.rs +++ b/apps/system/components/kata-os-common/src/cspace-slot/src/lib.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + //! RAII wrapper for a dynamically allocated CSpace slot. #![cfg_attr(not(test), no_std)] diff --git a/apps/system/components/kata-os-common/src/lib.rs b/apps/system/components/kata-os-common/src/lib.rs index 0379efe..3bd21ba 100644 --- a/apps/system/components/kata-os-common/src/lib.rs +++ b/apps/system/components/kata-os-common/src/lib.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #![no_std] pub extern crate allocator; diff --git a/apps/system/components/kata-os-common/src/logger/src/lib.rs b/apps/system/components/kata-os-common/src/logger/src/lib.rs index ea9351f..2f6defc 100644 --- a/apps/system/components/kata-os-common/src/logger/src/lib.rs +++ b/apps/system/components/kata-os-common/src/logger/src/lib.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #![cfg_attr(not(test), no_std)] use core2::io::{Cursor, Write}; diff --git a/apps/system/components/kata-os-common/src/model/arch/aarch32.rs b/apps/system/components/kata-os-common/src/model/arch/aarch32.rs index d7aecd8..7e7e4b1 100644 --- a/apps/system/components/kata-os-common/src/model/arch/aarch32.rs +++ b/apps/system/components/kata-os-common/src/model/arch/aarch32.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // ARM aarch32 target support. #![allow(non_camel_case_types)] diff --git a/apps/system/components/kata-os-common/src/model/arch/aarch64.rs b/apps/system/components/kata-os-common/src/model/arch/aarch64.rs index 4ee75b2..761aebf 100644 --- a/apps/system/components/kata-os-common/src/model/arch/aarch64.rs +++ b/apps/system/components/kata-os-common/src/model/arch/aarch64.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // ARM aarch64 target support. #![allow(non_camel_case_types)] diff --git a/apps/system/components/kata-os-common/src/model/arch/arm.rs b/apps/system/components/kata-os-common/src/model/arch/arm.rs index e2800b3..aab1c37 100644 --- a/apps/system/components/kata-os-common/src/model/arch/arm.rs +++ b/apps/system/components/kata-os-common/src/model/arch/arm.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // ARM common target support. #![allow(non_camel_case_types)] diff --git a/apps/system/components/kata-os-common/src/model/arch/riscv.rs b/apps/system/components/kata-os-common/src/model/arch/riscv.rs index 869f2a5..1733214 100644 --- a/apps/system/components/kata-os-common/src/model/arch/riscv.rs +++ b/apps/system/components/kata-os-common/src/model/arch/riscv.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // RISC-V common target support. #![allow(non_camel_case_types)] diff --git a/apps/system/components/kata-os-common/src/model/arch/riscv32.rs b/apps/system/components/kata-os-common/src/model/arch/riscv32.rs index 47c93b3..708301f 100644 --- a/apps/system/components/kata-os-common/src/model/arch/riscv32.rs +++ b/apps/system/components/kata-os-common/src/model/arch/riscv32.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // RISC-V 32-bit target support. #![allow(non_camel_case_types)] diff --git a/apps/system/components/kata-os-common/src/model/arch/riscv64.rs b/apps/system/components/kata-os-common/src/model/arch/riscv64.rs index f480c1f..e396d55 100644 --- a/apps/system/components/kata-os-common/src/model/arch/riscv64.rs +++ b/apps/system/components/kata-os-common/src/model/arch/riscv64.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // RISC-V 64-bit target support. #![allow(non_camel_case_types)] diff --git a/apps/system/components/kata-os-common/src/model/arch/x86.rs b/apps/system/components/kata-os-common/src/model/arch/x86.rs index f5faea3..03c70c1 100644 --- a/apps/system/components/kata-os-common/src/model/arch/x86.rs +++ b/apps/system/components/kata-os-common/src/model/arch/x86.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Intel x86 32-bit target support. use static_assertions::assert_cfg; diff --git a/apps/system/components/kata-os-common/src/model/arch/x86_64.rs b/apps/system/components/kata-os-common/src/model/arch/x86_64.rs index 0e1f566..769ceda 100644 --- a/apps/system/components/kata-os-common/src/model/arch/x86_64.rs +++ b/apps/system/components/kata-os-common/src/model/arch/x86_64.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Intel x86 64-bit target support. use static_assertions::assert_cfg; diff --git a/apps/system/components/kata-os-common/src/model/build.rs b/apps/system/components/kata-os-common/src/model/build.rs index 3b22c8d..b4220f7 100644 --- a/apps/system/components/kata-os-common/src/model/build.rs +++ b/apps/system/components/kata-os-common/src/model/build.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + extern crate sel4_config; use std::env; use std::fs; diff --git a/apps/system/components/kata-os-common/src/model/feature/dynamic_alloc.rs b/apps/system/components/kata-os-common/src/model/feature/dynamic_alloc.rs index c7f292c..b2f8929 100644 --- a/apps/system/components/kata-os-common/src/model/feature/dynamic_alloc.rs +++ b/apps/system/components/kata-os-common/src/model/feature/dynamic_alloc.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Dynamic Object Allocation. use crate::KataOsModel; diff --git a/apps/system/components/kata-os-common/src/model/feature/mcs.rs b/apps/system/components/kata-os-common/src/model/feature/mcs.rs index b97d28e..c5f029f 100644 --- a/apps/system/components/kata-os-common/src/model/feature/mcs.rs +++ b/apps/system/components/kata-os-common/src/model/feature/mcs.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // MCS Kernel Support. use crate::KataOsModel; diff --git a/apps/system/components/kata-os-common/src/model/feature/no_mcs.rs b/apps/system/components/kata-os-common/src/model/feature/no_mcs.rs index 4f825e3..ee277fb 100644 --- a/apps/system/components/kata-os-common/src/model/feature/no_mcs.rs +++ b/apps/system/components/kata-os-common/src/model/feature/no_mcs.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // No MCS Kernel Support. use crate::KataOsModel; diff --git a/apps/system/components/kata-os-common/src/model/feature/no_smp.rs b/apps/system/components/kata-os-common/src/model/feature/no_smp.rs index 727f229..047be58 100644 --- a/apps/system/components/kata-os-common/src/model/feature/no_smp.rs +++ b/apps/system/components/kata-os-common/src/model/feature/no_smp.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // No SMP support. // TODO(sleffler): maybe merge into arch code diff --git a/apps/system/components/kata-os-common/src/model/feature/no_spill_tcb_args.rs b/apps/system/components/kata-os-common/src/model/feature/no_spill_tcb_args.rs index 85f7b0b..a887ede 100644 --- a/apps/system/components/kata-os-common/src/model/feature/no_spill_tcb_args.rs +++ b/apps/system/components/kata-os-common/src/model/feature/no_spill_tcb_args.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Register Calling Convention. // Max 4 arguments are passed to threads using registers. diff --git a/apps/system/components/kata-os-common/src/model/feature/no_vcpu.rs b/apps/system/components/kata-os-common/src/model/feature/no_vcpu.rs index 457e946..bba423d 100644 --- a/apps/system/components/kata-os-common/src/model/feature/no_vcpu.rs +++ b/apps/system/components/kata-os-common/src/model/feature/no_vcpu.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // No Hypervisor Support. use crate::KataOsModel; diff --git a/apps/system/components/kata-os-common/src/model/feature/smp.rs b/apps/system/components/kata-os-common/src/model/feature/smp.rs index 3b69bb3..8d36c94 100644 --- a/apps/system/components/kata-os-common/src/model/feature/smp.rs +++ b/apps/system/components/kata-os-common/src/model/feature/smp.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // SMP support. // TODO(sleffler): maybe merge into arch code diff --git a/apps/system/components/kata-os-common/src/model/feature/spill_tcb_args.rs b/apps/system/components/kata-os-common/src/model/feature/spill_tcb_args.rs index 1c8330e..58eebac 100644 --- a/apps/system/components/kata-os-common/src/model/feature/spill_tcb_args.rs +++ b/apps/system/components/kata-os-common/src/model/feature/spill_tcb_args.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Spill-to-stack Calling Convention. // The first REG_ARGS arguments are passed to threads using registers; // any more arguments are written to the stack. diff --git a/apps/system/components/kata-os-common/src/model/feature/static_alloc.rs b/apps/system/components/kata-os-common/src/model/feature/static_alloc.rs index 62f80a6..266d09f 100644 --- a/apps/system/components/kata-os-common/src/model/feature/static_alloc.rs +++ b/apps/system/components/kata-os-common/src/model/feature/static_alloc.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Static Object Allocation. // Expect a statically-allocated capDL spec. diff --git a/apps/system/components/kata-os-common/src/model/feature/vcpu.rs b/apps/system/components/kata-os-common/src/model/feature/vcpu.rs index 5e3165d..e96dfe2 100644 --- a/apps/system/components/kata-os-common/src/model/feature/vcpu.rs +++ b/apps/system/components/kata-os-common/src/model/feature/vcpu.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Hypervisor Support. use crate::KataOsModel; diff --git a/apps/system/components/kata-os-common/src/model/mod.rs b/apps/system/components/kata-os-common/src/model/mod.rs index 65ce632..3b7386c 100644 --- a/apps/system/components/kata-os-common/src/model/mod.rs +++ b/apps/system/components/kata-os-common/src/model/mod.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // capDL bootstrap for KataOs. // // Constructs a system of multiple components according to the capDL diff --git a/apps/system/components/kata-os-common/src/panic/src/lib.rs b/apps/system/components/kata-os-common/src/panic/src/lib.rs index b65a110..0beabbf 100644 --- a/apps/system/components/kata-os-common/src/panic/src/lib.rs +++ b/apps/system/components/kata-os-common/src/panic/src/lib.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #![no_std] #[cfg(not(test))] diff --git a/apps/system/components/kata-os-common/src/scheduling/src/lib.rs b/apps/system/components/kata-os-common/src/scheduling/src/lib.rs index d8a04f2..41e267c 100644 --- a/apps/system/components/kata-os-common/src/scheduling/src/lib.rs +++ b/apps/system/components/kata-os-common/src/scheduling/src/lib.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + //! Kata OS seL4 scheduling primitives #![no_std] diff --git a/apps/system/components/kata-os-common/src/sel4-config/src/lib.rs b/apps/system/components/kata-os-common/src/sel4-config/src/lib.rs index 8e8efc4..5c67485 100644 --- a/apps/system/components/kata-os-common/src/sel4-config/src/lib.rs +++ b/apps/system/components/kata-os-common/src/sel4-config/src/lib.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Cargo/rust build glue to import seL4 kernel configuration. We // parse the gen_config.h file from a build area to find features // needed by a dependent crate (sel4-sys, kata-os-rootserver, etc). diff --git a/apps/system/components/kata-os-common/src/sel4-sys/arch/arm_generic.rs b/apps/system/components/kata-os-common/src/sel4-sys/arch/arm_generic.rs index dfe3659..aae379e 100644 --- a/apps/system/components/kata-os-common/src/sel4-sys/arch/arm_generic.rs +++ b/apps/system/components/kata-os-common/src/sel4-sys/arch/arm_generic.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Arch-independent aliases. pub type seL4_ASIDControl = seL4_ARM_ASIDControl; pub type seL4_ASIDPool = seL4_ARM_ASIDPool; diff --git a/apps/system/components/kata-os-common/src/sel4-sys/arch/riscv_generic.rs b/apps/system/components/kata-os-common/src/sel4-sys/arch/riscv_generic.rs index 84a40f2..3c5be40 100644 --- a/apps/system/components/kata-os-common/src/sel4-sys/arch/riscv_generic.rs +++ b/apps/system/components/kata-os-common/src/sel4-sys/arch/riscv_generic.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Arch-independent aliases. pub type seL4_ASIDControl = seL4_RISCV_ASIDControl; pub type seL4_ASIDPool = seL4_RISCV_ASIDPool; diff --git a/apps/system/components/kata-os-common/src/sel4-sys/arch/x86_64.rs b/apps/system/components/kata-os-common/src/sel4-sys/arch/x86_64.rs index ba4dc8b..719d452 100644 --- a/apps/system/components/kata-os-common/src/sel4-sys/arch/x86_64.rs +++ b/apps/system/components/kata-os-common/src/sel4-sys/arch/x86_64.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + pub const seL4_WordBits: usize = 64; pub const seL4_PageBits: usize = 12; pub const seL4_SlotBits: usize = 5; diff --git a/apps/system/components/kata-os-common/src/sel4-sys/arch/x86_generic.rs b/apps/system/components/kata-os-common/src/sel4-sys/arch/x86_generic.rs index b3b43d7..666b0b0 100644 --- a/apps/system/components/kata-os-common/src/sel4-sys/arch/x86_generic.rs +++ b/apps/system/components/kata-os-common/src/sel4-sys/arch/x86_generic.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Arch-independent aliases. pub type seL4_ASIDControl = seL4_X86_ASIDControl; pub type seL4_ASIDPool = seL4_X86_ASIDPool; diff --git a/apps/system/components/kata-os-common/src/sel4-sys/debug.rs b/apps/system/components/kata-os-common/src/sel4-sys/debug.rs index ff6fbd6..7a672c6 100644 --- a/apps/system/components/kata-os-common/src/sel4-sys/debug.rs +++ b/apps/system/components/kata-os-common/src/sel4-sys/debug.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #![allow(dead_code)] // Support for debugging capability handling. These only do something diff --git a/apps/system/components/kata-os-common/src/slot-allocator/src/lib.rs b/apps/system/components/kata-os-common/src/slot-allocator/src/lib.rs index ba528c4..72a41a6 100644 --- a/apps/system/components/kata-os-common/src/slot-allocator/src/lib.rs +++ b/apps/system/components/kata-os-common/src/slot-allocator/src/lib.rs @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + //! An allocator for an array of integer-numbered objects. This is //! typically used to track capability slots in a CNode, though it //! can be used for other purposes.