ld: switch to ifc-generated ipc interface
This commit is contained in:
@@ -9,7 +9,7 @@ set_target_properties(ld PROPERTIES
|
|||||||
OUTPUT_NAME "ld64"
|
OUTPUT_NAME "ld64"
|
||||||
SUFFIX ".so")
|
SUFFIX ".so")
|
||||||
|
|
||||||
target_link_libraries(ld ulibc libmango libmsg-fs)
|
target_link_libraries(ld ulibc libmango interface::fs)
|
||||||
|
|
||||||
target_compile_options(ld PRIVATE
|
target_compile_options(ld PRIVATE
|
||||||
-fPIC -fno-stack-protector -nostdlib -ffreestanding)
|
-fPIC -fno-stack-protector -nostdlib -ffreestanding)
|
||||||
|
|||||||
@@ -6,10 +6,12 @@
|
|||||||
.extern main
|
.extern main
|
||||||
.type main, @function
|
.type main, @function
|
||||||
|
|
||||||
.extern exit
|
.extern task_exit
|
||||||
.type exit, @function
|
.type task_exit, @function
|
||||||
|
|
||||||
_start:
|
_start:
|
||||||
call main
|
call main
|
||||||
|
mov %rax, %rdi
|
||||||
|
call task_exit
|
||||||
1: pause
|
1: pause
|
||||||
jmp 1b
|
jmp 1b
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
#define MSG_IMPLEMENTATION
|
||||||
|
|
||||||
#include <mango/log.h>
|
#include <mango/log.h>
|
||||||
#include <mango/msg.h>
|
#include <mango/msg.h>
|
||||||
#include <mango/types.h>
|
#include <mango/types.h>
|
||||||
#include <rosetta/msg/fs.h>
|
#include <rosetta/fs.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -14,7 +16,6 @@ int main(
|
|||||||
kern_handle_t address_space,
|
kern_handle_t address_space,
|
||||||
uintptr_t bsp_base)
|
uintptr_t bsp_base)
|
||||||
{
|
{
|
||||||
kern_log("ld!");
|
|
||||||
void *brk = sbrk(0);
|
void *brk = sbrk(0);
|
||||||
kern_logf("brk=%p", brk);
|
kern_logf("brk=%p", brk);
|
||||||
|
|
||||||
@@ -36,19 +37,24 @@ int main(
|
|||||||
#if 1
|
#if 1
|
||||||
port_connect(port, 0, 0);
|
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";
|
const char *path = "/usr/lib/libc.so";
|
||||||
int flags = 4;
|
int flags = 4;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
kern_logf("calling open(%s, %d)", path, flags);
|
kern_logf("sending msg: open(%s, %d)", path, flags);
|
||||||
status = rosetta_msg_fs_open_send(port, path, flags, &err);
|
status = fs_open(port, path, flags, &err);
|
||||||
|
|
||||||
if (status != KERN_OK) {
|
if (status != KERN_OK) {
|
||||||
kern_logf("open call failed (status %d)", status);
|
kern_logf("open call failed (status %d)", status);
|
||||||
} else if (err != 0) {
|
} else {
|
||||||
kern_logf("open call returned error %d", err);
|
kern_logf("open(%s, %d) = %d", path, flags, err);
|
||||||
} else {
|
|
||||||
kern_logf("open call succeeded");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user