Commit graph

919 commits

Author SHA1 Message Date
Adrian Danis
a0cb9e6703 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
2016-11-22 16:56:33 +11:00
Adrian Danis
fc56575ea6 x64: Define TLB bitmap region
Defines the TLB bitmap to be located, virtually, just below the kernel
window. To get an initialized bitmap in each new address space we
change copyGlobalMappings to copy from USER_TOP (which includes the
initialized TLB bitmap in the global address space) instead of just
the kernel window base
2016-11-22 14:05:55 +11:00
Adrian Danis
d14a973a3d x86: Pass address space when invalidating ASID
For efficient TLB coherency on x86-64 it will be useful to know
the address space that the ASID being invalidated was last assigned to
2016-11-22 13:58:44 +11:00
amrzar
135b320b3b x86: extend APIC to support cluster IPIs 2016-11-22 13:43:37 +11:00
Adrian Danis
117c53e583 imx32: Update autoconf.h for standalone build 2016-11-22 11:53:29 +11:00
Adrian Danis
febe070a28 x86: increase IPI words to 3 2016-11-22 11:51:15 +11:00
Adrian Danis
d393278c0c ia32: Use wrappers for remote ops 2016-11-22 11:51:15 +11:00
Adrian Danis
db0a8184e7 SELFOUR-553: Update standalone kernel configurations
This changes the kernel configurations for the verified platform to
not use the globals frame.
2016-11-22 11:49:52 +11:00
Adrian Danis
e78cdf9b64 SELFOUR-553: Support alternate IPC buffer locations without globals frame
This commit adds support for using the ThreadID registers of the ARM MPCore
platforms for storing the address of the IPC buffer instead of the globals
frame. The choice of using the user readable/writeable ThreadID register
is chosen, even though it means the user cannot use it for its own
purposes, as it leaves room in the future for doing TLS support in the
user read only register, where compilers expect it.
2016-11-22 11:49:52 +11:00
Adrian Danis
9f99e77c38 SELFOUR-553: Support ARM MPCore registers
This commit adds support for saving/restoring an additional register
that exists on ARM MPCore platforms. As this register is user wrieable,
as well as readable, it must saved and restored by the kernel to
prevent gross information channels.
2016-11-22 11:49:52 +11:00
Bamboo
1875861937 [STYLE_FIX] 2016-11-22 11:13:46 +11:00
amrzar
27afc1bd92 x86: add logical id mapping for x2APIC IPI boradcasting 2016-11-22 09:40:31 +11:00
Amirreza Zarrabi
becdb483a8 Merge pull request #506 in SEL4/sel4 from ~AZARRABI/sel4:x2apic_fence to master
* commit 'b216c194faacfa070ee963ede54c8020d6494f24':
  x86: add mfence as X2APIC MSRs are not serializing
2016-11-21 09:58:38 +11:00
Adrian Danis
51a0fad68c Merge pull request #505 in SEL4/sel4 from ~ADANIS/sel4:likely to master
* commit 'edc811a872e5d709c2ff78fadf85573cb51b6304':
  x86: Add likely to isValidVTableRoot_fp
2016-11-21 09:53:26 +11:00
amrzar
b216c194fa x86: add mfence as X2APIC MSRs are not serializing 2016-11-21 08:20:38 +11:00
Adrian Danis
edc811a872 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
2016-11-18 16:36:40 +11:00
Anna Lyons
8452068cc3 Move migration logic to own function
This makes it easier to port to the RT branch, where
migration can happen in several different places.
2016-11-18 16:34:13 +11:00
Adrian Danis
31628d9a58 Remove recycle
Removes the recycle operation and adds an operation
to cancel any badged sends on and endpoint. Calling
Revoke + CancelBadgedSend is equivalent to Recycle
on a badged endpoint
2016-11-18 14:10:01 +11:00
amrzar
2955bd46b2 add x2apic to x86-64 autoconfig 2016-11-18 07:26:12 +11:00
Amirreza Zarrabi
af81bb0fd5 Merge pull request #499 in SEL4/sel4 from ~AZARRABI/sel4:x2apic to master
* commit 'd746cc9cf61b6f50aee6aacf89e91b1f555b1a88':
  x86: enable support for x2APIC
2016-11-18 07:13:15 +11:00
amrzar
d746cc9cf6 x86: enable support for x2APIC 2016-11-17 16:32:57 +11:00
Adrian Danis
8a6936ff1d Remove incorrect CONST usage
This removes usages of CONST Arch_activateIdleThread. According to
gcc 'a function that has pointer arguments and examines the data
pointed to must not be declared const'. Whilst these functions do
not presently examine their tcb_t pointer argument, it seems
pointless to pass something that can never be safely looked at.

Further a function that returns void and is CONST is utterly meaningless
2016-11-17 11:51:46 +11:00
Adrian Danis
7f76749448 Revert SELFOUR-242
This reverts commits
3aee0ab7b3
6b6b965528
a1421832ac
2016-11-16 14:02:11 +11:00
Anna Lyons
a1421832ac SELFOUR-242: invert bitfield scheduler & optimise
This commit does the following:

* invert the bit field scheduler for better cache performance for high priority threads
* peeks into the bitfield scheduler to allow fastpath to be leveraged when IPC occurs from lo --> hi priority threads if correct
2016-11-15 09:45:48 +11:00
Adrian Danis
90f6a9863b x86: Initial support for SMP vt-x
Enables vt-x code to compile when CONFIG_MAX_NUM_NODES is set to
greater than 1 and adds code to manage VMCS state on different cores
2016-11-11 14:04:39 +11:00
Adrian Danis
2c49729da5 x86: Refactor tlb_bitmap to be mode generic
Refactors the TLB bitmap code to be generic across ia32 and x86-64.
2016-11-09 15:24:17 +11:00
Adrian Danis
9c91fc8f42 x86: Refactor generic x86 pte/pde manipulation
Previously generic functions for manipulating page table and page
directory entries were placed in mode/structures.h. These are moved
to a mode/vspace.h instead so that they can use existing functions
defined in arch/vspace.h.

The x86_make_pde_mapping function is dropped in this move as it is
not used. Instead it is replaced with a function for creating an
empty mapping for whatever is the vspace root.
2016-11-09 15:23:40 +11:00
amrzar
ffd0f34b39 Clean up x86KScurInterrupt:
1. Remove the locking dependancy on the value of x86KScurInterrupt
2. Remove confusing set/unset of x86KScurInterrupt
2016-11-09 14:22:04 +11:00
amrzar
b46e98c10e smp: solve bug in tlb_bitmap
1. Missing loop counter when accessing to PD in 'tlb_bitmap_get'.
2. Missing 'TLBBITMAP_PD_INDEX' in 'TLBBITMAP_PD_MAKE_INDEX'. The index generated by 'TLBBITMAP_PD_MAKE_INDEX' should be valid in PD while the original one used to generate just 0, 1, etc. The correct index is '0 + TLBBITMAP_PD_INDEX', '1 + TLBBITMAP_PD_INDEX' and so on.
2016-11-09 10:00:56 +11:00
Bamboo
846254be1f [STYLE_FIX] 2016-11-08 05:55:43 +00:00
Anna Lyons
c86669df43 x86: export tsc freq in bootinfo
We read the frequency from the platform info MSR and export it to the
user for accurate timing (for platforms that support platform into)
2016-11-08 14:46:18 +11:00
Adrian Danis
828a14d853 SELFOUR-222: Configure IRQ cnode size per platform 2016-11-08 11:48:31 +11:00
Adrian Danis
808f68e1be x64: Mode specific IPI definitions 2016-11-07 15:02:29 +11:00
Adrian Danis
9899c60c8b x86: Reduce number of irqs to 128
On x86-64 the irq cnode will be larger than a page if there is more
than 128 irqs.
2016-11-07 14:58:46 +11:00
Adrian Danis
1173e19aa6 x86: kernelSP only needed for ia32 2016-11-07 14:58:46 +11:00
Adrian Danis
6f908324f8 x64: Access core local state correctly 2016-11-07 14:58:46 +11:00
Adrian Danis
8b5ec01626 x86: Split IPIs into arch and mode portions 2016-11-07 14:53:46 +11:00
amrzar
44fc989cc5 Store remote FPU state 2016-11-07 14:41:25 +11:00
Bamboo
b90b715818 [STYLE_FIX] 2016-11-07 13:27:52 +11:00
Adrian Danis
61c1a4c4ff x64: Mode specific smp file 2016-11-07 12:18:43 +11:00
Adrian Danis
a726b4bea5 x86: Split CPU ID management into mode and general
This moves getCurrentCPUIndex into a mode specific smp header, and
moves wrappers that use it into the generap smp header
2016-11-07 11:46:08 +11:00
Adrian Danis
76b9441eee x86: Remove unused function 2016-11-07 11:44:57 +11:00
amrzar
056dbf811b SELFOUR-634: support for TLB and cache management 2016-11-07 10:55:05 +11:00
Anna Lyons
4a82597b7a trivial: change remoteTCBStall to take tcb
Instead of cap_t. This allows the function to be used from other
functions that have the tcb pointer and not the cap.
2016-11-07 10:37:17 +11:00
Adrian Danis
ab91c11a4f Merge pull request #459 in SEL4/sel4 from ~ADANIS/sel4:smmu to master
* commit '858fa717c6a30fe1f0514c4ad8bbbe1003016864':
  tk1: Remove temporary SMMU memory mapping support
  arm: Remove lookup error message
  arm: Correctly mask SMMU PT addresses
  tk1: Correct SMMU PD and PT indexing
2016-11-03 05:05:38 +00:00
Adrian Danis
a85472a951 x86: Always consider FPU owernship of threads core
When checking if a thread is using the FPU or not we now check on that
threads core, under the assumption that if a thread migrates its FPU
state is explicitly (and not lazily) migrated.
2016-11-03 10:18:24 +11:00
Adrian Danis
858fa717c6 tk1: Remove temporary SMMU memory mapping support 2016-11-02 15:12:56 +11:00
Adrian Danis
e3be5fa8e4 tk1: Correct SMMU PD and PT indexing 2016-11-02 15:12:56 +11:00
amrzar
3b19198bf4 Include vspace remote call support 2016-11-02 15:00:19 +11:00
amrzar
658eb090db Extend IPI for two function parameters 2016-11-02 13:47:29 +11:00
Thomas Sewell
03c71b63e1 SELFOUR-444: Preemptible zeroing for retype.
Change to the order of operations and timing behaviour of
invokeUntyped_Retype. The Retype operation now zeroes the
entire range of the Untyped cap (if it is being used for
the first time) before installing any objects. This avoids
the need for long-running initialisation of large objects,
whose initial contents are always zero. The initial zeroing
phase is preemptible, and may take multiple timeslices to
complete.
2016-11-01 17:05:36 +11:00
Bamboo
061f1b8d49 [STYLE_FIX] 2016-11-01 02:56:15 +00:00
amrzar
a228c492a6 Incuede TLBBitmap in PD to keep track of cores currently accessing this PD 2016-11-01 10:07:57 +11:00
Amirreza Zarrabi
b2295ea036 Merge pull request #434 in SEL4/sel4 from ~AZARRABI/sel4:sceduler_multicore to master
* commit '25bb94372fe4afce072959af88c1afe9ff1c67d3':
  SELFOUR-635: support for TCB operations This will update TCB invocations to consider multicore environment, this may include: - adds the affinity invocation to transfer TCB between different cores and update TCB structure for core ID - checking the thread/core state before performing TCB operation, e.g. deleting the runnable TCB, etc
2016-10-30 23:11:25 +00:00
Kent Mcleod
436b214ec6 Merge pull request #444 in SEL4/sel4 from ~KMCLEOD/sel4:pr to master
* commit '66dfc2e786614a34c18ad2d7c20c04c69e589a97':
  Change ia32 to use fs register for IPC buffer
2016-10-30 23:00:44 +00:00
amrzar
25bb94372f SELFOUR-635: support for TCB operations
This will update TCB invocations to consider multicore environment, this may include:
- adds the affinity invocation to transfer TCB between different cores and update TCB structure for core ID
- checking the thread/core state before performing TCB operation, e.g. deleting the runnable TCB, etc
2016-10-30 08:59:32 +11:00
Kent McLeod
66dfc2e786 Change ia32 to use fs register for IPC buffer
gs register is used by gcc for TLS and the IPC buffer gets in the way
2016-10-28 16:40:38 +11:00
Anna Lyons
40383a9882 Fix arm builds broken in 44ed6adb6 2016-10-28 16:16:04 +11:00
Anna Lyons
f0cb354755 Merge pull request #410 in SEL4/sel4 from ~ALYONS/sel4:cache to master
* commit '44ed6adb616590a0f6ae8b0ad8c442afed625457':
  add seL4_BenchmarkFlushCaches() for arm and ia32
