Code Monkey home page Code Monkey logo

xv6's Introduction

Unix v6

preview

This is the reimplementation in ANSI C of Unix v6.

Features

  • Refactored build system: the separation between distribution and kernel is now clear. The complete distribution, (SUS-1 compliant) is available in distrib/. The rest of the kernel uses recursive makefiles.
  • vfs: the filesystem layer is now abstract. Multiple filesystem support is now possible. Currently FAT32 and ext2 are in progress.
  • ACPI support: a limited set of ACPI commands are supported. Currently mainly shutdown/S5 mode.
  • userland libc: C89/ANSI compliant + POSIX-1 compliant
  • SUS-1 compliance: As for kernel support, users and signals are still missing for POSIX-1 support, while some syscalls are already present. On the userland part, the libc and FHS are in progress. Update: libc almost finished.

Authors

Original implementation

Original xv6 vailable here: http://pdos.csail.mit.edu/6.828/2012/xv6.html

xv6's People

Contributors

newbiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

xv6's Issues

'r' is uninitialized in distrib/ulibc/src/stdlib/div.c

This could just be an issue with my compiler but I figured I'd make an issue anyways.
When running 'make', everything builds fine except for div.c. It fails with the following error:

src/stdlib/div.c: In function ‘div’:
src/stdlib/div.c:10:10: error: ‘r’ is used uninitialized in this function [-Werror=uninitialized]
   return r;
          ^
cc1: all warnings being treated as errors

I am using Debian 10 with Linux 4.4.0 and GCC 8.3.0 from the default repositories. Any help would be appreciated because this looks like it could be a very fun OS to play with.

ACPI minimal support

Still lot of work to do for ACPI minimal support:
At least S5/shutdown should work out of hardcoded VM

int sys_halt(void)
{
  // Hack: Hard coded ACPI shutdown for qemu/bochs
  outw(0xB004, 0x0 | 0x2000);
  return 0;
}

Add stream buffering

The whole stdio submodule completement ignores buffering (as if everything is _IONBF). That should be fixed.

Finish ANSI C userspace libc (ulibc)

There's a lot to do for ulibc to be fully usable.

$ grep -hr 'assert(0' distrib/ulibc/ -B2 | grep -v assert | grep -v { | grep -v '\-\-'
void (*signal(int sig, void (*func)(int)))(int)
int raise(int sig)
double atof(const char* nptr)
int atoi(const char* nptr)
long int atol(const char* nptr)
double strtod(const char* nptr, char** endptr)
long int strtol(const char* nptr, char** endptr, int base)
unsigned long int strtoul(const char* nptr, char** endptr, int base)
int rand(void)
void srand(unsigned int seed)
void* calloc(size_t nmemb, size_t size)
void free(void* ptr)
void* malloc(size_t size)
void* realloc(void* ptr, size_t size)
void abort(void)
int atexit(void (*func)(void))
void exit(int status)
char* getenv(const char* name)
int system(const char* string)
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*))
void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*))
int abs(int j)
div_t div(int numer, int denom)
long int labs(long int j)
ldiv_t ldiv(long int numer, long int denom)
int mblen(const char* s, size_t n)
int mbtowc(wchar_t* pwc, const char* s, size_t n)
int wctomb(char* s, wchar_t wchar)
size_t mbstowcs(wchar_t* pwcs, const char* s, size_t n)
size_t wcstombs(char* s, const wchar_t* pwcs, size_t n)
clock_t clock(void)
double difftime(time_t time1, time_t time0)
time_t mktime(struct tm* timeptr)
time_t time(time_t* timer)
char* asctime(const struct tm* timeptr)
char* ctime(const time_t* timer)
struct tm* gmtime(const time_t* timer)
struct tm* localtime(const time_t* timer)
size_t strftime(char* s, size_t maxsize, const char* format, const struct tm* timeptr)
void *memcpy(void *s1, const void *s2, size_t n)
void *memmove(void *s1, const void *s2, size_t n)
char *strcpy(char *s1, const char *s2)
char *strncpy(char *s1, const char *s2, size_t n)
char *strcat(char *s1, const char *s2)
char *strncat(char *s1, const char *s2, size_t n)
int memcmp(const void *s1, const void *s2, size_t n)
int strcmp(const char *s1, const char *s2)
int strcoll(const char *s1, const char *s2)
int strncmp(const char *s1, const char *s2, size_t n)
size_t strxfrm(char *s1, const char *s2, size_t n)
void *memchr(const void *s, int c, size_t n)
char *strchr(const char *s, int c)
size_t strcspn(const char *s1, const char *s2)
char *strpbrk(const char *s1, const char *s2)
char *strrchr(const char *s, int c)
size_t strspn(const char *s1, const char *s2)
char *strstr(const char *s1, const char *s2)
char *strtok(char *s1, const char *s2)
void *memset(void *s, int c, size_t n)
char *strerror(int errnum)
size_t strlen(const char *s)
int remove(const char* filename)
int rename(const char* src, const char* dst)
FILE* tmpfile(void)
char* tmpnam(char* s)
int fclose(FILE* stream)
int fflush(FILE* stream)
FILE* fopen(const char* filename, const char* mode)
FILE* freopen(const char* filename, const char* mode, FILE* stream)
void setbuf(FILE* stream, char* buf)
int setvbuf(FILE* stream, char* buf, int mode, size_t size)
int fprintf(FILE* stream, const char* format, ...)
int fscanf(FILE* stream, const char* format, ...)
int printf(const char* format, ...)
int scanf(const char* format, ...)
int sprintf(char* s, const char* format, ...)
int sscanf(const char* s, const char* format, ...)
int vfprintf(FILE* stream, const char* format, va_list arg)
int vprintf(const char* format, va_list arg)
int vsprintf(char* s, const char* format, va_list arg)
int fgetc(FILE* stream)
char* fgets(char* s, int n, FILE* stream)
int fputc(int c, FILE* stream)
int fputs(const char* s, FILE* stream)
int getc(FILE* stream)
int getchar(void)
char* gets(char* s)
int putc(int c, FILE* stream)
int putchar(int c)
int puts(const char* s)
int ungetc(int c, FILE* stream)
size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream)
size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream)
int fgetpos(FILE* stream,fpos_t* pos)
int fseek(FILE* stream, long int offset, int whence)
int fsetpos(FILE* stream, const fpos_t* pos)
long int ftell(FILE* stream)
void rewind(FILE* stream)
void clearerr(FILE* stream)
int feof(FILE* stream)
int ferror(FILE* stream)
void perror(const char* s)
double acos(double x)
double asin(double x)
double atan(double x)
double atan2(double x, double y)
double cos(double x)
double sin(double x)
double tan(double x)
double cosh(double x)
double sinh(double x)
double tanh(double x)
double exp(double x)
double frexp(double value, int* exp)
double ldexp(double x, int exp)
double log(double x)
double log10(double x)
double modf(double value, double* iptr)
double pow(double x, double y)
double sqrt(double x)
double ceil(double x)
double fabs(double x)
double floot(double x)
double fmod(double x, double y)

Some hundred symbols in fact:

$ !! | wc -l
grep -hr 'assert(0' distrib/ulibc/ -B2 | grep -v assert | grep -v { | grep -v '\-\-'  | wc -l
124

exit() not working

Seems like exit() ulibc stub does not work properly. It will act like the first defined function is called on atexit() ?!
I suspect pushed arguments on exit() and the noreturn somehow breaks the cdecl ABI not used by sysexit().
This needs investigation.
sysexit() works tho.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.