diff options
author | Michal Ludvig <mludvig@suse.cz> | 2004-03-12 10:14:29 +0000 |
---|---|---|
committer | Michal Ludvig <mludvig@suse.cz> | 2004-03-12 10:14:29 +0000 |
commit | 0f10071e3dbfb84b625c8609615bdd0d7b66ec3e (patch) | |
tree | 805d22cdc90a76c428a876dd8cf10b69631671d9 /gas/config | |
parent | c02908d2c016356ad1027f85b70643c7017dafd2 (diff) | |
download | gdb-0f10071e3dbfb84b625c8609615bdd0d7b66ec3e.zip gdb-0f10071e3dbfb84b625c8609615bdd0d7b66ec3e.tar.gz gdb-0f10071e3dbfb84b625c8609615bdd0d7b66ec3e.tar.bz2 |
2004-03-12 Michal Ludvig <mludvig@suse.cz>
* gas/config/tc-i386.c (output_insn): Handle PadLock instructions.
* gas/config/tc-i386.h (CpuPadLock): New define.
(CpuUnknownFlags): Added CpuPadLock.
* include/opcode/i386.h (i386_optab): Added xstore/xcrypt insns.
* opcodes/i386-dis.c (PADLOCK_SPECIAL, PADLOCK_0): New defines.
(dis386_twobyte): Opcode 0xa7 is PADLOCK_0.
(padlock_table): New struct with PadLock instructions.
(print_insn): Handle PADLOCK_SPECIAL.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-i386.c | 34 | ||||
-rw-r--r-- | gas/config/tc-i386.h | 5 |
2 files changed, 30 insertions, 9 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index b1ba958..5de6a55 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -1,6 +1,6 @@ /* i386.c -- Assemble code for the Intel 80386 Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -23,6 +23,7 @@ /* Intel 80386 machine specific gas. Written by Eliot Dresselhaus (eliot@mgm.mit.edu). x86_64 support by Jan Hubicka (jh@suse.cz) + VIA PadLock support by Michal Ludvig (mludvig@suse.cz) Bugs & suggestions are completely welcome. This is free software. Please help us make it better. */ @@ -3123,7 +3124,6 @@ output_interseg_jump () md_number_to_chars (p + size, (valueT) i.op[0].imms->X_add_number, 2); } - static void output_insn () { @@ -3151,10 +3151,23 @@ output_insn () char *p; unsigned char *q; - /* All opcodes on i386 have either 1 or 2 bytes. We may use third - byte for the SSE instructions to specify a prefix they require. */ - if (i.tm.base_opcode & 0xff0000) - add_prefix ((i.tm.base_opcode >> 16) & 0xff); + /* All opcodes on i386 have either 1 or 2 bytes, PadLock instructions + have 3 bytes. We may use one more higher byte to specify a prefix + the instruction requires. */ + if ((i.tm.cpu_flags & CpuPadLock) != 0 + && (i.tm.base_opcode & 0xff000000) != 0) + { + unsigned int prefix; + prefix = (i.tm.base_opcode >> 24) & 0xff; + + if (prefix != REPE_PREFIX_OPCODE + || i.prefix[LOCKREP_PREFIX] != REPE_PREFIX_OPCODE) + add_prefix (prefix); + } + else + if ((i.tm.cpu_flags & CpuPadLock) == 0 + && (i.tm.base_opcode & 0xff0000) != 0) + add_prefix ((i.tm.base_opcode >> 16) & 0xff); /* The prefix bytes. */ for (q = i.prefix; @@ -3175,7 +3188,14 @@ output_insn () } else { - p = frag_more (2); + if ((i.tm.cpu_flags & CpuPadLock) != 0) + { + p = frag_more (3); + *p++ = (i.tm.base_opcode >> 16) & 0xff; + } + else + p = frag_more (2); + /* Put out high byte first: can't use md_number_to_chars! */ *p++ = (i.tm.base_opcode >> 8) & 0xff; *p = i.tm.base_opcode & 0xff; diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index 069c233..14b522b 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -1,6 +1,6 @@ /* tc-i386.h -- Header file for tc-i386.c Copyright 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003 + 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -194,13 +194,14 @@ typedef struct #define CpuSSE2 0x2000 /* Streaming SIMD extensions 2 required */ #define Cpu3dnow 0x4000 /* 3dnow! support required */ #define CpuPNI 0x8000 /* Prescott New Instructions required */ +#define CpuPadLock 0x10000 /* VIA PadLock required */ /* These flags are set by gas depending on the flag_code. */ #define Cpu64 0x4000000 /* 64bit support required */ #define CpuNo64 0x8000000 /* Not supported in the 64bit mode */ /* The default value for unknown CPUs - enable all features to avoid problems. */ -#define CpuUnknownFlags (Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuP4|CpuSledgehammer|CpuMMX|CpuSSE|CpuSSE2|CpuPNI|Cpu3dnow|CpuK6|CpuAthlon) +#define CpuUnknownFlags (Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuP4|CpuSledgehammer|CpuMMX|CpuSSE|CpuSSE2|CpuPNI|Cpu3dnow|CpuK6|CpuAthlon|CpuPadLock) /* the bits in opcode_modifier are used to generate the final opcode from the base_opcode. These bits also are used to detect alternate forms of |