Commit graph

731 commits

Author SHA1 Message Date
Anna Lyons
8c7081c9aa trivial: use BIT in compile asserts in structures.h 2017-06-02 14:47:26 +10:00
Hesham Almatary
f1ef8b3a55 ARM: Fix assembler error with BIT definition 2017-06-02 10:56:15 +10:00
Anna Lyons
59415dc99c Add compile assert to ensure tcbName size > 0
Otherwise in debug mode, printing tcbName
can crash the system.
2017-06-01 15:11:51 +10:00
Anna Lyons
bb5ecb1b3e SELFOUR-880: add seL4_DebugDumpScheduler
- when CONFIG_DEBUG is enabled, track all threads
- when CONFIG_PRINTING is enabled, provide seL4_DebugDumpScheduler which
allows the user to dump the state of the kernel scheduler.
2017-05-30 15:22:23 +10:00
Adrian Danis
1f2f6b98bb Use CONFIG_ variables instead of configuration definitions 2017-05-29 17:04:47 +10:00
Hesham Almatary
1930cf2e44 Fix: Allow util.h to be included in assembly files 2017-05-29 15:45:22 +10:00
Hesham Almatary
7ec01d0992 ARM32: typedef vspace_root_t
Similar to x86, and avoid #ifdefs in fastpath.c arch-independent code
2017-05-18 13:35:33 +10:00
Anna Lyons
9ca253a3d0 SELFOUR-879: expose index and entry constants 2017-05-09 11:35:52 +10:00
Anna Lyons
fc0f1eec76 kernel entry tracking: track VMExit and VCPUfault 2017-05-08 10:10:37 +10:00
Stephen Sherratt
2c398b7bf6 Abstract setting ipc buffer register into arch fn 2017-05-05 16:01:51 +10:00
Anna Lyons
50d72007c6 SELFOUR-862: CONFIG_PRINTING --> seL4_DebugPutChar
seL4_DebugPutChar is only available when CONFIG_PRINTING is enabled
2017-05-04 16:07:16 +10:00
Bamboo
8ce9513d7a [STYLE_FIX] 2017-05-04 01:48:32 +00:00
Adrian Danis
a5fa9570fc Change hasVCPU to generic archInfo boolean in public interfaces
The Arch_hasVCPU function instead of cheaking for whether a thread has a VCPU was
specifically checking for whether a thread on aarch32 had a VCPU, as that was the
condition needed to be passed into sanitiseRegister. This made the implementation
on x86 extremely confusing as Arch_hasVCPU was implemented to return false due to
there being no need for sanitiseRegister on x86 to know whether there was a vcpu.

This commit changes hasVCPU variables to be an abstract archInfo boolean that can
be used arbitrarily by an architecture. Arch_hasVCPU function was also changed to
become Arch_getSanitiseRegisterInfo whose result only passed to sanitiseRegister.
2017-05-04 11:18:03 +10:00
Adrian Danis
8523406990 Use unverified_compile_assert in cases where OFFSETOF is used
OFFSETOF is not supported by the C parser, and so regular compile_assert may not be used
2017-05-04 11:13:31 +10:00
Adrian Danis
038018be65 Use OFFSETOF instead of directly using __builtin_offsetof 2017-05-04 11:13:31 +10:00
Adrian Danis
019f965e7d arm: Use unverified_compile_assert instead of manual #ifdef wrapping 2017-05-04 11:13:31 +10:00
Adrian Danis
ae0937a053 Add unverified_compile_assert
This version of compile_assert is not expanded during verification builds and
can be used in cases where you would like an assertion that contains syntax
that is not supported by the C parser
2017-05-04 11:13:31 +10:00
Adrian Danis
52834951dc Add missing include in assert.h 2017-05-04 11:13:31 +10:00
Adrian Danis
0a0c27227e x86: Remove trailing semicolons in asm statements
These semicolons are not actually necessary, and cause problems for the C parser
2017-05-04 11:13:31 +10:00
Kent McLeod
d13544c737 SELFOUR-865: Pass memory map information to user 2017-05-03 16:17:03 +10:00
Adrian Danis
551e73f22f Check for configuration variables being 'defined' instead of 'true'
This is to conform with existing style of checking configuration options
2017-05-03 10:35:44 +10:00
Anna Lyons
beddca16cd libsel4: Add seL4_FastMessageRegisters
This allows benchmarks and utility code to only set registers in the ipc
buffer as required.
2017-05-02 11:08:11 +10:00
Rafal Kolanski
0f0680835c arm fastpath: reorder vcpu_switch / armv_contextSwitch_HWASID
In the original slow path, armv_contextSwitch_HWASID shoots first.

