summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-04-15 20:34:58 +0200
committerAnton Kling <anton@kling.gg>2024-04-15 20:34:58 +0200
commit62ba2a9ab01e5f2a9b1cd325af8d3112702b7713 (patch)
tree0926fbbc9d8c0058ee0f37e4f8691a554ca647e3
parent3acd8cf6c8e41c1e1228c60ac5c4ea0f69e7aff5 (diff)
Bug fix and cleanup.
-rw-r--r--kernel/Makefile4
-rw-r--r--kernel/arch/i386/mmu.c1
-rw-r--r--kernel/cpu/idt.c2
-rw-r--r--kernel/cpu/syscall.c78
-rw-r--r--kernel/drivers/rtl8139.c1
-rw-r--r--kernel/fs/vfs.c3
-rw-r--r--kernel/ipc.c121
-rw-r--r--kernel/ipc.h28
-rw-r--r--kernel/kmalloc.c1
-rw-r--r--kernel/libc/include/string.h1
-rw-r--r--kernel/libc/string/copy.c9
-rw-r--r--kernel/libc/string/strncpy.c11
-rw-r--r--kernel/sched/scheduler.c18
-rw-r--r--kernel/sched/scheduler.h2
-rw-r--r--kernel/syscalls/getcwd.c1
-rw-r--r--kernel/syscalls/ipc.c18
-rwxr-xr-xmeta/run.sh2
-rw-r--r--userland/libc/include/syscall.h38
18 files changed, 59 insertions, 280 deletions
diff --git a/kernel/Makefile b/kernel/Makefile
index 19853a7..3f09855 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -1,7 +1,7 @@
CC="i686-sb-gcc"
AS="i686-sb-as"
-OBJ = arch/i386/boot.o init/kernel.o cpu/gdt.o cpu/reload_gdt.o cpu/idt.o cpu/io.o libc/stdio/print.o drivers/keyboard.o log.o drivers/pit.o libc/string/memcpy.o libc/string/strlen.o libc/string/memcmp.o drivers/ata.o libc/string/memset.o cpu/syscall.o read_eip.o libc/exit/assert.o process.o libc/string/strcpy.o arch/i386/mmu.o kmalloc.o fs/ext2.o fs/vfs.o fs/devfs.o cpu/spinlock.o random.o libc/string/strcmp.o crypto/ChaCha20/chacha20.o crypto/SHA1/sha1.o fs/tmpfs.o libc/string/isequal.o drivers/pst.o syscalls/ppoll.o syscalls/ftruncate.o kubsan.o syscalls/mmap.o drivers/serial.o syscalls/accept.o syscalls/bind.o syscalls/socket.o socket.o poll.o fs/fifo.o hashmap/hashmap.o fs/shm.o syscalls/shm.o elf.o ksbrk.o sched/scheduler.o syscalls/stat.o libc/string/copy.o libc/string/strncpy.o drivers/mouse.o libc/string/strlcpy.o libc/string/strcat.o drivers/vbe.o syscalls/msleep.o syscalls/uptime.o syscalls/mkdir.o drivers/pci.o drivers/rtl8139.o network/ethernet.o network/arp.o network/bytes.o network/ipv4.o network/udp.o syscalls/recvfrom.o math.o syscalls/sendto.o signal.o syscalls/kill.o syscalls/sigaction.o network/tcp.o drivers/ahci.o crypto/xoshiro256plusplus/xoshiro256plusplus.o syscalls/chdir.o syscalls/getcwd.o syscalls/isatty.o syscalls/randomfill.o syscalls/open.o syscalls/write.o syscalls/pwrite.o ipc.o syscalls/ipc.o syscalls/port.o syscalls/map_frames.o syscalls/virtual_to_physical.o syscalls/install_irq.o arch/i386/interrupts.o cpu/isr.o lib/stack.o lib/buffered_write.o lib/list.o cpu/arch_inst.o cpu/int_syscall.o queue.o syscalls/queue.o syscalls/munmap.o syscalls/open_process.o
-CFLAGS = -std=c99 -Ofast -fsanitize=vla-bound,shift-exponent,pointer-overflow,shift,signed-integer-overflow,bounds -ggdb -ffreestanding -Wall -Werror -mgeneral-regs-only -Wimplicit-fallthrough -I./libc/include/ -I. -Wno-pointer-sign -DKERNEL
+OBJ = arch/i386/boot.o init/kernel.o cpu/gdt.o cpu/reload_gdt.o cpu/idt.o cpu/io.o libc/stdio/print.o drivers/keyboard.o log.o drivers/pit.o libc/string/memcpy.o libc/string/strlen.o libc/string/memcmp.o drivers/ata.o libc/string/memset.o cpu/syscall.o read_eip.o libc/exit/assert.o process.o libc/string/strcpy.o arch/i386/mmu.o kmalloc.o fs/ext2.o fs/vfs.o fs/devfs.o cpu/spinlock.o random.o libc/string/strcmp.o crypto/ChaCha20/chacha20.o crypto/SHA1/sha1.o fs/tmpfs.o libc/string/isequal.o drivers/pst.o syscalls/ppoll.o syscalls/ftruncate.o kubsan.o syscalls/mmap.o drivers/serial.o syscalls/accept.o syscalls/bind.o syscalls/socket.o socket.o poll.o fs/fifo.o hashmap/hashmap.o fs/shm.o syscalls/shm.o elf.o ksbrk.o sched/scheduler.o syscalls/stat.o libc/string/copy.o drivers/mouse.o libc/string/strlcpy.o libc/string/strcat.o drivers/vbe.o syscalls/msleep.o syscalls/uptime.o syscalls/mkdir.o drivers/pci.o drivers/rtl8139.o network/ethernet.o network/arp.o network/bytes.o network/ipv4.o network/udp.o syscalls/recvfrom.o math.o syscalls/sendto.o signal.o syscalls/kill.o syscalls/sigaction.o network/tcp.o drivers/ahci.o crypto/xoshiro256plusplus/xoshiro256plusplus.o syscalls/chdir.o syscalls/getcwd.o syscalls/isatty.o syscalls/randomfill.o syscalls/open.o syscalls/write.o syscalls/pwrite.o syscalls/port.o syscalls/map_frames.o syscalls/virtual_to_physical.o syscalls/install_irq.o arch/i386/interrupts.o cpu/isr.o lib/stack.o lib/buffered_write.o lib/list.o cpu/arch_inst.o cpu/int_syscall.o queue.o syscalls/queue.o syscalls/munmap.o syscalls/open_process.o
+CFLAGS = -std=c99 -O0 -fsanitize=vla-bound,shift-exponent,pointer-overflow,shift,signed-integer-overflow,bounds -ggdb -ffreestanding -Wall -Werror -mgeneral-regs-only -Wimplicit-fallthrough -I./libc/include/ -I. -Wno-pointer-sign -DKERNEL
#CFLAGS = -std=c99 -Ofast -flto -ggdb -ffreestanding -Wall -Werror -mgeneral-regs-only -Wimplicit-fallthrough -I./libc/include/ -I. -Wno-pointer-sign -DKERNEL
#CFLAGS = -std=c99 -O0 -fsanitize=vla-bound,shift-exponent,pointer-overflow,shift,signed-integer-overflow,bounds -ggdb -ffreestanding -Wall -Werror -mgeneral-regs-only -Wimplicit-fallthrough -I./libc/include/ -I. -Wno-pointer-sign -DKERNEL
#CFLAGS = -std=c99 -Ofast -ggdb -ffreestanding -Wall -Werror -mgeneral-regs-only -Wimplicit-fallthrough -I./libc/include/ -I. -Wno-pointer-sign -DKERNEL
diff --git a/kernel/arch/i386/mmu.c b/kernel/arch/i386/mmu.c
index ce20208..3e8570d 100644
--- a/kernel/arch/i386/mmu.c
+++ b/kernel/arch/i386/mmu.c
@@ -712,6 +712,7 @@ void paging_init(u64 memsize, multiboot_info_t *mb) {
available_memory_kb = memsize;
+ num_of_frames = max(num_of_frames, num_array_frames);
void *new = kmalloc(num_of_frames * sizeof(u32));
memset(new, 0xFF, num_of_frames * sizeof(u32));
memcpy(new, tmp_small_frames, num_array_frames * sizeof(u32));
diff --git a/kernel/cpu/idt.c b/kernel/cpu/idt.c
index 0d031f3..b668c6e 100644
--- a/kernel/cpu/idt.c
+++ b/kernel/cpu/idt.c
@@ -101,7 +101,7 @@ void page_fault(reg_t *regs) {
kprintf("Attempted instruction fetch\n");
}
- dump_backtrace(8);
+ dump_backtrace(20);
halt();
}
diff --git a/kernel/cpu/syscall.c b/kernel/cpu/syscall.c
index d3da640..a33a6e2 100644
--- a/kernel/cpu/syscall.c
+++ b/kernel/cpu/syscall.c
@@ -156,61 +156,31 @@ int syscall_tcp_read(u32 socket, u8 *buffer, u32 buffer_size, u64 *out) {
}
int (*syscall_functions[])() = {
- (void(*))syscall_open,
- (void(*))syscall_mread,
- (void(*))syscall_write,
- (void(*))syscall_pread,
- (void(*))syscall_pwrite,
- (void(*))syscall_fork,
- (void(*))syscall_exec,
- (void(*))syscall_getpid,
- (void(*))syscall_exit,
- (void(*))syscall_wait,
- (void(*))syscall_brk,
- (void(*))syscall_sbrk,
- (void(*))syscall_pipe,
- (void(*))syscall_dup2,
- (void(*))syscall_close,
- (void(*))syscall_openpty,
- (void(*))syscall_poll,
- (void(*))syscall_mmap,
- (void(*))syscall_accept,
- (void(*))syscall_bind,
- (void(*))syscall_socket,
- (void(*))syscall_shm_open,
- (void(*))syscall_ftruncate,
- (void(*))syscall_stat,
- (void(*))syscall_msleep,
- (void(*))syscall_uptime,
- (void(*))syscall_mkdir,
- (void(*))syscall_recvfrom,
- (void(*))syscall_sendto,
- (void(*))syscall_kill,
- (void(*))syscall_sigaction,
- (void(*))syscall_chdir,
- (void(*))syscall_getcwd,
- (void(*))syscall_isatty,
- (void(*))syscall_randomfill,
- (void(*))syscall_ipc_register_endpoint,
- (void(*))syscall_ipc_read,
- (void(*))syscall_ipc_write,
- (void(*))syscall_ipc_write_to_process,
- (void(*))syscall_outw,
- (void(*))syscall_inl,
- (void(*))syscall_outl,
- (void(*))syscall_map_frames,
- (void(*))syscall_virtual_to_physical,
- (void(*))syscall_install_irq,
- (void(*))syscall_tmp_handle_packet,
-
- (void(*))syscall_tcp_connect,
- (void(*))syscall_tcp_write,
+ (void(*))syscall_open, (void(*))syscall_mread,
+ (void(*))syscall_write, (void(*))syscall_pread,
+ (void(*))syscall_pwrite, (void(*))syscall_fork,
+ (void(*))syscall_exec, (void(*))syscall_getpid,
+ (void(*))syscall_exit, (void(*))syscall_wait,
+ (void(*))syscall_brk, (void(*))syscall_sbrk,
+ (void(*))syscall_pipe, (void(*))syscall_dup2,
+ (void(*))syscall_close, (void(*))syscall_openpty,
+ (void(*))syscall_poll, (void(*))syscall_mmap,
+ (void(*))syscall_accept, (void(*))syscall_bind,
+ (void(*))syscall_socket, (void(*))syscall_shm_open,
+ (void(*))syscall_ftruncate, (void(*))syscall_stat,
+ (void(*))syscall_msleep, (void(*))syscall_uptime,
+ (void(*))syscall_mkdir, (void(*))syscall_recvfrom,
+ (void(*))syscall_sendto, (void(*))syscall_kill,
+ (void(*))syscall_sigaction, (void(*))syscall_chdir,
+ (void(*))syscall_getcwd, (void(*))syscall_isatty,
+ (void(*))syscall_randomfill, (void(*))syscall_outw,
+ (void(*))syscall_inl, (void(*))syscall_outl,
+ (void(*))syscall_map_frames, (void(*))syscall_virtual_to_physical,
+ (void(*))syscall_install_irq, (void(*))syscall_tmp_handle_packet,
+ (void(*))syscall_tcp_connect, (void(*))syscall_tcp_write,
(void(*))syscall_tcp_read,
-
- (void(*))syscall_queue_create,
- (void(*))syscall_queue_add,
- (void(*))syscall_queue_wait,
- (void(*))syscall_munmap,
+ (void(*))syscall_queue_create, (void(*))syscall_queue_add,
+ (void(*))syscall_queue_wait, (void(*))syscall_munmap,
(void(*))syscall_open_process,
};
diff --git a/kernel/drivers/rtl8139.c b/kernel/drivers/rtl8139.c
index 5a11e74..592397f 100644
--- a/kernel/drivers/rtl8139.c
+++ b/kernel/drivers/rtl8139.c
@@ -3,7 +3,6 @@
#include <cpu/io.h>
#include <drivers/pci.h>
#include <drivers/rtl8139.h>
-#include <ipc.h>
#include <mmu.h>
#include <network/arp.h>
#include <network/ethernet.h>
diff --git a/kernel/fs/vfs.c b/kernel/fs/vfs.c
index bff0cb6..8ae2b1f 100644
--- a/kernel/fs/vfs.c
+++ b/kernel/fs/vfs.c
@@ -315,6 +315,9 @@ int raw_vfs_pread(vfs_fd_t *vfs_fd, void *buf, u64 count, u64 offset) {
if (!(vfs_fd->flags & O_READ)) {
return -EBADF;
}
+ assert(vfs_fd);
+ assert(vfs_fd->inode);
+ assert(vfs_fd->inode->read);
return vfs_fd->inode->read(buf, offset, count, vfs_fd);
}
diff --git a/kernel/ipc.c b/kernel/ipc.c
deleted file mode 100644
index a3e1160..0000000
--- a/kernel/ipc.c
+++ /dev/null
@@ -1,121 +0,0 @@
-#include <assert.h>
-#include <interrupts.h>
-#include <ipc.h>
-#include <math.h>
-#include <stdbool.h>
-#include <string.h>
-
-struct IpcEndpoint {
- u8 in_use;
- u32 pid;
-};
-
-struct IpcEndpoint ipc_endpoints[100];
-
-bool ipc_register_endpoint(u32 endpoint) {
- if (endpoint >= 100) {
- return false;
- }
- if (ipc_endpoints[endpoint].in_use) {
- return false;
- }
- ipc_endpoints[endpoint].in_use = 1;
- ipc_endpoints[endpoint].pid = current_task->pid;
- return true;
-}
-
-bool ipc_endpoint_to_pid(u32 endpoint, u32 *pid) {
- if (endpoint >= 100) {
- return false;
- }
- if (!ipc_endpoints[endpoint].in_use) {
- return false;
- }
- *pid = ipc_endpoints[endpoint].pid;
- return true;
-}
-
-int ipc_get_mailbox(u32 id, struct IpcMailbox **out) {
- process_t *p;
- if (!get_task_from_pid(id, &p)) {
- return 0;
- }
- *out = &p->ipc_mailbox;
- return 1;
-}
-
-int ipc_has_data(process_t *p) {
- if (!p) {
- p = current_task;
- }
- struct IpcMailbox *handler = &p->ipc_mailbox;
- u32 read_ptr = handler->read_ptr;
- struct IpcMessage *ipc_message = &handler->data[read_ptr];
- return ipc_message->is_used;
-}
-
-int ipc_read(u8 *buffer, u32 length, u32 *sender_pid) {
- struct IpcMailbox *handler = &current_task->ipc_mailbox;
-
- u32 read_ptr = handler->read_ptr;
- struct IpcMessage *ipc_message = &handler->data[read_ptr];
- for (;;) {
- if (!ipc_message->is_used) {
- if (current_task->is_interrupted) {
- current_task->is_interrupted = 0;
- current_task->is_halted = 0;
- return 0;
- }
- current_task->is_halted = 1;
- switch_task();
- continue;
- }
- break;
- }
- current_task->is_halted = 0;
- disable_interrupts();
- ipc_message->is_used = 0;
- // TODO: Verify sender_pid is a valid address
- if (sender_pid) {
- assert(mmu_is_valid_userpointer(sender_pid, sizeof(ipc_message->sender_pid)));
- *sender_pid = ipc_message->sender_pid;
- }
-
- u32 len = min(length, ipc_message->size);
- memcpy(buffer, ipc_message->buffer, len);
-
- // Update read_ptr
- read_ptr++;
- if (read_ptr >= IPC_NUM_DATA) {
- read_ptr = 0;
- }
- handler->read_ptr = read_ptr;
- return len;
-}
-
-int ipc_write_to_process(int pid, u8 *buffer, u32 length) {
- struct IpcMailbox *handler;
- assert(ipc_get_mailbox(pid, &handler));
-
- u32 write_ptr = handler->write_ptr;
- struct IpcMessage *ipc_message = &handler->data[write_ptr];
- ipc_message->is_used = 1;
- u32 len = min(IPC_BUFFER_SIZE, length);
- ipc_message->sender_pid = current_task->pid;
- ipc_message->size = len;
- memcpy(ipc_message->buffer, buffer, len);
-
- // Update write_ptr
- write_ptr++;
- if (write_ptr >= IPC_NUM_DATA) {
- write_ptr = 0;
- }
- handler->write_ptr = write_ptr;
- return len;
-}
-
-int ipc_write(int endpoint, u8 *buffer, u32 length) {
- u32 pid;
- assert(ipc_endpoint_to_pid(endpoint, &pid));
- return ipc_write_to_process(pid, buffer, length);
-}
diff --git a/kernel/ipc.h b/kernel/ipc.h
deleted file mode 100644
index d8db074..0000000
--- a/kernel/ipc.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <sched/scheduler.h>
-#ifndef IPC_H
-#define IPC_H
-#include <stdbool.h>
-#include <typedefs.h>
-
-#define IPC_BUFFER_SIZE 0x2000
-#define IPC_NUM_DATA 400
-
-struct IpcMessage {
- u8 is_used;
- u32 sender_pid;
- u32 size;
- u8 buffer[IPC_BUFFER_SIZE];
-};
-
-struct IpcMailbox {
- u32 read_ptr;
- u32 write_ptr;
- struct IpcMessage data[IPC_NUM_DATA];
-};
-
-bool ipc_register_endpoint(u32 endpoint);
-int ipc_write_to_process(int pid, u8 *buffer, u32 length);
-int ipc_write(int ipc_id, u8 *buffer, u32 length);
-int ipc_read(u8 *buffer, u32 length, u32 *sender_pid);
-int ipc_has_data(process_t *p);
-#endif
diff --git a/kernel/kmalloc.c b/kernel/kmalloc.c
index 59cc93d..84a16bd 100644
--- a/kernel/kmalloc.c
+++ b/kernel/kmalloc.c
@@ -152,7 +152,6 @@ void merge_headers(MallocHeader *b) {
}
void *int_kmalloc(size_t s) {
- s += 0x1000;
size_t n = s;
MallocHeader *free_entry = find_free_entry(s);
if (!free_entry) {
diff --git a/kernel/libc/include/string.h b/kernel/libc/include/string.h
index 707d391..89ea5ab 100644
--- a/kernel/libc/include/string.h
+++ b/kernel/libc/include/string.h
@@ -13,7 +13,6 @@ int isequal(const char *s1, const char *s2);
int isequal_n(const char *s1, const char *s2, u32 n);
char *copy_and_allocate_string(const char *s);
char *copy_and_allocate_user_string(const char *s);
-char *strncpy(char *dest, const char *src, size_t n);
size_t strlcpy(char *dst, const char *src, size_t dsize);
char *strcat(char *s1, const char *s2);
#endif
diff --git a/kernel/libc/string/copy.c b/kernel/libc/string/copy.c
index 11cd664..4acbbf4 100644
--- a/kernel/libc/string/copy.c
+++ b/kernel/libc/string/copy.c
@@ -4,12 +4,13 @@
#include <string.h>
char *copy_and_allocate_string(const char *s) {
- size_t l = strlen(s);
- char *r = kmalloc(l + 1);
+ size_t l = strlen(s) + 1;
+ char *r = kmalloc(l);
if (!r) {
return NULL;
}
- return strncpy(r, s, l);
+ memcpy(r, s, l);
+ return r;
}
char *copy_and_allocate_user_string(const char *s) {
@@ -24,6 +25,6 @@ char *copy_and_allocate_user_string(const char *s) {
if (!r) {
return NULL;
}
- strlcpy(r, s, len);
+ memcpy(r, s, len+1);
return r;
}
diff --git a/kernel/libc/string/strncpy.c b/kernel/libc/string/strncpy.c
deleted file mode 100644
index a886895..0000000
--- a/kernel/libc/string/strncpy.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <stddef.h>
-#include <string.h>
-
-// FIXME: Something is weird with this function
-char *strncpy(char *dest, const char *src, size_t n) {
- char *r = dest;
- for (; n && (*dest = *src); n--, src++, dest++)
- ;
- *dest = '\0';
- return r;
-}
diff --git a/kernel/sched/scheduler.c b/kernel/sched/scheduler.c
index 6f36a76..f56ff56 100644
--- a/kernel/sched/scheduler.c
+++ b/kernel/sched/scheduler.c
@@ -102,12 +102,13 @@ void insert_eip_on_stack(u32 cr3, u32 address, u32 value);
process_t *create_process(process_t *p, u32 esp, u32 eip) {
process_t *r;
r = kcalloc(1, sizeof(process_t));
- r->pid = next_pid++;
+ r->pid = next_pid;
+ next_pid++;
if (!p) {
assert(1 == next_pid);
- strncpy(r->program_name, "[kernel]", sizeof(current_task->program_name));
+ strlcpy(r->program_name, "[kernel]", sizeof(current_task->program_name));
} else {
- strncpy(r->program_name, "[Not yet named]",
+ strlcpy(r->program_name, "[Not yet named]",
sizeof(current_task->program_name));
}
@@ -182,8 +183,6 @@ void tasking_init(void) {
int i = 0;
void free_process(process_t *p) {
- kprintf("pid: %x\n", p->pid);
- kprintf("Exiting process: %s\n", p->program_name);
// free_process() will purge all contents such as allocated frames
// out of the current process. This will be called by exit() and
// exec*().
@@ -304,7 +303,7 @@ int exec(const char *filename, char **argv, int dealloc_argv,
return 0;
}
- strncpy(current_task->program_name, filename,
+ strlcpy(current_task->program_name, filename,
sizeof(current_task->program_name));
current_task->data_segment_end = align_page((void *)end_of_code);
@@ -405,13 +404,6 @@ int is_halted(process_t *process) {
}
}
- if (process->is_halted) {
- if (ipc_has_data(process)) {
- kprintf("ipc had data\n");
- return 0;
- }
- }
-
int queue_block = 1;
int wait_empty = 1;
for (int i = 0;; i++) {
diff --git a/kernel/sched/scheduler.h b/kernel/sched/scheduler.h
index bdf32d4..04259c2 100644
--- a/kernel/sched/scheduler.h
+++ b/kernel/sched/scheduler.h
@@ -3,7 +3,6 @@ typedef struct Process process_t;
#define SCHEDULER_H
#include <fs/ext2.h>
#include <fs/vfs.h>
-#include <ipc.h>
#include <lib/list.h>
#include <lib/stack.h>
#include <mmu.h>
@@ -61,7 +60,6 @@ struct Process {
void *signal_handlers[32];
void *interrupt_handler;
PageDirectory *cr3;
- struct IpcMailbox ipc_mailbox;
struct list file_descriptors;
diff --git a/kernel/syscalls/getcwd.c b/kernel/syscalls/getcwd.c
index c279428..bd0025d 100644
--- a/kernel/syscalls/getcwd.c
+++ b/kernel/syscalls/getcwd.c
@@ -3,7 +3,6 @@
#include <syscalls.h>
char *syscall_getcwd(char *buf, size_t size) {
- kprintf("syscall_getcwd\n");
const char *cwd = current_task->current_working_directory;
size_t len = min(size, strlen(cwd));
strlcpy(buf, current_task->current_working_directory, len);
diff --git a/kernel/syscalls/ipc.c b/kernel/syscalls/ipc.c
deleted file mode 100644
index b6947d1..0000000
--- a/kernel/syscalls/ipc.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <ipc.h>
-#include <syscalls.h>
-
-int syscall_ipc_register_endpoint(u32 id) {
- return ipc_register_endpoint(id);
-}
-
-int syscall_ipc_read(u8 *buffer, u32 length, u32 *sender_pid) {
- return ipc_read(buffer, length, sender_pid);
-}
-
-int syscall_ipc_write_to_process(int pid, u8 *buffer, u32 length) {
- return ipc_write_to_process(pid, buffer, length);
-}
-
-int syscall_ipc_write(int endpoint, u8 *buffer, u32 length) {
- return ipc_write(endpoint, buffer, length);
-}
diff --git a/meta/run.sh b/meta/run.sh
index 44fc40c..618dd5e 100755
--- a/meta/run.sh
+++ b/meta/run.sh
@@ -4,7 +4,7 @@ cd "$scriptdir"
cd ..
#qemu-system-i386 -netdev user,id=n0,hostfwd=tcp:127.0.0.1:6001-:6000 -device rtl8139,netdev=n0 -object filter-dump,id=id,netdev=n0,file=./logs/netout -d int -no-reboot -no-shutdown -chardev stdio,id=char0,logfile=./logs/serial.log,signal=off -serial chardev:char0 -drive id=disk,file=./meta/ext2.img,if=none -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0 -m 512M -cdrom ./kernel/myos.iso -s
#qemu-system-i386 -d int -netdev user,id=n0,hostfwd=tcp:127.0.0.1:6001-:6000 -device rtl8139,netdev=n0 -object filter-dump,id=id,netdev=n0,file=./logs/netout -no-reboot -no-shutdown -chardev stdio,id=char0,logfile=./logs/serial.log,signal=off -serial chardev:char0 -drive id=disk,file=./meta/ext2.img,if=none -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0 -m 512M -cdrom ./kernel/myos.iso -s
-qemu-system-i386 -d int -netdev user,id=n0,hostfwd=tcp:127.0.0.1:6001-:6000 -device rtl8139,netdev=n0 -object filter-dump,id=id,netdev=n0,file=./logs/netout -no-reboot -no-shutdown -chardev stdio,id=char0,logfile=./logs/serial.log,signal=off -serial chardev:char0 -drive id=disk,file=./meta/ext2.img,if=none -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0 -m 1G -cdrom ./kernel/myos.iso -s
+qemu-system-i386 -enable-kvm -netdev user,id=n0,hostfwd=tcp:127.0.0.1:6001-:6000 -device rtl8139,netdev=n0 -object filter-dump,id=id,netdev=n0,file=./logs/netout -no-reboot -no-shutdown -chardev stdio,id=char0,logfile=./logs/serial.log,signal=off -serial chardev:char0 -drive id=disk,file=./meta/ext2.img,if=none -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0 -m 128M -cdrom ./kernel/myos.iso -s
# Sync the sysroot
cd ./meta/
mkdir ./mount
diff --git a/userland/libc/include/syscall.h b/userland/libc/include/syscall.h
index c5fe3e4..1e8c86c 100644
--- a/userland/libc/include/syscall.h
+++ b/userland/libc/include/syscall.h
@@ -41,27 +41,23 @@
#define SYS_ISATTY 33
#define SYS_RANDOMFILL 34
-#define SYS_IPC_REGISTER_ENDPOINT 35
-#define SYS_IPC_READ 36
-#define SYS_IPC_WRITE 37
-#define SYS_IPC_WRITE_TO_PROCESS 38
-#define SYS_OUTW 39
-#define SYS_INL 40
-#define SYS_OUTL 41
-#define SYS_MAP_FRAMES 42
-#define SYS_VIRTUAL_TO_PHYSICAL 43
-#define SYS_INSTALL_IRQ 44
-#define SYS_TMP_KERNEL_HANDLE_PACKET 45
-
-#define SYS_TCP_CONNECT 46
-#define SYS_TCP_WRITE 47
-#define SYS_TCP_READ 48
-
-#define SYS_QUEUE_CREATE 49
-#define SYS_QUEUE_ADD 50
-#define SYS_QUEUE_WAIT 51
-#define SYS_MUNMAP 52
-#define SYS_OPEN_PROCESS 53
+#define SYS_OUTW 35
+#define SYS_INL 36
+#define SYS_OUTL 37
+#define SYS_MAP_FRAMES 38
+#define SYS_VIRTUAL_TO_PHYSICAL 39
+#define SYS_INSTALL_IRQ 40
+#define SYS_TMP_KERNEL_HANDLE_PACKET 41
+
+#define SYS_TCP_CONNECT 42
+#define SYS_TCP_WRITE 43
+#define SYS_TCP_READ 44
+
+#define SYS_QUEUE_CREATE 45
+#define SYS_QUEUE_ADD 46
+#define SYS_QUEUE_WAIT 47
+#define SYS_MUNMAP 48
+#define SYS_OPEN_PROCESS 49
int syscall(uint32_t eax, uint32_t ebx, uint32_t ecx, uint32_t edx,
uint32_t esi, uint32_t edi);