Git Product home page Git Product logo

xv6-x86_64's Introduction

This is a port of xv6 to the x86-64 platform (from i386), attempting to
be as minimally intrusive as possible (beyond some initial reorganization
of the source code layout and build system).

  "xv6 is a re-implementation of Dennis Ritchie's and Ken Thompson's Unix
   Version 6 (v6).  xv6 loosely follows the structure and style of v6,
   but is implemented for a modern x86-based multiprocessor using ANSI C."

The original upstream branch (mirror) was pulled from the git repository
https://github.com/mit-pdos/xv6-public
(previously git://pdos.csail.mit.edu/xv6/xv6.git)

The original project homepage is here:
https://pdos.csail.mit.edu/6.828/2014/xv6.html
(previously http://pdos.csail.mit.edu/6.828/2012/xv6.html)

The PDF books about the rev8 version of xv6 are checked into the books branch
of this repository for easy access.  They come from the xv6 project's home site.

The original README remains as README.orig -- renamed to avoid misrepresenting
this working branch and any local changes as the original project and to 
hopefully avoid people pestering the original authors about bugs x86_64 port may
introduce while poking at their code.

. . .

The code has been organized into kernel/, include/, user/, ulib/, and tools/
subdirectories, and arranged so that the build puts intermediate object files
into .kobj/ and .uobj/ directories, other intermediates into out/, and the
filesystem contents into fs/.

The Makefile defaults to building the 64bit version of xv6.  Reset the X64
environment variable to build the 32bit version.

README.64bit contains notes about the 64bit port.

xv6-x86_64's People

Contributors

andrewth avatar atton avatar finallyjustice avatar jnider avatar jserv avatar kaashoek avatar li-guangda avatar rsc avatar s-rah avatar swetland avatar zeldovich 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xv6-x86_64's Issues

Missing clobber declaration in kernel/cpuid.c

From the specification of x86_64, Vol. 2A 3-191, the cpuid instruction will override register EDX in most cases. A more general solution, declaring this register in clobber list would be better. Furthermore, x86_64 specification only marks EDX as reserved when EAX is 07h, such claim may be violated in the future, to maximize the compatibility, I think declaring the register EDX in clobber list is worth considering.

The source of xv6: kernel/cpuid.c: 140:
asm("cpuid" : "=a"(maxsubleaf), "=b"(sef_flags) : "a" (7), "c" (0) :);

Build failure with clang

While building xv6 with clang, tools/sign.pl complains:

$ make CC=clang
...
boot block too large: 894 bytes (max 510)
Makefile:119: recipe for target 'out/bootblock' failed

The version of clang:
$ clang --version
Ubuntu clang version 3.6.0-2ubuntu1 (tags/RELEASE_360/final) (based on LLVM 3.6.0)

Implement copy-on-write fork

With a technique called copy-on-write (COW), when a fork occurs, the parent process's pages are not copied for the child process. Instead, the pages are shared between the child and the parent process. Whenever a process (parent or child) modifies a page, a separate copy of that particular page alone is made for that process (parent or child) which performed the modification. This process will then use the newly copied page rather than the shared one in all future references. The other process (the one which did not modify the shared page) continues to use the original copy of the page (which is now no longer shared). This technique is called copy-on-write since the page is copied when some process writes to it.

Initial implementation: https://github.com/delphifirst/xv6/commits/master

ld: Error: unable to disambiguate: -nodefaultlibs (did you mean --nodefaultlibs ?)

I'm trying to build xv6-x86_64 on Debian testing 64 (gcc 12 is already installed)
Running make xv6.img yield this:

No rule to make target /.d
gcc -fno-builtin -fno-pic -m32 -nostdinc -Iinclude -Os -o out/bootmain.o -c kernel/bootmain.c
gcc -fno-builtin -fno-pic -m32 -nostdinc -Iinclude -o out/bootasm.o -c kernel/bootasm.S
ld -m elf_i386 -nodefaultlibs --omagic -e start -Ttext 0x7C00
-o out/bootblock.o out/bootasm.o out/bootmain.o
ld: Error: unable to disambiguate: -nodefaultlibs (did you mean --nodefaultlibs ?)
make: *** [Makefile:137: out/bootblock] Error 1

Implement POSIX semaphores

POSIX semaphores allow processes and threads to synchronize their actions.

A semaphore is an integer whose value is never allowed to fall below zero. Two operations can be performed on semaphores: increment the semaphore value by one (sem_post); and decrement the semaphore value by one (sem_wait). If the value of a semaphore is currently zero, then a sem_wait operation will block until the value becomes greater than zero.

POSIX semaphores come in two forms: named semaphores and unnamed semaphores.

Initial implementation: https://github.com/MrHohn/cs518hw2/commits/sp15-hw2

No valid gcc optimizations

Using make OPT=-O1 specifies the optimization order of gcc. However, it always fails for O=1, 2, and s.

The case of -O1:

  • build FAIL
nmeta 29 (boot, super, inode blocks 26, bitmap blocks 1) blocks 941 log 30 total 1000
mkfs: tools/mkfs.c:268: iappend: Assertion `fbn < (10 + (512 / sizeof(uint)))' failed.
Makefile:221: recipe for target 'fs.img' failed

The case of -O2:

  • build FAIL
nmeta 29 (boot, super, inode blocks 26, bitmap blocks 1) blocks 941 log 30 total 1000
mkfs: tools/mkfs.c:268: iappend: Assertion `fbn < (10 + (512 / sizeof(uint)))' failed.
Makefile:221: recipe for target 'fs.img' failed

The case of -Os:

  • build OK
  • usertests hangs:
...
open small succeeded ok
read succeeded ok
small file test ok
big files test

Error, infinite recursion.


user/sh.c:58:1: error: infinite recursion detected [-Werror=infinite-recursion]

   58 | runcmd(struct cmd *cmd)
      | ^~~~~~

user/sh.c:89:5: note: recursive call

   89 |     runcmd(rcmd->cmd);

      |     ^~~~~~~~~~~~~~~~~

user/sh.c:109:7: note: recursive call

  109 |       runcmd(pcmd->left);

      |       ^~~~~~~~~~~~~~~~~~

user/sh.c:116:7: note: recursive call

  116 |       runcmd(pcmd->right);

      |       ^~~~~~~~~~~~~~~~~~~

user/sh.c:95:7: note: recursive call

   95 |       runcmd(lcmd->left);

      |       ^~~~~~~~~~~~~~~~~~

user/sh.c:97:5: note: recursive call

   97 |     runcmd(lcmd->right);

      |     ^~~~~~~~~~~~~~~~~~~

user/sh.c:127:7: note: recursive call

  127 |       runcmd(bcmd->cmd);

      |

could I replace sh?

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.