Commit graph

138 commits

Author SHA1 Message Date
Andrew Boie 45979dafb4 linker: add iterable section macros
For iterable areas defined with Z_STRUCT_SECTION_ITERABLE(),
the corresponding output section in the linker script is just
boilerplate. Add macros to make these definitions simpler.

Unfortunately, we have a fair number of iterable sections not
defined with Z_STRUCT_SECTION_ITERABLE(), this patch does not
address this.

The output sections are all named <struct name>_area, update
sanitylib.py with this.

sys_sem with no userspace, and k_lifo/k_fifo are special cases
where different data types that are all equivalent need to be
put in the same iterable area. Add
Z_STRUCT_SECTION_ITERABLE_ALTERNATE() for this special case.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-24 17:09:22 -04:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Kumar Gala 7dc3ecd63d stdint.h: Make {u}int64_t types consistent regardless of arch
On 64-bit arch's like AARCH64, x86_64, or riscv-64 the way {u}int64_t
will differ from how its defined on 32-bit arch's.  Do the same trick we
do for {u}int32_t for {u}int64_t so that the type is the same regardless
of what we are building for.

This keeps things like %lld working the same regardless of 32-bit or
64-bit arch.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Andrew Boie 299ec8f1b5 userspace: net sockets are kernel objects
Any data structure declaration tagged with __net_socket will end up
in the kernel object table with type K_OBJ_NET_SOCKET. These all
correspond to objects which are associated with socket file
descriptors and can handle the socket vtable API.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Daniel Leung 04a3d9906c toolchain: Fix warning about too few arguments on BUILD_ASSERT()
Commit c408fa88a3 introduced changes
to the BUILD_ASSERT() macro so the MSG argument is optional.
However, in include/toolchain/common.h, the BUILD_ASSERT()
definition has not made the MSG argument as optional which results
in build errors complaing about too few arguments. Fix by adding
some dots there.

This is observed when using XCC (based on Clang 3.9).

Fixes #24008

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-04-11 11:09:20 -04:00
Oleg Zhurakivskyy c408fa88a3 toolchain: common: Merge build assert macros
In order to de-duplicate 2 macros with the same use,
merge BUILD_ASSERT(), BUILD_ASSERT_MSG() into one macro.

Make BUILD_ASSERT_MSG() deprecated.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-31 07:18:06 +02:00
Carles Cufi cd38fb1610 Revert "toolchain: common: Merge build assert macros"
This reverts commit 974aa3add4.

Pull Request #23437 was merged by mistake with an invalid manifest.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-03-19 18:45:13 +01:00
Oleg Zhurakivskyy 974aa3add4 toolchain: common: Merge build assert macros
In order to de-duplicate 2 macros with the same use,
merge BUILD_ASSERT(), BUILD_ASSERT_MSG() into one macro.

Make BUILD_ASSERT_MSG() deprecated.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-19 15:47:53 +01:00
Corey Wharton ccd15df510 scripts: Dynamically add driver subsystems to subsystems list
This change extends the parse_syscalls.py script to scan for a
__subsystem sentinal added to driver api declarations. It thens
generates a list that is passed into gen_kobject_list.py to extend
the subsystems list. This allows subsystems to be declared in the
code instead of a separate python list and provides a mechanism for
defining out-of-tree subsystems.

Signed-off-by: Corey Wharton <coreyw7@fb.com>
2020-03-11 17:13:39 +02:00
Carlo Caione b4335a04ac arm: aarch64: Reintroduce _ASM_FILE_PROLOGUE
This is currently missing from the AArch64 assembly files.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-03-11 09:34:24 +01:00
Stephanos Ioannidis 0bd86f3604 arch: arm: aarch32: Allow selecting compiler instruction set
This commit introduces the `COMPILER_ISA_THUMB2` symbol to allow
choosing either the ARM or Thumb instruction set for C code
compilation.

In addition, this commit introduces the `ASSEMBLER_ISA_THUMB2` helper
symbol to specify the default target instruction set for the assembler.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-10 17:51:32 +01:00
Andrew Boie f1b1332c94 x86: fix large Kconfig values on 64-bit
Use the special x86 operand modifier 'p' to print the raw value.
This fixes an issue on x86-64 where errors were generated
if a constant larger than INT_MAX was used.

