53 lines
919 B
C
53 lines
919 B
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <sys/user.h>
|
|
|
|
#define INSTRUCTION_COUNT 5
|
|
|
|
enum instruction {
|
|
INST_NOP = 0x00,
|
|
INST_EXIT = 0x01,
|
|
INST_LOAD = 0x02,
|
|
|
|
INST_SHOW = 0x10,
|
|
INST_INFO = 0x11,
|
|
|
|
INST_BREAK = 0x20,
|
|
INST_DELETE = 0x21,
|
|
INST_PATCH = 0x22,
|
|
|
|
INST_SI = 0x30,
|
|
INST_CONT = 0x31,
|
|
INST_SYSCALL = 0x32,
|
|
|
|
INST_INVALID = 0xff,
|
|
};
|
|
|
|
void sync_regs(void);
|
|
uint8_t poke(uint64_t addr, uint8_t data);
|
|
|
|
void run(const char *filename);
|
|
void disassemble();
|
|
|
|
void inst_load(char **filename);
|
|
void inst_si(void);
|
|
void inst_cont(void);
|
|
void inst_info(void);
|
|
void inst_info_reg(void);
|
|
void inst_info_break(void);
|
|
void inst_break(void);
|
|
void inst_delete(void);
|
|
void inst_patch(void);
|
|
void inst_syscall(void);
|
|
|
|
extern int child;
|
|
extern int status;
|
|
|
|
extern struct user_regs_struct regs;
|
|
extern uint64_t disassemble_addr;
|
|
|
|
extern long syscall_nr;
|