Commit graph

5050 commits

Author SHA1 Message Date
Jan Beulich
101b4bb8f4 x86: improve matching diagnostics when %st is involved
Diagnosing operand size vs operand type mismatches doesn't work very
well when GPRs and FPRs are in the same register class, distinguished
just by size. Introduce a separate RegFP class.
2025-05-16 10:32:19 +02:00
dysun
bbac5532cc RISC-V: Add zilsd & zclsd support
Ref: https://github.com/riscv/riscv-zilsd/blob/main/zilsd.adoc

Signed-off-by: dysun <sundongya@nucleisys.com>

Co-developed-by: LIU Xu <liuxu@nucleisys.com>
Co-developed-by: ZHAO Fujin <zhaofujin@nucleisys.com>
2025-05-16 08:57:48 +08:00
Alice Carlotti
1c87a0ffc2 aarch64: Replace incorrect comment
The comment explaining the placement of the cfinv entry before the
generic msr entry in the opcode table was incorrect.  The issue is
unrelated to the all ones bitmask for cfinv, and is actually due the
large number of architectural aliases of the msr instruction.
2025-05-13 17:57:30 +01:00
Ezra Sitorus
f891d8e69d aarch64: Support for FEAT_RME_GPC3
FEAT_RME_GPC3 - RME Granule Protection Check 3 Extension - introduces
a method for defining a set of windows in the memory map for which
Granule Protection Checks are skipped, and instead applies a set of
default settings associated with the window.

This patch introduces the sysreg gpcbw_el3. Add -march=armv9.5-a to
access this sysreg since this feature is optional from armv9.5-a.
2025-05-12 17:07:53 +01:00
Ezra Sitorus
720e45f92a aarch64: Support for FEAT_OCCMO
FEAT_OCCMO - Outer Cacheable Cache Maintenance Operation - introduces
system instructions that provides software with a mechanism to publish
writes to the Outer cache level.
2025-05-12 16:54:36 +01:00
Alice Carlotti
fd45b1c1aa aarch64: Mark predicate-as-counter pseudo instructions
Using explicit pseudo aliases is clearer and more consistent with other
instruction aliases.

This does not change behaviour.  For the non-alias instructions
(everything except mov) we already picked the first matching entry for
disassembly by default.  For mov we picked the last matching aliased
entry, which remained the original alias since do_misc_decoding doesn't
recognise OP_MOV_PN_PN.
2025-05-09 20:27:22 +01:00
Alice Carlotti
f20bd95af0 aarch64: Mark clearbhb as a pseudo instruction
This was an early name for the clrbhb hint instruction.  Some software
was written with the old name before it was renamed, so we support it
for assembly but should never use it in disassembly.

This patch has no functional change, because we already pick (by
default) the last matching alias in the opcode table, and clrbhb is
listed later than clearbhb.
2025-05-09 20:27:22 +01:00
Alice Carlotti
f1c037989a aarch64: Fix dgh disassembly 2025-05-09 20:27:22 +01:00
Alice Carlotti
51df25b00f aarch64: Mark SME mova aliases
This will only change behaviour during disassembly with -M no-aliases.
2025-05-09 20:27:22 +01:00
Alice Carlotti
a8d71f52d0 aarch64: Mark rev64 as a pseudo instruction
This is more natural than raising the priority of rev with F_P1, and
is functionally equivalent.
2025-05-09 20:27:22 +01:00
Alice Carlotti
92f7d4ddde aarch64: Eliminate AARCH64_OPND_SVE_ADDR_R
Adjust parsing for AARCH64_OPND_SVE_ADDR_RR{_LSL*} operands to accept
implicit XZR offsets.  Add new AARCH64_OPND_SVE_ADDR_RM{_LSL*} operands
to support instructions where an XZR offset is allowed but must be
specified explicitly.  This allows the removal of the duplicate opcode
table entries using AARCH64_OPND_SVE_ADDR_R.
2025-05-09 20:19:30 +01:00
Chao-ying Fu
617ead3c20 RISC-V: Added vendor extensions, xmipscbop, xmipscmov, xmipsexectl and xmipslsp
Spec:
https://mips.com/wp-content/uploads/2025/03/P8700-F_Programmers_Reference_Manual_Rev1.82_3-19-2025.pdf

Added MIPS vendor extensions, xmipscbop, xmipscmov, xmipsexectl and xmipslsp
with verison 1.0.

