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

Function asm_block_round_trip

tests/vm_diag_test.rs:264–294  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

262fn asm_block_round_trip() {
263 let src = r#"
264; Writes a single byte via the Linux write syscall (syscall 64).
265; This mirrors a low-level write wrapper, implemented in HLL inline asm.
266write_byte: (c: i32) -> i32 {
267 asm {
268 addi sp, sp, -16
269 sd ra, 8(sp)
270 sb a0, 7(sp)
271 li a0, 1
272 addi a1, sp, 7
273 li a2, 1
274 li a7, 64
275 ecall
276 ld ra, 8(sp)
277 addi sp, sp, 16
278 }
279 return 0
280}
281
282main: () -> i32 {
283 write_byte(72) ; 'H'
284 write_byte(105) ; 'i'
285 write_byte(10) ; '\n'
286 return 0
287}
288"#;
289 let (uart, exit) = link_stdlib_and_run(src);
290 assert_eq!(uart.trim_end_matches('\n'), "Hi");
291 assert_eq!(exit, Some(0));
292}

Callers

nothing calls this directly

Calls 1

link_stdlib_and_runFunction · 0.85

Tested by

no test coverage detected