akaros.git
3 years agovm exit handler for xsetbv
Michael Taufen [Mon, 22 Feb 2016 22:47:54 +0000 (14:47 -0800)]
vm exit handler for xsetbv

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoInitialize guest xcr0, save and restore xcr0 between guest and Akaros
Michael Taufen [Mon, 22 Feb 2016 22:42:31 +0000 (14:42 -0800)]
Initialize guest xcr0, save and restore xcr0 between guest and Akaros

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoBoot time and per-cpu extended state setup
Michael Taufen [Mon, 22 Feb 2016 22:35:42 +0000 (14:35 -0800)]
Boot time and per-cpu extended state setup

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd load, safe load, read xcr0 functions
Michael Taufen [Mon, 22 Feb 2016 22:27:02 +0000 (14:27 -0800)]
Add load, safe load, read xcr0 functions

void lxcr0(uint64_t xcr0)
int safe_lxcr0(uint64_t xcr0)
uint64_t rxcr0(void)

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRelocated fixup table macros
Michael Taufen [Wed, 24 Feb 2016 23:15:48 +0000 (15:15 -0800)]
Relocated fixup table macros

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoExtended state data structures (XCC)
Michael Taufen [Mon, 22 Feb 2016 22:11:37 +0000 (14:11 -0800)]
Extended state data structures (XCC)

Rebuild your kenrel headers and rebuild all user apps!

new ancillary_state state components
x86_default_xcr0
xcr0 in guest_pcore

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove some trailing whitespace.
Michael Taufen [Thu, 11 Feb 2016 17:50:47 +0000 (09:50 -0800)]
Remove some trailing whitespace.

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoTurn off TSD in slave processors.
Kanoj Sarcar [Wed, 24 Feb 2016 19:08:13 +0000 (14:08 -0500)]
Turn off TSD in slave processors.

Turn off TSD (Time Stamp Disable) on slaves.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd page reference counting to mm hooks.
Kanoj Sarcar [Mon, 22 Feb 2016 23:42:20 +0000 (15:42 -0800)]
Add page reference counting to mm hooks.

Add page reference counting logic to some of the user map helper functions.

Expose one of the mlx4 parameters to user space.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMake query_port not report port_down always.
Kanoj Sarcar [Mon, 22 Feb 2016 23:35:17 +0000 (15:35 -0800)]
Make query_port not report port_down always.

Hack existing linux logic to avoid netdev stuff that was reporting port_down
always.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix couple of problems in compat code.
Kanoj Sarcar' via Akaros [Thu, 18 Feb 2016 22:11:00 +0000 (14:11 -0800)]
Fix couple of problems in compat code.

While trying newer tests, the non-initialization logic of SGL's became
apparent. Also, newer tests invoke get_user_pages() without faulting in
corresponding pages, so we need to automatically allocate the pages.

Clean up to do reference counting in get_user_pages() etc will come later.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove user include hacks
Barret Rhoden [Tue, 16 Feb 2016 21:15:34 +0000 (16:15 -0500)]
Remove user include hacks

Due to the old style of having user libraries include their own headers as
both <libname/foo.h> and <foo.h>, we had to have a few hacks to force us to
include the 'real' headers that we wanted.

Now that we do things the right way, we don't need to carry those hacks
around.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoClean up user library include paths (XCC)
Barret Rhoden [Tue, 16 Feb 2016 19:33:42 +0000 (14:33 -0500)]
Clean up user library include paths (XCC)

Allowing libraries to search their own include/ for <foo.h> is a huge mess
that results in issues when glibc has foo.h.  The fix is to not allow that,
and to insist libraries refer to their own files by their full name
(libname/foo.h).

All user libraries (other than pthread) now have their include directories
arranged as:

user/LIBNAME/include/LIBNAME/FOO.h

With their include path being set to user/LIBNAME/include/, and all
 #includes explicitly list the libname.

Due to moving parlib's arch symlink, you'll need to do something like:

$ rm user/parlib/include/arch
$ make mrproper
$ mv .config.old .config
$ make ARCH=x86 oldconfig
$ make userclean

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoActivate kernel bypass logic
Kanoj Sarcar' via Akaros [Thu, 11 Feb 2016 01:11:53 +0000 (17:11 -0800)]
Activate kernel bypass logic

Hook in mlx4/ driver to activate kernel bypass logic.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoPort over linux 4.1.15 infiniband/core logic for kernel bypass NIC access
Kanoj Sarcar' via Akaros [Thu, 11 Feb 2016 01:09:47 +0000 (17:09 -0800)]
Port over linux 4.1.15 infiniband/core logic for kernel bypass NIC access

