Merge basic system calls with stack set-up infrastructure #27

Merged
td1223 merged 31 commits from user-programs into user-programs-stdout 2024-11-06 22:21:28 +00:00
5 changed files with 227 additions and 126 deletions
Showing only changes of commit 02fff62ca2 - Show all commits

View File

@@ -161,19 +161,19 @@ syscall_read (int fd, void *buffer, unsigned size)
validate_user_pointer (buffer, size);
if (fd == STDIN_FILENO)
{
/* Reading from the console. */
char *write_buffer = buffer;
for (int i = 0; i < size; i++)
write_buffer[i] = input_getc ();
{
/* Reading from the console. */
char *write_buffer = buffer;
for (int i = 0; i < size; i++)
write_buffer[i] = input_getc ();
return size;
}
return size;
}
else
{
/* Reading from a file. */
return 0; // TODO: Implement Write to Files
}
{
/* Reading from a file. */
return 0; // TODO: Implement Write to Files
}
}
static int
@@ -231,4 +231,4 @@ validate_user_pointer (const void *ptr, size_t size)
thread_exit ();
return ptr;
}
}