History log of /seL4-camkes-master/kernel/include/arch/x86/arch/64/mode/fastpath/fastpath.h
Revision Date Author Comments
# 512a0200 19-Mar-2020 Qian Ge <qian.ge@data61.csiro.au>

replacing all ifndef with pargma once

All the kernel header files now use pargma once rather than the ifndef,
as the pre-processed C files do not change while header files
are protected with pargma once. This will also solve any naming issues
caused by ifndef.


# 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.


# 7fc45c4e 18-Mar-2019 Anna Lyons <Anna.Lyons@data61.csiro.au>

style: set code width to 120


# d0930f67 18-Mar-2019 Anna Lyons <Anna.Lyons@data61.csiro.au>

style: consistently attach return type

Add attach-return-type to astyle


# 3d10ef0c 18-Mar-2019 Anna Lyons <Anna.Lyons@data61.csiro.au>

style: correct parenthesis padding

Use astyle's unpad-paren to unpad all parentheses that are not included
by pad-header, pad-oper, and pad-comma.


# cf113c61 12-Mar-2019 Jasper Lowell <jasper.lowell@data61.csiro.au>

x86_64: Use sys[ret/exit]q instead of rex prefix

Clang does not support the rex.w instruction prefix and instead requires
sys[ret/exit] mnemonics.


# b1e799a4 28-Jan-2018 Adrian Danis <Adrian.Danis@data61.csiro.au>

x86: Config option for RSB flush on context switch

This option can be enabled to prevent a user from performing a Spectre like attack on
another user through polluting the RSB.


# 2423c620 28-Jan-2018 Adrian Danis <Adrian.Danis@data61.csiro.au>

x86: Config option for branch prediction barrier on context switch

This option can be enabled to prevent a user from performing a Spectre like attack on
another user through polluting the indirect branch predictor.


# f0594ac9 28-Jan-2018 Adrian Danis <Adrian.Danis@data61.csiro.au>

x86: Implement IBRS based Spectre mitigations

Provides the ability to enable the IBRS hardware Spectre mitigation strategies, as well
as completes the software mitigation by disabling jump tables in compilation. The
hardware mitigations are largely provided "for completeness" in the hopes that they
eventually become less expensive. For the moment there is no reason to turn on any
beyond STIBP if running in multicore


# 374da850 16-Jan-2018 Bamboo <bamboo@keg.ertos.in.nicta.com.au>

[STYLE_FIX]


# 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


# 96842a2c 05-Jan-2018 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: If PCIDs are not enabled forbid them in any CR3 values

When PCIDs are not enabled the low 12 bits of CR3 are not all ignored as bits 3 and 4 control
memory typing of the translation. To prevent setting these to 'random' values we should leave
the low bits of CR3 0 when not using PCIDs.

A new makeCR3 wrapper is defined that is used instead of cr3_new that, based on CONFIG_SUPPORT_PCID,
either fills in the PCID or 0 as required.


# 4edbbbd4 03-Jan-2018 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: Separate notion of current vspace root with current user vspace root

This introduces functions for specifically manipulating the user vspace root, either as an
abstract root or the specific CR3 value, in a way that is separated from the current vspace
root. Currently they are one and the same, but this separation allows for having the kernel
translation (and hence the active vspace root) be different the currently active user.


# 00a05777 25-Oct-2017 Hesham Almatary <hesham.almatary@data61.csiro.au>

Benchmark: account for thread utils on 64-bit archs' fastpath


# 57fa0e0f 07-Aug-2017 Hesham Almatary <hesham.almatary@data61.csiro.au>

Share linker.h between architectures


# 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)


# eccaae51 20-Feb-2017 Adrian Danis <Adrian.Danis@data61.csiro.au>

s/D61/DATA61/ in license headers for consistency


# df977382 09-Jan-2017 Donny Yang <work@kota.moe>

x64: Rearrange endpoint_cap structure to improve fastpath speed

This looks like we're just swapping the positions of capEPBadge and capEPPtr,
but it turns out that the bitwise op being performed on capEPPtr to set the
high bits were part of the data dependency critical path, so this actually
does improve the speed by moving the bitwise op to capEPBadge (albeit it's
now an AND instead of an OR)

I initially set the field size to 32 bits, but it turns out that causes gcc
to emit an instruction (mov r32, r32) that causes the instruction decoder
to switch to the legacy decode path for the rest of the fast path for some
reason.


