mirror of
https://github.com/ziglang/zig.git
synced 2024-11-28 08:02:32 +00:00
32 lines
556 B
Zig
32 lines
556 B
Zig
pub export fn _start() noreturn {
|
|
print();
|
|
exit(0);
|
|
}
|
|
|
|
fn print() void {
|
|
asm volatile ("svc #0"
|
|
:
|
|
: [number] "{x8}" (64),
|
|
[arg1] "{x0}" (1),
|
|
[arg2] "{x1}" (@ptrToInt("Hello, World!\n")),
|
|
[arg3] "{x2}" ("Hello, World!\n".len),
|
|
: "memory", "cc"
|
|
);
|
|
}
|
|
|
|
fn exit(ret: usize) noreturn {
|
|
asm volatile ("svc #0"
|
|
:
|
|
: [number] "{x8}" (93),
|
|
[arg1] "{x0}" (ret),
|
|
: "memory", "cc"
|
|
);
|
|
unreachable;
|
|
}
|
|
|
|
// run
|
|
// target=aarch64-linux
|
|
//
|
|
// Hello, World!
|
|
//
|