Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove MCLONE system call #118

Merged
merged 2 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/syscalls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
| 12 | [EXIT_THREAD](exit-thread.md) | Terminate the current thread |
| 13 | [MMAP](mmap.md) | Map memory |
| 14 | [CREATE_PROCESS](create-process.md) | Create a process |
| 15 | [MCLONE](mclone.md) | Clone a memory mapping |
| 15 | - | Reserved |
| 16 | [DUP](dup.md) | Duplicate a descriptor |
| 17 | [CLOSE](close.md) | Close a descriptor |
| 18 | [DESTROY](destroy.md) | Destroy a kernel object |
Expand All @@ -30,7 +30,7 @@
| 21 | [AWAIT_THREAD](await-thread.md) | Wait for a thread to exit |
| 22 | [REPLY_ERROR](reply-error.md) | Reply to message with an error |
| 23-4095 | - | Reserved |
| 4096+ | [SEND](send.md) | Send a message |
| 4096+ | [SEND](send.md) | Send a message |

#### Reserved Function Numbers

Expand Down
87 changes: 0 additions & 87 deletions doc/syscalls/mclone.md

This file was deleted.

9 changes: 0 additions & 9 deletions include/jinue/jinue.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ int jinue_create_endpoint(int fd, int *perrno);

int jinue_create_process(int fd, int *perrno);

int jinue_mclone(
int src,
int dest,
void *src_addr,
void *dest_addr,
size_t length,
int prot,
int *perrno);

int jinue_dup(int process, int src, int dest, int *perrno);

int jinue_close(int fd, int *perrno);
Expand Down
3 changes: 0 additions & 3 deletions include/jinue/shared/asm/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@
/** create a new process */
#define JINUE_SYS_CREATE_PROCESS 14

/** clone a memory mapping from the current process to another */
#define JINUE_SYS_MCLONE 15

/** duplicate a descriptor from the current process to another */
#define JINUE_SYS_DUP 16

Expand Down
7 changes: 0 additions & 7 deletions include/jinue/shared/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ typedef struct {
uint64_t paddr;
} jinue_mmap_args_t;

typedef struct {
void *src_addr;
void *dest_addr;
size_t length;
int prot;
} jinue_mclone_args_t;

typedef struct {
int process;
int fd;
Expand Down
2 changes: 0 additions & 2 deletions include/kernel/application/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ void *get_thread_local(void);

int get_address_map(const jinue_buffer_t *buffer);

int mclone(int src, int dest, const jinue_mclone_args_t *args);

int mint(int owner, const jinue_mint_args_t *args);

int mmap(int process_fd, const jinue_mmap_args_t *args);
Expand Down
1 change: 0 additions & 1 deletion kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ sources.kernel.c = \
application/syscalls/await_thread.c \
application/syscalls/mint.c \
application/syscalls/mmap.c \
application/syscalls/mclone.c \
application/syscalls/puts.c \
application/syscalls/reboot.c \
application/syscalls/receive.c \
Expand Down
125 changes: 0 additions & 125 deletions kernel/application/syscalls/mclone.c

This file was deleted.

56 changes: 0 additions & 56 deletions kernel/interface/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,59 +375,6 @@ static void sys_create_process(jinue_syscall_args_t *args) {
set_return_value_or_error(args, retval);
}

static void sys_mclone(jinue_syscall_args_t *args) {
const jinue_mclone_args_t *userspace_mclone_args;

int src = get_descriptor(args->arg1);
int dest = get_descriptor(args->arg2);
userspace_mclone_args = (void *)args->arg3;

if(src < 0) {
set_return_value_or_error(args, src);
return;
}

if(dest < 0) {
set_return_value_or_error(args, dest);
return;
}

if(! check_userspace_buffer(userspace_mclone_args, sizeof(jinue_mclone_args_t))) {
set_error(args, JINUE_EINVAL);
return;
}

jinue_mclone_args_t mclone_args = *userspace_mclone_args;

if(OFFSET_OF_PTR(mclone_args.src_addr, PAGE_SIZE) != 0) {
set_error(args, JINUE_EINVAL);
return;
}

if(OFFSET_OF_PTR(mclone_args.dest_addr, PAGE_SIZE) != 0) {
set_error(args, JINUE_EINVAL);
return;
}

if((mclone_args.length & (PAGE_SIZE -1)) != 0) {
set_error(args, JINUE_EINVAL);
return;
}

if((mclone_args.prot & ~ALL_PROT_FLAGS) != 0) {
set_error(args, JINUE_EINVAL);
return;
}

if((mclone_args.prot & WRITE_EXEC) == WRITE_EXEC) {
set_error(args, JINUE_ENOTSUP);
return;
}

int retval = mclone(src, dest, &mclone_args);
set_return_value_or_error(args, retval);
}

static void sys_dup(jinue_syscall_args_t *args) {
int process_fd = get_descriptor(args->arg1);
int src = get_descriptor(args->arg2);
Expand Down Expand Up @@ -607,9 +554,6 @@ void handle_syscall(jinue_syscall_args_t *args) {
case JINUE_SYS_CREATE_PROCESS:
sys_create_process(args);
break;
case JINUE_SYS_MCLONE:
sys_mclone(args);
break;
case JINUE_SYS_DUP:
sys_dup(args);
break;
Expand Down
25 changes: 0 additions & 25 deletions userspace/lib/jinue/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,31 +222,6 @@ int jinue_create_process(int fd, int *perrno) {
return call_with_usual_convention(&args, perrno);
}

int jinue_mclone(
int src,
int dest,
void *src_addr,
void *dest_addr,
size_t length,
int prot,
int *perrno) {

jinue_syscall_args_t args;
jinue_mclone_args_t mclone_args;

mclone_args.src_addr = src_addr;
mclone_args.dest_addr = dest_addr;
mclone_args.length = length;
mclone_args.prot = prot;

args.arg0 = JINUE_SYS_MCLONE;
args.arg1 = src;
args.arg2 = dest;
args.arg3 = (uintptr_t)&mclone_args;

return call_with_usual_convention(&args, perrno);
}

int jinue_dup(int process, int src, int dest, int *perrno) {
jinue_syscall_args_t args;

Expand Down
Loading