Values larger than UINT_MAX are still unsupported (on any arch).

Fixes: #22542

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-02-13 09:03:03 +02:00
Ulf Magnusson 46f98d86c7 include: gcc.h: Add a __WARN() macro with a custom warning on expansion
Works like __DEPRECATED_MACRO with a custom message. Can do this for
example:

    #define FOO __WARN("Please use BAR instead") ...

Implement __DEPRECATED_MACRO with __WARN().

Useful for https://github.com/zephyrproject-rtos/zephyr/pull/21506.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-01 08:48:17 -05:00
Carlo Caione 87d8a035dd arch: arm64: Support aarch64-gcc compiler
To be able to successfully compile the kernel for the ARM64 architecture
we have to tweak the compiler-related files to be able to use the
AArch64 GCC compiler.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-02-01 08:08:43 -05:00
Peter Bigot bfa3eb17b2 toolchain: gcc: respect existing deprecated macro define
The __deprecated symbol can be pre-defined to avoid warnings of use of
deprecated API in tests of that API.  Enable that same feature for
macros that are deprecated.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-31 12:32:50 -08:00
Daniel Leung e73231f7f0 toolchain: xcc: use Clang if exists
The XCC toolchain may come with Clang front-end depending on
how it's built. Currently, the only SoC/board using XCC is
the intel_s1000_crb and its XCC toolchain comes with Clang
3.9.0 which has a lot better support for C99 and C++11 than
the portion based on GCC 4.2 (which does not even support
C++11). So this change attempts to use the Clang portion
instead of GCC if the Clang executable exists.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-01-07 17:09:38 +01:00
Daniel Leung d390bb2d66 xtensa: define UINT32_C macro for XCC
Newer XCC versions wrap unsigned int with UINT32_C(x)
in their own macros. However, the #include chain
usually does not contain UINT32_C(x). To make matters
worse, including stdint.h (where UINT32_C is defined)
in toolchain/xcc.h would cause the linker script to
contain a bunch of typedef which are invalid for
linker scripts. So define UINT32_C(x) manually.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-01-07 17:09:38 +01:00
Daniel Leung a058219245 toolchain: fix __BYTE_ORDER__ not defined for XCC
Commit 571741a0c5 introduced a block to determine __BYTE_ORDER__
within toolchain/gcc.h. However, toolchain/xcc.h defined
__BYTE_ORDER__ there but the early inclusion of gcc.h causes
errors since __BYTE_ORDER__ cannot be determined within gcc.h.
So wrap around the gcc.h include with a fake __BYTE_ORDER__ to
bypass the check in gcc.h.

Also set the __BYTE_ORDER__ to the correct __ORDER_*_ENDIAN__
macro.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-12-02 09:58:00 -05:00
Stephanos Ioannidis 2d7460482d headers: Refactor kernel and arch headers.
This commit refactors kernel and arch headers to establish a boundary
between private and public interface headers.

The refactoring strategy used in this commit is detailed in the issue

This commit introduces the following major changes:

1. Establish a clear boundary between private and public headers by
  removing "kernel/include" and "arch/*/include" from the global
  include paths. Ideally, only kernel/ and arch/*/ source files should
  reference the headers in these directories. If these headers must be
  used by a component, these include paths shall be manually added to
  the CMakeLists.txt file of the component. This is intended to
  discourage applications from including private kernel and arch
  headers either knowingly and unknowingly.

  - kernel/include/ (PRIVATE)
    This directory contains the private headers that provide private
   kernel definitions which should not be visible outside the kernel
   and arch source code. All public kernel definitions must be added
   to an appropriate header located under include/.

  - arch/*/include/ (PRIVATE)
    This directory contains the private headers that provide private
   architecture-specific definitions which should not be visible
   outside the arch and kernel source code. All public architecture-
   specific definitions must be added to an appropriate header located
   under include/arch/*/.

  - include/ AND include/sys/ (PUBLIC)
    This directory contains the public headers that provide public
   kernel definitions which can be referenced by both kernel and
   application code.

  - include/arch/*/ (PUBLIC)
    This directory contains the public headers that provide public
   architecture-specific definitions which can be referenced by both
   kernel and application code.

