Plumbing thread related system calls into user-level
This commit is contained in:
parent
156e25fcc5
commit
858f3cff69
@ -26,7 +26,10 @@ int OSStat(const char *path, struct stat *sb);
|
||||
int OSReadDir(uint64_t fd, char *buf, size_t length, uint64_t *offset);
|
||||
|
||||
// Threads
|
||||
int OSThreadCreate(uint64_t rip);
|
||||
int OSThreadExit(uint64_t status);
|
||||
int OSThreadSleep(uint64_t time);
|
||||
int OSThreadWait(uint64_t tid);
|
||||
|
||||
#endif /* __SYSCALL_H__ */
|
||||
|
||||
|
@ -91,9 +91,27 @@ OSReadDir(uint64_t fd, char *buf, size_t length, uint64_t *offset)
|
||||
return syscall(SYSCALL_READDIR, fd, buf, length, offset);
|
||||
}
|
||||
|
||||
int
|
||||
OSThreadCreate(uint64_t rip)
|
||||
{
|
||||
return syscall(SYSCALL_THREADCREATE, rip);
|
||||
}
|
||||
|
||||
int
|
||||
OSThreadExit(uint64_t status)
|
||||
{
|
||||
return syscall(SYSCALL_THREADEXIT, status);
|
||||
}
|
||||
|
||||
int
|
||||
OSThreadSleep(uint64_t time)
|
||||
{
|
||||
return syscall(SYSCALL_THREADSLEEP, time);
|
||||
}
|
||||
|
||||
int
|
||||
OSThreadWait(uint64_t tid)
|
||||
{
|
||||
return syscall(SYSCALL_THREADWAIT, tid);
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#define SYSCALL_THREADCREATE 0x30
|
||||
#define SYSCALL_THREADEXIT 0x31
|
||||
#define SYSCALL_THREADSLEEP 0x32
|
||||
#define SYSCALL_THREADWAIT 0x33
|
||||
|
||||
// Network
|
||||
#define SYSCALL_SOCKET 0x40
|
||||
|
@ -320,6 +320,14 @@ Syscall_ThreadSleep(uint64_t time)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
Syscall_ThreadWait(uint64_t tid)
|
||||
{
|
||||
// XXX: Support waiting
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
Syscall_Entry(uint64_t syscall, uint64_t a1, uint64_t a2,
|
||||
uint64_t a3, uint64_t a4, uint64_t a5)
|
||||
@ -364,6 +372,8 @@ Syscall_Entry(uint64_t syscall, uint64_t a1, uint64_t a2,
|
||||
return 0;
|
||||
case SYSCALL_THREADSLEEP:
|
||||
return Syscall_ThreadSleep(a1);
|
||||
case SYSCALL_THREADWAIT:
|
||||
return Syscall_ThreadWait(a1);
|
||||
default:
|
||||
return (uint64_t)-1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user