aboutsummaryrefslogtreecommitdiff
path: root/examples/create_process/src/main2.zig
blob: e487df94bb30cb88c9b1441083359ef814ca6d35 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// SPDX-FileCopyrightText: 2024 Himbeer <himbeer@disroot.org>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

export fn _start() void {
    main();
}

pub fn main() void {
    const msg = "Hello from program 2";
    asm volatile (
        \\ li a7, 100001
        \\ ecall
        :
        : [ptr] "{a0}" (msg.ptr),
          [len] "{a1}" (msg.len),
        : "a7"
    );

    asm volatile (
        \\ li a7, 100003
        \\ ecall
        ::: "a7", "a1");
}