From 59c4487dfaf90b92eb9ea96479b9f4a5c517b912 Mon Sep 17 00:00:00 2001 From: John van Groningen Date: Tue, 22 Nov 2011 14:28:11 +0000 Subject: generate thread safe code on 64 bit windows if THREAD64 is defined --- cgaas.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'cgaas.c') diff --git a/cgaas.c b/cgaas.c index 81796a4..e24e5bb 100644 --- a/cgaas.c +++ b/cgaas.c @@ -3444,6 +3444,28 @@ static void as_rtsi_instruction (struct instruction *instruction) store_w (instruction->instruction_parameters[0].parameter_data.i); } +#ifdef THREAD64 +static void as_ldtsp_instruction (struct instruction *instruction) +{ + int reg,reg_n; + + reg=instruction->instruction_parameters[1].parameter_data.reg.r; + + /* mov label,reg */ + as_r_a (0213,reg,instruction->instruction_parameters[0].parameter_data.l); + + reg_n=reg_num (reg); + + /* mov gs:[0x1480+reg*8],reg */ + store_c (0x65); /* gs prefix */ + store_c (0x48 | ((reg_n & 8)>>1) | ((reg_n & 8)>>2)); + store_c (0213); + store_c (4 | ((reg_n & 7)<<3)); + store_c (0305 | ((reg_n & 7)<<3)); + store_l (0x1480); +} +#endif + static void as_f_r (int code1,int code2,int reg1,int reg2) { store_c (code1); @@ -4522,6 +4544,11 @@ static void as_instructions (struct instruction *instruction) case IRTSI: as_rtsi_instruction (instruction); break; +#ifdef THREAD64 + case ILDTLSP: + as_ldtsp_instruction (instruction); + break; +#endif default: internal_error_in_function ("as_instructions"); } -- cgit v1.2.3