2016-10-28 04:21:25 +00:00
Anna Lyons
44ed6adb61 add seL4_BenchmarkFlushCaches() for arm and ia32
Available when CONFIG_ENABLE_BENCHMARKS is set, flushes caches for
running cold-cache benchmarks
2016-10-28 15:09:03 +11:00
Adrian Danis
261d1f536c arm: Use #define for tcbArchCNodeEntries
Using a #define allows the post processed C code to be identical
for the purposes of verification
2016-10-28 13:58:22 +11:00
Adrian Danis
30f1d1fa7b x86: Comment #endif blocks for clarity 2016-10-28 13:51:21 +11:00
Bamboo
120a5e5496 [STYLE_FIX] 2016-10-28 01:34:31 +00:00
Adrian Danis
0012ea3e2e x86: fix FPU under SMP builds 2016-10-28 12:20:17 +11:00
Adrian Danis
da409659d0 x64: Match ASID changes on ia32 2016-10-28 12:14:16 +11:00
Adrian Danis
e83769322f x64: Update IO port cap type to match ia32 2016-10-28 12:13:42 +11:00
Adrian Danis
f8e6b4d9d6 x64: Guard vt-x that is not yet implemented
These guards are needed because vt-x is not yet properly supported
in x86-64 builds. Once it is these guards can be removed again
2016-10-28 12:12:46 +11:00
Adrian Danis
679d28c992 x64: Correct FPU handling code 2016-10-28 12:12:04 +11:00
Bamboo
6a86cbf5c7 [STYLE_FIX] 2016-10-27 05:34:49 +00:00
Adrian Danis
7fbde1bbcb SELFOUR-287: 32-bit vt-x implementation
This is an implementation of vt-x for x86 kernels running in
ia32 mode.
2016-10-27 16:20:30 +11:00
amrzar
f050e6a9c5 implement layout of ipi interrupt handling 2016-10-23 12:21:14 +11:00
Adrian Danis
ea47c2d4a4 Remove self include 2016-10-21 12:05:02 +11:00
Adrian Danis
ccb2e4b446 Remove circular include
machine/hardware.h is already including machine/interrupt.h
2016-10-21 12:05:02 +11:00
Adrian Danis
80dbdf5ed0 Remove unused include 2016-10-21 12:05:02 +11:00
Adrian Danis
7c08bc25e9 Remove include of basic_types
arm/arch/types.h does not require any definitions from basic_types
(other than those from stdint, which is already directly included)
2016-10-21 12:05:02 +11:00
Adrian Danis
63649f2636 Remove arch/machine.h include from statedata.h
statedata.h gets included from arch/machine.h, and statedata
does not require any of the machine.h definitions.

As a result of removing this various other, previously missing,
includes need to be added
2016-10-21 12:05:02 +11:00
Adrian Danis
b90238d089 Replace #pragma once with include guards 2016-10-21 12:05:02 +11:00
Adrian Danis
d6eafad1a5 Move cap definitions from objecttype into header 2016-10-20 15:45:06 +11:00
Adrian Danis
325643ac19 Remove circular include between debug and benchmark_track
benchmark_track.h does not depend upon anything in debug.h and
so it does not need to include it. Once this include is removed
debug.h can pull its definition of ksKernelEntry from benchmark_track.h
2016-10-20 15:45:06 +11:00
Adrian Danis
c3370f770b x86: Remove circular include
x86/arch/machine/hardware.h gets include via types.h (through the
compound_types.h header). As this header is defining compound types
it really only needs access to the basic types (i.e. stdint.h)
2016-10-20 15:45:06 +11:00
Anna Lyons
49f26d5c84 Fix benchmark_debug_syscall_start
The lowest syscall number is -8, which doesnt' fit in 3 bits -> change
to 4.
Also, we were storing the -ve number, which also doesn't fit into 3
bits -> invert it when we store it.
2016-10-20 15:07:49 +11:00
Adrian Danis
1c50cec9e8 arm: Remove duplicate definitions
PPTR_TOP and KS_LOG_PPTR are defined in the mode headers, this commit
removes the duplicate definitions in the general arm header
2016-10-20 14:12:03 +11:00
Hesham Almatary
423f3eaf4a Merge pull request #423 in SEL4/sel4 from ~HALMATARY/sel4:benchmarkRefine to master
* commit 'e3f764a65be484d89e29ebc22ea406f1438ae3d3':
  Benchmark: move arch-dependent benchmark.c from api/ to new benchmark/ directory
  Benchmark: Pack arch-independent benchmark-related files into separate directories
2016-10-20 02:23:29 +00:00
Hesham Almatary
5f7fa2fcc8 Benchmark: Pack arch-independent benchmark-related files into separate directories 2016-10-20 11:42:04 +11:00
Adrian Danis
59f50c7183 x86: use vspace_root_t type
switchToThread_fp is passed variables of type vspace_root_t, not
pde_t, this commit brings the two into line
2016-10-20 11:07:55 +11:00
Adrian Danis
9396783741 am335x: Prevent out of bounds array access 2016-10-20 10:56:58 +11:00
amrzar
2d462d4ad9 add basic api for setting affinity 2016-10-19 08:35:37 +11:00
Anna Lyons
3a185a5c32 debug: generate list of syscall names 2016-10-18 14:05:41 +11:00
Rafal Kolanski
01e0ed7d9a Merge pull request #406 in SEL4/sel4 from ~ADANIS/sel4:lazyvcpu to master
* commit 'cdc869309b69d04c8682f166755c26cc7a401667':
  arm_hyp: Used cached value for num LRs
  arm_hyp: Add lazy vcpu switching
  arm_hyp: Declare armHSCurVCPU in header
  arm_hyp: Correctly destroy armHSCurVCPU
  arm_hyp: Move hype state into correct statedata header
2016-10-17 04:25:01 +00:00
Adrian Danis
cfe0f8e9db 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.
2016-10-14 15:47:16 +11:00
Adrian Danis
2a1d1e94d7 arm_hyp: Add lazy vcpu switching 2016-10-14 14:24:12 +11:00
Adrian Danis
04612f16c6 arm_hyp: Declare armHSCurVCPU in header 2016-10-14 14:24:12 +11:00
Adrian Danis
fdad50853a arm_hyp: Move hype state into correct statedata header
The hypervisor state is declared in arch/32/statedata.c, but is
defined in arch/statedata.h. This commit moves the definitions to
arch/32/statedata.h to match all the other state in arch/32/statedata.c
2016-10-14 14:24:12 +11:00
Amirreza Zarrabi
36e5db7aac Merge pull request #399 in SEL4/sel4 from ~AZARRABI/sel4:smp_idle to master
* commit '1887ae9dce65c3a32df244c19b635cbe5e3d72bf':
  Update SMP idle thread handling
2016-10-14 00:22:46 +00:00
amrzar
1887ae9dce Update SMP idle thread handling 2016-10-14 11:15:39 +11:00
Adrian Danis
235a02ec4e x86: Use FLAGS_* defines instead of magic numbers 2016-10-13 16:58:27 +11:00
Adrian Danis
b01cf7f0d7 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
2016-10-13 16:49:11 +11:00
Adrian Danis
a4c014ca8e x64: Missing c_exit_hook 2016-10-13 15:26:37 +11:00
Adrian Danis
d1d4568114 x86: Define FLAGS bits instead of having magic numbers 2016-10-12 14:38:00 +11:00
Adrian Danis
a3c88cfc5b pc99: Update autoconf.h for standalone builds 2016-10-12 14:18:55 +11:00
Bamboo
f062dcdcf9 [STYLE_FIX] 2016-10-12 03:07:32 +00:00
Adrian Danis
6d07c44329 x64: Partial hardware breakpoint support
This only implementes debug support if using the SYSCALL kernel invocation
method, will not work yet with SYSENTER
2016-10-12 13:38:37 +11:00
Adrian Danis
6294225ca7 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
2016-10-12 13:38:35 +11:00
Adrian Danis
e2bf4881c8 x64: Refactor Arch_initContext
Split Arch_initContext into mode and arch portions
2016-10-12 13:38:26 +11:00
Adrian Danis
48df6d3ab4 x64: Define kernelBase for breakpoint code 2016-10-12 12:22:32 +11:00
Adrian Danis
600fe2bc09 x86: Move hardware debug state
Assembly traps rely on the registers and kernel stack being at a
known offset
2016-10-12 12:22:32 +11:00
Adrian Danis
9c1d204eaf x64: Correctly invalidate PCIDs 2016-10-12 12:22:32 +11:00
Adrian Danis
4f09f9c42d x86: Refactor elf code 2016-10-12 12:22:32 +11:00
Adrian Danis
7d50c439a8 Defined untyped size ranges in libsel4 2016-10-12 12:22:32 +11:00
Adrian Danis
4c94f43c51 x64: Fastpath 2016-10-12 12:22:32 +11:00
Adrian Danis
f3094f2e86 x64: extend message_info_t to 64-bit 2016-10-12 12:22:32 +11:00
Adrian Danis
067b71cad4 x64/libsel4: Add x64 libsel4 implementation 2016-10-12 12:22:32 +11:00
Adrian Danis
7f9970e5e2 x64: Add x86_64 support 2016-10-12 12:22:31 +11:00
Adrian Danis
726f5edaf5 x64: Check size of unsigned long 2016-10-12 12:06:22 +11:00
Adrian Danis
03ec049d6b x64: 64-bit elf loading 2016-10-12 12:06:22 +11:00
Bamboo
e1d4ffd13e [STYLE_FIX] 2016-10-12 00:17:10 +00:00
amrzar
f80be7055b Add VISIBLE attrubute to UP states 2016-10-12 10:11:51 +11:00
amrzar
3f9eb7c873 SELFOUR-632: implement cores non-architecture dependent structres 2016-10-10 16:33:48 +11:00
Kofi Doku Atuah
bebfcf6d27 SELFOUR-499: X86, ARM: Add userspace invocations for hardware debugging
This commit implements the body of SELFOUR-499. The API exposes the x86 DR0-7
and ARM coprocessor 14 features to userspace by virtualizing them as context-
switched registers in the TCB. Implemented as TCB invocations. This feature is
only built when CONFIG_HARDWARE_DEBUG_API is selected.

* Add low-level support routines for setting, unsetting, getting, enabling
  and disabling breakpoints.
* Add support for single-stepping as well.
  ^ Single-stepping is not supported on ARMv6 since the hardware
    doesn't have support.
  ^ ARM implements single-stepping as instruction breakpoints
    configured to fault on every instruction -- this is achieved through
    the "mismatch" mode, which is only supported from ARMv7 onwards.
* Also support explicit software break requests, a la "BKPT" and "INT $3".

* New invocations:
  * seL4_TCB_SetBreakpoint().
  * seL4_TCB_GetBreakpoint().
  * seL4_TCB_UnsetBreakpoint().
  * seL4_TCB_ConfigureSingleStepping().
* New constants:
  ^ Event types:
    ^ seL4_InstructionBreakpoint.
    ^ seL4_DataBreakpoint.
    ^ seL4_SoftwareBreakRequest.
  ^ Access types:
    ^ seL4_BreakOnRead.
    ^ seL4_BreakOnWrite.
    ^ seL4_BreakOnReadWrite.
  ^ Exports:
    ^ seL4_NumHWBreakpoints.
    ^ seL4_NumExclusiveBreakpoints.
    ^ seL4_NumExclusiveWatchpoints.
    ^ seL4_NumDualFunctionMonitors.
    ^ seL4_FirstBreakpoint.
    ^ seL4_FirstWatchpoint.
    ^ seL4_FirstDualFunctionMonitor.

See documentation in the seL4 API manual.
2016-10-10 13:53:21 +11:00
Kofi Doku Atuah
8b39c73544 Define kernelBase for 32-bit x86. 2016-10-06 16:03:04 +11:00
Bamboo
e3974daac1 [STYLE_FIX] 2016-10-06 01:10:16 +00:00
amrzar
e63be664c6 SELFOUR-631: implement CLH lock and barrier infrastructure 2016-10-06 11:50:57 +11:00
Adrian Danis
45622671de x86: Define large frame types 2016-10-06 07:39:25 +11:00
Adrian Danis
602836a21b x86: Generic setCurrentVSpaceRoot
Defines a generic setCurrentVSpaceRoot to replace setCurrentPD in
mode generic code
2016-10-06 07:39:25 +11:00
Adrian Danis
74cb86c202 x86: Support for syscall
syscall/sysret is an additional way of performing kernel entry/exits.
Whilst the instructions themselves are not supported when running
in 32-bit mode, this commit provides the config choice for them as
well as the generic support code for them.
2016-10-06 07:39:24 +11:00
Adrian Danis
d72cd75136 x86: Rename invalidateTLBentry->invalidateTLBEntry 2016-10-05 16:40:43 +11:00
Anna Lyons
7336303b7f SELFOUR-276: Add MCP field to threads.
Where MCP = Maximum Controlled Priority

This commit adds:

* seL4_TCB_SetMCPriority

and changes the arguments to

* seL4_TCB_Configure

As of this commit, a thread cannot create or set a threads
priority (including itself) above its mcp. Previously the kernel
did this check against a threads priority, which prevented a thread
from setting it's own priority down and then up again.
2016-10-05 11:11:19 +11:00
Adrian Danis
43772b2dc2 x86: Rename decodeIA32PortOperation->decodeX86PortOperation 2016-10-04 11:17:35 +11:00
Adrian Danis
2320d90904 x86: Fixup IOMMU implementation
Adds a mapping type to frame caps that tracks
what kind of hierarchy the cap is mapped into;
an MMU, IOMMU and in the future an EPT structure.

