public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Disassemble CASEx assembler instructions
@ 2005-03-28 22:54 Jan-Benedict Glaw
  2005-03-29 15:44 ` Hans-Peter Nilsson
  0 siblings, 1 reply; 4+ messages in thread
From: Jan-Benedict Glaw @ 2005-03-28 22:54 UTC (permalink / raw)
  To: binutils

Hi!

IIRC, the HP PA-RISC architecture also has a "case" instruction,
like VAX has one, too. How could this be menaingful disassembled?
Well, the PA-RISC backend seems to not recognize it (of I haven't
really found the code...), but the VAX backend does -- quite
suboptimal. Behing the initial CASEx instruction, there are a number
of displacements (which were currently disassembled as instructions).

As it seems, not a lot of ISAs actually know this type of instruction,
so there's no generic code to handle the displacement table. These
ideas come to mind:

	- Let the backend recognize that this is a CASEx opcode and
	  return (as number of bytes disassembled) the CASEx opcode
	  plus the size of the whole displacement table. This would
	  basically dump the whole table in hex and disassembly would
	  be correct after the table.

	- Implement higher-level knowledge of what's about to be
	  disassembled. Then the backend could signal that there's
	  a table of /n/ displacements of type /t/, which the backend
	  in turn could disassemble displacement-for-displacement.

The easy method of at least getting the disassembly of the remainder
of the function correct would be at least to implement the first
solution, which is additionally quite easy to implement.

Comments?

MfG, JBG

-- 
AWEK microdata GmbH -- Am Wellbach 4 -- 33609 Bielefeld

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Disassemble CASEx assembler instructions
  2005-03-28 22:54 Disassemble CASEx assembler instructions Jan-Benedict Glaw
@ 2005-03-29 15:44 ` Hans-Peter Nilsson
  2005-03-29 15:45   ` Hans-Peter Nilsson
  2005-03-29 15:51   ` Jan-Benedict Glaw
  0 siblings, 2 replies; 4+ messages in thread
From: Hans-Peter Nilsson @ 2005-03-29 15:44 UTC (permalink / raw)
  To: Jan-Benedict Glaw; +Cc: binutils

On Mon, 28 Mar 2005, Jan-Benedict Glaw wrote:
> Well, the PA-RISC backend seems to not recognize it (of I haven't
> really found the code...), but the VAX backend does -- quite
> suboptimal.

See also opcodes/cris-dis.c.  Though that case-handling is quite
buggy, I'm afraid.

> 	- Let the backend recognize that this is a CASEx opcode and
> 	  return (as number of bytes disassembled) the CASEx opcode
> 	  plus the size of the whole displacement table. This would
> 	  basically dump the whole table in hex and disassembly would
> 	  be correct after the table.

Doesn't this automatically happen if you add the size of
the table when you disassemble the CASEx insn?

> 	- Implement higher-level knowledge of what's about to be
> 	  disassembled. Then the backend could signal that there's
> 	  a table of /n/ displacements of type /t/, which the backend
> 	  in turn could disassemble displacement-for-displacement.

If this is done, it needs to handle different equations for the
contents of the table: size of each item, counting from the
start of the table or the offset, whether relative or absolute.
Perhaps best handled by the target passing a function pointer.

brgds, H-P

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Disassemble CASEx assembler instructions
  2005-03-29 15:44 ` Hans-Peter Nilsson
@ 2005-03-29 15:45   ` Hans-Peter Nilsson
  2005-03-29 15:51   ` Jan-Benedict Glaw
  1 sibling, 0 replies; 4+ messages in thread
From: Hans-Peter Nilsson @ 2005-03-29 15:45 UTC (permalink / raw)
  To: Jan-Benedict Glaw; +Cc: binutils

On Tue, 29 Mar 2005, Hans-Peter Nilsson wrote:
> Doesn't this automatically happen if you add the size of
> the table when you disassemble the CASEx insn?

s/add/add to the return value of the print_insn function/.

brgds, H-P

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Disassemble CASEx assembler instructions
  2005-03-29 15:44 ` Hans-Peter Nilsson
  2005-03-29 15:45   ` Hans-Peter Nilsson
@ 2005-03-29 15:51   ` Jan-Benedict Glaw
  1 sibling, 0 replies; 4+ messages in thread
From: Jan-Benedict Glaw @ 2005-03-29 15:51 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils

On Tue, Mar 29, 2005 at 08:16:38AM -0500, Hans-Peter Nilsson wrote:
> On Mon, 28 Mar 2005, Jan-Benedict Glaw wrote:
> > 	- Let the backend recognize that this is a CASEx opcode and
> > 	  return (as number of bytes disassembled) the CASEx opcode
> > 	  plus the size of the whole displacement table. This would
> > 	  basically dump the whole table in hex and disassembly would
> > 	  be correct after the table.
> 
> Doesn't this automatically happen if you add the size of
> the table when you disassemble the CASEx insn?

Yes, it would. But right now, the VAX backend returns only the length
of the CASEx instruction (including its operands). If the table follows
directly, it omits/forgets to add its size, too.

[x] Placed on TODO ...

MfG, JBG

-- 
AWEK microdata GmbH -- Am Wellbach 4 -- 33609 Bielefeld

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-03-29 13:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-28 22:54 Disassemble CASEx assembler instructions Jan-Benedict Glaw
2005-03-29 15:44 ` Hans-Peter Nilsson
2005-03-29 15:45   ` Hans-Peter Nilsson
2005-03-29 15:51   ` Jan-Benedict Glaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).