# c68a69f8 19-Dec-2016 Donny Yang <work@kota.moe>

x64: Rearrange cnode_cap structure to improve fastpath speed


# 20e6ec6e 19-Dec-2016 Donny Yang <work@kota.moe>

x64: Rearrange pml4_cap structure to improve fastpath speed


# 7842e0dd 14-Dec-2016 Donny Yang <work@kota.moe>

x64: Parallelise isValidVTableRoot_fp() check


# 564b9839 05-Dec-2016 Donny Yang <work@kota.moe>

x86: Avoid writing the fs/gs base if we don't have to


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

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


# fbafb777 28-Nov-2016 Donny Yang <work@kota.moe>

x64: Always set the high bits of certain pointers in the fastpath

seL4 is always in the top of memory, so the high bits of pointers are always 1.
The autogenerated unpacking code doesn't know that, however, so will try to
conditionally sign extend (in 64-bit mode), which wastes cycles in the fast
path. Instead, we can do the unpacking ourselves and explicitly set the high
bits.


# d73d0e8f 24-Nov-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x86: Write FS and GS base when restoring user context

This commit moves the write to FS and GS base, allowing for a much
more efficient write to GS base under x86-64 SMP. When writing
GS base was in Arch_switchToThread it was neccessary to write to
an MSR such that when swapgs was performed on kernel exit the new
value of GS base would be retrieved. Unfortunately writing to an
MSR is very expensive and we would much prefer to use the writegsbase
instructions instead. By moving this code to restore user context
we are able to call swapgs earlier and then use the normal
writegsbase instruction


# 811800da 24-Nov-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: Efficiently pack objects for fastpath

Improves the packing of structures used in the fastpath


# 1c312610 23-Nov-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x86: Switch to NULL FPU state if suspect no one using it

Adds a heuristic to switch to a NULL fpu state if we think the FPU
is not presently in use. A NULL fpu state is more efficient as
we do not have to enable/disable the FPU when switching threads


# f0d599f5 23-Nov-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x86: Add FORCE_INLINE to some fastpath functions

The compiler fails to realize that inlining these functions is
a performance benefit due to fact that after inlining their
bodies can be optimized with other inlined functions.


# 008f9ae2 21-Nov-2016 Bamboo <bamboo@keg.ertos.in.nicta.com.au>

[STYLE_FIX]


# d6d8fb54 14-Nov-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: Multicore TLB coherency


# 09356a3e 13-Nov-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: Release lock when returning from kernel


# 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


# edc811a8 17-Nov-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x86: Add likely to isValidVTableRoot_fp

Although this function is called from the fastpath inside of an
`unlikely` macro and the function itself gets inlined, the knowledge
that this conjunction is unlikely is somehow lost. Explicitly putting
a `likely` here fixes it


# 6f908324 06-Nov-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: Access core local state correctly


# 120a5e54 27-Oct-2016 Bamboo <bamboo@keg.ertos.in.nicta.com.au>

[STYLE_FIX]


# 679d28c9 27-Oct-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: Correct FPU handling code


# 6a86cbf5 26-Oct-2016 Bamboo <bamboo@keg.ertos.in.nicta.com.au>

[STYLE_FIX]


# 7fbde1bb 14-Jun-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

SELFOUR-287: 32-bit vt-x implementation

This is an implementation of vt-x for x86 kernels running in
ia32 mode.


# b90238d0 19-Oct-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

Replace #pragma once with include guards


# 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.


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

x86: Use FLAGS_* defines instead of magic numbers


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

x86: Make stack.h a mode specific header

The functionality of setKernelEntryStackPointer is all ia32 specific and
this commit moves this to a mode specific include location


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

x64: Missing c_exit_hook


# f062dcdc 11-Oct-2016 Bamboo <bamboo@keg.ertos.in.nicta.com.au>

[STYLE_FIX]


# 6d07c443 10-Oct-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: Partial hardware breakpoint support

This only implementes debug support if using the SYSCALL kernel invocation
method, will not work yet with SYSENTER


# 6294225c 10-Oct-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x86: Rename [ER]FLAGS to FLAGS

Having a different name for the FLAGS register creates an unnecessary difference
between ia32 and x86_64 code since regardless of the name/size the bits in the
register mean exactly the same thing


# 4c94f43c 26-Sep-2016 Adrian Danis <Adrian.Danis@data61.csiro.au>

x64: Fastpath