Compare commits
8 Commits
dbb2d72bcb
...
e2b19c3e9a
| Author | SHA1 | Date | |
|---|---|---|---|
| e2b19c3e9a | |||
| 411423bf30 | |||
| 0183790af3 | |||
| 418c426e83 | |||
| eca9d3915b | |||
| d32988c56c | |||
| 02d4f43151 | |||
| 1645fdfb42 |
@@ -9,10 +9,11 @@ find_program(GDB gdb)
|
|||||||
|
|
||||||
set(patched_kernel ${CMAKE_CURRENT_BINARY_DIR}/kernel/${kernel_name}.elf32)
|
set(patched_kernel ${CMAKE_CURRENT_BINARY_DIR}/kernel/${kernel_name}.elf32)
|
||||||
set(generic_flags -m 1G)
|
set(generic_flags -m 1G)
|
||||||
|
set(no_debug_flags)
|
||||||
|
|
||||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
|
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
message(STATUS "QEMU: Enabling KVM acceleration")
|
message(STATUS "QEMU: Enabling KVM acceleration")
|
||||||
set(generic_flags ${generic_flags} -enable-kvm)
|
set(no_debug_flags ${no_debug_flags} -enable-kvm)
|
||||||
else ()
|
else ()
|
||||||
message(STATUS "QEMU: Host system is not Linux. KVM acceleration unavailable")
|
message(STATUS "QEMU: Host system is not Linux. KVM acceleration unavailable")
|
||||||
endif ()
|
endif ()
|
||||||
@@ -33,7 +34,7 @@ add_custom_target(run-kernel
|
|||||||
${QEMU}
|
${QEMU}
|
||||||
-kernel ${patched_kernel}
|
-kernel ${patched_kernel}
|
||||||
-initrd ${sys_dir}/${bsp_name}
|
-initrd ${sys_dir}/${bsp_name}
|
||||||
${generic_flags}
|
${generic_flags} ${no_debug_flags}
|
||||||
-serial stdio
|
-serial stdio
|
||||||
--append kernel.early-console=ttyS0
|
--append kernel.early-console=ttyS0
|
||||||
USES_TERMINAL
|
USES_TERMINAL
|
||||||
@@ -42,12 +43,12 @@ add_custom_target(run-kernel
|
|||||||
add_custom_target(run-kernel-monitor
|
add_custom_target(run-kernel-monitor
|
||||||
COMMAND
|
COMMAND
|
||||||
${QEMU}
|
${QEMU}
|
||||||
-kernel $<TARGET_FILE:${kernel_name}>
|
-kernel ${patched_kernel}
|
||||||
-initrd ${sys_dir}/${bsp_name}
|
-initrd ${sys_dir}/${bsp_name}
|
||||||
${generic_flags}
|
${generic_flags} ${no_debug_flags}
|
||||||
-monitor stdio
|
-monitor stdio
|
||||||
USES_TERMINAL
|
USES_TERMINAL
|
||||||
DEPENDS ${kernel_name} bsp)
|
DEPENDS ${patched_kernel} bsp)
|
||||||
|
|
||||||
if (image_cdrom)
|
if (image_cdrom)
|
||||||
message(STATUS "QEMU: Enable CD-ROM boot")
|
message(STATUS "QEMU: Enable CD-ROM boot")
|
||||||
@@ -55,7 +56,7 @@ if (image_cdrom)
|
|||||||
COMMAND
|
COMMAND
|
||||||
${QEMU}
|
${QEMU}
|
||||||
-cdrom ${image_cdrom}
|
-cdrom ${image_cdrom}
|
||||||
${generic_flags}
|
${generic_flags} ${no_debug_flags}
|
||||||
-serial stdio
|
-serial stdio
|
||||||
USES_TERMINAL
|
USES_TERMINAL
|
||||||
DEPENDS ${image_cdrom})
|
DEPENDS ${image_cdrom})
|
||||||
@@ -99,9 +100,9 @@ elseif (GDB)
|
|||||||
-initrd ${sys_dir}/${bsp_name}
|
-initrd ${sys_dir}/${bsp_name}
|
||||||
${generic_flags}
|
${generic_flags}
|
||||||
-s -S &
|
-s -S &
|
||||||
${GDB}
|
${GDB} -tui
|
||||||
-o "file ${CMAKE_BINARY_DIR}/kernel/${kernel_name}.debug"
|
-ex "file ${CMAKE_BINARY_DIR}/kernel/${kernel_name}.debug"
|
||||||
-o "remote localhost:1234"
|
-ex "target remote localhost:1234"
|
||||||
USES_TERMINAL
|
USES_TERMINAL
|
||||||
DEPENDS ${patched_kernel} bsp)
|
DEPENDS ${patched_kernel} bsp)
|
||||||
|
|
||||||
@@ -114,10 +115,9 @@ elseif (GDB)
|
|||||||
${generic_flags}
|
${generic_flags}
|
||||||
-s -S &
|
-s -S &
|
||||||
${GDB} -tui
|
${GDB} -tui
|
||||||
-s "${CMAKE_BINARY_DIR}/kernel/${kernel_name}.debug"
|
-ex "file ${CMAKE_BINARY_DIR}/kernel/${kernel_name}.debug"
|
||||||
-ex "target remote localhost:1234"
|
-ex "target remote localhost:1234"
|
||||||
USES_TERMINAL
|
USES_TERMINAL
|
||||||
DEPENDS ${image_cdrom})
|
DEPENDS ${image_cdrom})
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ if [ ! -n "$target_arch" ]; then
|
|||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
build_type=Debug
|
||||||
source_dir=$(realpath $(dirname "$0"))
|
source_dir=$(realpath $(dirname "$0"))
|
||||||
native_build_dir=$source_dir/build-native
|
native_build_dir=$source_dir/build-native
|
||||||
target_build_dir=$source_dir/build
|
target_build_dir=$source_dir/build
|
||||||
@@ -28,6 +29,7 @@ cmake \
|
|||||||
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$native_build_dir/lib" \
|
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$native_build_dir/lib" \
|
||||||
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="$native_build_dir/lib" \
|
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="$native_build_dir/lib" \
|
||||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||||
|
-DCMAKE_BUILD_TYPE=$build_type \
|
||||||
$source_dir/kernel/tools
|
$source_dir/kernel/tools
|
||||||
|
|
||||||
popd
|
popd
|
||||||
@@ -39,6 +41,7 @@ cmake \
|
|||||||
-DCMAKE_INSTALL_PREFIX=$sysroot_dir \
|
-DCMAKE_INSTALL_PREFIX=$sysroot_dir \
|
||||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||||
-DTARGET_ARCH=$target_arch \
|
-DTARGET_ARCH=$target_arch \
|
||||||
|
-DCMAKE_BUILD_TYPE=$build_type \
|
||||||
$source_dir \
|
$source_dir \
|
||||||
-DCMAKE_MODULE_PATH=$source_dir/arch/$target_arch \
|
-DCMAKE_MODULE_PATH=$source_dir/arch/$target_arch \
|
||||||
-DCMAKE_SYSTEM_NAME=Rosetta \
|
-DCMAKE_SYSTEM_NAME=Rosetta \
|
||||||
|
|||||||
2
kernel
2
kernel
Submodule kernel updated: 5f0654430d...1c7c90ef39
@@ -18,4 +18,4 @@ sysroot_add_library(
|
|||||||
HEADER_DIR /usr/include
|
HEADER_DIR /usr/include
|
||||||
LIB_DIR /usr/lib)
|
LIB_DIR /usr/lib)
|
||||||
|
|
||||||
target_link_libraries(libmsg-fs libmsg libmango)
|
target_link_libraries(libmsg-fs libmsg libmango ulibc)
|
||||||
|
|||||||
@@ -1,3 +1,111 @@
|
|||||||
void msg_fs_tmp(void)
|
#include <rosetta/msg/fs.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
kern_status_t rosetta_msg_fs_open_send(
|
||||||
|
kern_handle_t port,
|
||||||
|
const char *path,
|
||||||
|
int flags,
|
||||||
|
int *out_err)
|
||||||
{
|
{
|
||||||
|
size_t path_len = strlen(path);
|
||||||
|
|
||||||
|
struct rosetta_msg_fs_open msg = {0};
|
||||||
|
rosetta_msg_init(&msg.msg_base, ROSETTA_MSG_FS, ROSETTA_MSG_FS_OPEN);
|
||||||
|
uint16_t offset = sizeof msg;
|
||||||
|
msg.msg_request.o_path = offset;
|
||||||
|
msg.msg_request.o_path_len = path_len;
|
||||||
|
msg.msg_request.o_flags = flags;
|
||||||
|
|
||||||
|
struct iovec send_vec[] = {
|
||||||
|
IOVEC(&msg, sizeof msg),
|
||||||
|
IOVEC(path, path_len),
|
||||||
|
};
|
||||||
|
|
||||||
|
struct iovec reply_vec[] = {
|
||||||
|
IOVEC(&msg, sizeof msg),
|
||||||
|
};
|
||||||
|
|
||||||
|
struct msg req = {
|
||||||
|
.msg_data = send_vec,
|
||||||
|
.msg_data_count = sizeof send_vec / sizeof send_vec[0],
|
||||||
|
};
|
||||||
|
|
||||||
|
struct msg resp = {
|
||||||
|
.msg_data = reply_vec,
|
||||||
|
.msg_data_count = sizeof reply_vec / sizeof reply_vec[0],
|
||||||
|
};
|
||||||
|
|
||||||
|
kern_status_t status = msg_send(port, 0, &req, &resp);
|
||||||
|
if (status != KERN_OK) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
*out_err = msg.msg_response.o_err;
|
||||||
|
|
||||||
|
return KERN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
kern_status_t rosetta_msg_fs_open_recv(
|
||||||
|
kern_handle_t channel,
|
||||||
|
msgid_t id,
|
||||||
|
struct rosetta_msg_string *out_path,
|
||||||
|
int *out_flags)
|
||||||
|
{
|
||||||
|
struct rosetta_msg_fs_open msg;
|
||||||
|
struct iovec vec = IOVEC(&msg, sizeof msg);
|
||||||
|
size_t r = 0;
|
||||||
|
|
||||||
|
kern_status_t status = msg_read(channel, id, 0, &vec, 1, &r);
|
||||||
|
if (status != KERN_OK) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r != sizeof msg) {
|
||||||
|
/* TODO better error code for malformed messages */
|
||||||
|
return KERN_INVALID_ARGUMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
out_path->s_len = msg.msg_request.o_path_len;
|
||||||
|
if (out_path->s_max > 0) {
|
||||||
|
vec.io_base = (virt_addr_t)out_path->s_buf;
|
||||||
|
vec.io_len = out_path->s_max - 1;
|
||||||
|
|
||||||
|
if (vec.io_len > out_path->s_len) {
|
||||||
|
vec.io_len = out_path->s_len;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = msg_read(
|
||||||
|
channel,
|
||||||
|
id,
|
||||||
|
msg.msg_request.o_path,
|
||||||
|
&vec,
|
||||||
|
1,
|
||||||
|
&r);
|
||||||
|
if (status != KERN_OK) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r != out_path->s_len) {
|
||||||
|
return KERN_INVALID_ARGUMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
out_path->s_buf[out_path->s_len] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
*out_flags = msg.msg_request.o_flags;
|
||||||
|
|
||||||
|
return KERN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
kern_status_t rosetta_msg_fs_open_reply(
|
||||||
|
kern_handle_t channel,
|
||||||
|
msgid_t id,
|
||||||
|
int err)
|
||||||
|
{
|
||||||
|
struct rosetta_msg_fs_open msg = {0};
|
||||||
|
msg.msg_response.o_err = err;
|
||||||
|
struct iovec vec = IOVEC(&msg, sizeof msg);
|
||||||
|
|
||||||
|
struct msg kmsg = {.msg_data = &vec, .msg_data_count = 1};
|
||||||
|
return msg_reply(channel, 0, id, &kmsg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,21 +7,36 @@
|
|||||||
#define ROSETTA_MSG_FS 0x01409DD2U
|
#define ROSETTA_MSG_FS 0x01409DD2U
|
||||||
|
|
||||||
/* rosetta.msg.fs.open message ID */
|
/* rosetta.msg.fs.open message ID */
|
||||||
#define ROSETTA_MSG_FS_OPEN 0x7D837778U
|
#define ROSETTA_MSG_FS_OPEN 0x7778U
|
||||||
|
|
||||||
struct rosetta_msg_fs_open {
|
struct rosetta_msg_fs_open {
|
||||||
struct rosetta_msg msg_base;
|
struct rosetta_msg msg_base;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint16_t o_path;
|
uint16_t o_path;
|
||||||
|
uint16_t o_path_len;
|
||||||
uint16_t o_flags;
|
uint16_t o_flags;
|
||||||
} msg_request;
|
} msg_request;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int o_err;
|
int o_err;
|
||||||
uint16_t o_fd_index;
|
|
||||||
} msg_response;
|
} msg_response;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern kern_status_t rosetta_msg_fs_open_send(
|
||||||
|
kern_handle_t port,
|
||||||
|
const char *path,
|
||||||
|
int flags,
|
||||||
|
int *out_err);
|
||||||
|
extern kern_status_t rosetta_msg_fs_open_recv(
|
||||||
|
kern_handle_t channel,
|
||||||
|
msgid_t id,
|
||||||
|
struct rosetta_msg_string *out_path,
|
||||||
|
int *out_flags);
|
||||||
|
extern kern_status_t rosetta_msg_fs_open_reply(
|
||||||
|
kern_handle_t channel,
|
||||||
|
msgid_t id,
|
||||||
|
int err);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -18,4 +18,4 @@ sysroot_add_library(
|
|||||||
HEADER_DIR /usr/include
|
HEADER_DIR /usr/include
|
||||||
LIB_DIR /usr/lib)
|
LIB_DIR /usr/lib)
|
||||||
|
|
||||||
target_link_libraries(libmsg libmango)
|
target_link_libraries(libmsg libmango ulibc)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#define ROSETTA_MSG_MAGIC 0x9AB07D10U
|
#define ROSETTA_MSG_MAGIC 0x9AB07D10U
|
||||||
|
|
||||||
|
#include <mango/msg.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
struct rosetta_msg {
|
struct rosetta_msg {
|
||||||
@@ -12,4 +13,19 @@ struct rosetta_msg {
|
|||||||
uint16_t msg_reserved;
|
uint16_t msg_reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct rosetta_msg_string {
|
||||||
|
char *s_buf;
|
||||||
|
size_t s_len;
|
||||||
|
size_t s_max;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern void rosetta_msg_init(
|
||||||
|
struct rosetta_msg *msg,
|
||||||
|
uint32_t protocol_id,
|
||||||
|
uint16_t msg_id);
|
||||||
|
extern kern_status_t rosetta_msg_recv(
|
||||||
|
kern_handle_t channel,
|
||||||
|
msgid_t *out_id,
|
||||||
|
struct rosetta_msg *out_msg);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,3 +1,33 @@
|
|||||||
void msg_tmp(void)
|
#include <rosetta/msg.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
void rosetta_msg_init(
|
||||||
|
struct rosetta_msg *msg,
|
||||||
|
uint32_t protocol_id,
|
||||||
|
uint16_t msg_id)
|
||||||
{
|
{
|
||||||
|
memset(msg, 0x0, sizeof *msg);
|
||||||
|
|
||||||
|
msg->msg_magic = ROSETTA_MSG_MAGIC;
|
||||||
|
msg->msg_protocol = protocol_id;
|
||||||
|
msg->msg_id = msg_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
kern_status_t rosetta_msg_recv(
|
||||||
|
kern_handle_t channel,
|
||||||
|
msgid_t *out_id,
|
||||||
|
struct rosetta_msg *out_msg)
|
||||||
|
{
|
||||||
|
struct iovec iov = IOVEC(out_msg, sizeof *out_msg);
|
||||||
|
struct msg kmsg = MSG(&iov, 1, NULL, 0);
|
||||||
|
kern_status_t status = msg_recv(channel, 0, out_id, &kmsg);
|
||||||
|
if (status != KERN_OK) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (out_msg->msg_magic != ROSETTA_MSG_MAGIC) {
|
||||||
|
return KERN_INVALID_ARGUMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return KERN_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ set_property(SOURCE ${arch_sources} PROPERTY LANGUAGE C)
|
|||||||
|
|
||||||
add_executable(bootstrap ${c_sources} ${arch_sources})
|
add_executable(bootstrap ${c_sources} ${arch_sources})
|
||||||
|
|
||||||
target_link_libraries(bootstrap libmango ulibc liblaunch)
|
target_link_libraries(bootstrap libmango ulibc liblaunch libmsg-fs)
|
||||||
|
|
||||||
target_compile_options(bootstrap PRIVATE
|
target_compile_options(bootstrap PRIVATE
|
||||||
-fPIC -pie -fno-stack-protector -nostdlib -ffreestanding)
|
-fPIC -pie -fno-stack-protector -nostdlib -ffreestanding)
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
#include <mango/msg.h>
|
#include <mango/msg.h>
|
||||||
#include <mango/task.h>
|
#include <mango/task.h>
|
||||||
#include <mango/types.h>
|
#include <mango/types.h>
|
||||||
|
#include <rosetta/msg.h>
|
||||||
|
#include <rosetta/msg/fs.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define INIT_PATH "/usr/bin/test"
|
#define INIT_PATH "/usr/bin/test"
|
||||||
|
|
||||||
@@ -98,27 +99,47 @@ int main(
|
|||||||
kern_logf("launch result: %d", status);
|
kern_logf("launch result: %d", status);
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
char msg_buf[512];
|
|
||||||
struct iovec vec = {
|
|
||||||
.io_base = (virt_addr_t)msg_buf,
|
|
||||||
.io_len = sizeof msg_buf,
|
|
||||||
};
|
|
||||||
struct msg msg = {.msg_data = &vec, .msg_data_count = 1};
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
msgid_t id = 0;
|
msgid_t id;
|
||||||
kern_status_t kstatus = msg_recv(channel, 0, &id, &msg);
|
struct rosetta_msg msg;
|
||||||
if (kstatus != KERN_OK) {
|
kern_status_t status = rosetta_msg_recv(channel, &id, &msg);
|
||||||
kern_logf("msg_recv failed %d", kstatus);
|
if (status != KERN_OK) {
|
||||||
break;
|
kern_logf("message recv error %d", status);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
kern_logf("received message %zx: %s", id, msg_buf);
|
if (msg.msg_protocol != ROSETTA_MSG_FS) {
|
||||||
|
kern_logf(
|
||||||
|
"unknown message protocol %u",
|
||||||
|
msg.msg_protocol);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
size_t len = snprintf(msg_buf, sizeof msg_buf, "Goodbye!");
|
if (msg.msg_id != ROSETTA_MSG_FS_OPEN) {
|
||||||
vec.io_len = len + 1;
|
kern_logf("unknown message function %u", msg.msg_id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
msg_reply(channel, 0, id, &msg);
|
char path[4096];
|
||||||
|
int flags;
|
||||||
|
struct rosetta_msg_string path_str = {
|
||||||
|
.s_buf = path,
|
||||||
|
.s_max = sizeof path,
|
||||||
|
};
|
||||||
|
status = rosetta_msg_fs_open_recv(
|
||||||
|
channel,
|
||||||
|
id,
|
||||||
|
&path_str,
|
||||||
|
&flags);
|
||||||
|
if (status != KERN_OK) {
|
||||||
|
kern_logf("rosetta.fs.open recv error %d", status);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
kern_logf("open(%s, %d)", path, flags);
|
||||||
|
|
||||||
|
rosetta_msg_fs_open_reply(channel, id, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
target_link_libraries(ld ulibc libmango libmsg-fs)
|
||||||
|
|
||||||
target_compile_options(ld PRIVATE
|
target_compile_options(ld PRIVATE
|
||||||
-fPIC -fno-stack-protector -nostdlib -ffreestanding)
|
-fPIC -fno-stack-protector -nostdlib -ffreestanding)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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 <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -35,21 +36,21 @@ int main(
|
|||||||
#if 1
|
#if 1
|
||||||
port_connect(port, 0, 0);
|
port_connect(port, 0, 0);
|
||||||
|
|
||||||
const char msg_buf[] = "Hello!";
|
const char *path = "/usr/lib/libc.so";
|
||||||
struct iovec vec = IOVEC(msg_buf, 7);
|
int flags = 4;
|
||||||
struct msg msg = MSG(&vec, 1, NULL, 0);
|
int err = 0;
|
||||||
|
|
||||||
char recv_buf[64];
|
kern_logf("calling open(%s, %d)", path, flags);
|
||||||
struct iovec recv_vec = IOVEC(recv_buf, sizeof recv_buf);
|
status = rosetta_msg_fs_open_send(port, path, flags, &err);
|
||||||
struct msg recv_msg = MSG(&recv_vec, 1, NULL, 0);
|
|
||||||
|
|
||||||
kern_logf("sending message...");
|
if (status != KERN_OK) {
|
||||||
status = msg_send(port, 0, &msg, &recv_msg);
|
kern_logf("open call failed (status %d)", status);
|
||||||
kern_logf("msg_send: %d", status);
|
} else if (err != 0) {
|
||||||
|
kern_logf("open call returned error %d", err);
|
||||||
if (status == KERN_OK) {
|
} else {
|
||||||
kern_logf("reply: %s", recv_buf);
|
kern_logf("open call succeeded");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user