]> xenbits.xensource.com Git - people/liuw/xtf.git/log
people/liuw/xtf.git
8 years agoCreate aliases of the live L1 and L2 pagetables
Andrew Cooper [Sun, 5 Jun 2016 17:18:35 +0000 (18:18 +0100)]
Create aliases of the live L1 and L2 pagetables

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce paddr_t
Andrew Cooper [Sun, 5 Jun 2016 12:42:08 +0000 (13:42 +0100)]
Introduce paddr_t

rather than just using uint64_t.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce PRI helper definitions for PTEs
Andrew Cooper [Sun, 5 Jun 2016 12:28:00 +0000 (13:28 +0100)]
Introduce PRI helper definitions for PTEs

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoMore pagetable order and entries information
Andrew Cooper [Sun, 5 Jun 2016 11:22:57 +0000 (12:22 +0100)]
More pagetable order and entries information

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoMore space for static inline pagetable helpers
Andrew Cooper [Sun, 5 Jun 2016 11:18:35 +0000 (12:18 +0100)]
More space for static inline pagetable helpers

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce typesafe min()/max() helpers
Andrew Cooper [Fri, 27 May 2016 09:42:53 +0000 (10:42 +0100)]
Introduce typesafe min()/max() helpers

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce mmu_update() hypercall infrastructure
Andrew Cooper [Mon, 11 Jul 2016 12:46:53 +0000 (13:46 +0100)]
Introduce mmu_update() hypercall infrastructure

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoCollect CPU family/model/stepping information on boot
Andrew Cooper [Fri, 27 May 2016 13:34:41 +0000 (14:34 +0100)]
Collect CPU family/model/stepping information on boot

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd FEP utility
Wei Liu [Mon, 20 Jun 2016 14:44:38 +0000 (15:44 +0100)]
Add FEP utility

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoHelpers to retrieve %ss and %esp from cpu_regs
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>
8 years agoIntroduce ASSERT() and BUILD_BUG_ON()
Andrew Cooper [Thu, 16 Jun 2016 12:05:01 +0000 (12:05 +0000)]
Introduce ASSERT() and BUILD_BUG_ON()

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoxtf-runner: Extend test selection to run multiple tests at once
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>
8 years agoxtf-runner: Support listing tests
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>
8 years agoxtf-runner: Basic test runner
Andrew Cooper [Mon, 22 Feb 2016 12:43:54 +0000 (12:43 +0000)]
xtf-runner: Basic test runner

Currently just accepts a list of full test-$ENV-$NAME, runs them in order, and
provides a results summary at the end.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce a pylint configuration file
Andrew Cooper [Mon, 22 Feb 2016 12:43:52 +0000 (12:43 +0000)]
Introduce a pylint configuration file

Also ignore python intermediate files.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoConstants for all EFER bits
Andrew Cooper [Sun, 29 May 2016 14:58:04 +0000 (15:58 +0100)]
Constants for all EFER bits

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoFix _ASM_EXTABLE_HANDLER() to expand preprocessor tokens in its parameters
Andrew Cooper [Mon, 6 Jun 2016 11:54:40 +0000 (11:54 +0000)]
Fix _ASM_EXTABLE_HANDLER() to expand preprocessor tokens in its parameters

Currently it stringises the literal parameter, which can result in a
non-expanded token ending up in at the assembler, causing a build failure.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce _PAGE_* constants for all pagetable entry bits
Andrew Cooper [Tue, 31 May 2016 17:20:39 +0000 (17:20 +0000)]
Introduce _PAGE_* constants for all pagetable entry bits

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoProvide cpu_has_* helper predicates for common features
Andrew Cooper [Tue, 31 May 2016 17:17:14 +0000 (17:17 +0000)]
Provide cpu_has_* helper predicates for common features

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoCollect the CPU vendor on boot, and make it available for tests
Andrew Cooper [Mon, 23 May 2016 18:21:06 +0000 (19:21 +0100)]
Collect the CPU vendor on boot, and make it available for tests

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoProvide {BITS,BYTES}_PER_LONG
Andrew Cooper [Mon, 23 May 2016 13:39:26 +0000 (13:39 +0000)]
Provide {BITS,BYTES}_PER_LONG

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd cpuid_e[abcd]x() helper wrappers
Andrew Cooper [Fri, 20 May 2016 10:22:49 +0000 (11:22 +0100)]
Add cpuid_e[abcd]x() helper wrappers

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoHelper script to create new tests, and high level tests documentation
Andrew Cooper [Thu, 19 May 2016 18:22:24 +0000 (19:22 +0100)]
Helper script to create new tests, and high level tests documentation

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoDisable implicit makefile rules
Andrew Cooper [Thu, 19 May 2016 17:09:27 +0000 (18:09 +0100)]
Disable implicit makefile rules

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoRemove setting ROOT path in common.mk
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>
8 years agoProvide _PAGE_AD as shorthand, and simplify the invlpg test
Andrew Cooper [Tue, 17 May 2016 18:37:54 +0000 (19:37 +0100)]
Provide _PAGE_AD as shorthand, and simplify the invlpg test