Passed binutils testsuites of targets elf32/elf64/linux32/linux64.

Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Signed-off-by: Chao-ying Fu <cfu@wavecomp.com>
2025-05-09 12:24:15 +08:00
Jens Remus
bc1b43ef7a s390: Fix format specifier for VR in disassembler
Vector register (VR) numbers are unsigned.  Use format specifier %u
instead of %i.

Reported-by: Florian Krohm <flo2030@eich-krohm.de>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-05-07 17:17:10 +02:00
Kito Cheng
10ec3d5de0 RISC-V: Mark fgt.*/fge.* as instruction alias
They are instruction alias, but not mark correctly, and seems like we
don't have a good way to verify that since the disassembler doesn't
disassemble instruction into alias.

[1] https://github.com/riscv-non-isa/riscv-asm-manual/pull/124
2025-04-30 08:04:38 +08:00
Maciej W. Rozycki
4a5312e736 Regenerate more configury files for 64-bit BFD detection fix
The fix for 64-bit BFD detection omitted the regeneration of a bunch
of configury files; fix that.
2025-04-28 19:27:22 +01:00
Maciej W. Rozycki
d9639e091c Fix 64-bit BFD detection causing build failures
We have a discrepancy with 64-bit BFD handling across our component
subdirectories leading to link failures such as:

ld: ../opcodes/.libs/libopcodes.a(disassemble.o): in function `disassembler': disassemble.c:(.text+0x65): undefined reference to `print_insn_alpha'
ld: disassemble.c:(.text+0x105): undefined reference to `print_insn_ia64'
ld: disassemble.c:(.text+0x11d): undefined reference to `print_insn_loongarch'
ld: disassemble.c:(.text+0x1a1): undefined reference to `print_insn_big_mips'
[...]

with some configurations having a 32-bit host and 64-bit BFD, such as:
`--host=i386-linux-gnu --target=riscv64-linux-gnu --enable-targets=all'.
This is ultimately due to how 64-bit BFD is enabled for bfd/ itself and
other subdirectorses and has been a regression from commit 1d5269c994
("unify 64-bit bfd checks").

For bfd/ the BFD_64_BIT autoconf macro from config/bfd64.m4 is used
combined with this logic in bfd/configure.ac:

case ${host64}-${target64}-${want64} in
  *true*)
    wordsize=64
    bfd64_libs='$(BFD64_LIBS)'
    all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
    [...]
    ;;
  false-false-false)
    wordsize=32
    all_backends='$(BFD32_BACKENDS)'
    ;;
esac

where the value of ${wordsize} switches between 32-bit and 64-bit BFD
via these pieces:

#define BFD_ARCH_SIZE @wordsize@

and:

#if BFD_ARCH_SIZE >= 64
#define BFD64
#endif

in bfd/bfd-in.h, which ultimately becomes a part of "bfd.h".

Then ${host64} is determined in bfd/configure.ac from the host's word
size, via the host's pointer size:

if test "x${ac_cv_sizeof_void_p}" = "x8"; then
  host64=true
fi

And ${target64} is determined in bfd/configure.ac from the target's word
size:

    if test ${target_size} = 64; then
	target64=true
    fi

Where multiple targets have been requested with `--enable-targets=all'
the presence of any 64-bit target will set "true" here.

Finally ${want64} is set according to `--enable-64-bit-bfd' user option
with an arrangement involving BFD_64_BIT:

BFD_64_BIT
if test $enable_64_bit_bfd = yes ; then
  want64=true
else
  want64=false
fi

which also, redundantly, checks and sets its result upon the host's word
size.  Lastly ${want64} is also selectively set by target fragments in
bfd/config.bfd, which mostly if not completely overlaps with ${target64}
setting as described above.

Conversely other subdirectories only rely on BFD_64_BIT, so they fail to
notice that BFD is 64-bit and do not enable their 64-bit handling where
the host requested is 32-bit and 64-bit BFD has been enabled other than
with `--enable-64-bit-bfd'.  One consequence is opcodes/disassemble.c
enables calls to its numerous own 64-bit backends by checking the BFD64
macro from "bfd.h", however does not actually enable said backends in
its Makefile.  Hence the link errors quoted above.

Address the problem then by moving the `--enable-64-bit-bfd' option back
to bfd/configure.ac and remove the call to BFD_64_BIT from there and
then rewrite the macro in terms of checking for the presence of BFD64
macro in "bfd.h", which is the canonical way of determining whether BFD
is 64-bit or not.

