History log of /seL4-l4v-master/seL4/src/arch/x86/64/traps.S
Revision Date Author Comments
# 96456c6a 06-May-2020 Curtis Millar <curtis.millar@data61.csiro.au>

trivial: fix header files

Signed-off-by: Curtis Millar <curtis.millar@data61.csiro.au>


# fba7c896 06-May-2020 Curtis Millar <curtis.millar@data61.csiro.au>

Consolidate kernel virtual memory regions

Each architecture now only needs to describe the bounds of the three
memory regions: the 1:1 mapped physical memory region, the kernel ELF
region (which may or may not overlap the physical memory region) and the
device / kernel page table region.

The physical base address of the 1:1 mapped physcial memory region and
the kernel ELF region must also be specified.

The top of user addressable memory (where in the same virtual address
space as the kernel) is defined by USER_TOP.

The physic memory virtual mapping is described by PPTR_BASE and
PPTR_TOP. The base physical memory address is PADDR_BASE and is the
physical address used to map PPTR_BASE.

Don't use kernelBase when referring to the base of the 1:1 mapped
physical memory window.

The kernel ELF virtual address region is described by KERNEL_ELF_BASE
and extends until the virtual address of the symbol `ki_end` which is
created by the linker. KERNEL_ELF_PADDR_BASE is the base address of
the physical memory region used to map the kernel and is the address to
which KERNEL_ELF_BASE maps.

KERNEL_ELF_BASE and KERNEL_ELF_PADDR_BASE do not need to be aligned to a
page size boundary as they are approriately truncated during boot by the
`map_kernel_window` function.

KDEV_BASE describes the base virtual address of the kernel device region
and the region is assumed to extend to the end of virtual memory.

Note: The offset between PPTR_BASE and PADDR_BASE is used to translate
the virtual address of all untyped objects to physical addresses. This
includes device untyped objects or frame objects where the virtual
address does not fall within the 1:1 mapped physical memory region.

Signed-off-by: Curtis Millar <curtis.millar@data61.csiro.au>


# 79da0792 01-Mar-2020 Gerwin Klein <gerwin.klein@data61.csiro.au>

Convert license tags to SPDX identifiers

This commit also converts our own copyright headers to directly use
SPDX, but leaves all other copyright header intact, only adding the
SPDX ident. As far as possible this commit also merges multiple
Data61 copyright statements/headers into one for consistency.


# 554f812d 08-Nov-2016 Anna Lyons <Anna.Lyons@data61.csiro.au>

mcs: scheduling context donation over ipc

After this commit, threads blocked on an endpoint can recieve a
scheduling context from the thread that wakes the blocked thread.


# 3207abee 20-Mar-2019 Curtis Millar <curtis.millar@data61.csiro.au>

RFC-3: Update context for x86 to use FS and GS.

TLS_BASE virtual register is replaced with FS_BASE and GS_BASE virtual
registers.

The FS_BASE and GS_BASE virtual registers are moved to the end of the
context so they need not be considered in the kernel exit and entry
implementation.

Removed tracking of ES, DS, FS, and GS segment selectors on kernel entry
and exit.

ES and DS are clobbered on kernel entry with the RPL 3 selector for a
DPL 3 linear data segment.

FS is clobbered on exit with the RPL 3 selector for the DPL 3 segment
with FS_BASE as the base. This is done on exit to reload the value from
the GDT.

GS is clobbered on exit with the RPL 3 selector for the DPL 3 segment
with GS_BASE as the base. This is done on exit to reload the value from
the GDT.

Kernel entry and exit code is refactored, simplified, and improved in
light of the above changes.

x64: update verified config to use fsgsbase instr

The verification platform for x64 relies on the fsgsbase instruction.


# 29695d26 07-Jan-2018 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: SKIM window to mitigate Meltdown (CVE-2017-5754) on x86-64

Introduces a kernel option that, when enabled, reduces the kernel window in a user address
space to just be Static Kernel Image and Microstate (SKIM), instead of the full kernel
address space. This isolates the important kernel data from the user preventing a
Meltdown style attack being able to violate secrecy. The kernel text and read only data,
i.e. anything that is static from boot, is not secret and can be allowed in the SKIM window
and potentially read by the user. Additionally to switch to and from the actual kernel
address space a small amount of state needs to also be in the SKIM window.

This is only an implementation for x86-64, although the same design is applicable to ia32


# f00cceda 06-Nov-2017 Adrian Danis <Adrian.Danis@data61.csiro.au>

x86: User zero as idle thread stack sentinel

