Fail* directories reorganized, Code-cleanup (-> coding-style), Typos+comments fixed.
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1321 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
141
simulators/bochs/bx_debug/Makefile.in
Normal file
141
simulators/bochs/bx_debug/Makefile.in
Normal file
@ -0,0 +1,141 @@
|
||||
# Copyright (C) 2001 The Bochs Project
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library 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
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
|
||||
@SUFFIX_LINE@
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
top_builddir = ..
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@ @GUI_CFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXFLAGS = @CXXFLAGS@ @GUI_CXXFLAGS@
|
||||
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
# Definitely use flex. Use flex version >= 2.5.4
|
||||
# Flex version 2.5.2 was reported not to work
|
||||
LEX = flex
|
||||
YACC = yacc
|
||||
|
||||
|
||||
# ===========================================================
|
||||
# end of configurable options
|
||||
# ===========================================================
|
||||
|
||||
|
||||
BX_OBJS = \
|
||||
dbg_main.o \
|
||||
symbols.o \
|
||||
linux.o \
|
||||
|
||||
BX_PARSER_OBJS = \
|
||||
parser.o \
|
||||
lexer.o
|
||||
|
||||
BX_INCLUDES = debug.h
|
||||
|
||||
BX_INCDIRS = -I.. -I$(srcdir)/.. -I../@INSTRUMENT_DIR@ -I$(srcdir)/../@INSTRUMENT_DIR@ -I. -I$(srcdir)/.
|
||||
|
||||
all: libdebug.a
|
||||
|
||||
.@CPP_SUFFIX@.o:
|
||||
$(CXX) @DASH@c $(BX_INCDIRS) $(CXXFLAGS) @CXXFP@$< @OFP@$@
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) @DASH@c $(BX_INCDIRS) $(CFLAGS) @CFP@$< @OFP@$@
|
||||
|
||||
|
||||
|
||||
libdebug.a: $(BX_OBJS) $(BX_PARSER_OBJS)
|
||||
@RMCOMMAND@ libdebug.a
|
||||
@MAKELIB@ $(BX_OBJS) $(BX_PARSER_OBJS)
|
||||
$(RANLIB) libdebug.a
|
||||
|
||||
$(BX_OBJS): $(BX_INCLUDES)
|
||||
|
||||
|
||||
clean:
|
||||
@RMCOMMAND@ *.o
|
||||
@RMCOMMAND@ libdebug.a
|
||||
|
||||
dist-clean: clean
|
||||
@RMCOMMAND@ Makefile
|
||||
|
||||
parse-clean:
|
||||
@RMCOMMAND@ -f lexer.c
|
||||
@RMCOMMAND@ -f parser.c
|
||||
@RMCOMMAND@ -f parser.h
|
||||
|
||||
dbg_main.o: debug.h
|
||||
sim2.o: debug.h
|
||||
|
||||
parser.c: parser.y
|
||||
@/bin/rm -f y.tab.c parser.c
|
||||
@/bin/rm -f y.tab.h parser.h
|
||||
$(YACC) -p bx -d $<
|
||||
@/bin/mv -f y.tab.c parser.c
|
||||
@/bin/mv -f y.tab.h parser.h
|
||||
@echo '#endif /* if BX_DEBUGGER */' >> parser.c
|
||||
@echo '/* The #endif is appended by the makefile after running yacc. */' >> parser.c
|
||||
|
||||
lexer.c: lexer.l
|
||||
$(LEX) -Pbx -t $< > lexer.c
|
||||
|
||||
###########################################
|
||||
# dependencies generated by
|
||||
# gcc -MM -I. -I.. -I../instrument/stubs *.c *.cc | sed 's/\.cc/.@CPP_SUFFIX@/g'
|
||||
###########################################
|
||||
lexer.o: lexer.c debug.h ../config.h ../osdep.h
|
||||
parser.o: parser.c debug.h ../config.h ../osdep.h
|
||||
dbg_main.o: dbg_main.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
|
||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
||||
../instrument/stubs/instrument.h ../param_names.h ../cpu/cpu.h \
|
||||
../cpu/model_specific.h ../cpu/crregs.h ../cpu/descriptor.h \
|
||||
../cpu/instr.h ../cpu/ia_opcodes.h ../cpu/lazy_flags.h ../cpu/icache.h \
|
||||
../cpu/apic.h ../cpu/i387.h ../fpu/softfloat.h ../fpu/tag_w.h \
|
||||
../fpu/status_w.h ../fpu/control_w.h ../cpu/xmm.h ../iodev/iodev.h
|
||||
linux.o: linux.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h ../bx_debug/debug.h \
|
||||
../config.h ../osdep.h ../bxversion.h ../gui/siminterface.h \
|
||||
../gui/paramtree.h ../memory/memory.h ../pc_system.h ../plugin.h \
|
||||
../extplugin.h ../ltdl.h ../gui/gui.h ../instrument/stubs/instrument.h \
|
||||
../cpu/cpu.h ../cpu/model_specific.h ../cpu/crregs.h \
|
||||
../cpu/descriptor.h ../cpu/instr.h ../cpu/ia_opcodes.h \
|
||||
../cpu/lazy_flags.h ../cpu/icache.h ../cpu/apic.h ../cpu/i387.h \
|
||||
../fpu/softfloat.h ../fpu/tag_w.h ../fpu/status_w.h ../fpu/control_w.h \
|
||||
../cpu/xmm.h
|
||||
symbols.o: symbols.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
|
||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
||||
../instrument/stubs/instrument.h ../cpu/cpu.h ../cpu/model_specific.h \
|
||||
../cpu/crregs.h ../cpu/descriptor.h ../cpu/instr.h ../cpu/ia_opcodes.h \
|
||||
../cpu/lazy_flags.h ../cpu/icache.h ../cpu/apic.h ../cpu/i387.h \
|
||||
../fpu/softfloat.h ../fpu/tag_w.h ../fpu/status_w.h ../fpu/control_w.h \
|
||||
../cpu/xmm.h
|
||||
3884
simulators/bochs/bx_debug/dbg_main.cc
Normal file
3884
simulators/bochs/bx_debug/dbg_main.cc
Normal file
File diff suppressed because it is too large
Load Diff
507
simulators/bochs/bx_debug/debug.h
Normal file
507
simulators/bochs/bx_debug/debug.h
Normal file
@ -0,0 +1,507 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2009 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library 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
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
// if including from C parser, need basic types etc
|
||||
#include "config.h"
|
||||
#include "osdep.h"
|
||||
|
||||
#define BX_DBG_NO_HANDLE 1000
|
||||
|
||||
Bit32u crc32(const Bit8u *buf, int len);
|
||||
|
||||
#if BX_DEBUGGER
|
||||
|
||||
// some strict C declarations needed by the parser/lexer
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern Bit32u dbg_cpu;
|
||||
|
||||
void dbg_printf (const char *fmt, ...);
|
||||
|
||||
typedef enum {
|
||||
BX_DBG_SREG_ES,
|
||||
BX_DBG_SREG_CS,
|
||||
BX_DBG_SREG_SS,
|
||||
BX_DBG_SREG_DS,
|
||||
BX_DBG_SREG_FS,
|
||||
BX_DBG_SREG_GS
|
||||
} SRegs;
|
||||
|
||||
#if BX_SUPPORT_X86_64
|
||||
# define BX_DBG_GEN_REGISTERS 16
|
||||
#else
|
||||
# define BX_DBG_GEN_REGISTERS 8
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
BX_DBG_REG8H_AH,
|
||||
BX_DBG_REG8H_CH,
|
||||
BX_DBG_REG8H_DH,
|
||||
BX_DBG_REG8H_BH,
|
||||
} Regs8H;
|
||||
|
||||
#if BX_SUPPORT_X86_64
|
||||
|
||||
typedef enum {
|
||||
BX_DBG_REG8L_AL,
|
||||
BX_DBG_REG8L_CL,
|
||||
BX_DBG_REG8L_DL,
|
||||
BX_DBG_REG8L_BL,
|
||||
BX_DBG_REG8L_SPL,
|
||||
BX_DBG_REG8L_BPL,
|
||||
BX_DBG_REG8L_SIL,
|
||||
BX_DBG_REG8L_DIL,
|
||||
BX_DBG_REG8L_R8,
|
||||
BX_DBG_REG8L_R9,
|
||||
BX_DBG_REG8L_R10,
|
||||
BX_DBG_REG8L_R11,
|
||||
BX_DBG_REG8L_R12,
|
||||
BX_DBG_REG8L_R13,
|
||||
BX_DBG_REG8L_R14,
|
||||
BX_DBG_REG8L_R15
|
||||
} Regs8L;
|
||||
|
||||
typedef enum {
|
||||
BX_DBG_REG16_AX,
|
||||
BX_DBG_REG16_CX,
|
||||
BX_DBG_REG16_DX,
|
||||
BX_DBG_REG16_BX,
|
||||
BX_DBG_REG16_SP,
|
||||
BX_DBG_REG16_BP,
|
||||
BX_DBG_REG16_SI,
|
||||
BX_DBG_REG16_DI,
|
||||
BX_DBG_REG16_R8,
|
||||
BX_DBG_REG16_R9,
|
||||
BX_DBG_REG16_R10,
|
||||
BX_DBG_REG16_R11,
|
||||
BX_DBG_REG16_R12,
|
||||
BX_DBG_REG16_R13,
|
||||
BX_DBG_REG16_R14,
|
||||
BX_DBG_REG16_R15
|
||||
} Regs16;
|
||||
|
||||
typedef enum {
|
||||
BX_DBG_REG32_EAX,
|
||||
BX_DBG_REG32_ECX,
|
||||
BX_DBG_REG32_EDX,
|
||||
BX_DBG_REG32_EBX,
|
||||
BX_DBG_REG32_ESP,
|
||||
BX_DBG_REG32_EBP,
|
||||
BX_DBG_REG32_ESI,
|
||||
BX_DBG_REG32_EDI,
|
||||
BX_DBG_REG32_R8,
|
||||
BX_DBG_REG32_R9,
|
||||
BX_DBG_REG32_R10,
|
||||
BX_DBG_REG32_R11,
|
||||
BX_DBG_REG32_R12,
|
||||
BX_DBG_REG32_R13,
|
||||
BX_DBG_REG32_R14,
|
||||
BX_DBG_REG32_R15
|
||||
} Regs32;
|
||||
|
||||
typedef enum {
|
||||
BX_DBG_REG64_RAX,
|
||||
BX_DBG_REG64_RCX,
|
||||
BX_DBG_REG64_RDX,
|
||||
BX_DBG_REG64_RBX,
|
||||
BX_DBG_REG64_RSP,
|
||||
BX_DBG_REG64_RBP,
|
||||
BX_DBG_REG64_RSI,
|
||||
BX_DBG_REG64_RDI,
|
||||
BX_DBG_REG64_R8,
|
||||
BX_DBG_REG64_R9,
|
||||
BX_DBG_REG64_R10,
|
||||
BX_DBG_REG64_R11,
|
||||
BX_DBG_REG64_R12,
|
||||
BX_DBG_REG64_R13,
|
||||
BX_DBG_REG64_R14,
|
||||
BX_DBG_REG64_R15
|
||||
} Regs64;
|
||||
|
||||
#else
|
||||
|
||||
typedef enum {
|
||||
BX_DBG_REG8L_AL,
|
||||
BX_DBG_REG8L_CL,
|
||||
BX_DBG_REG8L_DL,
|
||||
BX_DBG_REG8L_BL
|
||||
} Regs8L;
|
||||
|
||||
typedef enum {
|
||||
BX_DBG_REG16_AX,
|
||||
BX_DBG_REG16_CX,
|
||||
BX_DBG_REG16_DX,
|
||||
BX_DBG_REG16_BX,
|
||||
BX_DBG_REG16_SP,
|
||||
BX_DBG_REG16_BP,
|
||||
BX_DBG_REG16_SI,
|
||||
BX_DBG_REG16_DI
|
||||
} Regs16;
|
||||
|
||||
typedef enum {
|
||||
BX_DBG_REG32_EAX,
|
||||
BX_DBG_REG32_ECX,
|
||||
BX_DBG_REG32_EDX,
|
||||
BX_DBG_REG32_EBX,
|
||||
BX_DBG_REG32_ESP,
|
||||
BX_DBG_REG32_EBP,
|
||||
BX_DBG_REG32_ESI,
|
||||
BX_DBG_REG32_EDI
|
||||
} Regs32;
|
||||
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
bkRegular,
|
||||
bkAtIP,
|
||||
bkStepOver
|
||||
} BreakpointKind;
|
||||
|
||||
typedef enum _show_flags {
|
||||
Flag_call = 0x1,
|
||||
Flag_ret = 0x2,
|
||||
Flag_softint = 0x4,
|
||||
Flag_iret = 0x8,
|
||||
Flag_intsig = 0x10,
|
||||
Flag_mode = 0x20
|
||||
} show_flags_t;
|
||||
|
||||
// Flex defs
|
||||
extern int bxlex(void);
|
||||
extern char *bxtext; // Using the pointer option rather than array
|
||||
extern int bxwrap(void);
|
||||
void bx_add_lex_input(char *buf);
|
||||
|
||||
// Yacc defs
|
||||
extern int bxparse(void);
|
||||
extern void bxerror(char *s);
|
||||
|
||||
#define EMPTY_ARG (-1)
|
||||
|
||||
bx_bool bx_dbg_read_linear(unsigned which_cpu, bx_address laddr, unsigned len, Bit8u *buf);
|
||||
Bit16u bx_dbg_get_selector_value(unsigned int seg_no);
|
||||
Bit16u bx_dbg_get_ip (void);
|
||||
Bit32u bx_dbg_get_eip(void);
|
||||
bx_address bx_dbg_get_instruction_pointer(void);
|
||||
Bit8u bx_dbg_get_reg8l_value(unsigned reg);
|
||||
Bit8u bx_dbg_get_reg8h_value(unsigned reg);
|
||||
Bit16u bx_dbg_get_reg16_value(unsigned reg);
|
||||
Bit32u bx_dbg_get_reg32_value(unsigned reg);
|
||||
Bit64u bx_dbg_get_reg64_value(unsigned reg);
|
||||
void bx_dbg_set_reg8l_value(unsigned reg, Bit8u value);
|
||||
void bx_dbg_set_reg8h_value(unsigned reg, Bit8u value);
|
||||
void bx_dbg_set_reg16_value(unsigned reg, Bit16u value);
|
||||
void bx_dbg_set_reg32_value(unsigned reg, Bit32u value);
|
||||
void bx_dbg_set_reg64_value(unsigned reg, Bit64u value);
|
||||
void bx_dbg_load_segreg(unsigned reg, unsigned value);
|
||||
bx_address bx_dbg_get_laddr(Bit16u sel, bx_address ofs);
|
||||
void bx_dbg_step_over_command(void);
|
||||
void bx_dbg_trace_command(bx_bool enable);
|
||||
void bx_dbg_trace_reg_command(bx_bool enable);
|
||||
void bx_dbg_trace_mem_command(bx_bool enable);
|
||||
void bx_dbg_ptime_command(void);
|
||||
void bx_dbg_timebp_command(bx_bool absolute, Bit64u time);
|
||||
#define MAX_CONCURRENT_BPS 5
|
||||
extern int timebp_timer;
|
||||
extern Bit64u timebp_queue[MAX_CONCURRENT_BPS];
|
||||
extern int timebp_queue_size;
|
||||
void bx_dbg_record_command(char*);
|
||||
void bx_dbg_playback_command(char*);
|
||||
void bx_dbg_modebp_command(void);
|
||||
void bx_dbg_where_command(void);
|
||||
void bx_dbg_print_string_command(bx_address addr);
|
||||
void bx_dbg_xlate_address(bx_lin_address address);
|
||||
void bx_dbg_show_command(const char*);
|
||||
void bx_dbg_print_stack_command(unsigned nwords);
|
||||
void bx_dbg_print_watchpoints(void);
|
||||
void bx_dbg_watchpoint_continue(bx_bool watch_continue);
|
||||
void bx_dbg_watch(int type, bx_phy_address address, Bit32u len);
|
||||
void bx_dbg_unwatch_all(void);
|
||||
void bx_dbg_unwatch(bx_phy_address handle);
|
||||
void bx_dbg_continue_command(void);
|
||||
void bx_dbg_stepN_command(int cpu, Bit32u count);
|
||||
void bx_dbg_set_auto_disassemble(bx_bool enable);
|
||||
void bx_dbg_disassemble_switch_mode(void);
|
||||
void bx_dbg_disassemble_hex_mode_switch(int mode);
|
||||
void bx_dbg_set_disassemble_size(unsigned size);
|
||||
void bx_dbg_del_breakpoint_command(unsigned handle);
|
||||
void bx_dbg_en_dis_breakpoint_command(unsigned handle, bx_bool enable);
|
||||
bx_bool bx_dbg_en_dis_pbreak(unsigned handle, bx_bool enable);
|
||||
bx_bool bx_dbg_en_dis_lbreak(unsigned handle, bx_bool enable);
|
||||
bx_bool bx_dbg_en_dis_vbreak(unsigned handle, bx_bool enable);
|
||||
bx_bool bx_dbg_del_pbreak(unsigned handle);
|
||||
bx_bool bx_dbg_del_lbreak(unsigned handle);
|
||||
bx_bool bx_dbg_del_vbreak(unsigned handle);
|
||||
int bx_dbg_vbreakpoint_command(BreakpointKind bk, Bit32u cs, bx_address eip);
|
||||
int bx_dbg_lbreakpoint_command(BreakpointKind bk, bx_address laddress);
|
||||
int bx_dbg_pbreakpoint_command(BreakpointKind bk, bx_phy_address paddress);
|
||||
void bx_dbg_info_bpoints_command(void);
|
||||
void bx_dbg_quit_command(void);
|
||||
#define BX_INFO_GENERAL_PURPOSE_REGS 1 /* bitmasks - choices for bx_dbg_info_registers_command */
|
||||
#define BX_INFO_FPU_REGS 2
|
||||
#define BX_INFO_MMX_REGS 4
|
||||
#define BX_INFO_SSE_REGS 8
|
||||
void bx_dbg_info_registers_command(int);
|
||||
void bx_dbg_info_ivt_command(unsigned from, unsigned to);
|
||||
void bx_dbg_info_idt_command(unsigned from, unsigned to);
|
||||
void bx_dbg_info_gdt_command(unsigned from, unsigned to);
|
||||
void bx_dbg_info_ldt_command(unsigned from, unsigned to);
|
||||
void bx_dbg_info_tss_command(void);
|
||||
void bx_dbg_info_debug_regs_command(void);
|
||||
void bx_dbg_info_control_regs_command(void);
|
||||
void bx_dbg_info_segment_regs_command(void);
|
||||
void bx_dbg_info_flags(void);
|
||||
void bx_dbg_info_linux_command(void);
|
||||
void bx_dbg_examine_command(const char *command, const char *format, bx_bool format_passed,
|
||||
bx_address addr, bx_bool addr_passed);
|
||||
Bit32u bx_dbg_lin_indirect(bx_address addr);
|
||||
Bit32u bx_dbg_phy_indirect(bx_phy_address addr);
|
||||
void bx_dbg_setpmem_command(bx_phy_address addr, unsigned len, Bit32u val);
|
||||
void bx_dbg_query_command(const char *);
|
||||
void bx_dbg_take_command(const char *, unsigned n);
|
||||
void bx_dbg_disassemble_current(const char *);
|
||||
void bx_dbg_disassemble_command(const char *, Bit64u from, Bit64u to);
|
||||
void bx_dbg_instrument_command(const char *);
|
||||
void bx_dbg_doit_command(unsigned);
|
||||
void bx_dbg_crc_command(bx_phy_address addr1, bx_phy_address addr2);
|
||||
void bx_dbg_linux_syscall(unsigned which_cpu);
|
||||
void bx_dbg_info_ne2k(int page, int reg);
|
||||
void bx_dbg_info_pic(void);
|
||||
void bx_dbg_info_vga(void);
|
||||
void bx_dbg_info_pci(void);
|
||||
void bx_dbg_print_help(void);
|
||||
void bx_dbg_calc_command(Bit64u value);
|
||||
void bx_dbg_dump_table(void);
|
||||
|
||||
// callbacks from CPU
|
||||
void bx_dbg_exception(unsigned cpu, Bit8u vector, Bit16u error_code);
|
||||
void bx_dbg_interrupt(unsigned cpu, Bit8u vector, Bit16u error_code);
|
||||
void bx_dbg_halt(unsigned cpu);
|
||||
|
||||
// memory trace callbacks from CPU, len=1,2,4 or 8
|
||||
void bx_dbg_lin_memory_access(unsigned cpu, bx_address lin, bx_phy_address phy, unsigned len, unsigned pl, unsigned rw, Bit8u *data);
|
||||
void bx_dbg_phy_memory_access(unsigned cpu, bx_phy_address phy, unsigned len, unsigned rw, Bit8u *data);
|
||||
|
||||
// check memory access for watchpoints
|
||||
void bx_dbg_check_memory_watchpoints(unsigned cpu, bx_phy_address phy, unsigned len, unsigned rw);
|
||||
|
||||
// commands that work with Bochs param tree
|
||||
void bx_dbg_restore_command(const char *param_name, const char *path);
|
||||
void bx_dbg_show_param_command(const char *param);
|
||||
|
||||
int bx_dbg_show_symbolic(void);
|
||||
void bx_dbg_set_symbol_command(const char *symbol, Bit32u val);
|
||||
const char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base);
|
||||
const char* bx_dbg_symbolic_address_16bit(Bit32u eip, Bit32u cs);
|
||||
int bx_dbg_symbol_command(const char* filename, bx_bool global, Bit32u offset);
|
||||
void bx_dbg_info_symbols_command(const char *Symbol);
|
||||
int bx_dbg_lbreakpoint_symbol_command(const char *Symbol);
|
||||
Bit32u bx_dbg_get_symbol_value(const char *Symbol);
|
||||
const char* bx_dbg_disasm_symbolic_address(Bit32u eip, Bit32u base);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// the rest for C++
|
||||
#ifdef __cplusplus
|
||||
|
||||
typedef enum {
|
||||
STOP_NO_REASON = 0,
|
||||
STOP_TIME_BREAK_POINT,
|
||||
STOP_READ_WATCH_POINT,
|
||||
STOP_WRITE_WATCH_POINT,
|
||||
STOP_MAGIC_BREAK_POINT,
|
||||
STOP_MODE_BREAK_POINT,
|
||||
STOP_CPU_HALTED
|
||||
} stop_reason_t;
|
||||
|
||||
typedef enum {
|
||||
BREAK_POINT_MAGIC, BREAK_POINT_READ, BREAK_POINT_WRITE, BREAK_POINT_TIME
|
||||
} break_point_t;
|
||||
|
||||
#define BX_DBG_REG_EIP 10
|
||||
#define BX_DBG_REG_EFLAGS 11
|
||||
#define BX_DBG_REG_CS 20
|
||||
#define BX_DBG_REG_SS 21
|
||||
#define BX_DBG_REG_DS 22
|
||||
#define BX_DBG_REG_ES 23
|
||||
#define BX_DBG_REG_FS 24
|
||||
#define BX_DBG_REG_GS 25
|
||||
#define BX_DBG_REG_CR0 30
|
||||
#define BX_DBG_REG_CR2 32
|
||||
#define BX_DBG_REG_CR3 33
|
||||
#define BX_DBG_REG_CR4 34
|
||||
|
||||
#define BX_DBG_PENDING_DMA 1
|
||||
#define BX_DBG_PENDING_IRQ 2
|
||||
|
||||
void bx_debug_break(void);
|
||||
|
||||
void bx_dbg_exit(int code);
|
||||
#if BX_DBG_EXTENSIONS
|
||||
int bx_dbg_extensions(char *command);
|
||||
#else
|
||||
#define bx_dbg_extensions(command) 0
|
||||
#endif
|
||||
|
||||
//
|
||||
// code for guards...
|
||||
//
|
||||
|
||||
#define BX_DBG_GUARD_IADDR_VIR 0x0001
|
||||
#define BX_DBG_GUARD_IADDR_LIN 0x0002
|
||||
#define BX_DBG_GUARD_IADDR_PHY 0x0004
|
||||
#define BX_DBG_GUARD_IADDR_ALL (BX_DBG_GUARD_IADDR_VIR | \
|
||||
BX_DBG_GUARD_IADDR_LIN | \
|
||||
BX_DBG_GUARD_IADDR_PHY)
|
||||
|
||||
#define BX_DBG_GUARD_CTRL_C 0x0100
|
||||
|
||||
typedef struct {
|
||||
unsigned guard_for;
|
||||
|
||||
// instruction address breakpoints
|
||||
struct {
|
||||
#if (BX_DBG_MAX_VIR_BPOINTS > 0)
|
||||
unsigned num_virtual;
|
||||
struct {
|
||||
Bit32u cs; // only use 16 bits
|
||||
bx_address eip;
|
||||
unsigned bpoint_id;
|
||||
bx_bool enabled;
|
||||
} vir[BX_DBG_MAX_VIR_BPOINTS];
|
||||
#endif
|
||||
|
||||
#if (BX_DBG_MAX_LIN_BPOINTS > 0)
|
||||
unsigned num_linear;
|
||||
struct {
|
||||
bx_address addr;
|
||||
unsigned bpoint_id;
|
||||
bx_bool enabled;
|
||||
} lin[BX_DBG_MAX_LIN_BPOINTS];
|
||||
#endif
|
||||
|
||||
#if (BX_DBG_MAX_PHY_BPOINTS > 0)
|
||||
unsigned num_physical;
|
||||
struct {
|
||||
bx_phy_address addr;
|
||||
unsigned bpoint_id;
|
||||
bx_bool enabled;
|
||||
} phy[BX_DBG_MAX_PHY_BPOINTS];
|
||||
#endif
|
||||
} iaddr;
|
||||
|
||||
// user typed Ctrl-C, requesting simulator stop at next convient spot
|
||||
volatile bx_bool interrupt_requested;
|
||||
|
||||
// booleans to control whether simulator should report events
|
||||
// to debug controller
|
||||
struct {
|
||||
bx_bool irq;
|
||||
bx_bool a20;
|
||||
bx_bool io;
|
||||
bx_bool dma;
|
||||
} report;
|
||||
|
||||
struct {
|
||||
bx_bool irq; // should process IRQs asynchronously
|
||||
bx_bool dma; // should process DMAs asynchronously
|
||||
} async;
|
||||
|
||||
#define BX_DBG_ASYNC_PENDING_A20 0x01
|
||||
#define BX_DBG_ASYNC_PENDING_RESET 0x02
|
||||
#define BX_DBG_ASYNC_PENDING_NMI 0x04
|
||||
|
||||
// Asynchronous changes which are pending. These are Q'd by
|
||||
// the debugger, as the master simulator is notified of a pending
|
||||
// async change. At the simulator's next point, where it checks for
|
||||
// such events, it notifies the debugger with acknowlegement. This
|
||||
// field contains a logically or'd list of all events which should
|
||||
// be checked, and ack'd.
|
||||
struct {
|
||||
unsigned which; // logical OR of above constants
|
||||
bx_bool a20;
|
||||
bx_bool reset;
|
||||
bx_bool nmi;
|
||||
} async_changes_pending;
|
||||
} bx_guard_t;
|
||||
|
||||
// working information for each simulator to update when a guard
|
||||
// is reached (found)
|
||||
typedef struct bx_guard_found_t {
|
||||
unsigned guard_found;
|
||||
unsigned iaddr_index;
|
||||
Bit64u icount; // number of completed instructions from last breakpoint hit
|
||||
Bit32u cs; // cs:eip and linear addr of instruction at guard point
|
||||
bx_address eip;
|
||||
bx_address laddr;
|
||||
// 00 - 16 bit, 01 - 32 bit, 10 - 64-bit, 11 - illegal
|
||||
unsigned code_32_64; // CS seg size at guard point
|
||||
bx_bool ctrl_c; // simulator stopped due to Ctrl-C request
|
||||
Bit64u time_tick; // time tick when guard reached
|
||||
} bx_guard_found_t;
|
||||
|
||||
struct bx_watchpoint {
|
||||
bx_phy_address addr;
|
||||
Bit32u len;
|
||||
};
|
||||
|
||||
extern unsigned num_write_watchpoints;
|
||||
extern unsigned num_read_watchpoints;
|
||||
extern bx_watchpoint write_watchpoint[BX_DBG_MAX_WATCHPONTS];
|
||||
extern bx_watchpoint read_watchpoint[BX_DBG_MAX_WATCHPONTS];
|
||||
extern bx_guard_t bx_guard;
|
||||
|
||||
#define IS_CODE_32(code_32_64) ((code_32_64 & 1) != 0)
|
||||
#define IS_CODE_64(code_32_64) ((code_32_64 & 2) != 0)
|
||||
|
||||
void bx_dbg_init_infile(void);
|
||||
int bx_dbg_set_rcfile(const char *rcfile);
|
||||
int bx_dbg_main(void);
|
||||
void bx_dbg_user_input_loop(void);
|
||||
void bx_dbg_interpret_line(char *cmd);
|
||||
|
||||
typedef struct {
|
||||
Bit16u sel;
|
||||
Bit32u des_l, des_h, valid;
|
||||
#if BX_SUPPORT_X86_64
|
||||
Bit32u dword3;
|
||||
#endif
|
||||
} bx_dbg_sreg_t;
|
||||
|
||||
typedef struct {
|
||||
bx_address base;
|
||||
Bit16u limit;
|
||||
} bx_dbg_global_sreg_t;
|
||||
|
||||
void bx_dbg_dma_report(bx_phy_address addr, unsigned len, unsigned what, Bit32u val);
|
||||
void bx_dbg_iac_report(unsigned vector, unsigned irq);
|
||||
void bx_dbg_a20_report(unsigned val);
|
||||
void bx_dbg_io_report(Bit32u port, unsigned size, unsigned op, Bit32u val);
|
||||
void bx_dbg_disassemble_current(int which_cpu, int print_time);
|
||||
|
||||
#endif // #ifdef __cplusplus
|
||||
|
||||
#endif // #if BX_DEBUGGER
|
||||
3482
simulators/bochs/bx_debug/lexer.c
Normal file
3482
simulators/bochs/bx_debug/lexer.c
Normal file
File diff suppressed because it is too large
Load Diff
288
simulators/bochs/bx_debug/lexer.l
Normal file
288
simulators/bochs/bx_debug/lexer.l
Normal file
@ -0,0 +1,288 @@
|
||||
%{
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#define YY_NO_UNISTD_H
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
#if BX_DEBUGGER
|
||||
|
||||
#include "parser.h"
|
||||
|
||||
int bx_yyinput(char *buf, int max_size);
|
||||
#undef YY_INPUT
|
||||
#define YY_INPUT(buf, ret, max_size) (ret = bx_yyinput(buf, max_size))
|
||||
|
||||
static char *lex_input_ptr = NULL;
|
||||
static unsigned lex_input_size = 0;
|
||||
|
||||
#if BX_SUPPORT_X86_64
|
||||
#define LONG_MODE_8BL_REG(reg) \
|
||||
{ bxlval.uval = reg; return(BX_TOKEN_8BL_REG); }
|
||||
#define LONG_MODE_16B_REG(reg) \
|
||||
{ bxlval.uval = reg; return(BX_TOKEN_16B_REG); }
|
||||
#define LONG_MODE_32B_REG(reg) \
|
||||
{ bxlval.uval = reg; return(BX_TOKEN_32B_REG); }
|
||||
#define LONG_MODE_64B_REG(reg) \
|
||||
{ bxlval.uval = reg; return(BX_TOKEN_64B_REG); }
|
||||
#else
|
||||
#define LONG_MODE_8BL_REG(reg) \
|
||||
{ bxlval.sval = strdup(bxtext); return(BX_TOKEN_GENERIC); }
|
||||
#define LONG_MODE_16B_REG(reg) \
|
||||
{ bxlval.sval = strdup(bxtext); return(BX_TOKEN_GENERIC); }
|
||||
#define LONG_MODE_32B_REG(reg) \
|
||||
{ bxlval.sval = strdup(bxtext); return(BX_TOKEN_GENERIC); }
|
||||
#define LONG_MODE_64B_REG(reg) \
|
||||
{ bxlval.sval = strdup(bxtext); return(BX_TOKEN_GENERIC); }
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
%x EXAMINE
|
||||
%x DISASM
|
||||
|
||||
%%
|
||||
<*>[ \t]+ ; // eat up whitespace
|
||||
set { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SET); }
|
||||
on { bxlval.bval = 1; return(BX_TOKEN_ON); }
|
||||
off { bxlval.bval = 0; return(BX_TOKEN_OFF); }
|
||||
crc { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CRC); }
|
||||
c |
|
||||
cont |
|
||||
continue { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CONTINUE); }
|
||||
step |
|
||||
s { bxlval.sval = strdup(bxtext); return(BX_TOKEN_STEPN); }
|
||||
next |
|
||||
n |
|
||||
p { bxlval.sval = strdup(bxtext); return(BX_TOKEN_STEP_OVER); }
|
||||
blist { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LIST_BREAK); }
|
||||
vb|vbreak { bxlval.sval = strdup(bxtext); return(BX_TOKEN_VBREAKPOINT); }
|
||||
lb|lbreak { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LBREAKPOINT); }
|
||||
break |
|
||||
b|pb |
|
||||
pbreak { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PBREAKPOINT); }
|
||||
info { bxlval.sval = strdup(bxtext); return(BX_TOKEN_INFO); }
|
||||
cr |
|
||||
creg { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CONTROL_REGS); }
|
||||
dr |
|
||||
dreg { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DEBUG_REGS); }
|
||||
sreg { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SEGMENT_REGS); }
|
||||
r { bxlval.sval = strdup(bxtext); return(BX_TOKEN_R); }
|
||||
reg|regs |
|
||||
registers { bxlval.sval = strdup(bxtext); return(BX_TOKEN_REGS); }
|
||||
fp|fpu { bxlval.sval = strdup(bxtext); return(BX_TOKEN_FPU); }
|
||||
sse |
|
||||
xmm { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SSE); }
|
||||
mmx { bxlval.sval = strdup(bxtext); return(BX_TOKEN_MMX); }
|
||||
cpu { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CPU); }
|
||||
idt { bxlval.sval = strdup(bxtext); return(BX_TOKEN_IDT); }
|
||||
ivt { bxlval.sval = strdup(bxtext); return(BX_TOKEN_IVT); }
|
||||
gdt { bxlval.sval = strdup(bxtext); return(BX_TOKEN_GDT); }
|
||||
ldt { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LDT); }
|
||||
tss { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TSS); }
|
||||
tab { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TAB); }
|
||||
linux { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LINUX); }
|
||||
delete |
|
||||
del |
|
||||
d { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DEL_BREAKPOINT); }
|
||||
bpe { bxlval.sval = strdup(bxtext); return(BX_TOKEN_ENABLE_BREAKPOINT); }
|
||||
bpd { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DISABLE_BREAKPOINT); }
|
||||
quit |
|
||||
exit |
|
||||
q { bxlval.sval = strdup(bxtext); return(BX_TOKEN_QUIT); }
|
||||
x |
|
||||
xp { BEGIN(EXAMINE); bxlval.sval = strdup(bxtext); return(BX_TOKEN_EXAMINE); }
|
||||
restore { bxlval.sval = strdup(bxtext); return(BX_TOKEN_RESTORE); }
|
||||
setpmem { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SETPMEM); }
|
||||
query { bxlval.sval = strdup(bxtext); return(BX_TOKEN_QUERY); }
|
||||
pending { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PENDING); }
|
||||
take { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TAKE); }
|
||||
dma { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DMA); }
|
||||
irq { bxlval.sval = strdup(bxtext); return(BX_TOKEN_IRQ); }
|
||||
pic { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PIC); }
|
||||
u |
|
||||
disasm { BEGIN(DISASM); bxlval.sval = strdup(bxtext); return(BX_TOKEN_DISASM); }
|
||||
hex { bxlval.sval = strdup(bxtext); return(BX_TOKEN_HEX); }
|
||||
instrument { bxlval.sval = strdup(bxtext); return(BX_TOKEN_INSTRUMENT); }
|
||||
stop { bxlval.sval = strdup(bxtext); return(BX_TOKEN_STOP); }
|
||||
doit { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DOIT); }
|
||||
trace { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TRACE); }
|
||||
trace-reg { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TRACEREG); }
|
||||
trace-mem { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TRACEMEM); }
|
||||
switch-mode { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SWITCH_MODE); }
|
||||
size { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SIZE); }
|
||||
ptime { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PTIME); }
|
||||
sb { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TIMEBP); }
|
||||
sba { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TIMEBP_ABSOLUTE); }
|
||||
record { bxlval.sval = strdup(bxtext); return(BX_TOKEN_RECORD); }
|
||||
playback { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PLAYBACK); }
|
||||
modebp { bxlval.sval = strdup(bxtext); return(BX_TOKEN_MODEBP); }
|
||||
print-stack { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PRINT_STACK); }
|
||||
watch { bxlval.sval = strdup(bxtext); return(BX_TOKEN_WATCH); }
|
||||
unwatch { bxlval.sval = strdup(bxtext); return(BX_TOKEN_UNWATCH); }
|
||||
read { bxlval.sval = strdup(bxtext); return(BX_TOKEN_READ); }
|
||||
w|write { bxlval.sval = strdup(bxtext); return(BX_TOKEN_WRITE); }
|
||||
show { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SHOW); }
|
||||
ldsym { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LOAD_SYMBOLS); }
|
||||
symbols { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SYMBOLS); }
|
||||
slist { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LIST_SYMBOLS); }
|
||||
global { bxlval.sval = strdup(bxtext); return(BX_TOKEN_GLOBAL); }
|
||||
where { bxlval.sval = strdup(bxtext); return(BX_TOKEN_WHERE); }
|
||||
print-string { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PRINT_STRING); }
|
||||
ne2k|ne2000 { bxlval.sval = strdup(bxtext); return(BX_TOKEN_NE2000); }
|
||||
page { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PAGE); }
|
||||
vga { bxlval.sval = strdup(bxtext); return(BX_TOKEN_VGA); }
|
||||
pci { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PCI); }
|
||||
all { bxlval.sval = strdup(bxtext); return(BX_TOKEN_ALL); }
|
||||
al { bxlval.uval = BX_DBG_REG8L_AL; return(BX_TOKEN_8BL_REG);}
|
||||
bl { bxlval.uval = BX_DBG_REG8L_BL; return(BX_TOKEN_8BL_REG);}
|
||||
cl { bxlval.uval = BX_DBG_REG8L_CL; return(BX_TOKEN_8BL_REG);}
|
||||
dl { bxlval.uval = BX_DBG_REG8L_DL; return(BX_TOKEN_8BL_REG);}
|
||||
sil { LONG_MODE_8BL_REG(BX_DBG_REG8L_SIL); }
|
||||
dil { LONG_MODE_8BL_REG(BX_DBG_REG8L_DIL); }
|
||||
spl { LONG_MODE_8BL_REG(BX_DBG_REG8L_SPL); }
|
||||
bpl { LONG_MODE_8BL_REG(BX_DBG_REG8L_BPL); }
|
||||
r8b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R8); }
|
||||
r9b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R9); }
|
||||
r10b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R10); }
|
||||
r11b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R11); }
|
||||
r12b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R12); }
|
||||
r13b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R13); }
|
||||
r14b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R14); }
|
||||
r15b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R15); }
|
||||
ah { bxlval.uval = BX_DBG_REG8H_AH; return(BX_TOKEN_8BH_REG);}
|
||||
bh { bxlval.uval = BX_DBG_REG8H_BH; return(BX_TOKEN_8BH_REG);}
|
||||
ch { bxlval.uval = BX_DBG_REG8H_CH; return(BX_TOKEN_8BH_REG);}
|
||||
dh { bxlval.uval = BX_DBG_REG8H_DH; return(BX_TOKEN_8BH_REG);}
|
||||
ax { bxlval.uval = BX_DBG_REG16_AX; return(BX_TOKEN_16B_REG);}
|
||||
bx { bxlval.uval = BX_DBG_REG16_BX; return(BX_TOKEN_16B_REG);}
|
||||
cx { bxlval.uval = BX_DBG_REG16_CX; return(BX_TOKEN_16B_REG);}
|
||||
dx { bxlval.uval = BX_DBG_REG16_DX; return(BX_TOKEN_16B_REG);}
|
||||
si { bxlval.uval = BX_DBG_REG16_SI; return(BX_TOKEN_16B_REG);}
|
||||
di { bxlval.uval = BX_DBG_REG16_DI; return(BX_TOKEN_16B_REG);}
|
||||
bp { bxlval.uval = BX_DBG_REG16_BP; return(BX_TOKEN_16B_REG);}
|
||||
sp { bxlval.uval = BX_DBG_REG16_SP; return(BX_TOKEN_16B_REG);}
|
||||
r8w { LONG_MODE_16B_REG(BX_DBG_REG16_R8); }
|
||||
r9w { LONG_MODE_16B_REG(BX_DBG_REG16_R9); }
|
||||
r10w { LONG_MODE_16B_REG(BX_DBG_REG16_R10); }
|
||||
r11w { LONG_MODE_16B_REG(BX_DBG_REG16_R11); }
|
||||
r12w { LONG_MODE_16B_REG(BX_DBG_REG16_R12); }
|
||||
r13w { LONG_MODE_16B_REG(BX_DBG_REG16_R13); }
|
||||
r14w { LONG_MODE_16B_REG(BX_DBG_REG16_R14); }
|
||||
r15w { LONG_MODE_16B_REG(BX_DBG_REG16_R15); }
|
||||
eax { bxlval.uval = BX_DBG_REG32_EAX; return(BX_TOKEN_32B_REG);}
|
||||
ebx { bxlval.uval = BX_DBG_REG32_EBX; return(BX_TOKEN_32B_REG);}
|
||||
ecx { bxlval.uval = BX_DBG_REG32_ECX; return(BX_TOKEN_32B_REG);}
|
||||
edx { bxlval.uval = BX_DBG_REG32_EDX; return(BX_TOKEN_32B_REG);}
|
||||
esi { bxlval.uval = BX_DBG_REG32_ESI; return(BX_TOKEN_32B_REG);}
|
||||
edi { bxlval.uval = BX_DBG_REG32_EDI; return(BX_TOKEN_32B_REG);}
|
||||
ebp { bxlval.uval = BX_DBG_REG32_EBP; return(BX_TOKEN_32B_REG);}
|
||||
esp { bxlval.uval = BX_DBG_REG32_ESP; return(BX_TOKEN_32B_REG);}
|
||||
r8d { LONG_MODE_32B_REG(BX_DBG_REG32_R8); }
|
||||
r9d { LONG_MODE_32B_REG(BX_DBG_REG32_R9); }
|
||||
r10d { LONG_MODE_32B_REG(BX_DBG_REG32_R10); }
|
||||
r11d { LONG_MODE_32B_REG(BX_DBG_REG32_R11); }
|
||||
r12d { LONG_MODE_32B_REG(BX_DBG_REG32_R12); }
|
||||
r13d { LONG_MODE_32B_REG(BX_DBG_REG32_R13); }
|
||||
r14d { LONG_MODE_32B_REG(BX_DBG_REG32_R14); }
|
||||
r15d { LONG_MODE_32B_REG(BX_DBG_REG32_R15); }
|
||||
rax { LONG_MODE_64B_REG(BX_DBG_REG64_RAX); }
|
||||
rbx { LONG_MODE_64B_REG(BX_DBG_REG64_RBX); }
|
||||
rcx { LONG_MODE_64B_REG(BX_DBG_REG64_RCX); }
|
||||
rdx { LONG_MODE_64B_REG(BX_DBG_REG64_RDX); }
|
||||
rsi { LONG_MODE_64B_REG(BX_DBG_REG64_RSI); }
|
||||
rdi { LONG_MODE_64B_REG(BX_DBG_REG64_RDI); }
|
||||
rsp { LONG_MODE_64B_REG(BX_DBG_REG64_RSP); }
|
||||
rbp { LONG_MODE_64B_REG(BX_DBG_REG64_RBP); }
|
||||
r8 { LONG_MODE_64B_REG(BX_DBG_REG64_R8); }
|
||||
r9 { LONG_MODE_64B_REG(BX_DBG_REG64_R9); }
|
||||
r10 { LONG_MODE_64B_REG(BX_DBG_REG64_R10); }
|
||||
r11 { LONG_MODE_64B_REG(BX_DBG_REG64_R11); }
|
||||
r12 { LONG_MODE_64B_REG(BX_DBG_REG64_R12); }
|
||||
r13 { LONG_MODE_64B_REG(BX_DBG_REG64_R13); }
|
||||
r14 { LONG_MODE_64B_REG(BX_DBG_REG64_R14); }
|
||||
r15 { LONG_MODE_64B_REG(BX_DBG_REG64_R15); }
|
||||
ip { return(BX_TOKEN_REG_IP); }
|
||||
eip { return(BX_TOKEN_REG_EIP);}
|
||||
rip { return(BX_TOKEN_REG_RIP);}
|
||||
cs { bxlval.uval = BX_DBG_SREG_CS; return(BX_TOKEN_CS); }
|
||||
es { bxlval.uval = BX_DBG_SREG_ES; return(BX_TOKEN_ES); }
|
||||
ss { bxlval.uval = BX_DBG_SREG_SS; return(BX_TOKEN_SS); }
|
||||
ds { bxlval.uval = BX_DBG_SREG_DS; return(BX_TOKEN_DS); }
|
||||
fs { bxlval.uval = BX_DBG_SREG_FS; return(BX_TOKEN_FS); }
|
||||
gs { bxlval.uval = BX_DBG_SREG_GS; return(BX_TOKEN_GS); }
|
||||
flags|eflags { bxlval.uval = 0; return (BX_TOKEN_FLAGS); }
|
||||
h|help { bxlval.sval = strdup(bxtext); return(BX_TOKEN_HELP); }
|
||||
\? |
|
||||
calc { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CALC); }
|
||||
<EXAMINE>\/[0-9]+ { BEGIN(INITIAL); bxlval.sval = strdup(bxtext); return(BX_TOKEN_XFORMAT); }
|
||||
<EXAMINE>\/[0-9]*[mxduotcsibhwg]+ { BEGIN(INITIAL); bxlval.sval = strdup(bxtext); return(BX_TOKEN_XFORMAT); }
|
||||
<DISASM>\/[0-9]+ { BEGIN(INITIAL); bxlval.sval = strdup(bxtext); return(BX_TOKEN_DISFORMAT); }
|
||||
"+" { return ('+'); }
|
||||
"-" { return ('-'); }
|
||||
"*" { return ('*'); }
|
||||
"/" { return ('/'); }
|
||||
">>" { return (BX_TOKEN_RSHIFT); }
|
||||
"<<" { return (BX_TOKEN_LSHIFT); }
|
||||
"&" { return ('&'); }
|
||||
"|" { return ('|'); }
|
||||
"^" { return ('^'); }
|
||||
"!" { return ('!'); }
|
||||
"@" { return ('@'); }
|
||||
"(" { return ('('); }
|
||||
")" { return (')'); }
|
||||
\'([^\\\'\n]|(\\.))*\' | /* throw away leading and trailing \" */
|
||||
\"([^\\\"\n]|(\\.))*\" { bxlval.sval = strdup(bxtext+1); bxlval.sval[strlen(bxlval.sval)-1] = 0; return(BX_TOKEN_STRING); }
|
||||
0x[0-9a-fA-F]+ { bxlval.uval = strtoull(bxtext, NULL, 16); return(BX_TOKEN_NUMERIC); }
|
||||
0[0-7]+ { bxlval.uval = strtoull(bxtext, NULL, 8); return(BX_TOKEN_NUMERIC); }
|
||||
[0-9]+ { bxlval.uval = strtoull(bxtext, NULL, 10); return(BX_TOKEN_NUMERIC); }
|
||||
[a-z-]+ { bxlval.sval = strdup(bxtext); return(BX_TOKEN_COMMAND); }
|
||||
$[a-zA-Z_][a-zA-Z0-9_]* { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SYMBOLNAME); }
|
||||
[A-Za-z_][A-Za-z0-9_]* { bxlval.sval = strdup(bxtext); return(BX_TOKEN_GENERIC); }
|
||||
<*>";" { return ('\n'); }
|
||||
<*>\n { return ('\n'); }
|
||||
[#][^\n]* ; // eat up comments '//'
|
||||
. { return(bxtext[0]); }
|
||||
<EXAMINE,DISASM>. { BEGIN(INITIAL); unput(*bxtext); }
|
||||
%%
|
||||
|
||||
int
|
||||
bx_yyinput(char *buf, int max_size)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (lex_input_size == 0) {
|
||||
fprintf(stderr, "lex: no characters in string input buffer.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
len = strlen(lex_input_ptr) + 1;
|
||||
if (len > max_size)
|
||||
len = max_size;
|
||||
|
||||
memcpy(buf, lex_input_ptr, len);
|
||||
|
||||
return(len);
|
||||
}
|
||||
|
||||
void
|
||||
bx_add_lex_input(char *buf)
|
||||
{
|
||||
lex_input_ptr = buf;
|
||||
lex_input_size = strlen(buf);
|
||||
|
||||
// Since we're parsing from strings, flush out
|
||||
// all current buffer state, so the next read
|
||||
// requests from yyinput
|
||||
|
||||
bx_flush_buffer( YY_CURRENT_BUFFER );
|
||||
}
|
||||
|
||||
#endif /* if BX_DEBUGGER */
|
||||
92
simulators/bochs/bx_debug/linux.cc
Normal file
92
simulators/bochs/bx_debug/linux.cc
Normal file
@ -0,0 +1,92 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
#include <stdio.h>
|
||||
|
||||
#include "bochs.h"
|
||||
#include "cpu/cpu.h"
|
||||
|
||||
#if BX_DEBUGGER
|
||||
|
||||
#define LOG_THIS genlog->
|
||||
|
||||
// for Linux segment numbers
|
||||
// these numbers are from <asm/segment.h>
|
||||
#define KERNEL_CS 0x10
|
||||
#define USER_CS 0x18
|
||||
|
||||
void bx_dbg_info_linux_command(void)
|
||||
{
|
||||
BX_INFO (("Info linux"));
|
||||
bx_dbg_sreg_t cs;
|
||||
BX_CPU(dbg_cpu)->dbg_get_sreg(&cs, BX_DBG_SREG_CS);
|
||||
int cpu_mode = BX_CPU(dbg_cpu)->get_cpu_mode();
|
||||
|
||||
int mode;
|
||||
if (cpu_mode >= BX_MODE_IA32_PROTECTED) {
|
||||
// protected mode
|
||||
if (cs.sel == KERNEL_CS) {
|
||||
mode = 'k';
|
||||
fprintf (stderr, "Processor mode: kernel\n");
|
||||
} else if (cs.sel == USER_CS) {
|
||||
fprintf (stderr, "Processor mode: user\n");
|
||||
mode = 'u';
|
||||
} else {
|
||||
mode = '?';
|
||||
fprintf (stderr, "Processor mode: ??? protected=1 but unrecognized CS\n");
|
||||
}
|
||||
} else {
|
||||
mode = 'r';
|
||||
fprintf (stderr, "Processor mode: real-address mode, maybe during boot sequence\n");
|
||||
}
|
||||
if (mode != 'u') return;
|
||||
/* user mode, look through registers and memory to find our process ID */
|
||||
}
|
||||
|
||||
class syscall_names_t {
|
||||
#define MAX_SYSCALLS 200
|
||||
const char *syscall_names_linux[MAX_SYSCALLS];
|
||||
public:
|
||||
syscall_names_t() { init (); }
|
||||
void init();
|
||||
const char *get_name(int num);
|
||||
};
|
||||
|
||||
void syscall_names_t::init()
|
||||
{
|
||||
for (int i=0; i<MAX_SYSCALLS; i++) {
|
||||
syscall_names_linux[i] = "<unknown syscall>";
|
||||
}
|
||||
#define DEF_SYSCALL(num,name) syscall_names_linux[num] = name;
|
||||
/* basically every line in the included file is a call to DEF_SYSCALL.
|
||||
The preprocessor will turn each DEF_SYSCALL into an assignment
|
||||
to syscall_names_linux[num]. */
|
||||
#include "syscalls-linux.h"
|
||||
/* now almost all the name entries have been initialized. If there
|
||||
are any gaps, they still point to "<unknown syscall>". */
|
||||
|
||||
#if (N_SYSCALLS > MAX_SYSCALLS)
|
||||
#error MAX_SYSCALLS must exceed N_SYSCALLS from syscalls-linux.h
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *syscall_names_t::get_name(int n)
|
||||
{
|
||||
if (n < 0 || n > N_SYSCALLS) return 0;
|
||||
return syscall_names_linux[n];
|
||||
}
|
||||
|
||||
syscall_names_t syscall_names;
|
||||
|
||||
void bx_dbg_linux_syscall(unsigned which_cpu)
|
||||
{
|
||||
Bit32u eax = BX_CPU(which_cpu)->get_reg32(BX_32BIT_REG_EAX);
|
||||
const char *name = syscall_names.get_name(eax);
|
||||
if (name)
|
||||
fprintf (stderr, "linux system call %s (#%d)\n", name, eax);
|
||||
else
|
||||
fprintf (stderr, "system call (#%d) is out of range\n", eax);
|
||||
}
|
||||
|
||||
#endif /* if BX_DEBUGGER */
|
||||
34
simulators/bochs/bx_debug/make-syscalls-linux.pl
Executable file
34
simulators/bochs/bx_debug/make-syscalls-linux.pl
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# tested with linux 2.2.14
|
||||
# reads <asm/unistd.h>, outputs syscalls-linux.h
|
||||
|
||||
$date = `date`;
|
||||
print <<EOF;
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Linux system call table
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Format for each entry:
|
||||
// DEF_LINUX_SYSCALL(syscall_number, "syscall_name")
|
||||
// This file can be regenerated with the following command:
|
||||
//
|
||||
// ./make-syscalls-linux.pl < /usr/include/asm/unistd.h > syscalls-linux.h
|
||||
//
|
||||
EOF
|
||||
|
||||
$max = 0;
|
||||
while (<STDIN>) {
|
||||
$line = $_;
|
||||
next unless /#define __NR_[a-z]/;
|
||||
s/.*NR_//;
|
||||
undef $number;
|
||||
($name, $number) = split (/[\s]+/);
|
||||
if ((length $number) < 1) {
|
||||
die "bad line: $line";
|
||||
}
|
||||
if ($number > $max) { $max = $number; }
|
||||
print "DEF_SYSCALL($number, \"$name\")\n";
|
||||
}
|
||||
|
||||
print "#define N_SYSCALLS $max\n";
|
||||
4029
simulators/bochs/bx_debug/parser.c
Normal file
4029
simulators/bochs/bx_debug/parser.c
Normal file
File diff suppressed because it is too large
Load Diff
276
simulators/bochs/bx_debug/parser.h
Normal file
276
simulators/bochs/bx_debug/parser.h
Normal file
@ -0,0 +1,276 @@
|
||||
/* A Bison parser, made by GNU Bison 2.3. */
|
||||
|
||||
/* Skeleton interface for Bison's Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
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; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
BX_TOKEN_8BH_REG = 258,
|
||||
BX_TOKEN_8BL_REG = 259,
|
||||
BX_TOKEN_16B_REG = 260,
|
||||
BX_TOKEN_32B_REG = 261,
|
||||
BX_TOKEN_64B_REG = 262,
|
||||
BX_TOKEN_CS = 263,
|
||||
BX_TOKEN_ES = 264,
|
||||
BX_TOKEN_SS = 265,
|
||||
BX_TOKEN_DS = 266,
|
||||
BX_TOKEN_FS = 267,
|
||||
BX_TOKEN_GS = 268,
|
||||
BX_TOKEN_FLAGS = 269,
|
||||
BX_TOKEN_ON = 270,
|
||||
BX_TOKEN_OFF = 271,
|
||||
BX_TOKEN_CONTINUE = 272,
|
||||
BX_TOKEN_STEPN = 273,
|
||||
BX_TOKEN_STEP_OVER = 274,
|
||||
BX_TOKEN_NEXT_STEP = 275,
|
||||
BX_TOKEN_SET = 276,
|
||||
BX_TOKEN_DEBUGGER = 277,
|
||||
BX_TOKEN_LIST_BREAK = 278,
|
||||
BX_TOKEN_VBREAKPOINT = 279,
|
||||
BX_TOKEN_LBREAKPOINT = 280,
|
||||
BX_TOKEN_PBREAKPOINT = 281,
|
||||
BX_TOKEN_DEL_BREAKPOINT = 282,
|
||||
BX_TOKEN_ENABLE_BREAKPOINT = 283,
|
||||
BX_TOKEN_DISABLE_BREAKPOINT = 284,
|
||||
BX_TOKEN_INFO = 285,
|
||||
BX_TOKEN_QUIT = 286,
|
||||
BX_TOKEN_R = 287,
|
||||
BX_TOKEN_REGS = 288,
|
||||
BX_TOKEN_CPU = 289,
|
||||
BX_TOKEN_FPU = 290,
|
||||
BX_TOKEN_SSE = 291,
|
||||
BX_TOKEN_MMX = 292,
|
||||
BX_TOKEN_IDT = 293,
|
||||
BX_TOKEN_IVT = 294,
|
||||
BX_TOKEN_GDT = 295,
|
||||
BX_TOKEN_LDT = 296,
|
||||
BX_TOKEN_TSS = 297,
|
||||
BX_TOKEN_TAB = 298,
|
||||
BX_TOKEN_ALL = 299,
|
||||
BX_TOKEN_LINUX = 300,
|
||||
BX_TOKEN_DEBUG_REGS = 301,
|
||||
BX_TOKEN_CONTROL_REGS = 302,
|
||||
BX_TOKEN_SEGMENT_REGS = 303,
|
||||
BX_TOKEN_EXAMINE = 304,
|
||||
BX_TOKEN_XFORMAT = 305,
|
||||
BX_TOKEN_DISFORMAT = 306,
|
||||
BX_TOKEN_RESTORE = 307,
|
||||
BX_TOKEN_SETPMEM = 308,
|
||||
BX_TOKEN_SYMBOLNAME = 309,
|
||||
BX_TOKEN_QUERY = 310,
|
||||
BX_TOKEN_PENDING = 311,
|
||||
BX_TOKEN_TAKE = 312,
|
||||
BX_TOKEN_DMA = 313,
|
||||
BX_TOKEN_IRQ = 314,
|
||||
BX_TOKEN_HEX = 315,
|
||||
BX_TOKEN_DISASM = 316,
|
||||
BX_TOKEN_INSTRUMENT = 317,
|
||||
BX_TOKEN_STRING = 318,
|
||||
BX_TOKEN_STOP = 319,
|
||||
BX_TOKEN_DOIT = 320,
|
||||
BX_TOKEN_CRC = 321,
|
||||
BX_TOKEN_TRACE = 322,
|
||||
BX_TOKEN_TRACEREG = 323,
|
||||
BX_TOKEN_TRACEMEM = 324,
|
||||
BX_TOKEN_SWITCH_MODE = 325,
|
||||
BX_TOKEN_SIZE = 326,
|
||||
BX_TOKEN_PTIME = 327,
|
||||
BX_TOKEN_TIMEBP_ABSOLUTE = 328,
|
||||
BX_TOKEN_TIMEBP = 329,
|
||||
BX_TOKEN_RECORD = 330,
|
||||
BX_TOKEN_PLAYBACK = 331,
|
||||
BX_TOKEN_MODEBP = 332,
|
||||
BX_TOKEN_PRINT_STACK = 333,
|
||||
BX_TOKEN_WATCH = 334,
|
||||
BX_TOKEN_UNWATCH = 335,
|
||||
BX_TOKEN_READ = 336,
|
||||
BX_TOKEN_WRITE = 337,
|
||||
BX_TOKEN_SHOW = 338,
|
||||
BX_TOKEN_LOAD_SYMBOLS = 339,
|
||||
BX_TOKEN_SYMBOLS = 340,
|
||||
BX_TOKEN_LIST_SYMBOLS = 341,
|
||||
BX_TOKEN_GLOBAL = 342,
|
||||
BX_TOKEN_WHERE = 343,
|
||||
BX_TOKEN_PRINT_STRING = 344,
|
||||
BX_TOKEN_NUMERIC = 345,
|
||||
BX_TOKEN_NE2000 = 346,
|
||||
BX_TOKEN_PIC = 347,
|
||||
BX_TOKEN_PAGE = 348,
|
||||
BX_TOKEN_HELP = 349,
|
||||
BX_TOKEN_CALC = 350,
|
||||
BX_TOKEN_VGA = 351,
|
||||
BX_TOKEN_PCI = 352,
|
||||
BX_TOKEN_COMMAND = 353,
|
||||
BX_TOKEN_GENERIC = 354,
|
||||
BX_TOKEN_RSHIFT = 355,
|
||||
BX_TOKEN_LSHIFT = 356,
|
||||
BX_TOKEN_REG_IP = 357,
|
||||
BX_TOKEN_REG_EIP = 358,
|
||||
BX_TOKEN_REG_RIP = 359,
|
||||
INDIRECT = 360,
|
||||
NEG = 361,
|
||||
NOT = 362
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define BX_TOKEN_8BH_REG 258
|
||||
#define BX_TOKEN_8BL_REG 259
|
||||
#define BX_TOKEN_16B_REG 260
|
||||
#define BX_TOKEN_32B_REG 261
|
||||
#define BX_TOKEN_64B_REG 262
|
||||
#define BX_TOKEN_CS 263
|
||||
#define BX_TOKEN_ES 264
|
||||
#define BX_TOKEN_SS 265
|
||||
#define BX_TOKEN_DS 266
|
||||
#define BX_TOKEN_FS 267
|
||||
#define BX_TOKEN_GS 268
|
||||
#define BX_TOKEN_FLAGS 269
|
||||
#define BX_TOKEN_ON 270
|
||||
#define BX_TOKEN_OFF 271
|
||||
#define BX_TOKEN_CONTINUE 272
|
||||
#define BX_TOKEN_STEPN 273
|
||||
#define BX_TOKEN_STEP_OVER 274
|
||||
#define BX_TOKEN_NEXT_STEP 275
|
||||
#define BX_TOKEN_SET 276
|
||||
#define BX_TOKEN_DEBUGGER 277
|
||||
#define BX_TOKEN_LIST_BREAK 278
|
||||
#define BX_TOKEN_VBREAKPOINT 279
|
||||
#define BX_TOKEN_LBREAKPOINT 280
|
||||
#define BX_TOKEN_PBREAKPOINT 281
|
||||
#define BX_TOKEN_DEL_BREAKPOINT 282
|
||||
#define BX_TOKEN_ENABLE_BREAKPOINT 283
|
||||
#define BX_TOKEN_DISABLE_BREAKPOINT 284
|
||||
#define BX_TOKEN_INFO 285
|
||||
#define BX_TOKEN_QUIT 286
|
||||
#define BX_TOKEN_R 287
|
||||
#define BX_TOKEN_REGS 288
|
||||
#define BX_TOKEN_CPU 289
|
||||
#define BX_TOKEN_FPU 290
|
||||
#define BX_TOKEN_SSE 291
|
||||
#define BX_TOKEN_MMX 292
|
||||
#define BX_TOKEN_IDT 293
|
||||
#define BX_TOKEN_IVT 294
|
||||
#define BX_TOKEN_GDT 295
|
||||
#define BX_TOKEN_LDT 296
|
||||
#define BX_TOKEN_TSS 297
|
||||
#define BX_TOKEN_TAB 298
|
||||
#define BX_TOKEN_ALL 299
|
||||
#define BX_TOKEN_LINUX 300
|
||||
#define BX_TOKEN_DEBUG_REGS 301
|
||||
#define BX_TOKEN_CONTROL_REGS 302
|
||||
#define BX_TOKEN_SEGMENT_REGS 303
|
||||
#define BX_TOKEN_EXAMINE 304
|
||||
#define BX_TOKEN_XFORMAT 305
|
||||
#define BX_TOKEN_DISFORMAT 306
|
||||
#define BX_TOKEN_RESTORE 307
|
||||
#define BX_TOKEN_SETPMEM 308
|
||||
#define BX_TOKEN_SYMBOLNAME 309
|
||||
#define BX_TOKEN_QUERY 310
|
||||
#define BX_TOKEN_PENDING 311
|
||||
#define BX_TOKEN_TAKE 312
|
||||
#define BX_TOKEN_DMA 313
|
||||
#define BX_TOKEN_IRQ 314
|
||||
#define BX_TOKEN_HEX 315
|
||||
#define BX_TOKEN_DISASM 316
|
||||
#define BX_TOKEN_INSTRUMENT 317
|
||||
#define BX_TOKEN_STRING 318
|
||||
#define BX_TOKEN_STOP 319
|
||||
#define BX_TOKEN_DOIT 320
|
||||
#define BX_TOKEN_CRC 321
|
||||
#define BX_TOKEN_TRACE 322
|
||||
#define BX_TOKEN_TRACEREG 323
|
||||
#define BX_TOKEN_TRACEMEM 324
|
||||
#define BX_TOKEN_SWITCH_MODE 325
|
||||
#define BX_TOKEN_SIZE 326
|
||||
#define BX_TOKEN_PTIME 327
|
||||
#define BX_TOKEN_TIMEBP_ABSOLUTE 328
|
||||
#define BX_TOKEN_TIMEBP 329
|
||||
#define BX_TOKEN_RECORD 330
|
||||
#define BX_TOKEN_PLAYBACK 331
|
||||
#define BX_TOKEN_MODEBP 332
|
||||
#define BX_TOKEN_PRINT_STACK 333
|
||||
#define BX_TOKEN_WATCH 334
|
||||
#define BX_TOKEN_UNWATCH 335
|
||||
#define BX_TOKEN_READ 336
|
||||
#define BX_TOKEN_WRITE 337
|
||||
#define BX_TOKEN_SHOW 338
|
||||
#define BX_TOKEN_LOAD_SYMBOLS 339
|
||||
#define BX_TOKEN_SYMBOLS 340
|
||||
#define BX_TOKEN_LIST_SYMBOLS 341
|
||||
#define BX_TOKEN_GLOBAL 342
|
||||
#define BX_TOKEN_WHERE 343
|
||||
#define BX_TOKEN_PRINT_STRING 344
|
||||
#define BX_TOKEN_NUMERIC 345
|
||||
#define BX_TOKEN_NE2000 346
|
||||
#define BX_TOKEN_PIC 347
|
||||
#define BX_TOKEN_PAGE 348
|
||||
#define BX_TOKEN_HELP 349
|
||||
#define BX_TOKEN_CALC 350
|
||||
#define BX_TOKEN_VGA 351
|
||||
#define BX_TOKEN_PCI 352
|
||||
#define BX_TOKEN_COMMAND 353
|
||||
#define BX_TOKEN_GENERIC 354
|
||||
#define BX_TOKEN_RSHIFT 355
|
||||
#define BX_TOKEN_LSHIFT 356
|
||||
#define BX_TOKEN_REG_IP 357
|
||||
#define BX_TOKEN_REG_EIP 358
|
||||
#define BX_TOKEN_REG_RIP 359
|
||||
#define INDIRECT 360
|
||||
#define NEG 361
|
||||
#define NOT 362
|
||||
|
||||
|
||||
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
#line 13 "parser.y"
|
||||
{
|
||||
char *sval;
|
||||
Bit64u uval;
|
||||
bx_bool bval;
|
||||
}
|
||||
/* Line 1489 of yacc.c. */
|
||||
#line 269 "y.tab.h"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
extern YYSTYPE bxlval;
|
||||
|
||||
1247
simulators/bochs/bx_debug/parser.y
Normal file
1247
simulators/bochs/bx_debug/parser.y
Normal file
File diff suppressed because it is too large
Load Diff
442
simulators/bochs/bx_debug/symbols.cc
Executable file
442
simulators/bochs/bx_debug/symbols.cc
Executable file
@ -0,0 +1,442 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2009 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library 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
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "bochs.h"
|
||||
#include "cpu/cpu.h"
|
||||
|
||||
#if BX_DEBUGGER
|
||||
#if !((BX_HAVE_MAP || BX_HAVE_MAP_H) && (BX_HAVE_SET || BX_HAVE_SET_H))
|
||||
|
||||
static const char BX_HAVE_MAP_ERR[] = "context not implemented because BX_HAVE_MAP=0\n";
|
||||
|
||||
const char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base)
|
||||
{
|
||||
static bx_bool first = true;
|
||||
if (first) {
|
||||
dbg_printf(BX_HAVE_MAP_ERR);
|
||||
first = false;
|
||||
}
|
||||
return "unk. ctxt";
|
||||
}
|
||||
|
||||
const char* bx_dbg_symbolic_address_16bit(Bit32u eip, Bit32u cs)
|
||||
{
|
||||
// just prints an error anyway
|
||||
return bx_dbg_symbolic_address (0,0,0);
|
||||
}
|
||||
|
||||
int bx_dbg_symbol_command(const char* filename, bx_bool global, Bit32u offset)
|
||||
{
|
||||
dbg_printf(BX_HAVE_MAP_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void bx_dbg_info_symbols_command(const char *Symbol)
|
||||
{
|
||||
dbg_printf(BX_HAVE_MAP_ERR);
|
||||
}
|
||||
|
||||
int bx_dbg_lbreakpoint_symbol_command(const char *Symbol)
|
||||
{
|
||||
dbg_printf(BX_HAVE_MAP_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Bit32u bx_dbg_get_symbol_value(const char *Symbol)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* bx_dbg_disasm_symbolic_address(Bit32u eip, Bit32u base)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* if BX_HAVE_MAP == 1 */
|
||||
|
||||
#if BX_HAVE_MAP
|
||||
#include <map>
|
||||
#elif BX_HAVE_MAP_H
|
||||
#include <map.h>
|
||||
#endif
|
||||
|
||||
#if BX_HAVE_SET
|
||||
#include <set>
|
||||
#elif BX_HAVE_SET_H
|
||||
#include <set.h>
|
||||
#endif
|
||||
|
||||
struct symbol_entry_t
|
||||
{
|
||||
symbol_entry_t (Bit32u _start = 0, const char* _name = 0)
|
||||
{
|
||||
start = _start;
|
||||
name = _name ? strdup(_name) : 0;
|
||||
}
|
||||
~symbol_entry_t()
|
||||
{
|
||||
if (name)
|
||||
free(name);
|
||||
}
|
||||
|
||||
void trim_quotes(void);
|
||||
|
||||
char* name;
|
||||
Bit32u start;
|
||||
|
||||
private:
|
||||
symbol_entry_t(const symbol_entry_t&); // No definition
|
||||
void operator=(const symbol_entry_t &); // No definition
|
||||
};
|
||||
|
||||
struct lt_symbol_entry_t
|
||||
{
|
||||
bool operator()(const symbol_entry_t* s1, const symbol_entry_t* s2) const
|
||||
{
|
||||
return s1->start < s2->start;
|
||||
}
|
||||
};
|
||||
|
||||
struct lt_rsymbol_entry_t
|
||||
{
|
||||
bool operator()(const symbol_entry_t* s1, const symbol_entry_t* s2) const
|
||||
{
|
||||
return strcoll(s1->name, s2->name) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct context_t
|
||||
{
|
||||
typedef std::set<symbol_entry_t*,lt_symbol_entry_t> sym_set_t;
|
||||
typedef std::set<symbol_entry_t*,lt_rsymbol_entry_t> rsym_set_t;
|
||||
typedef std::map<Bit32u,context_t*> map_t;
|
||||
|
||||
context_t (Bit32u);
|
||||
~context_t();
|
||||
|
||||
static context_t* get_context(Bit32u);
|
||||
symbol_entry_t* get_symbol_entry(Bit32u);
|
||||
symbol_entry_t* get_symbol_entry(const char *Symbol) const;
|
||||
void add_symbol(symbol_entry_t*);
|
||||
const sym_set_t* get_all_symbols() const {return &m_syms;}
|
||||
const rsym_set_t* get_all_rsymbols() const {return &m_rsyms;}
|
||||
|
||||
friend class context_dtor_t;
|
||||
protected:
|
||||
static map_t s_map;
|
||||
// Forvard references (find name by address)
|
||||
sym_set_t m_syms;
|
||||
// Reverse references (find address by name)
|
||||
rsym_set_t m_rsyms;
|
||||
Bit32u m_id;
|
||||
};
|
||||
|
||||
context_t::map_t context_t::s_map;
|
||||
|
||||
context_t::context_t (Bit32u id)
|
||||
{
|
||||
m_id = id;
|
||||
s_map[m_id] = this;
|
||||
}
|
||||
|
||||
context_t::~context_t()
|
||||
{
|
||||
while (!m_syms.empty())
|
||||
{
|
||||
sym_set_t::iterator it = m_syms.begin();
|
||||
symbol_entry_t *sym = *it;
|
||||
m_syms.erase(it);
|
||||
delete sym;
|
||||
}
|
||||
}
|
||||
|
||||
context_t* context_t::get_context(Bit32u i)
|
||||
{
|
||||
return s_map[i];
|
||||
}
|
||||
|
||||
symbol_entry_t* context_t::get_symbol_entry(Bit32u ip)
|
||||
{
|
||||
symbol_entry_t probe(ip, 0);
|
||||
// find the first symbol whose address is greater than ip.
|
||||
if (m_syms.empty ())
|
||||
return 0;
|
||||
sym_set_t::iterator iter = m_syms.upper_bound(&probe);
|
||||
|
||||
if (iter == m_syms.end()) { // No symbol found
|
||||
return 0;
|
||||
}
|
||||
|
||||
--iter;
|
||||
if(iter == m_syms.end())
|
||||
return 0;
|
||||
return *iter;
|
||||
}
|
||||
|
||||
symbol_entry_t* context_t::get_symbol_entry(const char *Symbol) const
|
||||
{
|
||||
if (m_rsyms.empty())
|
||||
return 0;
|
||||
|
||||
symbol_entry_t probe(0, Symbol);
|
||||
rsym_set_t::const_iterator iter;
|
||||
iter=m_rsyms.find(&probe);
|
||||
if(iter==m_rsyms.end()) // No symbol found
|
||||
return 0;
|
||||
return *iter;
|
||||
}
|
||||
|
||||
void context_t::add_symbol(symbol_entry_t* sym)
|
||||
{
|
||||
m_syms.insert(sym);
|
||||
m_rsyms.insert(sym);
|
||||
}
|
||||
|
||||
void symbol_entry_t::trim_quotes(void)
|
||||
{
|
||||
size_t len = strlen(name);
|
||||
if (name[0] == '\"' && name[len-1] == '\"')
|
||||
{
|
||||
memmove(name, name+1, len);
|
||||
name[len-2] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Bit32u bx_dbg_get_symbol_value(const char *Symbol)
|
||||
{
|
||||
context_t* cntx = context_t::get_context(0);
|
||||
if(!cntx) // Context not found
|
||||
return 0;
|
||||
|
||||
symbol_entry_t s(0, Symbol);
|
||||
s.trim_quotes();
|
||||
|
||||
symbol_entry_t* sym=cntx->get_symbol_entry(s.name);
|
||||
if(!sym) // Symbol not found
|
||||
return 0;
|
||||
|
||||
return sym->start;
|
||||
}
|
||||
|
||||
const char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base)
|
||||
{
|
||||
static char buf[80];
|
||||
#if 0
|
||||
// bbd: I don't see why we shouldn't allow symbol lookups on
|
||||
// segments with a nonzero base. I need to trace user
|
||||
// processes in Linux, which have a base of 0xc0000000.
|
||||
if (base != 0) {
|
||||
snprintf (buf, 80, "non-zero base");
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
// Look up this context
|
||||
context_t* cntx = context_t::get_context(context);
|
||||
if (!cntx) {
|
||||
// Try global context
|
||||
cntx = context_t::get_context(0);
|
||||
if (!cntx) {
|
||||
snprintf (buf, 80, "unk. ctxt");
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
// full linear address not only eip (for nonzero based segments)
|
||||
symbol_entry_t* entr = cntx->get_symbol_entry(base+eip);
|
||||
if (!entr) {
|
||||
snprintf (buf, 80, "no symbol");
|
||||
return buf;
|
||||
}
|
||||
snprintf (buf, 80, "%s+%x", entr->name, (base+eip) - entr->start);
|
||||
return buf;
|
||||
}
|
||||
|
||||
const char* bx_dbg_disasm_symbolic_address(Bit32u eip, Bit32u base)
|
||||
{
|
||||
static char buf[80];
|
||||
|
||||
// Try global context
|
||||
context_t* cntx = context_t::get_context(0);
|
||||
if (!cntx) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// full linear address not only eip (for nonzero based segments)
|
||||
symbol_entry_t* entr = cntx->get_symbol_entry(base+eip);
|
||||
if (!entr) {
|
||||
return 0;
|
||||
}
|
||||
snprintf (buf, 80, "%s+%x", entr->name, (base+eip) - entr->start);
|
||||
return buf;
|
||||
}
|
||||
|
||||
const char* bx_dbg_symbolic_address_16bit(Bit32u eip, Bit32u cs)
|
||||
{
|
||||
// in 16-bit code, the segment selector and offset are combined into a
|
||||
// 20-bit linear address = (segment selector<<4) + offset.
|
||||
eip &= 0xffff;
|
||||
cs &= 0xffff;
|
||||
return bx_dbg_symbolic_address (0, eip+(cs<<4), 0);
|
||||
}
|
||||
|
||||
int bx_dbg_symbol_command(const char* filename, bx_bool global, Bit32u offset)
|
||||
{
|
||||
symbol_entry_t file(0, filename);
|
||||
file.trim_quotes();
|
||||
|
||||
// Install symbols in correct context (page table)
|
||||
// The file format should be
|
||||
// address symbol (example '00002afe _StartLoseNT')
|
||||
|
||||
Bit32u context_id = (global) ? 0 : (BX_CPU(dbg_cpu)->cr3) >> 12;
|
||||
|
||||
context_t* cntx = context_t::get_context(context_id);
|
||||
|
||||
if (!cntx) {
|
||||
cntx = new context_t(context_id);
|
||||
}
|
||||
|
||||
FILE* fp = fopen(file.name, "rt"); // 't' is need for win32, unixes simply ignore it
|
||||
if (!fp) {
|
||||
dbg_printf ("Could not open symbol file '%s'\n", file.name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// C++/C# symbols can be long
|
||||
char buf[512];
|
||||
int line_num = 1;
|
||||
|
||||
while (fgets(buf, sizeof(buf), fp)) {
|
||||
// handle end of line (before error messages)
|
||||
int len = strlen(buf);
|
||||
bool whole_line = (buf[len - 1] == '\n');
|
||||
if (whole_line)
|
||||
buf[len - 1] = 0;
|
||||
|
||||
// parse
|
||||
char* sym_name;
|
||||
Bit32u addr = strtoul(buf, &sym_name, 16);
|
||||
|
||||
if (!isspace(*sym_name)) {
|
||||
if (*sym_name == 0)
|
||||
dbg_printf("%s:%d: missing symbol name\n", file.name, line_num);
|
||||
else
|
||||
dbg_printf("%s:%d: syntax error near '%s'\n", file.name, line_num, sym_name);
|
||||
return -1;
|
||||
}
|
||||
++sym_name;
|
||||
|
||||
symbol_entry_t* sym = new symbol_entry_t(addr + offset, sym_name);
|
||||
cntx->add_symbol(sym);
|
||||
|
||||
// skip the rest of long line
|
||||
while (!whole_line) {
|
||||
if (!fgets(buf, sizeof(buf), fp))
|
||||
break;
|
||||
// actually, last line can end without newline, but then
|
||||
// we'll just break at the next iteration because of EOF
|
||||
whole_line = (buf[strlen(buf)-1] == '\n');
|
||||
}
|
||||
++line_num;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check if s1 is prefix of s2
|
||||
static bool bx_dbg_strprefix(const char *s1, const char *s2)
|
||||
{
|
||||
if(!s1 || !s2)
|
||||
return false;
|
||||
|
||||
size_t len=strlen(s1);
|
||||
|
||||
if(len>strlen(s2))
|
||||
return false;
|
||||
return strncmp(s1, s2, len)==0;
|
||||
}
|
||||
|
||||
void bx_dbg_info_symbols_command(const char *Symbol)
|
||||
{
|
||||
context_t* cntx = context_t::get_context(0);
|
||||
|
||||
if(!cntx) {
|
||||
dbg_printf ("Global context not available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(Symbol) {
|
||||
const context_t::rsym_set_t* rsyms;
|
||||
|
||||
rsyms=cntx->get_all_rsymbols();
|
||||
if (rsyms->empty ()) {
|
||||
dbg_printf ("Symbols not loaded\n");
|
||||
return;
|
||||
}
|
||||
|
||||
symbol_entry_t probe(0, Symbol);
|
||||
// remove leading and trailing quotas
|
||||
probe.trim_quotes();
|
||||
context_t::rsym_set_t::const_iterator iter;
|
||||
iter=rsyms->lower_bound(&probe);
|
||||
|
||||
if(iter==rsyms->end() || !bx_dbg_strprefix(probe.name, (*iter)->name))
|
||||
dbg_printf ("No symbols found\n");
|
||||
else {
|
||||
for(;iter!=rsyms->end() && bx_dbg_strprefix(probe.name, (*iter)->name);++iter) {
|
||||
dbg_printf ("%08x: %s\n", (*iter)->start, (*iter)->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const context_t::sym_set_t* syms;
|
||||
|
||||
syms=cntx->get_all_symbols();
|
||||
if (syms->empty ()) {
|
||||
dbg_printf ("Symbols not loaded\n");
|
||||
return;
|
||||
}
|
||||
|
||||
context_t::sym_set_t::const_iterator iter;
|
||||
for(iter = syms->begin();iter!=syms->end();++iter) {
|
||||
dbg_printf ("%08x: %s\n", (*iter)->start, (*iter)->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int bx_dbg_lbreakpoint_symbol_command(const char *symbol)
|
||||
{
|
||||
context_t* cntx = context_t::get_context(0);
|
||||
if(!cntx) {
|
||||
dbg_printf ("Global context not available\n");
|
||||
return -1;
|
||||
}
|
||||
symbol_entry_t probe(0, symbol);
|
||||
// remove leading and trailing quotes
|
||||
probe.trim_quotes();
|
||||
|
||||
const symbol_entry_t* sym=cntx->get_symbol_entry(probe.name);
|
||||
if(sym)
|
||||
return bx_dbg_lbreakpoint_command(bkRegular, sym->start);
|
||||
dbg_printf ("Symbol not found\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
209
simulators/bochs/bx_debug/syscalls-linux.h
Normal file
209
simulators/bochs/bx_debug/syscalls-linux.h
Normal file
@ -0,0 +1,209 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Linux system call table
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Format for each entry:
|
||||
// DEF_LINUX_SYSCALL(syscall_number, "syscall_name")
|
||||
// This file can be regenerated with the following command:
|
||||
//
|
||||
// ./make-syscalls-linux.pl < /usr/include/asm/unistd.h > syscalls-linux.h
|
||||
|
||||
DEF_SYSCALL(1, "exit")
|
||||
DEF_SYSCALL(2, "fork")
|
||||
DEF_SYSCALL(3, "read")
|
||||
DEF_SYSCALL(4, "write")
|
||||
DEF_SYSCALL(5, "open")
|
||||
DEF_SYSCALL(6, "close")
|
||||
DEF_SYSCALL(7, "waitpid")
|
||||
DEF_SYSCALL(8, "creat")
|
||||
DEF_SYSCALL(9, "link")
|
||||
DEF_SYSCALL(10, "unlink")
|
||||
DEF_SYSCALL(11, "execve")
|
||||
DEF_SYSCALL(12, "chdir")
|
||||
DEF_SYSCALL(13, "time")
|
||||
DEF_SYSCALL(14, "mknod")
|
||||
DEF_SYSCALL(15, "chmod")
|
||||
DEF_SYSCALL(16, "lchown")
|
||||
DEF_SYSCALL(17, "break")
|
||||
DEF_SYSCALL(18, "oldstat")
|
||||
DEF_SYSCALL(19, "lseek")
|
||||
DEF_SYSCALL(20, "getpid")
|
||||
DEF_SYSCALL(21, "mount")
|
||||
DEF_SYSCALL(22, "umount")
|
||||
DEF_SYSCALL(23, "setuid")
|
||||
DEF_SYSCALL(24, "getuid")
|
||||
DEF_SYSCALL(25, "stime")
|
||||
DEF_SYSCALL(26, "ptrace")
|
||||
DEF_SYSCALL(27, "alarm")
|
||||
DEF_SYSCALL(28, "oldfstat")
|
||||
DEF_SYSCALL(29, "pause")
|
||||
DEF_SYSCALL(30, "utime")
|
||||
DEF_SYSCALL(31, "stty")
|
||||
DEF_SYSCALL(32, "gtty")
|
||||
DEF_SYSCALL(33, "access")
|
||||
DEF_SYSCALL(34, "nice")
|
||||
DEF_SYSCALL(35, "ftime")
|
||||
DEF_SYSCALL(36, "sync")
|
||||
DEF_SYSCALL(37, "kill")
|
||||
DEF_SYSCALL(38, "rename")
|
||||
DEF_SYSCALL(39, "mkdir")
|
||||
DEF_SYSCALL(40, "rmdir")
|
||||
DEF_SYSCALL(41, "dup")
|
||||
DEF_SYSCALL(42, "pipe")
|
||||
DEF_SYSCALL(43, "times")
|
||||
DEF_SYSCALL(44, "prof")
|
||||
DEF_SYSCALL(45, "brk")
|
||||
DEF_SYSCALL(46, "setgid")
|
||||
DEF_SYSCALL(47, "getgid")
|
||||
DEF_SYSCALL(48, "signal")
|
||||
DEF_SYSCALL(49, "geteuid")
|
||||
DEF_SYSCALL(50, "getegid")
|
||||
DEF_SYSCALL(51, "acct")
|
||||
DEF_SYSCALL(52, "umount2")
|
||||
DEF_SYSCALL(53, "lock")
|
||||
DEF_SYSCALL(54, "ioctl")
|
||||
DEF_SYSCALL(55, "fcntl")
|
||||
DEF_SYSCALL(56, "mpx")
|
||||
DEF_SYSCALL(57, "setpgid")
|
||||
DEF_SYSCALL(58, "ulimit")
|
||||
DEF_SYSCALL(59, "oldolduname")
|
||||
DEF_SYSCALL(60, "umask")
|
||||
DEF_SYSCALL(61, "chroot")
|
||||
DEF_SYSCALL(62, "ustat")
|
||||
DEF_SYSCALL(63, "dup2")
|
||||
DEF_SYSCALL(64, "getppid")
|
||||
DEF_SYSCALL(65, "getpgrp")
|
||||
DEF_SYSCALL(66, "setsid")
|
||||
DEF_SYSCALL(67, "sigaction")
|
||||
DEF_SYSCALL(68, "sgetmask")
|
||||
DEF_SYSCALL(69, "ssetmask")
|
||||
DEF_SYSCALL(70, "setreuid")
|
||||
DEF_SYSCALL(71, "setregid")
|
||||
DEF_SYSCALL(72, "sigsuspend")
|
||||
DEF_SYSCALL(73, "sigpending")
|
||||
DEF_SYSCALL(74, "sethostname")
|
||||
DEF_SYSCALL(75, "setrlimit")
|
||||
DEF_SYSCALL(76, "getrlimit")
|
||||
DEF_SYSCALL(77, "getrusage")
|
||||
DEF_SYSCALL(78, "gettimeofday")
|
||||
DEF_SYSCALL(79, "settimeofday")
|
||||
DEF_SYSCALL(80, "getgroups")
|
||||
DEF_SYSCALL(81, "setgroups")
|
||||
DEF_SYSCALL(82, "select")
|
||||
DEF_SYSCALL(83, "symlink")
|
||||
DEF_SYSCALL(84, "oldlstat")
|
||||
DEF_SYSCALL(85, "readlink")
|
||||
DEF_SYSCALL(86, "uselib")
|
||||
DEF_SYSCALL(87, "swapon")
|
||||
DEF_SYSCALL(88, "reboot")
|
||||
DEF_SYSCALL(89, "readdir")
|
||||
DEF_SYSCALL(90, "mmap")
|
||||
DEF_SYSCALL(91, "munmap")
|
||||
DEF_SYSCALL(92, "truncate")
|
||||
DEF_SYSCALL(93, "ftruncate")
|
||||
DEF_SYSCALL(94, "fchmod")
|
||||
DEF_SYSCALL(95, "fchown")
|
||||
DEF_SYSCALL(96, "getpriority")
|
||||
DEF_SYSCALL(97, "setpriority")
|
||||
DEF_SYSCALL(98, "profil")
|
||||
DEF_SYSCALL(99, "statfs")
|
||||
DEF_SYSCALL(100, "fstatfs")
|
||||
DEF_SYSCALL(101, "ioperm")
|
||||
DEF_SYSCALL(102, "socketcall")
|
||||
DEF_SYSCALL(103, "syslog")
|
||||
DEF_SYSCALL(104, "setitimer")
|
||||
DEF_SYSCALL(105, "getitimer")
|
||||
DEF_SYSCALL(106, "stat")
|
||||
DEF_SYSCALL(107, "lstat")
|
||||
DEF_SYSCALL(108, "fstat")
|
||||
DEF_SYSCALL(109, "olduname")
|
||||
DEF_SYSCALL(110, "iopl")
|
||||
DEF_SYSCALL(111, "vhangup")
|
||||
DEF_SYSCALL(112, "idle")
|
||||
DEF_SYSCALL(113, "vm86old")
|
||||
DEF_SYSCALL(114, "wait4")
|
||||
DEF_SYSCALL(115, "swapoff")
|
||||
DEF_SYSCALL(116, "sysinfo")
|
||||
DEF_SYSCALL(117, "ipc")
|
||||
DEF_SYSCALL(118, "fsync")
|
||||
DEF_SYSCALL(119, "sigreturn")
|
||||
DEF_SYSCALL(120, "clone")
|
||||
DEF_SYSCALL(121, "setdomainname")
|
||||
DEF_SYSCALL(122, "uname")
|
||||
DEF_SYSCALL(123, "modify_ldt")
|
||||
DEF_SYSCALL(124, "adjtimex")
|
||||
DEF_SYSCALL(125, "mprotect")
|
||||
DEF_SYSCALL(126, "sigprocmask")
|
||||
DEF_SYSCALL(127, "create_module")
|
||||
DEF_SYSCALL(128, "init_module")
|
||||
DEF_SYSCALL(129, "delete_module")
|
||||
DEF_SYSCALL(130, "get_kernel_syms")
|
||||
DEF_SYSCALL(131, "quotactl")
|
||||
DEF_SYSCALL(132, "getpgid")
|
||||
DEF_SYSCALL(133, "fchdir")
|
||||
DEF_SYSCALL(134, "bdflush")
|
||||
DEF_SYSCALL(135, "sysfs")
|
||||
DEF_SYSCALL(136, "personality")
|
||||
DEF_SYSCALL(137, "afs_syscall")
|
||||
DEF_SYSCALL(138, "setfsuid")
|
||||
DEF_SYSCALL(139, "setfsgid")
|
||||
DEF_SYSCALL(141, "getdents")
|
||||
DEF_SYSCALL(143, "flock")
|
||||
DEF_SYSCALL(144, "msync")
|
||||
DEF_SYSCALL(145, "readv")
|
||||
DEF_SYSCALL(146, "writev")
|
||||
DEF_SYSCALL(147, "getsid")
|
||||
DEF_SYSCALL(148, "fdatasync")
|
||||
DEF_SYSCALL(150, "mlock")
|
||||
DEF_SYSCALL(151, "munlock")
|
||||
DEF_SYSCALL(152, "mlockall")
|
||||
DEF_SYSCALL(153, "munlockall")
|
||||
DEF_SYSCALL(154, "sched_setparam")
|
||||
DEF_SYSCALL(155, "sched_getparam")
|
||||
DEF_SYSCALL(156, "sched_setscheduler")
|
||||
DEF_SYSCALL(157, "sched_getscheduler")
|
||||
DEF_SYSCALL(158, "sched_yield")
|
||||
DEF_SYSCALL(159, "sched_get_priority_max")
|
||||
DEF_SYSCALL(160, "sched_get_priority_min")
|
||||
DEF_SYSCALL(161, "sched_rr_get_interval")
|
||||
DEF_SYSCALL(162, "nanosleep")
|
||||
DEF_SYSCALL(163, "mremap")
|
||||
DEF_SYSCALL(164, "setresuid")
|
||||
DEF_SYSCALL(165, "getresuid")
|
||||
DEF_SYSCALL(166, "vm86")
|
||||
DEF_SYSCALL(167, "query_module")
|
||||
DEF_SYSCALL(168, "poll")
|
||||
DEF_SYSCALL(169, "nfsservctl")
|
||||
DEF_SYSCALL(170, "setresgid")
|
||||
DEF_SYSCALL(171, "getresgid")
|
||||
DEF_SYSCALL(172, "prctl")
|
||||
DEF_SYSCALL(173, "rt_sigreturn")
|
||||
DEF_SYSCALL(174, "rt_sigaction")
|
||||
DEF_SYSCALL(175, "rt_sigprocmask")
|
||||
DEF_SYSCALL(176, "rt_sigpending")
|
||||
DEF_SYSCALL(177, "rt_sigtimedwait")
|
||||
DEF_SYSCALL(178, "rt_sigqueueinfo")
|
||||
DEF_SYSCALL(179, "rt_sigsuspend")
|
||||
DEF_SYSCALL(180, "pread")
|
||||
DEF_SYSCALL(181, "pwrite")
|
||||
DEF_SYSCALL(182, "chown")
|
||||
DEF_SYSCALL(183, "getcwd")
|
||||
DEF_SYSCALL(184, "capget")
|
||||
DEF_SYSCALL(185, "capset")
|
||||
DEF_SYSCALL(186, "sigaltstack")
|
||||
DEF_SYSCALL(187, "sendfile")
|
||||
DEF_SYSCALL(188, "getpmsg")
|
||||
DEF_SYSCALL(189, "putpmsg")
|
||||
DEF_SYSCALL(190, "vfork")
|
||||
DEF_SYSCALL(191, "ugetrlimit")
|
||||
DEF_SYSCALL(192, "mmap2")
|
||||
DEF_SYSCALL(193, "truncate64")
|
||||
DEF_SYSCALL(194, "ftruncate64")
|
||||
DEF_SYSCALL(195, "stat64")
|
||||
DEF_SYSCALL(196, "lstat64")
|
||||
DEF_SYSCALL(197, "fstat64")
|
||||
#define N_SYSCALLS 197
|
||||
Reference in New Issue
Block a user