Additionally the IOMMU code is updated to
have correct functionality and be verification
friendly.
2016-09-29 16:11:11 +10:00
Kofi Doku Atuah
b1f8d21e96 TK1: Split the mux controller from the misc region
The TK1 manual's address map has a 16K MMIO region called the "Misc" region,
where they lump together several controllers that aren't all page aligned,
including a USB controller and a SATA controller of some kind.

They also lump the pinmux controller into this "misc" region, but the
pinmux controller is at a page aligned boundary, and has no other devices
sharing that page, so it can be split off into its own device untyped.

This also makes it easier to request that mapping from userspace.
2016-09-29 15:13:16 +10:00
amrzar
2cbc7123b6 SELFOUR-630:preliminary booting application processors
- update core detection code and Kconfig file
    - update kernel stack managment so that BSP does not use boot stack before IPI APs
    - move arch dependant data to a single structure
    - add cache line size to Kconfig
    - add cpu indexing and apic id mapping
    - boot APs to halting state
    - add guard for kernel stack if there is only one core
2016-09-28 16:10:25 +10:00
Adrian Danis
017cb20b78 arm: Move ACTLR functions out of pl2 headers
The ACTLR register is not a PL2 exclusive register, and is architecturally
defined to exist (although the contents of the register are implementation defined).
2016-09-27 09:34:29 +10:00
Anna Lyons
6f00118314 trivial: move ksKernelEntry definition
so debug builds can see it. Not sure how this built previously?
2016-09-23 15:13:38 +10:00
Adrian Danis
2a84b7d792 Merge pull request #120 in SEL4/sel4 from ~ADANIS/sel4:deviceuntyped to master
* commit '8e77cdb5e91e971f49747492a3350c2b443a3827':
  SELFOUR-421: Add padding for untyped in bootinfo
  SELFOUR-421: minor changes for c-refine
  SELFOUR-421: fix up boolean equality in Arch_sameObjectAs
  SELFOUR-421: added device check to sameObjectAs
  SELFOUR-421: Arch_createObject changed to use new user_data_device in ghostupdates for device pages
  SELFOUR-421 Introduce explicit device frames and untypeds
2016-09-23 04:16:22 +00:00
Joel Beeren
2d74ae7eb8 SELFOUR-421: Arch_createObject changed to use new user_data_device in ghostupdates for device pages 2016-09-23 14:15:09 +10:00
Adrian Danis
d507b2d39e SELFOUR-421 Introduce explicit device frames and untypeds
Kernel objects cannot be created from device untypeds, with the
exception of frames, which do not get zeroed and cannot be used
as an IPC buffer. Device untypeds additionally cannot be used
in the construction of ASID pools.

This then changes the API to the rootserver (i.e. bootinfo) to
send device untypeds instead of device frames. On ARM these
device untypeds are the same as the previously exported device
frame regions. On x86 PCI scanning is removed and all physical
memory addresses (that are not important for kernel integrity)
are released to the user.

In order to have bits in the frame and untyped caps on ARM the
number of software ASIDs had to be reduced from 2^18 to 2^17,
and the maximum untyped size reduced from 2^31 to 2^30
2016-09-23 14:15:08 +10:00
Kofi Doku Atuah
97a9b9ab9e Fix TCB Max-name-length macro
The previous macro computed to (0 - sizeof(tcb_t)). Basically a negative
number, which is just a really big unsigned number, so this macro was
basically allowing TCB naming of any length.
2016-09-22 15:37:34 +10:00
Adrian Danis
4044e20412 Revert "Merge pull request #358 in SEL4/sel4 from ~AZARRABI/sel4:multicore to master"
This reverts commit ce2f666bb8, reversing
changes made to dc183f96b8.
2016-09-22 14:22:18 +10:00
Adrian Danis
8ffc353172 Revert "[STYLE_FIX]"
This reverts commit d29f743bbc.
2016-09-22 14:22:08 +10:00
Adrian Danis
7f4694ec3e pc99: Update standalone config with CACHE_LN_SZ 2016-09-22 14:10:08 +10:00
Bamboo
d29f743bbc [STYLE_FIX] 2016-09-22 04:01:23 +00:00
Amirreza Zarrabi
ce2f666bb8 Merge pull request #358 in SEL4/sel4 from ~AZARRABI/sel4:multicore to master
* commit 'fbc071b4f11b3d7d423e26908a661f416b07cda2':
  SELFOUR-630:preliminary booting application processors - update core detection code and Kconfig file - update kernel stack managment so that BSP does not use boot stack before IPI APs - move arch dependant data to a single structure - add cache line size to Kconfig - add cpu indexing and apic id mapping - boot APs to halting state - add guard for kernel stack if there is only one core
2016-09-22 03:59:32 +00:00
Kofi Doku Atuah
df6fe18acf Link libsel4's macros.h into the kernel
Also, include libsel4 macros.h link in types.h.
2016-09-21 13:57:44 +10:00
amrzar
fbc071b4f1 SELFOUR-630:preliminary booting application processors
- update core detection code and Kconfig file
- update kernel stack managment so that BSP does not use boot stack before IPI APs
- move arch dependant data to a single structure
- add cache line size to Kconfig
- add cpu indexing and apic id mapping
- boot APs to halting state
- add guard for kernel stack if there is only one core
2016-09-21 12:14:10 +10:00
Hesham Almatary
9e104c1626 Merge pull request #353 in SEL4/sel4 from ~HALMATARY/sel4:BenchmarkReset to master
* commit '8808ba7fa00591528c1c730c6cfeb4ee6ef82e8b':
  Benchmark: Implement per-thread reset syscall
2016-09-20 00:22:49 +00:00
Kent McLeod
41ec5cf754 SELFOUR-537: Support for raspberry pi3 2016-09-19 15:53:53 +10:00
Stephen Sherratt
5a0bdb7480 Store active irq in global variable on kzm
The first time the irq number is read from the controller, the interrupt
is acknowledged. Subsequent reads of the irq number result in an invalid
irq number being read.

This modifies the kzm interrupt controller driver to save the current irq
number when it's first read from the interrupt controller, preventing the
need for future reads from the controller until the next interrupt arrives.
2016-09-14 13:43:35 +10:00
Hesham Almatary
8808ba7fa0 Benchmark: Implement per-thread reset syscall 2016-09-12 13:54:12 +10:00
Adrian Danis
4491cae521 SELFOUR-556: Rationalize BITS vs INDEX_BITS
s/PGD_BITS/PGD_INDEX_BITS
Current convention is to say that X_BITS is the log base 2
size of an object, not the log base 2 number of indices
2016-08-31 09:24:47 +10:00
Adrian Danis
35c50cfdaf SELFOUR-556: Rationalize BITS vs INDEX_BITS
s/PD_BITS/PD_INDEX_BITS
Current convention is to say that X_BITS is the log base 2
size of an object, not the log base 2 number of indices
2016-08-31 09:24:47 +10:00
Adrian Danis
3cde4fa8f3 SELFOUR-556: Rationalize BITS vs INDEX_BITS
s/SMMU_PD_BITS/SMMU_PD_INDEX_BITS
Current convention is to say that X_BITS is the log base 2
size of an object, not the log base 2 number of indices
2016-08-31 09:24:47 +10:00
Adrian Danis
f251953f60 SELFOUR-556: Rationalize BITS vs INDEX_BITS
s/PT_BITS/PT_INDEX_BITS
Current convention is to say that X_BITS is the log base 2
size of an object, not the log base 2 number of indices
2016-08-31 09:24:47 +10:00
Adrian Danis
1103e5a30b SELFOUR-556: Rationalize BITS vs INDEX_BITS
s/ASID_POOL_BITS/ASID_POOL_INDEX_BITS
Current convention is to say that X_BITS is the log base 2
size of an object, not the log base 2 number of indices
2016-08-31 09:24:47 +10:00
Adrian Danis
bbc98573e7 SELFOUR-556: Rationalize BITS vs INDEX_BITS
s/VTD_PT_BITS/VTD_PT_INDEX_BITS
Current convention is to say that X_BITS is the log base 2
size of an object, not the log base 2 number of indices
2016-08-31 09:24:47 +10:00
Adrian Danis
935b055c5e SELFOUR-556: Rationalize BITS vs INDEX_BITS
s/PDT_BITS/PDPT_INDEX_BITS
Current convention is to say that X_BITS is the log base 2
size of an object, not the log base 2 number of indices
2016-08-31 09:24:47 +10:00
Bamboo
f4188c6cd3 [STYLE_FIX] 2016-08-31 08:59:24 +10:00
Amirreza Zarrabi
92c95c8f0e Merge pull request #335 in SEL4/sel4 from ~AZARRABI/sel4:halt_recur to master
* commit '57f1352ff70cb2de18768174d257d151e4fd12e8':
  SELFOUR-614: calling halt() on the hikey platform results in infinite data abort SELFOUR-408: halt does not halt
2016-08-30 22:19:00 +00:00
Thomas Sewell
702f8c6902 Fix prototyping for constant address pointers.
Previous change adf91d4be0
introduces const inconsistently for two pointers.
2016-08-29 13:58:43 +10:00
Hesham Almatary
fb19c78e12 Benchmark: Share trace point log structure with the user 2016-08-26 11:13:05 +10:00
Hesham Almatary
5ef4cbfa7f Benchmark: Fix bug when trace points enabled with user-level log buffer
After the user-level log buffer addition, any code that writes to the log must
check if the user has already set a log buffer properly.
2016-08-25 10:54:11 +10:00
Bamboo
362e41f285 [STYLE_FIX] 2016-08-24 11:40:27 +10:00
Anna Lyons
ada2fc5f14 SELFOUR-624: fix ia32 debug build
- separate putDebugChar and putConsoleChar
- this only has effect on x86 where 2 serial ports are initialised by
  the kernel
- for arm, putConsoleChar just calls putDebugChar
2016-08-24 11:10:12 +10:00
Anna Lyons
e2bc428df4 style 2016-08-24 10:42:36 +10:00
Anna Lyons
ef00e98689 SELFOUR-615: arm entry point stubs 2016-08-24 10:42:36 +10:00
Adrian Danis
e0f8111faa move benchmark code from arch hooks 2016-08-24 10:42:36 +10:00
Adrian Danis
5466105cb9 call arch entry hook from C entry hook 2016-08-24 10:42:36 +10:00
Adrian Danis
4c57e6e577 define arch entry hooks instead 2016-08-24 10:42:36 +10:00
Adrian Danis
a217102b4e Consolidate benchmark entry/exit
Move the benchmark pre/post ambles into the now existing entry/exit
hook functions
2016-08-24 10:42:36 +10:00
Adrian Danis
3c05b79a6e Provide generic C entry/exit hook routines
It can be deseriable to run code before/after user mode, but
not have to write it in assembly. This commit adds such stubs
that get called as the first/last C code when coming in
and out of the kernel
2016-08-24 10:42:36 +10:00
amrzar
57f1352ff7 SELFOUR-614: calling halt() on the hikey platform results in infinite data abort
SELFOUR-408: halt does not halt

Remove assembly files for halt and idle thread and add wfi in armv.
2016-08-23 14:49:30 +10:00
Anna Lyons
c0817f4979 Merge pull request #339 in SEL4/sel4 from ~ALYONS/sel4:bye-lcok to master
* commit '5bd050f42fa6957a43db4ab20735f10d11f60bcd':
  trivial: x86 remove unused lock.[c|h]
2016-08-23 03:11:52 +00:00
Anna Lyons
5bd050f42f trivial: x86 remove unused lock.[c|h] 2016-08-23 11:41:26 +10:00
Anna Lyons
04e7eba3d0 Merge pull request #338 in SEL4/sel4 from ~ALYONS/sel4:SELFOUR-624 to master
* commit '49510f9df47ae75c764ac317f2d63abda7b2c784':
  SELFOUR-624: remove redundancy in io.[c|h]
2016-08-23 01:38:56 +00:00
Anna Lyons
49510f9df4 SELFOUR-624: remove redundancy in io.[c|h]
And clean up a bit while we are there
2016-08-23 08:00:47 +10:00
Kofi Doku Atuah
d33e48540c Use UNREACHABLE() instead of while(1) 2016-08-22 09:25:02 +10:00
Kofi Doku Atuah
2576eef364 x86: POPF immediately before SYSEXIT.
* Change restore_user_context() and fastpath_restore() to call POPF
  just before SYSEXIT.
* Also change the way registers are loaded such that we don't access
  memory that is not guarded by the current position of the stack pointer.

The reason for this change is that EFLAGS.TF, the Trap Flag, only takes
effect on the instruction AFTER the instruction that sets EFLAGS.TF. The
reason Intel/AMD did it this way is to allow the kernel to enable EFLAGS.TF
for userspace, without it taking effect on kernel instructions BEFORE
the CPU actually has returned to userspace.

EFLAGS.TF enables single-stepping. So the full picture is that since we
executed other instructions between POPF and SYSRET, those instructions
were triggering single-stepping IN the kernel. To solve this, we must
put POPF immediately before SYSRET.
2016-08-22 09:25:02 +10:00
Hesham Almatary
c3826e0efe SELFOUR-518: Benchmark - User-level log buffer, delete dump and size system calls
Given that the log buffer is now
(79291252a8) in user-level, the kernel doesn't have
to dump and send the size for users. Users have to take care of this.
2016-08-19 12:57:03 +10:00
Anna Lyons
f34f354a5d SELFOUR-617: one source of memory object sizes
Adds the following constants to libsel4
and uses them in the kernel.

