summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2016-10-03 11:01:39 +0200
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2016-10-03 11:01:39 +0200
commit9d423d9c96e33d9bf50810449352e708283f4971 (patch)
tree59a82f0f75cc2c9288cbf34a95ad99af51d3b4e9
parentarm/tms570: document BSP setup with included hardware initialization. (diff)
downloadrtems-9d423d9c96e33d9bf50810449352e708283f4971.tar.bz2
libdl/rtl-obj.c: synchronize cache should not depend on CPU_CACHE_LINE_BYTES.
The CPU_CACHE_LINE_BYTES has been introduced after 4.11 branch fork and is not available for all architectures on RTEMS 4.11. Use of rtems_cache_get_maximal_line_size() is more descriptive choice. The min/max data/instruction cache line size is not critical there, value is used for optimization only to use single operation for decently following sections.
-rw-r--r--cpukit/libdl/rtl-obj.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cpukit/libdl/rtl-obj.c b/cpukit/libdl/rtl-obj.c
index f61d4e53d7..bdcebce61e 100644
--- a/cpukit/libdl/rtl-obj.c
+++ b/cpukit/libdl/rtl-obj.c
@@ -566,6 +566,7 @@ typedef struct
uint32_t mask;
void *start_va;
void *end_va;
+ size_t cache_line_size;
} rtems_rtl_obj_sect_sync_ctx_t;
static bool
@@ -582,10 +583,10 @@ rtems_rtl_obj_sect_sync_handler (rtems_chain_node* node, void* data)
if (sync_ctx->end_va == sync_ctx->start_va) {
sync_ctx->start_va = sect->base;
} else {
- old_end = (uintptr_t)sync_ctx->end_va & ~(CPU_CACHE_LINE_BYTES - 1);
- new_start = (uintptr_t)sect->base & ~(CPU_CACHE_LINE_BYTES - 1);
+ old_end = (uintptr_t)sync_ctx->end_va & ~(sync_ctx->cache_line_size - 1);
+ new_start = (uintptr_t)sect->base & ~(sync_ctx->cache_line_size - 1);
if ( (sect->base < sync_ctx->start_va) ||
- (new_start - old_end > CPU_CACHE_LINE_BYTES) ) {
+ (new_start - old_end > sync_ctx->cache_line_size) ) {
rtems_cache_instruction_sync_after_code_change(sync_ctx->start_va,
sync_ctx->end_va - sync_ctx->start_va + 1);
sync_ctx->start_va = sect->base;
@@ -605,6 +606,8 @@ rtems_rtl_obj_synchronize_cache (rtems_rtl_obj_t* obj)
if (rtems_cache_get_instruction_line_size() == 0)
return;
+ sync_ctx.cache_line_size = rtems_cache_get_maximal_line_size();
+
sync_ctx.mask = RTEMS_RTL_OBJ_SECT_TEXT | RTEMS_RTL_OBJ_SECT_CONST |
RTEMS_RTL_OBJ_SECT_DATA | RTEMS_RTL_OBJ_SECT_BSS |
RTEMS_RTL_OBJ_SECT_EXEC;