From cb01f75a9ddb338ead305e8712fb525f249d1995 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Tue, 18 Jun 2013 18:02:33 +0200 Subject: [PATCH] foc-arndale: use same context area location Currently, on the Arndale platform, core uses a different thread context area base address than the other tasks (0x20000000 vs. 0x40000000). This is problematic, because core calculates the location of the UTCB area of a new thread relatively to core's own thread context area base. So, the UTCB area of non-core threads ends up in a virtual address range which is outside of the task's thread context area and not marked as used in the task's RM session. With this patch, the same thread context area base address gets used in core and in the other tasks. Fixes #779. --- base-foc/lib/mk/arm/base.mk | 3 +++ base-foc/lib/mk/{base.mk => base.inc} | 2 +- base-foc/lib/mk/exynos5/base.mk | 3 +++ base-foc/lib/mk/x86/base.mk | 3 +++ .../src/{core => base/thread}/arndale/thread_context_area.cc | 4 ++++ base-foc/src/core/arndale/target.mk | 2 +- 6 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 base-foc/lib/mk/arm/base.mk rename base-foc/lib/mk/{base.mk => base.inc} (86%) create mode 100644 base-foc/lib/mk/exynos5/base.mk create mode 100644 base-foc/lib/mk/x86/base.mk rename base-foc/src/{core => base/thread}/arndale/thread_context_area.cc (70%) diff --git a/base-foc/lib/mk/arm/base.mk b/base-foc/lib/mk/arm/base.mk new file mode 100644 index 000000000..5d2889686 --- /dev/null +++ b/base-foc/lib/mk/arm/base.mk @@ -0,0 +1,3 @@ +include $(REP_DIR)/lib/mk/base.inc + +SRC_CC += thread/thread_context_area.cc diff --git a/base-foc/lib/mk/base.mk b/base-foc/lib/mk/base.inc similarity index 86% rename from base-foc/lib/mk/base.mk rename to base-foc/lib/mk/base.inc index 915c86331..8f0a09bb4 100644 --- a/base-foc/lib/mk/base.mk +++ b/base-foc/lib/mk/base.inc @@ -9,7 +9,7 @@ LIBS += base-common SRC_CC += console/log_console.cc SRC_CC += env/env.cc env/context_area.cc env/reload_parent_cap.cc \ env/cap_map_remove.cc env/cap_alloc.cc -SRC_CC += thread/thread_start.cc thread/thread_context_area.cc +SRC_CC += thread/thread_start.cc INC_DIR += $(BASE_DIR)/src/base/env diff --git a/base-foc/lib/mk/exynos5/base.mk b/base-foc/lib/mk/exynos5/base.mk new file mode 100644 index 000000000..5de464872 --- /dev/null +++ b/base-foc/lib/mk/exynos5/base.mk @@ -0,0 +1,3 @@ +include $(REP_DIR)/lib/mk/base.inc + +SRC_CC += thread/arndale/thread_context_area.cc diff --git a/base-foc/lib/mk/x86/base.mk b/base-foc/lib/mk/x86/base.mk new file mode 100644 index 000000000..5d2889686 --- /dev/null +++ b/base-foc/lib/mk/x86/base.mk @@ -0,0 +1,3 @@ +include $(REP_DIR)/lib/mk/base.inc + +SRC_CC += thread/thread_context_area.cc diff --git a/base-foc/src/core/arndale/thread_context_area.cc b/base-foc/src/base/thread/arndale/thread_context_area.cc similarity index 70% rename from base-foc/src/core/arndale/thread_context_area.cc rename to base-foc/src/base/thread/arndale/thread_context_area.cc index b9c7c2772..9764793d7 100644 --- a/base-foc/src/core/arndale/thread_context_area.cc +++ b/base-foc/src/base/thread/arndale/thread_context_area.cc @@ -6,6 +6,10 @@ * We need to place the context area within core outside the physical memory. * Sigma0 maps physical to core-local memory always 1:1 when using * SIGMA0_REQ_FPAGE_ANY. Those mappings would interfere with the context area. + * + * Because the UTCB area of a task resides at the end of the context area and + * its address gets calculated by core, the context area in other tasks needs + * to be at the same address as in core. */ #include diff --git a/base-foc/src/core/arndale/target.mk b/base-foc/src/core/arndale/target.mk index 51858401f..4290ec929 100644 --- a/base-foc/src/core/arndale/target.mk +++ b/base-foc/src/core/arndale/target.mk @@ -1,5 +1,5 @@ # override default location of thread context area within core -vpath thread_context_area.cc $(PRG_DIR) +vpath thread_context_area.cc $(REP_DIR)/src/base/thread/arndale include $(PRG_DIR)/../target.inc