Port over linux 4.1.15 drivers/infiniband/core logic essential for
kernel bypass NIC access. Slight edits to adapt to Akaros environment
(#if exclusion of non essential code blocks, panic stubs etc), described
in README file.

Most of the interlock logic with core kernel (mm/vfs etc) is captured
in compat.[ch].

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoPort over linux 4.1.15 mlx4 kernel bypass driver
Kanoj Sarcar' via Akaros [Wed, 10 Feb 2016 23:54:30 +0000 (15:54 -0800)]
Port over linux 4.1.15 mlx4 kernel bypass driver

Port over linux 4.1.15 drivers/infiniband/hw/mlx4 logic essential for
kernel bypass NIC access. Slight edits to adapt to Akaros environment
(#if exclusion of non essential code blocks, panic stubs etc), described
in README file.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoUpdates from vmm-akaros
Michael Taufen [Wed, 10 Feb 2016 17:37:58 +0000 (09:37 -0800)]
Updates from vmm-akaros

Boot params
e820 info
Use copy_vmctl_tovmtf(*) in __build_vm_ctx_cp(*)
Inject GPF on unsupported MSR access
Add linux_bootparam.h

Signed-off-by: Michael Taufen <mtaufen@gmail.com>
[ pragma once, static_assert->parlib_static_assert ]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove kernel errno string processing
Barret Rhoden [Sat, 13 Feb 2016 20:57:08 +0000 (15:57 -0500)]
Remove kernel errno string processing

The kernel doesn't really need to know about the string names for errno
values.  We were using that mostly as a hack to not use proper
errstrings.

I kept parse_errno.sh around, since we (theoretically) still use that to
generate error lists in glibc.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove uses of errno_to_string()
Barret Rhoden [Sat, 13 Feb 2016 19:03:57 +0000 (14:03 -0500)]
Remove uses of errno_to_string()

Using errno_to_string() was a hack.

In addition to removing that, this commit cleans up a few nasty things.
In namec(), we just had a static string floating around for some reason.
Good times.

More importantly, in sysfile we were doing a brain-dead strcmp on
ENODATA.  Computers should do comparisons on errno.  Errstr is for
humans.  The danger there is that if someone did:

error(ENODATA, "Actually a useful message that was not NULL")

then the strcmp on errstr would fail, since it's not the "string that
meant ENODATA).

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoOutlaw the setting of NULL errstrs
Barret Rhoden [Sat, 13 Feb 2016 19:12:01 +0000 (14:12 -0500)]
Outlaw the setting of NULL errstrs

This will catch them if we try to use them.  O/w we'll have to rely on
other methods (code review/tools) to find them.

Maybe there's an argument to be made for a simple error(EFOO, 0),
where you just don't want to bother making a string.  Then for now you
can use ERROR_FIXME.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove the printk format %e
Barret Rhoden [Sat, 13 Feb 2016 19:00:35 +0000 (14:00 -0500)]
Remove the printk format %e

We were using it in two places, and one of them was incorrect (getchar()
wasn't returning an errno).

It was also blindly inferring errstr() from the context.  If we're going to
do that, we might as well not even pass in the err.  It was basically an
unused perror() for the kernel.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoqio: Use an empty string to mark a closed queue
Barret Rhoden [Sat, 13 Feb 2016 17:48:14 +0000 (12:48 -0500)]
qio: Use an empty string to mark a closed queue

Instead of converting ECONNABORTED to a string and then doing a
brain-dead strcmp, we can just use an empty string.  AFAIK, qclose() or
hangups with no message are meant to be normal closes.  Reads will just
return 0 (no data, EOF, etc.), instead of throwing an error.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoHave #ip protocol's bind()s throw errors
Barret Rhoden [Sat, 13 Feb 2016 17:21:16 +0000 (12:21 -0500)]
Have #ip protocol's bind()s throw errors

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoHave #ip protocol's announce()s throw errors
Barret Rhoden [Sat, 13 Feb 2016 17:16:20 +0000 (12:16 -0500)]
Have #ip protocol's announce()s throw errors

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoHave #ip protocol's connect()s throw errors
Barret Rhoden [Sat, 13 Feb 2016 17:06:23 +0000 (12:06 -0500)]
Have #ip protocol's connect()s throw errors

A couple extra things:

Fsstdbind and Fsstdannounce have temporary waserror shims, until those
get changed.  I needed to change setladdrport to throw, and these needed
to catch it for now.

udpconnect() was the only connect method to call Fsconnected() even if
Fsstdconnect() failed.  All of the others just return immediately.  A
potential effect of Fsconnected() is that it calls rendez_wake on the
"connection rendez" in the conversation (c->cr).  It might be the case
that someone could be sleeping, and we fail to wake them up.  Perhaps a
connect or announce succeeded, but then we failed with this connect, and
now we don't wake anyone.

Given that udpannounce is structured the same as the other connects
(doesn't call Fsconnected() on error), and the qlocks on the CV for
connect and announce, I think this can't happen.  And if it does, then
we just need to fix this connect/announce mess to make it not happen
globally.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoHave #ip's protocol ctl()s throw errors
Barret Rhoden [Sat, 13 Feb 2016 16:29:03 +0000 (11:29 -0500)]
Have #ip's protocol ctl()s throw errors

I took care of UDP and ICMP6 in this commit, since they were fairly
simple.  TCP and IPIFC were a bit more complex.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoThrow errors from within ipifcctl()
Barret Rhoden [Sat, 13 Feb 2016 16:16:34 +0000 (11:16 -0500)]
Throw errors from within ipifcctl()

This commit changes the internals of ipifcctl() to use error().  Note
that this does not change ipifcconnect() (yet), though it mucks with
that functions slightly due to a common helper.

I also added a helper for ipifc_iprouting, instead of performing the
"iprouting" operation in-line.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoThrow errors from within tcpctl()
Barret Rhoden [Fri, 12 Feb 2016 22:24:17 +0000 (17:24 -0500)]
Throw errors from within tcpctl()

The #ip ctl message framework expects to get a string for an error, then
it just calls error() with that string.  We even go so far as to catch the
error, then return the current_errstr().  All a bit ridiculous.

Changing TCP's ctl message is the first in a few steps to change #ip's ctl
interface.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove bootp
Barret Rhoden [Fri, 12 Feb 2016 22:48:22 +0000 (17:48 -0500)]
Remove bootp

This was just a source of null pointer faults in the kernel.  bootp was a
function pointer, set to null.  You can crash the kernel with:

/ $ echo "bootp" > /net/ipifc/0/ctl

As Ron aptly put it: "bootp is dead to me."

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoBuild the kernel with -Werror
Barret Rhoden [Sat, 13 Feb 2016 17:31:32 +0000 (12:31 -0500)]
Build the kernel with -Werror

For people doing development, they can turn it off locally (i.e. not
committed) in the Makefile.  But by default, all builds need to have
-Werror.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove the static_link_warning from glibc (XCC)
Barret Rhoden [Fri, 12 Feb 2016 20:02:52 +0000 (15:02 -0500)]
Remove the static_link_warning from glibc (XCC)

If you build a program statically and use dlopen (or one of a few other
functions), you'll get a warning.  The warning is meant to tell you that
even though you built statically, you still need to have the right .so's
for things to work at runtime.  That's fine.

The problem is that, while this information is nice, it is a warning, and
not just informational, and it breaks with -Werror.

Rebuild your toolchain.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agomlx4: Port over Linux header files related to NIC kernel bypass
Kanoj Sarcar' via Akaros [Wed, 10 Feb 2016 23:31:00 +0000 (15:31 -0800)]
mlx4: Port over Linux header files related to NIC kernel bypass

Slight edits on top of Linux 4.1.15 header files for Akaros builds.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
[fixed a checkpatch warning]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoEnable build info rebuild upon HEAD commit ID change
Davide Libenzi [Mon, 21 Dec 2015 19:24:36 +0000 (11:24 -0800)]
Enable build info rebuild upon HEAD commit ID change

Enable build info rebuild upon HEAD commit ID change.

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd QEMU port forwarding options for UDP as well as TCP
Edward Hyunkoo Jee [Thu, 11 Feb 2016 01:26:13 +0000 (17:26 -0800)]
Add QEMU port forwarding options for UDP as well as TCP

Signed-off-by: Edward Hyunkoo Jee <edjee@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove #nix
Barret Rhoden [Wed, 10 Feb 2016 23:22:44 +0000 (18:22 -0500)]
Remove #nix

That was an old experiment that we haven't touched in over a year and will
probably never use again.  If we do, we can resurrect it.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Fix missed posted IRQs
Barret Rhoden [Wed, 10 Feb 2016 19:22:52 +0000 (14:22 -0500)]
VMM: Fix missed posted IRQs

There's a couple parts to it:

- vmrunkernel was not posting the IRQ properly; it wasn't setting the
  outstanding notification bit.

- We need to self_ipi when that bit is set.  We had previously lost a race
  when poking the guest pcore (IPI was sent, but not received while in a
VM).  We just resend the IPI.

For ease of access, I now store the posted_irq_desc in the GPC.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Add a syscall to poke a guest pcore (XCC)
Barret Rhoden [Mon, 8 Feb 2016 17:29:27 +0000 (12:29 -0500)]
VMM: Add a syscall to poke a guest pcore (XCC)

Posted IRQs in VMX are a lot like poking the guest pcore, so we'll just use
a syscall for it.

There's a bit of nastiness with error handling.  So far, it's a real pain
to find out if a posted IRQ landed on the VM and handling if it didn't.
(When the POKE IRQ lands and the core wasn't a VM, how do we know for
certain which VM we were supposed to interrupt, without doing something
painful?).

The general Akaros philosophy here is to post a bit in memory and poke
spuriously.  When it comes to notifying vcores, we set notif_pending, send
a (possibly spurious) __notify, and if we missed it, we'll see the
notif_pending the next time we __startcore.  Hopefully we can do something
similar with posted IRQs.

This also cleans up all of the vmctl hacks, none of which are needed
anymore.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRename SYS_setup_vmm -> SYS_vmm_setup (XCC)
Barret Rhoden [Fri, 5 Feb 2016 21:39:26 +0000 (16:39 -0500)]
Rename SYS_setup_vmm -> SYS_vmm_setup (XCC)

This will make having multiple VMM syscalls slightly cleaner.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Use the I_POKE_CORE IRQ for posted IRQs
Barret Rhoden [Fri, 5 Feb 2016 19:19:48 +0000 (14:19 -0500)]
VMM: Use the I_POKE_CORE IRQ for posted IRQs

Posting IRQs is a lot like poking a core, especially when you try and think
about it in an architecture independent manner.  I_POKE_CORE is normally a
way to make sure a core isn't halted.  For VMs, it's now also a way to poke
the VMX hardware to inject an IRQ if necessary.

Note that if we want to post an IRQ and send an I_POKE_CORE, but the VM
exits before the IRQ gets there, we just run the regular POKE_ handler,
which does nothing.

This also makes our life a little easier, in that handle_vmexit_ext_irq()
doesn't need to think about getting an I_POKE.  Poke's aren't full-up IRQs
(requiring a registered handler) regardless of whether they are sent to a
core running a VM or a 'regular' core.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Remove unused tests
Barret Rhoden [Fri, 5 Feb 2016 21:38:54 +0000 (16:38 -0500)]
VMM: Remove unused tests

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agomlx4: Enable QP destruction
Kanoj Sarcar' via Akaros [Wed, 10 Feb 2016 23:18:17 +0000 (15:18 -0800)]
mlx4: Enable QP destruction

QP destruction panics because radix_tree_delete() is panic-stubbed. Implement
a version using linked lists that allows deletion.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
[ tagged commit with mlx4: ]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAllow CQ destruction in core mlx4/ logic.
Kanoj Sarcar' via Akaros [Wed, 10 Feb 2016 23:10:21 +0000 (15:10 -0800)]
Allow CQ destruction in core mlx4/ logic.

Enable CQ destruction.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoACPI changes for DMAR and new directory hierarchy.
Dan Cross [Fri, 5 Feb 2016 20:36:13 +0000 (15:36 -0500)]
ACPI changes for DMAR and new directory hierarchy.

Add the DMAR parser, and rationalize the ACPI directory
hierarchy to make it traversable from the shell. There
is additional work to do here on the latter, but that is
not critical path and this gets Gan the DMAR code he
needs for virtualization.

Signed-off-by: Dan Cross <crossd@gmail.com>
[ Fixed 16 -> KMALLOC_ALIGNMENT ]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoSet up root home for ssh
Ronald G. Minnich [Tue, 9 Feb 2016 20:59:25 +0000 (12:59 -0800)]
Set up root home for ssh

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoBind #random to /dev during ifconfig
Barret Rhoden [Fri, 5 Feb 2016 15:29:34 +0000 (10:29 -0500)]
Bind #random to /dev during ifconfig

Most programs expect to find random/urandom there.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoUse the new RNG for the networking stack
Barret Rhoden [Thu, 4 Feb 2016 23:35:41 +0000 (18:35 -0500)]
Use the new RNG for the networking stack

And remove the old version.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoUse random_read() for small urandom_read() calls
Barret Rhoden [Thu, 4 Feb 2016 23:33:17 +0000 (18:33 -0500)]
Use random_read() for small urandom_read() calls

urandom_read() starts with a random 8 byte seed.  If we need less than
that, we can (probably) just go with those bytes, as if we called
random_read() directly.

This also exposes random_read() and urandom_read() to external callers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove major stack consumers from procread()
Barret Rhoden [Thu, 4 Feb 2016 22:36:57 +0000 (17:36 -0500)]
Remove major stack consumers from procread()

procread() is a disaster.  This makes it less of a disaster.  We were
running off the end of the kernel stack when running with 4K stacks, due to
the 1K or so procread needed.  We're already deep in 9ns, and that was
enough to clobber memory.

I also removed all of the functionality that was #if 0'd out.  If we ever
need it, we can recreate it or get it from Plan 9 / Harvey.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix strace flow control and data extraction issues
Barret Rhoden [Thu, 4 Feb 2016 18:34:11 +0000 (13:34 -0500)]
Fix strace flow control and data extraction issues

There were a few issues.

- Using qwrite() was causing us to block at a bad time.  Using qiwrite()
  won't block, but it also won't do any flow control.  Instead, we do our
own flow control.  Note that we only check on the trace before the syscall.
If we have a start entry, we should have an exit entry, regardless of the
queue size.

- When we procread(), we were grabbing a reference on the proc.  However,
  if the process already exited, then we'd fail.  This prevented us from
draining the queue after the hangup.

- We drop traces.  Now we report the numbers.  If your console is slow, try
  redirecting to a file (e.g. strace foo 2> trace_file).

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoChange qfull() to check limits
Barret Rhoden [Thu, 4 Feb 2016 17:35:23 +0000 (12:35 -0500)]
Change qfull() to check limits

Instead of checking Qflow flags, we just check the len vs the limit.  This
way, we can use qfull() when we're filling a queue with qiwrite/qibwrite
(which don't bother setting Qflow).

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix page faults in strace
Barret Rhoden [Thu, 4 Feb 2016 03:00:24 +0000 (22:00 -0500)]
Fix page faults in strace

There are a couple issues, one of which we had.  For one, if the tracer
turned on halfway through a syscall, then kthread->strace might have
been garbage.  Probably not, but better safe than sorry.

The other issue is that the syscall struct could be gone by the time the
syscall ends and we finish the trace.  This could happen with
sys_exec().  We clear kthread->sysc, since the memory it points to was
already freed during the exec.

sctrace() will get cleaned up a little once we merge it with the
original tracer.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix warnings due to the declaration of serialize_*
Barret Rhoden [Thu, 4 Feb 2016 02:46:52 +0000 (21:46 -0500)]
Fix warnings due to the declaration of serialize_*

We missed these in commit 1fe2ed47726f ("Fix parameter types for
sys_proc_create() (XCC)").

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd a random device; remove old genrandom junk; remove random from #cons
Ronald G. Minnich [Thu, 4 Feb 2016 03:09:02 +0000 (19:09 -0800)]
Add a random device; remove old genrandom junk; remove random from #cons

Compiles just fine.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoGet the basic random number generator functions to compile
Ronald G. Minnich [Thu, 4 Feb 2016 02:48:37 +0000 (18:48 -0800)]
Get the basic random number generator functions to compile

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFormat with .clang-format, included herein for reference
Ronald G. Minnich [Thu, 4 Feb 2016 02:22:18 +0000 (18:22 -0800)]
Format with .clang-format, included herein for reference

BasedOnStyle: LLVM
IndentWidth: 4
TabWidth: 4
UseTab: Always
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
AlignAfterOpenBracket: true

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoImport new random number generator files from harvey
Ronald G. Minnich [Thu, 4 Feb 2016 01:52:35 +0000 (17:52 -0800)]
Import new random number generator files from harvey

This is the unchanged version; they will not compile at all
and need formatting.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd a .clang-format
Ronald G. Minnich [Thu, 4 Feb 2016 01:53:52 +0000 (17:53 -0800)]
Add a .clang-format

This essentially follows the linux format save for tab indent of 4.

I've used this to format big blocks of code and it removes almost all
warnings from checkpatch, and the only ones left were
known to be bogus.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoNew and easy strace framework.
Ronald G. Minnich [Mon, 25 Jan 2016 22:26:22 +0000 (14:26 -0800)]
New and easy strace framework.

echo straceon > /proc/pid/strace
cat /proc/pid/strace

echo straceme if you don't want inheritance.
echo straceoff > /proc/pid/strace to stop it.

That's it. strace acts like a file.

and you'll see syscall info (enter and exit) for the process.

So strace is now spelled cat, dd, grep, or, well,
anything that reads files.

Inheritance is working.

But this is a very efficient way to trace processes, even better than
the tracer I wrote for Plan 9.
A single read from strace can read many system call records.

This now dumps read, write, and open information.

Included is a sample strace program which works. You can even
strace a shell now and watch the children.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
[ various fixups, side by side with Ron! ]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix parameter types for sys_proc_create() (XCC)
Barret Rhoden [Wed, 3 Feb 2016 23:29:33 +0000 (18:29 -0500)]
Fix parameter types for sys_proc_create() (XCC)

There were too many consts in there.  The new ones are exactly from
execv()'s parameters.

Technically, you should rebuild glibc.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoReplace old ether82563.c with new driver.
Dan Cross [Mon, 25 Jan 2016 23:44:14 +0000 (18:44 -0500)]
Replace old ether82563.c with new driver.

Replace the old ether82563.c driver with the new driver
taken from Plan 9, incorporating Geoff Collyer's recent work
on the i218.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoLatest ether82563.c: integrate into Akaros.
Dan Cross [Mon, 25 Jan 2016 19:46:25 +0000 (14:46 -0500)]
Latest ether82563.c: integrate into Akaros.

Get the latest ether82563 driver building and running on Akaros;
integrate Akaros-specific changes into the driver. Document further
work.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agolindent on ether82563.c
Dan Cross [Fri, 22 Jan 2016 22:12:11 +0000 (17:12 -0500)]
lindent on ether82563.c

Run 'lindent' on ether82563.c.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agospatch plan9-ether82563.c
Dan Cross [Fri, 22 Jan 2016 22:11:31 +0000 (17:11 -0500)]
spatch plan9-ether82563.c

Run 'spatch' on ether82563.c from Plan 9.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoImport latest ether82563.c from Plan 9
Dan Cross [Fri, 22 Jan 2016 22:05:59 +0000 (17:05 -0500)]
Import latest ether82563.c from Plan 9

Bring in the latest copy of the Intel ether82563 driver
from Plan 9. This is the unmodified driver, save for
ensuring the correct copyright statement is at the top
of the file.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Rename vmx_vcpu -> guest_pcore (XCC)
Barret Rhoden [Tue, 2 Feb 2016 17:40:09 +0000 (12:40 -0500)]
VMM: Rename vmx_vcpu -> guest_pcore (XCC)

"Virtual CPU" is a little too close to "Virtual Core", which is something
completely different.  "Guest pcore" seems a little clearer, given Akaros's
current naming conventions.  Let me know if you have a better name.

This also moves the vcpu / gpc from the kernel header, since userspace
doesn't need to know about it.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Clean up VMX setup
Barret Rhoden [Tue, 2 Feb 2016 17:25:02 +0000 (12:25 -0500)]
VMM: Clean up VMX setup

The pcpui->vmxarea was only used to pass the vmx buffer from setup() to
enable().

We can just merge those two functions and put their guts into
intel_vmm_pcpu_init().

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Remove unused code (XCC)
Barret Rhoden [Tue, 2 Feb 2016 17:20:57 +0000 (12:20 -0500)]
VMM: Remove unused code (XCC)

This removes a lot of the KVM "bag on the side".

For whatever reason, struct vmx_vcpu is in a kernel header, so reinstall
your headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Use VM contexts [2/2]
Barret Rhoden [Tue, 2 Feb 2016 17:02:24 +0000 (12:02 -0500)]
VMM: Use VM contexts [2/2]

The bulk of this commit changes vmrunkernel to use VM contexts, but without
changing the overall structure of the program.  We now use two uthreads:
one for the VM and one for the controller (i.e. int main()).  They pass
control back and forth with a mutex (the ball).

The other changes are to actually use the vmexit_handler in the kernel
(HOST_RIP) and to just assume we are notifying GPC 0 (which is what we've
been doing).  IPI injection needs a little work.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Add kernel support for VM contexts [1/2]
Barret Rhoden [Tue, 2 Feb 2016 16:58:24 +0000 (11:58 -0500)]
VMM: Add kernel support for VM contexts [1/2]

The kernel now knows how to pop VM contexts and handle VM exits.

As of this commit, we're still using the old KVM loop.  The HOST_RIP on
resume is still set to use the old KVM loop, IPI injection still uses the
vmctl, and userspace does not ask it to use contexts.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agox86: Factor out irq_dispatch() from handle_irq()
Barret Rhoden [Tue, 2 Feb 2016 16:54:59 +0000 (11:54 -0500)]
x86: Factor out irq_dispatch() from handle_irq()

I'll need to call irq_dispatch() when VMs exit due to external interrupts.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Add custom exit reasons (XCC)
Barret Rhoden [Tue, 2 Feb 2016 15:38:20 +0000 (10:38 -0500)]
VMM: Add custom exit reasons (XCC)

We'll need these types for when the kernel fails to pop a VM context.  In
that case, we'll reflect the context back to the 2LS, and we'll need exit
reasons to explain what went wrong.

I also cleaned up the #defines a little.  We had multiple copies of the
exit reasons throughout the codebase.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoStop zeroing current_ctx before popping a TF
Barret Rhoden [Mon, 1 Feb 2016 22:50:13 +0000 (17:50 -0500)]
Stop zeroing current_ctx before popping a TF

I'll need to use current_ctx when popping a VM_TF fails.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Clean up per-cpu VMCS state
Barret Rhoden [Mon, 1 Feb 2016 21:53:59 +0000 (16:53 -0500)]
VMM: Clean up per-cpu VMCS state

When we want to run a VM on a new host pcore, we need to set up a bunch of
per-core info, such as the stacktop, TLS, and GDT.

This is a bit of a cleanup of the old code, which needed to handle things
we didn't, such as the 32 bit SYSENTER_ESP.  It was also a classic "bag on
the side," where instead of just using the pcpui, it was reading the
hardware state (e.g. 'str') and using those values.

In the newer version, we just save whatever we know we need, using pcpui
for the source of all of the info.  In the process, we remove a lot of
unnecessary code.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agox86: Enumerate reserved eflags (XCC)
Barret Rhoden [Mon, 1 Feb 2016 17:08:54 +0000 (12:08 -0500)]
x86: Enumerate reserved eflags (XCC)

Eflags/rflags has a few reserved fields.  If you attempt a VM enter with a
reserved bit set incorrectly, vmlaunch/resume will fail due to the bad
state.  Interestingly enough, this won't happen if you attempt to popfl a
bad rflags.  So VMX is picky, but the regular hardware isn't.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Add a gva2gpa() helper
Barret Rhoden [Mon, 1 Feb 2016 16:44:39 +0000 (11:44 -0500)]
VMM: Add a gva2gpa() helper

Instead of just assuming we can do the math for Linux's KERNBASE mapping,
this will check the page tables.

'cr3' is guest physical / user (ring 3) memory.  This should be safe from
unmapped user memory or other issues, thanks to copy_from_user().

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Move MSR emulation to vmm.c [4/4]
Barret Rhoden [Mon, 1 Feb 2016 16:33:09 +0000 (11:33 -0500)]
VMM: Move MSR emulation to vmm.c [4/4]

It's now vendor independent, so we can move it out of vmx.c.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Decouple MSR emulation from VMX [3/4]
Barret Rhoden [Mon, 1 Feb 2016 16:27:45 +0000 (11:27 -0500)]
VMM: Decouple MSR emulation from VMX [3/4]

We just use our own #defines to say whether we want a read or write,
instead of VMX exit reasons.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Clear upper 32 bits on MSR reads [2/4]
Barret Rhoden [Mon, 1 Feb 2016 16:19:31 +0000 (11:19 -0500)]
VMM: Clear upper 32 bits on MSR reads [2/4]

MSR reads in hardware should clear the upper 32 bits of rax and rdx.  Our
emulation code was going out of its way to keep the upper 32 bits as they
were on the trap, instead of clearing them.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Add a helper to emulate MSRs [1/4]
Barret Rhoden [Mon, 1 Feb 2016 16:11:53 +0000 (11:11 -0500)]
VMM: Add a helper to emulate MSRs [1/4]

The existing msrio() is too ingrained in the KVM/Dune style of operations.
It'll work a little easier with pointers to the registers and not having a
ret value that is a VMX header value.

The existing implementation of MSR emulation is in vmx.c, though for the
most part it is VMX-independent.  The one bit that is from VMX is using the
opcodes from VMX exits to specify whether we're reading or writing.  That
will change shortly.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agox86: Remove x86_get_ip_hw()
Barret Rhoden [Mon, 1 Feb 2016 16:08:10 +0000 (11:08 -0500)]
x86: Remove x86_get_ip_hw()

We have another function that does the same thing: get_hwtf_pc().

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Add helpers for loading guest pcores
Barret Rhoden [Mon, 1 Feb 2016 16:03:03 +0000 (11:03 -0500)]
VMM: Add helpers for loading guest pcores

These are similar to the old vmx_{get,put}_cpu().  Those are somewhat of a
mess.

These helpers deal with concurrency (multiple cores trying to load the same
VM core at a time) and don't have any of the baggage from KVM/Dune.
Specifically, we don't need things like 'launched' or to handle cases where
the VMCS was already loaded.

I attempted, perhaps in vain, to keep most of this vendor-independent.  For
the most part, Intel or AMD will need to do the same things in
load_guest_pcore(), minus the VMCS particulars (maybe?).  Also, struct
vmx_vcpu will eventually be guest_pcore or something.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: Add helpers for vmcs_read() and vmcs_write()
Barret Rhoden [Mon, 1 Feb 2016 15:40:17 +0000 (10:40 -0500)]
VMM: Add helpers for vmcs_read() and vmcs_write()

VMCS read and write always transfer 64 bits (since we're in 64 bit mode)
regardless of the size of the field.

Additionally, I added a return value to vmcs_write(), so that callers can
check if a write failed.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: refactor MSR emulation
Barret Rhoden [Wed, 27 Jan 2016 16:46:22 +0000 (11:46 -0500)]
VMM: refactor MSR emulation

The main change is to take pointers to rcx/rdx/rax instead of the vcpu.  It
simplifies the code a bit and, more importantly, doesn't tie us to the
vcpu.

This change mostly looks like:
s/vcpu->regs.tf_rax/*rax/

I also changed the return value to be a bool, which will plug into VM ctx
fault handling a little easier, and dropped the unused 'qual' parameter.  I
also moved emsr_ok, which was out of place compared to its buddies.

I didn't change any of the logic in the MSR emulation functions, but a few
of them need attention.  There's a bunch of copy-paste going on, and the
semantics aren't always clear for things like mustmatch.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agox86: Add a helper for loading cr2
Barret Rhoden [Tue, 26 Jan 2016 19:55:52 +0000 (14:55 -0500)]
x86: Add a helper for loading cr2

We'll need to manually save and restore it for VMs.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRestrict uva2kva() to only work for user addresses
Barret Rhoden [Mon, 25 Jan 2016 19:34:53 +0000 (14:34 -0500)]
Restrict uva2kva() to only work for user addresses

Previously, we were allowing uva2kva() to work on KVAs.  That's a little
surprising, given the name.

The new version takes a length and protection field, so the caller can
check permissions at the same time.  Note the permissions check is only for
the address space limit - not an actual mmap() permission.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: perform per-guest-pcore init at setup (XCC)
Barret Rhoden [Mon, 25 Jan 2016 19:23:15 +0000 (14:23 -0500)]
VMM: perform per-guest-pcore init at setup (XCC)

The EOI bitmap, PIR, VAPIC, and APIC pages all need to be set up per
VMCS/vcpu/guest pcore.  We had been doing this during the REG_RSP_RIP_CR3,
which was shorthand for "first time through."  Now, we do that during
initializing the entire proc VMM.

Most of the changes involve passing the guest pcore init info down through
the syscall and init paths.  I also made a helper for setting up the VMCS
pages, since the PIR, VAPIC, and APIC all follow the same pattern.  That
helper is also able to fail, which wasn't considered before.

Reinstall your kernel headers (vmctl changed).

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMM: init the vmexit counters when initing the VMM
Barret Rhoden [Mon, 25 Jan 2016 16:42:08 +0000 (11:42 -0500)]
VMM: init the vmexit counters when initing the VMM

Previously, this was just done during the first vmctl command
(REG_RSP_RIP_CR3).  It's really a "once per VMM per process" thing.  In the
future, we could add commands to reset the counters or something.  Still,
the initial initialization should be when setting up the VMM in the first
place.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoSuppressed prints for CPUID exit RIPS and removed timer thread
GanShun [Tue, 17 Nov 2015 22:12:00 +0000 (14:12 -0800)]
Suppressed prints for CPUID exit RIPS and removed timer thread

Commented out timer pthread create in vmrunkernel.c and changed printk to
printd in vmx.c for CPUID exit prints.

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoSplit up reflect_unhandled_trap()
Barret Rhoden [Thu, 21 Jan 2016 21:46:32 +0000 (16:46 -0500)]
Split up reflect_unhandled_trap()

reflect_unhandled_trap() was doing two things: putting the trap info into
the hardware context and reflecting that context back to the 2LS.  This
commit pulls out the latter part, which will be used when reflecting vm
exits.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoChange the 2LS reflected fault op to take a ctx
Barret Rhoden [Thu, 21 Jan 2016 20:49:47 +0000 (15:49 -0500)]
Change the 2LS reflected fault op to take a ctx

VM exits are another type of reflected fault.  The existing reflected fault
code assumes they are hardware faults.  For the most part, the handling of
the two types of contexts is the same, as far as uthread.c is concerned.

By passing the context, instead of interpretting the context, directly to
the 2LS, we'll eventually be able to handle VM exits as well, without the
parlib / uthread code caring at all.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMake HW trap reflection more arch-independent
Barret Rhoden [Thu, 21 Jan 2016 19:44:08 +0000 (14:44 -0500)]
Make HW trap reflection more arch-independent

This isn't perfect, since the list of traps is somewhat arch-dependent, but
it's a little better.  For the most part, we're probably only ever going to
handle certain common traps, and I'd like to avoid duplicate code.

If an architecture is unable to produce certain traps, then they can just
pick an unused trap number.  So long as they are all distinct, the switch
statement will be fine.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMove trap reflection bits into their own header
Barret Rhoden [Thu, 21 Jan 2016 19:26:50 +0000 (14:26 -0500)]
Move trap reflection bits into their own header

I'll be adding more to this soon, and it makes sense to separate this from
vcore.h.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd user support for VM contexts
Barret Rhoden [Wed, 20 Jan 2016 22:34:44 +0000 (17:34 -0500)]
Add user support for VM contexts

VM contexts are a lot like HW contexts.  The FP state may be dirty, and it
is in the processor's FP registers (or VCPD, if the kernel saved it).  The
FP state is independent of the general purpose registers as far as VMX
goes, which works out well: the VM ctx is just another general purpose
context, albeit one that needs kernel support to enter or exit.

And of course, a VMM needs to build a VM context and try to run it.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoStub out kernel support for VM contexts (XCC)
Barret Rhoden [Wed, 20 Jan 2016 22:22:53 +0000 (17:22 -0500)]
Stub out kernel support for VM contexts (XCC)

The places that need implemented are marked with TODO: (VMCTX).  This just
provides the framework for the actual kernel support and a first cut at
what a VM context looks like.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agox86: Use a common lock for printing all trapframes
Barret Rhoden [Thu, 21 Jan 2016 16:57:15 +0000 (11:57 -0500)]
x86: Use a common lock for printing all trapframes

The lock is just there for sanity reasons.  What happens on occasion is
that the kernel faults on multiple cores at the same time and tries to
print trapframes at the same time.  Those get interleaved, which is a minor
pain.  Using different locks for different TF types doesn't actually help,
so this just uses the one lock.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoProvide a syscall to pop a user context (XCC)
Barret Rhoden [Wed, 20 Jan 2016 16:47:00 +0000 (11:47 -0500)]
Provide a syscall to pop a user context (XCC)

x86 will need help running VM contexts, which is the only intended use for
this syscall.

The syscall works for any type of context, but be careful actually using
it.  As noted in the comments, Parlib manages TLS separately from
pop_user_ctx(), but this syscall will set the TLS.  When testing, I had
parlib 0 FS base in the the ctx, then had proc_pop_ctx only change the FS
base if it wasn't 0.  Technically, they could want us to set a FS base of
0, so it's not really a fix.  Another solution would be to have parlib read
fsbase, then fill that into the context.  Considering there's no real need
for the kernel to pop HW or SW contexts, none of it is worth doing.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAllow copy_*_user to be included from umem.h
Barret Rhoden [Wed, 20 Jan 2016 16:44:04 +0000 (11:44 -0500)]
Allow copy_*_user to be included from umem.h

Previously, we needed to include arch/uaccess.h to get access to the
copy_*_user helpers.  This way, we have just one header for all functions
related to user memory, which was the original intent.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoPass in file offset into mmap() handlers.
Kanoj Sarcar' via Akaros [Sat, 30 Jan 2016 00:25:32 +0000 (16:25 -0800)]
Pass in file offset into mmap() handlers.

Signed-off-by: Kanoj Sarcar <kanoj@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoSlices: A growable list of pointers.
Dan Cross [Fri, 22 Jan 2016 19:26:11 +0000 (14:26 -0500)]
Slices: A growable list of pointers.

Introduce the slice library; a growable list of pointers.
Loosely modeled after the 'slice' abstraction in the Go
programming language.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoerror: return usable error strings, not nothing.
Ronald G. Minnich [Fri, 22 Jan 2016 18:47:20 +0000 (10:47 -0800)]
error: return usable error strings, not nothing.

This is a way to get us to clean up our act on errstrs.
Bare errnos are frequently unusable, as were the Plan 9
canned error strings. At the very least, this will
show the file that produced the error. It should show
the line number but does not (why?).

But it's way better than nothing.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
[fixed the macro to show the line number]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>