2. Split arch_interface.h into "kernel-to-arch interface" and "public
  arch interface" divisions.

  - kernel/include/kernel_arch_interface.h
    * provides private "kernel-to-arch interface" definition.
    * includes arch/*/include/kernel_arch_func.h to ensure that the
     interface function implementations are always available.
    * includes sys/arch_interface.h so that public arch interface
     definitions are automatically included when including this file.

  - arch/*/include/kernel_arch_func.h
    * provides architecture-specific "kernel-to-arch interface"
     implementation.
    * only the functions that will be used in kernel and arch source
     files are defined here.

  - include/sys/arch_interface.h
    * provides "public arch interface" definition.
    * includes include/arch/arch_inlines.h to ensure that the
     architecture-specific public inline interface function
     implementations are always available.

  - include/arch/arch_inlines.h
    * includes architecture-specific arch_inlines.h in
     include/arch/*/arch_inline.h.

  - include/arch/*/arch_inline.h
    * provides architecture-specific "public arch interface" inline
     function implementation.
    * supersedes include/sys/arch_inline.h.

3. Refactor kernel and the existing architecture implementations.

  - Remove circular dependency of kernel and arch headers. The
   following general rules should be observed:

    * Never include any private headers from public headers
    * Never include kernel_internal.h in kernel_arch_data.h
    * Always include kernel_arch_data.h from kernel_arch_func.h
    * Never include kernel.h from kernel_struct.h either directly or
     indirectly. Only add the kernel structures that must be referenced
     from public arch headers in this file.

  - Relocate syscall_handler.h to include/ so it can be used in the
   public code. This is necessary because many user-mode public codes
   reference the functions defined in this header.

  - Relocate kernel_arch_thread.h to include/arch/*/thread.h. This is
   necessary to provide architecture-specific thread definition for
   'struct k_thread' in kernel.h.

  - Remove any private header dependencies from public headers using
   the following methods:

    * If dependency is not required, simply omit
    * If dependency is required,
      - Relocate a portion of the required dependencies from the
       private header to an appropriate public header OR
      - Relocate the required private header to make it public.

This commit supersedes #20047, addresses #19666, and fixes #3056.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-11-06 16:07:32 -08:00
Daniel Leung b7eb04b300 x86: consolidate x86_64 architecture, SoC and boards
There are two set of code supporting x86_64: x86_64 using x32 ABI,
and x86 long mode, and this consolidates both into one x86_64
architecture and SoC supporting truly 64-bit mode.

() Removes the x86_64:x32 architecture and SoC, and replaces
   them with the existing x86 long mode arch and SoC.
() Replace qemu_x86_64 with qemu_x86_long as qemu_x86_64.
() Updates samples and tests to remove reference to
   qemu_x86_long.
() Renames CONFIG_X86_LONGMODE to CONFIG_X86_64.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-10-25 17:57:55 -04:00
Andrew Boie e69997eb77 include: gcc.h: include header needed by posix
This header makes a call to posix_print_error_and_exit,
but pulls in no prototype.

Linker scripts use nothing in this file, move the #ifndef
_LINKER to the toplevel.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-10-21 10:13:38 -07:00
Anas Nashif dffc944437 toolchain: check if __deprecated is defined
This macro is defined on some operating systems, so make sure we do not
redefine it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Krzysztof Chruscinski bea966dea1 toolchain: Add single arguments evaluation macros for min and max
MAX() and MIN() were evaluating arguments twice. If arguments are
functions they were called twice which resulted in bigger code
and potential misbehavior.

Added alternative macros (Z_MAX, Z_MIN) which can be used instead.
Macros have usage limitations thus they are not replacements. They
are also relying on GCC extension thus placed in gcc.h

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-09-25 17:41:03 +02:00
Stephanos Ioannidis 571741a0c5 toolchain: Add __BYTE_ORDER__ definition to the GCC toolchain header.
__BYTE_ORDER__ preprocessor definition is not defined by older versions
of GCC. The definitions for __ORDER_BIG_ENDIAN__,
__ORDER_LITTLE_ENDIAN__ and __BYTE_ORDER__ by automatic detection using
arch-specific endianness definitions have been added.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-09-19 08:13:52 -04:00
Bradley Bolen 7daf42b123 Revert "toolchain: gcc: Remove ref. to undefined sym. CONFIG_ISA_ARM"
This reverts commit e20fd5f454.

This is needed for Cortex-R support.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2019-08-09 22:50:50 +02:00
Nicolas Pitre 1f4b5ddd0f riscv32: rename to riscv
With the upcoming riscv64 support, it is best to use "riscv" as the
subdirectory name and common symbols as riscv32 and riscv64 support
code is almost identical. Then later decide whether 32-bit or 64-bit
compilation is wanted.

Redirects for the web documentation are also included.

Then zephyrbot complained about this:

"
New files added that are not covered in CODEOWNERS:

dts/riscv/microsemi-miv.dtsi
dts/riscv/riscv32-fe310.dtsi

Please add one or more entries in the CODEOWNERS file to cover
those files
"

So I assigned them to those who created them. Feel free to readjust
as necessary.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-08-02 13:54:48 -07:00
Nicolas Pitre 635491b6c5 toolchain/xcc: augment compiler provided macros to match gcc and clang
Ensure that xcc is at parity with gcc and clang by inferring missing
definitions based on those that it already provides.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-03 06:09:16 -04:00
Nicolas Pitre f32330b22c stdint.h: streamline type definitions
Compilers (at least gcc and clang) already provide definitions to
create standard types and their range. For example, __INT16_TYPE__ is
normally defined as a short to be used with the int16_t typedef, and
__INT16_MAX__ is defined as 32767. So it makes sense to rely on them
rather than hardcoding our own, especially for the fast types where
the compiler itself knows what basic type is best.

Using compiler provided definitions makes even more sense when dealing
with 64-bit targets where some types such as intptr_t and size_t must
have a different size and range. Those definitions are then adjusted
by the compiler directly.

However there are two cases for which we should override those
definitions:

* The __INT32_TYPE__ definition on 32-bit targets vary between an int
  and a long int depending on the architecture and configuration.
  Notably, all compilers shipped with the Zephyr SDK, except for the
  i586-zephyr-elfiamcu variant, define __INT32_TYPE__ to a long int.
  Whereas, all Linux configurations for gcc, both 32-bit and 64-bit,
  always define __INT32_TYPE__ as an int. Having variability here is
  not welcome as pointers to a long int and to an int are not deemed
  compatible by the compiler, and printing an int32_t defined with a
  long using %d makes the compiler to complain, even if they're the
  same size on 32-bit targets. Given that an int is always 32 bits
  on all targets we might care about, and given that Zephyr hardcoded
  int32_t to an int before, then we just redefine __INT32_TYPE__ and
  derrivatives to an int to keep the peace in the code.

* The confusion also exists with __INTPTR_TYPE__. Looking again at the
  Zephyr SDK, it is defined as an int, even even when __INT32_TYPE__ is
  initially a long int. One notable exception is i586-zephyr-elf where
  __INTPTR_TYPE__ is a long int even when using -m32. On 64-bit targets
  this is always a long int. So let's redefine __INTPTR_TYPE__ to always
  be a long int on Zephyr which simplifies the code, works for both
  32-bit and 64-bit targets, and mimics what the Linux kernel does.
  Only a few print format strings needed adjustment.

In those two cases, there is a safeguard to ensure the type we're
enforcing has the right size and fail the build otherwise.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-25 23:29:22 -04:00
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
Nicolas Pitre aa9228854f linker generated list: provide an iterator to simplify list access
Given that the section name and boundary simbols can be inferred from
the struct object name, it makes sense to create an iterator that
abstracts away the access details and reduce the possibility for
mistakes.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-06 14:21:32 -07:00
Nicolas Pitre b1d3742ce2 linker generated list: introduce Z_STRUCT_SECTION_ITERABLE()
This convenience macro wraps Z_DECL_ALIGN() and __in_section() to
simplify static definitions of structure instances gathered in dedicated
sections. Most of the time those go together, and the section name is
already closely related to the struct type, so abstracting things behind
a simpler interface reduces probability of mistakes and makes the code
clearer. A few input section names have been adjusted accordingly.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-06 14:21:32 -07:00
Nicolas Pitre 8bb1f2a947 linker generated list: explicit alignment on data definitions
The alignment fix on struct device definitions should be done to all
such linker list tricks. Let's abstract the declaration plus alignment
with a macro and apply it to all concerned cases.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-06 14:21:32 -07:00
Jakob Olesen c8708d9bf3 misc: Replace uses of __builtin_*_overflow() with <misc/math_extras.h>.
Use the new math_extras functions instead of calling builtins directly.

Change a few local variables to size_t after checking that all uses of
the variable actually expects a size_t.

Signed-off-by: Jakob Olesen <jolesen@fb.com>
2019-05-14 19:53:30 -05:00
Jakob Olesen f4f09dd7cd toolchain: Define a HAS_BUILTIN(x) macro in toolchain.h.
Compilers based on Clang provide a __has_builtin(x) macro which can be
used to detect in the preprocessor if a given builtin function is
supported by the compiler.

For other compilers (notably GCC), we provide an alternative definition
of HAS_BUILTIN(x) that depends on the toolchain-specific header file to
declare which builtin functions are supported based on the current
compiler version.

Signed-off-by: Jakob Olesen <jolesen@fb.com>
2019-05-14 19:53:30 -05:00
Daniel Leung 84b1bba8ee codecov: keep "inline" for ALWAYS_INLINE
Previous commit c31e659165 changed
the ALWAYS_INLINE macros to avoid functions being inlined for
the purpose of code coverage. This has a side effect of causing
the text sections of kobject_hash.c and priv_stacks_hash.c
to ballon more than 10 times in size. This is caused by
attaching the unused attribute, which results in all those
functions being in the text sections though they are never
used. So just keep the "inline" there.

This also removes -fno-inline from NO_COVERAGE_FLAGS so these
two files are not compiled with flags related to code coverage.

Fixes #15009

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-04-02 09:39:44 -04:00
Daniel Leung c31e659165 codecov: avoid inlining functions for correct execution counts
This adds a compiler option -fno-inline for code coverage on
architectures which supports doing code coverage. This also
modifies the ALWAYS_INLINE macro to not do any inlining. This
needs to be done so code coverage can count the number of
executions to the correct lines.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-26 13:28:30 -04:00
Patrik Flykt 4344e27c26 all: Update reserved function names
Update reserved function names starting with one underscore, replacing
them as follows:
   '_k_' with 'z_'
   '_K_' with 'Z_'
   '_handler_' with 'z_handl_'
   '_Cstart' with 'z_cstart'
   '_Swap' with 'z_swap'

This renaming is done on both global and those static function names
in kernel/include and include/. Other static function names in kernel/
are renamed by removing the leading underscore. Other function names
not starting with any prefix listed above are renamed starting with
a 'z_' or 'Z_' prefix.

Function names starting with two or three leading underscores are not
automatcally renamed since these names will collide with the variants
with two or three leading underscores.

Various generator scripts have also been updated as well as perf,
linker and usb files. These are
   drivers/serial/uart_handlers.c
   include/linker/kobject-text.ld
   kernel/include/syscall_handler.h
   scripts/gen_kobject_list.py
   scripts/gen_syscall_header.py

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-11 13:48:42 -04:00
Ulf Magnusson e569533de0 toolchain: Remove ref. to undefined sym. CONFIG_ISA_THUMB
This symbol has never been defined in the Git history.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-02 03:46:10 +01:00
Ulf Magnusson e20fd5f454 toolchain: gcc: Remove ref. to undefined sym. CONFIG_ISA_ARM
This Kconfig symbol was removed in commit cb04620fbd ("remove make/
directory").

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-02 03:46:10 +01:00
Aurelien Jarno 992f29a1bc arch: make __ramfunc support transparent
Instead of having to enable ramfunc support manually, just make it
transparently available to users, keeping the MPU region disabled if not
used to not waste a MPU region. This however wastes 24 bytes of code
area when the MPU is disabled and 48 bytes when it is enabled, and
probably a dozen of CPU cycles during boot. I believe it is something
acceptable.

Note that when XIP is used, code is already in RAM, so the __ramfunc
keyword does nothing, but does not generate an error.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-22 11:36:50 -08:00
qianfan Zhao e1cc657941 arm: Placing the functions which holds __ramfunc into '.ramfunc'
Using __ramfunc to places a function in RAM instead of Flash.
Code that for example reprograms flash at runtime can't execute
from flash, in that case must placing code into RAM.

This commit create a new section named '.ramfunc' in link scripts,
all functions has __ramfunc keyword saved in thats sections and
will load from flash to sram after the system booted.

Fixes: #10253

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2019-02-22 11:36:50 -08:00
Andrew Boie 41f6011c36 userspace: remove APPLICATION_MEMORY feature
This was never a long-term solution, more of a gross hack
to get test cases working until we could figure out a good
end-to-end solution for memory domains that generated
appropriate linker sections. Now that we have this with
the app shared memory feature, and have converted all tests
to remove it, delete this feature.

To date all userspace APIs have been tagged as 'experimental'
which sidesteps deprecation policies.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Andy Ross b69d0da82d arch/x86_64: New architecture added
This patch adds a x86_64 architecture and qemu_x86_64 board to Zephyr.
Only the basic architecture support needed to run 64 bit code is
added; no drivers are added, though a low-level console exists and is
wired to printk().

The support is built on top of a "X86 underkernel" layer, which can be
built in isolation as a unit test on a Linux host.

Limitations:

+ Right now the SDK lacks an x86_64 toolchain.  The build will fall
  back to a host toolchain if it finds no cross compiler defined,
  which is tested to work on gcc 8.2.1 right now.

+ No x87/SSE/AVX usage is allowed.  This is a stronger limitation than
  other architectures where the instructions work from one thread even
  if the context switch code doesn't support it.  We are passing
  -no-sse to prevent gcc from automatically generating SSE
  instructions for non-floating-point purposes, which has the side
  effect of changing the ABI.  Future work to handle the FPU registers
  will need to be combined with an "application" ABI distinct from the
  kernel one (or just to require USERSPACE).

+ Paging is enabled (it has to be in long mode), but is a 1:1 mapping
  of all memory.  No MMU/USERSPACE support yet.

+ We are building with -mno-red-zone for stack size reasons, but this
  is a valuable optimization.  Enabling it requires automatic stack
  switching, which requires a TSS, which means it has to happen after
  MMU support.

+ The OS runs in 64 bit mode, but for compatibility reasons is
  compiled to the 32 bit "X32" ABI.  So while the full 64 bit
  registers and instruction set are available, C pointers are 32 bits
  long and Zephyr is constrained to run in the bottom 4G of memory.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Flavio Ceolin b45a287b02 toolchain: xcc: Builtin overflow functions return boolean
The builtin_*_overflow functions when available return a
boolean. Change internal definitions to return same type.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-11-30 08:05:11 -08:00
Anas Nashif d7fe69a6bc toolchain: xcc: __builtin_unreachable needs to be a loop
Functions are declared as noreturn but they do in fact return (when
control reaches the end of the body, since it doesn't enter an infinite
loop, it doesn't call other "noreturn" functions, etc.)

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-02 08:37:27 -04:00
Daniel Leung 51e47180f0 toolchain: xcc: fake __builtin_umul[ll]_overflow
XCC doesn't provide these builtins so we have to define them
with minimal functionality for testing.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-10-19 17:52:45 -04:00
Adithya Baglody 21d43a6fe4 include: toolchain: gcc.h: Fixed MISRA C violation.
The macros likely() and unlikely() used by the compiler for
optimization are always used inside an if condition.
According to MISRA we need to have bool type and not long.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-10-17 12:17:58 -04:00
Flavio Ceolin 6fdc56d286 kernel: Using boolean types for boolean constants
Make boolean expressions use boolean types.

MISRA-C rule 14.4

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-28 06:28:41 +05:30
Flavio Ceolin 67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -04:00
Kumar Gala 6c6a66623a toolchain: gcc: check if __weak is defined
Avoid build conflict when __weak is defined by someone else.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-06-28 09:13:17 -05:00