Commit graph

107 commits

Author SHA1 Message Date
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
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
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
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
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
Stephen Sherratt
e82953a194 Removed CONFIG_BENCHMARK config option. All checks for '#ifdef CONFIG_BENCHMARK' replaced with '#if CONFIG_MAX_NUM_TRACE_POINTS > 0'. 2015-09-03 11:39:31 +10:00