Rather than running `grep' directly on ../bfd/bfd-in3.h as the opcodes/
fragment used to before the problematic commit:

    if grep '#define BFD_ARCH_SIZE 64' ../bfd/bfd-in3.h > /dev/null; then

run the preprocessor on "bfd.h", which allows to invoke the macro from
configure.ac files placed in subdirectories located at deeper levels, by
relying on the preprocessor's search path.

This requires however that the invokers rely on `all-bfd' rather than
`configure-bfd' for their `configure' invocation stage, because "bfd.h"
is made by `make all' rather than `configure' in bfd/.

Do not cache the result of this check however, as reconfiguring a tree
such as to flip `--enable-64-bit-bfd' on or to change a secondary target
may affect BFD64 and we have no access to information about secondary
targets in BFD_64_BIT.

Also remove the ENABLE_BFD_64_BIT automake conditional, as it's not used
anywhere.

Last but not least remove the hack from gdb/configure.ac to fail builds
for `mips*-*-*' hosts where `--enable-targets=all' has been requested,
but `--enable-64-bit-bfd' has not as it's no longer needed.  Such builds
complete successfully now, having enabled 64-bit BFD implicitly.

Tested-By: Guinevere Larsen <guinevere@redhat.com>
Tested-By: Luis Machado <luis.machado@arm.com>
Approved-By: Alan Modra <amodra@gmail.com>
Approved-By: Luis Machado <luis.machado@arm.com>
2025-04-28 18:53:30 +01:00
Surya Kumari Jangala
863cfde5f0 PowerPC: Support for Prefixed Add Immediate Shifted Instruction (RFC02686)
opcodes/
	* ppc-opc.c (insert_si32, extract_si32, insert_nsi32,
	extract_nsi32): New functions.
	(SI32, NSI32, P_D_SI32_MASK, P_DRAPCREL_SI32_MASK): New macros.
	(IMM32): Update for new macros.
	(powerpc_opcodes): Add plis, paddis, psubis.

gas/
	* testsuite/gas/ppc/future.s: New test.
	* testsuite/gas/ppc/future.d: Likewise.
2025-04-28 02:55:05 -05:00
Marek Pikuła
88891208c3 RISC-V: Add missing disassembler option max
The flag already exists but it's not been exposed to user.

Signed-off-by: Marek Pikuła <m.pikula@partner.samsung.com>
2025-04-15 10:59:51 +08:00
Jan Beulich
55cee09736 x86: move PadLock enumerators
... to be all in one group. This helps code generation for code like

      || is_cpu (&i.tm, CpuPadLock)
      || is_cpu (&i.tm, CpuPadLockRNG2)
      || is_cpu (&i.tm, CpuPadLockPHE2)
      || is_cpu (&i.tm, CpuPadLockXMODX)

that we have (effectively) twice.
2025-04-14 14:22:21 +02:00
WANG Xuerui
eff93f19cb LoongArch: Support LA32R aliases rdcnt{vl,vh,id}.w
These LA32R instructions are in fact special cases of the LA32S/LA64
rdtime{l,h}.w (with only one output operand instead of two, the other
one being forced to $zero), but are named differently in the LA32R
ISA manual nevertheless.

As the LA32R names are more memorable to a degree (especially for those
having difficulties remembering which operand corresponds to the node
ID), support them by making them aliases of the corresponding LA32S/LA64
instruction respectively, and make them render as such in disassembly.

Signed-off-by: WANG Xuerui <git@xen0n.name>
2025-04-13 10:45:00 +08:00
Jens Remus
981fe5fd80 s390: Add support for z17 as CPU name
So far IBM z17 was identified as arch15.  Add the real name, as it has
been announced. [1]

[1]: IBM z17 announcement letter, AD25-0015,
     https://www.ibm.com/docs/en/announcements/z17-makes-more-possible

gas/
	* config/tc-s390.c (s390_parse_cpu): Add z17 as alternate CPU
	name for arch15.
	* doc/c-s390.texi: Likewise.
	* doc/as.texi: Likewise.

opcodes/
	* s390-mkopc.c (main): Add z17 as alternate CPU name for arch15.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-04-09 09:00:48 +02:00
H.J. Lu
03df259d29 x86: Add {noimm8s} pseudo prefix
Instruction templates with only sign-extended 8-bit immediate operand
also have a second template with full-operand-size immediate operand
under a different opcode.  Add {noimm8s} pseudo prefix to exclude
templates with only sign-extended 8-bit immediate operand.

gas/

	PR gas/32811
	* config/tc-i386.c (pseudo_prefixes): Add no_imm8s.
	(operand_size_match): Return false for templates with only sign-
	extended 8-bit immediate operand if {noimm8s} is used.
	(parse_insn): Handle Prefix_NoImm8s.
	* doc/c-i386.texi: Document {noimm8s}.
	* testsuite/gas/i386/pseudos.s: Add tests for {noimm8s}.
	* testsuite/gas/i386/x86-64-pseudos.s: Likewise.
	* testsuite/gas/i386/pseudos.d: Updated.
	* testsuite/gas/i386/x86-64-pseudos.d: Likewise.

opcodes/

	PR gas/32811
	* opcodes/i386-opc.h (Prefix_NoImm8s): New.
	* i386-opc.tbl: Add {noimm8s} pseudo prefix.
	* i386-mnem.h: Regenerated.
	* i386-tbl.h: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-29 07:04:20 -07:00
Marek Pikuła
0d1f436268 RISC-V: Don't show support for 1.9.1 priv spec
The privileged spec 1.9.1 support was removed since binutils 2.43. The
linker only recognizes it and then reports a warning that it may
conflict with other spec versions.

While the support is removed, binutils should still recognize it, but it
shouldn't be exposed to the user in `disassember-options` help.

Signed-off-by: Marek Pikuła <m.pikula@partner.samsung.com>
2025-03-28 09:20:50 +08:00
Haochen Jiang
fdb44fced2 x86: Remove AVX10.2 256 bit rounding support
Since we will support 512 bit on both P-core and E-core for AVX10, 256 bit
rounding is not that useful because we currently have rounding feature
directly on E-core now and no need to use 256-bit rounding as somehow
a workaround. This patch will remove all the support and backport to
Binutils 2.44.

gas/ChangeLog:

	* NEWS: Mention support removal.
	* config/tc-i386.c (build_evex_prefix): Remove U bit encode.
	(check_VecOperands): Remove ymm check for rounding.
	(s_insn): Revise .insn comment.
	* testsuite/gas/i386/avx10_2-256-cvt-intel.d: Remove ymm
	rounding related test.
	* testsuite/gas/i386/avx10_2-256-cvt.d: Ditto.
	* testsuite/gas/i386/avx10_2-256-cvt.s: Ditto.
	* testsuite/gas/i386/avx10_2-256-miscs-intel.d: Ditto.
	* testsuite/gas/i386/avx10_2-256-miscs.d: Ditto.
	* testsuite/gas/i386/avx10_2-256-miscs.s: Ditto.
	* testsuite/gas/i386/avx10_2-256-satcvt-intel.d: Ditto.
	* testsuite/gas/i386/avx10_2-256-satcvt.d: Ditto.
	* testsuite/gas/i386/avx10_2-256-satcvt.s: Ditto.
	* testsuite/gas/i386/evex.d: Ditto.
	* testsuite/gas/i386/evex.s: Ditto.
	* testsuite/gas/i386/i386.exp: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-cvt-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-cvt.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-cvt.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-miscs-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-miscs.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-miscs.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-satcvt-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-satcvt.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-satcvt.s: Ditto.
	* testsuite/gas/i386/x86-64-evex.d: Ditto.
	* testsuite/gas/i386/x86-64.exp: Ditto.
	* testsuite/gas/i386/avx10_2-rounding-intel.d: Removed.
	* testsuite/gas/i386/avx10_2-rounding-inval.l: Removed.
	* testsuite/gas/i386/avx10_2-rounding-inval.s: Removed.
	* testsuite/gas/i386/avx10_2-rounding.d: Removed.
	* testsuite/gas/i386/avx10_2-rounding.s: Removed.
	* testsuite/gas/i386/x86-64-avx10_2-rounding-intel.d: Removed.
	* testsuite/gas/i386/x86-64-avx10_2-rounding.d: Removed.
	* testsuite/gas/i386/x86-64-avx10_2-rounding.s: Removed.

opcodes/ChangeLog:

	* i386-dis.c (struct instr_info): Remove U bit.
	(get_valid_dis386): Roll back to APX condition.
	* i386-opc.tbl: Remove ymm rounding support.
	* i386-tbl.h: Regenerated.
2025-03-27 10:10:47 +08:00
WANG Xuerui
6d1823dc89 LoongArch: Fix disassembly option parsing stopping at the first option
Turns out the return value of parse_loongarch_dis_option acts as an
error code, and previously the function always signified failure with
a non-zero return value, making only the first disassembly option get
to take effect.

Fix by adding the missing `return 0`'s to the two success code paths.

Signed-off-by: WANG Xuerui <git@xen0n.name>
2025-03-26 15:49:58 +08:00
Jerry Zhang Jian
a7ecc1ba97 RISC-V: add Smrnmi 1.0 instruction support
Add instruction `mnret' support