seL4_SectionSize (arm)
seL4_SuperSectionSize (arm)
seL4_HugePageSize (x86 - pae)
seL4_LargePageSize (arm)
seL4_DataFault
seL4_InstructionFault
2016-08-17 12:42:38 +10:00
Hesham Almatary
79291252a8 Merge pull request #304 in SEL4/sel4 from ~HALMATARY/sel4:SELFOUR-518/UserLevelLogBuffer to master
* commit '16c3481109e2024d6fd65365ea94265ead37dcca':
  SELFOUR-518: User-level log buffer
  Benchmark: share and use KS_LOG_PPTR and PPTR_TOP for x86 and ARM
2016-08-16 00:34:21 +00:00
Hesham Almatary
16c3481109 SELFOUR-518: User-level log buffer
Remove global ksLog and use KS_LOG_PPTR instead

Benchmark - Log buffer: use global page table
2016-08-15 15:06:38 +10:00
Hesham Almatary
90628a75a7 Benchmark: share and use KS_LOG_PPTR and PPTR_TOP for x86 and ARM 2016-08-12 11:14:04 +10:00
Adrian Danis
7090a30e9a Merge pull request #325 in SEL4/sel4 from ~ADANIS/sel4:idle to master
* commit 'b727ede2c5c054277bf386566d4d966254883620':
  arm: Restore CPSR_IDLETHREAD usage
2016-08-10 05:56:17 +00:00
Adrian Danis
b727ede2c5 arm: Restore CPSR_IDLETHREAD usage
CPSR_IDLETHREAD was introduced in a5f61c7 to mask FIQs and asynchronous
aborts. Usage of this was lost in a merge, this commit restores the
usages in Arch_configureIdleThread, and updates CPSR_IDLETHREAD to
use the correct PMODE depending on whether the kernel is running
in hypervisor mode or not
2016-08-10 14:18:03 +10:00
Anna Lyons
dd7644f687 trivial: remove unused prototype 2016-08-10 13:48:01 +10:00
Anna Lyons
f33ae44e13 SELFOUR-612: one generic timer impl
This commit unifies 3 implementations of the arm
generic timer and cleans up existing code.
2016-08-10 07:16:46 +10:00
Anna Lyons
872cd4923a Fix problem in omap irq code
If an irq over max IRQ came in (unlikely) then it would result in an
array bounds over flow. gcc detected this as a result of the inlining of
the irq functions.
2016-08-09 16:18:34 +10:00
Anna Lyons
ce2c058f3d SELFOUR-607: inline remaining irq path functions 2016-08-09 16:18:34 +10:00
Adrian Danis
3b85582e7b SELFOUR-609: Introduce virq type in bitfield
Introduces a bitfield defined virq type that is then used to replace
manual bit packing of virtual irqs in the vcpu/vgic LR registers
2016-08-09 13:57:02 +10:00
Adrian Danis
adb0c08e23 arm/tk1: Explicitly define device region sizes
ARMSectionBits is variable depending on the current virtual addres space
scheme
2016-08-09 11:21:34 +10:00
Anna Lyons
0fd41318f1 trivial: fix tk1 release build 2016-08-09 09:52:26 +10:00
Anna Lyons
d727922b97 trivial: fix a few arm builds 2016-08-09 09:52:26 +10:00
Anna Lyons
652cafd729 trivial: fix beagle release build 2016-08-08 11:53:52 +10:00
Anna Lyons
4a486779ac SELFOUR-519: remove map_kernel_devices duplication
* move devices to static array in hardware.h
* use one higher level function to map them in.
2016-08-06 17:53:04 +10:00
Anna Lyons
ed61b3030c SELFOUR-607: remove stray irqInvalid def 2016-08-06 17:53:03 +10:00
Anna Lyons
9456b3e690 SELFOUR-519: remove more duplication in hardware.c
* move p_reg functions up a level
* move p_reg definitions to hardware.h
2016-08-06 17:53:03 +10:00
Anna Lyons
859091b414 SELFOUR-519: remove duplicated constants
* rename physBaseMapping to BASE_OFFSET
* because physBaseMapping was only used explicity in a few places
* move duplicated arm definions up a level
    - PPTR_TOP
    - PADDR_TOP
    - BASE_OFFSET
2016-08-05 17:08:21 +10:00
Rafal Kolanski
e105053581 Update prototype of maskInterrupt to match implementations.
The prototype will ultimately be removed, but the mismatch is presently
breaking verification.
2016-08-05 16:42:04 +10:00
Anna Lyons
6859e3bbd9 SELFOUR-607: unify irqInvalid for arm gic_pl390.h 2016-08-05 10:45:32 +10:00
Anna Lyons
ef2fca4bc1 SELFOUR-607: gic_pl390: inline and cleanup.
Inline non-boot irq functions called on the irq path.
This improves performance of interrupt paths through code locality.

Additionally, remove unused functions and use the BIT macro
rather than redefining it.
2016-08-04 16:10:11 +10:00
Adrian Danis
28175f77f9 x86: Split some arch functions in mode headers into arch and mode portions 2016-08-01 11:43:59 +10:00
Hesham Almatary
36a419eafe Merge pull request #302 in SEL4/sel4 from ~HALMATARY/sel4:SELFOUR-526 to master
* commit 'c6247d36a36d211ecb26ff906c37fcfbda0e4f99':
  SELFOUR-526: Refactor benchmark/debug syscall kernel entry
2016-07-28 04:06:05 +00:00
Hesham Almatary
c6247d36a3 SELFOUR-526: Refactor benchmark/debug syscall kernel entry 2016-07-28 10:29:42 +10:00
Adrian Danis
a5690c444b SELFOUR-551: Prevent vcpu_boot_init appearing to verification
When hypervisor extensions are not enabled the boot code cannot
actually call vcpu_boot_init as the symbol names do not even
exist. This is fixed be defining macros that expand to nothing
2016-07-28 09:01:22 +10:00
Adrian Danis
6d891b0a48 SELFOUR-551: Remove direct accesses to machine data structures
This commit wraps accesses to the vgic in functions that are marked as
DONT_TRANSLATE and uses a global constant (that is determined at boot time)
for the number of LR registers to prevent loops that have undefined bounds
2016-07-27 12:03:06 +10:00
Adrian Danis
8e0315f443 SELFOUR-551: Standardize VCPU capitalization
For acronyms seL4 other does CAPS or caps, this changes some functions
that were doing Caps
2016-07-27 11:23:36 +10:00
Adrian Danis
e4a732d53c SELFOUR-551: Remove unused arguments from decodeVCPUSetTCB 2016-07-26 16:01:18 +10:00
Adrian Danis
a185335e62 SELFOUR-551: Swap argument order of [di|a]ssociateVcpuTcb
Attempts to create some consistently across other functions that have
VCPU first in the name and also VCPU first in the argument list
2016-07-26 15:57:16 +10:00
Adrian Danis
2399465494 SELFOUR-561: s/ARM_HYP/CONFIG_ARM_HYPERVISOR_SUPPORT/ 2016-07-26 15:31:34 +10:00
Hesham Almatary
c4de796da1 Merge pull request #292 in SEL4/sel4 from ~HALMATARY/sel4:fix/ARMHypTraps to master
* commit '3ffa58aa1fb75c65fac4d1351bc6e014bdda2b64':
  Verification: don't translate functions that are re-implemented from assembly to C
  ARM Hyp: Fix fastpath_restore on ARM Hyp and implement slowpath and restore in C
  SELFOUR-526: ARM - Implement slowpath and restore_user_context in C
2016-07-23 04:06:01 +00:00
Adrian Danis
9c7f178f9f Merge pull request #274 in SEL4/sel4 from ~MFERNANDEZ/sel4:8dafd43a-daa8-4d38-ad7e-3ac425d50087 to master
* commit 'd36447b35f88705f796e17f47bf9033918fd2ed0':
  Mark strncmp as a pure function.
  Fix: Make VISIBLE expand to nothing for Clang.
2016-07-21 05:03:02 +00:00
Hesham Almatary
778043a73c ARM Hyp: Fix fastpath_restore on ARM Hyp and implement slowpath and restore in C 2016-07-19 15:27:26 +10:00
Kofi Doku Atuah
56030fc3cc x86: Fix cpuid family/model composition
Fixes a bug where previously MODEL_ID() was defined as:
    `#define MODEL_ID(x) ( ((x & 0xf0000) >> 16) + (x & 0xf0) )`

This was incorrect because (1) it didn't take into account the conditional
nature of the extended_model_ID, and (2) it's actually shifting the
extended_model_ID into the low bits and keeping the model_ID in the high bits,
when it should be the other way around.

This patch also introduces a foundation for more sane testing of CPU vendor,
family, model and brand_ID.
2016-07-15 17:12:25 +10:00
Hesham Almatary
d97603bd84 SELFOUR-566: Decouble seL4_DebugNameThread from CONFIG_PRINTING 2016-07-15 12:30:17 +10:00
Anna Lyons
bb4bda4b7f Merge pull request #286 in SEL4/sel4 from ~ALYONS/sel4:29e0070 to master
* commit '69f140a2268532523b4f52f26d2692963e61b468':
  trivial: remove duplicated setMRs_syscall_error
2016-07-13 01:33:13 +00:00
Anna Lyons
69f140a226 trivial: remove duplicated setMRs_syscall_error 2016-07-12 14:44:14 +10:00
Hesham Almatary
11916d7601 Merge pull request #278 in SEL4/sel4 from ~HALMATARY/sel4:UnifiedCEntry to master
* commit 'cee1268e9bf9619b60bd85cfda0a5d5306e8cf8a':
  [VER-619] Pass verification related to newly added built-in unreachable
  SELFOUR-545: x86 - cleanup c_traps.c file and use new traps.h
  SELFOUR-526: ARM - dummy unreachable statements after fastpath calls
  SELFOUR-526: ARM - Unify C entry point for system calls
