Commit graph

1941 commits

Author SHA1 Message Date
Adrian Danis
c6e4cc3ea1 Correct L2 bitmap size calculation and put it in one place
This corrects the calculation of the L2 bitmap size to correctly handle cases where the
requested num priorities is not a clean multiple of the wordBits
2017-11-28 10:18:35 +11:00
Anna Lyons
252962c5bb aarch64: CONFIG_EXPORT_(PCNT_USER|VCNT_USER)
Implement configs which export the physical and or virtual generic timer
count register to use level.

This brings it inline with armv8 (aarch32) and armv7.
2017-11-28 10:14:12 +11:00
Anna Lyons
8397feae4a aarch64: implement cycle counter, PMU
- add timestamp(), timestamp_t for aarch64
- implement CONFIG_EXPORT_PMU_USER
2017-11-28 10:14:12 +11:00
Anna Lyons
e753404913 Provide a general ARM timestamp function
Use SYSTEM_READ_WORD, each platform defines the CCNT constant.
2017-11-28 10:14:12 +11:00
Anna Lyons
3017f9b72a Move timestamp_t definition to types.h
it was causing circular references in files where it is defined and
hardware macros are also used.
2017-11-28 10:13:49 +11:00
Hesham Almatary
3d2ae69f9c ARM/SMP: Re-implement atomic exchange taking sel4 IPI into account 2017-11-23 14:35:54 +11:00
Anna Lyons
d833f9a0c9 Hikey: disable DANGEROUS_CODE_INJECTION
DANGEROUS_CODE_INJECTION does not work on the Hikey due to the current
state of the vspace implementation.
2017-11-23 11:54:45 +11:00
Adrian Danis
6707a74131 x86: GetStatusBits only defined on ia32
The GetStatusBits invocation is only implemented on ia32. Adding the condition to the
XML list prevents the invocation from being in the list of invocations on x86_64, when
it has no implementation.
2017-11-22 17:01:03 +11:00
Anna Lyons
49a26db19d Combine common arm generic timer code
Previously both aarch32 and aarch64 duplicated common
generic timer code. Unify them in include/arch/arm/machine/timer.h
2017-11-20 14:37:55 +11:00
Anna Lyons
3de2b5cfe9 Initialise gpt_cnt_tval to squash compiler warning 2017-11-20 14:37:55 +11:00
Anna Lyons
fff4f1b580 Make TIMER_RELOAD check 64-bit compatable
This check checks the TIMER_RELOAD fits in the wordsize.
Use UINTPTR_MAX instead of 0xffffffff so the check can be moved
to mode agnostic code.
2017-11-20 14:37:55 +11:00
Anna Lyons
cb81478015 aarch64: add constants for generic timer
This brings the aarch64 generic timer into exactly the same code as
the aarch32 generic timer.
2017-11-20 14:37:55 +11:00
Anna Lyons
c11f18cbf3 ARM generic timers: use aarch agnostic macros 2017-11-20 14:37:55 +11:00
Anna Lyons
07d796790a Add generic macros for aarch32/64 system access
This commit generalises 32 and 64 bit configuration for arm: 32bit uses
coprocessor access through mrc/mcr, 64bit system configuration through
msr,mrs

