This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Decode function entry mask on VAXen
On Wed, Mar 09, 2005 at 11:15:06AM +1030, Alan Modra wrote:
> On Tue, Mar 08, 2005 at 09:30:18PM +0100, Jan-Benedict Glaw wrote:
> Supply a changelog entry, and it's good to commit with a few minor
> changes.
I've done another change to it. The whole last_symbol stuff isn't
needed at all, because objdump nicely fills disassemble_info->symbols,
which can be used instead. I've also dropped the FORCE_DISASSEMBLE
flag, which isn't needed either, because I now let it check for
BSF_FUNCTION symbols. Here's the changelog:
2005-03-09 Jan-Benedict Glaw <jbglaw@lug-owl.de>
* opcodes/vax-dis.c: Update copyright
(entry_mask_bit): New array containing descriptions for entry
mask bits.
(print_insn_vax): Decode function entry mask.
This is my current patch:
diff -Nurp ../cvs-repos/binutils/binutils-upstream-HEAD/opcodes/vax-dis.c src/opcodes/vax-dis.c
--- ../cvs-repos/binutils/binutils-upstream-HEAD/opcodes/vax-dis.c 2002-05-10 01:11:30.000000000 +0200
+++ src/opcodes/vax-dis.c 2005-03-09 09:35:42.000000000 +0100
@@ -1,5 +1,5 @@
/* Print VAX instructions.
- Copyright 1995, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1995, 1998, 2000-2002, 2005 Free Software Foundation, Inc.
Contributed by Pauline Middelink <middelin@polyware.iaf.nl>
This program is free software; you can redistribute it and/or modify
@@ -34,6 +34,21 @@ static char *reg_names[] =
"r8", "r9", "r10", "r11", "ap", "fp", "sp", "pc"
};
+/* Definitions for the function entry mask bits. */
+static char *entry_mask_bit[] =
+{
+ /* Registers 0 and 1 shall not be saved, since they're used to pass back
+ a function's result to it's caller... */
+ "~r0~", "~r1~",
+ /* Registers 2 .. 11 are normal registers. */
+ "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11",
+ /* Registers 12 and 13 are argument and frame pointer and must not
+ be saved by using the entry mask. */
+ "~ap~", "~fp~",
+ /* Bits 14 and 15 control integer and decimal overflow. */
+ "IntOvfl", "DecOvfl",
+};
+
/* Sign-extend an (unsigned char). */
#if __STDC__ == 1
#define COERCE_SIGNED_CHAR(ch) ((signed char)(ch))
@@ -140,6 +155,28 @@ print_insn_vax (memaddr, info)
buffer[1] = 0;
}
+ /* Decode function entry mask. */
+ if (info->num_symbols
+ && info->symbols
+ && info->symbols[0]
+ && (info->symbols[0]->flags & BSF_FUNCTION)
+ && memaddr == bfd_asymbol_value (info->symbols[0]))
+ {
+ int i = 0;
+ int register_mask = buffer[1] << 8 | buffer[0];
+
+ (*info->fprintf_func) (info->stream, "Entry mask 0x%04x = <",
+ register_mask);
+
+ for (i = 15; i >= 0; i--)
+ if (register_mask & (1 << i))
+ (*info->fprintf_func) (info->stream, " %s", entry_mask_bit[i]);
+
+ (*info->fprintf_func) (info->stream, " >");
+
+ return 2;
+ }
+
for (votp = &votstrs[0]; votp->name[0]; votp++)
{
register vax_opcodeT opcode = votp->detail.code;
Thanks, JBG
--
AWEK microdata GmbH -- Am Wellbach 4 -- 33609 Bielefeld