ld: remove test messages
This commit is contained in:
@@ -9,7 +9,9 @@ set_target_properties(ld PROPERTIES
|
||||
OUTPUT_NAME "ld64"
|
||||
SUFFIX ".so")
|
||||
|
||||
target_link_libraries(ld ulibc libmango interface::fs)
|
||||
target_link_libraries(ld
|
||||
libc-core libc-malloc libmango librosetta
|
||||
interface::fs)
|
||||
|
||||
target_compile_options(ld PRIVATE
|
||||
-fPIC -fno-stack-protector -nostdlib -ffreestanding)
|
||||
|
||||
@@ -1,30 +1,27 @@
|
||||
#define MSG_IMPLEMENTATION
|
||||
#define MSG_NO_MALLOC
|
||||
|
||||
#include <heap/heap.h>
|
||||
#include <mango/log.h>
|
||||
#include <mango/msg.h>
|
||||
#include <mango/task.h>
|
||||
#include <mango/types.h>
|
||||
#include <mango/vm.h>
|
||||
#include <rosetta/bootstrap.h>
|
||||
#include <rosetta/fs.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
const char **argv,
|
||||
kern_handle_t task,
|
||||
kern_handle_t address_space,
|
||||
uintptr_t bsp_base)
|
||||
int main(const struct rosetta_bootstrap *bs)
|
||||
{
|
||||
void *brk = sbrk(0);
|
||||
kern_logf("brk=%p", brk);
|
||||
kern_handle_t task, address_space;
|
||||
task_self(&task);
|
||||
task_get_address_space(task, &address_space);
|
||||
|
||||
void *buf = malloc(64);
|
||||
if (buf) {
|
||||
memset(buf, 0x0, 64);
|
||||
kern_logf("allocated 64 bytes at %p", buf);
|
||||
} else {
|
||||
kern_logf("malloc() failed");
|
||||
for (size_t i = 0; i < bs->bs_argc; i++) {
|
||||
kern_logf("argv[%zu]: %s", i, bs->bs_argv[i]);
|
||||
}
|
||||
|
||||
kern_handle_t port;
|
||||
@@ -34,16 +31,8 @@ int main(
|
||||
return -1;
|
||||
}
|
||||
|
||||
#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;
|
||||
@@ -53,10 +42,14 @@ int main(
|
||||
|
||||
if (status != KERN_OK) {
|
||||
kern_logf("open call failed (status %d)", status);
|
||||
} else {
|
||||
kern_logf("open(%s, %d) = %d", path, flags, err);
|
||||
} else {
|
||||
kern_logf(
|
||||
"open(%s, %d) = %s (%s)",
|
||||
path,
|
||||
flags,
|
||||
strerror_code(err),
|
||||
strerror(err));
|
||||
}
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user