ld: switch to ifc-generated ipc interface

This commit is contained in:
2026-02-26 19:48:06 +00:00
parent 285a80530d
commit 598bdb1410
3 changed files with 19 additions and 11 deletions

View File

@@ -1,7 +1,9 @@
#define MSG_IMPLEMENTATION
#include <mango/log.h>
#include <mango/msg.h>
#include <mango/types.h>
#include <rosetta/msg/fs.h>
#include <rosetta/fs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -14,7 +16,6 @@ int main(
kern_handle_t address_space,
uintptr_t bsp_base)
{
kern_log("ld!");
void *brk = sbrk(0);
kern_logf("brk=%p", brk);
@@ -36,19 +37,24 @@ int main(
#if 1
port_connect(port, 0, 0);
const char *str = "hello";
char new_buf[512] = {0};
struct msg_string new = {.str_buf = new_buf, .str_max = sizeof new_buf};
kern_logf("sending msg: uppercase(%s)", str);
status = fs_uppercase(port, str, &new);
kern_logf("uppercase(%s) = %s", str, new_buf);
const char *path = "/usr/lib/libc.so";
int flags = 4;
int err = 0;
kern_logf("calling open(%s, %d)", path, flags);
status = rosetta_msg_fs_open_send(port, path, flags, &err);
kern_logf("sending msg: open(%s, %d)", path, flags);
status = fs_open(port, path, flags, &err);
if (status != KERN_OK) {
kern_logf("open call failed (status %d)", status);
} else if (err != 0) {
kern_logf("open call returned error %d", err);
} else {
kern_logf("open call succeeded");
} else {
kern_logf("open(%s, %d) = %d", path, flags, err);
}
#endif