ld: switch to ifc-generated ipc interface
This commit is contained in:
@@ -9,7 +9,7 @@ set_target_properties(ld PROPERTIES
|
||||
OUTPUT_NAME "ld64"
|
||||
SUFFIX ".so")
|
||||
|
||||
target_link_libraries(ld ulibc libmango libmsg-fs)
|
||||
target_link_libraries(ld ulibc libmango interface::fs)
|
||||
|
||||
target_compile_options(ld PRIVATE
|
||||
-fPIC -fno-stack-protector -nostdlib -ffreestanding)
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
.extern main
|
||||
.type main, @function
|
||||
|
||||
.extern exit
|
||||
.type exit, @function
|
||||
.extern task_exit
|
||||
.type task_exit, @function
|
||||
|
||||
_start:
|
||||
call main
|
||||
mov %rax, %rdi
|
||||
call task_exit
|
||||
1: pause
|
||||
jmp 1b
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user