- SYSTEM_READ|WRITE_WORD: read or write configuration word
- SYSTEM_READ|WRITE_64  : read or write 64bits of configuration
2017-11-20 14:37:55 +11:00
Anna Lyons
4b2114782c Add stdint MAX definitions
- UINTPTR_MAX
- UINT64_MAX
- UINT32_MAX
- INT64_MAX
- INT32_MAX
2017-11-17 14:49:27 +11:00
Adrian Danis
87923b720b cmake: Additional TOPLEVELTYPES for x86-64 2017-11-15 17:33:13 +11:00
Adrian Danis
9a89cbe4c6 cmake: TOPLEVELTYPES declared as target property
TOPLEVELTYPES is not intended to be configurable by the user, rather is a reflection
on the types defined by the source. This changes the TOPLEVELTYPES argument to be
a property, allowing it to be constructed as a generator expression when generating
BF files. By being a property, and not something like a global property, it removes
the need to ensure that additions to TOPLEVELTYPES are done prior to any bitfield
target definitions.
2017-11-15 17:33:13 +11:00
Adrian Danis
9134ae3ee4 cmake: Custom target for holding properties
Defines an empty custom target whose purpose is to hold properties and configuration
data that can be retrieved using generator expressions in the build phase.
2017-11-15 17:33:13 +11:00
Adrian Danis
a2c8462efb cmake: Expand lists in BF generation
Uses the COMMAND_EXPAND_LISTS flag to allow for generator expressions in parameters
to GenBFCommand. As lists are now being expanded the 'args' variable must also be
quoted.
2017-11-15 17:33:13 +11:00
Claudia Tu
74a741b5bc Fix typo 2017-11-15 14:07:34 +11:00
Adrian Danis
9d4010e0b3 Print single IRQ error
`Arch_checkIRQ` already prints an error message in the case of x86. Printing the additional
error message is both unnecessary, confusing as the message makes no sense on x86. As the
error does make sense on ARM this commit moves the message to the arm `Arch_checkIRQ`
2017-11-10 11:37:34 +11:00
Adrian Danis
8a72227d52 x86: PIC code visible during compilation
These functions are referenced from code that is not guarded by an #ifdef CONFIG_IRQ_PIC,
which was only working due to the optimizer being able to elide the calls prior to
linking.
2017-11-09 14:17:42 +11:00
Joel Beeren
092042f7c5 x64: add MODIFIES statements for extern functions
The CParser can't deduce modifies rules for functions without
definitions (like in8, out8 et al and interrupt handler functions).
This adds explicit modifies rules for these functions.
2017-11-09 12:18:31 +11:00
Adrian Danis
f00cceda7f x86: User zero as idle thread stack sentinel
The RSP of the idle thread is checked to determine whether an interrupt occured in the idle
thread or during a pre-emptible period of kernel execution. This changes the sentinel value
to be a constant 0, instead of the address of the IRQ stack. Using zero is simpler, prevents
any relation to the stack being used to save values and is simpler for verification as it
is a clear constant value.
2017-11-07 17:30:48 +11:00
Adrian Danis
aa3fc06c79 cmake: Make variables show up if previously hidden
Previously if a variable had unmet dependencies and had been hidden, by being made
an internal variable, it would not have been unhidden by the use of `option`. This
emulates the behaviour of `option` that we were wanting, but additionally using `FORCE`
to override the `INTERNAL` setting
2017-11-03 16:39:45 +11:00
Adrian Danis
24a69963e7 cmake: Directly generate configuration files
Uses file(GENERATE) to directly create the contents of generated configuration files instead of
awkwardly using custom commands to echo the contents of multi line strings into files.
2017-11-03 13:49:37 +11:00
Adrian Danis
89fb678db8 cmake: Invoke compilations without echo and xargs
Newer versions of cmake provide a COMMAND_EXPAND_LISTS option that allows a quoted string,
such as "a;b" to be given to a COMMAND parameter and have it expand into multiple arguments.
Using this we can much more nicely generate some of our COMMAND invocations, at the cost of
requiring a more recent cmake version
2017-11-03 13:49:37 +11:00
Adrian Danis
2b6e302008 cmake: Avoid placing lists in generator expressions
Placing lists directly in the generater expression means that this string, despite having
semicolons in it, is not actually a list, as it has an expression (the generator expression)
spanning multiple lists. This leads to confusion during argument processing and expansion
2017-11-03 13:49:37 +11:00
Adrian Danis
9dc8c3b0ca cmake: Avoid calling OS specific shell commands
cmake provides a command-line tool mode (via -E) to allow for doing common shell
operations in an OS agnostic way. Using this makes these scripts more portable
across OSes and environments
2017-11-03 13:49:37 +11:00
Adrian Danis
4e121d0c48 smp: Use explicit fences instead of volatile
This provides a more robust and efficient implementation that only forces memory reloads
at explicit known points, instead of the over approximation of every time they are
accessed that is forced by volatile.
2017-11-03 11:39:32 +11:00
Gerwin Klein
38cc67e821 slightly more Mac friendly cmake commands
Mac has BSD sed, not GNU sed; tr seems to be more portable.
2017-11-02 13:39:13 +11:00
Adrian Danis
836e802a59 cmake: Just use march for setting ARM kernel compilation options 2017-10-30 14:01:42 +11:00
Adrian Danis
d2644e8ab7 Declare and check IPC buffer size
Adds a named constant of the IPC buffer size bits that can be used when checking the
size/alignment of an IPC buffer. This constant has a compile time assertion to ensure
it corresponds to the actual IPC buffer
2017-10-27 16:12:18 +11:00
Adrian Danis
3a48b9fa33 cmake: Unset CACHE variables from the CACHE
These variables were meant to be removed from the cache
2017-10-27 14:13:31 +11:00
Adrian Danis
777f19645b cmake: Correctly set options to their DEFAULT_DISABLED values
The config_option helper was previously using cmake_dependent_option, which supposedly took
a value to set the option to in the case where it was disabled. However, this only sets
the value in the current function context, and not the cache. I do not understand why this
is the case and it seems to make that functionality completely useless. This commit simply
does the dependency checking itself and correctly sets the disabled value.
2017-10-27 14:13:05 +11:00
Adrian Danis
5e273cc7bd cmake: Easier setting of ARM cross compiler
Allows for an ARM cross compiler to be specified with just -DARM=TRUE when initializing
cmake, instead of having to specify a full cross compilation prefix. This provides no
additional functionality, but provides a nicer interface for users
2017-10-27 13:55:46 +11:00
Adrian Danis
c04d9ce8ce cmake: Use check_c_compiler_flag
This is more robust than manually using check_c_sources_compile
2017-10-27 13:53:56 +11:00
Bamboo
bbb9717cd8 [STYLE_FIX] 2017-10-27 01:30:35 +00:00
Adrian Danis
15c0f0eb75 Increase badge size for endpoints on 64-bit platforms
This unifies the badge size of endpoints and notifications on 64-bit platforms to a
consistent 64-bits, and also changes the libsel4 definitions to match for both.
2017-10-27 12:15:09 +11:00
Adrian Danis
b5854775a5 Increase size of guards on 64-bit platforms
The maximum guard size was unnecessarily restricted to 18 bits as it is on 32-bit
platforms. This change increases it to the current maximum possible of 58 bits.
The 58-bit limitation exists due to the need to encode a guard+guardsize into a
single word for cnode invocations.
2017-10-27 12:15:09 +11:00
Adrian Danis
bdf78d2361 libsel4: Correct 64-bit guard size bits constant
This constant was incorrectly defined as 5 when it is actually 6 on 64-bit kernels
2017-10-27 12:15:09 +11:00
Adrian Danis
2a70716833 libsel4: Make guard and badge definitions mode specific
The definitions of guard and badge sizes is going to be changed for 64-bit platforms,
this change provides an easy way of providing different definitions
2017-10-27 12:15:09 +11:00
Adrian Danis
8108c811ed libsel4: Remove bitfield type unifying Guard and Badge construction
Using the bitfield generator to treat guards and badges as a union type can be convenient,
but it requires reserving a bit in the data for the bitfield run time type information.
This type information is not needed by the kernel as it knows implicitly whether the passed
data is a badge or a guard based on the kind of cap being operated on. However, with the
type information present we cannot pass a word sized piece of data to the kernel.