2016-07-12 04:37:44 +00:00
Alejandro Gomez-Londono
cee1268e9b [VER-619] Pass verification related to newly added built-in unreachable 2016-07-12 14:32:47 +10:00
Adrian Danis
2b3a305ef8 SELFOUR-560: Remove unused io_page_directory cap 2016-07-08 16:55:33 +10:00
Adrian Danis
c50926b505 SELFOUR-559: Cleanup ARMPageUnmap for IO mappings
This commit moves setThreadState outside the 'perform' stage of the
invocation, and renames decodeARMIOUnmapInvocation to
performPageInvocationUnmapIO as it is actually doing a perform
and not a decode
2016-07-08 16:50:08 +10:00
Adrian Danis
5ca374b34c SELFOUR-558: Consistently name Unmap instead of UnMap 2016-07-08 16:27:02 +10:00
Adrian Danis
75299d05a9 SELFOUR-557: s/isIOSpaceFrame/isIOSpaceFrameCap/ 2016-07-08 16:17:09 +10:00
Adrian Danis
382dc2d60e SELFOUR-554: Update archCapIsPhysical
VCPU and IO page table caps were not added to archCapisPhysical,
this commit fixes that and marks them as physical objects
2016-07-08 15:38:33 +10:00
Adrian Danis
9bedaaa873 SELFOUR-552: Translate IO-ASIDs->PDs by table
Previously looking up the page directory base for a SysteMMU was
done by writing the ASID into the hardware and reading out the
currently set page directory for that ASID. This is confusing for
verification so this commit introduces a global translation table
for converting an ASID to a page directory.
2016-07-08 15:38:33 +10:00
Hesham Almatary
f9ea6383f3 SELFOUR-545: x86 - cleanup c_traps.c file and use new traps.h
Closes SELFOUR-545
2016-07-08 10:39:17 +10:00
Hesham Almatary
39c692cc35 SELFOUR-526: ARM - Unify C entry point for system calls 2016-07-06 10:32:26 +10:00
Matthew Fernandez
d36447b35f Mark strncmp as a pure function.
Simply a performance optimisation. This has no effect on functional behaviour.
2016-06-29 17:04:28 +10:00
Matthew Fernandez
fee3af3dd3 Fix: Make VISIBLE expand to nothing for Clang.
The `VISIBLE` macro is designed to selectively inhibit the effects of GCC's
whole program and link-time optimisations. This is necessary when a C function
is only referenced from a context outside the compiler's visibility, e.g. an
assembly file. As far as I can determine, Clang's link-time optimisations
already account for this possibility and do not need to have this information
manually indicated to them (see, for example, Linux's compiler support headers).

In any event, `__attribute__((visibility("default")))` is not equivalent to
`__attribute__((externally_visible))`, but is instead for controlling symbol
visibility in a library-like setting. This commit removes this incorrect
expansion.
2016-06-29 16:58:47 +10:00
Adrian Danis
e450377a6f Remove #include <stdbool.h>
seL4 has no stdbool.h and #including this is simply causing gcc to
pull in some 'random' stdbool outside of our control
2016-06-24 15:05:44 +10:00
Hesham Almatary
935e8054a6 SELFOUR-448 Benchmark: Add PMU IRQ support to ARM platforms
Currently supported boards are:
- imx6 (sabre)
- tk1 (Jeston)
- kzm
2016-06-24 12:44:09 +10:00
Hesham Almatary
09358f9b6a SELFOUR-448 Benchmark: Track thread's CPU utilisation time 2016-06-24 12:43:09 +10:00
Hesham Almatary
b986bbfccb Benchmark: armv6 implement armv_handleOverflowIRQ 2016-06-23 14:55:14 +10:00
Rafal Kolanski
b92d3f3caa Merge pull request #264 in SEL4/sel4 from arm_hyp to master
* commit 'e38288f805a434faf9052ecf96dd12838f8bf2bd': (76 commits)
  arm-hyp: Rearrange registerset to add compile_asserts
  arm-hyp: Simplify return conditions
  arm-hyp: Use BIT macro
  arm-hyp: Add preprocessor guard comments
  arm-hyp: Rearrange #ifdef
  arm-hyp: Comment on SCTLR_DEFAULT
  arm-hyp: Remove EXPECTED_TCB_SIZE
  trivial: style
  trivial: fix previous merge
  arm-hyp: Hide more definitions
  arm-hyp: Hide ARMPageMapIO invocation
  arm-hyp: Add conditions to invocations
  arm-hyp: Push ARM_HYP config check into traps.S
  arm-hyp: Hide more calls to isIOSpaceFrame
  arm-hyp: Hide calls to isIOSpaceFrame
  arm-hyp: Rename pd->pd_val in some instances
  arm-hyp: Pander to the C parser
  arm-hyp: Correct previous merge with master
  arm-hyp: Hide iospace caps being #ifdef
  arm-hyp: Remove unneccessary cast
  ...
2016-06-22 12:40:05 +00:00
Adrian Danis
2b347793e7 arm-hyp: Rearrange registerset to add compile_asserts 2016-06-22 16:25:06 +10:00
Adrian Danis
0830533513 arm-hyp: Add preprocessor guard comments 2016-06-22 16:25:06 +10:00
Adrian Danis
71bd25249e arm-hyp: Rearrange #ifdef 2016-06-22 16:25:05 +10:00
Adrian Danis
7a113a200d arm-hyp: Remove EXPECTED_TCB_SIZE
This definition was removed from master
2016-06-22 16:25:05 +10:00
Hesham Almatary
f488e25e51 SELFOUR-448: Benchmark: implement ccnt on armv6 2016-06-22 13:40:34 +10:00
Adrian Danis
cd96226421 Merge branch master into arm_hyp
Conflicts:
	include/arch/arm/arch/32/mode/object/structures.h
2016-06-21 14:39:32 +10:00
Hesham Almatary
8541b87326 SELFOUR-516 Remove EXPECTED_TCB_SIZE 2016-06-21 14:25:26 +10:00
Adrian Danis
82034bbc02 Merge branch master with arm_hyp 2016-06-17 09:57:07 +10:00
Adrian Danis
fd2f5ec85b Explicitly check if a capability is physical or not
Previously the return value of cap_get_capPtr was compared to 0 in
sameRegionAs to emulate a check in the abstract specification that
tests if the cap is a physical cap or not. Overloading 0 results
in a scenario where a legitimate deviceUntyped's children do not
get considered to be children because they have a capPtr of 0.

This change adds and explicit function that returns whether or not
a capability is physical or not, and uses that in sameRegionAs
2016-06-16 16:42:30 +10:00
Adrian Danis
11c665f53a arm-hyp: Hide more definitions 2016-06-16 15:34:07 +10:00
Matthew Fernandez
06041ab0ed Merge pull request #252 in SEL4/sel4 from ~MFERNANDEZ/sel4:3ce5c4cb-dbf7-4f3b-bb0d-a33908959c3f to master
* commit '7ad7cfba0a539a6a08b437e368fc67d92b0b7bac':
  Fix standalone debug compilation on ARMv6.
2016-06-16 04:48:07 +00:00
Adrian Danis
9a3a450419 x86: Use IO page table size defined in libsel4 2016-06-16 14:20:51 +10:00
Matthew Fernandez
7ad7cfba0a Fix standalone debug compilation on ARMv6.
This commit moves a declaration of `ksKernelEntry` such that it is now only
guarded by `DEBUG`, not additionally `CONFIG_PRINTING`. This allows the kernel
to be built standalone with debugging enabled using the following invocation:

    DEBUG=1 TOOLPREFIX=arm-none-eabi- CPU=arm1136jf-s PLAT=imx31 ARCH=arm \
      ARMV=armv6 make
2016-06-16 12:09:17 +10:00
Adrian Danis
9b7d6e9ce7 arm-hyp: Rename pd->pd_val in some instances
To aid the C parser any variable named 'pd' should be pde_t*, this
renames usages of pd where it is a word_t to be pd_val
2016-06-14 10:52:31 +10:00
Adrian Danis
1d777adbe4 arm-hyp: Correct previous merge with master 2016-06-08 15:11:16 +10:00
Adrian Danis
e67be6acee Merge branch master into arm_hyp
Conflicts:
	src/plat/exynos5/machine/hardware.c
	src/plat/tk1/machine/hardware.c
2016-06-08 15:04:03 +10:00
Adrian Danis
48555c3864 arm-hyp: Hide iospace caps being #ifdef
These cap type existing, even if unused, break the original verification
2016-06-08 14:53:24 +10:00
Adrian Danis
2b90ed467b Merge pull request #236 in SEL4/sel4 from ~ADANIS/sel4:x86 to master
* commit 'b1e7e073df53639c81cb7b9ae4b2f568afa8eb16':
  x86: Move xsetbv to general header
2016-06-08 01:31:48 +00:00
Adrian Danis
c4dcc75c56 arm-hyp: Remove unneccessary cast
This cast causes problems for the C parser
2016-06-08 08:59:52 +10:00
Adrian Danis
b1e7e073df x86: Move xsetbv to general header
The xsetbv and write_xcr0 wrapper are not 32-bit specific and were
placed in the wrong location originally.
2016-06-07 15:31:49 +10:00
Adrian Danis
6d6b047b2d Minor fixes for other ARM platforms 2016-06-07 13:35:55 +10:00
Anna Lyons
c5b6a6a58a Refactor duplicated code in hardware.h
One copy to rule them all.
2016-06-07 12:01:14 +10:00
Anna Lyons
c9684b964f trivial: consolidate timer function declarations
This moves all timer function declarations to a single
header instead of duplication them for each platform
2016-06-07 11:50:11 +10:00
Anna Lyons
0ec5e93771 SELFOUR-402: remove isReservedIRQ
While provided by each hardware platform this function is never called.
2016-06-07 11:50:11 +10:00
Hesham Almatary
efde16c864 fix: kernel debug build fails without ksKernelEntry there 2016-06-07 10:17:46 +10:00
Hesham Almatary
8a159d70cd Merge pull request #228 in SEL4/sel4 from ~HALMATARY/sel4:BenchmarkSharedUser to master
* commit 'a84964ba4cd8e6ca4a9527041a8cfddae27a0c3c':
  SELFOUR-446 Benchmark: Share kernel entry types with user-level
2016-06-06 23:32:48 +00:00
Hesham Almatary
a84964ba4c SELFOUR-446 Benchmark: Share kernel entry types with user-level 2016-06-07 09:19:31 +10:00
Adrian Danis
5f0ae410f4 arm-hyp: Minor cleanups
Cleanup some small licensing, whitespace and configuration details
2016-06-06 11:51:58 +10:00
Adrian Danis
c64ae63e5c Merge branch master into arm_hyp 2016-06-06 11:51:46 +10:00
Adrian Danis
6915cf03be x86: Update autoconf.h for standalone builds 2016-06-03 09:42:37 +10:00
Adrian Danis
93bca86e40 x86: Introduce support for XSAVE feature set
The XSAVE feature set is the future proof way for x86 CPUs to
manage extended CPU state. Extended state is MMX, FPU, SSE, AVX etc
registers. This is a replacement for the current FXSAVE and the
512 byte FPU region.

XSAVE introduces a few problems that this commit has to address

* The alignment of the XSAVE region is 64bytes, instead of the 16
  bytes of the FXSAVE region
* XSAVE region size is dependent on the desired features, which
  are detected at run time
* There are multiple variants of the XSAVE instruction that have
  different potential optimizations, but are not always supported

The solutions to these are

* Re-order the FPU state and user registers in the user context
  struct so that the new XSAVE region is first, and is thus
  aligned to 64bytes without needing lots of padding
* Provide config options for desired features (including XSAVE
  instruction variant) and required XSAVE region size. These
  are checked at boot time to ensure the CPU meets these
  requirements
2016-06-02 11:06:37 +10:00
Adrian Danis
96bcba168b x86: Add functions for writing to the extended control registers 2016-06-02 11:06:37 +10:00
Adrian Danis
1cb58c1f37 Add config_default macro
This macro allows for using the value of a CONFIG_ variable in situations
where it may not be defined. This could be due to it being a dependency
on another CONFIG_ variable that is not currently defined. This arrises
from code blocks like

if (config_set(CONFIG_FOO)) {
    return CONFIG_VAR_DEPENDS_ON_FOO;
}

This will not compile when CONFIG_FOO is not set. Using

return config_default(CONFIG_VAR_DEPENDS_ON_FOO, 42);

Provides a way for this to be built
2016-06-02 11:06:07 +10:00
Adrian Danis
e667a7e04b x86: Add missing CR4 bit definition 2016-06-02 11:06:07 +10:00
Adrian Danis
58f26d2f30 x86: Add missing CPUID functions 2016-06-02 11:06:07 +10:00
Adrian Danis
2516e65cfa x86: Add XSS MSR definition 2016-06-02 11:06:07 +10:00
Adrian Danis
4d76c71e31 x86: Calculate register offset from structures
The address being calculated is the end of the user context array.
There is no need for this to be done as a magic number offset
from the tcb_t, this commit takes an index into the actual array,
using the constant that is defined as the length of that array.
2016-06-02 11:06:07 +10:00
Adrian Danis
b001bc4489 Merge branch 'master' into 'arm_hyp'
Conflicts:
	Kconfig
	libsel4/tools/syscall_stub_gen.py
	src/plat/exynos5/machine/hardware.c
	src/plat/tk1/machine/Makefile
	src/plat/tk1/machine/hardware.c
2016-06-02 10:57:12 +10:00
Hesham Almatary
46698d5383 Merge pull request #192 in SEL4/sel4 from ~HALMATARY/sel4:feature/syscall_bench2 to master
* commit 'bcf0a235b114fe8c24c3a187f55c67c373f259d3':
  SELFOUR-446 Unify code base for trace points and track feature
  SELFOUR-446 Benchmark: Track interrupts and user/vm faults
  Fix: move seL4_LogBufferSize to the correct file
  SELFOUR-446 Benchmark: Track syscall feature
2016-06-02 00:53:20 +00:00
Hesham Almatary
bcf0a235b1 SELFOUR-446 Unify code base for trace points and track feature 2016-06-02 10:49:25 +10:00
amrzar
128768edac Add support for armV8 and Hikey 32bit 2016-06-01 14:15:29 +10:00
Hesham Almatary
7cbaeb8ed0 SELFOUR-446 Benchmark: Track interrupts and user/vm faults 2016-05-31 08:54:57 +10:00
Yanyan Shen
dfb3551eef arm-hyp/tk1: address review comment 2016-05-30 16:33:28 +10:00
Yanyan Shen
c85094bb75 arm-hyp/tk1: add guards so other plats can compile. 2016-05-30 15:37:22 +10:00
Yanyan Shen
55f8b14417 arm-hyp/tk1: address review comments. 2016-05-27 11:00:01 +10:00
Yanyan Shen
27ecdffe3c arm-hyp/tk1: address review comments. 2016-05-27 00:16:53 +10:00
Adrian Danis
16b1bcf0a8 SELFOUR-489: Remove 'bound' field from TCBs
Its probable this was meant to be a boolean flag to represent
whether or not the TCB had a bound notification object. However,
this field is unused and its presence is confusing.
2016-05-26 10:17:19 +10:00
Yanyan Shen
5650a8fa84 arm-hyp/tk1: make style 2016-05-25 16:35:02 +10:00
Yanyan Shen
bb9e84e6ec arm-hyp/tk1: add default SMMU translation for VM 2016-05-25 16:31:26 +10:00
Hesham Almatary
fc1feb670e SELFOUR-446 Benchmark: Track syscall feature
Benchmark feature that currently:
- Keeps track of system calls info
- Start time
- Duration
- Capability type
- Invocation tag
- Log the number of invocations of each system call*
- Log the number of invocations for each capability type per syscall.
- Has 3 new syscalls (dump, reset, get size).
- This new feature uses the existing log buffer (which is 1MiB for x86
and ARM). Since the number of syscall invocations is not
deterministic, the logged number of invocations is limited by the size
of the buffer. I suggested to enable the users to pass their own
user-level buffer, to enable more flexibility, later.
- ENABLE_BENCHMARKS is now a parent config option of trace points and
system call track features, they can't be used at the same time.
2016-05-25 13:47:49 +10:00
Adrian Danis
9aeee98792 SELFOUR-449 Implement user stack trace on double fault 2016-05-25 12:07:23 +10:00
Adrian Danis
bbdf7a89a7 Mark tlbLockCount as visible so it is not discarded
This variable is referenced in assembler and needs to not get discarded
by the optimizer prior to linking.
2016-05-24 08:46:54 +10:00
Felix Kam
39a2c4f108 Merge pull request #181 in SEL4/sel4 from ~FKAM/sel4:lockTLBEntryPatch to master
* commit 'b9a7f3c9a13ff7e997e28b63676a1dd2a1b7f381':
  Make lockTLBEntry comply with the decompiler
2016-05-23 06:30:42 +00:00
Adrian Danis
0c1d959b0e x86: Define Additional MSRs
Define these MSRs in preparation for their use on the x86_64 port
2016-05-23 14:17:36 +10:00
Yanyan Shen
17ec138bf2 arm-hyp/tk1: enable SMMU interrupts 2016-05-20 17:05:44 +10:00
Yanyan Shen
a56c5ff16e Merge branch 'feature/arm_hyp_tk1' of ssh://bitbucket:7999/~yshen/sel4k into feature/arm_hyp_tk1 2016-05-20 12:24:52 +10:00
Yanyan Shen
b1e4f92fbd arm-hyp/tk1: reserve the SMMU interrupt 2016-05-20 12:23:51 +10:00
Yanyan Shen
11720f23ad arm-hyp/tk1: fix bugs found during testing 2016-05-20 00:00:46 +10:00
Adrian Danis
086b5192c5 Merge pull request #180 in SEL4/sel4 from ~ADANIS/sel4:printing to master
* commit '1287590e9736f48e30b42fe678f2bf081a8c1874':
  Correct separation of printing and debug builds
2016-05-19 00:17:03 +00:00
Felix Kam
b9a7f3c9a1 Make lockTLBEntry comply with the decompiler
lockTLBEntry, an assembly function, had tlb_lock_count as a symbol that
needed to be placed sufficiently close to be loaded and stored with
offset-from-pc addressing. When assembled, the symbol would turn up
between functions, as opposed to within a literal pool (it's a variable,
not a constant) or the .bss / data sections. The decompiler doesn't
handle that use case, and likely won't.  This change turns
tlb_lock_count into a C global variable (so that it will be placed in
the .bss / data sections), and splits lockTLBEntry into two parts so the
critical section will still fit in a 64-byte aligned region, and
therefore be guaranteed to live within a single page.
2016-05-18 16:53:13 +10:00
Adrian Danis
1c1e976de2 x86: Improve translation invalidation
x86_64 (with PCIDs enabled) supports a more fine grained invalidation
approach for the TLB and Page Structure Cache. This change expands
the number and kinds of information passed for certain invalidations,
and provides an implementation of this for ia32.
2016-05-18 13:49:28 +10:00
Adrian Danis
1287590e97 Correct separation of printing and debug builds
Fixes some build issues with 541289a326
as well as further allowing debugging (via the capdl interface) to
happen when printing is turned off.
2016-05-17 15:10:08 +10:00
Yanyan Shen
508e87477f arm/tk1: connect objects with SMMU invocations 2016-05-17 12:16:34 +10:00
Adrian Danis
541289a326 Further separate 'release' and 'verification' builds
Originally building the kernel was largely considered to be done in
one of two ways
1. Release build with no assertions, no debug symbols and no printing.
   This was generally considered to be a 'verified' build
2. Debug build with assertions, debug symbols and printing

Since then various options were added, such as the 'code injection'
option, which we wanted on builds that did not have assertions or
other options that affected performance. As such it did not depend
upon a debug build and had large warning signs saying that enabling
this in a release build would not give you a verified or trusted
kernel.

Most recently the ability to print from the kernel in release mode
was added. For the same reason that tying the ability to print with
the performance reduction of various debugging was not always desireable.

This change attempts to unify the current state and have a single top
level option to enable a 'verification friendly' build. All other
options (assertions, printing, code injection) then depend upon
this configuration not being set.
2016-05-17 10:51:55 +10:00
Yanyan Shen
55e58e1a41 arm/tk1: a checkpoint for iospace.c 2016-05-13 22:40:13 +10:00
Yanyan Shen
879d9724c1 arm/tk1: a checkpoint for SMMU implementation 2016-05-13 16:42:53 +10:00
Yanyan Shen
c4692926a8 arm_hyp/tk1: address review comments 2016-05-10 13:15:08 +10:00
Yanyan Shen
454efecbcf Merge branch 'feature/arm_hyp_tk1' of ssh://bitbucket:7999/~yshen/sel4k into feature/arm_hyp_tk1 2016-05-04 17:05:34 +10:00
Yanyan Shen
fa9b6e4312 arm/tk1: addresses/interrupts for hyp mode 2016-05-04 16:53:27 +10:00
Yanyan Shen
c13eeffddc arm/tk1: add system MMU structures for TK1 2016-05-04 16:42:35 +10:00
Yanyan Shen
4d8f933aba arm/arm_hyp: replace macros with explicit inline 2016-03-24 12:52:38 +11:00
Yanyan Shen
67bcf2357c arm_hyp: rm ARM_HYP ifdefs; func inline assembly
vcpu.c:
encapsulate inline assembly into inline functions that added to
device_pl2.h file.

other files:
replace #ifdef ARM_HYP with config_set(ARM_HYP)
2016-03-24 12:42:19 +11:00
Yanyan Shen
d195a02b91 arm_hyp: remove unused function declaration.
remove map_hypervisor_devices function declaration.
2016-03-24 12:42:19 +11:00
Yanyan Shen
cbb6bf15d1 arm_hyp: add file to contain hyp mode inline funcs
machine_pl2.h:
new place for hyp mode inline functions.

boot.c:
replace #ifdef ARM_HYP with config_set(ARM_HYP).

vcpu.h, machine_pl2.h:
add empty functions when ARM_HYP is not defined to
pass compilation.
2016-03-24 12:42:19 +11:00
Adrian Danis
6932e6a725 Merge branch master into arm_hyp 2016-03-22 16:48:52 +11:00
Yanyan Shen
cc729fab45 Merge pull request #145 in SEL4/sel4 from ~YSHEN/sel4k:feature/tk1 to master
* commit 'b9410822c17886309021671ac547589f4f76db05':
  arm/tk1: add support for Nvidia Tegra K1 board
2016-03-22 05:31:49 +00:00
Yanyan Shen
b9410822c1 arm/tk1: add support for Nvidia Tegra K1 board 2016-03-22 16:23:37 +11:00
Anna Lyons
9ae867cbf2 SELFOUR-435: change kernel timer from GPT11 to 9
GPT1-9 are configured by uboot to run at 13Mhz,
while GPT10-11 are not and run with a much slower clock.
2016-03-17 09:54:40 +11:00
Yanyan Shen
3287bb0e2d Merge branch 'arm_hyp' into feature/arm_hyp_tk1 2016-03-14 16:49:30 +11:00
Yanyan Shen
4178a9e79f arm/arm_hyp: replace macros with explicit inline 2016-03-14 16:47:40 +11:00
Yanyan Shen
6b2c9ade2a Merge branch 'feature/tk1' into feature/arm_hyp_tk1 2016-03-14 16:45:28 +11:00
Yanyan Shen
b0b5d5aaab arm/tk1: add support for Nvidia Tegra K1 board 2016-03-14 16:01:20 +11:00
Yanyan Shen
8e2e8db976 arm_hyp: rm ARM_HYP ifdefs; func inline assembly
vcpu.c:
encapsulate inline assembly into inline functions that added to
device_pl2.h file.

other files:
replace #ifdef ARM_HYP with config_set(ARM_HYP)
2016-03-03 16:03:22 +11:00
Yanyan Shen
1cdc450cb3 arm_hyp: remove unused function declaration.
remove map_hypervisor_devices function declaration.
2016-03-03 15:57:13 +11:00
Yanyan Shen
3abf177c5b arm_hyp: add file to contain hyp mode inline funcs
machine_pl2.h:
new place for hyp mode inline functions.

boot.c:
replace #ifdef ARM_HYP with config_set(ARM_HYP).

vcpu.h, machine_pl2.h:
add empty functions when ARM_HYP is not defined to
pass compilation.
2016-03-03 13:49:45 +11:00
Joel Beeren
702930246a Merge pull request #53 in SEL4/sel4 from ~ALYONS/sel4:reduce-dup-bi to master
* commit '289bf92bf0713f9060f3a43c0ee91f2a06d9e4d7':
  SELFOUR-114: remove bootinfo.h duplication
2016-03-02 23:47:20 +00:00
Adrian Danis
602f536940 x86: Change some PHYS_CODE to BOOT_CODE
The functions pit_init and pit_wait_wraparound were previously marked as
PHYS_CODE, despite being called from BOOT_CODE elsewhere. This bug has
been present for some time but can be masked by the compiler inlining
all the involved functions, which is what typically happens.
2016-03-02 11:11:48 +11:00
Anna Lyons
289bf92bf0 SELFOUR-114: remove bootinfo.h duplication 2016-03-01 17:25:22 +11:00
Yanyan Shen
81fe0a7fa6 arm/imx7: add support for iMX7-based Sabre board 2016-02-25 15:07:53 +11:00
Adrian Danis
e61a1056cc SELFOUR-56: Remove diminish rights from IPC
Diminish rights were to prevent a user from sending a writeable
cap over a read only endpoint. It turns out this 'security' can
be worked around without difficulty (by putting caps in a cnode
and sending the cnode) making the current diminish rights
implementation functionally useless.

Removing diminish rights has the benefit of simplifying all the
IPC paths.
2016-02-23 13:58:48 +11:00
Adrian Danis
22623be2f8 Merge branch master into arm_hyp
Conflicts:
	include/arch/arm/arch/32/mode/object/structures.h
	libsel4/sel4_arch_include/aarch32/sel4/sel4_arch/types.h
	src/arch/arm/32/model/statedata.c
2016-02-22 15:55:31 +11:00
Adrian Danis
d9329d6ba3 Merge commit '417e3e1ccf57f046dcd1e5f5e775f362ddf8bca0' into arm_hyp
Conflicts:
	src/arch/arm/32/kernel/vspace.c
2016-02-22 15:55:10 +11:00
Adrian Danis
d0a42bbf49 Merge commit '812a73a9f58670cb18c36694d505dcd742c2ba8b' into arm_hyp 2016-02-22 15:02:12 +11:00
Adrian Danis
9e35b398cc x86: Refactor vspace code to have verification friendly invocations 2016-02-17 09:43:54 +11:00
Adrian Danis
dd59353944 x86: More portable user mode IO port restriction
For x86-64, to disable IO instructions in user mode requires a
IO permission map being set up properly in TSS. Setting the
IO map base field of TSS larger than the TSS works for 32-bit, but
not 64-bit. This commit sets up a IO permission map usable for both
32-bit and 64-bit kernel and changes the TSS to use the mapping.
The IO permission bitmap is appened to the bitfield generated tss_t,
resulting the tss_io_t structure.
2016-02-15 16:08:51 +11:00
Adrian Danis
775ca8c929 x86: Fix clflush invocation in flushCacheLine
This fixes flushCacheLine to flush the line pointer to be vaddr,
not the cache line of the stack location holding the vaddr pointer
2016-02-15 15:57:45 +11:00
Adrian Danis
1ca0fa1fc2 imx6: Update autconf.h for standalone kernel compile 2016-02-12 14:08:08 +11:00
Robert Kaiser
c0bc7d8fc1 Added changes for Wandboard 2016-02-12 11:54:36 +11:00
Adrian Danis
d20ca20a13 x86: Rename ia32->x86
This is a stylistic commit to make names of variables/constants and
functions in the kernel more consistent. That is, things that are
not IA32 specific, but are generic x86, get renamed to having an
x86 name
2016-02-10 17:02:06 +11:00
Adrian Danis
eb5b792bca trivial: style 2016-02-10 11:48:31 +11:00
Adrian Danis
cfcaf49c2d SELFOUR-399: object sizes and globals frame addr should come from the same source 2016-02-10 09:13:16 +11:00
Adrian Danis
3c9f304a40 x86: Update autoconf.h for standalone kernel builds 2016-02-04 15:00:49 +11:00
Adrian Danis
be6b6be119 x86: FS/GS base MSRs
when FS/GS_BASE_MSR are used to set the base addreses,
user applications should not touch FS/GS regiters; so
the kernel should load proper selectors once, establishing
limits and other attributes for the segments.
2016-02-04 13:39:16 +11:00
Adrian Danis
fa3989eff6 trivial: style 2016-02-04 12:12:36 +11:00
Adrian Danis
91b38f371e x86: Rename mistake usage of x86->ia32 to fix build errors 2016-02-04 11:32:05 +11:00
Adrian Danis
d53aa04fd8 x86: Abstractions for setting up benchmarking log 2016-02-04 10:30:55 +11:00
Adrian Danis
9b7a8405c2 Change bootinfo to have generic slot region for paging structures
Current bootinfo defines two slot regions for paging structures,
one for page directories and one for page tables. This does not
easily generalise for N levels of paging structures. This change
uses a single region that has a known order of objects for however
many levels exist
2016-02-03 16:16:00 +11:00
Robert Kaiser
a2f414dc18 Run idle thread in system mode (rather than supervisor)
Add platform dependent code (using macros from autoconf.h)
to make idle thread run in low power mode on all ARMv7
and ARMv6 except for the KZM board: That board does not
seem to support low power mode although the chip should,
according to he manual

Part of SELFOUR-419
2016-02-03 16:07:55 +11:00
Adrian Danis
417e3e1ccf Merge pull request #103 in SEL4/sel4 from ~AZARRABI/sel4:aarch32 to master
* commit '3959ced3418c08d174e3c7533fc7459d2286fe15':
  Remove mode dependant codes for initial thread from architecture dependant boot codes
2016-02-03 04:14:34 +00:00
Adrian Danis
bddd804a6e x86: IOAPIC/MSI syscalls
Restructure the x86 interrupt handling to allow for a more flexible
method of using IOAPIC and MSI interrupts. The essence of this change
is to allow for the user to pick, for both IOAPIC and MSIs, which
CPU vector to use. Additionally there is future support, in the API,
for seL4 to eventually protect MSI interrupts with the vt-d interrupt
routing tables.

API behaviour for legacy systems using the PIC is preserved

Part of SELFOUR-281
2016-02-02 15:58:18 +11:00
amrzar
3959ced341 Remove mode dependant codes for initial thread from architecture dependant boot codes 2016-02-02 15:48:42 +11:00
Adrian Danis
95c33147c0 Merge branch master into arm_hyp
Conflicts:
	Kconfig
	include/arch/arm/arch/fastpath/fastpath.h
	include/arch/arm/arch/machine.h
	include/arch/arm/arch/machine/hardware.h
	include/arch/arm/arch/machine/registerset.h
	include/arch/arm/arch/model/statedata.h
	include/arch/arm/arch/object/structures.bf
	include/arch/arm/arch/object/structures.h
	libsel4/arch_include/arm/sel4/arch/exIPC.h
	libsel4/arch_include/arm/sel4/arch/types.h
2016-02-01 14:57:37 +11:00
Adrian Danis
0107e60169 ia32: Reduce total number of ASIDs from 16bits to 12bits
This change brings the ia32 api in line with the planned x64 api,
which will have 12bits of ASID. Aside from providing a consistent
API, this change also frees up bits in the frame cap that will
allow further x64 changes to be unified.
2016-01-29 15:46:51 +11:00
Adrian Danis
4f7ac5e196 Merge pull request #95 in SEL4/sel4 from ~ADANIS/sel4:used to master
* commit '21d9f7aeabce0c47033b402c07ec78a36c69c2f4':
  Add 'used' attribute to memcpy to prevent optimizing out
2016-01-27 23:39:01 +00:00
Adrian Danis
21d9f7aeab Add 'used' attribute to memcpy to prevent optimizing out
Some versions of GCC replace a struct copy with a call to 'memcpy',
which it is fully in its rights to do. Unfortunately on ARM platforms,
that have no direct calls to memcpy, the optimizer (in the presence
of -fwhole-program) drops the implementation of memcpy, even as it
is outputting calls to it.

Add the USED attribute prevents the optimizer from dropping the
function eagerly.
2016-01-28 10:36:24 +11:00
amrzar
3fc76c25f6 Rearranging headers for aarch32 to 32/mode/* 2016-01-27 16:32:48 +11:00
Adrian Danis
915a404d5c libsel4: Provide a layer of indirection around types.bf and shared_types.bf to allow for 64-bit variants 2016-01-21 13:31:54 +11:00
Adrian Danis
a701481095 Merge pull request #85 in SEL4/sel4 from ~AZARRABI/sel4:aarch32 to master
* commit '1a1110a0949c76a2d372e2bba6b2526898c51a68':
  Modify Kconfig and Makefile for aach32 as sel4_arch libsel4: updates to include aarch32 as sel4_arch
2016-01-19 05:17:46 +00:00
amrzar
1a1110a094 Modify Kconfig and Makefile for aach32 as sel4_arch
libsel4: updates to include aarch32 as sel4_arch
2016-01-19 15:37:52 +11:00
Adrian Danis
93ca3581fc Merge branch master into arm_hyp
Conflicts:
	include/arch/arm/arch/api/objecttype.h
	libsel4/tools/syscall_stub_gen.py
	src/arch/arm/kernel/vspace.c
	src/arch/arm/object/objecttype.c
2016-01-19 10:52:25 +11:00
Joel Beeren
e11bb32f78 archirq: fix x86 invLabel 2016-01-18 11:47:21 +11:00
Joel Beeren
1ff5a552c9 archirq: rename missed label to invLabel 2016-01-18 11:37:52 +11:00
Adrian Danis
a6aa7472f3 Remove redundant IRQInterruptControl invocation, and replace with a mechanism to actually decode arch specific IRQ invocations
Part of SELFOUR-281
2016-01-18 11:37:52 +11:00
Adrian Danis
0b88c56246 x86: Add missing checks when mapping and unmapping paging objects 2016-01-14 17:04:22 +11:00
Adrian Danis
8b280a07b7 x86: Introduce mode specific unmap and remap operations 2016-01-13 12:07:45 +11:00
Adrian Danis
210fc1f3fc x86: Factor out 32-bit specific parts of the fastpath 2016-01-13 09:52:31 +11:00
Adrian Danis
c58098c97a x86: Factor out IA32 specific objecttype code 2016-01-12 16:57:55 +11:00
Adrian Danis
cf6e5c8e12 x86: Use typedef for vspace roots instead of void* 2016-01-12 12:19:29 +11:00
Adrian Danis
68887cd836 x86: Populate the freemem list from the multiboot mem list
If the multiboot memory list exists, then it may contain more
than just the single contiguous memory region listed in 'mem_upper'
Therefore we use it to populate a more complete free memory list,
if it exists
2016-01-12 10:59:08 +11:00
Adrian Danis
933bd8b00a x86: add kpptr_to_paddr
This commit introduces the idea of a 'kpptr', which is simply an
address that is a kernel symbol. This allows for, in the future, to
have two different translations (between pointers and physical addresses)
one for kernel symbols, and one for other memory
2016-01-12 10:04:31 +11:00
Adrian Danis
e13c41fa57 x86: Use an unsigned value for IO domain state
Verification prefers not to deal with signed numbers, and there is
no reason for these to be signed
2016-01-12 10:04:31 +11:00
Adrian Danis
2be92b88ac Merge pull request #61 in SEL4/sel4 from ~ADANIS/sel4:x86_ver to master
* commit 'e74123c37b51ada05be30749edf9ad96fa6b3ab0':
  x86: Remove underscores from symbols as they are in violation of the C standard
  x86: Move cpus to boot_state to avoid taking address of a local variable
  x86: Do not use string literals as they violate the CParser
  x86: Fix compile assert
  x86: Correct loop for verification
  x86: Add user_data_t. Needed for verification
2016-01-11 04:51:36 +00:00
Adrian Danis
e74123c37b x86: Remove underscores from symbols as they are in violation of the C standard 2016-01-11 15:29:26 +11:00
Adrian Danis
650a0f10bc x86: Add user_data_t. Needed for verification 2016-01-11 15:29:26 +11:00
Adrian Danis
8238b391c0 Merge pull request #24 in SEL4/sel4 from ~MFERNANDEZ/sel4:4bfffad6-8c14-469d-8790-ea2e8d556805 to master
* commit '4bafc8b54728440b305961fdb0a914cb513b5661':
  Remove now-unused CLZL macro.
  Remove CLZ indirection via the CLZL macro.
  Remove `boot_clzl`.
  Fix missing include.
2016-01-11 04:16:12 +00:00
Adrian Danis
f4cb2f6e9f Merge pull request #33 in SEL4/sel4 from ~MFERNANDEZ/sel4:737990ae-9ee8-4acd-8720-26da70a7602d to master
* commit '878874fb2115da90eca754050ec01ba018a2fc07':
  x86: Use PHYS_CODE abstraction instead of explicit section names.
2016-01-11 03:29:04 +00:00
Adrian Danis
54fdda0bea Merge pull request #32 in SEL4/sel4 from ~MFERNANDEZ/sel4:2aadcc6c-5d97-4cab-82eb-d35f8d62b9eb to master
* commit '0cb33dec6df40b0e4d4c1e6f2fa646017b26f40f':
  Add a configuration option to disable ANSI colours.
2016-01-11 03:28:50 +00:00
Anna Lyons
e619975c0e SELFOUR-114: make IPC buffer definition accessible to the kernel 2016-01-11 11:16:24 +11:00
Anna Lyons
d93699c9a3 SELFOUR-114: remove duplication of seL4_MessageInfo_t, adjust naming to avoid cparser mangling 2016-01-11 11:16:08 +11:00
Adrian Danis
44a522dce2 libsel4: Generate libsel4 definitions from the current ARCH as well as the SEL4_ARCH 2016-01-08 10:16:30 +11:00
Anna Lyons
7758899844 SELFOUR-244: symlink duplicated files from libsel4 into kernel rather than duplicating them, remove sanity target as a result 2016-01-05 08:33:39 +11:00
Adrian Danis
75153a08ac x86: Do not use A constraint in inline assembly as it does not work correctly between 32 and 64 bit code 2015-12-23 15:30:30 +11:00
Adrian Danis
371a891dc4 x86: Move getFaultAddr to general hardware.h, as the read_cr2 is already specialized by the machine mode 2015-12-23 11:57:09 +11:00
Adrian Danis
c6139ce4af x86: Rename ia32KScurInterrupt -> x86KScurInterrupt 2015-12-22 14:37:52 +11:00
Adrian Danis
59d820a0cc x86: Use standard calling convention instead of fastcall
There is no measureable benefit from using the fastcall calling convention
and in all but one usage location the compiler should be inlining all the
functions calls, making the calling convention completely irrelevant
2015-12-22 13:43:27 +11:00
Adrian Danis
d827cf33d1 trivial: style 2015-12-22 13:23:11 +11:00
Adrian Danis
74f620d147 x86: Rename FaultEIP and NextEIP to FaultIP and NextIP to allow for 32/64-bit independent code 2015-12-21 15:14:33 +11:00
Adrian Danis
9227ee88b8 x86: Move 32-bit specific initial address space creation to vspace_32 2015-12-21 10:34:40 +11:00
Adrian Danis
4e81ed05b0 x86: Extract 32-bit specific vspace functions in mode/vspace.c 2015-12-21 10:34:37 +11:00
Adrian Danis
19620c9395 x86: Create 32-bit specific statedata 2015-12-18 15:41:11 +11:00
Adrian Danis
8e15c42921 x86: Port some of the IOMMU changes on the experimental branch
This changes the IOMMU from using passthrough devices and instead
directly mapping in the reserved regions that are needed for each
device.
2015-12-18 15:06:39 +11:00
Matthew Fernandez
878874fb21 x86: Use PHYS_CODE abstraction instead of explicit section names. 2015-12-18 13:58:42 +11:00
Matthew Fernandez
0cb33dec6d Add a configuration option to disable ANSI colours.
Note that the default is for ANSI colours to be enabled, so behaviour will be
unchanged for projects that update to this commit and make no build
configuration changes.
2015-12-18 12:22:19 +11:00
Adrian Danis
b03c6dbf7d x86: With multi-kernel support removed make the kernel PDs etc global instead of passing them around 2015-12-18 10:50:08 +11:00
Adrian Danis
646638efee x86: Do not conditionally compile IOMMU code, use build/run time checks
Guarding code with #ifdef's makes even cursor testing of 'does this code compile'
difficult due to code being hidden by the pre-processor. Using config_set in
regular C if statements is performant as the compiler can trivially detect
dead code at compile time, and at -O1 and above will not even link in symbols
referenced by dead code in these blocks, so this will not bloat image size
2015-12-17 14:37:08 +11:00
Adrian Danis
5d42d0143e x86: Do not conditionally compile IRQ controller code, use build/run time checks
Guarding code with #ifdef's makes even cursor testing of 'does this code compile'
difficult due to code being hidden by the pre-processor. Using config_set in
regular C if statements is performant as the compiler can trivially detect
dead code at compile time, and at -O1 and above will not even link in symbols
referenced by dead code in these blocks, so this will not bloat image size
2015-12-17 14:37:08 +11:00
Adrian Danis
791db5edb9 Merge pull request #25 in SEL4/sel4 from ~ADANIS/sel4:pae to master
* commit '4413fd1be516baeac30f77da8b23c3a9fef0ec07':
  x86: Make some vspace code and definitions non-static that get used by the PAE vspace code
  libsel4: Define different lookup levels for PAE
2015-12-17 03:29:54 +00:00
Adrian Danis
4413fd1be5 x86: Make some vspace code and definitions non-static that get used by the PAE vspace code 2015-12-17 14:03:00 +11:00
Matthew Fernandez
4bafc8b547 Remove now-unused CLZL macro. 2015-12-17 13:49:10 +11:00
Adrian Danis
71a45e6b44 x86: Strip multi kernel support from the x86 kernel. This is not used and is conflicting with planned future features 2015-12-17 11:56:47 +11:00
Adrian Danis
1c53c3336c ia32: Add includes that are now needed after other includes got reordered 2015-12-17 10:58:55 +11:00
Adrian Danis
d9ff68e40a Merge pull request #14 in SEL4/sel4 from ~ADANIS/sel4:x86_common to master
* commit 'fc27f47f0cbaa72734f820160db768cbaac3a898':
  x86: Move general x86 functions to common header
  x86: Rename constants and functions to have X86 prefix instead of IA32 prefix
  x86: Make parts of what have become 32-bit specific headers common
2015-12-16 23:50:31 +00:00
Adrian Danis
1b34ed08c8 x86: Define a KERNEL_BASE_OFFSET for translating the kernel image region
This definition is different to BASE_OFFSET in that it is only meant to
apply to the kernel image portion of the kernel window, and doesn't
assume that the entire window can be translated by a single offset
2015-12-15 17:16:43 +11:00
Adrian Danis
fc27f47f0c x86: Move general x86 functions to common header 2015-12-15 17:08:28 +11:00
Adrian Danis
ef85f94a99 x86: Rename constants and functions to have X86 prefix instead of IA32 prefix 2015-12-15 17:08:28 +11:00
Adrian Danis
6729ce7823 x86: Make parts of what have become 32-bit specific headers common
The reason these were not made common to begin with is so that there
was a commit that was just a rename of these files to make any merges
with other branches that might exist easier
2015-12-15 17:08:28 +11:00
Adrian Danis
4056ad404f Merge pull request #11 in SEL4/sel4 from ~ADANIS/sel4:apic_init to master
* commit '64aed5370af89e1e1ba751941582125adfca971c':
  x86: Move APIC frequency calculation to APIC init, instead of doing it before we initialize paging
2015-12-15 03:42:00 +00:00
Anna Lyons
a0e5db7a2a Add debug functionality to print the kernel entry reason and arguments at any point in the kernel 2015-12-15 12:01:18 +11:00
Adrian Danis
64aed5370a x86: Move APIC frequency calculation to APIC init, instead of doing it before we initialize paging 2015-12-14 19:13:20 +11:00
Adrian Danis
022287c38b x86: Minimal changes to fix previous commit that renamed headers 2015-12-14 12:55:46 +11:00
Adrian Danis
c597c72fdf Move files that contain 32-bit specific code into specific 'mode'
directories

This commit is 'broken' as it leaves the repository in an unbuildable state.
The purpose of having this commit is so that there is a commit where the
modifications to these files is *just* a rename, making it easier to merge
these changes into other branches.
2015-12-14 12:48:12 +11:00
Adrian Danis
fbb4affde7 x86: Make parts of what is currently the 32-bit specific structures common 2015-12-14 12:48:12 +11:00
Adrian Danis
78e2457e91 Minimal modifications to structures file to make repository build again 2015-12-14 12:48:12 +11:00
Adrian Danis
bd7f06d2dc Move structures.bf files that contain 32-bit specific code into specific
mode directories

This commit is 'broken' as it leaves the repository in an unbuildable state.
The purpose of having this commit is so that there is a commit where the
modifications to these files is *just* a rename, making it easier to merge
these changes into other branches.
2015-12-14 12:48:12 +11:00
Adrian Danis
994c22dd13 trivial: style 2015-12-10 16:09:39 +11:00
Joel Beeren
84fb0dcdfe conversion: fixed hardcoded spec rule for clzl 2015-12-10 10:45:23 +11:00
Joel Beeren
a0c228c953 conversion: fix stray unsigned int size 2015-12-10 10:45:23 +11:00
Joel Beeren
8b62754402 conversion: standardised type of 'length' for arm 2015-12-10 10:45:22 +11:00
Joel Beeren
912089fac5 conversion: fixed unnecessary word_t change 2015-12-10 10:45:22 +11:00
Joel Beeren
94b0216258 conversion: fixed bitfield generator, clz spec 2015-12-10 10:45:22 +11:00
Adrian Danis
171824f7b7 Change additional int->word_t due to interraction with the C parser to ease verification 2015-12-10 10:45:22 +11:00
Adrian Danis
0ecff9f393 unsigned int -> word_t 2015-12-10 10:45:21 +11:00
Adrian Danis
2d61910e0f Rename uint32_t -> word_t in any relevant places 2015-12-10 10:45:20 +11:00
Adrian Danis
e3e9780a27 Rename CTZ and CLZ functions to long variants, change parameters from uint32_t to word_t to make compatible between 32 and 64-bit 2015-12-10 10:45:20 +11:00
Yanyan Shen
9f2d521979 Make cspace address walking 32/64-bit agnostic 2015-12-10 10:45:19 +11:00
Adrian Danis
3ef267618d Make utility functions 64bit friendly 2015-12-10 10:45:19 +11:00
Adrian Danis
e2c6dbca3f Cast to word_t instead of 'int' to be compatible with both 32 and 64 bit applications 2015-12-10 10:45:18 +11:00
Adrian Danis
d58d4f3e87 Use word_t for zombie pointers to be 64-bit compatible 2015-12-10 10:45:18 +11:00
Adrian Danis
fee26a8816 Change casting from int->long to be compatible with both 32 and 64 bit compilations 2015-12-10 10:45:18 +11:00
Adrian Danis
617df4a723 Rationalize standard types
This commit aims to rationalize how we represent different types
for compatiblity between ARM and x86, as well as between 32 and
64 bit code. The choices being made here is to declare that a
uint32_t has a type of 'int', this allows uint32_t to be declared
consistently across 32 and 64 bit (at least in GCC).
The word_t type is declared using a 'long' (not a uint32_t or uint64_t) to
allow for a word_t to be backed by the same type on both 32 and 64 bit
All other types that want to be declared as the size of a native word
get declared in terms of a word_t
2015-12-10 10:45:17 +11:00
Gerwin Klein
142627ade0 terminology: updated two async stragglers in comments 2015-12-03 15:54:53 +11:00
Adrian Danis
9aa7059465 Merge remote-tracking branch 'local/master' into HEAD 2015-12-02 17:49:40 +11:00
Adrian Danis
a079bd6084 Merge commit '88d73db06c327d45b6405f1ad5b94a0319f5921d' into HEAD
Conflicts:
	include/arch/arm/arch/object/structures.h
2015-12-02 17:34:02 +11:00
Adrian Danis
460c87ddf3 Merge commit '5d64d156f47c20ae049c0c854797291436f84021' into HEAD 2015-12-02 17:13:07 +11:00
Adrian Danis
6ef0b35313 x86: Add missing case for PDPT objects in cap_get_archCapSizeBits 2015-11-27 14:39:19 +11:00
Anna Lyons
a99a10408d SELFOUR-279: rename Wait -> Recv, add wrappers for seL4_Poll and seL4_Wait for notification objects.
This commit deprecates seL4_ReplyWait, removes seL4_NBwait completely,
and changes the return type of seL4_Wait to void (seL4_Wait should be
used for notification objects, and seL4_Recv should be used where
seL4_Wait was used previously for endpoints).
2015-11-20 15:28:18 +11:00
Matthew Fernandez
ab4fa44236 ARM: Replace various direct use of __attribute__ with util.h abstractions.
Use of these abstractions aids compiler portability, as only a single place in
the kernel needs to be adapted. This commit is not intended to affect either
verification or generated code.
2015-11-19 17:17:41 +11:00
Matthew Fernandez
affb802b85 Add 'fastcall' abstraction to util.h.
This change has no effect on verification or generated code.
2015-11-19 17:14:49 +11:00
Adrian Danis
a72e0468e3 Move object size definitions to arch specific headers
The size of these objects cannot be considered a common constant as
they will be different in the upcoming 64-bit ports
2015-11-13 14:43:20 +11:00
Adrian Danis
c75b3158d8 Fix definition of TCB_NAME_LENGTH to make it more correct
The previous definition of TCB_NAME_LENGTH assumed that the TCB was
split evenly into the cnode region and the rest. It did this by
calculating the size of the rest by using the size of the cnode
region. In actual fact the cnode region might be smaller, making
the size of the rest the size of the total tcb block size, minus
the cnode size. The max name length is therefore this region, minus
the size of the tcb_t
2015-11-13 14:37:13 +11:00
Adrian Danis
4db6ec7afb Always have compile_assert enabled
A compile assert has no runtime or image size overhead and so there
is no reason to not have them enabled

This commit addresses SELFOUR-289
2015-11-11 11:09:24 +11:00
Matthew Fernandez
dc147f8d3d ARM: Fix uninitialised variables.
This commit fixes two functions where a branch to the default case of a switch
statement returns an uninitialised value.
2015-11-10 17:44:04 +11:00
Anna Lyons
88d73db06c refactor tcb_t to remove duplication between x86 and arm header files 2015-11-09 17:18:43 +11:00
Anna Lyons
54603123e6 SELFOUR-317: rename async endpoint to notification object, and other
fallout.
2015-11-09 17:18:43 +11:00
Adrian Danis
f6ae69f0f0 Use autoconf generated header for standalone kernel builds
Configuring standalone kernel builds (such as those used by verification)
has been done in a completely different way to how the kernel is
configured for project builds. As the kernel gains additional options
it becomes difficult to maintain standalone kernel builds without
tediously exporting these additional options, such tedious work is
what autoconf.h is meant to address

The new configuration strategy requires a include/plat/PLAT/autoconf.h
file to exist for any platform that wants to hae standalone builds
performed on it. This configuration also becomes the *verified*
configuration, and makes it clear for projects to build the kernel
in the verified configuration.
2015-11-09 14:41:18 +11:00
Adrian Danis
8743737dae Use CONST instead of PURE in thread functions
As these functions do not read any global state they fit
within the subset of PURE that can be declared as CONST
2015-10-23 15:02:53 +11:00
Rafal Kolanski
991d7afbd5 Wrap __builtin_clz for C Parser (verification)
Create new function "clz" which invokes __builtin_clz
Tell the C parser to not try translate it (DONT_TRANSLATE), but instead
to trust the spec we provide (FNSPEC+MODIFIES).

Squashed the fix by Anna Lyons:

rearrange CLZ in util.h and s/__builtin__clz/__builtin_clz/
2015-10-21 18:52:53 +11:00
Stephen Sherratt
62727e30a2 Using bitfields to track for which priorities there exist non-empty ready queues.
Background
seL4 organizes threads into ready queues, of which there is one for each
domain, for each priority level. The ready queue for a given
domain/priority combination can be found by indexing the array
`ksReadyQueues` with "domain*num_priorities + priority".

Current scheduler implementation
To find the non-empty ready queue with the maximum priority for the current domain,
seL4 iterates through `ksReadyQueues`, starting with the element
corresponding to the current domain and maximum possible priority, and
decrementing the priority until a non-empty queue is found. This is
problematic in cases where the only ready threads have low priorities,
as iterating through many elements of an array effectively flushes the
cache.

Changes in this patch
This patch replaces the iteration with a lookup into a table of
bitfields per domain. Using bitfields allows the kernel to determine the
highest priority level with a non-empty ready queue for the current
domain by counting the leading zeroes in bitfields. This removes the
negative cache effects of iterating through an array.

Implementation details
For each domain, a multilevel table of bitfields is maintained which
stores the priority levels within that domain for which there exist
ready threads. On a 32-bit architecture, the top level of the table is a 32-bit bitfield where if
the ith bit is set, there is at least 1 priority level in
[i*32..i*32+31] with a non-empty ready queue. The positions of bits in
this bitfield are used as indices into the second level table, which is
an array of 32-bit bitfields. The ith bit of the jth bitfield in this
array set to 1, indicates that priority level j*32+i has a non-empty
ready queue.
2015-10-21 18:52:44 +11:00
Stephen Sherratt
c99c1b79a0 Added a wordRadix constant to x86 kernel. 2015-10-21 18:33:16 +11:00
Anna Lyons
d9802d179f Add seL4_NBWait: non blocking wait for notifications and endpoints. 2015-10-21 13:43:39 +11:00
Siwei Zhuang
73a7410638 Update the size of tcb structure. 2015-10-19 17:33:41 +11:00
Siwei Zhuang
9d909f743a Merge remote-tracking branch 'seL4/master' into arm_hyp
Conflicts:
	include/arch/arm/arch/api/constants.h
	libsel4/arch_include/arm/sel4/arch/types.h
	src/fastpath/fastpath.c
	src/plat/exynos5/machine/hardware.c
2015-10-16 14:41:36 +11:00
Anna Lyons
1fecec2560 add compile asserts to check objects are the sizes we expect them to be 2015-10-13 15:30:20 +11:00
Anna Lyons
79be32ace2 AEP -> Notification: deprecate old API syscalls, functions and constants that refer to AEP's and introduce new ones that refer to Notifications 2015-10-13 13:26:04 +11:00
Adrian Danis
97042a0f07 Introduce 'Notification Binding': a new feature which allows a tcb to be bound to a single asynchronous endpoint. 2015-10-09 15:19:58 +11:00
Anna Lyons
07a7f4c42e generate warnings for incorrect format strings for kprintf, bring stdint.h
inline for x86 and arm and fix some format strings as a consequence
2015-09-30 12:31:39 +10:00
Stephen Sherratt
0a2340c3e8 Trivial: style 2015-09-08 12:46:09 +10:00
Stephen Sherratt
4b3ac0e8e7 Surrounding benchmarking definitions with "#if CONFIG_MAX_NUM_TRACE_POINTS > 0". 2015-09-08 12:46:09 +10:00