History log of /kvm-unit-tests/lib/x86/desc.c (Results 26 – 50 of 61)
Revision Date Author Comments
# 728e71ee 23-Mar-2018 Paolo Bonzini <pbonzini@redhat.com>

x86: add UMIP test

The UMIP feature can be emulated by KVM, so it's useful to add
a test that it works properly.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


# e8e04104 29-Jun-2017 Jim Mattson <jmattson@google.com>

Specify %cs for exception_handler iret

The exception handler longjmp should happen in the code segment of the
exception handler rather than in the code segment of the exception
(particularly when th

Specify %cs for exception_handler iret

The exception handler longjmp should happen in the code segment of the
exception handler rather than in the code segment of the exception
(particularly when the exception occurs in compatibility mode).

Signed-off-by: Jim Mattson <jmattson@google.com>
Message-Id: <20170629184647.76674-2-jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 06d1898a 29-Jun-2017 Jim Mattson <jmattson@google.com>

Save/restore handler in test_for_exception

The default handler for #DE, #UD, and #GP is check_exception_table.
Test_for_exception should restore the original handler before
returning, rather than bl

Save/restore handler in test_for_exception

The default handler for #DE, #UD, and #GP is check_exception_table.
Test_for_exception should restore the original handler before
returning, rather than blindly clobbering it with NULL.

Signed-off-by: Jim Mattson <jmattson@google.com>
Message-Id: <20170629184647.76674-1-jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 10594e42 07-Jun-2017 Paolo Bonzini <pbonzini@redhat.com>

x86: clean up GDTs

- Add a 16-bit code and data segment to cstart.S.
- Move ring 3 segment descriptors at the end of the GDT, and lay them out
as required by syscall/sysret in cstart64.S.
- Only d

x86: clean up GDTs

- Add a 16-bit code and data segment to cstart.S.
- Move ring 3 segment descriptors at the end of the GDT, and lay them out
as required by syscall/sysret in cstart64.S.
- Only define TSS_INTR for 32-bit, and place it where cstart64.S puts the
32-bit ring 0 segment.
- Document that the same data segment can be used for 32 and 64-bit code.
- Mark all descriptors as accessed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>

show more ...


# fd6aada0 17-May-2017 Radim Krčmář <rkrcmar@redhat.com>

use %# instead of 0x% in all format strings

It's one character shorter, properly prefixed, and also provides error
detection: %#d triggers a warning.

Done with `sed -i 's/0x%/%#/g' **/*.[ch]` to mo

use %# instead of 0x% in all format strings

It's one character shorter, properly prefixed, and also provides error
detection: %#d triggers a warning.

Done with `sed -i 's/0x%/%#/g' **/*.[ch]` to motivate the use of %#,
existing padding was raised by 2 to account for the counted "0x" (output
should be the same).

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>

show more ...


# bd7ec418 19-Apr-2016 Andrew Jones <drjones@redhat.com>

x86: change exit to abort again

This is needed again because ed0a50e5 "x86: lib: debug dump
on unhandled exceptions" must have missed it in a rebase.

Signed-off-by: Andrew Jones <drjones@redhat.com

x86: change exit to abort again

This is needed again because ed0a50e5 "x86: lib: debug dump
on unhandled exceptions" must have missed it in a rebase.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Peter Feiner <pfeiner@google.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>

show more ...


# ed0a50e5 22-Mar-2016 Peter Feiner <pfeiner@google.com>

x86: lib: debug dump on unhandled exceptions

Prints the stack trace and registers.

Signed-off-by: Peter Feiner <pfeiner@google.com>
Reviewed-By: Andrew Jones <drjones@redhat.com>
Message-Id: <d5511

x86: lib: debug dump on unhandled exceptions

Prints the stack trace and registers.

Signed-off-by: Peter Feiner <pfeiner@google.com>
Reviewed-By: Andrew Jones <drjones@redhat.com>
Message-Id: <d5511a7b6d4b2fad9c5b11116d778084a58a6f01.1458689655.git.pfeiner@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# b006d7eb 03-Mar-2016 Andrew Jones <drjones@redhat.com>

x86: fix printf format warnings

Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1457008388-12749-5-git-send-email-drjones@redhat.com>
[Fix c

x86: fix printf format warnings

Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1457008388-12749-5-git-send-email-drjones@redhat.com>
[Fix conflicts with "x86: clean up exit use, use abort". - Paolo
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Conflicts:

lib/x86/desc.c

show more ...


# a2b7c499 02-Mar-2016 Andrew Jones <drjones@redhat.com>

x86: clean up exit use, use abort

Change all exit()'s for the purpose of aborts to abort()'s. This changes
a handful of exit(-1)'s, which resulted in a 255 exit status (putting
the status in signal

x86: clean up exit use, use abort

Change all exit()'s for the purpose of aborts to abort()'s. This changes
a handful of exit(-1)'s, which resulted in a 255 exit status (putting
the status in signal territory) to a 127 exit status (just below signal
territory), as 127 is defined as the unittest abort. Yes, stdlib would
use SIGABRT resulting in 134, but, well, we do what we can...

Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
Message-Id: <1456939982-13178-2-git-send-email-drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 932ba2d2 12-Jan-2016 Paolo Bonzini <pbonzini@redhat.com>

x86: simplify test_for_exception trigger functions

test_for_exception makes the unit tests simpler, but it requires the
trigger function to be in on the joke: before, by calling
set_exception_return

x86: simplify test_for_exception trigger functions

test_for_exception makes the unit tests simpler, but it requires the
trigger function to be in on the joke: before, by calling
set_exception_return; now, by calling set_exception_jmpbuf and
handle_exception(NULL). The new setjmp-based implementation
lets us move all of this into test_for_exception itself, so
that the trigger_func can be very simple.

Suggested-by: David Matlack <dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 03f37ef2 15-Dec-2015 Paolo Bonzini <pbonzini@redhat.com>

x86: replace set_exception_return with longjmp-based implementation

set_exception_return forces exceptions handlers to return to a specific
address instead of returning to the instruction address pu

x86: replace set_exception_return with longjmp-based implementation

set_exception_return forces exceptions handlers to return to a specific
address instead of returning to the instruction address pushed by the
CPU at the time of the exception. The unit tests apic.c and vmx.c use
this functionality to recover from expected exceptions.

When using set_exception_return one would have to be careful not to modify
the stack (such as by doing a function call) as triggering the exception
will likely jump us past the instructions which undo the stack manipulation
(such as a ret). This is unnecessarily brittle, and C already has a
mechanism to do non-local returns---setjmp. Now that libcflat includes
an implementation of setjmp, replace set_exception_return with a wrapper
that takes care of restoring the processor flags as well.

Reported-by: David Matlack <dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 7488d290 12-Nov-2015 Paolo Bonzini <pbonzini@redhat.com>

KVM: x86: a few more x86-specific functions

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


# 74d51c58 26-Aug-2015 Levente Kurusa <lkurusa@redhat.com>

x86: desc: fix typo

It should be 'exception' instead of 'excecption'.

Signed-off-by: Levente Kurusa <lkurusa@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


# d95bd8f6 13-Mar-2015 Radim Krčmář <rkrcmar@redhat.com>

x86: fix build (macro R interpreted as raw string)

GCC 5.0.0 enables raw strings by default and they have higher priority
than macros, thus R"[...]" is interpreted incorrectly:

lib/x86/isr.c:112:

x86: fix build (macro R interpreted as raw string)

GCC 5.0.0 enables raw strings by default and they have higher priority
than macros, thus R"[...]" is interpreted incorrectly:

lib/x86/isr.c:112:30: error: invalid character ')' in raw string delimiter
lib/x86/isr.c:112:8: error: stray ‘R’ in program
lib/x86/isr.c:112:26: error: expected ‘:’ or ‘)’ before string constant
"orl $0x200, (%%"R"sp)\n\t"

Fix it by putting a space between macro R and a string literal.
(We already do that somewhere.)

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

show more ...


# 73f9822e 24-Jul-2014 Nadav Amit <namit@cs.technion.ac.il>

x86: Test rflags.rf is set upon faults

This patch tests whether rflags.rf is set upon #UD and #GP faults as it should,
according to Intel SDM 17.3.1.1. The patch saves rflags.rf in an unused bit of

x86: Test rflags.rf is set upon faults

This patch tests whether rflags.rf is set upon #UD and #GP faults as it should,
according to Intel SDM 17.3.1.1. The patch saves rflags.rf in an unused bit of
the value which is saved during exception handling to save rflags.rf.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 309ca07b 02-Apr-2014 Paolo Bonzini <pbonzini@redhat.com>

x86: desc: support ISTs for alternate stacks in 64-bit mode

Introduce a new API that replaces setup_tss32 and set_intr_task_gate
in tests that run in both modes. This will enable three more tests i

x86: desc: support ISTs for alternate stacks in 64-bit mode

Introduce a new API that replaces setup_tss32 and set_intr_task_gate
in tests that run in both modes. This will enable three more tests in
eventinj to run in 64-bit mode.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 69d8fe0e 02-Apr-2014 Paolo Bonzini <pbonzini@redhat.com>

x86: unify GDT format between 32-bit and 64-bit

Except the TSS, which is 16-bytes in 64-bit mode, we can use the same
structure and share the constants. This will aid in porting tests
to 64-bit.

M

x86: unify GDT format between 32-bit and 64-bit

Except the TSS, which is 16-bytes in 64-bit mode, we can use the same
structure and share the constants. This will aid in porting tests
to 64-bit.

Multiple bitwidth and ring 3 selectors aren't used yet. I couldn't
make my mind on keeping vs. dropping them, in the end I kept the ring 3
selectors which have a chance of being used for SMAP or paging unit tests.

With this change, vmx.c can start using desc.h's constants and those
in vm.h (why vm.h?) can be dropped.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 5b0bf08b 02-Apr-2014 Paolo Bonzini <pbonzini@redhat.com>

x86: taskswitch: use desc library

The APIs in desc.c make it much simpler to understand what the test
is doing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


# 8f4755fa 02-Apr-2014 Paolo Bonzini <pbonzini@redhat.com>

x86: desc: reuse cstart.S GDT and TSS

There is no particular reason to use a specific TSS in tests that
use task-switching. In fact, in many cases the tests just want
a separate interrupt stack and

x86: desc: reuse cstart.S GDT and TSS

There is no particular reason to use a specific TSS in tests that
use task-switching. In fact, in many cases the tests just want
a separate interrupt stack and could run on 64-bit just as well
if the task-switching is abstracted.

As a first step, remove duplicate protected mode setup from desc.c's
users. Just leave some spare selectors in cstart.S's GDT before
the CPUs' main TSS. Then reuse CPU 0's TSS as TSS_MAIN.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 8e2a348d 03-Apr-2014 Paolo Bonzini <pbonzini@redhat.com>

x86: desc: move idt_entry_t and gdt_entry_t to header

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


# 67961d18 02-Apr-2014 Paolo Bonzini <pbonzini@redhat.com>

x86: desc: change set_gdt_entry argument to selector

This interface, already used in taskswitch.c, is a bit easier to use.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


# a3d1fb55 03-Apr-2014 Paolo Bonzini <pbonzini@redhat.com>

x86: move size #defines to processor.h

These are necessary in many testcases that includes hand-written
assembly, otherwise they will only run for either 32- or 64-bit.

Signed-off-by: Paolo Bonzini

x86: move size #defines to processor.h

These are necessary in many testcases that includes hand-written
assembly, otherwise they will only run for either 32- or 64-bit.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# e3f363c4 04-Jan-2014 Jan Kiszka <jan.kiszka@siemens.com>

lib/x86: Move exception test code into library

Will also be used by the APIC test. Moving exception_return assignment
out of line, we can drop the explicit compiler barrier.

Signed-off-by: Jan Kisz

lib/x86: Move exception test code into library

Will also be used by the APIC test. Moving exception_return assignment
out of line, we can drop the explicit compiler barrier.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# b01c8823 12-Apr-2013 Kevin Wolf <kwolf@redhat.com>

x86/taskswitch2: Task switches into/out of VM86

This adds a test case that jumps into VM86 by iret-ing to a TSS and back
to Protected Mode using a task gate in the IDT.

Signed-off-by: Kevin Wolf <k

x86/taskswitch2: Task switches into/out of VM86

This adds a test case that jumps into VM86 by iret-ing to a TSS and back
to Protected Mode using a task gate in the IDT.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>

show more ...


# b319491d 15-Nov-2011 Avi Kivity <avi@redhat.com>

desc: fix build for i386

Noted by Takuya Yoshikawa.

Signed-off-by: Avi Kivity <avi@redhat.com>


123