cpu: inline function to print instruction register
This commit is contained in:
parent
888e146fe4
commit
d7161b6d4b
@ -25,9 +25,11 @@
|
||||
#ifndef __ATMEGA_COMMON_H
|
||||
#define __ATMEGA_COMMON_H
|
||||
|
||||
#include "cpu_conf.h"
|
||||
#include <stdio.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "cpu_conf.h"
|
||||
|
||||
/**
|
||||
* For downwards compatibility with old RIOT code.
|
||||
* TODO: remove once core was adjusted
|
||||
@ -46,6 +48,16 @@ extern "C" {
|
||||
*/
|
||||
void cpu_init(void);
|
||||
|
||||
/**
|
||||
* @brief Print the last instruction's address
|
||||
*
|
||||
* @todo: Not supported
|
||||
*/
|
||||
static inline void cpu_print_last_instruction(void)
|
||||
{
|
||||
printf("n/a");
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -30,6 +30,8 @@
|
||||
#ifndef CPU_H_
|
||||
#define CPU_H_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cpu_conf.h"
|
||||
#include "irq.h"
|
||||
|
||||
@ -100,6 +102,16 @@ void cpu_init(void);
|
||||
*/
|
||||
void cortexm_init(void);
|
||||
|
||||
/**
|
||||
* @brief Prints the current content of the link register (lr)
|
||||
*/
|
||||
static inline void cpu_print_last_instruction(void)
|
||||
{
|
||||
register uint32_t *lr_ptr;
|
||||
__asm__ __volatile__("mov %0, lr" : "=r"(lr_ptr));
|
||||
printf("%p", lr_ptr);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -16,7 +16,9 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "lpc2387.h"
|
||||
#include "arm_cpu.h"
|
||||
|
||||
@ -41,6 +43,16 @@ bool install_irq(int IntNumber, void (*HandlerAddr)(void), int Priority);
|
||||
void gpio_init_ports(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Prints the current content of the link register (lr)
|
||||
*/
|
||||
static inline void cpu_print_last_instruction(void)
|
||||
{
|
||||
register uint32_t *lr_ptr;
|
||||
__asm__ __volatile__("mov %0, lr" : "=r"(lr_ptr));
|
||||
printf("%p", lr_ptr);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -167,6 +167,16 @@ inline void __restore_context(unsigned int irqen)
|
||||
*/
|
||||
void msp430_cpu_init(void);
|
||||
|
||||
/**
|
||||
* @brief Print the last instruction's address
|
||||
*
|
||||
* @todo: Not supported
|
||||
*/
|
||||
static inline void cpu_print_last_instruction(void)
|
||||
{
|
||||
printf("n/a");
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -20,6 +20,8 @@
|
||||
#ifndef _CPU_H
|
||||
#define _CPU_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -28,6 +30,16 @@ extern "C" {
|
||||
void dINT(void);
|
||||
void eINT(void);
|
||||
|
||||
/**
|
||||
* @brief Prints the last instruction's address
|
||||
*/
|
||||
static inline void cpu_print_last_instruction(void)
|
||||
{
|
||||
void *p;
|
||||
__asm__("1: mov 1b, %0" : "=r" (p));
|
||||
printf("%p", p);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -133,6 +133,16 @@ void x86_init_board(void);
|
||||
*/
|
||||
bool x86_get_memory_region(uint64_t *start, uint64_t *len, unsigned long *cnt);
|
||||
|
||||
/**
|
||||
* @brief Prints the last instruction's address
|
||||
*
|
||||
* @todo: Not supported
|
||||
*/
|
||||
static inline void cpu_print_last_instruction(void)
|
||||
{
|
||||
printf("n/a");
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user