The solution here is to go back to using a plain seL4_Word as the type for invocations
that want a capdata and let the user either construct a badge as a plain word, or use
the seL4_CNode_CapData bitfield for constructing a guard, although they have to manually extract
the word representation out of it.
2017-10-27 12:15:09 +11:00
Adrian Danis
2e6cadd9f0 Rename cnode_capdata to seL4_CNode_CapData
The purpose of renaming this type is to match the style of the other shared types in libsel4.
Previously its name was fine as this was a private kernel type.
2017-10-27 12:14:44 +11:00
Adrian Danis
5f4640dc6c Move cnode_capdata to libsel4 shared types bitfield
This data structure is meant to be the user visible format of the data for a cnode_cap,
yet it is defined in a kernel only bitfield file. Moving it to libsel4 opens up the
possibility of consolidating the definitions in libsel4
2017-10-27 12:14:44 +11:00
Hesham Almatary
00a0577790 Benchmark: account for thread utils on 64-bit archs' fastpath 2017-10-27 09:32:56 +11:00
Adrian Danis
18db530231 Abstract zombie word radixes
Zombie caps perform bit packing that relied on the log2(wordBits), which was being
hard coded to 5. Whilst 5 is the correct value on 32-bit platforms, it is incorrect
on 64-bit ones. This changes the previously hardcoded 5 to be the, already existing,
wordRadix definition.
2017-10-26 11:50:51 +11:00
Adrian Danis
827d9f9705 Merge branch master into zcu102-7.0.0 2017-10-26 11:49:45 +11:00
Nathan Studer
9e5f1e60b6 Make clock check a warning only instead of a hard fault
This clock value isn't set consistently on some platforms due to software
rounding, so halting here tends to happen a lot.  Instead print a warning
and continue on.

For example using a default Xilinx platform with a 33.333... MHz oscialltor
and a default bootloader the clock value will be somewhere in the range
99999000-100000000, which for most practical purposes is the same thing.

Since this register is written by software and doesn't have the precision to
fully represent common hardware oscillator frequencies, this check seems overly
strict anyway.
2017-10-24 13:15:54 -04:00
Hesham Almatary
a66feddb8c Manual: Delete a sentence that's not valid anymore 2017-10-24 15:09:16 +11:00