Pass _PAGE_AD as parameter to the asm block, to reduce the use of magic
constants.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoCollect feature information from cpuid
Andrew Cooper [Wed, 11 May 2016 13:57:58 +0000 (14:57 +0100)]
Collect feature information from cpuid

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoUse IS_DEFINED() in preference to #ifdef
Andrew Cooper [Wed, 11 May 2016 12:56:33 +0000 (13:56 +0100)]
Use IS_DEFINED() in preference to #ifdef

By exposing more code and having the compiler optimise it out, there is less
chance of bitrot.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce IS_DEFINED() for use in C code
Andrew Cooper [Wed, 9 Mar 2016 19:41:59 +0000 (19:41 +0000)]
Introduce IS_DEFINED() for use in C code

Alter CONFIG_{PV,HVM} to be explicitly defined as 1.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoProvide function pointer abstractions for cpuid() and cpuid_count()
Andrew Cooper [Wed, 11 May 2016 12:38:14 +0000 (13:38 +0100)]
Provide function pointer abstractions for cpuid() and cpuid_count()

Code common between PV and HVM using cpuid() needs to use different cpuid()
implementations, as PV guests need to use the Xen forced emulation prefix.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce an architecture specific convenience header
Andrew Cooper [Wed, 11 May 2016 11:43:03 +0000 (12:43 +0100)]
Introduce an architecture specific convenience header

Avoid introducing arch/x86/lib.h implicitly via xtf/lib.h

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoXSA-173 PoC
Andrew Cooper [Fri, 18 Mar 2016 21:18:49 +0000 (21:18 +0000)]
XSA-173 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoMake the tables from hvm/pagetables.S available to C code
Andrew Cooper [Tue, 10 May 2016 16:09:55 +0000 (17:09 +0100)]
Make the tables from hvm/pagetables.S available to C code

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoAllow selecting objcopy binary to use
Roger Pau Monne [Tue, 10 May 2016 12:00:27 +0000 (14:00 +0200)]
Allow selecting objcopy binary to use

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoOnly set CC if it's not set
Roger Pau Monne [Tue, 10 May 2016 11:58:39 +0000 (13:58 +0200)]
Only set CC if it's not set

This prevents overwriting CC if it's already set on the environment.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoInvlpg handling test
Andrew Cooper [Wed, 4 May 2016 14:41:48 +0000 (15:41 +0100)]
Invlpg handling test

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoExtend exception table support to include custom handlers
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>
9 years agoAvoid shifting a negative value
Roger Pau Monne [Fri, 6 May 2016 09:17:46 +0000 (11:17 +0200)]
Avoid shifting a negative value

Because it's undefined behaviour.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoFix usage of "-executable" with find
Roger Pau Monne [Fri, 6 May 2016 11:07:30 +0000 (13:07 +0200)]
Fix usage of "-executable" with find

"-executable" is a GNU only extension to find. Instead replace it with a
POSIX compatible one.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoDon't re-define __noinline
Roger Pau Monne [Fri, 6 May 2016 09:15:49 +0000 (11:15 +0200)]
Don't re-define __noinline

On FreeBSD __noinline is already defined in cdefs.h

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoProvide all {read,write}_cr[02348]() stub functions
Andrew Cooper [Thu, 5 May 2016 15:12:17 +0000 (16:12 +0100)]
Provide all {read,write}_cr[02348]() stub functions

