Commit Graph

4 Commits

Author SHA1 Message Date
Andrew Boie 4f77c2ad53 kernel: rename z_arch_ to arch_
Promote the private z_arch_* namespace, which specifies
the interface between the core kernel and the
architecture code, to a new top-level namespace named
arch_*.

This allows our documentation generation to create
online documentation for this set of interfaces,
and this set of interfaces is worth treating in a
more formal way anyway.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-11-07 15:21:46 -08:00
Sebastian Bøe 5e6f220713 kernel: Fix type of Z_EXC_HANDLE
The type of Z_EXC_HANDLE was incorrectly declared, this was causing
the compiler to make incorrect inferences about what could be in
exc_handle and caused a bug in fault.c.

To get more specific ...

An exception handler consists of three void pointers, or function
pointers. The function pointers point to functions. An example of one
such function is 'z_arch_user_string_nlen_fault_start' From
userspace.S.

The correct way of initalizing a function pointer from a function
declared in another source file looks like this:

void external_defined_function(void);

{
   void * internal_initialized_function_ptr = external_defined_function;
}

But EXC_HANDLER is not doing this. Instead it does this:

extern void (*external_defined_function)(void);

{
  void * internal_initialized_function_ptr = &external_defined_function;
}

The declaration here is wrong. It declares that externally, there is
stored a function pointer somewhere. Which is not true. There does not
exist a function pointer anywhere. But this doesn't matter, because we
don't actually de-reference the function pointer to find the address
of the function, but instead we take the address of the function
pointer.

Taking the address of the function pointer to find the address of a
function is wrong, one should de-reference function pointers to find
function addresses. Luckily, these two bugs have been cancelling each
other out, until recently.

This patch corrects the type used.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-11-16 09:18:27 -08:00
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
Andrew Boie 3369a5ed07 arch: introduce exc_handle.h
Defines some common macros and data structures for declaring
text section ranges with fixup handler addresses if an
exception occurs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-07-31 07:47:15 -07:00