From e3a8099343aac9d94f411638ad84632d4b620132 Mon Sep 17 00:00:00 2001 From: Miguel Date: Mon, 15 Oct 2018 16:29:50 +0200 Subject: cleanup sys/ etc --- Makefile | 2 +- README.md | 4 +- fs/ext2.c | 29 ++-- fs/ext2.h | 6 +- fs/mount.c | 28 +++- fs/mount.h | 6 +- fs/sysfs.c | 6 +- interface/README | 7 +- interface/fs.h | 36 ----- interface/sys/dirent.h | 26 ++++ interface/sys/termios.h | 144 ++++++++++++++++++++ interface/syscalls.c | 345 ++++++++++++++++++++++-------------------------- interface/syscalls.h | 3 +- kernel/kernel.c | 1 + kernel/kernel.h | 12 +- kernel/scheduler.c | 4 + kernel/syscalls.c | 139 ++++++++++++++++--- lib/string/string.h | 2 +- userspace/Makefile | 28 +++- userspace/bigmem.c | 5 +- userspace/cat.c | 17 +-- userspace/files/.vimrc | 1 + userspace/fsh.c | 5 +- userspace/ls.c | 56 ++++---- userspace/pwd.c | 9 ++ userspace/snake.c | 48 ------- userspace/xterm/vesa.c | 2 +- 27 files changed, 580 insertions(+), 391 deletions(-) delete mode 100644 interface/fs.h create mode 100644 interface/sys/dirent.h create mode 100644 interface/sys/termios.h create mode 100644 userspace/pwd.c delete mode 100644 userspace/snake.c diff --git a/Makefile b/Makefile index c3efbee..f5a0fc4 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ qemu-debug: all -net nic,model=e1000 \ -net tap,ifname=tap0,script=no,downscript=no \ -vga virtio \ - -m 1024 -s -S + -m 2048 -s -S # qemu -enable-kvm -s -S ~/temp/FoolOs/disk.img # qemu -enable-kvm -s -singlestep disk.img # qemu-system-i386 -enable-kvm -s -S -kernel foolos.img -smp 4 -initrd userspace/ext2.img diff --git a/README.md b/README.md index 0665379..1f41779 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ mesa3d, quake,doom, netwookring tcp/ip --with-fallbacks="fool-term" --with-debug --prefix=/usr --with-termlib - ../ncurses-6.1/configure --host=i686-foolos --with-fallbacks="fool-term" --prefix=/usr --with-termlib + ../ncurses-6.1/configure --host=i686-foolos --with-fallbacks="fool-term" --prefix=/usr --with-termlib --with-debug * ncurses-examples: ../ncurses-examples-20180127/configure --host=i686-foolos --prefix=/usr --with-ncurses make DESTDIR=/home/miguel/temp/foolos/ install @@ -170,6 +170,8 @@ mesa3d, quake,doom, netwookring tcp/ip * vim: vim_cv_memcpy_handles_overlap=no vim_cv_bcopy_handles_overlap=no vim_cv_memmove_handles_overlap=no vim_cv_stat_ignores_slash=no vim_cv_getcwd_broken=no vim_cv_tty_group=world vim_cv_tty_mode=0620 vim_cv_tgetent=zero vim_cv_terminfo=no vim_cv_toupper_broken=no ./configure --host=i686-foolos --prefix=/usr --with-tlib=tinfo + set CFLAGS="-ggdb -O0" to get debug symbols + Content ======= diff --git a/fs/ext2.c b/fs/ext2.c index 9b41d6c..b58b6a4 100644 --- a/fs/ext2.c +++ b/fs/ext2.c @@ -11,7 +11,7 @@ #include "lib/string/string.h" -#include "interface/fs.h" +#include // THE SUPERBLOCK typedef struct ext2_superblock_struct @@ -226,26 +226,27 @@ static uint32_t ext2_filename_to_inode_traverse(uint32_t ext2_start_addr, char * uint32_t pos=0; while(1) { - fs_dirent dirs; + struct dirent dirs; uint32_t ret=ext2_read_dir(VMEM_EXT2_RAMIMAGE,inode_start, &dirs,&pos); if(!ret)break; - if(strlen(dirs.name)==len && !strcmp_l(first,dirs.name,len)) + if(strlen(dirs.d_name)==len && !strcmp_l(first,dirs.d_name,len)) { - klog("found inode %d %s%s (in inode %d)",dirs.inode,dirs.name,dirs.type==FS_FILE_TYPE_DIR?"/ ":" ",inode_start); - if(final)return dirs.inode; - return ext2_filename_to_inode_traverse(ext2_start_addr,&path[len]+1,dirs.inode); +// klog("found inode %d %s%s (in inode %d)",dirs.d_ino,dirs.d_name,dirs.type==FS_FILE_TYPE_DIR?"/ ":" ",inode_start); + if(final)return dirs.d_ino; + return ext2_filename_to_inode_traverse(ext2_start_addr,&path[len]+1,dirs.d_ino); } } - klog("file not found! : %s",path); return 0; } uint32_t ext2_filename_to_inode(uint32_t ext2_start_addr, char *path) { if(!strcmp_l(path,"/",0))return 2; // root is inode 2 by definition - return ext2_filename_to_inode_traverse(ext2_start_addr,path,2); + uint32_t ret= ext2_filename_to_inode_traverse(ext2_start_addr,path,2); + if(ret==0)klog("file not found! : %s",path); + return ret; } uint32_t ext2_read_inode(uint32_t ext2_start_addr, int inode_nr, char *buf, uint32_t *pos, uint32_t max_size) @@ -273,7 +274,7 @@ uint32_t ext2_read_inode(uint32_t ext2_start_addr, int inode_nr, char *buf, uint return count; } -int ext2_read_dir(uint32_t ext2_start_addr, int inode_nr, fs_dirent *dirs, uint32_t *pos) +int ext2_read_dir(uint32_t ext2_start_addr, int inode_nr, struct dirent *dirs, uint32_t *pos) { ext2_superblock *super=ext2_check(ext2_start_addr); ext2_inode *inode=ext2_get_inode(ext2_start_addr,inode_nr); @@ -293,10 +294,10 @@ int ext2_read_dir(uint32_t ext2_start_addr, int inode_nr, fs_dirent *dirs, uint3 dirs->type=FS_FILE_TYPE_FILE; ext2_inode *inode_current=ext2_get_inode(ext2_start_addr,dir->inode); if(inode_current->permissions&0x4000)dirs->type=FS_FILE_TYPE_DIR; - memcpy(dirs->name,ptr+8,dir->name_length_low); - if(dir->name_length_low>255)dirs->name[255]=0; - dirs->name[dir->name_length_low]=0; // null temrinate - dirs->inode=dir->inode; + memcpy(dirs->d_name,ptr+8,dir->name_length_low); + if(dir->name_length_low>255)dirs->d_name[255]=0; + dirs->d_name[dir->name_length_low]=0; // null temrinate + dirs->d_ino=dir->inode; *pos+=dir->size; return 1; @@ -314,7 +315,7 @@ fd ext2_mount_file_open(mount *m,char *path) return fd_from_path(path); } -int ext2_mount_read_dir(mount *m,char *path, fs_dirent *dirs, uint32_t *pos) +int ext2_mount_read_dir(mount *m,char *path, struct dirent *dirs, uint32_t *pos) { uint32_t inode= ext2_filename_to_inode(VMEM_EXT2_RAMIMAGE,path); if(inode==0)return -1; diff --git a/fs/ext2.h b/fs/ext2.h index 524f8fd..c3b5067 100644 --- a/fs/ext2.h +++ b/fs/ext2.h @@ -15,7 +15,7 @@ */ #include -#include "interface/fs.h" +#include /** klog some basic info about the ext2 fs */ void ext2_dump_info(uint32_t ext2_start_addr); @@ -25,9 +25,9 @@ uint32_t ext2_read_inode(uint32_t ext2_start_addr, int inode_nr, char *buf, uint /** Simiilar to ext2_read_inode but for directory inodes. * the inode number needs to point to a directory inode - * fills on fs_dirent and sets _pos_ to the position of the next + * fills on dirent and sets _pos_ to the position of the next */ -int ext2_read_dir(uint32_t ext2_start_addr, int inode_nr, fs_dirent *dirs, uint32_t *pos); +int ext2_read_dir(uint32_t ext2_start_addr, int inode_nr, struct dirent *dirs, uint32_t *pos); /** get inode number from file path / if not found return 0 */ uint32_t ext2_filename_to_inode(uint32_t ext2_start_addr, char *path); diff --git a/fs/mount.c b/fs/mount.c index eca0b2c..a54fb92 100644 --- a/fs/mount.c +++ b/fs/mount.c @@ -49,6 +49,7 @@ static uint32_t check_match(char *p1, char *p2) c++; p1++; p2++; + if(*p1=='/')return c; } } @@ -71,9 +72,9 @@ static char* get_mount_for_path(char *path,mount *mnt) for(int i=0;ipath); + uint32_t len=check_match(path+1,(m->path)+1); - if(len>best_len)//&&len==strlen(m->path)) + if(len>best_len&&path[len-1]=='/')//&&len==strlen(m->path)) { best=i; best_len=len; @@ -89,8 +90,25 @@ fd mount_file_open(char *path) mount m; char buf[256]; if(path[0]!='/'){ - // TODO: use environemnet PWD var! - sprintf(buf,"/home/miguel/%s",path); + + // we extract the PWD env variable! + // TODO: this is ugly! + char **env1=VMEM_USER_ENV+1024*2; + + int i=0; + while(1) + { + if(env1[i]==0)kpanic("unable to extract PWD!"); + if(!strcmp_l("PWD=",env1[i],4)) + { + sprintf(buf,"%s/%s",env1[i]+4,path); + klog("absolute path exracted: %s",buf); + break; + } + i++; + } + + } else { @@ -101,7 +119,7 @@ fd mount_file_open(char *path) return m.mount_file_open(&m,p); } -int mount_read_dir (char *path, fs_dirent *dirs, uint32_t *pos) +int mount_read_dir (char *path, struct dirent *dirs, uint32_t *pos) { mount m; char *p=get_mount_for_path(path,&m); diff --git a/fs/mount.h b/fs/mount.h index ba3d704..97d7183 100644 --- a/fs/mount.h +++ b/fs/mount.h @@ -19,7 +19,7 @@ #include -#include "interface/fs.h" // provides fs_dirent structure for read_dir() +#include // provides fs_dirent structure for read_dir() #include "fd.h" // file descriptor returned by open /** the possible values for mount_struct.type */ @@ -36,7 +36,7 @@ typedef struct mount_struct char path[256]; // where are we mounted (provide leading and trailing slash!) fd (*mount_file_open)(struct mount_struct*, char *path); - int (*mount_read_dir) (struct mount_struct*, char *path, fs_dirent *dirs, uint32_t *pos); + int (*mount_read_dir) (struct mount_struct*, char *path, struct dirent *dirs, uint32_t *pos); void *data; // pointer to some opaque private data @@ -49,7 +49,7 @@ void mount_add(mount mnt); fd mount_file_open(char *path); /** TODO: should use fd number instead of PATH on each call*/ -int mount_read_dir (char *path, fs_dirent *dirs, uint32_t *pos); +int mount_read_dir (char *path, struct dirent *dirs, uint32_t *pos); /** sysfs interface / exposing status via /sysfs/ file */ void mount_sysfs(ringbuffer *r, void (*f)(ringbuffer *r,char *fmt, ...)); diff --git a/fs/sysfs.c b/fs/sysfs.c index b7901d0..bcc706f 100644 --- a/fs/sysfs.c +++ b/fs/sysfs.c @@ -31,11 +31,11 @@ fd sysfs_file_open(mount *m,char *path) return fd_from_sysfs(map[0],map[1]); } -int sysfs_read_dir(mount *m,char *path, fs_dirent *dirs, uint32_t *pos) +int sysfs_read_dir(mount *m,char *path, struct dirent *dirs, uint32_t *pos) { if(*pos>=count)return 0; - memcpy(dirs->name,names[*pos],strlen(names[*pos])+1); - dirs->inode=0; + memcpy(dirs->d_name,names[*pos],strlen(names[*pos])+1); + dirs->d_ino=0; *pos+=1; return 1; } diff --git a/interface/README b/interface/README index 199cc8c..b1a1b1f 100644 --- a/interface/README +++ b/interface/README @@ -1,7 +1,7 @@ This files are required for compiling newlib for fool os. -they go into this dir or similar.. +They go into this dir or similar..: ~/Downloads/newlib-foolos/newlib/libc/sys/foolos -~/Downloads/newlib-foolos/newlib/libc/sys/foolos +I prefer to just link them and keep here. configure.in Makefile.am @@ -15,5 +15,4 @@ syscalls.c crt0.h crt0.s -this should to /usr/include/sys -fs.h -> sys/dirent.h !! required by kernel/userspace and maybe clibrary +sys/ diff --git a/interface/fs.h b/interface/fs.h deleted file mode 100644 index 25d4253..0000000 --- a/interface/fs.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file - * abstraction layer for filesystems - */ - -#ifndef FOOLOS_FS -#define FOOLOS_FS - -#include - -enum FS_FILE_TYPE{ - FS_FILE_TYPE_DIR = 1, - FS_FILE_TYPE_FILE = 2 -}; - -typedef struct fs_dirent_struct -{ - uint32_t mount; //mount identifier - uint32_t inode; //inode number or similar - uint8_t type; //FILE OR DIR (FS_FILE_TYPE) - char name[255]; - -}fs_dirent; - -/* -typedef struct fs_dirent_struct -{ - uint32_t inode; - uint32_t offset; - uint16_t length; - uint8_t type; - char name[256]; -}fs_dirent; -*/ - -#endif diff --git a/interface/sys/dirent.h b/interface/sys/dirent.h new file mode 100644 index 0000000..bf37746 --- /dev/null +++ b/interface/sys/dirent.h @@ -0,0 +1,26 @@ +#ifndef _DIRENT_H +#define _DIRENT_H + +#include + +enum FS_FILE_TYPE +{ + FS_FILE_TYPE_DIR = 1, + FS_FILE_TYPE_FILE = 2 +}; + +struct dirent +{ + uint32_t d_ino; + char d_name[255]; + + // rest is optional + uint8_t type; //FILE OR DIR (FS_FILE_TYPE) + + int pos; // position of last read! + char dirname[255]; // directory name we are traversing TODO: use inode here or similar for other systems! +}; + +typedef struct dirent DIR; + +#endif diff --git a/interface/sys/termios.h b/interface/sys/termios.h new file mode 100644 index 0000000..84ffd8c --- /dev/null +++ b/interface/sys/termios.h @@ -0,0 +1,144 @@ +// https://code.woboq.org/gcc/include/bits/termios.h.html + +#define NCCS 32 + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +struct termios +{ + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_cc[NCCS]; /* control characters */ + + cc_t c_line; /* line discipline ?? */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +}; + +/* c_cc characters */ +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +/* c_oflag bits */ +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 + +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 + +/* c_cflag bit meaning */ +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 + +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 + +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 +#define __MAX_BAUD B4000000 + +/* c_lflag bits */ +#define ISIG 0000001 +#define ICANON 0000002 +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0000400 +#define IEXTEN 0100000 + +/* tcflow() and TCXONC use these */ +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* tcflush() and TCFLSH use these */ +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* tcsetattr uses these */ +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 diff --git a/interface/syscalls.c b/interface/syscalls.c index 06846bb..c9964fd 100644 --- a/interface/syscalls.c +++ b/interface/syscalls.c @@ -8,9 +8,13 @@ #include #include #include +#include #include +// TODO ? all funct not preceeded with underscore should go as #defines +// inside headers! for newlib we define both here now ... // + // BASICS // // everybody is root @@ -25,7 +29,20 @@ uid_t getgid(void) return 0; } -// no sync needed for our ram-image so far (DMA?) +// everybody is root +char *getlogin(void) +{ + return "root"; +} + +// the hostname is hard +int gethostname(char *name, size_t len) +{ + strcpy(name,"foolcomp"); + return 0; //success +} + +// no sync needed for our ram-image so far (maye once w use DMA?) void sync(void) { } @@ -33,6 +50,7 @@ void sync(void) // set working directory - we simply save this in PWD environment var int chdir(const char *path) { + char buf[256]; sprintf(buf,"PWD=%s",path); putenv(buf); return 0; // assume success @@ -41,12 +59,19 @@ int chdir(const char *path) // get working dir (see chdir) char* getwd(char *buf) { - return getenv("PWD"); + 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. // +void _flushing() +{ + fflush(stdout); } // C NEWLIB // -// first of all we have a few posix syscalls required by newlib +// here we have a few posix syscalls 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. @@ -216,191 +241,75 @@ int write(int file, char *ptr, int len) return syscall(SYSCALL_WRITE,file,ptr,len); } -////////////////////////////////////////////////////////////////////// - - -int _readdir(const char *name,void *dirs,int max) +int _gettimeofday(struct timeval *tv, void *tz) { - return syscall(SYSCALL_READDIR,name,dirs,max); + return syscall(SYSCALL_GETTIMEOFDAY,tv,tz,0); } - -int _poll(int file) -{ - return syscall(SYSCALL_POLL,file,0,0); -} - -int _gettimeofday(struct timeval *tv, void *tz) +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); } +int lstat(const char *file, struct stat *st) +{ + return syscall(SYSCALL_LSTAT,file,st,0); +} -// termios - - int tcgetattr(int fd, struct termios *termios_p) - { - return syscall(SYSCALL_TCGETATTR,fd,termios_p,0); - } - - int tcsetattr(int fd, int optional_actions, const struct termios *termios_p) - { - return syscall(SYSCALL_TCSETATTR,fd,termios_p,0); - } - -/* - - int tcsendbreak(int fd, int duration); - - int tcdrain(int fd); - - - int tcflow(int fd, int action); -*/ - -// void cfmakeraw(struct termios *termios_p); - - /* - speed_t cfgetispeed(const struct termios *termios_p); - - */ - - speed_t cfgetospeed(const struct termios *termios_p) - { - syscall(SYSCALL_UNIMPLEMENTED,"cfgetospeed",0,0); - return B230400; - } - - long fpathconf(int fd, int name) - { - return syscall(SYSCALL_UNIMPLEMENTED,"fpathconf",0,0); - } - - int tcflush(int fd, int queue_selector) - { - return syscall(SYSCALL_UNIMPLEMENTED,"tcflush",0,0); - } - - /* - int cfsetispeed(struct termios *termios_p, speed_t speed); - - int cfsetospeed(struct termios *termios_p, speed_t speed); - - int cfsetspeed(struct termios *termios_p, speed_t speed); - */ +// like fork but keeps runin' on same memory so we have multithreading +int _clone(void) +{ + return syscall(SYSCALL_CLONE,0,0,0); +} -////////////////////////////////////////// move along /// +// DIRENT // - int access(const char *pathname, int mode) - { - return syscall(SYSCALL_UNIMPLEMENTED,"access",0,0); - } +DIR *opendir(const char *name) +{ + DIR *dir=malloc(sizeof(struct dirent)); + return syscall(SYSCALL_OPENDIR,name,dir,0); +} - #include - #include +struct dirent *readdir(DIR *dirp) +{ + return syscall(SYSCALL_READDIR,dirp,0,0); +} - mode_t umask(mode_t mask) - { - return syscall(SYSCALL_UNIMPLEMENTED,"umask",0,0); - } +// TERMIOS // - int mkdir(const char *pathname, mode_t mode) - { - return syscall(SYSCALL_UNIMPLEMENTED,"mkdir",0,0); - } +int tcgetattr(int fd, struct termios *termios_p) +{ + return syscall(SYSCALL_TCGETATTR,fd,termios_p,0); +} +int tcsetattr(int fd, int optional_actions, const struct termios *termios_p) +{ + return syscall(SYSCALL_TCSETATTR,fd,termios_p,0); +} - char *ttyname(int fd) - { - return syscall(SYSCALL_UNIMPLEMENTED,"ttyname",0,0); - } +speed_t cfgetospeed(const struct termios *termios_p) +{ + return B230400; +} -// +// I/O STUFF - Pipes et al // - struct void *readdir(DIR *dirp) // returns dirent - { - return syscall(SYSCALL_UNIMPLEMENTED,"readdir",0,0); - } - - DIR *opendir(const char *name) - { - errno=EACCES; - return syscall(SYSCALL_UNIMPLEMENTED,"opendir",name,0); - } - - int closedir(DIR *dirp) - { - return syscall(SYSCALL_UNIMPLEMENTED,"closedir",0,0); - } - - - unsigned int sleep(unsigned int seconds) - { - return syscall(SYSCALL_UNIMPLEMENTED,"sleep",0,0); - } - - char *getlogin(void) - { - return syscall(SYSCALL_UNIMPLEMENTED,"getlogin",0,0); - } - - - /** - * Monitor multiple descriptors - * ============================ - * - * nfds is the MAX file descriptor number +1. - * - * It is possible to provide 3 different sets of filedescriptors - * (they can be NULL as well) - * - * - readfds - reading - * - writefds - writing - * - exceptfds - exceptions (all cleared unless exception occurs) - * - * The call returns the total number of descriptors contained in all - * sets after returning. - * - * This call will block until time (timeout) runs out - * OR a file descriptor becomes ready. - */ - - int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) - { - // pack all our sets togehter - fd_set *fd_sets[3]; - - fd_sets[0]=readfds; - fd_sets[1]=writefds; - fd_sets[2]=exceptfds; - - return syscall(SYSCALL_SELECT,nfds,timeout,fd_sets); - } - - int pclose(FILE *stream) - { - return syscall(SYSCALL_UNIMPLEMENTED,"pclose",0,0); - } - - FILE *popen(const char *command, const char *type) - { - return syscall(SYSCALL_UNIMPLEMENTED,"popen",0,0); - } - - // call dup2 in dup emulation mode - int dup(int oldfd) - { - return _dup2(oldfd,0xffffffff); // dup emulation mode - } +int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) +{ + // pack all our sets togehter + fd_set *fd_sets[3]; + fd_sets[0]=readfds; + fd_sets[1]=writefds; + fd_sets[2]=exceptfds; -int _clone(void) -{ - return syscall(SYSCALL_CLONE,0,0,0); + return syscall(SYSCALL_SELECT,nfds,timeout,fd_sets); } + int _pipe(uint32_t fds[2]) { return syscall(SYSCALL_PIPE,fds,0,0); @@ -417,19 +326,81 @@ int dup2(uint32_t oldfd,uint32_t newfd) { return syscall(SYSCALL_DUP2,oldfd,newfd,0); } -int _gui_rect() +int dup(int oldfd) { - return syscall(SYSCALL_GUI_RECT,0,0,0); + return _dup2(oldfd,0xffffffff); // dup emulation mode } + +// PRIMITIVE GUI SYSCALLS // + +// create window for running process int _gui_win() { return syscall(SYSCALL_GUI_WIN,0,0,0); } -int gethostname(char *name, size_t len) +// swap buffers +int _gui_rect() { - strcpy(name,"foolcomp"); - return 0; //success + return syscall(SYSCALL_GUI_RECT,0,0,0); +} + +////////////////////////////////////////// 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. +// +///// + + +long fpathconf(int fd, int name) +{ + return syscall(SYSCALL_UNIMPLEMENTED,"fpathconf",0,0); +} + +int tcflush(int fd, int queue_selector) +{ + return syscall(SYSCALL_UNIMPLEMENTED,"tcflush",0,0); +} + +int access(const char *pathname, int mode) +{ + return syscall(SYSCALL_UNIMPLEMENTED,"access",0,0); +} + +mode_t umask(mode_t mask) +{ + return syscall(SYSCALL_UNIMPLEMENTED,"umask",0,0); +} + +int mkdir(const char *pathname, mode_t mode) +{ + return syscall(SYSCALL_UNIMPLEMENTED,"mkdir",0,0); +} + +char *ttyname(int fd) +{ + return syscall(SYSCALL_UNIMPLEMENTED,"ttyname",0,0); +} + +int closedir(DIR *dirp) +{ + return syscall(SYSCALL_UNIMPLEMENTED,"closedir",0,0); +} + +unsigned int sleep(unsigned int seconds) +{ + return syscall(SYSCALL_UNIMPLEMENTED,"sleep",0,0); +} + +int pclose(FILE *stream) +{ + return syscall(SYSCALL_UNIMPLEMENTED,"pclose",0,0); +} + +FILE *popen(const char *command, const char *type) +{ + return syscall(SYSCALL_UNIMPLEMENTED,"popen",0,0); } ssize_t readlink(const char *pathname, char *buf, size_t bufsiz) @@ -439,48 +410,46 @@ ssize_t readlink(const char *pathname, char *buf, size_t bufsiz) int rmdir(const char *pathname) { - syscall(SYSCALL_UNIMPLEMENTED,"rmdir",0,0); - return 0; + return syscall(SYSCALL_UNIMPLEMENTED,"rmdir",0,0); } int fcntl(int fd, int cmd, ... /* arg */ ) { - syscall(SYSCALL_UNIMPLEMENTED,"fcntl",0,0); - return 0; + return syscall(SYSCALL_UNIMPLEMENTED,"fcntl",0,0); } pid_t waitpid(pid_t pid, int *wstatus, int options) { - syscall(SYSCALL_UNIMPLEMENTED,"waitpid",0,0); - return 0; + return syscall(SYSCALL_UNIMPLEMENTED,"waitpid",0,0); } int execl(const char *path, const char *arg, ...) { - syscall(SYSCALL_UNIMPLEMENTED,"execl",0,0); - return 0; + return syscall(SYSCALL_UNIMPLEMENTED,"execl",0,0); } int execvp(const char *file, char *const argv[]) { - syscall(SYSCALL_UNIMPLEMENTED,"execvp",0,0); - return 0; + return syscall(SYSCALL_UNIMPLEMENTED,"execvp",0,0); } long sysconf(int name) { return syscall(SYSCALL_UNIMPLEMENTED,"sysconf",name,0); - return 0; } int chmod(const char *pathname, mode_t mode) { - syscall(SYSCALL_UNIMPLEMENTED,"chmod",0,0); - return 0; -} - -void _flushing() -{ - fflush(stdout); + return syscall(SYSCALL_UNIMPLEMENTED,"chmod",pathname,mode); } +/* +int tcsendbreak(int fd, int duration); +int tcdrain(int fd); +int tcflow(int fd, int action); +void cfmakeraw(struct termios *termios_p); +speed_t cfgetispeed(const struct termios *termios_p); +int cfsetispeed(struct termios *termios_p, speed_t speed); +int cfsetospeed(struct termios *termios_p, speed_t speed); +int cfsetspeed(struct termios *termios_p, speed_t speed); +*/ diff --git a/interface/syscalls.h b/interface/syscalls.h index 1595c2d..604e150 100644 --- a/interface/syscalls.h +++ b/interface/syscalls.h @@ -28,5 +28,6 @@ #define SYSCALL_SELECT 89 #define SYSCALL_TCGETATTR 90 #define SYSCALL_TCSETATTR 91 +#define SYSCALL_OPENDIR 92 -#define SYSCALL_UNIMPLEMENTED 255 +#define SYSCALL_UNIMPLEMENTED 200 diff --git a/kernel/kernel.c b/kernel/kernel.c index 3692b17..a34be42 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -148,6 +148,7 @@ void kernel_main(uint32_t eax,uint32_t ebx) klog("Compositor init ..."); compositor_init(cfg_multiboot->framebuffer_width,cfg_multiboot->framebuffer_height,cfg_multiboot->framebuffer_pitch); compositor_set_background("/home/miguel/bg.ppm"); + //compositor_set_background(0); // -- KB DRIVER -- // klog("Keyboard init ..."); diff --git a/kernel/kernel.h b/kernel/kernel.h index 46302ba..cf21c60 100644 --- a/kernel/kernel.h +++ b/kernel/kernel.h @@ -29,6 +29,7 @@ REFERENCES //#define FOOLOS_UNIT_TESTING // Run Unit Tests //#define FOOLOS_LOG_OFF // Turn off logging (disables serial port alltogether) //#define FOOLOS_COLORLESS // Turn off colors in log +//#define LOG_SYSCALLS #define HIDE_FIXME #define FOOLOS_APIC_FREQ 15 // how many apic ticks per second @@ -69,7 +70,8 @@ REFERENCES #define VMEM_USER_ENV 0x07000000 // 1 page / per user process //#define VMEM_USER_PROG_PAGES (256*16) -#define VMEM_USER_PROG_PAGES (1024*16) // 64 megs +//#define VMEM_USER_PROG_PAGES (1024*16) // 64 megs +#define VMEM_USER_PROG_PAGES (1024*8) // 32megs #define VMEM_USER_PROG 0x08048000 // / per user process (usual entry: 0x8048080) #define VMEM_USER_STACK_PAGES (1024*16) // 64 megs / per thread @@ -87,13 +89,13 @@ REFERENCES //TODO: do not hardcode in crt0.s!!!! #define VMEM_USER_NEWLIB 0xF5000000 // 1 page / newlib reentrancy struct. 1 per thread +#define VMEM_USER_FRAMEBUFFER 0xF5100000 +#define VMEM_USER_FRAMEBUFFER_PAGES 300// 4*320*480 bytes per app (one extra?) + #define VMEM_FRAMEBUFFER 0xF6000000 // identity mapped #define VMEM_FRAMEBUFFER_PAGES (1024*8) // 32mb #define VMEM_EXT2_RAMIMAGE 0xF8000000 // identity mapped -#define VMEM_EXT2_PAGES (1024*16) // 64mb - -#define VMEM_USER_FRAMEBUFFER 0xFC000000 -#define VMEM_USER_FRAMEBUFFER_PAGES 300// 4*320*480 bytes per app (one extra?) +#define VMEM_EXT2_PAGES (1024*26) // 128mb #endif diff --git a/kernel/scheduler.c b/kernel/scheduler.c index 2112659..59d26d1 100644 --- a/kernel/scheduler.c +++ b/kernel/scheduler.c @@ -363,11 +363,13 @@ void task_syscall_worker() task_list[cpu][0].vmem=task_list[cpu][i].vmem; // switch syscall worker to pagedir of calling userprog x86_set_page_directory(task_list[cpu][0].vmem); + x86_cli(); // we do not want to be scheduled to other page ... sorry TODO: suuuuckS! uint32_t ok = syscall_generic_test(task_list[cpu][i].eax, task_list[cpu][i].edx, task_list[cpu][i].ecx, task_list[cpu][i].ebx, task_list[cpu][i].pid); + x86_sti(); if(!ok) { @@ -375,11 +377,13 @@ void task_syscall_worker() continue; } + x86_cli(); // we do not want to be scheduled to other page ... sorry TODO: suuuuckS! uint32_t ret = syscall_generic(task_list[cpu][i].eax, task_list[cpu][i].edx, task_list[cpu][i].ecx, task_list[cpu][i].ebx, task_list[cpu][i].pid); + x86_sti(); // klog("... returned : %d",ret); diff --git a/kernel/syscalls.c b/kernel/syscalls.c index 1c1d2c7..e73f89c 100644 --- a/kernel/syscalls.c +++ b/kernel/syscalls.c @@ -31,6 +31,8 @@ //TODO move to process.c and implement per process // static fd fds[MAX_PID][MAX_FD]; +//static uint32_t opendir_pos[MAX_PID][MAX_FD]; +//static char opendir_name[MAX_PID][MAX_FD][256]; static int tty[MAX_PID]; // keep track of /dev/tty fd for each process :P static bool open_fd[MAX_PID][MAX_FD]; @@ -55,6 +57,19 @@ void fd_init_std_streams(uint32_t pid) } // +/** helper */ +int nextfd(int pid) +{ + for(int i=0;i0) + { + if(fd_eof(&fds[pid][file]))return ret; + *buf++=fd_read(&fds[pid][file]); + ret++; + } + return ret; } + /** + * Monitor multiple descriptors + * ============================ + * + * nfds is the MAX file descriptor number +1. + * + * It is possible to provide 3 different sets of filedescriptors + * (they can be NULL as well) + * + * - readfds - reading + * - writefds - writing + * - exceptfds - exceptions (all cleared unless exception occurs) + * + * The call returns the total number of descriptors contained in all + * sets after returning. + * + * This call will block until time (timeout) runs out + * OR a file descriptor becomes ready. + */ + int syscall_select(int maxxfd,struct timeval *tv, fd_set **fd_sets, uint32_t pid, bool test) { int ret=0; @@ -251,15 +313,47 @@ int syscall_select(int maxxfd,struct timeval *tv, fd_set **fd_sets, uint32_t pid } -//TODO: replace with dirent! -int syscall_readdir(const char *name,fs_dirent *dirs,int *pos,uint32_t pid) +//TODO: use fd and inode (instead of path)... now this is a crazy trick how it works.. +//is it that bad??? yes it was bad and vim crashed so we changed to even more hacky approach now.. :( :( +//ok it was other reason but we should not use it ... +//since userspace might zero or reuse dirent* and corrupt our DIR* ! TODO TODO TODO danger! +struct dirent *syscall_opendir(const char *name,struct dirent *dirs,int none,uint32_t pid) { - int ret=mount_read_dir(name, dirs, pos); + strcpy(dirs->dirname,name); + if(dirs->dirname[strlen(dirs->dirname)-1]=='/')dirs->dirname[strlen(dirs->dirname)-1]=0; + klog("syscall to opendir(%s)",dirs->dirname); + + // test if exists.... + struct dirent testdirent; + uint32_t testpos; + int ret=mount_read_dir(dirs->dirname, &testdirent, &testpos); if(ret==-1) { + // no it does not! set_errno(ENOENT); + return NULL; } - return ret; + + dirs->pos=0; + + /* + uint32_t fdn=nextfd(pid); + strcpy(opendir_name[pid][fdn],dirs->dirname); + opendir_pos[pid][fdn]=0; + */ + + return dirs; +} + +struct dirent *syscall_readdir(struct dirent *dirs,int none1, int none2,uint32_t pid) +{ + // this dirent will get filled with next entry... + int ret=mount_read_dir(dirs->dirname, dirs, &dirs->pos); + + // no more entries + if(ret==0)return NULL; + + return dirs; } /** execve helper */ @@ -327,22 +421,10 @@ int syscall_execve(const char *name, char *const argv[], char *const env[], int return 0; } -/** helper */ -int nextfd(int pid) -{ - for(int i=0;imax_addy)kpanic("can not set sbrk . TODO: dynamic allocation!"); fixme("fake syscall_sbrk(0x%08X) return %08X",incr,oldalloc); return oldalloc; } @@ -568,7 +654,9 @@ uint32_t syscall_generic_test(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint32_t syscall_generic(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint32_t pid) { -// klog("processing syscall [%s] for pid:%d",syscall_get_name(nr),pid); +#ifdef LOG_SYSCALLS + klog("processing syscall [%s] for pid:%d",syscall_get_name(nr),pid); +#endif switch(nr){ case SYSCALL_EXIT : @@ -617,6 +705,8 @@ uint32_t syscall_generic(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint return syscall_gettimeofday(p1,p2,p3,pid); case SYSCALL_READDIR : return syscall_readdir(p1,p2,p3,pid); + case SYSCALL_OPENDIR : + return syscall_opendir(p1,p2,p3,pid); case SYSCALL_KILL : // return task_kill(p1,p2,p3); return -1; @@ -634,6 +724,11 @@ uint32_t syscall_generic(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint return syscall_tcgetattr(p1,p2,p3,pid); case SYSCALL_TCSETATTR: return syscall_tcsetattr(p1,p2,p3,pid); + case SYSCALL_UNIMPLEMENTED: + if(!strcmp(p1,"fcntl")){ + klog("todo: quickfix hack for fcntl"); + } + } klog("unknown syscall %s / %d we just return 0",p1,nr); return 0; diff --git a/lib/string/string.h b/lib/string/string.h index acd03ab..429da4b 100644 --- a/lib/string/string.h +++ b/lib/string/string.h @@ -5,6 +5,6 @@ void* memcpy(void* restrict dstptr, const void* restrict srcptr, int size); int strcmp(char *str1, char *str2); int strcmp_l(char *str1, char *str2, int length); int strlen(const char* string); -static char *strcpy (char* dst, const char *src ){return memcpy(dst,src,strlen(src));} +static char *strcpy (char* dst, const char *src ){return memcpy(dst,src,strlen(src)+1);} // with trailing 0 #endif diff --git a/userspace/Makefile b/userspace/Makefile index 950a8d6..8e3518f 100644 --- a/userspace/Makefile +++ b/userspace/Makefile @@ -1,4 +1,4 @@ -IMAGESIZE=60000 #ext2.img size in Kb +IMAGESIZE=80000 #ext2.img size in Kb ####################### @@ -45,8 +45,9 @@ ext2.img: $(PROGS) @sudo mount ext2.img mnt @sudo chown miguel mnt @mkdir -p mnt/home/miguel - @cp files/* mnt/home/miguel/ - @cp files/.vimrc mnt/home/miguel/ + @cp files/* mnt/home/miguel/ -r + @cp files/.vimrc mnt/home/miguel/ -r + @cp files/.vim mnt/home/miguel/ -r @mkdir -p mnt/boot @mkdir -p mnt/bin @mkdir -p mnt/doc/fonts @@ -54,8 +55,15 @@ ext2.img: $(PROGS) @mkdir -p mnt/pipes # mountpoint for pipes @cp $(PROGS) mnt/bin @mkdir -p mnt/usr/share/vim - @cp /home/miguel/git/EXT/vim/src/vim mnt/bin - @cp /home/miguel/git/EXT/vim/runtime/syntax mnt/usr/share/vim/syntax -r + @mkdir -p mnt/home/miguel/.vim + @cp /home/miguel/temp/foolos/usr/share/vim/vim81/* mnt/usr/share/vim/ -r + #@cp /home/miguel/temp/foolos/usr/share/vim/vim81/* mnt/home/miguel/vim/ -r + #@cp /home/miguel/git/EXT/vim/runtime/syntax mnt/usr/share/vim/ -r + #@cp /home/miguel/temp/foolos/usr/share/vim/vim81/colors mnt/home/miguel/.vim/ -r + #@cp /home/miguel/git/EXT/vim/runtime/autoload mnt/usr/share/vim/ -r + #@cp /home/miguel/git/EXT/vim/runtime/filetype.vim mnt/usr/share/vim/ + #@cp /home/miguel/git/EXT/vim/runtime/ftplugin.vim mnt/usr/share/vim/ + #@cp /home/miguel/git/EXT/vim/runtime/ftplugin mnt/usr/share/vim/ -r @cp fonts/*.bin mnt/doc/fonts @cp xterm/xterm mnt/bin @cp cpp/testcpp mnt/bin @@ -63,7 +71,15 @@ ext2.img: $(PROGS) # @cp /home/miguel/temp/foolos/usr/bin/* mnt/bin @cp /home/miguel/temp/foolos/usr/bin/worm mnt/bin @cp /home/miguel/temp/foolos/usr/bin/xmas mnt/bin - @cp /home/miguel/temp/foolos/usr/bin/tput mnt/bin + @cp /home/miguel/temp/foolos/usr/bin/tput mnt/bin # why this doesnt work :( + @cp /home/miguel/temp/foolos/usr/bin/view mnt/bin + @cp /home/miguel/temp/foolos/usr/bin/rain mnt/bin + @cp /home/miguel/temp/foolos/usr/bin/gdc mnt/bin + @cp /home/miguel/temp/foolos/usr/bin/tclock mnt/bin + @cp /home/miguel/temp/foolos/usr/bin/xxd mnt/bin + @cp /home/miguel/temp/foolos/usr/bin/vim mnt/bin +# @cp /home/miguel/git/EXT/vim/src/vim mnt/bin + @cp /home/miguel/temp/foolos/usr/bin/hanoi mnt/bin # cp ~/temp/fool-os-stuff/binutils-build-host-foolos/binutils/readelf mnt/bin # cp ../font/binfont.bin mnt/ diff --git a/userspace/bigmem.c b/userspace/bigmem.c index 5d474aa..505d639 100644 --- a/userspace/bigmem.c +++ b/userspace/bigmem.c @@ -1,9 +1,10 @@ #include #include -int main() +int main(int argc,char **argv) { - for(int i=1;i<100;i++) + if(argc==1)printf("usage %s [steps]\n",argv[0]); + for(int i=1;i1){ - char buf[256]; - - // Relative Path - if(argv[1][0]!='/') - { - sprintf(buf,"%s/%s",getenv("PWD"),argv[1]); - in=fopen(buf,"r"); - } - - // Absolute Path - else - { - in=fopen(argv[1],"r"); - } - } + if(argc>1) in=fopen(argv[1],"r"); char buf[256]; diff --git a/userspace/files/.vimrc b/userspace/files/.vimrc index a86c950..a9d6328 100644 --- a/userspace/files/.vimrc +++ b/userspace/files/.vimrc @@ -5,6 +5,7 @@ set noswapfile "no swap files syntax on set number set colorcolumn=73 +set ft=c " following should be set from terminfo automatically set t_me= diff --git a/userspace/fsh.c b/userspace/fsh.c index 85fc5e4..17a3942 100644 --- a/userspace/fsh.c +++ b/userspace/fsh.c @@ -19,7 +19,7 @@ #include #include #include -#include "interface/fs.h" +#include extern char **environ; @@ -320,8 +320,7 @@ bool cd(char *path) } // check if exists - fs_dirent dirs; - if(-1==_readdir(buf,&dirs,0)) + if(NULL==opendir(buf)) { printf("directory not found!\n"); return false; diff --git a/userspace/ls.c b/userspace/ls.c index b3a17ef..b4cd262 100644 --- a/userspace/ls.c +++ b/userspace/ls.c @@ -1,40 +1,40 @@ -#include "interface/fs.h" +/** + * @file + * poor mans 'ls' for fool-os user space + */ + +#include +#include + +#include int main(int argc, char **argv) { - char *dir=getenv("PWD"); + DIR *dir; - if(argc==2) + if(argc==1) // no param passed + { + // get current working directory + dir=opendir(getenv("PWD")); + } + else { - if(argv[1][0]!='/') - { - if(!strcmp(dir,"/"))dir++; - char buf[256]; - sprintf(buf,"%s/%s",dir,argv[1]); - dir=buf; - } - else - { - dir=argv[1]; - } + // use command line argument + dir=opendir(argv[1]); } - printf("listing %s\n",dir); - - fs_dirent dirs; - uint32_t pos=0; - while(1) + if(dir==NULL) { - uint32_t ret=_readdir(dir,&dirs,&pos); - if(ret==-1) - { - printf("directory not found!\n"); - break; + printf("directory not found\n"); + return EXIT_FAILURE; + } - } - if(ret==0)break; - printf("% 12i %s%c\n",dirs.inode, dirs.name, ((dirs.type==FS_FILE_TYPE_DIR)?'/':' ')); + // iterate over entries + struct dirent *d; + while((d=readdir(dir))!=NULL) + { + printf("% 12i %s%c\n",d->d_ino, d->d_name, ((d->type==FS_FILE_TYPE_DIR)?'/':' ')); } - return 0; + return EXIT_SUCCESS; } diff --git a/userspace/pwd.c b/userspace/pwd.c new file mode 100644 index 0000000..3bc3002 --- /dev/null +++ b/userspace/pwd.c @@ -0,0 +1,9 @@ +#include + +int main() +{ + char buf[256]; + printf("current pwd=%s\n",getwd(buf)); + chdir("/usr/share"); + printf("changed pwd=%s\n",getwd(buf)); +} diff --git a/userspace/snake.c b/userspace/snake.c deleted file mode 100644 index d825987..0000000 --- a/userspace/snake.c +++ /dev/null @@ -1,48 +0,0 @@ -#include - -int data4[100]; - -int data1=1; -int data2=2; -int data3=3; - -int main() -{ - printf("Hello I am FoolSnake 0.1\n some data test: %i %i %i", data1,data2,data3 ); - - puts("+++"); - for(int i=0;i<100;i++) - { - if(data4[i]!=0)printf("WOW"); - } - puts("+++"); - - printf("setvbuf returned %i\n",setvbuf(stdin,NULL,_IONBF,0)); - printf("setvbuf returned %i\n",setvbuf(stdout,NULL,_IONBF,0)); - - //fool_tune(1,0,0); // activate gaming mode - - while(1) - { - uint8_t x=0; - - - while(!_poll(0)) - { - x++; - - putc('\b',stdout); - if(x%4==0)putc('/',stdout); - if(x%4==1)putc('-',stdout); - if(x%4==2)putc('\\',stdout); - if(x%4==3)putc('|',stdout); - } - - char c=fgetc(stdin); - printf("[%c]\n",c); - if(c=='q')break; - - } - - //fool_tune(0,0,0); // de-activate gaming mode -} diff --git a/userspace/xterm/vesa.c b/userspace/xterm/vesa.c index 745e7fb..b6cec2f 100644 --- a/userspace/xterm/vesa.c +++ b/userspace/xterm/vesa.c @@ -7,7 +7,7 @@ void PutFont(char c, int x,int y, int color_fg,int color_bg); -#define VMEM_USER_FRAMEBUFFER 0xfc000000 +#define VMEM_USER_FRAMEBUFFER 0xf5100000 // framebuffer info static uint32_t vesaXres; -- cgit v1.2.3