Andrew Cooper [Fri, 27 May 2016 07:53:53 +0000 (08:53 +0100)]
Helpers to retrieve %ss and %esp from cpu_regs
In 32bit, if not stack switch occurs, this information isn't present in an
exception frame. As a result, regs->sp and regs->ss may actually alias the
interrupted stack frame. To avoid accidental incorrect use, prefix the names
in cpu_regs with an underscore.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 7 Jun 2016 17:08:10 +0000 (18:08 +0100)]
xtf-runner: Extend test selection to run multiple tests at once
A caller may now specify a test name (in which case all environments will be
run), an environment (in which case every test supporting that environment
will be run), or a category (in which case all tests in that category will be
run).
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 7 Jun 2016 13:25:38 +0000 (14:25 +0100)]
xtf-runner: Support listing tests
Without parameters, all tests will be returned.
Alternatively, specific environments or categories can be specified, to filter
the results. A special input of "host" will query Xen for the available
environments, and filter accordingly.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Roger Pau Monne [Thu, 19 May 2016 13:43:30 +0000 (15:43 +0200)]
Remove setting ROOT path in common.mk
Since it might be included from different paths that have different levels
of nestedness. Also all makefiles that include common.mk already define ROOT
on their own.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 6 May 2016 16:40:02 +0000 (17:40 +0100)]
Extend exception table support to include custom handlers
Provide additional documentation, and a selftest. Introduce __used to
indicate to the compiler that an object is referenced, even if the reference
isn't visible.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 22 Apr 2016 18:57:17 +0000 (19:57 +0100)]
Annotate hvm pagetables as data
Introduce PAGETABLE_{START,END}() helpers which wrap the appropriate
directives. Fix a copy&paste bug from c/s 3382222 "Introduce the hvm32pse
environment" which stated the size of pse_l1_identmap twice, and omitted
pse_l2_identmap.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 22 Apr 2016 18:49:32 +0000 (19:49 +0100)]
Avoid generating *UND* symbols in object files
The swint-emulation test contains hand-generated asm stubs which use arbitrary
identifiers just for their mnemonic properties. Unfortunately, their use in
the .if statements generate *UND* symbols listed in the object files export
table.
Use .ifc rather than .if, which explicit interprets its parameters as strings
rather than expressions. Unfortunately, there is no .elseifc directive.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 22 Apr 2016 18:47:42 +0000 (19:47 +0100)]
Annotate hypercall stubs as functions
Move DECLARE_HYPERCALL() from asm_macros.h to being local, as it is not useful
elsewhere. Link hypercall_page in .data rather than .text, to avoid polluting
the disassembly. Annotate hypercall_page itself as data.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 22 Apr 2016 18:36:15 +0000 (19:36 +0100)]
Fix XSA-168 PoC on Gen1 AMD hardware
We care simply that the vulnerability is fixed, rather than the architectural
correctness of the emulation of `invlpg`. Correctness should be implemented
by a functional test.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 23 Feb 2016 11:47:03 +0000 (11:47 +0000)]
Introduce the hvm32pse environment
This uses 32bit paging, along with the PSE extension.
Regular 32bit paging and PSE paging differ only in whether the PSE bit may be
set, to create 4M superpages. Since PSE is available on all hardware Xen will
now run on, forgo the `hvm32pg` environment to avoid the overhead of requiring
small pages for all mappings.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Sun, 6 Mar 2016 21:19:05 +0000 (21:19 +0000)]
Correct the generation of the `cd 03` instruction
Some assemblers "helpfully" turn the two-byte `int $3` into its one-byte form
`int3`. This defeats the purpose of the test case, so hand-roll the
instrucion.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Sun, 6 Mar 2016 20:26:12 +0000 (20:26 +0000)]
Reintroduce the test_NULL_unmapped() selftest
c/s f571b0b "Implement the hvm32 environment" introduced a guard to the
test_NULL_unmapped() selftest, as it is inapplicable in an unpaged
environment.
However, CONFIG_PAGING wasn't ever defined (it disappeared during
development), causing the selftest to be unconditionally omitted even in paged
environments.
Reintroduce the check, based on CONFIG_PAGING_LEVELS being non-zero.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Mon, 22 Feb 2016 18:04:28 +0000 (18:04 +0000)]
Alter xtf_success() to take a string to print
... to be consistent with the rest of the reporting interface. Every
reporting function is modified to accept NULL if there is nothing interesting
to print.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Mon, 18 Jan 2016 10:48:53 +0000 (10:48 +0000)]
Rework config.h and head_hvm.S for better paging separation
config.h is modified to turn CONFIG_ENV_$foo into the finer grain
CONFIG_{PV,HVM}, CONFIG_PAGING_LEVELS and possibly CONFIG_PAGING_PAE. It then
undefines the CONFIG_ENV_$foo #define, to prevent mistakes in regular code.
Generation of environment_description is also moved into config.h, and it is
extended to include paging information.
head_hvm.S is then modified to use the finer grain #defines. Specifically,
CR4.PAE is only set if CONFIG_PAGING_PAE, and CR3 and CR0.PG are only set if
CONFIG_PAGING_LEVELS is greater than 0.
The existing setting of CR0.PE is removed, as it is guaranteed always to be
set.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 15 Jan 2016 15:34:59 +0000 (15:34 +0000)]
Misc docs improvements
* Include assembly files. They are not processed for structured comments, but
are are available to be viewed and referred to.
* Use the preferred @# to prevent automatic linking when using #
* Disable timestamps. Helps when comparing generated content.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 15 Jan 2016 15:02:00 +0000 (15:02 +0000)]
Avoid overflow in compare_extable_entry() when entries are far appart
Constrain the return value to strictly between -1 and 1. Without this,
sorting extable entries which are further than 2GB apart fails, as the
calculation overflows the return value.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 15 Jan 2016 12:48:07 +0000 (12:48 +0000)]
Introduce 'skip' as a test result
There are situations where the test cannot be completed, and this might be
considered success or failure, depending on the exact outcome intended by the
individual who is running the tests.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Thu, 14 Jan 2016 12:24:52 +0000 (12:24 +0000)]
Test software injection of `into` in 32bit builds
The `into` instruction is another software interrupt, which raises an #OF trap
if the overflow flag is set. It is only recognised in 32bit code however, and
yields #UD if exectued in long mode.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>