summaryrefslogtreecommitdiff
path: root/interface/syscalls.c
diff options
context:
space:
mode:
Diffstat (limited to 'interface/syscalls.c')
-rw-r--r--interface/syscalls.c54
1 files changed, 30 insertions, 24 deletions
diff --git a/interface/syscalls.c b/interface/syscalls.c
index c9964fd..42fba62 100644
--- a/interface/syscalls.c
+++ b/interface/syscalls.c
@@ -14,40 +14,47 @@
// TODO ? all funct not preceeded with underscore should go as #defines
// inside headers! for newlib we define both here now ... //
+// TODO: do we want all the wrappers here?
+// TODO: how does the underscored and non-underscored versions work in gcc-linux
+// lookup : ELF symbol interposion!
-// BASICS //
+// FIRST SOME TRIVIAL BASICS //
+// They do not even call the kernel at all //
-// everybody is root
+/** everybody is root in Fool Os */
uid_t getuid(void)
{
return 0;
}
-// everybody is root
+/** everybody is root in Fool Os */
uid_t getgid(void)
{
return 0;
}
-// everybody is root
+/** everybody is root in Fool Os */
char *getlogin(void)
{
return "root";
}
-// the hostname is hard
+/** The hostname is hardcoded here.
+ * Just recompile if you want to change this ;)
+ */
int gethostname(char *name, size_t len)
{
- strcpy(name,"foolcomp");
+ strcpy(name,"foolbox");
return 0; //success
}
-// no sync needed for our ram-image so far (maye once w use DMA?)
+/** no sync required by our ram-image **/
void sync(void)
{
}
-// set working directory - we simply save this in PWD environment var
+/** set working directory.
+ * We save it in PWD environment var */
int chdir(const char *path)
{
char buf[256];
@@ -56,14 +63,14 @@ int chdir(const char *path)
return 0; // assume success
}
-// get working dir (see chdir)
+/** get working dir (see chdir) */
char* getwd(char *buf)
{
return strcpy(buf,getenv("PWD"));
}
-// HELPER for flushing stdout down the toilet when main exits //
-// newlib does not do this ? TODO: check what the standard says. //
+/** HELPER for flushing stdout down the toilet when main exits.
+ newlib does not do this ? TODO: check what the standard says. */
void _flushing()
{
fflush(stdout);
@@ -71,12 +78,12 @@ void _flushing()
// C NEWLIB //
-// here we have a few posix syscalls required by newlib
+// here we have a few posix syscalls, mostly required by newlib
// (we use version newlib-3.0.0.20180802)
// https://sourceware.org/newlib/libc.html#Syscalls
// just check liunx man-pages, how they SHOULD work.
-// holds environment variables
+/** holds environment variables */
extern char **environ;
// terminate caller
@@ -250,7 +257,6 @@ int gettimeofday(struct timeval *tv, void *tz)
return syscall(SYSCALL_GETTIMEOFDAY,tv,tz,0);
}
-// not sure if required by newlib ? ///
int _lstat(const char *file, struct stat *st)
{
return syscall(SYSCALL_LSTAT,file,st,0);
@@ -260,14 +266,14 @@ int lstat(const char *file, struct stat *st)
return syscall(SYSCALL_LSTAT,file,st,0);
}
-// like fork but keeps runin' on same memory so we have multithreading
+/** works like fork() but keeps running mostly on the same memory so we
+ * have multithreading as well. */
int _clone(void)
{
return syscall(SYSCALL_CLONE,0,0,0);
}
// DIRENT //
-
DIR *opendir(const char *name)
{
DIR *dir=malloc(sizeof(struct dirent));
@@ -333,26 +339,26 @@ int dup(int oldfd)
// PRIMITIVE GUI SYSCALLS //
-// create window for running process
-int _gui_win()
+/** create window for running process */
+int _gui_win(uint32_t xy, uint32_t wh,uint32_t f)
{
- return syscall(SYSCALL_GUI_WIN,0,0,0);
+ return syscall(SYSCALL_GUI_WIN,xy,wh,f);
}
-// swap buffers
-int _gui_rect()
+/** invalidate screen rectangle and set user framebuffer addy
+ * we pack x,y and width,height togehter */
+int _gui_inval(uint32_t xy, uint32_t wh, uint32_t addr)
{
- return syscall(SYSCALL_GUI_RECT,0,0,0);
+ return syscall(SYSCALL_GUI_RECT,xy,wh,addr);
}
////////////////////////////////////////// move along fool ///////////
//
// ALL calls under this lines are just stubs to let some 3rd party stuff
-// compile and fail silently on runtime where applicable.
+// compile and fail silently during runtime where applicable.
//
/////
-
long fpathconf(int fd, int name)
{
return syscall(SYSCALL_UNIMPLEMENTED,"fpathconf",0,0);