add sys_add_three_integers

This commit is contained in:
2024-09-12 12:59:18 -04:00
parent f5117281a3
commit 090b997d35
9 changed files with 40 additions and 1 deletions

View File

@@ -114,6 +114,12 @@ void syscall(struct trapframe *tf) {
err = sys_printchar((char)tf->tf_a0);
break;
case SYS_add_three_integers:
err = sys_add_three_integers((int)tf->tf_a0, (int)tf->tf_a1, (int)tf->tf_a2,
&retval);
kprintf("%d\n", retval);
break;
/* Add stuff here */
default:

View File

@@ -380,6 +380,7 @@ file syscall/loadelf.c
file syscall/runprogram.c
file syscall/time_syscalls.c
file syscall/printchar.c
file syscall/add_three_integers.c
#
# Startup and initialization

View File

@@ -95,6 +95,7 @@
// #define SYS_setpriority 39
// (process groups, sessions, and job control)
#define SYS_printchar 41
#define SYS_add_three_integers 42
// #define SYS_getpgid 40
// #define SYS_setpgid 41
// #define SYS_getsid 42

View File

@@ -59,4 +59,6 @@ int sys___time(userptr_t user_seconds, userptr_t user_nanoseconds);
int sys_printchar(char c);
int sys_add_three_integers(int a, int b, int c, int *ret);
#endif /* _SYSCALL_H_ */

View File

@@ -0,0 +1,8 @@
#include <types.h>
#include <lib.h>
#include <syscall.h>
int sys_add_three_integers(int a, int b, int c, int *ret) {
*ret = a + b + c;
return 0;
}