Skip to content
Snippets Groups Projects
Commit 9bf6c2f7 authored by ja3-saxby's avatar ja3-saxby
Browse files

Got write system call working properly

parent 7b1c7048
No related branches found
No related tags found
2 merge requests!22Merge Feature/system calls,!10Implement the write() system call
...@@ -60,6 +60,7 @@ syscall_handler (struct intr_frame *f UNUSED) ...@@ -60,6 +60,7 @@ syscall_handler (struct intr_frame *f UNUSED)
break; break;
case SYSCALL_EXIT: case SYSCALL_EXIT:
syscall_exit(f); syscall_exit(f);
thread_exit();
break; break;
case SYSCALL_EXEC: case SYSCALL_EXEC:
syscall_exec(f); syscall_exec(f);
......
...@@ -13,9 +13,6 @@ void syscall_write(struct intr_frame *f) { ...@@ -13,9 +13,6 @@ void syscall_write(struct intr_frame *f) {
int fd = *((int*)f->esp + 1); // file descriptor is second argument int fd = *((int*)f->esp + 1); // file descriptor is second argument
void* buffer = (void*)(*((int*)f->esp + 2)); // buffer is third argument void* buffer = (void*)(*((int*)f->esp + 2)); // buffer is third argument
unsigned size = *((unsigned*)((int*)f->esp + 3)); // size to write is fourth unsigned size = *((unsigned*)((int*)f->esp + 3)); // size to write is fourth
printf("syscall_write: fd = %d\n", fd);
printf("syscall_write: buffer = '%s'\n", buffer);
printf("syscall_write: size = %u\n", size);
// writing to stdout or stderr (fd in {1, 2}) is a special case // writing to stdout or stderr (fd in {1, 2}) is a special case
switch (fd) { switch (fd) {
case 1: case 1:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment