Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
d639f0b9
Commit
d639f0b9
authored
8 years ago
by
Ludwig Knüpfer
Browse files
Options
Downloads
Patches
Plain Diff
cpu/native: rewrite cpu_print_last_instruction
circumvent assembly by using a GCC/LLVM builtin
parent
b5cb68bd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cpu/native/include/cpu.h
+7
-6
7 additions, 6 deletions
cpu/native/include/cpu.h
with
7 additions
and
6 deletions
cpu/native/include/cpu.h
+
7
−
6
View file @
d639f0b9
/*
* Copyright (C) 2013 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
* Copyright (C) 2013
- 2016
Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
*
* 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
...
...
@@ -27,13 +27,14 @@ extern "C" {
#endif
/**
* @brief Prints the
last instruction's address
* @brief Prints the
address the callee will return to
*/
static
inline
void
cpu_print_last_instruction
(
void
)
__attribute__
((
always_inline
))
static
inline
void
cpu_print_last_instruction
(
void
)
{
void
*
p
;
__asm__
(
"1: mov 1b, %0"
:
"=r"
(
p
));
printf
(
"%p
\n
"
,
p
);
/* __builtin_return_address will return the address the calling function
* will return to - since cpu_print_last_instruction is forced inline,
* it is the return address of the user of this function */
printf
(
"%p
\n
"
,
__builtin_return_address
(
0
));
}
#ifdef __cplusplus
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment