Commit graph

59 commits

Author SHA1 Message Date
Adrian Danis
2acccc92df x64: force return via IRQ path so that register writes have an affect 2016-10-12 12:22:32 +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
Bamboo
b77903cc6f [STYLE_FIX] 2016-10-05 00:14:58 +00:00
Matthew Brecknell
8050cf0987 SELFOUR-276: remove some redundant checks
Existing thread priorities and MCPs are already guaranteed to be less than
seL4_MaxPrio.
2016-10-05 11:11:19 +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
Xin,Gao
59aa0ccd6f SELFOUR-421: minor changes for c-refine 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
Anna Lyons
ce2c058f3d SELFOUR-607: inline remaining irq path functions 2016-08-09 16:18:34 +10:00
Hesham Almatary
d97603bd84 SELFOUR-566: Decouble seL4_DebugNameThread from CONFIG_PRINTING 2016-07-15 12:30:17 +10:00
Anna Lyons
69f140a226 trivial: remove duplicated setMRs_syscall_error 2016-07-12 14:44:14 +10:00
Anna Lyons
cffe5a5ce7 SELFOUR-511: remove -Wdeclaration-after-statement
And change a line of code for verification to
test if it works.
2016-06-20 10:45:50 +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
Anna Lyons
9a7b1aecfd Trivial: move printfs in handleReservedIRQ up.
This wraps the printfs in CONFIG_IRQ_REPORTING
and reduces redundancy.
2016-06-07 11:50:11 +10:00
Adrian Danis
9842801382 SELFOUR-433: Shift as a 32-bit value
Shifting as an unsigned long long does not work on some ARM compilers
as the kernel is not linked against libgcc
2016-05-26 11:00:42 +10:00
Adrian Danis
73a54b0cbc SELFOUR-433: Prevent undefined shift in userError message 2016-05-25 16:29:52 +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
Adrian Danis
de8a73676b trivial: Add unlikely 2016-03-17 11:20:36 +11:00
Adrian Danis
831892a43b trivial: Fix types when printing
The type of irq_t differs per platform, this commit just forces
a conversion to an int, which should be sufficient for a debug
message
2016-03-17 11:17:47 +11:00
Adrian Danis
06bd6e0060 SELFOUR-420: Avoid indexing intStateIRQTable with an invalid IRQ 2016-03-17 10:50:34 +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
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
812a73a9f5 trivial: style 2016-02-02 16:24:23 +11: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
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
9b444eddab Merge pull request #17 in SEL4/sel4 from ~MFERNANDEZ/sel4:c7422aa2-0bab-4675-977b-709a7281c3b9 to master
* commit '0151d78dbd75931ec781d79b58990665392bd9ac':
  Fix comment reference to Haskell error.
2016-01-11 03:26:14 +00: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
Matthew Fernandez
0151d78dbd Fix comment reference to Haskell error. 2015-12-16 12:29:06 +11:00
Joel Beeren
063e04877c conversion: uncommit auxupd 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
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
6474aceaf0 Change types from uint32_t->word_t to be 32/64bit agnostic 2015-12-10 10:45:18 +11:00
Gerwin Klein
142627ade0 terminology: updated two async stragglers in comments 2015-12-03 15:54:53 +11:00
Thomas Sewell
7f08b8a534 Create array types in retype AUXUPDs. 2015-12-02 09:19:12 +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
Stephen Sherratt
1ea0c2c6a7 Replaced "async endpoint" with "notification" in comments and error messages 2015-11-17 16:24:24 +11:00
Anna Lyons
54603123e6 SELFOUR-317: rename async endpoint to notification object, and other
fallout.
2015-11-09 17:18:43 +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
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
Anna Lyons
d9802d179f Add seL4_NBWait: non blocking wait for notifications and endpoints. 2015-10-21 13:43:39 +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
Matthew Fernandez
3a015efea9 Trivial: Remove unnecessary #includes. 2015-07-28 10:33:06 +10:00
Thomas Sewell
c3dec90224 Fix style and unused variable warnings. 2015-07-14 15:51:13 +10:00
Thomas Sewell
fd1c946c72 Adjust -1 syntax for new Isabelle. 2015-07-14 14:15:27 +10:00
Thomas Sewell
0b162d7d3f Weaken cap_async_cap cteDeleteOne assertions.
It's true that the interrupt node must contain async endpoint
caps, but we never proved the relevant invariant, and it doesn't
change much.
2015-07-14 14:15:27 +10:00
Thomas Sewell
67d8d041de Ghost assertions about max object size. 2015-07-14 14:15:27 +10:00
Thomas Sewell
b0e9e46804 Ghost assertions for cteDeleteOne. 2015-07-14 14:15:27 +10:00