Both GCC and Clang correctly encode %cr8 accesses using the lock
instruction prefix in 32bit mode.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoAdd 64bit segment base MSRs to the index
Andrew Cooper [Thu, 5 May 2016 11:44:42 +0000 (12:44 +0100)]
Add 64bit segment base MSRs to the index

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoReserve space in the GDT for test use
Andrew Cooper [Thu, 5 May 2016 09:29:48 +0000 (10:29 +0100)]
Reserve space in the GDT for test use

Currently four entries, although this is an arbitrary choice.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoPrint more information when dumping exceptions
Andrew Cooper [Fri, 29 Apr 2016 12:08:20 +0000 (13:08 +0100)]
Print more information when dumping exceptions

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoHelper routines for decoding x86 architectural state
Andrew Cooper [Thu, 28 Apr 2016 13:24:06 +0000 (14:24 +0100)]
Helper routines for decoding x86 architectural state

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoIntroduce snprintf() and give vsnprintf() an appropriate __printf() attribute
Andrew Cooper [Thu, 28 Apr 2016 12:04:51 +0000 (13:04 +0100)]
Introduce snprintf() and give vsnprintf() an appropriate __printf() attribute

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoCreate xtf.h and avoid using xtf/lib.h as the include-all header
Andrew Cooper [Fri, 1 Apr 2016 18:00:45 +0000 (19:00 +0100)]
Create xtf.h and avoid using xtf/lib.h as the include-all header

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoXSA-123 PoC
Andrew Cooper [Fri, 15 Jan 2016 15:44:58 +0000 (15:44 +0000)]
XSA-123 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoExtend the pv-iopl test to test VMASST_TYPE_architectural_iopl
Andrew Cooper [Sat, 19 Mar 2016 19:51:01 +0000 (19:51 +0000)]
Extend the pv-iopl test to test VMASST_TYPE_architectural_iopl

A varient of exec_user() is introduced which takes an IOPL parameter.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoPV IOPL emulation testing
Andrew Cooper [Sat, 19 Mar 2016 15:36:16 +0000 (15:36 +0000)]
PV IOPL emulation testing

A test to verify correct behaviour of vIOPL shadowing in Xen.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoIntroduce DECLSTR() for declaring strings in ASM
Andrew Cooper [Fri, 22 Apr 2016 19:00:30 +0000 (20:00 +0100)]
Introduce DECLSTR() for declaring strings in ASM

Put the string in the mergeable string section, declare it as data, and set
its size.

Replace the partial open-coding of this in head_{pv,hvm}.S for main_err_msg,
and switch the label to being local.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoIntroduce ENDFUNC() and annotate ASM functions as such
Andrew Cooper [Fri, 22 Apr 2016 18:59:02 +0000 (19:59 +0100)]
Introduce ENDFUNC() and annotate ASM functions as such

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoAnnotate hvm pagetables as data
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>
9 years agoAvoid generating *UND* symbols in object files
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>
9 years agoAnnotate hypercall stubs as functions
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>
9 years agoMove arch/x86/hvm_pagetables.S into arch/x86/hvm/ directory
Andrew Cooper [Fri, 22 Apr 2016 18:40:02 +0000 (19:40 +0100)]
Move arch/x86/hvm_pagetables.S into arch/x86/hvm/ directory

This is a more appropriate place for it to live.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoIntroduce more linker alignment assertions
Andrew Cooper [Fri, 22 Apr 2016 18:38:00 +0000 (19:38 +0100)]
Introduce more linker alignment assertions

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoFix XSA-168 PoC on Gen1 AMD hardware
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>
9 years agoIntroduce Memory op ABI and infrastructure
Andrew Cooper [Mon, 21 Mar 2016 14:07:41 +0000 (14:07 +0000)]
Introduce Memory op ABI and infrastructure

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoFix GCC build following c/s 72442d4
Andrew Cooper [Sat, 26 Mar 2016 18:22:00 +0000 (18:22 +0000)]
Fix GCC build following c/s 72442d4

GCC and Clang have different permitted syntax for nested initialisers.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoIntroduce the hvm32pse environment
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>
9 years agoImprove the legibility of the pagetable generation code
Andrew Cooper [Sat, 26 Mar 2016 18:19:20 +0000 (18:19 +0000)]
Improve the legibility of the pagetable generation code

