syscall fix variable decl
This commit is contained in:
parent
9376fc2df9
commit
9e528320cf
@ -1,36 +1,39 @@
|
|||||||
|
#include "syscall.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "klibc.h"
|
#include "klibc.h"
|
||||||
#include "stdarg.h"
|
#include "stdarg.h"
|
||||||
#include "syscall.h"
|
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
|
||||||
int syscallExecute(int syscallId, const struct cpu_state *userCtx){
|
int syscallExecute(int syscallId, const struct cpu_state *userCtx)
|
||||||
|
{
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
switch (syscallId) {
|
switch (syscallId) {
|
||||||
case SYSCALL_ID_EXIT:
|
case SYSCALL_ID_EXIT: {
|
||||||
uint status;
|
uint status;
|
||||||
ret = syscallGet1arg(userCtx, &status);
|
ret = syscallGet1arg(userCtx, &status);
|
||||||
if(ret != 0)
|
if (ret != 0)
|
||||||
break;
|
break;
|
||||||
threadExit();
|
threadExit();
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SYSCALL_ID_YOLO:
|
case SYSCALL_ID_YOLO:
|
||||||
ret = printf("YOLO FROM USERSPACE\n");
|
ret = printf("YOLO FROM USERSPACE\n");
|
||||||
break;
|
break;
|
||||||
case SYSCALL_ID_PUTC:
|
case SYSCALL_ID_PUTC: {
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
ret = syscallGet1arg(userCtx, &c);
|
ret = syscallGet1arg(userCtx, &c);
|
||||||
putc(c);
|
putc(c);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SYSCALL_ID_READ:
|
case SYSCALL_ID_READ:
|
||||||
ret = keyboardRead();
|
ret = keyboardRead();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Unknon syscall id %d\n", syscallId);
|
printf("Unknon syscall id %d\n", syscallId);
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user