Add aarch64 execution infrastructure
This commit is contained in:
parent
ad82c64d4d
commit
69f969bb71
|
|
@ -0,0 +1,5 @@
|
|||
.global _main
|
||||
|
||||
_main:
|
||||
mov x0, 42 // exit code
|
||||
ret
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
.global main
|
||||
main:
|
||||
bl _main
|
||||
mov x8, 93 // sys_exit() is at index 93 in kernel functions table
|
||||
svc #0 // generate kernel call sys_exit(123);
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#lang racket
|
||||
|
||||
(require "test-util.scm")
|
||||
|
||||
(test-eq
|
||||
(compile-arm-asm "aarch64-hello.s" "a.out")
|
||||
#t)
|
||||
|
||||
(test-eq
|
||||
(run-arm-executable "a.out")
|
||||
42)
|
||||
|
|
@ -1,7 +1,14 @@
|
|||
#lang racket
|
||||
|
||||
(provide test-eq)
|
||||
(require racket/system)
|
||||
|
||||
(provide test-eq compile-arm-asm run-arm-executable)
|
||||
|
||||
(define (test-eq a b)
|
||||
(if (equal? a b) (displayln "PASS") (error (format "FAIL: ~a != ~a" a b))))
|
||||
|
||||
(define (compile-arm-asm filename outfilename)
|
||||
(system (format "aarch64-linux-gnu-gcc -static ~a runtime.s -o ~a" filename outfilename)))
|
||||
|
||||
(define (run-arm-executable filename)
|
||||
(system/exit-code (format "qemu-aarch64 ./~a" filename)))
|
||||
|
|
|
|||
Loading…
Reference in New Issue