server: Store the type of CPU that the client is running on.
diff --git a/server/process.h b/server/process.h
index 5b6dcda..250c5ce 100644
--- a/server/process.h
+++ b/server/process.h
@@ -58,6 +58,7 @@
process_id_t id; /* id of the process */
process_id_t group_id; /* group id of the process */
struct timeout_user *sigkill_timeout; /* timeout for final SIGKILL */
+ enum cpu_type cpu; /* client CPU type */
int unix_pid; /* Unix pid for final SIGKILL */
int exit_code; /* process exit code */
int running_threads; /* number of threads running in this process */
diff --git a/server/protocol.def b/server/protocol.def
index 5cc93da..0ef309e 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -143,6 +143,13 @@
} rip_info;
} debug_event_t;
+/* supported CPU types */
+enum cpu_type
+{
+ CPU_x86, CPU_x86_64, CPU_ALPHA, CPU_POWERPC, CPU_SPARC
+};
+typedef int cpu_type_t;
+
/* structure used in sending an fd from client to server */
struct send_fd
{
@@ -554,6 +561,7 @@
client_ptr_t entry; /* entry point or PEB if initial thread (in thread address space) */
int reply_fd; /* fd for reply pipe */
int wait_fd; /* fd for blocking calls pipe */
+ cpu_type_t cpu; /* CPU that this thread is running on */
@REPLY
process_id_t pid; /* process id of the new thread's process */
thread_id_t tid; /* thread id of the new thread */
diff --git a/server/request.h b/server/request.h
index 1adc03b..29ed8c9 100644
--- a/server/request.h
+++ b/server/request.h
@@ -600,6 +600,7 @@
C_ASSERT( sizeof(char) == 1 );
C_ASSERT( sizeof(char_info_t) == 4 );
C_ASSERT( sizeof(client_ptr_t) == 8 );
+C_ASSERT( sizeof(cpu_type_t) == 4 );
C_ASSERT( sizeof(data_size_t) == 4 );
C_ASSERT( sizeof(file_pos_t) == 8 );
C_ASSERT( sizeof(int) == 4 );
@@ -663,6 +664,7 @@
C_ASSERT( FIELD_OFFSET(struct init_thread_request, entry) == 32 );
C_ASSERT( FIELD_OFFSET(struct init_thread_request, reply_fd) == 40 );
C_ASSERT( FIELD_OFFSET(struct init_thread_request, wait_fd) == 44 );
+C_ASSERT( FIELD_OFFSET(struct init_thread_request, cpu) == 48 );
C_ASSERT( FIELD_OFFSET(struct init_thread_reply, pid) == 8 );
C_ASSERT( FIELD_OFFSET(struct init_thread_reply, tid) == 12 );
C_ASSERT( FIELD_OFFSET(struct init_thread_reply, server_start) == 16 );
diff --git a/server/thread.c b/server/thread.c
index 6c68a9e..dcf1da2 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -1045,10 +1045,16 @@
{
process->unix_pid = current->unix_pid;
process->peb = req->entry;
+ process->cpu = req->cpu;
reply->info_size = init_process( current );
}
else
{
+ if (req->cpu != process->cpu)
+ {
+ set_error( STATUS_INVALID_PARAMETER );
+ return;
+ }
if (process->unix_pid != current->unix_pid)
process->unix_pid = -1; /* can happen with linuxthreads */
if (current->suspend + process->suspend > 0) stop_thread( current );
diff --git a/server/trace.c b/server/trace.c
index 13a3ddc..3583cc3 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -105,6 +105,21 @@
}
}
+static void dump_cpu_type( const cpu_type_t *code )
+{
+ switch (*code)
+ {
+#define CASE(c) case CPU_##c: fputs( #c, stderr ); break
+ CASE(x86);
+ CASE(x86_64);
+ CASE(ALPHA);
+ CASE(POWERPC);
+ CASE(SPARC);
+ default: fprintf( stderr, "%u", *code ); break;
+#undef CASE
+ }
+}
+
static void dump_apc_call( const apc_call_t *call )
{
fputc( '{', stderr );
@@ -991,7 +1006,9 @@
dump_uint64( &req->entry );
fprintf( stderr, "," );
fprintf( stderr, " reply_fd=%d,", req->reply_fd );
- fprintf( stderr, " wait_fd=%d", req->wait_fd );
+ fprintf( stderr, " wait_fd=%d,", req->wait_fd );
+ fprintf( stderr, " cpu=" );
+ dump_cpu_type( &req->cpu );
}
static void dump_init_thread_reply( const struct init_thread_reply *req )