Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚨🔊 Add a better Data Abort Handler #112

Merged
merged 27 commits into from
Sep 2, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
065dc55
Add WIP of a better DataAbortHandler
edjubuh Feb 16, 2019
bf074e1
More WIP
edjubuh Feb 17, 2019
f1e47cd
Cleanup
edjubuh Feb 17, 2019
0742952
refactor some things
edjubuh Feb 17, 2019
bd02ca4
Refactor, clean up, and documentation
edjubuh Feb 17, 2019
56d3875
Merge branch 'develop' into feature/better-abort-handler
edjubuh Feb 17, 2019
7f34e55
More comments
edjubuh Feb 18, 2019
b92431b
Update unwind.c
edjubuh Feb 25, 2019
2c96190
Tweak printfs
edjubuh Feb 26, 2019
6c5e72e
Add custom build of newlib
edjubuh Mar 10, 2019
d2840a6
Include libc/libm in template
edjubuh Mar 10, 2019
8712d1e
Merge branch 'develop' into feature/better-abort-handler
edjubuh Mar 10, 2019
cacb282
Merge branch 'develop' into feature/better-abort-handler
edjubuh Mar 11, 2019
94b52e0
Exclude libc/libm from being included in cold image
edjubuh Mar 11, 2019
a84702b
Merge branch 'develop' into feature/better-abort-handler
edjubuh Mar 11, 2019
fb7fd95
check whether pc is in the hot zone
HotelCalifornia Jun 12, 2019
8eb3c3c
test unwind with hot/cold linking
HotelCalifornia Aug 8, 2019
3806d04
Merge branch 'develop' into feature/better-abort-handler
HotelCalifornia Aug 19, 2019
4c2166e
Merge branch 'develop' into feature/better-abort-handler
edjubuh Aug 31, 2019
b38b510
Add support for unwinding through hot code
edjubuh Aug 31, 2019
588a18c
Clean up for PR
edjubuh Sep 1, 2019
b547956
Undo USE_PACKAGE:=1
edjubuh Sep 1, 2019
9e211e4
Merge branch 'develop' into feature/better-abort-handler
HotelCalifornia Sep 1, 2019
e76d9e7
remove leftover include
HotelCalifornia Sep 2, 2019
7db09dc
move __env_lock/__env_unlock to src/system/envlock.c
HotelCalifornia Sep 2, 2019
5dc60f0
lint files
HotelCalifornia Sep 2, 2019
f719774
Update .arclint whitespace
HotelCalifornia Sep 2, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions firmware/v5-hot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,9 @@ SECTIONS

.ARM.exidx : {
__exidx_start = .;
__hot_exidx_start = .;
*(.ARM.exidx*)
*(.gnu.linkonce.armexidix.*.*)
__exidx_end = .;
__hot_exidx_end = .;
} > HOT_MEMORY

.preinit_array : {
Expand Down
3 changes: 3 additions & 0 deletions include/system/hot.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ struct hot_table {
char const* compile_timestamp;
char const* compile_directory;

void* __exidx_start;
void* __exidx_end;

struct {
#define FUNC(F) void (*F)();
#include "system/user_functions/list.h"
Expand Down
6 changes: 6 additions & 0 deletions src/system/hot.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ uint32_t const volatile * const MAGIC_ADDR = MAGIC;
extern char const* _PROS_COMPILE_TIMESTAMP;
extern char const* _PROS_COMPILE_DIRECTORY;

extern unsigned __exidx_start;
extern unsigned __exidx_end;

// this expands to a bunch of:
// extern void autonomous();
#define FUNC(F) void F();
Expand All @@ -31,6 +34,8 @@ void install_hot_table(struct hot_table* const tbl) {
// printf("Hot initializing\n");
tbl->compile_timestamp = _PROS_COMPILE_TIMESTAMP;
tbl->compile_directory = _PROS_COMPILE_DIRECTORY;
tbl->__exidx_start = &__exidx_start;
tbl->__exidx_end = &__exidx_end;

// this expands to a bunch of:
// tbl->functions.autonomous = autonomous;
Expand Down Expand Up @@ -71,6 +76,7 @@ void invoke_install_hot_table() {
// printf("%s %p %p %x %x\n", __FUNCTION__, (void*)install_hot_table, (void*)HOT_TABLE, MAGIC_ADDR[0], MAGIC_ADDR[1]);
if(vexSystemLinkAddrGet() == (uint32_t)0x03800000 && MAGIC_ADDR[0] == MAGIC0 && MAGIC_ADDR[1] == MAGIC1) {
install_hot_table(HOT_TABLE);

This comment was marked as resolved.

} else {
memset(HOT_TABLE, 0, sizeof(*HOT_TABLE));
}
Expand Down
18 changes: 5 additions & 13 deletions src/system/unwind.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "unwind-arm-common.h"

#include "system/hot.h"
#include "rtos/task.h"
#include "rtos/tcb.h"

Expand Down Expand Up @@ -80,25 +81,16 @@ struct __EIT_entry {
_uw content;
};
// these are all defined by the linker
extern struct __EIT_entry __attribute__((weak)) __hot_exidx_start;
extern struct __EIT_entry __attribute__((weak)) __hot_exidx_end;

extern struct __EIT_entry __exidx_start;
extern struct __EIT_entry __exidx_end;

// these too
extern uint8_t start_of_cold_mem, end_of_cold_mem, start_of_hot_mem, end_of_hot_mem;
_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc, int* nrec) {
// TODO: support hot/cold here
// fprintf(stderr, "\t%p", (void*)pc);

_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc, int* nrec) {
// check if pc is in the hot region
if ((void*)&start_of_hot_mem < (void*)pc && (void*)pc < (void*)&end_of_hot_mem) {
fprintf(stderr, "hot\n");
*nrec = &__hot_exidx_end - &__hot_exidx_start;
return (_Unwind_Ptr)&__hot_exidx_start;
if (HOT_TABLE && (void*)&start_of_hot_mem < (void*)pc && (void*)pc < (void*)&end_of_hot_mem) {
*nrec = (struct __EIT_entry*)HOT_TABLE->__exidx_end - (struct __EIT_entry*)HOT_TABLE->__exidx_start;
return (_Unwind_Ptr)HOT_TABLE->__exidx_start;
}
fprintf(stderr, "not hot\n");
// otherwise, we're in a monolith build or the cold region of a hot/cold build
*nrec = &__exidx_end - &__exidx_start;
return (_Unwind_Ptr)&__exidx_start;
Expand Down