()
| 975 | "#, |
| 976 | ); |
| 977 | assert_eq!(exit, Some(0)); |
| 978 | } |
| 979 | |
| 980 | // --- Kernel boot --- |
| 981 | |
| 982 | // The kernel stdlib prefixes rodata labels with "__kern_str_" so they never |
| 983 | // clash with user-code "str_" labels. |
| 984 | fn run_kernel_hll(user_src: &str) -> (String, Option<i64>) { |
| 985 | let snippet_manifest = BuildManifest::from_file( |
| 986 | std::path::Path::new(env!("CARGO_MANIFEST_DIR")) |
| 987 | .join("tests/fixtures/kernel_snippet.build"), |
| 988 | ) |
| 989 | .expect("kernel snippet build file parse"); |
| 990 | let stdlib_objs = CompilationPipeline::compile_stdlib_objects(TargetMode::Kernel) |
| 991 | .expect("kernel stdlib compile"); |
| 992 | // Kernel module dependency objects (vmm, pmm, ...) from the my_kernel closure; drop the |
| 993 | // `my_kernel` object so the test's own kmain (`user`) supplies the entry. |
| 994 | let kernel_objs = |
| 995 | CompilationPipeline::compile_kernel_module_objects().expect("kernel modules compile"); |
| 996 | |
| 997 | let mut user_pipeline = CompilationPipeline::new(); |
| 998 | user_pipeline.set_write_artifacts(false); |
| 999 | // user_src is kernel source (a kmain); give it the shared kernel layout header. |
| 1000 | user_pipeline.set_source_prelude(os_runtime::kernel::LAYOUT); |
| 1001 | let user = user_pipeline.compile(user_src).expect("user compile"); |
| 1002 | let (_, user_tokens) = user_pipeline.compile_ir_to_assembly_with_tokens(&user.ir_program); |
| 1003 | let mut user_obj = user_pipeline.assemble(&user_tokens).expect("user assemble"); |
| 1004 | for export in &snippet_manifest.abi_exports { |
| 1005 | user_obj.mark_entry_global(export); |
| 1006 | } |
| 1007 | |
| 1008 | let mut modules: Vec<(&str, &AssembledOutput)> = |
| 1009 | stdlib_objs.iter().map(|(n, o)| (n.as_str(), o)).collect(); |
| 1010 | for (name, obj) in &kernel_objs { |
nothing calls this directly
no test coverage detected