Factor the common _PAGE_xxx attributes out into PAGE_COMMON, and introduce a
macro for the index calculation.

Add _ACCESSED and _DIRTY to the common attributes, to avoid the processor
needing to set the bits.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoSplit common pagetable infrastructure from PAE specific infrastructure
Andrew Cooper [Fri, 26 Feb 2016 15:39:42 +0000 (15:39 +0000)]
Split common pagetable infrastructure from PAE specific infrastructure

In preparation for the introduction of PSE paging.  In most cases, add a PAE
prefix to existing constants.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoXSA-168 Proof of Concept test
Andrew Cooper [Thu, 10 Dec 2015 15:59:02 +0000 (15:59 +0000)]
XSA-168 Proof of Concept test

Must be run with shadow paging

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoAllow tests to supply extra settings for their .cfg file
Andrew Cooper [Thu, 24 Mar 2016 19:56:38 +0000 (19:56 +0000)]
Allow tests to supply extra settings for their .cfg file

by setting $(TEST-EXTRA-CFG)

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoXSA-122 Proof of Concept test
Andrew Cooper [Fri, 15 Jan 2016 15:40:32 +0000 (15:40 +0000)]
XSA-122 Proof of Concept test

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoIntroduce xen_version hypercall and ABI
Andrew Cooper [Thu, 24 Mar 2016 12:53:00 +0000 (12:53 +0000)]
Introduce xen_version hypercall and ABI

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoDrop CONFIG_PAGING_PAE
Andrew Cooper [Tue, 23 Feb 2016 11:43:19 +0000 (11:43 +0000)]
Drop CONFIG_PAGING_PAE

It can uniquely be determined from PAGING_LEVELS == 3 or 4, and doing so
simplifies the early ASM.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoIntroduce IS_ALIGNED()
Andrew Cooper [Fri, 26 Feb 2016 18:30:44 +0000 (18:30 +0000)]
Introduce IS_ALIGNED()

While at it comment the entities in this file, and guard _p() to avoid it
accidentally being used in assembly code.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoTest `into` even in 64bit
Andrew Cooper [Mon, 7 Mar 2016 09:09:21 +0000 (09:09 +0000)]
Test `into` even in 64bit

In 64bit, the instruction should fail unilaterally with #UD.  Check that the
emulator provides this behaviour.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoAdd memcpy() to the framework's libc implementation
Andrew Cooper [Mon, 21 Mar 2016 14:51:17 +0000 (14:51 +0000)]
Add memcpy() to the framework's libc implementation

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoCorrect the generation of the `cd 03` instruction
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>
9 years agoReintroduce the test_NULL_unmapped() selftest
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>
9 years agoUtility for dumping MSRs visible to a guest
Andrew Cooper [Sat, 5 Mar 2016 19:11:34 +0000 (19:11 +0000)]
Utility for dumping MSRs visible to a guest

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoUtility for dumping the CPUID information visible to a guest
Andrew Cooper [Sun, 30 Aug 2015 21:43:17 +0000 (22:43 +0100)]
Utility for dumping the CPUID information visible to a guest

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoAdd documentation noting that swint-emulation serves as a test for XSAs 106 and 156
Andrew Cooper [Tue, 23 Feb 2016 22:37:06 +0000 (22:37 +0000)]
Add documentation noting that swint-emulation serves as a test for XSAs 106 and 156

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoXSA-167 Proof of Concept test
Andrew Cooper [Fri, 15 Jan 2016 19:41:11 +0000 (19:41 +0000)]
XSA-167 Proof of Concept test

Introduce a brand new category called 'xsa' for dedicated XSA tests.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoAlter xtf_success() to take a string to print
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>
9 years agoIntroduce test categories and create a test-info.json for each test
Andrew Cooper [Mon, 22 Feb 2016 12:43:51 +0000 (12:43 +0000)]
Introduce test categories and create a test-info.json for each test

test-info.json will accumulate relevant test metadata.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoInstall each test into a separate directory
Andrew Cooper [Mon, 22 Feb 2016 12:43:49 +0000 (12:43 +0000)]
Install each test into a separate directory

