aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2009-01-03 21:00:48 +0000
committerHans-Peter Nilsson <hp@axis.com>2009-01-03 21:00:48 +0000
commitddf2c97233d9d3415e6ccac3256d08bc7aedba48 (patch)
tree16754062c4d48c1886942d661cf553d9199207ee
parent2e1566c6dacb9e40d35df48b487364e6911f088e (diff)
downloadbinutils-ddf2c97233d9d3415e6ccac3256d08bc7aedba48.zip
binutils-ddf2c97233d9d3415e6ccac3256d08bc7aedba48.tar.gz
binutils-ddf2c97233d9d3415e6ccac3256d08bc7aedba48.tar.bz2
* cris/sim-main.h (struct _sim_cpu): New member
set_target_thread_data. * cris/crisv32f.c (CRIS_TLS_REGISTER): Define. * cris/crisv10f.c: Ditto. * cris/cris-tmpl.c (MY (set_target_thread_data)): New function. (MY (f_specific_init)): Set new _sim_cpu member to new function. * cris/traps.c (TARGET_SYS_set_thread_area): Define. (cris_break_13_handler) <case TARGET_SYS_set_thread_area>: New case.
-rw-r--r--sim/ChangeLog10
-rw-r--r--sim/cris/cris-tmpl.c9
-rw-r--r--sim/cris/crisv10f.c1
-rw-r--r--sim/cris/crisv32f.c1
-rw-r--r--sim/cris/sim-main.h3
-rw-r--r--sim/cris/traps.c12
6 files changed, 36 insertions, 0 deletions
diff --git a/sim/ChangeLog b/sim/ChangeLog
index 100adb9..067d2ec 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,5 +1,15 @@
2009-01-03 Hans-Peter Nilsson <hp@axis.com>
+ * cris/sim-main.h (struct _sim_cpu): New member
+ set_target_thread_data.
+ * cris/crisv32f.c (CRIS_TLS_REGISTER): Define.
+ * cris/crisv10f.c: Ditto.
+ * cris/cris-tmpl.c (MY (set_target_thread_data)): New function.
+ (MY (f_specific_init)): Set new _sim_cpu member to new function.
+ * cris/traps.c (TARGET_SYS_set_thread_area): Define.
+ (cris_break_13_handler) <case TARGET_SYS_set_thread_area>: New
+ case.
+
* cris/traps.c (TARGET_SYS_exit_group): Define.
(cris_break_13_handler): Handle it like the exit for the last
thread.
diff --git a/sim/cris/cris-tmpl.c b/sim/cris/cris-tmpl.c
index fe46bf0..a4c232c 100644
--- a/sim/cris/cris-tmpl.c
+++ b/sim/cris/cris-tmpl.c
@@ -233,6 +233,14 @@ MY (f_model_mark_set_h_gr) (SIM_CPU *current_cpu, ARGBUF *abuf)
}
#endif
+/* Set the thread register contents. */
+
+void
+MY (set_target_thread_data) (SIM_CPU *current_cpu, USI val)
+{
+ (CPU (XCONCAT2 (h_sr_v, BASENUM) [CRIS_TLS_REGISTER])) = val;
+}
+
/* Create the context for a thread. */
void *
@@ -256,6 +264,7 @@ MY (f_specific_init) (SIM_CPU *current_cpu)
{
current_cpu->make_thread_cpu_data = MY (make_thread_cpu_data);
current_cpu->thread_cpu_data_size = sizeof (current_cpu->cpu_data);
+ current_cpu->set_target_thread_data = MY (set_target_thread_data);
#if WITH_HW
current_cpu->deliver_interrupt = MY (deliver_interrupt);
#endif
diff --git a/sim/cris/crisv10f.c b/sim/cris/crisv10f.c
index 3a4e94f..e500cbf 100644
--- a/sim/cris/crisv10f.c
+++ b/sim/cris/crisv10f.c
@@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define WANT_CPU_CRISV10F
#define BASENUM 10
+#define CRIS_TLS_REGISTER 14
#include "cris-tmpl.c"
#if WITH_PROFILE_MODEL_P
diff --git a/sim/cris/crisv32f.c b/sim/cris/crisv32f.c
index bc66be6..8078717 100644
--- a/sim/cris/crisv32f.c
+++ b/sim/cris/crisv32f.c
@@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define SPECIFIC_U_MEM_FN
#define SPECIFIC_U_MOVEM_FN
#define BASENUM 32
+#define CRIS_TLS_REGISTER 2
#include "cris-tmpl.c"
#if WITH_PROFILE_MODEL_P
diff --git a/sim/cris/sim-main.h b/sim/cris/sim-main.h
index 576050a..a39ae17 100644
--- a/sim/cris/sim-main.h
+++ b/sim/cris/sim-main.h
@@ -191,6 +191,9 @@ struct _sim_cpu {
void* (*make_thread_cpu_data) (SIM_CPU *, void *);
size_t thread_cpu_data_size;
+ /* The register differs, so we dispatch to a CPU-specific function. */
+ void (*set_target_thread_data) (SIM_CPU *, USI);
+
/* CPU-model specific parts go here.
Note that in files that don't need to access these pieces WANT_CPU_FOO
won't be defined and thus these parts won't appear. This is ok in the
diff --git a/sim/cris/traps.c b/sim/cris/traps.c
index 081273f..aa3b90a 100644
--- a/sim/cris/traps.c
+++ b/sim/cris/traps.c
@@ -113,6 +113,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define TARGET_SYS_getegid32 202
#define TARGET_SYS_getgid32 200
#define TARGET_SYS_fcntl64 221
+#define TARGET_SYS_set_thread_area 243
#define TARGET_SYS_exit_group 252
#define TARGET_PROT_READ 0x1
@@ -3154,6 +3155,17 @@ cris_break_13_handler (SIM_CPU *current_cpu, USI callnum, USI arg1,
retval = -cb_host_to_target_errno (cb, ENOSYS);
break;
+ case TARGET_SYS_set_thread_area:
+ /* Do the same error check as Linux. */
+ if (arg1 & 255)
+ {
+ retval = -cb_host_to_target_errno (cb, EINVAL);
+ break;
+ }
+ (*current_cpu->set_target_thread_data) (current_cpu, arg1);
+ retval = 0;
+ break;
+
unimplemented_syscall:
default:
retval