2021-04-27 09:12:59 +01:00
|
|
|
const std = @import("std");
|
|
|
|
const TestContext = @import("../../src/test.zig").TestContext;
|
|
|
|
|
|
|
|
const linux_riscv64 = std.zig.CrossTarget{
|
|
|
|
.cpu_arch = .riscv64,
|
|
|
|
.os_tag = .linux,
|
|
|
|
};
|
|
|
|
|
|
|
|
pub fn addCases(ctx: *TestContext) !void {
|
|
|
|
{
|
|
|
|
var case = ctx.exe("riscv64 hello world", linux_riscv64);
|
|
|
|
// Regular old hello world
|
|
|
|
case.addCompareOutput(
|
2021-11-20 14:30:53 +00:00
|
|
|
\\pub fn main() void {
|
2021-04-27 09:12:59 +01:00
|
|
|
\\ print();
|
|
|
|
\\}
|
|
|
|
\\
|
|
|
|
\\fn print() void {
|
|
|
|
\\ asm volatile ("ecall"
|
|
|
|
\\ :
|
|
|
|
\\ : [number] "{a7}" (64),
|
|
|
|
\\ [arg1] "{a0}" (1),
|
|
|
|
\\ [arg2] "{a1}" (@ptrToInt("Hello, World!\n")),
|
|
|
|
\\ [arg3] "{a2}" ("Hello, World!\n".len)
|
|
|
|
\\ : "rcx", "r11", "memory"
|
|
|
|
\\ );
|
|
|
|
\\ return;
|
|
|
|
\\}
|
|
|
|
,
|
|
|
|
"Hello, World!\n",
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|