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

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