2014-05-24 15:56:57 +02:00
|
|
|
/*
|
2016-07-22 21:33:11 +02:00
|
|
|
* Copyright (C) 2013 - 2016 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
|
2013-03-06 10:29:49 +01:00
|
|
|
*
|
2014-08-23 15:43:13 +02:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
2013-03-13 21:56:56 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2018-06-01 12:17:51 +02:00
|
|
|
* @ingroup cpu
|
|
|
|
* @defgroup cpu_native Native
|
2014-05-24 15:56:57 +02:00
|
|
|
* @brief Native CPU specific code
|
|
|
|
* @details The native CPU uses system calls to simulate hardware access.
|
2013-11-27 17:54:30 +01:00
|
|
|
* @ingroup cpu
|
|
|
|
* @brief CPU abstraction for the native port
|
2013-03-06 10:29:49 +01:00
|
|
|
* @{
|
2015-09-27 18:58:30 +02:00
|
|
|
* @author Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
|
2013-03-06 10:29:49 +01:00
|
|
|
*/
|
|
|
|
|
2017-05-23 18:19:52 +02:00
|
|
|
#ifndef CPU_H
|
|
|
|
#define CPU_H
|
2013-03-06 01:08:15 +01:00
|
|
|
|
2022-06-17 17:19:49 +02:00
|
|
|
#include <stdint.h>
|
2015-09-04 16:51:08 +02:00
|
|
|
#include <stdio.h>
|
2021-02-05 18:23:10 +01:00
|
|
|
#include "cpu_conf.h"
|
2015-09-04 16:51:08 +02:00
|
|
|
|
2014-10-13 10:53:20 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-09-02 13:23:30 +02:00
|
|
|
/**
|
|
|
|
* @brief The CPU supports unaligned memory access.
|
|
|
|
* Even if the underlying architecture does not support it, the kernel will take care of it.
|
|
|
|
*/
|
|
|
|
#define CPU_HAS_UNALIGNED_ACCESS
|
|
|
|
|
2015-09-04 16:51:08 +02:00
|
|
|
/**
|
2022-06-17 17:19:49 +02:00
|
|
|
* @brief Gets the address the callee will return to
|
2015-09-04 16:51:08 +02:00
|
|
|
*/
|
2022-06-17 17:19:49 +02:00
|
|
|
__attribute__((always_inline)) static inline uintptr_t cpu_get_caller_pc(void)
|
2015-09-04 16:51:08 +02:00
|
|
|
{
|
2016-07-22 21:33:11 +02:00
|
|
|
/* __builtin_return_address will return the address the calling function
|
2022-06-17 17:19:49 +02:00
|
|
|
* will return to - since cpu_get_caller_pc is forced inline,
|
2016-07-22 21:33:11 +02:00
|
|
|
* it is the return address of the user of this function */
|
2022-06-17 17:19:49 +02:00
|
|
|
return (uintptr_t)__builtin_return_address(0);
|
2015-09-04 16:51:08 +02:00
|
|
|
}
|
|
|
|
|
2014-10-13 10:53:20 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-03-13 21:56:56 +01:00
|
|
|
/** @} */
|
2017-05-23 18:19:52 +02:00
|
|
|
#endif /* CPU_H */
|