qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Disassembler location
       [not found] <709543045.677058.1720634520917.ref@mail.yahoo.com>
@ 2024-07-10 18:02 ` Michael Morrell
  2024-07-10 21:55   ` Paolo Bonzini
  2024-07-10 21:56   ` Richard Henderson
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Morrell @ 2024-07-10 18:02 UTC (permalink / raw)
  To: qemu-devel

I'm working on a port to a new architecture and was noticing a discrepancy in where the disassembler code lives.  There is a file "target/<arch>/disas.c" for 4 architectures (avr, loongarch, openrisc, and rx), but a file "disas/<arch>.c" for 14 architectures (if I counted right).  It seems the 4 architectures using "target/<arch>/disas.c" are more recently added so I was wondering if that is now the preferred location.  I couldn't find information on this, but I wasn't sure where to look.

Any advice?

Thanks,

   Michael


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

* Re: Disassembler location
  2024-07-10 18:02 ` Disassembler location Michael Morrell
@ 2024-07-10 21:55   ` Paolo Bonzini
  2024-07-10 21:57     ` Richard Henderson
  2024-07-10 21:56   ` Richard Henderson
  1 sibling, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2024-07-10 21:55 UTC (permalink / raw)
  To: mrm94040, qemu-devel

On 7/10/24 20:02, Michael Morrell wrote:
> I'm working on a port to a new architecture and was noticing a
> discrepancy in where the disassembler code lives.  There is a file
> "target/<arch>/disas.c" for 4 architectures (avr, loongarch,
> openrisc, and rx), but a file "disas/<arch>.c" for 14 architectures
> (if I counted right).  It seems the 4 architectures using
> "target/<arch>/disas.c" are more recently added so I was wondering if
> that is now the preferred location.  I couldn't find information on
> this, but I wasn't sure where to look.

loongarch puts it in target/<arch>/ because it reuses some code between 
disassembler and translator.

The others are not hosts, only targets.  By putting the file in 
target/<arch>/, they do not need to add it to the "disassemblers" 
variable in meson.build---but they add it anyway. :)

All in all, if you're not in the loongarch situation I'd put it in disas/.

Paolo



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

* Re: Disassembler location
  2024-07-10 18:02 ` Disassembler location Michael Morrell
  2024-07-10 21:55   ` Paolo Bonzini
@ 2024-07-10 21:56   ` Richard Henderson
  2024-07-11  7:00     ` Rot127
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Henderson @ 2024-07-10 21:56 UTC (permalink / raw)
  To: mrm94040, qemu-devel

On 7/10/24 11:02, Michael Morrell wrote:
> I'm working on a port to a new architecture and was noticing a discrepancy in where the disassembler code lives.  There is a file "target/<arch>/disas.c" for 4 architectures (avr, loongarch, openrisc, and rx), but a file "disas/<arch>.c" for 14 architectures (if I counted right).  It seems the 4 architectures using "target/<arch>/disas.c" are more recently added so I was wondering if that is now the preferred location.  I couldn't find information on this, but I wasn't sure where to look.
> 
> Any advice?

The older disas/arch.c files come from binutils, prior to the GPLv3 license change.  These 
are generally very old architectures, or not up to date.

The newer target/arch/disas.c are for architectures for which the translator and the 
disassembler share generated code via decodetree.  If you're implementing a new 
architecture from scratch, this is your best choice.

The "best" supported are those with support in system libcapstone.  :-)


r~


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

* Re: Disassembler location
  2024-07-10 21:55   ` Paolo Bonzini
@ 2024-07-10 21:57     ` Richard Henderson
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2024-07-10 21:57 UTC (permalink / raw)
  To: Paolo Bonzini, mrm94040, qemu-devel

On 7/10/24 14:55, Paolo Bonzini wrote:
> The others are not hosts, only targets.  By putting the file in target/<arch>/, they do 
> not need to add it to the "disassemblers" variable in meson.build---but they add it 
> anyway. :)

We should clean that up.  :-)

r~


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

* Re: Disassembler location
  2024-07-10 21:56   ` Richard Henderson
@ 2024-07-11  7:00     ` Rot127
  0 siblings, 0 replies; 5+ messages in thread
From: Rot127 @ 2024-07-11  7:00 UTC (permalink / raw)
  To: richard.henderson; +Cc: mrm94040, qemu-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 337 bytes --]

Fyi please note that LoongArch support was recently added to Capstone 
(https://github.com/capstone-engine/capstone/pull/2349).

Also, if you want to add support for a new architecture in Capstone and 
it is supported in LLVM,
you can use our new Auto-Sync updater. See 
https://github.com/capstone-engine/capstone/issues/2015.


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2147 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2024-07-11  7:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <709543045.677058.1720634520917.ref@mail.yahoo.com>
2024-07-10 18:02 ` Disassembler location Michael Morrell
2024-07-10 21:55   ` Paolo Bonzini
2024-07-10 21:57     ` Richard Henderson
2024-07-10 21:56   ` Richard Henderson
2024-07-11  7:00     ` Rot127

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 NNTP newsgroup(s).