mumbel / ghidra_we Goto Github PK
View Code? Open in Web Editor NEWGhidra we32k processor module
License: Apache License 2.0
Ghidra we32k processor module
License: Apache License 2.0
With the current WE.sinc
file, I'm seeing the following exception during analysis phase.
To reproduce, load the COFF file https://archives.loomcom.com/3b2/scsi/scsi-we32k-driver. I am using the latest Ghidra from my we-coff
branch (https://github.com/sethm/ghidra/).
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Bit length must be >= 1 and <= 64
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at generic.concurrent.QResult.<init>(QResult.java:40)
at generic.concurrent.FutureTaskMonitor.run(FutureTaskMonitor.java:78)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.IllegalArgumentException: Bit length must be >= 1 and <= 64
at ghidra.program.model.scalar.Scalar.<init>(Scalar.java:62)
at ghidra.program.util.VarnodeContext.extendValue(VarnodeContext.java:1300)
at ghidra.program.util.SymbolicPropogator.applyPcode(SymbolicPropogator.java:1095)
at ghidra.program.util.SymbolicPropogator.flowConstants(SymbolicPropogator.java:495)
at ghidra.program.util.SymbolicPropogator.flowConstants(SymbolicPropogator.java:393)
at ghidra.program.util.SymbolicPropogator.flowConstants(SymbolicPropogator.java:191)
at ghidra.app.plugin.core.analysis.ConstantPropagationAnalyzer.flowConstants(ConstantPropagationAnalyzer.java:401)
at ghidra.app.plugin.core.analysis.ConstantPropagationAnalyzer.analyzeLocation(ConstantPropagationAnalyzer.java:381)
at ghidra.app.plugin.core.analysis.ConstantPropagationAnalyzer$1.process(ConstantPropagationAnalyzer.java:274)
at ghidra.app.plugin.core.analysis.ConstantPropagationAnalyzer$1.process(ConstantPropagationAnalyzer.java:1)
at generic.concurrent.ConcurrentQ$CallbackCallable.call(ConcurrentQ.java:658)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at generic.concurrent.FutureTaskMonitor.run(FutureTaskMonitor.java:76)
... 3 more
ERROR Analyzer Error: Analysis Task: Stack - Bit length must be >= 1 and <= 64 java.lang.IllegalArgumentException: Bit length must be >= 1 and <= 64
at ghidra.program.model.scalar.Scalar.<init>(Scalar.java:62)
at ghidra.program.util.VarnodeContext.extendValue(VarnodeContext.java:1300)
at ghidra.program.util.SymbolicPropogator.applyPcode(SymbolicPropogator.java:1095)
at ghidra.program.util.SymbolicPropogator.flowConstants(SymbolicPropogator.java:495)
at ghidra.program.util.SymbolicPropogator.flowConstants(SymbolicPropogator.java:393)
at ghidra.program.util.SymbolicPropogator.flowConstants(SymbolicPropogator.java:191)
at ghidra.app.cmd.function.NewFunctionStackAnalysisCmd.createStackPointerVariables(NewFunctionStackAnalysisCmd.java:340)
at ghidra.app.cmd.function.NewFunctionStackAnalysisCmd.analyzeFunction(NewFunctionStackAnalysisCmd.java:191)
at ghidra.app.cmd.function.NewFunctionStackAnalysisCmd.applyTo(NewFunctionStackAnalysisCmd.java:118)
at ghidra.app.plugin.core.function.StackVariableAnalyzer.added(StackVariableAnalyzer.java:54)
at ghidra.app.plugin.core.analysis.AnalysisScheduler.runAnalyzer(AnalysisScheduler.java:190)
at ghidra.app.plugin.core.analysis.AnalysisTask.applyTo(AnalysisTask.java:39)
at ghidra.app.plugin.core.analysis.AutoAnalysisManager$AnalysisTaskWrapper.run(AutoAnalysisManager.java:685)
at ghidra.app.plugin.core.analysis.AutoAnalysisManager.startAnalysis(AutoAnalysisManager.java:785)
at ghidra.app.plugin.core.analysis.AutoAnalysisManager.startAnalysis(AutoAnalysisManager.java:664)
at ghidra.app.plugin.core.analysis.AutoAnalysisManager.startAnalysis(AutoAnalysisManager.java:629)
at ghidra.app.plugin.core.analysis.AnalysisBackgroundCommand.applyTo(AnalysisBackgroundCommand.java:58)
at ghidra.framework.plugintool.mgr.BackgroundCommandTask.run(BackgroundCommandTask.java:101)
at ghidra.framework.plugintool.mgr.ToolTaskManager.run(ToolTaskManager.java:315)
at java.base/java.lang.Thread.run(Thread.java:835)
@sethm came across a twitter post, hadn't every heard of this processor and it looked semi-interesting. I hadn't implemented a variable length instruction set in sleigh yet, so I gave it a go today since it didn't look too large of an ISA. Lots of stuff is still wrong, but the larger parts are mostly done or coming together. The bigger items are cleaning up addrmode
tables and the cspec and pspec files. I don't think I'll get much further since I'll probably not get too familiar with the processor, but if you have any issues I could probably take a look if you're interested in this. Also PRs are welcome, or I can just add you as a contributor.
addrmode
may need reworking/refactoring, though may be working for the most part.
The most noticeable issue right now is exaddrmode
which handles the expanded operand mode.
87 73 e2 40 MOVB 0x3(%ap),{uhalf}%r0
$Ue80:4 = INT_ZEXT r0:2
$Uea0:4 = COPY $Ue80
$Uce0:4 = COPY 3:4
$Uce0:4 = INT_ADD $Uce0, ap
$Ud00:1 = LOAD ram($Uce0)
$Uea0:4 = INT_ZEXT $Ud00
...
This should be writing a zext uhalf value to r0 at some point, but currently is just writing to the varnode for the value in {uhalf}r0
maybe addrmode should be split into addrmode_src and addrmode_dst to begin with, but still not sure how to solve this non-write.
There are three processors in the WE32K family:
There are subtle distinctions between the WE32000 and WE32100, but much bigger changes between the WE32100 and WE32200. For explicitness, we may want to consider renaming the "WE" processor to "WE32100", since that's the current implementation. Then, when we have that working, we can add a "WE32200" alongside it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.