Verification can't reorder machine operations on hardware state we don't
model. This puts the fastpath into the same order as the slow path.
2017-04-29 19:53:32 +10:00
Joel Beeren
d7cf973002 Refactor sanitiseRegister to take a bool rather than a (tcb_t *).
This involves adding a function to determine if a tcb has a vcpu, and
makes verification a lot easier for arm-hyp.
2017-04-27 15:50:22 +10:00
Adrian Danis
b861f28498 Move isRunnable from thread.c to thread.h
This helper function is useful beyond just thread.c
2017-04-26 09:36:43 +10:00
Adrian Danis
353f05747f arm: Pass 'call' down to invokeVCPUReadReg
invokeVCPUReadReg should not be setting message registers for the return message unless
the user performed a call. In doing so we must refactor the call to readVCPUReg to
outside the introduced `if` condition since, as it performs machine operations, it
should always happen
2017-04-24 15:54:32 +10:00
Adrian Danis
43dea0680c x86: Correct multiboot info definition
The fields in the multiboot_info structure have precise sizes and should not use pointers
types as these sizes change between ia32 and x86_64 builds. This commit changes such
fields to be the correct fixed size uint32_t
2017-04-20 16:22:52 +10:00
Anna Lyons
8c02bc1301 x64: implement seL4_BenchmarkFlushCaches
by moving the ia32 implementation up a level to x86
and implementing the syscall stub.
2017-04-11 14:14:10 +10:00
Anna Lyons
37fef55a27 trivial: remove unused 'bound' field from ntfn 2017-04-11 13:59:54 +10:00
Adrian Danis
4e3839e315 Move standalone autoconf.h files out of include directories
When performing non standalone builds a separate autoconf.h file is generated and defines
the configuration of the kernel. Currently the directory with that file as well as the
kernels include/plat/${PLAT} directory are both listed as include directories to the
compiler. Due to the directory with the generated autoconf.h being earlier in the -I
list the generated autoconf.h will be used in preference to the standalone autoconf.h.

Relying on the order of -I directives is too unstable and so this commit moves the
autoconf.h files to a dedicated configs directory, which is only added as a -I
directive if a standalone build is being performed.
2017-04-10 11:16:57 +10:00
Rafal Kolanski
73db41687e arm hyp: make invokeVCPUInjectIRQ index arg unsigned long
Argument passed to it comes directly from a word_t so it shouldn't be
signed. Also, verification.
2017-04-06 13:45:43 +10:00
Adrian Danis
0abc720277 s/DEBUG/CONFIG_DEBUG_BUILD/
DEBUG definition is not supposed to be used in the kernel, rather CONFIG_DEBUG_BUILD,
which can be toggled separately to user notion of DEBUG
2017-04-06 10:43:24 +10:00
Stephen Sherratt
b70374eb48 Add debug_printUserState 2017-04-05 16:54:50 +10:00
Rafal Kolanski
7680bab494 tk1: disable SMMU in autoconf.h
This is overwritten by KConfig but used on verified platform where the
SMMU is likely to come much later.
2017-04-05 09:50:52 +10:00
Rafal Kolanski
9b17e8afca tk1: maxIRQ off-by-one w.r.t. N_INTERRUPTS 2017-04-04 15:59:40 +10:00
Rafal Kolanski
9098528719 tk1: set CONFIG_NUM_DOMAINS=16 for verified kernel 2017-04-04 11:55:07 +10:00
Bamboo
c5b52b044c [STYLE_FIX] 2017-04-03 05:17:15 +00:00
Kofi Doku Atuah
4b491dcf0c SELFOUR-836: arm-hyp: Config option for saving/loading vs trapping debug state
Provides a configuration option for enabling HDCR.TD* traps, or saving and loading debug
state on VCPU switches. Currently verification only plans to support the trap setting.

