Martin Lucina [Tue, 20 Jan 2015 12:22:33 +0000 (13:22 +0100)]
app-tools/ld: Ignore --export-dynamic and variants
Some applications insist on using --export-dynamic in LDFLAGS even when
configured with --disable-shared. Since we don't do dynamic linking,
we can safely ignore these options in stunt ld.
Martin Lucina [Tue, 13 Jan 2015 17:20:32 +0000 (18:20 +0100)]
Make initial stack setup consistent with per-thread stack setup
Push an "end of backtrace" marker onto the stack and zero BP. For x86_64
additionally push an extra 0 to ensure correct stack alignment as per
the ABI.
Martin Lucina [Mon, 12 Jan 2015 14:20:00 +0000 (15:20 +0100)]
Correct x86-64 stack alignment at thread entry (fixes #18)
The x86-64 ABI mandates in section 3.2.2 that (%rsp + 8) is always a
multiple of 16 when control is transferred to a function entry point. We
did not correctly implement this convention which resulted in broken
alignment for stack variables, and, following from that, SSE
instructions generated by GCC faulting due to bad alignment.
For the x86-32 version the alignment constraint appears to be[1] that
%esp must be a multiple of 16, this is already the case so no change is
made to x86-32.s.
Martin Lucina [Sun, 28 Dec 2014 17:12:40 +0000 (18:12 +0100)]
Implement wall clock time (rumprun-xen issue #13)
This change adds minios_clock_wall() as a global symbol to return wall
clock time from Xen. I did not reinstate the minios "gettime()" which is
available upstream as that relies on a definitition of struct timeval.
minios_monotonic_clock() is renamed to minios_clock_monotonic() for
consistency.
rumpuser_clock_gettime() is updated to support RUMPUSER_CLOCK_REWALL,
returning wall clock time.
All rumphyper calls to the minios NOW() macro are replaced with calls to
the properly namespaces minios_clock_monotonic().
Martin Lucina [Mon, 15 Dec 2014 21:02:27 +0000 (22:02 +0100)]
Mini-OS: netfront: Fix rx ring starvation in network_rx
In network_rx() we must push the same amount of requests back onto the
ring in the second loop that we consumed in the first loop. Otherwise
the ring will eventually starve itself of free request slots and no
packets will be delivered.
Martin Lucina [Fri, 12 Dec 2014 17:28:42 +0000 (18:28 +0100)]
Mini-OS: Add monotonic_clock to minios_ namespace
This is needed by rumphyper_base, among other things. Unclear how it is
possible that the build was working until now, separating the Mini-OS
and rumprun build systems exposed this.
Martin Lucina [Fri, 12 Dec 2014 17:18:50 +0000 (18:18 +0100)]
Extricate rumprun build system from Mini-OS
Moves the Mini-OS Makefile and associated bits to xen/, separating the
rumprun and Mini-OS build systems. This will hopefully prepare us better
for (possibly) merging with upstream Mini-OS.
Further changes arising from this:
- All minios and rumprun object files are now built under obj/
- MiniOS build installs the arch-specific ldscript under
obj/xen/minios.lds
- Rather than separately specifying the arch-specific startfile in
app-tools specs we link it into the final minios.o and use that as the
startfile.
The advantage of this approach is we no longer have to "hunt" for the
startfile _OR_ the arch-specific lib in the top-level Makefile. It
does mean the resulting application has a different memory layout due
to link order but this should not matter.
Martin Lucina [Wed, 3 Dec 2014 16:25:01 +0000 (17:25 +0100)]
app-tools: Remove useless objcopy from stunt ld
Discussed with Ian previously; the objcopy step was left over from
previous attempts at namespacing mini-os and is no longer required as
this is performed when linking minios.o.
Martin Lucina [Sun, 23 Nov 2014 21:02:12 +0000 (22:02 +0100)]
rumprun: Use blkid rather than file to detect fstype
The output of file differs between systems (and Linux distribution
versions!). Use blkid for now to detect block device filesystem type,
will need to be revisited or marked as a dependency on e2fsprogs for
*BSD.
Martin Lucina [Sun, 23 Nov 2014 20:58:19 +0000 (21:58 +0100)]
rumprun: Make diskspec backward compatible with Xen 4.1
Xen 4.1 is used in Debian stable; the diskspec used by xl is not clearly
documented and is just a passthrough to the xm disk stanza. We need mode
'w' rather than 'rw' which is also understood by (at least) Xen 4.4.
Martin Lucina [Fri, 14 Nov 2014 16:37:06 +0000 (17:37 +0100)]
Rename rumprun-xen to rumprun
To reflect the intent to support different stacks in future (eg. kvm),
rumprun-xen is renamed to just rumprun, with a mandatory STACK as its
first argument.
Martin Lucina [Thu, 13 Nov 2014 10:40:08 +0000 (11:40 +0100)]
Configure rumprun-xen application stacks from Xenstore
In order to run rumprun-xen applications that are actually useful, we
need to be able to configure block devices and network interfaces.
These changes implement a basic mechanism to do this using Xenstore.
Conceptually the changes consist of the following parts which work
together:
- The rumpconfig module provides _rumprun_config() and
_rumprun_deconfig() functions. These are called before and after the
application main() function, and also in the case of deconfig when
_exit() is called.
- These functions rely on keys like the following being present in
Xenstore at the time the domain is started:
- The "xr" driver script, currently located in app-tools/. The
motivation for this script is twofold:
Firstly, in order to write the configuration to Xenstore the domain
must be created in a paused state so that we can retrieve its unique
<domid>. Only then do we know where in Xenstore to write the
configuration data.
Secondly, it is my intention with this work to provide a
"docker-alike" interface for running rumprun applications. The "xr"
script is therefore the CLI for running such applications.
Note that in this initial version, only configuring IPv4 network
interfaces with DHCP is supported, and only using image files with ffs
or cd9660 filesystems for block devices is supported.
Martin Lucina [Tue, 11 Nov 2014 15:11:46 +0000 (16:11 +0100)]
rumpuser_exit(), _exit(): Cleanly halt Mini-OS.
rumpuser_exit() and _exit() were calling minios_do_exit() which is
intended to be called from an exception context and/or other "panic"
situation. This was causing the stack trace code in minios_do_exit() to
walk off into never never land when the rumprun-xen application called
exit() or returned from main().
This commit adds a new minios_do_halt(reason) function, with the reason
code intended to mirror SHUTDOWN_* in xen/sched.h. Of those, currently
only poweroff and crash are implemented.
We then modify the rumpuser_exit() and _exit() functions to correctly
shut down the domain by calling minios_stop_kernel() followed by
minios_do_halt(MINIOS_HALT_POWEROFF).
Martin Lucina [Fri, 7 Nov 2014 17:14:50 +0000 (18:14 +0100)]
Localize all non-public Mini-OS symbols
Pass 3 of X in Mini-OS namespace cleanup.
We define a set of prefixes in the Makefile for the symbol namespaces we
wish to keep. Then, when linking minios.o we use objcopy to localize all
other symbols. Note the sole exception of the arch-specific startup file
(x86_64.o) as this is used as the linker %startfile.