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.
This commit is contained in:
Michal Ludvig 2004-03-12 10:14:29 +00:00
parent c02908d2c0
commit 0f10071e3d
7 changed files with 91 additions and 11 deletions

View file

@ -1,3 +1,9 @@
2004-03-12 Michal Ludvig <mludvig@suse.cz>
* config/tc-i386.c (output_insn): Handle PadLock instructions.
* config/tc-i386.h (CpuPadLock): New define.
(CpuUnknownFlags): Added CpuPadLock.
2004-03-07 Andreas Schwab <schwab@suse.de>
* doc/c-hppa.texi (HPPA Directives): Fix typo.

View file

@ -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;

View file

@ -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

View file

@ -1,3 +1,7 @@
2004-03-12 Michal Ludvig <mludvig@suse.cz>
* i386.h (i386_optab): Added xstore/xcrypt insns.
2004-02-09 Anil Paranjpe <anilp1@KPITCummins.com>
* h8300.h (32bit ldc/stc): Add relaxing support.

View file

@ -1361,6 +1361,13 @@ static const template i386_optab[] = {
{"sysret", 0, 0x0f07, X, CpuK6, lq_Suf|DefaultSize, { 0, 0, 0} },
{"swapgs", 0, 0x0f01, 0xf8, Cpu64, NoSuf|ImmExt, { 0, 0, 0} },
/* VIA PadLock extensions. */
{"xstorerng", 0, 0x0fa7c0, X, Cpu686|CpuPadLock, NoSuf|IsString, { 0, 0, 0} },
{"xcryptecb", 0, 0xf30fa7c8, X, Cpu686|CpuPadLock, NoSuf|IsString, { 0, 0, 0} },
{"xcryptcbc", 0, 0xf30fa7d0, X, Cpu686|CpuPadLock, NoSuf|IsString, { 0, 0, 0} },
{"xcryptcfb", 0, 0xf30fa7e0, X, Cpu686|CpuPadLock, NoSuf|IsString, { 0, 0, 0} },
{"xcryptofb", 0, 0xf30fa7e8, X, Cpu686|CpuPadLock, NoSuf|IsString, { 0, 0, 0} },
/* sentinel */
{NULL, 0, 0, 0, 0, 0, { 0, 0, 0} }
};

View file

@ -1,3 +1,10 @@
2004-03-12 Michal Ludvig <mludvig@suse.cz>
* 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.
2004-03-12 Alan Modra <amodra@bigpond.net.au>
* i386-dis.c (grps): Use clflush by default for 0x0fae/7.

View file

@ -1,6 +1,6 @@
/* Print i386 instructions for GDB, the GNU debugger.
Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2001, 2002, 2003 Free Software Foundation, Inc.
2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
* July 1988
* modified by John Hassey (hassey@dg-rtp.dg.com)
* x86-64 support added by Jan Hubicka (jh@suse.cz)
* VIA PadLock support by Michal Ludvig (mludvig@suse.cz)
*/
/*
@ -362,6 +363,7 @@ fetch_data (struct disassemble_info *info, bfd_byte *addr)
#define USE_GROUPS 2
#define USE_PREFIX_USER_TABLE 3
#define X86_64_SPECIAL 4
#define PADLOCK_SPECIAL 5
#define FLOAT NULL, NULL, FLOATCODE, NULL, 0, NULL, 0
@ -388,6 +390,7 @@ fetch_data (struct disassemble_info *info, bfd_byte *addr)
#define GRP13 NULL, NULL, USE_GROUPS, NULL, 20, NULL, 0
#define GRP14 NULL, NULL, USE_GROUPS, NULL, 21, NULL, 0
#define GRPAMD NULL, NULL, USE_GROUPS, NULL, 22, NULL, 0
#define GRPPLOCK NULL, NULL, USE_GROUPS, NULL, 23, NULL, 0
#define PREGRP0 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 0, NULL, 0
#define PREGRP1 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 1, NULL, 0
@ -425,6 +428,8 @@ fetch_data (struct disassemble_info *info, bfd_byte *addr)
#define X86_64_0 NULL, NULL, X86_64_SPECIAL, NULL, 0, NULL, 0
#define PADLOCK_0 NULL, NULL, PADLOCK_SPECIAL, NULL, 0, NULL, 0
typedef void (*op_rtn) (int bytemode, int sizeflag);
struct dis386 {
@ -948,7 +953,7 @@ static const struct dis386 dis386_twobyte[] = {
{ "shldS", Ev, Gv, Ib },
{ "shldS", Ev, Gv, CL },
{ "(bad)", XX, XX, XX },
{ "(bad)", XX, XX, XX },
{ PADLOCK_0 },
/* a8 */
{ "pushT", gs, XX, XX },
{ "popT", gs, XX, XX },
@ -1449,6 +1454,17 @@ static const struct dis386 grps[][8] = {
{ "(bad)", XX, XX, XX },
{ "(bad)", XX, XX, XX },
{ "(bad)", XX, XX, XX },
},
/* GRPPLOCK */
{
{ "xstore", XX, XX, XX },
{ "xcryptecb", XX, XX, XX },
{ "xcryptcbc", XX, XX, XX },
{ "(bad)", XX, XX, XX },
{ "xcryptcfb", XX, XX, XX },
{ "xcryptofb", XX, XX, XX },
{ "(bad)", XX, XX, XX },
{ "(bad)", XX, XX, XX },
}
};
@ -1693,6 +1709,19 @@ static const struct dis386 x86_64_table[][2] = {
},
};
static const struct dis386 padlock_table[][8] = {
{
{ "xstorerng", XX, XX, XX },
{ "xcryptecb", XX, XX, XX },
{ "xcryptcbc", XX, XX, XX },
{ "(bad)", XX, XX, XX },
{ "xcryptcfb", XX, XX, XX },
{ "xcryptofb", XX, XX, XX },
{ "(bad)", XX, XX, XX },
{ "(bad)", XX, XX, XX },
},
};
#define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
static void
@ -2191,6 +2220,12 @@ print_insn (bfd_vma pc, disassemble_info *info)
dp = &x86_64_table[dp->bytemode2][mode_64bit];
break;
case PADLOCK_SPECIAL:
FETCH_DATA (info, codep + 1);
index = (*codep++ >> 3) & 0x07;
dp = &padlock_table[dp->bytemode2][index];
break;
default:
oappend (INTERNAL_DISASSEMBLER_ERROR);
break;