As this option complicates all of the #ifdef's related to debug registers even further,
abstractions for enabling/disabling each individual piece of the debug code for different
configuration options are also implemented.

Part of these refactored #ifdef guards was to remove the guards completely from libsel4
around the definitions of the number of breakpoints and watchpoints.
2017-04-03 14:21:27 +10:00
Kofi Doku Atuah
3cbe825a6f SELFOUR-836: arm: Correctly trap all debug events
We were previously using UNPREDICTABLE behaviour, because we were setting
HDCR.TDE without setting the other debug-related bits in HDCR.

Also, don't duplicate code: just call setHDCRTrapDebugExceptionState
within initHDCR().
2017-04-03 14:20:43 +10:00
Adrian Danis
67b829df1b SELFOUR-836: arm: Move Arch_initBreakpointContext prototype
This prototype was previously intermingled with struct definitions, so this moves it
to be located with the other function prototypes
2017-04-03 14:14:46 +10:00
Kofi Doku Atuah
3f90fad605 SELFOUR-836: Hardware debug API functions should take tcb_t and not arch_tcb_t
Touches files all throughout x86 (32 and 64) and ARM.
2017-04-03 14:14:00 +10:00
Kofi Doku Atuah
4e5cc369ff SELFOUR-836: Debug-API: setup initial debug context in BOOT_CODE
A more efficient way of setting up threads' initial context is implemented
by this patch: essentially instead of reading the debug coprocessor everytime
we create a thread, we read the coprocessor once at boot and then assign
those pre-read values when initializing threads.
2017-04-03 13:51:23 +10:00
Rafal Kolanski
084649c787 split asm read in addressTranslateS1CPR on arm-hyp
Previous implementation read a 64-bit value from two registers in one go
and implicitly cast down to paddr_t.

C Parser cannot handle an asm register read into anything other than a
word.

Workaround: perform two 32-bit reads instead, returning one of them.
2017-03-31 01:51:17 +11:00
Rafal Kolanski
de6d4772ee rename arch_tcb.vcpu -> arch_tcb.tcbVCPU, vcpu.tcb -> vcpu.vcpuTCB
struct vcpu { struct tcb* tcb; ...
struct arch_tcb { struct vcpu* vcpu; ...
and
struct tcb { struct arch_tcb tcbArch; ...

These conspire to generate a type error on verification side due to
assumptions about non-colliding names.
2017-03-31 00:57:47 +11:00
amrzar
93cc22b289 smp: fix bugs when stalling remote core
- Restart TCB from inside the lock if it is waiting for anything other than IRQ
- Only replace the TCB with idle thread if it is in ThreadState_RunningVM state

Also, this makes the design generic to be shared with arm.
2017-03-30 09:46:43 +11:00
Adrian Danis
8f7f8502e7 SELFOUR-712: arm: enable user level PMU event counter on v7 2017-03-28 12:10:51 +11:00
Adrian Danis
c104c82f5a arm: Refactor constants from debug API
This removes some duplicated constants and moves some constants into debug.h such that
they are visible without the user debugging API enabled. These constants are useful
for configuring other debugging/performance monitoring features.
2017-03-28 12:10:31 +11:00
Kofi Doku Atuah
725d0dacfd SELFOUR-836: Disable debug context save/restore between VMs
This patch disables the debug register state save and restore on ARM-hyp,
such that Guest VMs can now interfere with one another and trigger
one another for certain limited scenarios. This will be undone later on.
2017-03-21 15:31:23 +11:00
Hesham Almatary
26c81b9ff4 x86: move pdpte_t to 64/mode and delete it for ia32 2017-03-17 09:50:52 +11:00
Hesham Almatary
2cd909b2e9 ia32: remove unsued ia32KSGlobalPDPT and PDPT defines 2017-03-17 09:50:52 +11:00