Skip to content

Instantly share code, notes, and snippets.

@rbran
Created April 17, 2024 12:34
Show Gist options
  • Save rbran/b67e4e42654738b7c0eb078e9a49c656 to your computer and use it in GitHub Desktop.
Save rbran/b67e4e42654738b7c0eb078e9a49c656 to your computer and use it in GitHub Desktop.
pub struct Architecture {
pub name: String,
}
#[derive(Clone, Copy)]
pub struct RegisterInfo;
#[derive(Clone, Copy, Hash, PartialEq, Eq)]
pub struct Register;
#[derive(Clone, Copy)]
pub struct RegisterStackInfo;
#[derive(Clone, Copy)]
pub struct RegisterStack;
#[derive(Clone, Copy, Hash, PartialEq, Eq)]
pub struct Flag;
#[derive(Clone, Copy)]
pub struct FlagWrite;
#[derive(Clone, Copy, Hash, PartialEq, Eq)]
pub struct FlagClass;
#[derive(Clone, Copy)]
pub struct FlagGroup;
#[derive(Clone, Copy)]
pub struct Intrinsic;
impl AsRef<binaryninja::architecture::CoreArchitecture> for Architecture {
fn as_ref(&self) -> &binaryninja::architecture::CoreArchitecture {
todo!()
}
}
impl binaryninja::architecture::RegisterInfo for RegisterInfo {
type RegType = Register;
fn parent(&self) -> Option<Self::RegType> {
todo!()
}
fn size(&self) -> usize {
todo!()
}
fn offset(&self) -> usize {
todo!()
}
fn implicit_extend(&self) -> binaryninja::architecture::ImplicitRegisterExtend {
todo!()
}
}
impl binaryninja::architecture::Register for Register {
type InfoType = RegisterInfo;
fn name(&self) -> std::borrow::Cow<str> {
todo!()
}
fn info(&self) -> Self::InfoType {
todo!()
}
fn id(&self) -> u32 {
todo!()
}
}
impl binaryninja::architecture::RegisterStackInfo for RegisterStackInfo {
type RegStackType = RegisterStack;
type RegType = Register;
type RegInfoType = RegisterInfo;
fn storage_regs(&self) -> (Self::RegType, u32) {
todo!()
}
fn top_relative_regs(&self) -> Option<(Self::RegType, u32)> {
todo!()
}
fn stack_top_reg(&self) -> Self::RegType {
todo!()
}
}
impl binaryninja::architecture::RegisterStack for RegisterStack {
type InfoType = RegisterStackInfo;
type RegType = Register;
type RegInfoType = RegisterInfo;
fn name(&self) -> std::borrow::Cow<str> {
todo!()
}
fn info(&self) -> Self::InfoType {
todo!()
}
fn id(&self) -> u32 {
todo!()
}
}
impl binaryninja::architecture::Flag for Flag {
type FlagClass = FlagClass;
fn name(&self) -> std::borrow::Cow<str> {
todo!()
}
fn role(&self, _class: Option<Self::FlagClass>) -> binaryninja::architecture::FlagRole {
todo!()
}
fn id(&self) -> u32 {
todo!()
}
}
impl binaryninja::architecture::FlagWrite for FlagWrite {
type FlagType = Flag;
type FlagClass = FlagClass;
fn name(&self) -> std::borrow::Cow<str> {
todo!()
}
fn class(&self) -> Option<Self::FlagClass> {
todo!()
}
fn id(&self) -> u32 {
todo!()
}
fn flags_written(&self) -> Vec<Self::FlagType> {
todo!()
}
}
impl binaryninja::architecture::FlagClass for FlagClass {
fn name(&self) -> std::borrow::Cow<str> {
todo!()
}
fn id(&self) -> u32 {
todo!()
}
}
impl binaryninja::architecture::FlagGroup for FlagGroup {
type FlagType = Flag;
type FlagClass = FlagClass;
fn name(&self) -> std::borrow::Cow<str> {
todo!()
}
fn id(&self) -> u32 {
todo!()
}
fn flags_required(&self) -> Vec<Self::FlagType> {
todo!()
}
fn flag_conditions(&self) -> std::collections::HashMap<Self::FlagClass, binaryninja::architecture::FlagCondition> {
todo!()
}
}
impl binaryninja::architecture::Intrinsic for Intrinsic {
fn name(&self) -> std::borrow::Cow<str> {
todo!()
}
fn id(&self) -> u32 {
todo!()
}
fn inputs(&self) -> Vec<binaryninja::types::NameAndType<String>> {
todo!()
}
fn outputs(&self) -> Vec<binaryninja::types::Conf<binaryninja::rc::Ref<binaryninja::types::Type>>> {
todo!()
}
}
impl binaryninja::architecture::Architecture for Architecture {
type Handle = binaryninja::architecture::CustomArchitectureHandle<Architecture>;
type RegisterInfo = RegisterInfo;
type Register = Register;
type RegisterStackInfo = RegisterStackInfo;
type RegisterStack = RegisterStack;
type Flag = Flag;
type FlagWrite = FlagWrite;
type FlagClass = FlagClass;
type FlagGroup = FlagGroup;
type Intrinsic = Intrinsic;
fn endianness(&self) -> binaryninja::Endianness {
todo!()
}
fn address_size(&self) -> usize {
todo!()
}
fn default_integer_size(&self) -> usize {
todo!()
}
fn instruction_alignment(&self) -> usize {
todo!()
}
fn max_instr_len(&self) -> usize {
todo!()
}
fn opcode_display_len(&self) -> usize {
todo!()
}
fn associated_arch_by_addr(
&self,
_addr: &mut u64,
) -> binaryninja::architecture::CoreArchitecture {
todo!()
}
fn instruction_info(
&self,
_data: &[u8],
_addr: u64,
) -> Option<binaryninja::architecture::InstructionInfo> {
todo!()
}
fn instruction_text(
&self,
_data: &[u8],
_addr: u64,
) -> Option<(usize, Vec<binaryninja::disassembly::InstructionTextToken>)> {
todo!()
}
fn instruction_llil(
&self,
_data: &[u8],
_addr: u64,
_il: &mut binaryninja::llil::Lifter<Self>,
) -> Option<(usize, bool)> {
todo!()
}
fn registers_all(&self) -> Vec<Self::Register> {
todo!()
}
fn registers_full_width(&self) -> Vec<Self::Register> {
todo!()
}
fn stack_pointer_reg(&self) -> Option<Self::Register> {
todo!()
}
fn register_from_id(&self, _id: u32) -> Option<Self::Register> {
todo!()
}
fn handle(&self) -> Self::Handle {
todo!()
}
}
fn main() {
binaryninja::headless::init();
binaryninja::architecture::register_architecture("FakeArch", |_handle, _core| Architecture {
name: "Test".to_owned(),
});
binaryninja::headless::shutdown();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment