MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / run_kernel_hll

Function run_kernel_hll

tests/integration/platform_stdlib.rs:439–480  ·  view source on GitHub ↗

Compile user code linked against the kernel stdlib. The kernel stdlib uses the "__kern_str_" string-label prefix so rodata labels never clash with user-code labels (which use "str_").

(user_src: &str)

Source from the content-addressed store, hash-verified

437 assert_eq!(uart, "PASS");
438 assert_eq!(exit, Some(0));
439}
440
441#[test]
442fn mem_cmp_detects_difference() {
443 // The first differing byte determines the sign.
444 let (uart, exit) = run_hll(
445 r#"
446console := import("console")
447mem := import("mem")
448
449main: () -> i32 {
450 a: u8[2] = []
451 b: u8[2] = []
452 a[0] = 65
453 a[1] = 66
454 b[0] = 65
455 b[1] = 67
456 a_ptr: u8* = &a[0]
457 b_ptr: u8* = &b[0]
458 result: i32 = mem.cmp(a_ptr, b_ptr, 2)
459 if result < 0 {
460 console.putchar(80)
461 console.putchar(65)
462 console.putchar(83)
463 console.putchar(83)
464 }
465 return 0
466}
467"#,
468 );
469 assert_eq!(uart, "PASS");
470 assert_eq!(exit, Some(0));
471}
472
473// --- klog.hll ---
474
475#[test]
476fn klog_ok_output() {
477 let (uart, exit) = run_with(
478 KLOG_SRC,
479 r#"
480main: () -> i32 {
481 klog_ok("boot".ptr)
482 return 0
483}

Calls 11

compile_stdlib_objectsFunction · 0.85
set_write_artifactsMethod · 0.80
set_source_preludeMethod · 0.80
mark_entry_globalMethod · 0.80
collectMethod · 0.80
pushMethod · 0.80
compileMethod · 0.45
assembleMethod · 0.45
runMethod · 0.45