Commit graph

19 commits

Author SHA1 Message Date
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