The RSP of the idle thread is checked to determine whether an interrupt occured in the idle
thread or during a pre-emptible period of kernel execution. This changes the sentinel value
to be a constant 0, instead of the address of the IRQ stack. Using zero is simpler, prevents
any relation to the stack being used to save values and is simpler for verification as it
is a clear constant value.


# ee28936d 18-Jun-2017 Hesham Almatary <hesham.almatary@data61.csiro.au>

SMP: Introduce ENABLE_SMP_SUPPORT

- Make it more readable and less confusing compared to the 'CONFIG_MAX_NUM_NODES > 1' check


# 40c61e5c 18-Jun-2017 Anna Lyons <Anna.Lyons@data61.csiro.au>

Fix licenses (the rest)


# 4ce8ec48 08-Feb-2017 Adrian Danis <Adrian.Danis@data61.csiro.au>

SELFOUR-794: x64: Respect redzone on nested kernel interrupts


# c988403c 02-Feb-2017 Adrian Danis <Adrian.Danis@data61.csiro.au>

x86: Enable kernel exceptions in non debug mode that can return to new IP

Changes `handleKernelException` to always be called, regardless of debug mode or not
and gives `handleKernelException` the ability to return with a new IP that the
exception should return to. Currently this feature is not used and `handleKernelException`
always performs halt.


# cea45cd1 31-Jan-2017 Jack Suann <Jack.Suann@data61.csiro.au>

x86: Handling pending interrupts in kernel mode

This commit allows x86 to completely handle a pending interrupt without switching
out to user mode. To handle an interrupt on x86 the APIC *must* generate an exception,
prior to you being able to acknowledge it. Previously we only allow exceptions (i.e.
interrupts) to be generated outside of kernel mode when we are in user mode.

This change allows us to 'poll' for an interrupt and transition the APIC whilst in kernel
mode by enabling and taking interrupts at carefully defined points. A pending interrupt
will be stored by the exception handler, allowing us to then handle the interrupt and
acknowledge the hardware APIC. Handling is done by waiting until after we have 'left' the
kernel and are about to switch to user mode and then 'entering' the kernel again by jumping
to the interrupt entry point.

Handling interrupts entirely in kernel mode provides two advantages
* It will allow, in the future, the ability to handle kernel interrupts in situations
where we need to handle the interrupt before actually performing the hardware switch
back to user mode. This case happens where the user thread is using vt-x and so
pending interrupts do not generate an interrupt exception, but rather cause an exception
to be generated telling the system that there is a pending interrupt
* Where there are multiple pending interrupts it is more efficient to avoid additional
switches in and out of the user thread

Whilst this change does not enable pre-emption points to handle the interrupt before
returning out of `handleSyscall` it should be easily implementable with what is provided.


# 5037717c 11-Jan-2017 Adrian Danis <Adrian.Danis@data61.csiro.au>

x86: Explicitly define kernel stack size

This commit changes the previous hard coded 4K kernel stack size
to being a configurable power of 2 sized stack


# c5a4e4a1 06-Dec-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: VT-x entry/exit routines


# 78009dd2 28-Nov-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

SELFOUR-675: x64: Increase message registers from 2 to 4


# a0cb9e67 09-Nov-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: Support multiple kernel stacks

Adds support for per-core kernel stacks through the use of
thread local storage and swapgs. In addition to the main
kernel stack the IRQ stack also needs to be made per core


# cfe0f8e9 12-Oct-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: Support for hardware debugging when using SYSENTER

Hardware debugging was already supported if using SYSCALL for kernel
invocations, this adds support for when using SYSENTER. SYSENTER
is special because when entering the kernel the TF flag is not masked,
so the case of taking a debug exception in the kernel needs to be
handled. Also, unlike ia32, there is a race between performing
popf and calling sysexit where interrupts can be received. This race
is avoided by performing a full state restore with iret if a thread
is single stepping.


# 580ecbc1 12-Oct-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: Use explicit interrupt stack

This commit uses the Interrupt Stack Table introduced in x86-64 to force
interrupts to *always* use a new explicit stack. The legacy behaviour is
for a new stack to only be used if switching privilidge levels, meaning
if we got an interrupt in user mode we would get a new stack (prior to
pushing registers), but an interrupt in kernel mode would push registers
directly to the current (kernel) stack. Using the IST allows interrupts
from kernel mode to also switch to a new stack prior to pushing registers,
allowing for much more consistent semantics when dealing with interrupts.


# 7f9970e5 20-Dec-2015 Adrian Danis <Adrian.Danis@nicta.com.au>

x64: Add x86_64 support