Commit Graph

30 Commits

Author SHA1 Message Date
Hesham Almatary
f1ef8b3a55 ARM: Fix assembler error with BIT definition 2017-06-02 10:56:15 +10:00
Hesham Almatary
1930cf2e44 Fix: Allow util.h to be included in assembly files 2017-05-29 15:45:22 +10:00
Adrian Danis
f8606c86ad Provide spec for CTZL
Provides a spec for the __builtin_ctzl function and changes existing
code to use this wrapper
2017-02-22 17:22:17 +11:00
Thomas Sewell
117785483a Mark halt as no-inline and no-return.
This actually leads to better code. Copies of the halt loop inlined
in various places will instead be single instructions 'bl halt'. It's
also important for the translation validation to avoid having
pointless loops everywhere, especially inside the bodies of other
loops.
2016-12-12 17:30:50 +11:00
Thomas Sewell
9b7435718f Prototype compiler builtins.
Add compatible prototypes for compiler builtins
__builtin_unreachable, __builtin_ctzl, __builtin_clzl,
and __builtin_popcountl.

The compiler ignores these, but they are necessary for the Isabelle
C parser to handle them. This is needed to drop DONT_TRANSLATE markers
from various functions which call these builtins.
2016-12-12 17:30:49 +11:00
Adrian Danis
e7d0a88664 x86: Rewrite config_default as config_ternary for FPU
config_default was intended to either evaluated to the passed configuration
value, or the a default value if the config didn't exist. For integer values
this does not actually work, and the default value always gets returned.
This commit reimplements the desired functionality as config_ternary, which
takes 3 arguments, a config to switch on and a desired true and false expansion
2016-11-25 14:44:08 +11:00
Adrian Danis
859100e0a1 Merge pull request #288 in SEL4/sel4 from ~ALYONS/sel4:arch-fault to master
* commit 'ed95f84a438aea6365762a180cc493113e9282e0':
  SELFOUR-413: changes for verification
  SELFOUR-567: use seL4_CapRights_t from libsel4
  SELFOUR-413: refactor libsel4 fault API
  Split fault types into arch/generic
2016-11-25 14:31:09 +11:00
amrzar
08bc937f21 add DONT_TRANSLATE for popcount builtin 2016-11-25 14:04:46 +11:00
Anna Lyons
ed95f84a43 SELFOUR-413: changes for verification
Avoid using ptrs to arrays at all

Another macrofull change brought to your by verification. This should
avoid nasty proofs about const pointers.
2016-11-25 12:30:29 +11:00
Anna Lyons
33a771d3cb Split fault types into arch/generic
Prior to this commit faults were separate
per architecture. This commit extracts the common
fault types and introduces arch specific faults,
reducing code duplication across architectures.
2016-11-25 12:29:07 +11:00
amrzar
b3b7e3cbf9 x86: use popcount for IPIs 2016-11-24 15:56:35 +11: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
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
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
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
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
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
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
Matthew Fernandez
4bafc8b547 Remove now-unused CLZL macro. 2015-12-17 13:49:10 +11:00
Joel Beeren
84fb0dcdfe conversion: fixed hardcoded spec rule for clzl 2015-12-10 10:45:23 +11:00
Joel Beeren
94b0216258 conversion: fixed bitfield generator, clz spec 2015-12-10 10:45:22 +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
Adrian Danis
3ef267618d Make utility functions 64bit friendly 2015-12-10 10:45:19 +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
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
Adrian Danis
2637108626 ia32: Ensure multiboot structs are packed
This is a paranoia commit as most compilers will not
pad members of a struct if they are all the same size,
but this commit ensures it.
2015-05-28 12:09:12 +10:00
Sean Peters
8abdf6c5ed ia32: added the option to disable prefetchers 2015-04-15 14:38:55 +10:00
TrusthworthySystems
91b7da8625 Release snapshot 2014-07-18 05:03:59 +10:00