Parse a `.s` text file as assembly tokens, link with stdlib, and assemble.
(path: &str, mode: TargetMode)
| 386 | Ok(ExitCode::from((code & 0xFF) as u8)) |
| 387 | } |
| 388 | RunKind::KernelBoot => run_kernel_config(&engine, &config, max_steps), |
| 389 | RunKind::Freestanding => { |
| 390 | let outcome = engine.build_config(&config).map_err(map_session_error)?; |
| 391 | let mut vm = VirtualMachine::new(&outcome.artifacts.linked); |
| 392 | let result = vm.run(max_steps); |
| 393 | print!("{}", result.uart_output); |
| 394 | match result.outcome { |
| 395 | StepOutcome::Halted(code) => { |
| 396 | eprintln!("fsc: program exited with code {code}"); |
| 397 | Ok(ExitCode::from((code & 0xFF) as u8)) |
| 398 | } |
| 399 | StepOutcome::Continue => Err(CliError::Timeout(max_steps)), |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | fn run_kernel_config( |
| 406 | engine: &SessionEngine<'_>, |
| 407 | config: &RunConfig, |
| 408 | max_steps: u64, |
| 409 | ) -> Result<ExitCode, CliError> { |
| 410 | let boot = engine |
| 411 | .boot_kernel_config(config) |
no test coverage detected