From b18c47c26c534334f408aa106f8df8ae58ff8803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Tue, 30 Sep 2014 15:41:05 +0000 Subject: [PATCH] implemented remove_handler() --- BaS_gcc/if/driver_vec.c | 15 +++++++++++++-- BaS_gcc/include/driver_vec.h | 3 ++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/BaS_gcc/if/driver_vec.c b/BaS_gcc/if/driver_vec.c index 96f3d83..2c16fe0 100644 --- a/BaS_gcc/if/driver_vec.c +++ b/BaS_gcc/if/driver_vec.c @@ -139,7 +139,8 @@ static struct mmu_driver_interface mmu_interface = { .map_page_locked = &mmu_map_data_page_locked, .unlock_page = &mmu_unlock_data_page, - .report_locked_pages = &mmu_report_locked_pages + .report_locked_pages = &mmu_report_locked_pages, + .report_pagesize = &mmu_report_pagesize }; static struct generic_interface interfaces[] = @@ -193,6 +194,8 @@ static struct generic_interface interfaces[] = } }; +extern void remove_handler(void); /* forward declaration */ + /* * this is the driver table we expose to the OS */ @@ -200,10 +203,18 @@ static struct driver_table bas_drivers = { .bas_version = MAJOR_VERSION, .bas_revision = MINOR_VERSION, - .remove_handler = NULL, + .remove_handler = remove_handler, .interfaces = interfaces }; +void remove_handler(void) +{ + extern void std_exc_vec(void); + uint32_t *trap_0_vector = (uint32_t *) 0x80; + + *trap_0_vector = (uint32_t) std_exc_vec; +} + void __attribute__((interrupt)) get_bas_drivers(void) { __asm__ __volatile( diff --git a/BaS_gcc/include/driver_vec.h b/BaS_gcc/include/driver_vec.h index e9a9131..44f52ad 100644 --- a/BaS_gcc/include/driver_vec.h +++ b/BaS_gcc/include/driver_vec.h @@ -265,6 +265,7 @@ struct mmu_driver_interface int32_t (*map_page_locked)(uint32_t address, uint32_t length, int asid); int32_t (*unlock_page)(uint32_t address, uint32_t length, int asid); int32_t (*report_locked_pages)(uint32_t *num_itlb, uint32_t *num_dtlb); + uint32_t (*report_pagesize)(void); }; union interface @@ -291,7 +292,7 @@ struct driver_table { uint32_t bas_version; uint32_t bas_revision; - uint32_t (*remove_handler)(); /* calling this will disable the BaS' hook into trap #0 */ + void (*remove_handler)(void); /* calling this will disable the BaS' hook into trap #0 */ struct generic_interface *interfaces; };