-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: support for C-Sky architecture.
- Loading branch information
Showing
23 changed files
with
6,337 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="$(ProjectDir)../../Drivers/CommonBuildProperties.items" /> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<AssemblyName>Reko.Arch.CSky</AssemblyName> | ||
<RootNamespace>Reko.Arch.CSky</RootNamespace> | ||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> | ||
<Configurations>Debug;Release</Configurations> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Core\Core.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
#region License | ||
/* | ||
* Copyright (C) 1999-2024 John Källén. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2, or (at your option) | ||
* any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; see the file COPYING. If not, write to | ||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
*/ | ||
#endregion | ||
|
||
using Reko.Core; | ||
using Reko.Core.Expressions; | ||
using Reko.Core.Machine; | ||
using Reko.Core.Memory; | ||
using Reko.Core.Rtl; | ||
using Reko.Core.Types; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Reko.Arch.CSky | ||
{ | ||
public class CSkyArchitecture : ProcessorArchitecture | ||
{ | ||
/// <summary> | ||
/// Implements the C-Sky architecture. | ||
/// </summary> | ||
/// <param name="services"></param> | ||
/// <param name="options"></param> | ||
/// <remarks>Implemented by the CK810 device.</remarks> | ||
public CSkyArchitecture(IServiceProvider services, Dictionary<string, object> options) | ||
: base(services, "csky", options, Registers.ByName, Registers.ByDomain) | ||
{ | ||
this.CarryFlag = Registers.C; | ||
this.Endianness = EndianServices.Little; | ||
this.FramePointerType = PrimitiveType.Ptr32; | ||
this.InstructionBitSize = 16; | ||
this.CodeMemoryGranularity = 8; | ||
this.MemoryGranularity = 8; | ||
this.PointerType = PrimitiveType.Ptr32; | ||
this.StackRegister = Registers.GpRegs[14]; | ||
this.LinkRegister = Registers.GpRegs[15]; | ||
this.WordWidth = PrimitiveType.Word32; | ||
} | ||
|
||
public RegisterStorage LinkRegister { get; } | ||
|
||
public override IEnumerable<MachineInstruction> CreateDisassembler(EndianImageReader imageReader) | ||
{ | ||
return new CSkyDisassembler(this, imageReader); | ||
} | ||
|
||
public override IEqualityComparer<MachineInstruction>? CreateInstructionComparer(Normalize norm) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override IEnumerable<Address> CreatePointerScanner(SegmentMap map, EndianImageReader rdr, IEnumerable<Address> knownAddresses, PointerScannerFlags flags) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override ProcessorState CreateProcessorState() | ||
{ | ||
return new DefaultProcessorState(this); | ||
} | ||
|
||
public override IEnumerable<RtlInstructionCluster> CreateRewriter(EndianImageReader rdr, ProcessorState state, IStorageBinder binder, IRewriterHost host) | ||
{ | ||
return new CSkyRewriter(this, rdr, state, binder, host); | ||
} | ||
|
||
public override FlagGroupStorage? GetFlagGroup(RegisterStorage flagRegister, uint grf) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override FlagGroupStorage? GetFlagGroup(string name) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override SortedList<string, int> GetMnemonicNames() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override int? GetMnemonicNumber(string name) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override RegisterStorage[] GetRegisters() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override string GrfToString(RegisterStorage flagRegister, string prefix, uint grf) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Address MakeAddressFromConstant(Constant c, bool codeAlign) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Address? ReadCodeAddress(int size, EndianImageReader rdr, ProcessorState? state) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override bool TryParseAddress(string? txtAddr, [MaybeNullWhen(false)] out Address addr) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
Oops, something went wrong.