blob: 28fbca7e008061a8eaaf62dca0675f4d31735013 (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// SPDX-FileCopyrightText: 2024 Himbeer <himbeer@disroot.org>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
const program2 = @embedFile("program2");
var buf: [program2.len]u8 = undefined;
export fn _start() void {
main();
}
pub fn main() void {
const msg = "Hello from program 1\r\n";
asm volatile (
\\ li a7, 100001
\\ ecall
:
: [ptr] "{a0}" (msg.ptr),
[len] "{a1}" (msg.len),
: "a7"
);
@memcpy(buf[0..], program2);
asm volatile (
\\ li a7, 100002
\\ ecall
:
: [bytes] "{a0}" (&buf),
[len] "{a1}" (buf.len),
: "a7"
);
asm volatile (
\\ li a7, 100003
\\ ecall
::: "a7");
}
|