This allows for better delineation of tests and their resources.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoAccept a PREFIX parameter when generating test configuration
Andrew Cooper [Mon, 22 Feb 2016 12:43:46 +0000 (12:43 +0000)]
Accept a PREFIX parameter when generating test configuration

This allows the test paths to be configured for the install destination if it
isn't to be run out the build working tree.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoIntroduce links from test descriptions to their main.c
Andrew Cooper [Mon, 15 Feb 2016 15:33:23 +0000 (15:33 +0000)]
Introduce links from test descriptions to their main.c

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoDocument the build requirements
Andrew Cooper [Mon, 15 Feb 2016 15:33:23 +0000 (15:33 +0000)]
Document the build requirements

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoSpecify initalisers for each structure item
Andrew Cooper [Mon, 15 Feb 2016 15:33:23 +0000 (15:33 +0000)]
Specify initalisers for each structure item

Fixes an error from clang.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoDon't doubly declare the name label in ENTRY()
Andrew Cooper [Mon, 15 Feb 2016 15:33:23 +0000 (15:33 +0000)]
Don't doubly declare the name label in ENTRY()

GLOBAL() already declares it.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoDeclare the size of l1_identmap
Andrew Cooper [Mon, 15 Feb 2016 15:33:23 +0000 (15:33 +0000)]
Declare the size of l1_identmap

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoDisable implicit makefile rules
Andrew Cooper [Mon, 18 Jan 2016 10:48:59 +0000 (10:48 +0000)]
Disable implicit makefile rules

They are not needed, and cause unexpected behaviour.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoImplement the hvm32 environment; a 32bit HVM guest without paging
Andrew Cooper [Mon, 18 Jan 2016 10:48:56 +0000 (10:48 +0000)]
Implement the hvm32 environment; a 32bit HVM guest without paging

The test_NULL_unmapped() selftest is not applicable in an unpaged environment,
so is made conditional.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoRework config.h and head_hvm.S for better paging separation
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>
9 years agoRename the {pv,hvm}32 environments to {pv,hvm}32pae
Andrew Cooper [Mon, 18 Jan 2016 10:48:49 +0000 (10:48 +0000)]
Rename the {pv,hvm}32 environments to {pv,hvm}32pae

to indicate the paging mode in use.  More 32bit HVM environments will be
introduced, using different paging modes.

In principle, other 32bit PV environments exist, but are unable to run under a
64bit Xen, so are unlikely to be implemented.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoRename CONFIG_ENV_{pv,hvm} to CONFIG_{PV,HVM}
Andrew Cooper [Mon, 18 Jan 2016 10:48:44 +0000 (10:48 +0000)]
Rename CONFIG_ENV_{pv,hvm} to CONFIG_{PV,HVM}

to avoid them being easily confused with the environment-specific defined.

Additionally, reduce the usage of the environment-specific defines to an
absolute minimum, to avoid latent issues when introducing new environments.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoRework the build systems environment list generation
Andrew Cooper [Mon, 18 Jan 2016 10:48:26 +0000 (10:48 +0000)]
Rework the build systems environment list generation

and use this to reduce the amount of repetition in the object list generation.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoMisc docs improvements
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>
9 years agoInclude local variables in all files currently missing them
Andrew Cooper [Fri, 15 Jan 2016 15:31:09 +0000 (15:31 +0000)]
Include local variables in all files currently missing them

Correct some accidental introduction of tabs in arch/x86/link.lds.S

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoAvoid overflow in compare_extable_entry() when entries are far appart
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>
9 years agoImport xen/errno.h from Xen's public API
Andrew Cooper [Fri, 15 Jan 2016 14:43:45 +0000 (14:43 +0000)]
Import xen/errno.h from Xen's public API

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoIntroduce 'skip' as a test result
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>
9 years agoInclude xtf/hypercall.h in xtf/lib.h
Andrew Cooper [Fri, 15 Jan 2016 14:04:55 +0000 (14:04 +0000)]
Include xtf/hypercall.h in xtf/lib.h

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoTest software injection of `into` in 32bit builds
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>
9 years agoDocument the history of the framework
Andrew Cooper [Thu, 14 Jan 2016 12:41:46 +0000 (12:41 +0000)]
Document the history of the framework

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>