This repository has been archived on 2025-02-12. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
pic32-newlib/newlib/libgloss/pic32mx/exceptions.c
2009-02-02 09:36:40 +00:00

53 lines
1.4 KiB
C

#include <stdlib.h>
extern void _on_reset() __attribute__((weak));
extern void _nmi_handler() __attribute__((weak)) __attribute__((nomips16));
extern void _on_bootstrap() __attribute__((weak));
extern void _bootstrap_exception_handler() __attribute__((weak)) __attribute__((nomips16));
extern void _general_exception_handler(unsigned cause, unsigned status) __attribute__((weak)); /* should have nomips16 here as well */
void _on_reset() {
/* nothing */
__asm__ __volatile__ ("%(nop%)" : :);
}
void _nmi_handler() {
}
void _on_bootstrap() {
/* nothing */
__asm__ __volatile__ ("%(nop%)" : :);
}
void _bootstrap_exception_handler() {
while (1) {
__asm__ __volatile__ ("%(nop%)" : :);
}
};
void _general_exception_context() {
/* The provided implementation
* of this function saves context, calls an application handler function, restores context
* and performs a return from exception instruction. The context saved is the hi and lo
* registers and all general purpose registers except s0-s8, which are defined to be
* preserved by all called functions and so are not necessary to actively save again here.
* The values of the Cause and Status registers are passed to the application handler
* function (_general_exception_handler())
*/
/* XXX TODO: write this function */
_general_exception_handler(0,0);
};
void _general_exception_handler(unsigned cause, unsigned status) {
while (1) {
__asm__ __volatile__ ("%(nop%)" : :);
}
};