Fix 8 space tab formatting for non-C files I missed all of these files when I handled the .c and .h files. Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/Documentation/Contributing.md b/Documentation/Contributing.md index 991c73c..c585e59 100644 --- a/Documentation/Contributing.md +++ b/Documentation/Contributing.md
@@ -248,7 +248,7 @@ ``` [alias] - gr = log --graph --full-history --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s%x20%x1b[33m(%an)%x1b[0m" + gr = log --graph --full-history --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s%x20%x1b[33m(%an)%x1b[0m" grs = log --graph --full-history --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s%x20%x1b[33m(%an)%x1b[0m" --simplify-by-decoration ``` @@ -262,7 +262,7 @@ ``` $ git checkout master # make sure you're on master -$ git fetch # grab the latest from origin/ +$ git fetch # grab the latest from origin/ $ git merge origin/master ``` @@ -365,7 +365,7 @@ Here's a reasonable workflow to deal with this situation: ``` -$ git fetch # notice origin/master changed +$ git fetch # notice origin/master changed $ git checkout master # switch to master $ git merge origin/master # fast-forward merge - straight line of commits ``` @@ -391,8 +391,8 @@ `$ git push -f origin monitor-change` -The `-f` replaces the `origin/monitor-change` with your `monitor-change`. See below -for more on `-f`. +The `-f` replaces the `origin/monitor-change` with your `monitor-change`. See +below for more on `-f`. If you don't want to bother with maintaining your master right now, you can cut it down to a few steps (assuming you are on `SOMEBRANCH`): @@ -421,9 +421,9 @@ * 1234567 (master, origin/master) Some Other Commit ``` -You're working on the `vmmcp` branch, and you realize that `d76b4c6` adds a bunch -of debug `printk`s in it and that there is a bug in `HEAD` that you introduced in -`f62dd6c`. +You're working on the `vmmcp` branch, and you realize that `d76b4c6` adds a +bunch of debug `printk`s in it and that there is a bug in `HEAD` that you +introduced in `f62dd6c`. The lousy option would be to make a new commit on top of `876d5b0 (HEAD)` that removes the prints and fixes the bugs. The problem with this is that there is @@ -441,28 +441,28 @@ $ git rebase -i master ``` -This will replay all commits from (`1234567`, `876d5b0`] (not including `1234567`) on -top of `master` (`1234567`). Check out `git help rebase` for more info, -including some nifty diagrams. In short, that `rebase` command is the shorthand -for: +This will replay all commits from (`1234567`, `876d5b0`] (not including +`1234567`) on top of `master` (`1234567`). Check out `git help rebase` for +more info, including some nifty diagrams. In short, that `rebase` command is +the shorthand for: `$ git rebase -i --onto master master vmmcp` -The `rebase` command `-i` option (interactive) will pop open an editor, where you -can change the order of commits, squash multiple commits into a single commit, -or stop and edit the commit. Note that commits are presented in the order in -which they will be committed, which is the opposite of `gitk` and `git gr`, where -the newest commit is on top. +The `rebase` command `-i` option (interactive) will pop open an editor, where +you can change the order of commits, squash multiple commits into a single +commit, or stop and edit the commit. Note that commits are presented in the +order in which they will be committed, which is the opposite of `gitk` and `git +gr`, where the newest commit is on top. -Let's edit the commit `d76b4c6` (change '`pick`' to '`e`'). Save and exit, and the -rebase will proceed. When git hits that commit, it will stop and you can amend -your commit. +Let's edit the commit `d76b4c6` (change '`pick`' to '`e`'). Save and exit, and +the rebase will proceed. When git hits that commit, it will stop and you can +amend your commit. ``` -$ vi somefile # make your changes +$ vi somefile # make your changes $ git add -p somefile # add them to the index (building a commit) $ git commit --amend # amend your *old* commit (d76b4c6) -$ git status # see how you are doing +$ git status # see how you are doing $ git rebase --continue ``` @@ -474,7 +474,7 @@ ``` $ git checkout vmmcp # start from the top of the tree -$ vi somefile # make your changes +$ vi somefile # make your changes $ git add -p somefile # stage the changes $ git commit -m WIP-fixes-vmm-bug ``` @@ -496,19 +496,19 @@ `$ git rebase -i master` -Reorder the commits so that the WIP happens after `f62dd6c`, and change the WIP's -command from '`pick`' to '`f`'. +Reorder the commits so that the WIP happens after `f62dd6c`, and change the +WIP's command from '`pick`' to '`f`'. Assuming everything applies cleanly, you're done. The WIP approach is even -easier than the `rebase` with `amend`. I use it when a change applies to both the -current tip as well as the faulty commit. +easier than the `rebase` with `amend`. I use it when a change applies to both +the current tip as well as the faulty commit. You can even use `git rebase` to logically reorder commits so that together, the 'story' is more cohesive. -But wait, your version of `vmmcp` differs from `origin/vmmcp`! The repo's `vmmcp` -branch still looks like the old one. You need to `push -f` to force the repo's -branch to agree with yours: +But wait, your version of `vmmcp` differs from `origin/vmmcp`! The repo's +`vmmcp` branch still looks like the old one. You need to `push -f` to force +the repo's branch to agree with yours: `$ git push -f origin vmmcp` @@ -532,10 +532,10 @@ $ git reset --hard origin/vmmcp ``` -This throws away any differences between your tree and `origin/vmmcp`, in essence -making it replicate the current state of `origin/vmmcp`. If you had any changes, -you just lost them. Yikes! If in doubt, you can make a temp branch before -doing anything dangerous with reset. +This throws away any differences between your tree and `origin/vmmcp`, in +essence making it replicate the current state of `origin/vmmcp`. If you had +any changes, you just lost them. Yikes! If in doubt, you can make a temp +branch before doing anything dangerous with reset. `$ git branch temp # keeps a pointer called 'temp' to the current tip` @@ -553,12 +553,12 @@ `$ git rebase --onto origin/vmmcp PREVIOUS-ORIGIN-VMMCP` -You'll need to look at `gitk`, `git log`, `git gr`, or whatever to find the commit -name (SHA1) of the original `origin/vmmcp` (before you fetched). For this -reason, you could have a branch called vmmcp-mine for all of your changes, and -keep your branch `vmmcp` around to just track `origin/vmmcp`. This is what many -people do with `master`: it only tracks `origin/master`, and all changes happen on -separate branches. +You'll need to look at `gitk`, `git log`, `git gr`, or whatever to find the +commit name (SHA1) of the original `origin/vmmcp` (before you fetched). For +this reason, you could have a branch called vmmcp-mine for all of your changes, +and keep your branch `vmmcp` around to just track `origin/vmmcp`. This is what +many people do with `master`: it only tracks `origin/master`, and all changes +happen on separate branches. Note that you can probably just do a: @@ -605,8 +605,9 @@ $ git checkpatch master..my_branch_head ``` -That will generate the patches from master..my_branch_head and run checkpatch on each of them in series. -If you don't have the git scripts in your path, you'll have to do something like: +That will generate the patches from master..my_branch_head and run checkpatch +on each of them in series. If you don't have the git scripts in your path, +you'll have to do something like: ``` $ ./scripts/git/git-checkpatch master..my_branch_head
diff --git a/Documentation/async_events.txt b/Documentation/async_events.txt index 0bb1854..21d6675 100644 --- a/Documentation/async_events.txt +++ b/Documentation/async_events.txt
@@ -124,11 +124,11 @@ event_q pointer. If it is 0, the kernel will assume you poll the actual syscall struct. - struct syscall { - current stuff /* arguments, retvals */ - struct ev_queue * /* struct used for messaging, including IPIs*/ - void * /* used by 2LS, usually a struct u_thread * */ - } +struct syscall { + current stuff /* arguments, retvals */ + struct ev_queue * /* struct used for messaging, including IPIs*/ + void * /* used by 2LS, usually a struct u_thread * */ +} One issue with async syscalls is that there can be too many outstanding IOs (normally sync calls provide feedback / don't allow you to over-request). @@ -279,22 +279,22 @@ ---------------------------------------------- The mbox (mailbox) is where the actual messages go. - struct ev_mbox { - bcq of notif_events /* bounded buffer, multi-consumer/producer */ - msg_bitmap - } - struct ev_queue { /* aka, event_q, ev_q, etc. */ - struct ev_mbox * - void handler(struct event_q *) - vcore_to_be_told - flags /* IPI_WANTED, RR, 2L-handle-it, etc */ - } - struct ev_queue_big { - struct ev_mbox * /* pointing to the internal storage */ - vcore_to_be_told - flags /* IPI_WANTED, RR, 2L-handle-it, etc */ - struct ev_mbox { } /* never access this directly */ - } +struct ev_mbox { + bcq of notif_events /* bounded buffer, multi-consumer/producer */ + msg_bitmap +} +struct ev_queue { /* aka, event_q, ev_q, etc. */ + struct ev_mbox * + void handler(struct event_q *) + vcore_to_be_told + flags /* IPI_WANTED, RR, 2L-handle-it, etc */ +} +struct ev_queue_big { + struct ev_mbox * /* pointing to the internal storage */ + vcore_to_be_told + flags /* IPI_WANTED, RR, 2L-handle-it, etc */ + struct ev_mbox { } /* never access this directly */ +} The purpose of the big one is to simply embed some storage. Still, only access the mbox via the pointer. The big one can be casted (and stored as)
diff --git a/Documentation/fd_taps.txt b/Documentation/fd_taps.txt index dc335a4..d153088 100644 --- a/Documentation/fd_taps.txt +++ b/Documentation/fd_taps.txt
@@ -66,10 +66,10 @@ work - we'd probably want to pass in the FD (integer), proc*, and probably the chan. However, once we closed, the FD is now free, and we could have something like: - Trying to close: User opens and taps a conv: + Trying to close: User opens and taps a conv: close(5) (FD 5 was 1/data with a tap) - open(/net/tcp/1/data) (get 5 back) - register_fd_tap(5) (two taps on 5, might fail!) + open(/net/tcp/1/data) (get 5 back) + register_fd_tap(5) (two taps on 5, might fail!) deregister_fd_tap(5) cclose (needed to keep the chan alive) At the end, we might have no taps on 5. Or if we opened 2/data instead of @@ -78,9 +78,9 @@ Maybe we deregister first, then close, to avoid FD reuse problems. Remember that the only locking goes on in close. Now consider: - Trying to close: User tries to add (another) tap: + Trying to close: User tries to add (another) tap: deregister_fd_tap(5) - register_fd_tap(5) + register_fd_tap(5) close(5) (was 1/data with a tap) Now we just closed with a tap still registered. Eventually, that FD tap might fire. Spurious events are okay, but we could run into issues. Say the evq in @@ -116,12 +116,12 @@ - What if a legit deregister occurs while we are registering and eventually will succeed? Say: - sys_register_fd_tap(0xf00) - adds to fdset, unlocks + sys_register_fd_tap(0xf00) + adds to fdset, unlocks close(5) yanks 0xf00 from the fd deregister tap 0xf00 (fails, spurious) - register tap(chan, 0xf00) + register tap(chan, 0xf00) free 0xf00? The deregister fails, since it was never there (remember we said it could have spurious deregister calls). Then register happens. But the FD is closed! And @@ -148,15 +148,15 @@ lock FDT add tap 0xf00 to FD 5 unlock FDT - lock FDT - remove tap from FD 5 - unlock FDT - decref 0xf00 - (new syscall) - lock FDT - add tap 0xbar to FD 5 - unlock FDT - register tap 0xbar for FD 5 + lock FDT + remove tap from FD 5 + unlock FDT + decref 0xf00 + (new syscall) + lock FDT + add tap 0xbar to FD 5 + unlock FDT + register tap 0xbar for FD 5 register tap 0xf00 for FD 5 decref and trigger a deregister of f00
diff --git a/Documentation/process-internals.txt b/Documentation/process-internals.txt index 2bb5338..78aae55 100644 --- a/Documentation/process-internals.txt +++ b/Documentation/process-internals.txt
@@ -1349,9 +1349,9 @@ - You can't hold a spinlock of any sort and then wait on a routine kernel message. The core where that runs may be waiting on you, or some scenario like above. - - Similarly, think about how this works with kthreads. A kthread restart - is a routine KMSG. You shouldn't be waiting on code that could end up - kthreading, mostly because those calls block! + - Similarly, think about how this works with kthreads. A kthread + restart is a routine KMSG. You shouldn't be waiting on code that + could end up kthreading, mostly because those calls block! - You can hold a spinlock and wait on an IMMED kmsg, if the waiters of the spinlock have irqs enabled while spinning (this is what we used to do with the proc lock and IMMED kmsgs, and 54c6008 is an example of doing it wrong) @@ -1360,9 +1360,10 @@ - For broadcast trees, you'd have to send IMMEDs for the intermediates, and then it'd be okay to wait on those intermediate, immediate messages (if we wanted confirmation of the posting of RKM) - - The main thing any broadcast mechanism needs to do is make sure all + - The main thing any broadcast mechanism needs to do is make sure all messages get delivered in order to particular pcores (the central - premise of KMSGs) (and not deadlock due to waiting on a KMSG improperly) + premise of KMSGs) (and not deadlock due to waiting on a KMSG + improperly) - Alternatively, we could use routines for the intermediates if we didn't want to wait for RKMs to hit their destination, we'd need to always use the same proxy for the same destination pcore, e.g., core 16 always covers 16-31. @@ -1371,8 +1372,8 @@ ordering of intermediate msgs on the message queues of a particular core. - All kmsgs would need to use this broadcasting style (couldn't mix - regular direct messages with broadcast), so odds are this style would be - of limited use. + regular direct messages with broadcast), so odds are this style would + be of limited use. - since we're not waiting on execution of a message, we could use RKMs (while holding a spinlock) - There might be some bad effects with kthreads delaying the reception of RKMS
diff --git a/Documentation/testing.txt b/Documentation/testing.txt index 44ce828..3663494 100644 --- a/Documentation/testing.txt +++ b/Documentation/testing.txt
@@ -19,7 +19,8 @@ - Verify successful compilation of our user libraries - Verify successful compilation of the cross compiler for all supported archs on commits that touch a file in the cross compiler - - Compile and run a suite of kernel and user tests and verify their success + - Compile and run a suite of kernel and user tests and verify their + success The framework should support easily adding/removing tests, as well as a way to easily turn them on and off, without actually removing them. We should also @@ -117,26 +118,26 @@ 2.3 Post-boot kernel unit tests ------------------------------------------------------------------ - 1. Go to akaros/kern/src/tests_pb_kernel.c - 2. Create a new function for the test. Follow the following pattern: - bool test_[NAME](void) - { - [CODE] - return true; - } - 3. Inside the [CODE] section, use the following assertion functions: - * KT_ASSERT(boolean-expression): runs the expression and, if it fails, - it finishes the full unit test with a result of FAILED. - * KT_ASSERT_M(message, boolean-expression): like KT_ASSERT but, in case - of failure, the message gets printed as cause of failure. - 4. Go to akaros/kern/src/tests.c - 5. Add inside the pb_kernel_tests array a line like the following: - PB_K_TEST_REG([NAME], true), - (Optionally, disable temporarily the test by setting the second arg to - false). +1. Go to akaros/kern/src/tests_pb_kernel.c +2. Create a new function for the test. Follow the following pattern: + bool test_[NAME](void) + { + [CODE] + return true; + } +3. Inside the [CODE] section, use the following assertion functions: + * KT_ASSERT(boolean-expression): runs the expression and, if it fails, + it finishes the full unit test with a result of FAILED. + * KT_ASSERT_M(message, boolean-expression): like KT_ASSERT but, in case + of failure, the message gets printed as cause of failure. +4. Go to akaros/kern/src/tests.c +5. Add inside the pb_kernel_tests array a line like the following: + PB_K_TEST_REG([NAME], true), + (Optionally, disable temporarily the test by setting the second arg to + false). - If you'd like a test to be ran only in a given architecture, surround - it here by #ifdefine CONFIG_[ARCH] ... #endif tags. + If you'd like a test to be ran only in a given architecture, surround + it here by #ifdefine CONFIG_[ARCH] ... #endif tags. 2.4 Userspace unit tests ------------------------------------------------------------------ @@ -183,8 +184,8 @@ akaros/include/test_infrastructure.h test_infrastructure.h: - This file defines macros used for assertions, as well as data structures, - variables and a macro for registering postboot tests. + This file defines macros used for assertions, as well as data + structures, variables and a macro for registering postboot tests. tests_pb_kernel.c: This file contains the implementation of all the tests in this category.
diff --git a/Documentation/vfs.txt b/Documentation/vfs.txt index 5f4561c..2157a5f 100644 --- a/Documentation/vfs.txt +++ b/Documentation/vfs.txt
@@ -9,8 +9,9 @@ - Superblock: Specific instance of a mounted filesystem. All synchronization is done with the one spinlock. - Inode: represents a specific file - - Dentry: in memory object, corresponding to an element of a path. E.g. /, - usr, bin, and vim are all dentries. All have inodes. Vim happens to be a + - Dentry: in memory object, corresponding to an element of a path. + E.g. /, usr, bin, and vim are all dentries. All have inodes. Vim + happens to be a file instead of a directory. - File: represents a file opened by a process.
diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index 41ad619..6971176 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md
@@ -109,8 +109,8 @@ `/home/brho/classes/akaros/akaros-gcc-glibc/install-x86_64-ucb-akaros-gcc/bin` -You can also set up `MAKE_JOBS`, so you don't over or under load your system when -building. I have a 2 core laptop, so I use `MAKE_JOBS := 3` +You can also set up `MAKE_JOBS`, so you don't over or under load your system +when building. I have a 2 core laptop, so I use `MAKE_JOBS := 3` At this point, you can build (for example): @@ -170,7 +170,7 @@ ``` Building initramfs: - Adding kern/kfs to initramfs... + Adding kern/kfs to initramfs... ``` @@ -235,10 +235,10 @@ Personally, I always have `hdd.img` mounted. Some of the other devs have make targets that mount and umount it. Whenever I reboot my development machine, I run a script (as root) that mounts the image file and sets up a few things for -networking. I put a script I use for this in `scripts/kvm-up.sh`. You'll likely -want to copy it to the directory **above** the akaros root directory and edit it -accordingly. Feel free to comment out the networking stuff. That's for using -networking in `qemu`. +networking. I put a script I use for this in `scripts/kvm-up.sh`. You'll +likely want to copy it to the directory **above** the akaros root directory and +edit it accordingly. Feel free to comment out the networking stuff. That's for +using networking in `qemu`. Now that your image file is mounted at `mnt/hdd`, you'll want to copy your freshly built kernel to the root of the image. I have a make target in my @@ -289,8 +289,8 @@ `-net tap,ifname=tap0,script=no` -The "`-net dump`" option saves a pcap trace of the network traffic. This is very -useful for debugging, but probably not needed for most people. +The "`-net dump`" option saves a pcap trace of the network traffic. This is +very useful for debugging, but probably not needed for most people. Feel free to pick different values for the number of cpus and RAM (8 and 4096 in the example).
diff --git a/Kconfig b/Kconfig index 8fdc079..1ed6b8f 100644 --- a/Kconfig +++ b/Kconfig
@@ -13,21 +13,21 @@ bool "64-bit kernel" default y help - Say yes to build a 64-bit kernel. Must be 'y' for x86. + Say yes to build a 64-bit kernel. Must be 'y' for x86. menuconfig RUN_INIT_SCRIPT bool "Run init script after boot" default n help - Run an init script after boot instead of dropping into the monitor + Run an init script after boot instead of dropping into the monitor config INIT_SCRIPT_PATH_AND_ARGS - depends on RUN_INIT_SCRIPT - string "Path to init script, followed by its arguments." - default /bin/init.sh - help - Path to the init script run at boot time, followed by a space separated - list of arguments + depends on RUN_INIT_SCRIPT + string "Path to init script, followed by its arguments." + default /bin/init.sh + help + Path to the init script run at boot time, followed by a space + separated list of arguments source "kern/arch/$SRCARCH/Kconfig" @@ -41,48 +41,48 @@ bool "KFS filesystem" default y help - KFS is an initramfs bundled into the kernel, and contains your root - filesystem. + KFS is an initramfs bundled into the kernel, and contains your root + filesystem. config KFS_PATHS depends on KFS string "KFS/Initramfs paths" default kern/kfs help - Space separated list of paths to directories to bundle into KFS. This - will be your root filesystem. + Space separated list of paths to directories to bundle into KFS. + This will be your root filesystem. config KFS_CPIO_BIN depends on KFS string "KFS CPIO helper" default "" help - This binary (relative to the root directory) will be run before - bundling the KFS Paths into the CPIO. + This binary (relative to the root directory) will be run before + bundling the KFS Paths into the CPIO. endmenu choice COREALLOC_POLICY prompt "Core Allocation Policy" help - Select a policy for allocating cores to a process upon request. All - strategies first allocate cores from the set of provisioned cores for a - process, but differ in how they select cores beyond this. + Select a policy for allocating cores to a process upon request. All + strategies first allocate cores from the set of provisioned cores for + a process, but differ in how they select cores beyond this. config COREALLOC_FCFS bool "Simple FCFS" help - Allocate cores to processes on a first-come-first-served basis. All - cores are treated equally, and no topology information is used to try - and optimize which cores are given to which processes upon request. + Allocate cores to processes on a first-come-first-served basis. All + cores are treated equally, and no topology information is used to try + and optimize which cores are given to which processes upon request. config COREALLOC_PACKED bool "Packed Topology" help - Allocate cores to a process based on a topology-aware algorithm that - tries to pack allocated cores as close together as possible. It first - tries to pair new cores with their hyper-threaded pair, then keep them - on the same socket, then the same numa domain. + Allocate cores to a process based on a topology-aware algorithm that + tries to pack allocated cores as close together as possible. It + first tries to pair new cores with their hyper-threaded pair, then + keep them on the same socket, then the same numa domain. endchoice @@ -94,20 +94,20 @@ bool "KMSG Tracing" default n help - Turns on KMSG tracing, using the per-cpu ring buffer (holds about 256 - events). You can access this from the monitor via "trace pcpui". Turn - this off for a slight performance improvement on every KMSG (and every - MCP proc_yield). + Turns on KMSG tracing, using the per-cpu ring buffer (holds about 256 + events). You can access this from the monitor via "trace pcpui". + Turn this off for a slight performance improvement on every KMSG (and + every MCP proc_yield). config TRACE_LOCKS bool "Lock Tracing" depends on SPINLOCK_DEBUG default n help - Turns on lock tracing, using the per-cpu ring buffer. This records the - a timestamp and lock address, in an over-write tracing style (meaning - it'll clobber older events). If you have locking issues, this may give - you clues as to which locks were grabbed recently. + Turns on lock tracing, using the per-cpu ring buffer. This records + the a timestamp and lock address, in an over-write tracing style + (meaning it'll clobber older events). If you have locking issues, + this may give you clues as to which locks were grabbed recently. endmenu @@ -115,86 +115,86 @@ bool "dasserts" default n help - Turn on dassert() in code, dassert will compile to assert(). + Turn on dassert() in code, dassert will compile to assert(). config SPINLOCK_DEBUG bool "Spinlock debugging" default n help - Turns on debugging, which tracks the last time a lock was acquired and - detects improper lock acquisition based on IRQ levels (e.g. using - spin_lock() in IRQ context). This will slow down all lock - acquisitions. + Turns on debugging, which tracks the last time a lock was acquired + and detects improper lock acquisition based on IRQ levels (e.g. using + spin_lock() in IRQ context). This will slow down all lock + acquisitions. config SEQLOCK_DEBUG bool "Seqlock debugging" default n help - Provides asserts to detect seqlock errors. This will allow a malicious - userspace to trigger a panic in the kernel. + Provides asserts to detect seqlock errors. This will allow a + malicious userspace to trigger a panic in the kernel. config SEMAPHORE_DEBUG bool "Semaphore debugging" default n help - Turns on debugging, which tracks the last time and location that a - semaphore was downed, and provides a linked list of all semaphores that - have waiters. This will slow down all semaphore ups and downs. + Turns on debugging, which tracks the last time and location that a + semaphore was downed, and provides a linked list of all semaphores + that have waiters. This will slow down all semaphore ups and downs. config SEM_SPINWAIT bool "Semaphore spinwaiting" default n help - Turns on semaphore spinwaiting. In lieu of intelligent Adaptive - Mutexes, busy semaphores will just spin for a while before fully - sleeping. + Turns on semaphore spinwaiting. In lieu of intelligent Adaptive + Mutexes, busy semaphores will just spin for a while before fully + sleeping. config SEM_SPINWAIT_NR_LOOPS int "Number of polls before sleeping" depends on SEM_SPINWAIT default 100 help - How many times to poll a busy semaphore before going to sleep. + How many times to poll a busy semaphore before going to sleep. config DISABLE_SMT bool "Disables symmetric multithreading" default n help - Disables hyperthreading by telling the kernel to never give out even - numbered cores to MCPs. This does not check to see if the threads are - in fact siblings, or if the target machine is hyperthreaded. + Disables hyperthreading by telling the kernel to never give out even + numbered cores to MCPs. This does not check to see if the threads + are in fact siblings, or if the target machine is hyperthreaded. config PRINTK_NO_BACKSPACE bool "Printk with no backspace" default n help - One of the serial devices I was using a while back had issues printing - backspaces. This was an old hack to deal with that. + One of the serial devices I was using a while back had issues + printing backspaces. This was an old hack to deal with that. config SYSCALL_STRING_SAVING bool "Syscall string saving" default n help - Kmallocs a small buffer for each syscall and attaches it to the - kthread, which can be viewed when debugging semaphores. Individual - syscalls can save info in this buffer. + Kmallocs a small buffer for each syscall and attaches it to the + kthread, which can be viewed when debugging semaphores. Individual + syscalls can save info in this buffer. config BLOCK_EXTRAS bool "Block Extra Data" default y help - Extends blocks to have a list of other memory blocks. Useful for - networking performance. This is only an option while we debug the - implementation. Say y. If you have networking bugs, try turning this - off, and if that helps, tell someone. + Extends blocks to have a list of other memory blocks. Useful for + networking performance. This is only an option while we debug the + implementation. Say y. If you have networking bugs, try turning + this off, and if that helps, tell someone. config BETTER_BACKTRACE bool "Better backtraces, less optimizations" default n help - The kernel uses the frame pointer and call stacks for backtraces. - Tail-call optimizations remove some of this information. Say 'Y' here - to have better backtraces, at the expense of performance. + The kernel uses the frame pointer and call stacks for backtraces. + Tail-call optimizations remove some of this information. Say 'Y' + here to have better backtraces, at the expense of performance. endmenu @@ -204,37 +204,37 @@ bool "Asynchronous remote syscalls" default n help - Code to run a syscall-server on a core. A process can submit syscalls - and get the results asynchronously. Hasn't been used in years. Say - 'n' unless you want to play around. + Code to run a syscall-server on a core. A process can submit + syscalls and get the results asynchronously. Hasn't been used in + years. Say 'n' unless you want to play around. # SPARC auto-selects this config APPSERVER bool "Appserver" default n help - Old school I/O was through a remote machine. Not sure if anyone uses - this anymore. + Old school I/O was through a remote machine. Not sure if anyone uses + this anymore. config SERIAL_IO bool "Serial IO" default n help - Like the appserver, serial I/O was an old attempt to process I/O on a - remote machine across the serial port. + Like the appserver, serial I/O was an old attempt to process I/O on a + remote machine across the serial port. config SINGLE_CORE bool "Single core" default n help - Have the kernel boot only a single core. Can be useful for debugging, - but hasn't been used in years. + Have the kernel boot only a single core. Can be useful for + debugging, but hasn't been used in years. config BSD_ON_CORE0 bool "BSD on core 0" default n help - This was an old joke. Say 'n', since we can't simply #include <bsd>. + This was an old joke. Say 'n', since we can't simply #include <bsd>. endmenu
diff --git a/Makefile b/Makefile index 424657b..70766a6 100644 --- a/Makefile +++ b/Makefile
@@ -3,37 +3,37 @@ # # # Notes: -# - I downloaded the kbuild guts from git://github.com/lacombar/kconfig.git, -# and added things from a recent linux makefile. It is from aug 2011, so -# some things might not match up. -# - Kernel output in obj/: So Linux has the ability to output into another -# directory, via the KBUILD_OUTPUT variable. This induces a recursive make -# in the output directory. I mucked with it for a little, but didn't get it -# to work quite right. Also, there will be other Akaros issues since this -# makefile is also used for userspace and tests. For now, I'm leaving things -# the default Linux way. -# - Kconfig wants to use include/ in the root directory. We can change some -# of the default settings that silentoldconfig uses, but I'll leave it as-is -# for now, and just symlink that into kern/include. It'll be easier for us, -# and also potentially easier if we ever move kern/ up a level. Similarly, -# there are default Kconfigs in arch/, not in kern/arch. I just symlinked -# arch->kern/arch to keep everything simple. +# - I downloaded the kbuild guts from git://github.com/lacombar/kconfig.git, +# and added things from a recent linux makefile. It is from aug 2011, so +# some things might not match up. +# - Kernel output in obj/: So Linux has the ability to output into another +# directory, via the KBUILD_OUTPUT variable. This induces a recursive make +# in the output directory. I mucked with it for a little, but didn't get it +# to work quite right. Also, there will be other Akaros issues since this +# makefile is also used for userspace and tests. For now, I'm leaving things +# the default Linux way. +# - Kconfig wants to use include/ in the root directory. We can change some +# of the default settings that silentoldconfig uses, but I'll leave it as-is +# for now, and just symlink that into kern/include. It'll be easier for us, +# and also potentially easier if we ever move kern/ up a level. Similarly, +# there are default Kconfigs in arch/, not in kern/arch. I just symlinked +# arch->kern/arch to keep everything simple. # # TODO: -# - Consider merging the two target-detection bits (Linux's config, mixed, or -# dot target, and the symlink handling). Also, could consider moving around -# the KFS target. Clean doesn't need to know about it, for instance. +# - Consider merging the two target-detection bits (Linux's config, mixed, or +# dot target, and the symlink handling). Also, could consider moving around +# the KFS target. Clean doesn't need to know about it, for instance. # -# - Review, with an eye for being better about $(srctree). It might only be -# necessary in this file, if we every do the KBUILD_OUTPUT option. But we -# don't always want it (like for the implicit rule for Makefile) +# - Review, with an eye for being better about $(srctree). It might only be +# necessary in this file, if we every do the KBUILD_OUTPUT option. But +# we don't always want it (like for the implicit rule for Makefile) # -# - It's a bit crazy that we build symlinks for parlib, instead of it -# managing its own links based on $(ARCH) +# - It's a bit crazy that we build symlinks for parlib, instead of it +# managing its own links based on $(ARCH) # -# - Consider using Kbuild to build userspace and tests +# - Consider using Kbuild to build userspace and tests # -# - There are a few other TODOs sprinkled throughout the makefile. +# - There are a few other TODOs sprinkled throughout the makefile. # Number of make jobs to spawn. Can override this in Makelocal MAKE_JOBS ?= $(shell expr `cat /proc/cpuinfo | grep processor | wc -l` - 1) @@ -341,10 +341,10 @@ AS := $(CROSS_COMPILE)as AR := $(CROSS_COMPILE)ar LD := $(CROSS_COMPILE)ld -OBJCOPY := $(CROSS_COMPILE)objcopy -OBJDUMP := $(CROSS_COMPILE)objdump +OBJCOPY := $(CROSS_COMPILE)objcopy +OBJDUMP := $(CROSS_COMPILE)objdump NM := $(CROSS_COMPILE)nm -STRIP := $(CROSS_COMPILE)strip +STRIP := $(CROSS_COMPILE)strip KERNEL_LD ?= kernel.ld # These may have bogus values if there is no compiler. The kernel and user @@ -467,8 +467,8 @@ kfs-paths-check := $(shell for i in $(kfs-paths); do \ if [ ! -d "$$i" ]; then \ echo "Can't find KFS directory $$i"; \ - $(MAKE) -f $(srctree)/Makefile \ - silentoldconfig > /dev/null; \ + $(MAKE) -f $(srctree)/Makefile \ + silentoldconfig > /dev/null; \ exit -1; \ fi; \ done; echo "ok") @@ -483,14 +483,14 @@ $(kern_cpio) initramfs: $(kern_initramfs_files) @echo " Building initramfs:" @if [ "$(CONFIG_KFS_CPIO_BIN)" != "" ]; then \ - sh $(CONFIG_KFS_CPIO_BIN); \ - fi + sh $(CONFIG_KFS_CPIO_BIN); \ + fi @cat /dev/null | cpio --quiet -oH newc -O $(kern_cpio) $(Q)for i in $(kfs-paths); do cd $$i; \ - echo " Adding $$i to initramfs..."; \ - find -L . | cpio --quiet -oAH newc -O $(CURDIR)/$(kern_cpio); \ - cd $$OLDPWD; \ - done; + echo " Adding $$i to initramfs..."; \ + find -L . | cpio --quiet -oAH newc -O $(CURDIR)/$(kern_cpio); \ + cd $$OLDPWD; \ + done; ld_emulation = $(shell $(OBJDUMP) -i 2>/dev/null | \ grep -v BFD | grep ^[a-z] | head -n1)
diff --git a/README.md b/README.md index 5fc6012..45d2069 100644 --- a/README.md +++ b/README.md
@@ -8,16 +8,17 @@ other jobs running on the system. Although not yet integrated as such, it is designed to operate as a low-level -node OS with a higher-level Cluster OS, such as [Mesos](http://mesos.apache.org/), -governing how resources are shared amongst applications running on each node. -Its system call API and "Many Core Process" abstraction better match the -requirements of a Cluster OS, eliminating many of the obstacles faced by other -systems when trying to isolate simultaneously running processes. Moreover, -Akaros’s resource provisioning interfaces allow for node-local decisions to be -made that enforce the resource allocations set up by a Cluster OS. This can be -used to simplify global allocation decisions, reduce network communication, and -ultimately promote more efficient sharing of resources. There is limited -support for such functionality on existing operating systems. +node OS with a higher-level Cluster OS, such as +[Mesos](http://mesos.apache.org/), governing how resources are shared amongst +applications running on each node. Its system call API and "Many Core Process" +abstraction better match the requirements of a Cluster OS, eliminating many of +the obstacles faced by other systems when trying to isolate simultaneously +running processes. Moreover, Akaros’s resource provisioning interfaces allow +for node-local decisions to be made that enforce the resource allocations set +up by a Cluster OS. This can be used to simplify global allocation decisions, +reduce network communication, and ultimately promote more efficient sharing of +resources. There is limited support for such functionality on existing +operating systems. Akaros is still very young, but preliminary results show that processes running on Akaros have an order of magnitude less noise than on Linux, as well as fewer
diff --git a/kern/arch/riscv/kernel.ld b/kern/arch/riscv/kernel.ld index 2be5456..c925021 100644 --- a/kern/arch/riscv/kernel.ld +++ b/kern/arch/riscv/kernel.ld
@@ -10,7 +10,8 @@ .text 0xFFFFFFFF80002000 : AT(0x2000) { *(.text .stub .text.* .gnu.linkonce.t.*) - PROVIDE(etext = .); /* Define the 'etext' symbol to this value */ + /* Define the 'etext' symbol to this value */ + PROVIDE(etext = .); } INCLUDE kern/linker_tables.ld
diff --git a/kern/arch/x86/Kconfig b/kern/arch/x86/Kconfig index 274f217..5837a10 100644 --- a/kern/arch/x86/Kconfig +++ b/kern/arch/x86/Kconfig
@@ -11,16 +11,17 @@ bool "Verbose PCI Output" default n help - Will print out extra information related to PCI. + Will print out extra information related to PCI. config NOFASTCALL_FSBASE depends on X86_64 bool "Disable fastcall to set FS base" default n help - Disable the fast path syscall to set FS base. If your hardware allows - setting FS base from userspace, you can say y to disable the fastcall - for a slight improvement for all syscalls. If unsure, say n. + Disable the fast path syscall to set FS base. If your hardware + allows setting FS base from userspace, you can say y to disable the + fastcall for a slight improvement for all syscalls. If unsure, say + n. endmenu @@ -30,49 +31,49 @@ bool "Lousy Local APIC Timer" default n help - This turns our one-shot APIC timer into a periodic timer. If your - system seems to lock up until you hit the keyboard, say 'Y' here and - report the results. + This turns our one-shot APIC timer into a periodic timer. If your + system seems to lock up until you hit the keyboard, say 'Y' here and + report the results. - Qemu without KVM had issues firing a one-shot LAPIC timer (the timer IRQ - would only go off when some other IRQ fired), but it worked with a - periodic tick. Since we aggressively disarm the timer, this config - shouldn't be a performance hit. + Qemu without KVM had issues firing a one-shot LAPIC timer (the timer + IRQ would only go off when some other IRQ fired), but it worked with + a periodic tick. Since we aggressively disarm the timer, this config + shouldn't be a performance hit. config NOMTRRS bool "Disable MTRRs" default y help - Old debug option from when we were having issues with MTRRs. If your - machine won't boot, try turning this on. + Old debug option from when we were having issues with MTRRs. If your + machine won't boot, try turning this on. config KB_CORE0_ONLY bool "Keyboard from core0 only" default n help - Say 'n' unless you are using a buggy x86 machine that can't handle - polling the keyboard PIO from cores other than core 0. + Say 'n' unless you are using a buggy x86 machine that can't handle + polling the keyboard PIO from cores other than core 0. config X86_DISABLE_KEYBOARD bool "Disable Keyboard" default n help - x86 machines with a legacy USB keyboard often implement the USB stack - in SMM mode. When doing anything with the keyboard, including polling - the keyboard from the kernel monitor, SMM mode can dramatically - interfere with other cores (like a 10-15x performance impact on some - benchmarks). - - Say 'y' if you have such a machine and do not need the keyboard. + x86 machines with a legacy USB keyboard often implement the USB stack + in SMM mode. When doing anything with the keyboard, including + polling the keyboard from the kernel monitor, SMM mode can + dramatically interfere with other cores (like a 10-15x performance + impact on some benchmarks). + + Say 'y' if you have such a machine and do not need the keyboard. config ENABLE_LEGACY_USB bool "Enable Legacy USB" default n help - Say 'y' if you want to use a USB keyboard. Given that we do not have a - USB stack, disabling legacy USB means USB keyboards will not work. We - disable legacy USB by default, since our primary console communication - is serial, and legacy USB support results in SMM interference that - affects all cores. + Say 'y' if you want to use a USB keyboard. Given that we do not have + a USB stack, disabling legacy USB means USB keyboards will not work. + We disable legacy USB by default, since our primary console + communication is serial, and legacy USB support results in SMM + interference that affects all cores. endmenu
diff --git a/kern/arch/x86/entry64.S b/kern/arch/x86/entry64.S index 61774cd..9740273 100644 --- a/kern/arch/x86/entry64.S +++ b/kern/arch/x86/entry64.S
@@ -49,28 +49,28 @@ * This will clobber ax, dx, cx, di, si. * * A few notes about the jumbo GB mapping: - * - PML3 is responsible for the 9 bits from 30-38, hence the >> 30 and mask - * - PML4 is responsible for the 9 bits from 47-39, hence the >> 39 and mask - * - We use the jumbo PTE_PS flag only on PML3 - can't do it for PML4. - * - PTEs are 8 bytes each, hence the scale = 8 in the indirect addressing - * - The top half of all of PML4's PTEs are set to 0. This includes the top 20 - * bits of the physical address of the page tables - which are 0 in our case. - * - The paddr for the PML3 PTEs is split across two 32-byte halves of the PTE. - * We drop off the lower 30 bits, since we're dealing with 1GB pages. The 2 - * LSBs go at the top of the first half of the PTE, and the remaining 30 are - * the lower 30 of the top half. */ + * - PML3 is responsible for the 9 bits from 30-38, hence the >> 30 and mask + * - PML4 is responsible for the 9 bits from 47-39, hence the >> 39 and mask + * - We use the jumbo PTE_PS flag only on PML3 - can't do it for PML4. + * - PTEs are 8 bytes each, hence the scale = 8 in the indirect addressing + * - The top half of all of PML4's PTEs are set to 0. This includes the top 20 + * bits of the physical address of the page tables - which are 0 in our case. + * - The paddr for the PML3 PTEs is split across two 32-byte halves of the PTE. + * We drop off the lower 30 bits, since we're dealing with 1GB pages. The 2 + * LSBs go at the top of the first half of the PTE, and the remaining 30 are + * the lower 30 of the top half. */ #define MAP_GB_PAGES(pml3, vaddr, paddr, count) \ - movl $(boot_pml4), %eax; \ - push %eax; \ - movl $(count), %eax; \ - push %eax; \ - movl $(pml3), %edi; \ - movl $(vaddr >> 32), %esi; \ - movl $(vaddr & 0xffffffff), %edx; \ - movl $(paddr >> 32), %ecx; \ - movl $(paddr & 0xffffffff), %eax; \ - call map_gb_pages; \ - add $0x8, %esp + movl $(boot_pml4), %eax; \ + push %eax; \ + movl $(count), %eax; \ + push %eax; \ + movl $(pml3), %edi; \ + movl $(vaddr >> 32), %esi; \ + movl $(vaddr & 0xffffffff), %edx; \ + movl $(paddr >> 32), %ecx; \ + movl $(paddr & 0xffffffff), %eax; \ + call map_gb_pages; \ + add $0x8, %esp # Maps count GBs (up to 512) of vaddr -> paddr using pml3 and pml4 in 1GB pages # @@ -86,14 +86,14 @@ # arg5 on stack. other args already in regs. push %ebx call fill_jpml3 - add $0x4, %esp # pop arg5 frame + add $0x4, %esp # pop arg5 frame # restore our regs/args for next call - pop %edx - pop %esi - pop %edi + pop %edx + pop %esi + pop %edi movl 0xc(%esp), %ecx call insert_pml3 - pop %ebx + pop %ebx ret # Fills pml3 with "count" jumbo entries, mapping from vaddr -> paddr. @@ -103,45 +103,46 @@ fill_jpml3: push %ebx movl 0x8(%esp), %ebx - # want (vaddr >> 30) & 0x1ff into esi. append upper 2 bits of edx to esi. + # want (vaddr >> 30) & 0x1ff into esi. append upper 2 bits of edx to + # esi. shll $2, %esi shrl $30, %edx - orl %edx, %esi + orl %edx, %esi andl $0x1ff, %esi # want (paddr >> 30) into ecx. shll $2, %ecx shrl $30, %eax - orl %eax, %ecx + orl %eax, %ecx 1: movl %ecx, %eax - shll $30, %eax # lower part of PTE ADDR - orl $(PTE_P | PTE_W | PTE_PS | PTE_G), %eax + shll $30, %eax # lower part of PTE ADDR + orl $(PTE_P | PTE_W | PTE_PS | PTE_G), %eax movl %eax, (%edi, %esi, 8) movl %ecx, %eax - shrl $2, %eax # upper part of PTE ADDR + shrl $2, %eax # upper part of PTE ADDR movl %eax, 4(%edi, %esi, 8) # prep for next loop incl %esi incl %ecx decl %ebx - jnz 1b - pop %ebx + jnz 1b + pop %ebx ret #define MAP_2MB_PAGES(pml3, vaddr, paddr, count, pml2base) \ - movl $(pml2base), %eax; \ - push %eax; \ - movl $(boot_pml4), %eax; \ - push %eax; \ - movl $(count), %eax; \ - push %eax; \ - movl $(pml3), %edi; \ - movl $(vaddr >> 32), %esi; \ - movl $(vaddr & 0xffffffff), %edx; \ - movl $(paddr >> 32), %ecx; \ - movl $(paddr & 0xffffffff), %eax; \ - call map_2mb_pages; \ - add $0xc, %esp + movl $(pml2base), %eax; \ + push %eax; \ + movl $(boot_pml4), %eax; \ + push %eax; \ + movl $(count), %eax; \ + push %eax; \ + movl $(pml3), %edi; \ + movl $(vaddr >> 32), %esi; \ + movl $(vaddr & 0xffffffff), %edx; \ + movl $(paddr >> 32), %ecx; \ + movl $(paddr & 0xffffffff), %eax; \ + call map_2mb_pages; \ + add $0xc, %esp # Maps count GBs (up to 512) of vaddr -> paddr using pml3, pml4, and an array of # pml2s in 2MB pages @@ -155,19 +156,19 @@ push %esi push %edx # arg5 and 7 on stack. other args already in regs. - movl 0x1c(%esp), %ebx # arg7 (4 pushes, 1 retaddr, arg 5, arg6) + movl 0x1c(%esp), %ebx # arg7: 4 pushes, 1 retaddr, arg 5, arg6 push %ebx - movl 0x18(%esp), %ebx # arg6 (5 pushes, 1 retaddr) + movl 0x18(%esp), %ebx # arg6: 5 pushes, 1 retaddr push %ebx call fill_pml3 - add $0x8, %esp # pop args frame + add $0x8, %esp # pop args frame # restore our regs/args for next call - pop %edx - pop %esi - pop %edi + pop %edx + pop %esi + pop %edi movl 0xc(%esp), %ecx call insert_pml3 - pop %ebx + pop %ebx ret # Fills pml3 with "count" pml2 entries, mapping from vaddr -> paddr. @@ -177,30 +178,30 @@ # stack count, pml2base fill_pml3: push %ebx - push %ebp # scratch register + push %ebp # scratch register movl 0xc(%esp), %ebx 1: - push %edi # save edi = pml3 + push %edi # save edi = pml3 push %esi push %edx push %ecx push %eax - movl $512, %ebp # count = 512 for PML2 (map it all) + movl $512, %ebp # count = 512 for PML2 (map it all) push %ebp # compute pml2 (pml2base + (total count - current count) * PGSIZE * 2) - movl 0x28(%esp), %ebp # pml2base (8 push, 1 ret, arg5) - movl 0x24(%esp), %edi # total count + movl 0x28(%esp), %ebp # pml2base (8 push, 1 ret, arg5) + movl 0x24(%esp), %edi # total count subl %ebx, %edi shll $13, %edi addl %edi, %ebp - movl %ebp, %edi # arg0 for the func call + movl %ebp, %edi # arg0 for the func call call fill_jpml2 - add $0x4, %esp - pop %eax - pop %ecx - pop %edx - pop %esi - pop %edi + add $0x4, %esp + pop %eax + pop %ecx + pop %edx + pop %esi + pop %edi # re-save our register frame push %edi push %esi @@ -211,20 +212,20 @@ movl %edi, %ecx movl %ebp, %edi call insert_pml2 - pop %eax - pop %ecx - pop %edx - pop %esi - pop %edi + pop %eax + pop %ecx + pop %edx + pop %esi + pop %edi # prep for next loop. need to advance vaddr and paddr by 1GB addl $(1 << 30), %edx adcl $0, %esi addl $(1 << 30), %eax adcl $0, %ecx decl %ebx - jnz 1b - pop %ebp - pop %ebx + jnz 1b + pop %ebp + pop %ebx ret # Fills pml2 with "count" jumbo entries, mapping from vaddr -> paddr @@ -241,21 +242,21 @@ # want (paddr >> 21) into ecx. shll $11, %ecx shrl $21, %eax - orl %eax, %ecx + orl %eax, %ecx 1: movl %ecx, %eax - shll $21, %eax # lower part of PTE ADDR - orl $(PTE_P | PTE_W | PTE_PS | PTE_G), %eax + shll $21, %eax # lower part of PTE ADDR + orl $(PTE_P | PTE_W | PTE_PS | PTE_G), %eax movl %eax, (%edi, %esi, 8) movl %ecx, %eax - shrl $11, %eax # upper part of PTE ADDR + shrl $11, %eax # upper part of PTE ADDR movl %eax, 4(%edi, %esi, 8) # prep for next loop incl %esi incl %ecx decl %ebx - jnz 1b - pop %ebx + jnz 1b + pop %ebx ret # Inserts a pml3 into pml4, so that it handles mapping for vaddr @@ -264,7 +265,7 @@ insert_pml3: shrl $7, %esi # want to shift vaddr >> 39 andl $0x1ff, %esi - orl $(PTE_P | PTE_W | PTE_G), %edi + orl $(PTE_P | PTE_W | PTE_G), %edi movl %edi, (%ecx, %esi, 8) movl $0x0, 4(%ecx, %esi, 8) # being clever, i know upper bits are 0 ret @@ -273,33 +274,34 @@ # # edi pml2, esi vaddr_hi, edx vaddr_lo, ecx pml3 insert_pml2: - # want (vaddr >> 30) & 0x1ff into esi. append upper 2 bits of edx to esi. + # want (vaddr >> 30) & 0x1ff into esi. append upper 2 bits of edx to + # esi. shll $2, %esi shrl $30, %edx - orl %edx, %esi + orl %edx, %esi andl $0x1ff, %esi - orl $(PTE_P | PTE_W | PTE_G), %edi + orl $(PTE_P | PTE_W | PTE_G), %edi movl %edi, (%ecx, %esi, 8) movl $0x0, 4(%ecx, %esi, 8) # being clever, i know upper bits are 0 ret -.globl _start +.globl _start _start: movl $stack32top, %esp - push %ebx # save mulitboot info + push %ebx # save mulitboot info movw $0x1234,0x472 # warm boot movl $0x80000001, %eax # some machines / VMs might not support long mode cpuid test $(1 << 29), %edx - jz err_no_long + jz err_no_long # others don't support 1GB jumbo pages, which is a shame test $(1 << 26), %edx - jz no_pml3ps + jz no_pml3ps # build page table. need mappings for - # - current code/data at 0x00100000 -> 0x00100000 - # - kernel load location: 0xffffffffc0000000 -> 0x0000000000000000 - # - kernbase: 0xffff80000000 -> 0x0000000000000000 + # - current code/data at 0x00100000 -> 0x00100000 + # - kernel load location: 0xffffffffc0000000 -> 0x0000000000000000 + # - kernbase: 0xffff80000000 -> 0x0000000000000000 # we'll need one table for the PML4, and three PML3 (PDPE)'s. 1GB will # suffice for lo and hi (til we do the VPT and LAPIC mappings). For # kernbase, we'll do all 512 PML3 entries (covers 512GB) @@ -312,74 +314,75 @@ MAP_2MB_PAGES(boot_pml3_hi, 0xffffffffc0000000, 0x0, 1, boot_pml2_hi) MAP_2MB_PAGES(boot_pml3_kb, 0xffff800000000000, 0x0, 512, boot_pml2_kb) post_mapping: - # load cr3 - note that in long mode, cr3 is 64 bits wide. our boot pml4 is - # in lower memory, so it'll be fine if the HW 0 extends. + # load cr3 - note that in long mode, cr3 is 64 bits wide. our boot + # pml4 is in lower memory, so it'll be fine if the HW 0 extends. movl $boot_pml4, %eax movl %eax, %cr3 - # turn on paging option in cr4. note we assume PSE support. if we didn't - # have it, then our jumbo page mappings are going to fail. we also want - # global pages (for performance). PAE is the basics needed for long paging + # turn on paging option in cr4. note we assume PSE support. if we + # didn't have it, then our jumbo page mappings are going to fail. we + # also want global pages (for performance). PAE is the basics needed + # for long paging movl %cr4, %eax - orl $(CR4_PSE | CR4_PGE | CR4_PAE), %eax + orl $(CR4_PSE | CR4_PGE | CR4_PAE), %eax movl %eax, %cr4 # Turn on the IA32E enabled bit. # rd/wrmsr use ecx for the addr, and eax as the in/out register. movl $IA32_EFER_MSR, %ecx rdmsr - orl $IA32_EFER_IA32E_EN, %eax + orl $IA32_EFER_IA32E_EN, %eax wrmsr # Setup cr0. PE and PG are critical for now. The others are similar to # what we want in general (-AM with 64 bit, it's useless). movl %cr0, %eax - orl $(CR0_PE | CR0_PG | CR0_WP | CR0_NE | CR0_MP), %eax + orl $(CR0_PE | CR0_PG | CR0_WP | CR0_NE | CR0_MP), %eax andl $(~(CR0_AM | CR0_TS | CR0_EM | CR0_CD | CR0_NW)), %eax movl %eax, %cr0 - pop %ebx # restore multiboot info + pop %ebx # restore multiboot info # load the 64bit GDT and jump to long mode lgdt gdt64desc ljmp $0x08, $long_mode # these are error handlers, we're jumping over these err_no_long: - mov $no_long_string, %esi - jmp printstring + mov $no_long_string, %esi + jmp printstring err_no_pml3ps: - mov $no_pml3ps_string, %esi - jmp printstring + mov $no_pml3ps_string, %esi + jmp printstring printstring: - mov $0xb8a00, %edi # assuming CGA buffer, 16 lines down - mov $0, %ecx + mov $0xb8a00, %edi # assuming CGA buffer, 16 lines down + mov $0, %ecx 1: movb (%esi, %ecx), %bl test %bl, %bl - je printdone + je printdone # print to the console (0x07 is white letters on black background) - mov $0x07, %bh - mov %bx, (%edi, %ecx, 2) + mov $0x07, %bh + mov %bx, (%edi, %ecx, 2) # print to serial - mov $(0x3f8 + 5), %edx # assuming COM1 + mov $(0x3f8 + 5), %edx # assuming COM1 2: - inb %dx, %al + inb %dx, %al test $0x20, %al # ready check - jz 2b - mov $0x3f8, %edx # assuming COM1 - mov %bl, %al + jz 2b + mov $0x3f8, %edx # assuming COM1 + mov %bl, %al outb %al, %dx # advance the loop - inc %ecx - jmp 1b + inc %ecx + jmp 1b printdone: hlt - jmp printdone + jmp printdone .code64 long_mode: # zero the data segments. Not sure if this is legit or not. - xor %rax, %rax - mov %ax, %ds - mov %ax, %es - mov %ax, %ss - mov %ax, %fs - mov %ax, %gs + xor %rax, %rax + mov %ax, %ds + mov %ax, %es + mov %ax, %ss + mov %ax, %fs + mov %ax, %gs lldt %ax # paging is on, and our code is still running at 0x00100000. # do some miscellaneous OS setup. @@ -413,12 +416,12 @@ SEG_DATA_64(0) # kernel data segment SEG_DATA_64(3) # user data segment SEG_CODE_64(3) # user code segment - SEG_NULL # these two nulls are a placeholder for the TSS - SEG_NULL # these two nulls are a placeholder for the TSS + SEG_NULL # these two nulls are a placeholder for the TSS + SEG_NULL # these two nulls are a placeholder for the TSS .globl gdt64desc gdt64desc: .word (gdt64desc - gdt64 - 1) # sizeof(gdt64) - 1 - .long gdt64 # HW 0-extends this to 64 bit when loading (i think) + .long gdt64 # HW 0-extends this to 64 bit when loading (i think) no_long_string: .string "Unable to boot: long mode not supported" no_pml3ps_string:
diff --git a/kern/arch/x86/kernel64.ld b/kern/arch/x86/kernel64.ld index c9224cc..949b0d0 100644 --- a/kern/arch/x86/kernel64.ld +++ b/kern/arch/x86/kernel64.ld
@@ -18,17 +18,19 @@ *(.boottext .bootdata .bootbss) } - /* Needed this for syslinux, which was sitting around 16MB phys. This just - * jumps us forward to the 32MB mark, both physically and virtually. */ + /* Needed this for syslinux, which was sitting around 16MB phys. This + * just jumps us forward to the 32MB mark, both physically and + * virtually. */ . = 0x02000000; - /* Link the main kernel for the space after entry + KERN_LOAD_ADDR. We'll - * still load it adjacent in physical memory */ + /* Link the main kernel for the space after entry + KERN_LOAD_ADDR. + * We'll still load it adjacent in physical memory */ . += KERN_LOAD_ADDR; .text : AT(ADDR(.text) - KERN_LOAD_ADDR) { *(.text .stub .text.* .gnu.linkonce.t.*) - PROVIDE(etext = .); /* Define the 'etext' symbol to this value */ + /* Define the 'etext' symbol to this value */ + PROVIDE(etext = .); } INCLUDE kern/linker_tables.ld @@ -53,8 +55,8 @@ PROVIDE(__stop_bss = .); } - /* 'end' isn't a real section, but everything needs a name. It'll show up - * as 'N' (debug) in the nm / ksyms.map output. */ + /* 'end' isn't a real section, but everything needs a name. It'll show + * up as 'N' (debug) in the nm / ksyms.map output. */ .end : { PROVIDE(end = .); }
diff --git a/kern/arch/x86/setjmp64.S b/kern/arch/x86/setjmp64.S index 37d67f1..eb0628b 100644 --- a/kern/arch/x86/setjmp64.S +++ b/kern/arch/x86/setjmp64.S
@@ -21,7 +21,8 @@ xorl %eax,%eax # Zero out the return value for our first return pop %rsi # Temporarily grab the return address and adjust %rsp movq %rsi,(%rdi) # Save the return address - movq %rsp,8(%rdi) # The adjusted %rsp is the post-return %rsp (see longjmp) + movq %rsp,8(%rdi) # The adjusted %rsp is the post-return %rsp + # (see longjmp) movq %rbp,16(%rdi) push %rsi # Restore stuff to make the call/return stack happy ret
diff --git a/kern/arch/x86/smp_entry64.S b/kern/arch/x86/smp_entry64.S index 6c9e350..1040f63 100644 --- a/kern/arch/x86/smp_entry64.S +++ b/kern/arch/x86/smp_entry64.S
@@ -6,28 +6,29 @@ #define RELOC(x) ((x) - KERNBASE) #define CPUID_PSE_SUPPORT 0x00000008 -.globl smp_entry -smp_entry: .code16 +.globl smp_entry +smp_entry: .code16 cli cld - lock incw smp_semaphore - smp_entry + 0x1000 # announce our presence -spin_start: # grab lock in real mode + # announce our presence + lock incw smp_semaphore - smp_entry + 0x1000 +spin_start: # grab lock in real mode movw $1, %ax xchgw %ax, smp_boot_lock - smp_entry + 0x1000 test %ax, %ax - jne spin_start + jne spin_start # Set up rudimentary segmentation xorw %ax, %ax # Segment number zero movw %ax, %ds # -> Data Segment movw %ax, %es # -> Extra Segment movw %ax, %ss # -> Stack Segment - # Would like to patch all of these 0x1000's at trampoline relocation time - # There's three of them, so we could patch the trampoline code when we load, - # once we're sure the entry code will not change anymore + # Would like to patch all of these 0x1000's at trampoline relocation + # time There's three of them, so we could patch the trampoline code + # when we load, once we're sure the entry code will not change anymore lgdt gdtdesc - smp_entry + 0x1000 # Turn on protected mode movl %cr0, %eax - orl $CR0_PE, %eax + orl $CR0_PE, %eax movl %eax, %cr0 ljmp $GD_KT, $(protcseg - smp_entry + 0x1000) .code32 @@ -39,27 +40,28 @@ movw %ax, %ss # -> SS: Stack Segment movw %ax, %fs # -> FS movw %ax, %gs # -> GS - # Turn on Paging. We're using the symbol from entry64, which we'll have no - # problem linking against (compared to boot_cr3). this assumes we use the - # boot stuff at least through smp_boot. + # Turn on Paging. We're using the symbol from entry64, which we'll + # have no problem linking against (compared to boot_cr3). this assumes + # we use the boot stuff at least through smp_boot. movl $boot_pml4, %eax movl %eax, %cr3 - # turn on paging option in cr4. note we assume PSE support. if we didn't - # have it, then our jumbo page mappings are going to fail. we also want - # global pages (for performance). PAE is the basics needed for long paging + # turn on paging option in cr4. note we assume PSE support. if we + # didn't have it, then our jumbo page mappings are going to fail. we + # also want global pages (for performance). PAE is the basics needed + # for long paging movl %cr4, %eax - orl $(CR4_PSE | CR4_PGE | CR4_PAE), %eax + orl $(CR4_PSE | CR4_PGE | CR4_PAE), %eax movl %eax, %cr4 # Turn on the IA32E enabled bit. # rd/wrmsr use ecx for the addr, and eax as the in/out register. movl $IA32_EFER_MSR, %ecx rdmsr - orl $IA32_EFER_IA32E_EN, %eax + orl $IA32_EFER_IA32E_EN, %eax wrmsr - # Setup cr0. PE and PG are critical for now. The others are similar to - # what we want in general (-AM with 64 bit, it's useless). + # Setup cr0. PE and PG are critical for now. The others are similar + # to what we want in general (-AM with 64 bit, it's useless). movl %cr0, %eax - orl $(CR0_PE | CR0_PG | CR0_WP | CR0_NE | CR0_MP), %eax + orl $(CR0_PE | CR0_PG | CR0_WP | CR0_NE | CR0_MP), %eax andl $(~(CR0_AM | CR0_TS | CR0_EM | CR0_CD | CR0_NW)), %eax movl %eax, %cr0 # load the 64bit GDT and jump to long mode (symbol from entry64) @@ -71,52 +73,53 @@ long_mode: # Note: we are still running code on the trampoline # zero the data segments. Not sure if this is legit or not. - xor %rax, %rax - mov %ax, %ds - mov %ax, %es - mov %ax, %ss - mov %ax, %fs - mov %ax, %gs + xor %rax, %rax + mov %ax, %ds + mov %ax, %es + mov %ax, %ss + mov %ax, %fs + mov %ax, %gs lldt %ax incl x86_num_cores_booted # an int movq (smp_stack_top), %rsp movq $0, %rbp # so backtrace works - # We're on the trampoline, but want to be in the real location of the smp - # code (somewhere above KERN_LOAD_ADDR). This allows us to easily unmap - # the boot up memory, which the trampoline is part of. + # We're on the trampoline, but want to be in the real location of the + # smp code (somewhere above KERN_LOAD_ADDR). This allows us to easily + # unmap the boot up memory, which the trampoline is part of. movabs $(non_trampoline), %rax call *%rax non_trampoline: call smp_main - movq %rax, %rsp # use our new stack, value returned from smp_main + # use our new stack, value returned from smp_main + movq %rax, %rsp # note the next two lines are using the direct mapping from smp_boot(). # Remember, the stuff at 0x1000 is a *copy* of the code and data at # KERN_LOAD_ADDR. movw $0, smp_boot_lock - smp_entry + 0x1000 # release lock lock decw smp_semaphore - smp_entry + 0x1000 # show we are done - sti # so we can get the IPI - hlt # wait for the IPI to run smp_pcu_init() - call smp_final_core_init - call smp_idle # idle loop, will have interrupts turned on + sti # so we can get the IPI + hlt # wait for the IPI to run smp_pcu_init() + call smp_final_core_init + call smp_idle # idle loop, will have interrupts turned on # smp_idle should never return spin: - jmp spin + jmp spin # Below here is just data, stored with the code text - .p2align 2 # force 4 byte alignment + .p2align 2 # force 4 byte alignment gdt: - SEG_NULL # null seg + SEG_NULL # null seg SEG(STA_X|STA_R, 0, 0xffffffff) # code seg - SEG(STA_W, 0, 0xffffffff) # data seg + SEG(STA_W, 0, 0xffffffff) # data seg gdtdesc: - .word gdtdesc - gdt - 1 # sizeof(gdt) - 1 + .word gdtdesc - gdt - 1 # sizeof(gdt) - 1 .long gdt - smp_entry + 0x1000 # address gdt - .p2align 2 # force 4 byte alignment -.globl smp_boot_lock -smp_boot_lock: # this lock word will be only used from - .word 0 # its spot in the trampoline (0x1000) -.globl smp_semaphore -smp_semaphore: # poor man's polling semaphore + .p2align 2 # force 4 byte alignment +.globl smp_boot_lock +smp_boot_lock: # this lock word will be only used from + .word 0 # its spot in the trampoline (0x1000) +.globl smp_semaphore +smp_semaphore: # poor man's polling semaphore .word 0 -.globl smp_entry_end +.globl smp_entry_end smp_entry_end:
diff --git a/kern/arch/x86/trapentry64.S b/kern/arch/x86/trapentry64.S index c9a6d5b..8fec20d 100644 --- a/kern/arch/x86/trapentry64.S +++ b/kern/arch/x86/trapentry64.S
@@ -19,90 +19,90 @@ * It also builds this traps portion of the trap_tbl. * Use TRAPHANDLER for traps where the CPU automatically pushes an error code. */ -#define TRAPHANDLER(name, num) \ - .text; \ +#define TRAPHANDLER(name, num) \ + .text; \ .globl name; /* define global symbol for 'name' */ \ .type name, @function; /* symbol type is function */ \ - .align 2; /* align function definition */ \ - name: /* function starts here */ \ - pushq $(num); \ - jmp _alltraps; \ - .data; \ - .quad name; \ + .align 2; /* align function definition */ \ + name: /* function starts here */ \ + pushq $(num); \ + jmp _alltraps; \ + .data; \ + .quad name; \ .long num /* Use TRAPHANDLER_NOEC for traps where the CPU doesn't push an error code. * It pushes a 0 in place of the error code, so the trap frame has the same * format in either case. */ -#define TRAPHANDLER_NOEC(name, num) \ +#define TRAPHANDLER_NOEC(name, num) \ .text; \ - .globl name; \ - .type name, @function; \ + .globl name; \ + .type name, @function; \ .align 2; \ name: \ pushq $0; \ - pushq $(num); \ - jmp _alltraps; \ + pushq $(num); \ + jmp _alltraps; \ .data; \ .quad name; \ .long num /* Same as NOEC, but for IRQs instead. num is the ISR number it is mapped to */ -#define IRQ_HANDLER(name, num) \ +#define IRQ_HANDLER(name, num) \ .text; \ - .globl name; \ - .type name, @function; \ + .globl name; \ + .type name, @function; \ .align 2; \ name: \ pushq $0; \ - pushq $(num); \ - jmp _allirqs; \ + pushq $(num); \ + jmp _allirqs; \ .data; \ .quad name; \ .long num -#define NMI_HANDLER(name, num) \ +#define NMI_HANDLER(name, num) \ .text; \ - .globl name; \ - .type name, @function; \ + .globl name; \ + .type name, @function; \ .align 2; \ name: \ pushq $0; \ - pushq $(num); \ - jmp _nmi_entry; \ + pushq $(num); \ + jmp _nmi_entry; \ .data; \ .quad name; \ .long num #define DOUBLEFAULT_HANDLER(name, num) \ .text; \ - .globl name; \ - .type name, @function; \ + .globl name; \ + .type name, @function; \ .align 2; \ name: \ - pushq $(num); \ - jmp _dblf_entry; \ + pushq $(num); \ + jmp _dblf_entry; \ .data; \ .quad name; \ .long num /* Bare minimum IRQ handler: send a LAPIC_EOI and immediately iret. */ -#define POKE_HANDLER(name, num) \ +#define POKE_HANDLER(name, num) \ .text; \ - .globl name; \ - .type name, @function; \ + .globl name; \ + .type name, @function; \ .align 2; \ name:; \ - pushq %rax; \ - pushq %rcx; \ - pushq %rdx; \ - movq $0, %rax; \ - movq $0, %rdx; \ - movq $(MSR_LAPIC_EOI), %rcx; \ - wrmsr; \ - popq %rdx; \ - popq %rcx; \ - popq %rax; \ + pushq %rax; \ + pushq %rcx; \ + pushq %rdx; \ + movq $0, %rax; \ + movq $0, %rdx; \ + movq $(MSR_LAPIC_EOI), %rcx; \ + wrmsr; \ + popq %rdx; \ + popq %rcx; \ + popq %rax; \ iretq; \ .data; \ .quad name; \ @@ -402,18 +402,18 @@ pushq %rax cmpw $GD_KT, 0x90(%rsp) # 0x90 - diff btw tf_cs and tf_rax je trap_all_tf - # this is a user TF. we need to swapgs to get the kernel's gs and mark the - # context as partial - swapgs # user's GS is now in MSR_KERNEL_GS_BASE + # this is a user TF. we need to swapgs to get the kernel's gs and mark + # the context as partial + swapgs # user's GS is now in MSR_KERNEL_GS_BASE movl $0x1, 0xac(%rsp) # 0xac - diff btw tf_padding0 and tf_rax trap_all_tf: - pushq $0 # fsbase space - pushq $0 # gsbase space - movq $0, %rbp # so we can backtrace to this point + pushq $0 # fsbase space + pushq $0 # gsbase space + movq $0, %rbp # so we can backtrace to this point movq %rsp, %rdi call trap # the return paths are only used by the kernel - addq $0x10, %rsp # skip fs/gs base + addq $0x10, %rsp # skip fs/gs base popq %rax popq %rbx popq %rcx @@ -429,7 +429,7 @@ popq %r13 popq %r14 popq %r15 - addq $0x10, %rsp # skip trapno and err + addq $0x10, %rsp # skip trapno and err iretq # might merge this with _alltraps @@ -452,18 +452,18 @@ pushq %rax cmpw $GD_KT, 0x90(%rsp) # 0x90 - diff btw tf_cs and tf_rax je irq_all_tf - # this is a user TF. we need to swapgs to get the kernel's gs and mark the - # context as partial - swapgs # user's GS is now in MSR_KERNEL_GS_BASE + # this is a user TF. we need to swapgs to get the kernel's gs and mark + # the context as partial + swapgs # user's GS is now in MSR_KERNEL_GS_BASE movl $0x1, 0xac(%rsp) # 0xac - diff btw tf_padding0 and tf_rax irq_all_tf: - pushq $0 # fsbase space - pushq $0 # gsbase space - movq $0, %rbp # so we can backtrace to this point + pushq $0 # fsbase space + pushq $0 # gsbase space + movq $0, %rbp # so we can backtrace to this point movq %rsp, %rdi call handle_irq # the return paths are only used by the kernel - addq $0x10, %rsp # skip fs/gs base + addq $0x10, %rsp # skip fs/gs base popq %rax popq %rbx popq %rcx @@ -479,7 +479,7 @@ popq %r13 popq %r14 popq %r15 - addq $0x10, %rsp # skip trapno and err + addq $0x10, %rsp # skip trapno and err iretq # Similar to the NMI handler, we come in on a special stack, but we can trust @@ -510,14 +510,14 @@ pushq %rax cmpw $GD_KT, 0x90(%rsp) # 0x90 - diff btw tf_cs and tf_rax je dblf_all_tf - # this is a user TF. we need to swapgs to get the kernel's gs and mark the - # context as partial - swapgs # user's GS is now in MSR_KERNEL_GS_BASE + # this is a user TF. we need to swapgs to get the kernel's gs and mark + # the context as partial + swapgs # user's GS is now in MSR_KERNEL_GS_BASE movl $0x1, 0xac(%rsp) # 0xac - diff btw tf_padding0 and tf_rax dblf_all_tf: - pushq $0 # fsbase space - pushq $0 # gsbase space - movq $0, %rbp # so we can backtrace to this point + pushq $0 # fsbase space + pushq $0 # gsbase space + movq $0, %rbp # so we can backtrace to this point movq %rsp, %rdi call handle_double_fault dblf_spin: @@ -566,56 +566,57 @@ pushq %rax cmpw $GD_KT, 0x90(%rsp) # 0x90 - diff btw tf_cs and tf_rax je nmi_kern_tf - # this is a user TF. we need to swapgs to get the kernel's gs and mark the - # context as partial - swapgs # user's GS is now in MSR_KERNEL_GS_BASE + # this is a user TF. we need to swapgs to get the kernel's gs and mark + # the context as partial + swapgs # user's GS is now in MSR_KERNEL_GS_BASE movl $0x1, 0xac(%rsp) # 0xac - diff btw tf_padding0 and tf_rax - pushq $0 # fsbase space - pushq $0 # gsbase space + pushq $0 # fsbase space + pushq $0 # gsbase space jmp nmi_all_tf nmi_kern_tf: - # this is a kernel TF. but we don't know if they set up gs yet, so we'll - # save and restore whatever they had loaded and use our own - pushq $0 # fsbase space + # this is a kernel TF. but we don't know if they set up gs yet, so + # we'll save and restore whatever they had loaded and use our own + pushq $0 # fsbase space # Get the current GS base into rax movl $MSR_GS_BASE, %ecx rdmsr shlq $32, %rdx orq %rdx, %rax - # Get the real GS base from the top of the stack. This was set in smp_boot, - # and our rsp pointed to it when we entered the kernel. + # Get the real GS base from the top of the stack. This was set in + # smp_boot, and our rsp pointed to it when we entered the kernel. movq 0xb8(%rsp), %rdx # 0xb8 from fs_base to the top - # Compare them. If they are the same, we can just push 0 for gsbase (which - # later will mean "no need to restore GS". + # Compare them. If they are the same, we can just push 0 for gsbase + # (which later will mean "no need to restore GS". cmpq %rdx, %rax je nmi_gs_ok # They weren't the same. Save the old one and set the new one. - pushq %rax # gsbase space + pushq %rax # gsbase space movq %rdx, %rax shrq $32, %rdx andl $0xffffffff, %eax wrmsr jmp nmi_all_tf nmi_gs_ok: - pushq $0 # gsbase space + pushq $0 # gsbase space nmi_all_tf: - # At this point, GS is set correctly, either due to swapgs (user TF), wrmsr - # (kern TF with bad GS), or it was already fine (and gsbase in the TF = 0). - movq $0, %rbp # so we can backtrace to this point + # At this point, GS is set correctly, either due to swapgs (user TF), + # wrmsr (kern TF with bad GS), or it was already fine (and gsbase in the + # TF = 0). + movq $0, %rbp # so we can backtrace to this point movq %rsp, %rdi call handle_nmi - # Unlike in normal IRQs/Traps, both user and kernel contexts return via this - # path. + # Unlike in normal IRQs/Traps, both user and kernel contexts return via + # this path. cmpw $GD_KT, 0xa0(%rsp) # 0xa0 - diff btw tf_cs and tf_gsbase je nmi_kern_restore_gs - # User TF. Restore whatever was there with swapgs. We don't care what it - # was, nor do we care what was in the TF. - swapgs # user's GS is now in MSR_GS_BASE - addq $0x10, %rsp # skip gs/fs base + # User TF. Restore whatever was there with swapgs. We don't care what + # it was, nor do we care what was in the TF. + swapgs # user's GS is now in MSR_GS_BASE + addq $0x10, %rsp # skip gs/fs base jmp nmi_popal nmi_kern_restore_gs: - popq %rax # fetch saved gsbase - addq $0x08, %rsp # skip fs base + popq %rax # fetch saved gsbase + addq $0x08, %rsp # skip fs base cmpq $0, %rax je nmi_popal # gsbase in the TF != 0, which means we need to restore that gsbase @@ -640,7 +641,7 @@ popq %r13 popq %r14 popq %r15 - addq $0x10, %rsp # skip trapno and err + addq $0x10, %rsp # skip trapno and err iretq .globl __nmi_pop_ok_start; @@ -673,40 +674,42 @@ jz nmi_ok_cas_worked # ZF = 1 on successful CAS ret nmi_ok_cas_worked: - # save callee-saved regs (the pops below clobber them, and we might return) + # save callee-saved regs (the pops below clobber them, and we might + # return) pushq %rbp pushq %rbx pushq %r12 pushq %r13 pushq %r14 pushq %r15 - # We need to save the current rsp into the scratch space at the top of the - # stack. This assumes we're within the top page of our stack, which should - # always be true. Careful not to use rdi, which still has an argument. + # We need to save the current rsp into the scratch space at the top of + # the stack. This assumes we're within the top page of our stack, which + # should always be true. Careful not to use rdi, which still has an + # argument. movq %rsp, %rbx # Want to round rbx up to PGSIZE, then subtract 8, to get our slot. movq $0xfff, %rax - notq %rax # rax = 0xfffffffffffff000 - andq %rax, %rbx # round down rbx - addq $0x1000, %rbx # add PGSIZE, assuming rsp was not page aligned - subq $0x8, %rbx # point to the scratch space - movq %rsp, (%rbx) # save rsp in the scratch space + notq %rax # rax = 0xfffffffffffff000 + andq %rax, %rbx # round down rbx + addq $0x1000, %rbx # add PGSIZE, assuming rsp was not page aligned + subq $0x8, %rbx # point to the scratch space + movq %rsp, (%rbx) # save rsp in the scratch space # We jump our rsp to the base of the HW_TF. This is still on the same - # stack, just farther back than where our caller is. We need to be careful - # to not clobber the stack. Otherwise we'll have chaos. + # stack, just farther back than where our caller is. We need to be + # careful to not clobber the stack. Otherwise we'll have chaos. movq %rdi, %rsp - # From here down is the same as the normal NMI exit path, but with 'ok' in - # the symbol names. + # From here down is the same as the normal NMI exit path, but with 'ok' + # in the symbol names. cmpw $GD_KT, 0xa0(%rsp) # 0xa0 - diff btw tf_cs and tf_gsbase je nmi_ok_kern_restore_gs - # User TF. Restore whatever was there with swapgs. We don't care what it - # was, nor do we care what was in the TF. - swapgs # user's GS is now in MSR_GS_BASE - addq $0x10, %rsp # skip gs/fs base + # User TF. Restore whatever was there with swapgs. We don't care what + # it was, nor do we care what was in the TF. + swapgs # user's GS is now in MSR_GS_BASE + addq $0x10, %rsp # skip gs/fs base jmp nmi_ok_popal nmi_ok_kern_restore_gs: - popq %rax # fetch saved gsbase - addq $0x08, %rsp # skip fs base + popq %rax # fetch saved gsbase + addq $0x08, %rsp # skip fs base cmpq $0, %rax je nmi_ok_popal # gsbase in the TF != 0, which means we need to restore that gsbase @@ -731,7 +734,7 @@ popq %r13 popq %r14 popq %r15 - addq $0x10, %rsp # skip trapno and err + addq $0x10, %rsp # skip trapno and err iretq __nmi_pop_ok_end: @@ -740,45 +743,47 @@ # entire operation. __nmi_pop_fail_start: # careful only to use caller-saved or argument registers before saving - movl %edx, %eax # load old_val into eax for the CAS + movl %edx, %eax # load old_val into eax for the CAS cmpxchgl %ecx, (%rsi) # no need for LOCK, since an NMI would serialize jz nmi_fail_cas_worked # ZF = 1 on successful CAS ret nmi_fail_cas_worked: - # save callee-saved regs (the pops below clobber them, and we might return) + # save callee-saved regs (the pops below clobber them, and we might + # return) pushq %rbp pushq %rbx pushq %r12 pushq %r13 pushq %r14 pushq %r15 - # We need to save the current rsp into the scratch space at the top of the - # stack. This assumes we're within the top page of our stack, which should - # always be true. Careful not to use rdi, which still has an argument. + # We need to save the current rsp into the scratch space at the top of + # the stack. This assumes we're within the top page of our stack, which + # should always be true. Careful not to use rdi, which still has an + # argument. movq %rsp, %rbx # Want to round rbx up to PGSIZE, then subtract 8, to get our slot. movq $0xfff, %rax - notq %rax # rax = 0xfffffffffffff000 - andq %rax, %rbx # round down rbx - addq $0x1000, %rbx # add PGSIZE, assuming rsp was not page aligned - subq $0x8, %rbx # point to the scratch space - movq %rsp, (%rbx) # save rsp in the scratch space + notq %rax # rax = 0xfffffffffffff000 + andq %rax, %rbx # round down rbx + addq $0x1000, %rbx # add PGSIZE, assuming rsp was not page aligned + subq $0x8, %rbx # point to the scratch space + movq %rsp, (%rbx) # save rsp in the scratch space # We jump our rsp to the base of the HW_TF. This is still on the same - # stack, just farther back than where our caller is. We need to be careful - # to not clobber the stack. Otherwise we'll have chaos. + # stack, just farther back than where our caller is. We need to be + # careful to not clobber the stack. Otherwise we'll have chaos. movq %rdi, %rsp - # From here down is the same as the normal NMI exit path and the ok path, - # but with 'fail' in the symbol names. + # From here down is the same as the normal NMI exit path and the ok + # path, but with 'fail' in the symbol names. cmpw $GD_KT, 0xa0(%rsp) # 0xa0 - diff btw tf_cs and tf_gsbase je nmi_fail_kern_restore_gs - # User TF. Restore whatever was there with swapgs. We don't care what it - # was, nor do we care what was in the TF. - swapgs # user's GS is now in MSR_GS_BASE - addq $0x10, %rsp # skip gs/fs base + # User TF. Restore whatever was there with swapgs. We don't care what + # it was, nor do we care what was in the TF. + swapgs # user's GS is now in MSR_GS_BASE + addq $0x10, %rsp # skip gs/fs base jmp nmi_fail_popal nmi_fail_kern_restore_gs: - popq %rax # fetch saved gsbase - addq $0x08, %rsp # skip fs base + popq %rax # fetch saved gsbase + addq $0x08, %rsp # skip fs base cmpq $0, %rax je nmi_fail_popal # gsbase in the TF != 0, which means we need to restore that gsbase @@ -803,33 +808,34 @@ popq %r13 popq %r14 popq %r15 - addq $0x10, %rsp # skip trapno and err + addq $0x10, %rsp # skip trapno and err # Here's is where we differ from OK. Time to undo everything and return - # rsp currently is pointing at tf->tf_rip. Remember that we don't want to - # write anything to the stack - everything in the TF is still the way it was - # when we started to pop. + # rsp currently is pointing at tf->tf_rip. Remember that we don't want + # to write anything to the stack - everything in the TF is still the way + # it was when we started to pop. # # First off, let's get the stack addr of the pcpui pointer loaded movq %rsp, %rbx movq $0xfff, %rax - notq %rax # rax = 0xfffffffffffff000 - andq %rax, %rbx # round down rbx - addq $0x1000, %rbx # add PGSIZE, assuming rsp was not page aligned - subq $0x10, %rbx # point to the pcpui pointer + notq %rax # rax = 0xfffffffffffff000 + andq %rax, %rbx # round down rbx + addq $0x1000, %rbx # add PGSIZE, assuming rsp was not page aligned + subq $0x10, %rbx # point to the pcpui pointer # Now let's start to unwind - subq $0x98, %rsp # jump from rip to tf_gsbase (top of hw_tf) + subq $0x98, %rsp # jump from rip to tf_gsbase (top of hw_tf) # Need to restore gs, just like on an NMI entry cmpw $GD_KT, 0xa0(%rsp) # 0xa0 - diff btw tf_cs and tf_gsbase je nmi_pop_fail_kern_tf # This is a user TF. We need to swapgs to get the kernel's gs # We don't need to mark the context as partial (we never do for NMIs, - # actually), and in general, we don't want to write anything on the stack. - swapgs # user's GS is now in MSR_KERNEL_GS_BASE + # actually), and in general, we don't want to write anything on the + # stack. + swapgs # user's GS is now in MSR_KERNEL_GS_BASE jmp nmi_pop_fail_all_tf nmi_pop_fail_kern_tf: # Kernel TF. We basically need to do the same thing on entry, since we - # might have restored some weird GS base. We can tell based on tf_gsbase - # 0 for gsbase means we didn't need to change GS + # might have restored some weird GS base. We can tell based on + # tf_gsbase 0 for gsbase means we didn't need to change GS cmpq $0, (%rsp) je nmi_pop_fail_gs_fine # rbx points to where pcpui* is stored @@ -841,7 +847,7 @@ wrmsr nmi_pop_fail_gs_fine: nmi_pop_fail_all_tf: - addq $0x8, %rbx # move to the scratch slot, holding rsp + addq $0x8, %rbx # move to the scratch slot, holding rsp mov (%rbx), %rsp # restore callee-saved regs popq %r15 @@ -864,7 +870,7 @@ # When rdi has the magic number, rsi has the new base movabs $FASTCALL_SETFSBASE, %rax cmp %rax, %rdi - jne normal_syscall # could profile this and handle the jump differently + jne normal_syscall # could profile this and jump differently # need to check rsi, make sure it is canonical (will enfore below ULIM). # need to either do this check, or handle the kernel GP fault on wrmsr. movq %rsi, %rdi @@ -885,25 +891,25 @@ normal_syscall: #endif # cld is handled by the SFMASK - swapgs # user's GS is now in MSR_KERNEL_GS_BASE + swapgs # user's GS is now in MSR_KERNEL_GS_BASE movq %gs:0, %rsp # Saving the FPU callee-saved state for now. Might be able to have the # preempt handler deal with it. - pushq $0 # space for mxcsr, fpucw, and padding0 + pushq $0 # space for mxcsr, fpucw, and padding0 movw $0x1, 0x6(%rsp) # tf_padding0 = 1, partial context fnstcw 0x4(%rsp) stmxcsr (%rsp) - pushq %rdx # rsp, saved by userspace - pushq %rcx # rip, saved by hardware + pushq %rdx # rsp, saved by userspace + pushq %rcx # rip, saved by hardware pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbp pushq %rbx - pushq $0 # fsbase space - pushq $0 # gsbase space - movq $0, %rbp # so we can backtrace to this point + pushq $0 # fsbase space + pushq $0 # gsbase space + movq $0, %rbp # so we can backtrace to this point movq %rsp, %rdx # arg0, rdi: struct sysc*. arg1, rsi: count. arg2, rdx: sw_tf call sysenter_callwrapper @@ -917,17 +923,17 @@ # rflags has all flags = 0, so cli and cld already. # HOST_GS_BASE and RSP is set by the hardware # Set default values. Most of these will be set in C later. - pushq $0 # guest_pa - pushq $0 # guest_va - pushq $0 # intrinfo2 and 1 - pushq $0 # exit_qual + exit_reason - pushq $0 # pad + trap_inject - pushq $0 # flags + guest_pcorid - pushq $0 # cr3 - pushq $0 # cr2 - pushq $0 # rsp - pushq $0 # rflags - pushq $0 # rip + pushq $0 # guest_pa + pushq $0 # guest_va + pushq $0 # intrinfo2 and 1 + pushq $0 # exit_qual + exit_reason + pushq $0 # pad + trap_inject + pushq $0 # flags + guest_pcorid + pushq $0 # cr3 + pushq $0 # cr2 + pushq $0 # rsp + pushq $0 # rflags + pushq $0 # rip # Save register state pushq %r15 pushq %r14 @@ -944,7 +950,7 @@ pushq %rcx pushq %rbx pushq %rax - movq $0, %rbp # so we can backtrace to this point + movq $0, %rbp # so we can backtrace to this point movq %rsp, %rdi call handle_vmexit vmexit_spin:
diff --git a/kern/drivers/dev/Kbuild b/kern/drivers/dev/Kbuild index 60d6661..b936073 100644 --- a/kern/drivers/dev/Kbuild +++ b/kern/drivers/dev/Kbuild
@@ -14,11 +14,11 @@ obj-y += pipe.o obj-y += proc.o obj-y += random.o -obj-$(CONFIG_REGRESS) += regress.o +obj-$(CONFIG_REGRESS) += regress.o obj-y += sd.o obj-y += sdscsi.o obj-y += sdiahci.o obj-y += srv.o obj-y += tmpfs.o obj-y += version.o -obj-$(CONFIG_DEVVARS) += vars.o +obj-$(CONFIG_DEVVARS) += vars.o
diff --git a/kern/drivers/dev/Kconfig b/kern/drivers/dev/Kconfig index 6a1ee1f..634efb3 100644 --- a/kern/drivers/dev/Kconfig +++ b/kern/drivers/dev/Kconfig
@@ -2,20 +2,20 @@ bool "Include the regression test device" default y help - The regression test device allows you to push commands to monitor() - for testing. Defaults to 'y' for now. + The regression test device allows you to push commands to monitor() + for testing. Defaults to 'y' for now. config DEVVARS bool "#vars kernel variable exporter" default y help - The #vars device exports read access to select kernel variables. + The #vars device exports read access to select kernel variables. config DEVVARS_TEST bool "#vars test files" depends on DEVVARS default n help - Have #vars include a collection of test files that devvars utest uses. - Say 'y' if you plan to use the utest, at the expense of having a - cluttered #vars. + Have #vars include a collection of test files that devvars utest + uses. Say 'y' if you plan to use the utest, at the expense of having + a cluttered #vars.
diff --git a/kern/drivers/net/Kbuild b/kern/drivers/net/Kbuild index 1075fa6..0702edb 100644 --- a/kern/drivers/net/Kbuild +++ b/kern/drivers/net/Kbuild
@@ -1,6 +1,6 @@ # need at least one obj file to build for Kbuild obj-y += dummy.o -obj-$(CONFIG_BNX2X) += bnx2x/ +obj-$(CONFIG_BNX2X) += bnx2x/ obj-$(CONFIG_MLX4_CORE) += mlx4/ #obj-$(CONFIG_MLX4_INFINIBAND) += mlx4u/ #obj-$(CONFIG_MLX4_INFINIBAND) += udrvr/
diff --git a/kern/drivers/net/Kconfig b/kern/drivers/net/Kconfig index e0323de..11a8b1c 100644 --- a/kern/drivers/net/Kconfig +++ b/kern/drivers/net/Kconfig
@@ -3,22 +3,21 @@ default n select ZLIB_INFLATE help - Broadcom Everest 10 Gb network driver (NetXtremeII). + Broadcom Everest 10 Gb network driver (NetXtremeII). config BNX2X_SRIOV bool "Broadcom SR-IOV" depends on BNX2X default n help - BNX2X support for SR-IOV (I/O virtualization). + BNX2X support for SR-IOV (I/O virtualization). config MLX4_EN tristate "Mellanox Technologies 1/10/40Gbit Ethernet support" select MLX4_CORE select MLX4_INFINIBAND help - This driver supports Mellanox Technologies ConnectX Ethernet - devices. + This driver supports Mellanox Technologies ConnectX Ethernet devices. config MLX4_CORE tristate @@ -29,7 +28,7 @@ depends on MLX4_CORE default 10 help - To activate device managed flow steering when available, set to -1. + To activate device managed flow steering when available, set to -1. config MLX4_INFINIBAND tristate
diff --git a/kern/drivers/net/mlx4/Kconfig b/kern/drivers/net/mlx4/Kconfig index 1486ce9..572106a 100644 --- a/kern/drivers/net/mlx4/Kconfig +++ b/kern/drivers/net/mlx4/Kconfig
@@ -18,8 +18,8 @@ ---help--- Say Y here if you want to use Data Center Bridging (DCB) in the driver. - If set to N, will not be able to configure QoS and ratelimit attributes. - This flag is depended on the kernel's DCB support. + If set to N, will not be able to configure QoS and ratelimit + attributes. This flag is depended on the kernel's DCB support. If unsure, set to Y
diff --git a/kern/kfs/ifconfig b/kern/kfs/ifconfig index 8071da3..9c153cc 100755 --- a/kern/kfs/ifconfig +++ b/kern/kfs/ifconfig
@@ -90,8 +90,8 @@ if [ ! -n "$me" ] then # By default, configure for QEMU. - # We only use qemu's setting when we don't have ipconfig so that we can - # test ipconfig + DHCP with qemu. + # We only use qemu's setting when we don't have ipconfig so + # that we can test ipconfig + DHCP with qemu. me='10.0.2.15' mask='255.255.255.0' remote='10.0.2.0'
diff --git a/kern/kfs/lockprov.sh b/kern/kfs/lockprov.sh index cd0243c..943bf11 100644 --- a/kern/kfs/lockprov.sh +++ b/kern/kfs/lockprov.sh
@@ -68,8 +68,8 @@ # prov -tc -p$PTHPID -v1 >> tmpfile 2>&1 # prov -tc -p$PTHPID -v2 >> tmpfile 2>&1 # -# # the extra preempts here are to make us wait longer, to see gaps where we -# # "locked up" more clearly. +# # the extra preempts here are to make us wait longer, to see gaps where +# # we "locked up" more clearly. # usleep $PREEMPT_DELAY # usleep $PREEMPT_DELAY # usleep $PREEMPT_DELAY
diff --git a/kern/kfs/vnet_opts_example b/kern/kfs/vnet_opts_example index 0b565a2..e05c22b 100644 --- a/kern/kfs/vnet_opts_example +++ b/kern/kfs/vnet_opts_example
@@ -4,7 +4,7 @@ # # Options include: # -# snoop # Mirror traffic to #srv/snoop-PID +# snoop # Mirror traffic to #srv/snoop-PID # nat_timeout = 200 # Timeout NAT maps after 200 seconds # real_address # Let the guest think it has the host's IP address # map_diagnostics # Respond to 'notify 9' with a print of the NAT map
diff --git a/kern/lib/Kconfig b/kern/lib/Kconfig index 6653ea8..1913918 100644 --- a/kern/lib/Kconfig +++ b/kern/lib/Kconfig
@@ -4,12 +4,12 @@ bool "Zlib Deflation" default y help - Zlib deflation + Zlib deflation config ZLIB_INFLATE bool "Zlib Inflation" default y help - Zlib inflation + Zlib inflation endmenu
diff --git a/kern/linker_tables.ld b/kern/linker_tables.ld index f0bef9b..8f71059 100644 --- a/kern/linker_tables.ld +++ b/kern/linker_tables.ld
@@ -1,11 +1,12 @@ /* this is INCLUDEd into the arch-specific ld scripts */ /* Linker-made tables. Our tables (e.g. devtab) are 2^6 aligned, - * independently of us aligning '.'. We align '.' to get the right start, - * e.g. __devtabstart. */ + * independently of us aligning '.'. We align '.' to get the right + * start, e.g. __devtabstart. */ . = ALIGN(64); /* We shouldn't have to use PROVIDE, but if we don't, we get the wrong - * value for '.'. And items with empty tables get the KLA (basically 0) */ + * value for '.'. And items with empty tables get the KLA (basically + * 0) */ .devtab : { PROVIDE(__devtabstart = .); PROVIDE(devtab = .);
diff --git a/kern/src/Kbuild b/kern/src/Kbuild index 9e5e008..a2af5de 100644 --- a/kern/src/Kbuild +++ b/kern/src/Kbuild
@@ -1,8 +1,9 @@ $(src)/build_info.cid: @echo `git rev-parse HEAD` > $(src)/build_info.cid.tmp @if [ ! -f $(src)/build_info.cid ] || \ - [ `cmp -s $(src)/build_info.cid $(src)/build_info.cid.tmp` -ne 0 ]; then \ - cp $(src)/build_info.cid.tmp $(src)/build_info.cid; fi; + [ `cmp -s $(src)/build_info.cid $(src)/build_info.cid.tmp` -ne 0 ];\ + then \ + cp $(src)/build_info.cid.tmp $(src)/build_info.cid; fi; @rm -f $(src)/build_info.cid.tmp $(src)/build_info.c: $(src)/build_info.cid @@ -37,11 +38,11 @@ obj-y += elf.o obj-y += env.o obj-y += err.o -obj-$(CONFIG_ETH_AUDIO) += eth_audio.o +obj-$(CONFIG_ETH_AUDIO) += eth_audio.o obj-y += event.o obj-y += ex_table.o obj-y += fdtap.o -obj-$(CONFIG_COREALLOC_FCFS) += corealloc_fcfs.o +obj-$(CONFIG_COREALLOC_FCFS) += corealloc_fcfs.o obj-y += find_next_bit.o obj-y += find_last_bit.o obj-y += hashtable.o
diff --git a/kern/src/ktest/Kbuild b/kern/src/ktest/Kbuild index 88e4403..4498f30 100644 --- a/kern/src/ktest/Kbuild +++ b/kern/src/ktest/Kbuild
@@ -1,3 +1,3 @@ -obj-y += ktest.o -obj-$(CONFIG_PB_KTESTS) += pb_ktests.o -obj-$(CONFIG_NET_KTESTS) += net_ktests.o +obj-y += ktest.o +obj-$(CONFIG_PB_KTESTS) += pb_ktests.o +obj-$(CONFIG_NET_KTESTS) += net_ktests.o
diff --git a/kern/src/ktest/Kconfig.kernel b/kern/src/ktest/Kconfig.kernel index b2e333c..0aa2a21 100644 --- a/kern/src/ktest/Kconfig.kernel +++ b/kern/src/ktest/Kconfig.kernel
@@ -1,8 +1,8 @@ menuconfig KERNEL_TESTING - bool "Kernel testing" - default n - help - Run unit tests for the kernel + bool "Kernel testing" + default n + help + Run unit tests for the kernel source "kern/src/ktest/Kconfig.postboot" source "kern/src/ktest/Kconfig.net"
diff --git a/kern/src/ktest/Kconfig.net b/kern/src/ktest/Kconfig.net index 0b2f593..40d4c1b 100644 --- a/kern/src/ktest/Kconfig.net +++ b/kern/src/ktest/Kconfig.net
@@ -1,19 +1,19 @@ menuconfig NET_KTESTS - depends on KERNEL_TESTING - bool "Networking unit tests" - default y + depends on KERNEL_TESTING + bool "Networking unit tests" + default y config TEST_ptclbsum - depends on NET_KTESTS - bool "Unit tests for ptclbsum" - default y + depends on NET_KTESTS + bool "Unit tests for ptclbsum" + default y config TEST_simplesum_bench - depends on NET_KTESTS - bool "Checksum benchmark: baseline" - default y + depends on NET_KTESTS + bool "Checksum benchmark: baseline" + default y config TEST_ptclbsum_bench - depends on NET_KTESTS - bool "Checksum benchmark: ptclbsum" - default y + depends on NET_KTESTS + bool "Checksum benchmark: ptclbsum" + default y
diff --git a/kern/src/ktest/Kconfig.postboot b/kern/src/ktest/Kconfig.postboot index a7ae670..620c961 100644 --- a/kern/src/ktest/Kconfig.postboot +++ b/kern/src/ktest/Kconfig.postboot
@@ -1,272 +1,272 @@ menuconfig PB_KTESTS - depends on KERNEL_TESTING - bool "Post-boot kernel tests" - default y - help - Run unit tests after the kernel has booted. + depends on KERNEL_TESTING + bool "Post-boot kernel tests" + default y + help + Run unit tests after the kernel has booted. config TEST_ipi_sending - depends on PB_KTESTS && X86 - bool "IPI sending test" - default n - help - Run the ipi_sending test + depends on PB_KTESTS && X86 + bool "IPI sending test" + default n + help + Run the ipi_sending test config TEST_pic_reception - depends on PB_KTESTS && X86 - bool "PIC reception test" - default n - help - Run the pic_reception + depends on PB_KTESTS && X86 + bool "PIC reception test" + default n + help + Run the pic_reception config TEST_lapic_status_bit - depends on PB_KTESTS && X86 - bool "LAPIC status bit test" - default n - help - Run the lapic_status_bit + depends on PB_KTESTS && X86 + bool "LAPIC status bit test" + default n + help + Run the lapic_status_bit config TEST_pit - depends on PB_KTESTS && X86 - bool "PIT test" - default n - help - Run the pit test + depends on PB_KTESTS && X86 + bool "PIT test" + default n + help + Run the pit test config TEST_circ_buffer - depends on PB_KTESTS && X86 - bool "Circular buffer test" - default n - help - Run the circ_buffer test + depends on PB_KTESTS && X86 + bool "Circular buffer test" + default n + help + Run the circ_buffer test config TEST_kernel_messages - depends on PB_KTESTS && X86 - bool "Kernel messages test" - default n - help - Run the kernel_messages test + depends on PB_KTESTS && X86 + bool "Kernel messages test" + default n + help + Run the kernel_messages test config TEST_page_coloring - depends on PB_KTESTS && PAGE_COLORING - bool "Page coloring test" - default n - help - Run the page_coloring test + depends on PB_KTESTS && PAGE_COLORING + bool "Page coloring test" + default n + help + Run the page_coloring test config TEST_color_alloc - depends on PB_KTESTS && PAGE_COLORING - bool "Color allocation test" - default n - help - Run the color_alloc test + depends on PB_KTESTS && PAGE_COLORING + bool "Color allocation test" + default n + help + Run the color_alloc test config TEST_barrier - depends on PB_KTESTS - bool "Barrier test" - default n - help - Run the barrier test + depends on PB_KTESTS + bool "Barrier test" + default n + help + Run the barrier test config TEST_interrupts_irqsave - depends on PB_KTESTS - bool "Interrupts irqsave test" - default y - help - Run the interrupts_irqsave test + depends on PB_KTESTS + bool "Interrupts irqsave test" + default y + help + Run the interrupts_irqsave test config TEST_bitmasks - depends on PB_KTESTS - bool "Bitmasks test" - default y - help - Run the bitmasks test + depends on PB_KTESTS + bool "Bitmasks test" + default y + help + Run the bitmasks test config TEST_checklists - depends on PB_KTESTS - bool "Checklists test" - default n - help - Run the checklists test + depends on PB_KTESTS + bool "Checklists test" + default n + help + Run the checklists test config TEST_smp_call_functions - depends on PB_KTESTS - bool "SMP call functions test" - default n - help - Run the smp_call_functions test + depends on PB_KTESTS + bool "SMP call functions test" + default n + help + Run the smp_call_functions test config TEST_slab - depends on PB_KTESTS - bool "Slab test" - default n - help - Run the slab test + depends on PB_KTESTS + bool "Slab test" + default n + help + Run the slab test config TEST_kmalloc - depends on PB_KTESTS - bool "Kmalloc test" - default n - help - Run the kmalloc test + depends on PB_KTESTS + bool "Kmalloc test" + default n + help + Run the kmalloc test config TEST_hashtable - depends on PB_KTESTS - bool "Hashtable test" - default y - help - Run the hashtable test + depends on PB_KTESTS + bool "Hashtable test" + default y + help + Run the hashtable test config TEST_circular_buffer - depends on PB_KTESTS - bool "Circular buffer test" - default y - help - Run the circular buffer test + depends on PB_KTESTS + bool "Circular buffer test" + default y + help + Run the circular buffer test config TEST_bcq - depends on PB_KTESTS - bool "BCQ test" - default n - help - Run the bcq test + depends on PB_KTESTS + bool "BCQ test" + default n + help + Run the bcq test config TEST_ucq - depends on PB_KTESTS - bool "UCQ test" - default n - help - Run the ucq test + depends on PB_KTESTS + bool "UCQ test" + default n + help + Run the ucq test config TEST_vm_regions - depends on PB_KTESTS - bool "VM regions test" - default y - help - Run the vm_regions test + depends on PB_KTESTS + bool "VM regions test" + default y + help + Run the vm_regions test config TEST_radix_tree - depends on PB_KTESTS - bool "Radix Tree test" - default y - help - Run the radix_tree test + depends on PB_KTESTS + bool "Radix Tree test" + default y + help + Run the radix_tree test config TEST_random_fs - depends on PB_KTESTS - bool "Random FS test" - default n - help - Run the random_fs test + depends on PB_KTESTS + bool "Random FS test" + default n + help + Run the random_fs test config TEST_kthreads - depends on PB_KTESTS - bool "Kthreads test" - default n - help - Run the kthreads test + depends on PB_KTESTS + bool "Kthreads test" + default n + help + Run the kthreads test config TEST_kref - depends on PB_KTESTS - bool "Kref test" - default n - help - Run the kref test + depends on PB_KTESTS + bool "Kref test" + default n + help + Run the kref test config TEST_atomics - depends on PB_KTESTS - bool "Atomics test" - default y - help - Run the atomics test + depends on PB_KTESTS + bool "Atomics test" + default y + help + Run the atomics test config TEST_abort_halt - depends on PB_KTESTS - bool "Abort halt test" - default n - help - Run the abort_halt test + depends on PB_KTESTS + bool "Abort halt test" + default n + help + Run the abort_halt test config TEST_cv - depends on PB_KTESTS - bool "Condition Variable test" - default n - help - Run the cv test + depends on PB_KTESTS + bool "Condition Variable test" + default n + help + Run the cv test config TEST_memset - depends on PB_KTESTS - bool "Memset test" - default y - help - Run the memset test + depends on PB_KTESTS + bool "Memset test" + default y + help + Run the memset test config TEST_setjmp - depends on PB_KTESTS - bool "Setjmp test" - default n - help - Run the setjmp test + depends on PB_KTESTS + bool "Setjmp test" + default n + help + Run the setjmp test config TEST_apipe - depends on PB_KTESTS - bool "Apipe test" - default n - help - Run the apipe test + depends on PB_KTESTS + bool "Apipe test" + default n + help + Run the apipe test config TEST_rwlock - depends on PB_KTESTS - bool "Rwlock test" - default n - help - Run the rwlock test + depends on PB_KTESTS + bool "Rwlock test" + default n + help + Run the rwlock test config TEST_rv - depends on PB_KTESTS - bool "Rendezvous test" - default n - help - Run the rv test + depends on PB_KTESTS + bool "Rendezvous test" + default n + help + Run the rv test config TEST_alarm - depends on PB_KTESTS - bool "Alarm test" - default n - help - Run the alarm test + depends on PB_KTESTS + bool "Alarm test" + default n + help + Run the alarm test config TEST_kmalloc_incref - depends on PB_KTESTS - bool "Kmalloc incref" - default n + depends on PB_KTESTS + bool "Kmalloc incref" + default n config TEST_u16pool - depends on PB_KTESTS - bool "u16 pool" - default n + depends on PB_KTESTS + bool "u16 pool" + default n config TEST_uaccess - depends on PB_KTESTS - bool "Tests user memory access fault trapping" - default y + depends on PB_KTESTS + bool "Tests user memory access fault trapping" + default y config TEST_sort - depends on PB_KTESTS - bool "Tests sort library functions" - default y + depends on PB_KTESTS + bool "Tests sort library functions" + default y config TEST_cmdline_parse - depends on PB_KTESTS - bool "Tests command line parsing functions" - default y + depends on PB_KTESTS + bool "Tests command line parsing functions" + default y config TEST_percpu_zalloc - depends on PB_KTESTS - bool "percpu dynamic zalloc" - default y + depends on PB_KTESTS + bool "percpu dynamic zalloc" + default y config TEST_percpu_increment - depends on PB_KTESTS - bool "percpu dynamic alloc: increment" - default y + depends on PB_KTESTS + bool "percpu dynamic alloc: increment" + default y
diff --git a/kern/src/ktest/Kconfig.userspace b/kern/src/ktest/Kconfig.userspace index ce08699..76ce81a 100644 --- a/kern/src/ktest/Kconfig.userspace +++ b/kern/src/ktest/Kconfig.userspace
@@ -1,14 +1,14 @@ menuconfig USERSPACE_TESTING - bool "User-space testing" - default n - help - Run userspace unit tests after the kernel has booted. + bool "User-space testing" + default n + help + Run userspace unit tests after the kernel has booted. config USERSPACE_TESTING_SCRIPT - depends on USERSPACE_TESTING - string "Path to test launcher script." - default /bin/tests/utest/runall.sh - help - Run userspace unit tests from the specified path. + depends on USERSPACE_TESTING + string "Path to test launcher script." + default /bin/tests/utest/runall.sh + help + Run userspace unit tests from the specified path.
diff --git a/kern/src/net/Kconfig b/kern/src/net/Kconfig index 0fe649e..39df6e8 100644 --- a/kern/src/net/Kconfig +++ b/kern/src/net/Kconfig
@@ -2,8 +2,8 @@ bool "Networking Support" default y help - This is a placeholder for networking related option. Right now, - CONFIG_NETWORKING does not change the build in any way. + This is a placeholder for networking related option. Right now, + CONFIG_NETWORKING does not change the build in any way. if NETWORKING
diff --git a/scripts/ak-scripts/ak-code-review.sh b/scripts/ak-scripts/ak-code-review.sh index 4a5325b..ab3b77a 100644 --- a/scripts/ak-scripts/ak-code-review.sh +++ b/scripts/ak-scripts/ak-code-review.sh
@@ -36,7 +36,7 @@ base_sha1=${base_sha1:0:7} # Get the text from a git request-pull - request=$(git request-pull ${patch} ${base} ${remote} ${head}); + request=$(git request-pull ${patch} ${base} ${remote} ${head}); ret=${?}; if [ "${ret}" != "0" ]; then kill -s TERM $TOP_PID
diff --git a/scripts/git/bashrc-git-compl b/scripts/git/bashrc-git-compl index 9150ee1..c784895 100644 --- a/scripts/git/bashrc-git-compl +++ b/scripts/git/bashrc-git-compl
@@ -22,7 +22,8 @@ # remove the / for the ls-remote trim_remote="${remote::-1}" remote_branches="$(git ls-remote --heads $trim_remote | grep -o '[^/]*$')" - # arg3: generate completion matches, should be current string minus remote/ + # arg3: generate completion matches, should be current string minus + # remote/ __gitcomp_nl "$remote_branches" "$remote" "${cur#$remote}" }
diff --git a/scripts/git/git-track b/scripts/git/git-track index a41d566..d1aa269 100755 --- a/scripts/git/git-track +++ b/scripts/git/git-track
@@ -28,7 +28,7 @@ if [ $# -ne 2 ] then echo "Remote $REMOTE not tracked yet and no URL passed" - echo " Try again with the repo's URL or add the remote manually" + echo "Try again with the repo's URL or add the remote manually" usage fi URL=$2
diff --git a/scripts/git/mbox-to-patches.sh b/scripts/git/mbox-to-patches.sh index 305ac75..a6b7600 100755 --- a/scripts/git/mbox-to-patches.sh +++ b/scripts/git/mbox-to-patches.sh
@@ -50,7 +50,8 @@ AUTHOR=`grep "^Author:" MI_header | cut -f 2- -d' '` EMAIL=`grep "^Email:" MI_header | cut -f 2- -d' '` - # Determine the subject for naming the patch, replace spaces and weird chars + # Determine the subject for naming the patch, replace spaces and weird + # chars SUBJECT=`grep "^Subject:" MI_header | cut -f 2- -d' ' | sed 's/[^[:alnum:]]/-/g'`
diff --git a/scripts/lock_test.R b/scripts/lock_test.R index 7a4049a..ca3ec11 100644 --- a/scripts/lock_test.R +++ b/scripts/lock_test.R
@@ -95,7 +95,8 @@ # can manually move it if we don't want to waste space if (!is.null(names)) { plot(c(min_x,max_x), c(0, max_y), type="n", xaxt="n", yaxt="n") - legend_sz = legend("topright", legend=names, lty=linetype, plot=FALSE) + legend_sz = legend("topright", legend=names, lty=linetype, + plot=FALSE) max_y = 1.04 * (max_y + legend_sz$rect$h) invisible(dev.off()) } @@ -208,14 +209,15 @@ msec_times = trunc(total_acq/1e6) # if we just table directly, we'll lose the absent values (msec where no - # timestamp happened). not sure if factor is the best way, the help says - # it should be a small range. + # timestamp happened). not sure if factor is the best way, the help + # says it should be a small range. # http://stackoverflow.com/questions/1617061/including-absent-values-in-table-results-in-r msec_times = factor(msec_times, 0:max(msec_times)) # without the c(), it'll be a bunch of bars at each msec tab = c(table(msec_times)) - plot(tab, type="o", main=title, xlab="Time (msec)", ylab="Locks per msec") + plot(tab, type="o", main=title, xlab="Time (msec)", + ylab="Locks per msec") if (outfile != "") invisible(dev.off())
diff --git a/scripts/tagging/global-subd.sh b/scripts/tagging/global-subd.sh index 499f07f..b5bcc37 100755 --- a/scripts/tagging/global-subd.sh +++ b/scripts/tagging/global-subd.sh
@@ -54,9 +54,10 @@ cd "$LAST_ARG" set_sed_arg $LAST_ARG # call global with the last arg taken off. need to do it in one line, - # since bash sucks and it won't keep any quoted wildcards intact otherwise - # (or will still muck with the arguments in some weird way). this is - # similar to doing NEW_ARGS=${@:1:$LAST_MINUS_ONE}, and passing NEW_ARGS + # since bash sucks and it won't keep any quoted wildcards intact + # otherwise (or will still muck with the arguments in some weird way). + # this is similar to doing NEW_ARGS=${@:1:$LAST_MINUS_ONE}, and passing + # NEW_ARGS LAST_MINUS_ONE=$(($#-1)) global -ln "${@:1:$LAST_MINUS_ONE}" | sed "s/\.\/\($SED_ARG\)/\1/g" else # plain old global
diff --git a/scripts/tagging/gtags-update.sh b/scripts/tagging/gtags-update.sh index 4945d49..cf315aa 100755 --- a/scripts/tagging/gtags-update.sh +++ b/scripts/tagging/gtags-update.sh
@@ -1,10 +1,10 @@ #!/bin/bash # Barret Rhoden 2012-03-07 -# Builds/updates a gtags database for all directories/paths listed in GTAGS_INC_FILE -# (.gtagsinclude). If you are in a gtags-managed directory (subdir), it will -# update from the rootdir. If not, it will attempt to build a new gtags -# database, if you have the whitelist file. +# Builds/updates a gtags database for all directories/paths listed in +# GTAGS_INC_FILE (.gtagsinclude). If you are in a gtags-managed directory +# (subdir), it will update from the rootdir. If not, it will attempt to build +# a new gtags database, if you have the whitelist file. # # This will also do the incremental update, so run this when you have new files # in the system. Don't run global -u, since it takes forever, and is probably
diff --git a/tests/cpp_streams.cc b/tests/cpp_streams.cc index 1defe6e..3c3848f 100644 --- a/tests/cpp_streams.cc +++ b/tests/cpp_streams.cc
@@ -11,7 +11,8 @@ int x; }; -int main() { +int main(void) +{ string line; ifstream myfile; /* grep the asm for M_release to verify we're using atomics */
diff --git a/tools/app-arch/cpio/Makefile b/tools/app-arch/cpio/Makefile index 278a678..ae5b3ef 100644 --- a/tools/app-arch/cpio/Makefile +++ b/tools/app-arch/cpio/Makefile
@@ -25,9 +25,9 @@ $(build-dir): $(tarball) $(akaros-patches) rm -fr $(src-dir) tar -xf $< - $(Q)mkdir $(build-dir) && \ - for i in $(akaros-patches); do \ - (cd $(src-dir) && patch -p1 < ../$$i); \ + $(Q)mkdir $(build-dir) && \ + for i in $(akaros-patches); do \ + (cd $(src-dir) && patch -p1 < ../$$i); \ done PHONY += config @@ -44,8 +44,8 @@ PHONY += clean clean: - $(Q)[ -d $(build-dir) ] && \ - [ -f $(build-dir)/Makefile ] && \ + $(Q)[ -d $(build-dir) ] && \ + [ -f $(build-dir)/Makefile ] && \ $(MAKE) -C $(build-dir) clean || true PHONY += mrproper
diff --git a/tools/app-arch/tar/Makefile b/tools/app-arch/tar/Makefile index 641313d..a0779ae 100644 --- a/tools/app-arch/tar/Makefile +++ b/tools/app-arch/tar/Makefile
@@ -25,9 +25,9 @@ $(build-dir): $(tarball) $(akaros-patches) rm -fr $(src-dir) tar -xf $< - $(Q)mkdir $(build-dir) && \ - for i in $(akaros-patches); do \ - (cd $(src-dir) && patch -p1 < ../$$i); \ + $(Q)mkdir $(build-dir) && \ + for i in $(akaros-patches); do \ + (cd $(src-dir) && patch -p1 < ../$$i); \ done PHONY += config @@ -44,8 +44,8 @@ PHONY += clean clean: - $(Q)[ -d $(build-dir) ] && \ - [ -f $(build-dir)/Makefile ] && \ + $(Q)[ -d $(build-dir) ] && \ + [ -f $(build-dir)/Makefile ] && \ $(MAKE) -C $(build-dir) clean || true PHONY += mrproper
diff --git a/tools/dev-libs/elfutils/Makefile b/tools/dev-libs/elfutils/Makefile index 83b16c1..997a6fc 100644 --- a/tools/dev-libs/elfutils/Makefile +++ b/tools/dev-libs/elfutils/Makefile
@@ -33,9 +33,9 @@ $(build-dir): $(tarball) $(akaros-patches) $(Q)rm -rf $@ tar -xf $< - $(Q)cd $@ && \ - for i in $(akaros-patches); do \ - patch -p1 < ../$$i; \ + $(Q)cd $@ && \ + for i in $(akaros-patches); do \ + patch -p1 < ../$$i; \ done PHONY += config @@ -52,14 +52,14 @@ PHONY += clean clean: - $(Q)[ -d $(build-dir) ] && \ - [ -f $(build-dir)/Makefile ] && \ + $(Q)[ -d $(build-dir) ] && \ + [ -f $(build-dir)/Makefile ] && \ $(MAKE) -C $(build-dir) clean || true PHONY += mrproper mrproper: - $(Q)[ -d $(build-dir) ] && \ - [ -f $(build-dir)/Makefile ] && \ + $(Q)[ -d $(build-dir) ] && \ + [ -f $(build-dir)/Makefile ] && \ $(MAKE) -C $(build-dir) uninstall || true $(Q)rm -rf $(build-dir)
diff --git a/tools/jenkins/launcher.sh b/tools/jenkins/launcher.sh index 5275734..4ca10f9 100755 --- a/tools/jenkins/launcher.sh +++ b/tools/jenkins/launcher.sh Binary files differ
diff --git a/tools/sys-apps/bash/Makefile b/tools/sys-apps/bash/Makefile index b0a181e..97db874 100644 --- a/tools/sys-apps/bash/Makefile +++ b/tools/sys-apps/bash/Makefile
@@ -26,9 +26,9 @@ $(build-dir): $(tarball) $(akaros-patches) rm -fr $(src-dir) tar -xf $< - $(Q)mkdir $(build-dir) && \ - for i in $(akaros-patches); do \ - (cd $(src-dir) && patch -p1 < ../$$i); \ + $(Q)mkdir $(build-dir) && \ + for i in $(akaros-patches); do \ + (cd $(src-dir) && patch -p1 < ../$$i); \ done PHONY += config @@ -46,8 +46,8 @@ PHONY += clean clean: - $(Q)[ -d $(build-dir) ] && \ - [ -f $(build-dir)/Makefile ] && \ + $(Q)[ -d $(build-dir) ] && \ + [ -f $(build-dir)/Makefile ] && \ $(MAKE) -C $(build-dir) clean || true PHONY += mrproper
diff --git a/tools/sys-apps/coreutils/Makefile b/tools/sys-apps/coreutils/Makefile index 97bb9d6..bad2a57 100644 --- a/tools/sys-apps/coreutils/Makefile +++ b/tools/sys-apps/coreutils/Makefile
@@ -25,9 +25,9 @@ $(build-dir): $(tarball) $(akaros-patches) rm -fr $(src-dir) tar -xf $< - $(Q)mkdir $(build-dir) && \ - for i in $(akaros-patches); do \ - (cd $(src-dir) && patch -p1 < ../$$i); \ + $(Q)mkdir $(build-dir) && \ + for i in $(akaros-patches); do \ + (cd $(src-dir) && patch -p1 < ../$$i); \ done PHONY += config @@ -46,8 +46,8 @@ PHONY += clean clean: - $(Q)[ -d $(build-dir) ] && \ - [ -f $(build-dir)/Makefile ] && \ + $(Q)[ -d $(build-dir) ] && \ + [ -f $(build-dir)/Makefile ] && \ $(MAKE) -C $(build-dir) clean || true PHONY += mrproper
diff --git a/tools/sys-apps/diffutils/Makefile b/tools/sys-apps/diffutils/Makefile index 21426c6..0555364 100644 --- a/tools/sys-apps/diffutils/Makefile +++ b/tools/sys-apps/diffutils/Makefile
@@ -25,9 +25,9 @@ $(build-dir): $(tarball) $(akaros-patches) rm -fr $(src-dir) tar -xf $< - $(Q)mkdir $(build-dir) && \ - for i in $(akaros-patches); do \ - (cd $(src-dir) && patch -p1 < ../$$i); \ + $(Q)mkdir $(build-dir) && \ + for i in $(akaros-patches); do \ + (cd $(src-dir) && patch -p1 < ../$$i); \ done PHONY += config @@ -44,8 +44,8 @@ PHONY += clean clean: - $(Q)[ -d $(build-dir) ] && \ - [ -f $(build-dir)/Makefile ] && \ + $(Q)[ -d $(build-dir) ] && \ + [ -f $(build-dir)/Makefile ] && \ $(MAKE) -C $(build-dir) clean || true PHONY += mrproper
diff --git a/tools/sys-apps/grep/Makefile b/tools/sys-apps/grep/Makefile index 080400b..4aa7546 100644 --- a/tools/sys-apps/grep/Makefile +++ b/tools/sys-apps/grep/Makefile
@@ -25,9 +25,9 @@ $(build-dir): $(tarball) $(akaros-patches) rm -fr $(src-dir) tar -xf $< - $(Q)mkdir $(build-dir) && \ - for i in $(akaros-patches); do \ - (cd $(src-dir) && patch -p1 < ../$$i); \ + $(Q)mkdir $(build-dir) && \ + for i in $(akaros-patches); do \ + (cd $(src-dir) && patch -p1 < ../$$i); \ done PHONY += config @@ -46,8 +46,8 @@ PHONY += clean clean: - $(Q)[ -d $(build-dir) ] && \ - [ -f $(build-dir)/Makefile ] && \ + $(Q)[ -d $(build-dir) ] && \ + [ -f $(build-dir)/Makefile ] && \ $(MAKE) -C $(build-dir) clean || true PHONY += mrproper