Skip to content
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

[WIP] RzIL lifting for SPARC #4521

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
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
39 changes: 39 additions & 0 deletions librz/arch/isa/sparc/sparc_il.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-FileCopyrightText: 2024 Dhruv Maroo <[email protected]>
// SPDX-License-Identifier: LGPL-3.0-only

#ifndef SPARC_IL_H
#define SPARC_IL_H

/**
* \file This is the include file for using the SPARC RzIL lifter.
*
*
* References used:
* - https://www.cs.utexas.edu/users/novak/sparcv9.pdf
*/

#include <rz_lib.h>
#include <rz_analysis.h>

/* Here we don't interop with GNU because the GNU disassembler does not expose
* the instructions and the registers nicely. We only interface with Capstone. */
#include <capstone/capstone.h>
#include <capstone/sparc.h>

#define BITS_PER_BYTE 8

typedef sparc_reg SparcReg;
typedef cs_sparc_op SparcOp;
typedef cs_sparc SparcIns;
typedef sparc_insn SparcInsMnem;

typedef struct sparc_il_instruction_t {
const SparcIns *structure; ///< Capstone instruction data
SparcInsMnem mnem; ///< Instruction mnemonic (enum)
ut8 ins_size; ///< Size of instruction (in bytes)
} SparcILIns;

RZ_IPI bool rz_sparc_il_opcode(RZ_NONNULL RzAnalysis *analysis, RZ_NONNULL RzAnalysisOp *aop, ut64 pc, RZ_BORROW RZ_NONNULL const SparcILIns *ins);
RZ_IPI RzAnalysisILConfig *rz_sparc_il_config(RZ_NONNULL RzAnalysis *analysis);

#endif // SPARC_IL_H
Loading