Skip to content

54 s390 add s390s390x parser #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
538 changes: 538 additions & 0 deletions B2R2.sln

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/FrontEnd/API/B2R2.FrontEnd.API.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<ProjectReference Include="..\PPC32\B2R2.FrontEnd.PPC32.fsproj" />
<ProjectReference Include="..\RISCV64\B2R2.FrontEnd.RISCV64.fsproj" />
<ProjectReference Include="..\CIL\B2R2.FrontEnd.CIL.fsproj" />
<ProjectReference Include="..\S390\B2R2.FrontEnd.S390.fsproj" />
<ProjectReference Include="..\SH4\B2R2.FrontEnd.SH4.fsproj" />
<ProjectReference Include="..\SPARC\B2R2.FrontEnd.SPARC.fsproj" />
<ProjectReference Include="..\TMS320C6000\B2R2.FrontEnd.TMS320C6000.fsproj" />
Expand Down
7 changes: 7 additions & 0 deletions src/FrontEnd/API/GroundWork.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ type GroundWork =
PPC32.PPC32TranslationContext isa :> TranslationContext
| Architecture.RISCV64 ->
RISCV64.RISCV64TranslationContext isa :> TranslationContext
| Architecture.S390 | Architecture.S390X ->
S390.S390TranslationContext isa :> TranslationContext
| Architecture.SH4 ->
SH4.SH4TranslationContext isa :> TranslationContext
| Architecture.SPARC ->
Expand Down Expand Up @@ -87,6 +89,9 @@ type GroundWork =
RISCV64.RISCV64RegisterFactory
(isa.WordSize, RISCV64.RegExprs isa.WordSize)
:> RegisterFactory
| Architecture.S390 | Architecture.S390X ->
S390.S39064RegisterFactory
(isa.WordSize, S390.RegExprs isa.WordSize)
| Architecture.SH4 ->
SH4.SH4RegisterFactory (SH4.RegExprs isa.WordSize)
:> RegisterFactory
Expand Down Expand Up @@ -119,6 +124,8 @@ type GroundWork =
CIL.CILParser () :> IInstructionParsable
| Architecture.AVR ->
AVR.AVRParser () :> IInstructionParsable
| Architecture.S390 | Architecture.S390X ->
S390.S39064Parser (isa) :> IInstructionParsable
| Architecture.SH4 ->
SH4.SH4Parser (isa) :> IInstructionParsable
| Architecture.PPC32 ->
Expand Down
1 change: 1 addition & 0 deletions src/FrontEnd/BinFile/ELF/ELFHeader.fs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ module internal Header =
| 0xb7s -> Architecture.AARCH64
| 0x08s | 0x0as -> getMIPSArch span reader cls
| 0x53s -> Architecture.AVR
| 0x16s -> Architecture.S390
| 0x2as -> Architecture.SH4
| 0x14s -> Architecture.PPC32
| 0x2bs -> Architecture.SPARC
Expand Down
26 changes: 26 additions & 0 deletions src/FrontEnd/BinFile/ELF/ELFRelocationInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,28 @@ type RelocationMIPS =
/// 32-bit PC-relative.
| R_MIPS_PC32 = 248UL

/// Relocation type for S390.
type RelocationS390 =
| R_S390_NONE = 0UL
| R_390_8 = 1UL
| R_390_12 = 2UL
| R_390_16 = 3UL
| R_390_32 = 4UL
| R_390_PC32 = 5UL
| R_390_GOT12 = 6UL
| R_390_GOT32 = 7UL
| R_390_PLT32 = 8UL
| R_390_COPY = 9UL
| R_390_GLOB_DAT = 10UL
| R_390_JMP_SLOT = 11UL
| R_390_RELATIVE = 12UL
| R_390_GOTOFF = 13UL
| R_390_GOTPC = 14UL
| R_390_GOT16 = 15UL
| R_390_PC16 = 16UL
| R_390_PC16DBL = 17UL
| R_390_PLT16DBL = 18UL

/// Relocation type for SH4.
type RelocationSH4 =
| R_SH_NONE = 0UL
Expand Down Expand Up @@ -651,6 +673,7 @@ type RelocationType =
| RelocationARMv7 of RelocationARMv7
| RelocationARMv8 of RelocationARMv8
| RelocationMIPS of RelocationMIPS
| RelocationS390 of RelocationS390
| RelocationSH4 of RelocationSH4
| RelocationRISCV of RelocationRISCV
| RelocationPPC32 of RelocationPPC32
Expand All @@ -670,6 +693,8 @@ with
| Architecture.MIPS32
| Architecture.MIPS64 ->
RelocationMIPS <| LanguagePrimitives.EnumOfValue n
| Architecture.S390 | Architecture.S390X ->
RelocationS390 <| LanguagePrimitives.EnumOfValue n
| Architecture.SH4 ->
RelocationSH4 <| LanguagePrimitives.EnumOfValue n
| Architecture.RISCV64 ->
Expand All @@ -687,6 +712,7 @@ with
| RelocationARMv7 t -> t.ToString ()
| RelocationARMv8 t -> t.ToString ()
| RelocationMIPS t -> t.ToString ()
| RelocationS390 t -> t.ToString()
| RelocationSH4 t -> t.ToString ()
| RelocationRISCV t -> t.ToString ()
| RelocationPPC32 t -> t.ToString ()
Expand Down
298 changes: 298 additions & 0 deletions src/FrontEnd/FrontEnd.sln

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/FrontEnd/Registers/B2R2.FrontEnd.Registers.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compile Include="PARISC.fs" />
<Compile Include="PPC32.fs" />
<Compile Include="RISCV64.fs" />
<Compile Include="S390.fs" />
<Compile Include="SH4.fs" />
<Compile Include="SPARC.fs" />
<Compile Include="TMS320C6000.fs" />
Expand Down
Loading