Ref:
bb8b9127f8/src/rnmi.adoc
946eb67387/extensions/rv_smrnmi

bfd/ChangeLog:
    * elfxx-riscv.c: Add new Smrnmi instruction class handling

gas/ChangeLog:
    * testsuite/gas/riscv/smrnmi.s: New test for mnret
    * testsuite/gas/riscv/rmrnmi.d: Likewise

include/ChangeLog:
    * opcode/ricsv-opc.h: Add MATCH_MNRET, MASK_MNRET
    * opcode/riscv.h: Add new instruction class

opcodes/ChangeLog:
    * riscv-opc.c: Add `mnret' instruction

Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
2025-03-26 10:16:05 +08:00
Ezra Sitorus
f977d551da aarch64: Add missing FEAT_MEC dc encodings and gate sysregs
FEAT_MEC support was introduced in [1]. However, the dc instruction was
missing these encodings:
- DC CIPAE
- DC CIGDPAE

Furthermore, the Arm ARM states that FEAT_MEC is an optional extension,
introduced for v9.2-a.
Therefore, these sysregs:
- MECIDR_EL2
- MECID_P0_EL2
- MECID_A0_EL2
- MECID_P1_EL2
- MECID_A1_EL2
- VMECID_P_EL2
- VMECID_A_EL2
- MECID_RL_A_EL3

which were introduced in that commit now require -march=armv9.2-a at the very
least to be enabled, as well as the dc encodings.

opcodes/ChangeLog:
	* aarch64-opc.c (aarch64_sys_regs_dc): Add "cipae" and "cigdpae".
	* aarch64-sys-regs.def: Add V8_7A as a requirement for the above system
	registers.

gas/testsuite/gas/ChangeLog
	* aarch64/mec-invalid.s: Add .arch directive.
	* aarch64/mec.d: Add .arch directive and check for cipae, cigdpae.
	* aarch64/mec.s: Add MEC data cache operations test.
	* aarch64/mec-arch-bad.d: New test to check for bad arch version.
	* aarch64/mec-arch-bad.l: Above.

[1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=31f2faf5cf112931cfb8c0564a2b78477c907fe3

Regression tested on aarch64-none-elf
2025-03-24 16:28:31 +00:00
Jin Ma
66b81b40dc RISC-V: Add extension XTheadVdot for T-Head VECTOR vendor extension [1]
T-Head has a range of vendor-specific instructions. Therefore
it makes sense to group them into smaller chunks in form of
vendor extensions.

This patch adds the additional extension "XTheadVdot" based on the
"V" extension, and it provides four 8-bit multiply and add with
32-bit instructions for the "v" extension. The 'th' prefix and the
"XTheadVector" extension are documented in a PR for the
RISC-V toolchain conventions ([2]).

Co-Authored-By: Lifang Xia <lifang_xia@linux.alibaba.com>

[1] https://github.com/XUANTIE-RV/thead-extension-spec/tree/master/xtheadvdot
[2] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_multi_subset_supports): Add support
	for "XTheadVdot" extension.
	(riscv_multi_subset_supports_ext): Likewise.

gas/ChangeLog:

	* doc/c-riscv.texi: Likewise.
	* testsuite/gas/riscv/march-help.l: Likewise.
	* testsuite/gas/riscv/x-thead-vdot.d: New test.
	* testsuite/gas/riscv/x-thead-vdot.s: New test.

include/ChangeLog:

	* opcode/riscv-opc.h (MATCH_TH_VMAQA_VV): New.
	* opcode/riscv.h (enum riscv_insn_class): Add insn class for
	XTheadVdot.

opcodes/ChangeLog:

	* riscv-opc.c: Likewise.
2025-03-18 12:27:26 +08:00
Nelson Chu
e4c9f0e6c3 RISC-V: Avoid parsing arch string repeatedly for dis-assembler
Since we now always generate $x+isa for now, these would increase the
dis-assemble time by parsing the same architecture string repeatedly.  We
already have `arch_str' field into `subset_list' to record the current
architecture stirng, but it's only useful for assembler, since dis-assembler
and linker don't need it before.  Now for dis-assembler, we just need to
update the `arch_str' after parsing the architecture stirng, and then avoid
parsing repeatedly if the strings are the same.
2025-03-18 12:16:27 +08:00
Andrew Oates
ade87b8e62 RISC-V: Re-define mapping symbol $x to the file elf architecture attribute
The mapping symbol "$x" without an ISA string "means using ISA
configuration from ELF attribute."[1].  Currently the code does not
reset the subset_list.  This means that a previous mapping symbol that
overrides the ISA string will continue to be used, rather than the
default string set in the ELF file's .riscv.attributes section.  This
can cause incorrect or failed instruction decodings.

In practice, this causes problems when disassembling code generated by
LLVM, which (unlike gas) does not emit explicit mapping symbols at the
start of each section.

This change stores the default architecture string seen at the beginning
of disassembly in the global parse data struct, and restores that to
subset_list whenever a bare "$x" symbol is seen.

[1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#mapping-symbol

Before this patch, the mapping-x.s was dumped as,

00000000 <.text>:
   0:	00000013          	nop
   4:	0001                	.insn	2, 0x0001
   6:	0001                	.insn	2, 0x0001

Which is caused by the definiation of $x was conflict with the psABI.
2025-03-03 11:25:43 +08:00
Charlie Jenkins
227a52fbbd RISC-V: Fix abort when displaying data and partial instructions
If data is encountered that is not a power of two, dump all of the data with
a .<N>byte directive.  The current largest support risc-v instruction length
is 22, so the data over 22 bytes will be displayed by,
.insn, 22, ... + .<N-22>byte.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
2025-02-26 23:12:17 +08:00
Maximilian Ciric
0e92c0ded9 MIPS objdump: Recognize o64 ABI names
Add gpr and fpr names for the o64 ABI to objdump.

With the recent addition of both EABIs, this completes support for the
standard ABI options (ABI-breaking options such as -modd-spreg or
-mabi=32 -mfp64 notwithstanding). The names have been verified against
GCC's usage of the registers. Notably, the only(?) documentation that
defines the o64 ABI at

https://gcc.gnu.org/projects/mipso64-abi.html

appears to contain a mistake w.r.t. floating-point arguments. In
particular:

> If the first and second arguments floating-point arguments to a
> function are 32-bit values, they are passed in $f12 and $f14.

As from 4.0.0 this does not happen in GCC's implementation of the ABI;
a pair of single-float arguments are still passed in $f12 and $f13, the
same as when one or both of the arguments are double-precision floats.
The registers $f12, $f13 and $f14 have been named $fa0, $fa1 and $ft10
to match the implementation.

Signed-off-by: Maximilian Ciric <max.ciric@gmail.com>
2025-02-22 20:57:15 +00:00
Alan Modra
3a69ff93b5 riscv disassembler leak
Commit 3f61a38b5e moved the disassembler subset_list from a static
variable to disassembler private_data.  It is now malloc'd in
riscv_init_disasm_info so should be freed when disassemble_free_target
runs.

	* riscv-dis.c (disassemble_free_riscv): Free subset_list.
2025-02-16 08:43:10 +10:30
Anghelo Carvajal
caaa18f212 MIPS objdump: Add eabi32 and eabi64 ABI options
Extend gpr and fpr register names with names suitable for both EABIs.

Heavily inspired by the EABI documenation written by Eric Christopher,
which can be read at
https://sourceware.org/legacy-ml/binutils/2003-06/msg00436.html

2025-02-15  Anghelo Carvajal  <angheloalf95@gmail.com>

	* mips-dis.c (mips_fpr_names_eabi32): New variable.
	(mips_fpr_names_eabi64): New variable.
	(mips_abi_choices): Add "eabi32" and "eabi64" options.

Signed-off-by: Anghelo Carvajal <angheloalf95@gmail.com>
2025-02-15 01:30:58 +00:00
Hau Hsu
052d07f84b RISC-V: Make SSAMOSWAP.W available for rv64
Previously we limited SSAMOSWAP.W only available on RV32, but it should
be available on RV64 as well.

See
https://github.com/riscv/riscv-cfi/blob/main/src/cfi_backward.adoc
702a3e6e84/src/unpriv-cfi.adoc (L789)
2025-02-14 10:56:57 +08:00
Nelson Chu
3f61a38b5e RISC-V: Move all global static target stuff into private data for disassembler.
I got a request said that the JDK multi-thread compiler may be broken
if two or more threads are trying to print/disassemble stuff, and filling
the disassemble_info, setting callbacks, and grabbing the function pointer
to disasm at the same time.  Since such as the target global static stuff,
including subset of extensions and mapping symbol stuff, seems to only be
one globally.  Ideally, for dis-assembler, all global static target stuff
should/can be better to be defined into the target private data, since they
are target-dependency.

opcodes/
	* riscv-dis.c: Moved all global static target-dependency stuff into
	riscv_private_data, including architecture and mapping symbol stuff.
	(set_default_riscv_dis_options): Updated since global static target-
	dependency stuff are moved into riscv_private_data.
	(parse_riscv_dis_option_without_args): Likewise.
	(parse_riscv_dis_option): Likewise.
	(parse_riscv_dis_options): Likewise.
	(maybe_print_address): Likewise.
	(print_reg_list): Likewise.
	(riscv_get_spimm): Likewise.
	(print_insn_args): Likewise.
	(riscv_disassemble_insn): Likewise.
	(riscv_update_map_state): Likewise.
	(riscv_search_mapping_symbol): Likewise.
	(riscv_data_length): Likewise.
	(print_insn_riscv): Likewise.  Call the riscv_init_disasm_info before
	parsing any disassembler options, since the related stuff are moved
	into riscv_private_data.
	(riscv_init_disasm_info): Likewise.  Parse and set the architecture
	string and privileged spec version since riscv_get_disassembler is
	no longer needed.
	(riscv_get_disassembler): Removed.
	(disassemble_free_riscv): Only free the subset_list if
	riscv_private_data exsits.
	* disassemble.c (disassembler): Since riscv_get_disassembler is
	removed, call to print_insn_riscv.
	* disassemble.h: Removed extern riscv_get_disassembler.
2025-02-11 14:30:39 +08:00
MayShao-oc
a5626289a6 x86: Support x86 Zhaoxin PadLock XMODX instructions
The CPUID EDX bit[28] indicates its enablement, and it includes REP
XMODEXP and REP MONTMUL2. XMODX stands for modular exponentiation, it indicates
the support of modular exponentiation feature, both REP XMODEXP and
REP MONTMUL2 use it.

gas/ChangeLog:

	* NEWS: Support Zhaoxin PadLock XMODX instructions.
	* config/tc-i386.c (add_branch_prefix_frag_p): Don't add prefix to
	PadLockXMODX instructions.
	(output_insn): Handle PadLockXMODX instructions.
	* doc/c-i386.texi: Document PadLockXMODX.
	* testsuite/gas/i386/i386.exp: Add PadLockXMODX test.
	* testsuite/gas/i386/padlockxmodx.d: Ditto.
	* testsuite/gas/i386/padlockxmodx.s: Ditto.

opcodes/ChangeLog:

	* i386-dis.c: Add PadLockXMODX.
	* i386-gen.c: Ditto
	* i386-opc.h (CpuPadLockXMODX): New.
	* i386-opc.tbl: Add Zhaoxin PadLock XMODX instructions.
	* i386-tbl.h: Regenerated.
	* i386-mnem.h: Ditto.
	* i386-init.h: Ditto.
2025-02-07 10:31:42 +01:00
Yury Khrustalev
557daf57ca aarch64: Add leading zeros to opcodes in aarch64-tbl.h
Opcodes and bitmasks are 32-bit numbers and omitting leading
zeros might be interpreted as if they are 28-bit.
2025-02-05 14:14:29 +00:00
Yury Khrustalev
a868854dcf aarch64: Clean up whitespace in aarch64-tbl.h
Clean up whitespace for conforming to GNU coding standards
2025-02-05 14:14:29 +00:00
Andrew Carlotti
99b90c4611 aarch64: Fix fp8 feature dependencies
We agreed with LLVM that we shouldn't enforce the architectural
dependencies between fp8 muliplication features, so remove them.

Additionally, fix a typo in the gating for FEAT_SME_F8F16 instructions,
which were mistakenly gated by +sme-f8f32 instead.  Until now this
mistake had been masked by the dependency between the features.
2025-01-31 15:16:44 +00:00
Jan Beulich
b2d844097b x86/APX: GETSEC cannot be used with REX2
It lives in a "forbidden" row, yet its disassembler table entry was
lacking a respective marker.
2025-01-31 10:07:32 +01:00
Jan Beulich
d188bb12f7 x86: support RMPREAD insn
Like for RMPUPDATE documentation is about to change as far as operands
are concerned. They're merely the other way around here.

While adjustind gas documentation, also add the missing RMPQUERY
counterparts there.
2025-01-31 10:06:02 +01:00
Jan Beulich
4612bba098 x86: RMPUPDATE wants operands in different form
AMD are about to update their doc, to help clarify that what we
currently do isn't quite right: In particular it is not %rax but %rcx
which is affected by address size. In fact, that's a normal memory
operand, just not expressed via ModR/M byte, but fixed to (%rcx) (or
(%ecx) with 32-bit addressing).

To support this in the assembler, generalize memory operand handling so
far specific to XLAT (which isn't really a string insn, but requires its
memory operand to be (%bx) / (%ebx) / (%rbx)).

In the disassembler mimic handling after XLAT's, too.
2025-01-31 10:05:36 +01:00
Jan Beulich
36fa5275c1 x86-64: omit "default" segment prefixes from string insn disassembly
Printing implicit %ds: and %es: prefixes is pretty meaningless in 64-bit
mode. The SDM explicitly omits them for the 64-bit forms, and it
obviously has them for the other ones only to cover non-64-bit modes
(oddly enough the AMD PM has them present).
2025-01-31 10:04:45 +01:00
Michael J. Eager
26b751e4c4 MicroBlaze: Widen mask used in opcodes/microblaze-dis,c
Instead of using 0xFFFF0000, or with (~0xFFFF) to sign extend
negative 16-bit value and with (~0xFFFF) to extract higher order
address bits

opcodes/
	* microblaze-dis.c: (print_insn_microblaze): Widen mask
	(microblaze_get_target_address): Likewis

Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
Signed-off-by: Michael J. Eager <eager@eagercon.com>
2025-01-27 12:01:20 -08:00
Jens Remus
e99d28e6bd s390: Do not omit vector index register 0 in disassembly
Vector index registers are currently only used in the VRV instruction
format.  Unlike general purpose index registers an operand value of
zero (e.g. %v0, 0, or omitted) does not imply a zero value:

"For VRV format instructions, a vector element is used in the formation
of the intermediate value.  This vector element is an unsigned binary
integer value that is added to the base address and 12-bit displacement
to form a 64-bit intermediate sum.  The vector element is designated by
a vector register and an element index.  A zero V field accesses the
element in vector register zero and does not imply a zero value." [1]

Therefore do not omit vector index register 0 in disassembly, that is
disassemble D(VX,B) with VX=0 as D(VX,B) instead of D(B).  Also do not
disassemble index register 0 as "0", that is disassemble D(VX,B) with
VX=0 as D(%v0,B) instead of D(0,B).  Note that a base register 0 still
still gets disassembled as "0", that is D(VX,B) with B=0 disassembles
into D(VX,0).

[1]: IBM z/Architecture Principles of Operation, SA22-7832-13, IBM z16,
     https://publibfp.dhe.ibm.com/epubs/pdf/a227832d.pdf

opcodes/
	* s390-dis.c (s390_print_insn_with_opcode): Do not omit vector
	index register 0 in disassembly.  Disassemble it as %v0.

gas/testsuite/
	* gas/s390/zarch-base-index-0.d (vgef): Expect vector index
	register 0 in disassembly.
	* gas/s390/zarch-omitted-base-index.d (vgef): Likewise.

Suggested-by: Florian Krohm <flo2030@eich-krohm.de>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-01-27 16:48:58 +01:00
Surya Kumari Jangala
0c1b7977c9 PowerPC: Add support for RFC02657 - AES acceleration instructions
opcodes/
	* ppc-opc.c (insert_m2, extract_m2): New functions.
	(AESM, PGF1, XX2M, XX3M, XX3GF, XX2AES_MASK, XX2AESM_MASK,
	XX3AES_MASK, XX3AESM_MASK, XX3GF_MASK): New macros.
	(UIM): Update for new macros.
	(powerpc_opcodes): Add xxaes128encp, xxaes192encp, xxaes256encp,
	xxaesencp, xxaes128decp, xxaes192decp, xxaes256decp, xxaesdecp,
	xxaes128genlkp, xxaes192genlkp, xxaes256genlkp, xxaesgenlkp,
	xxgfmul128gcm, xxgfmul128xts, xxgfmul128.

gas/
	* testsuite/gas/ppc/future.s: New test.
	* testsuite/gas/ppc/future.d: Likewise.
2025-01-23 06:10:43 -05:00
Nick Clifton
8ae7da3ae8
Update translations for various sub-directories 2025-01-20 16:19:22 +00:00
Nick Clifton
8c7653ab09
Change version to 2.44.50 and regenerate files 2025-01-19 12:40:46 +00:00
Nick Clifton
b49d12e2c5
Add markers for bihnutils 2.44 branch 2025-01-19 12:09:01 +00:00