Browse Source
* NEWS: Mention the removal of NLM. 2006-03-29 Steve Ellcey <sje@cup.hp.com> * Makefile.in (nlm): Remove target. * configure.tgt (i[34567]86-*-netware*): Do not set build_nlm. * configure.ac: Remove AC_CONFIG_SUBDIRS of nlm. * configure: Regenerate. * doc/gdb.texinfo: Remove gdbserve.nlm documentation. * nlm: Remove directory.cr-0x5f1
17 changed files with 16 additions and 3052 deletions
@ -1,176 +0,0 @@ |
|||||
#Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999
|
|
||||
#Free Software Foundation, Inc.
|
|
||||
|
|
||||
# This file is part of GDB.
|
|
||||
|
|
||||
# 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 of the License, 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.
|
|
||||
|
|
||||
srcdir = @srcdir@ |
|
||||
VPATH = @srcdir@ |
|
||||
|
|
||||
prefix = @prefix@ |
|
||||
exec_prefix = @exec_prefix@ |
|
||||
|
|
||||
host_alias = @host_alias@ |
|
||||
target_alias = @target_alias@ |
|
||||
program_transform_name = @program_transform_name@ |
|
||||
bindir = @bindir@ |
|
||||
libdir = @libdir@ |
|
||||
tooldir = $(libdir)/$(target_alias) |
|
||||
|
|
||||
datadir = @datadir@ |
|
||||
mandir = @mandir@ |
|
||||
man1dir = $(mandir)/man1 |
|
||||
man2dir = $(mandir)/man2 |
|
||||
man3dir = $(mandir)/man3 |
|
||||
man4dir = $(mandir)/man4 |
|
||||
man5dir = $(mandir)/man5 |
|
||||
man6dir = $(mandir)/man6 |
|
||||
man7dir = $(mandir)/man7 |
|
||||
man8dir = $(mandir)/man8 |
|
||||
man9dir = $(mandir)/man9 |
|
||||
infodir = @infodir@ |
|
||||
htmldir = $(prefix)/html |
|
||||
includedir = @includedir@ |
|
||||
|
|
||||
SHELL = @SHELL@ |
|
||||
|
|
||||
INSTALL = @INSTALL@ |
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
|
||||
INSTALL_DATA = @INSTALL_DATA@ |
|
||||
|
|
||||
CC_FOR_TARGET = ` \
|
|
||||
if [ -f ../../gcc/xgcc ] ; then \
|
|
||||
echo ../../gcc/xgcc -B../../gcc/; \
|
|
||||
else \
|
|
||||
t='$(program_transform_name)'; echo gcc | sed -e '' $$t; \
|
|
||||
fi` |
|
||||
|
|
||||
NLMCONV_FOR_TARGET = ` \
|
|
||||
if [ -f ../../binutils/nlmconv ] ; then \
|
|
||||
echo ../../binutils/nlmconv; \
|
|
||||
else \
|
|
||||
t='$(program_transform_name)'; echo nlmconv | sed -e '' $$t; \
|
|
||||
fi` |
|
||||
|
|
||||
# All the includes used for CFLAGS and for lint.
|
|
||||
INCLUDE_CFLAGS = -I. -I${srcdir} |
|
||||
|
|
||||
# CFLAGS is specifically reserved for setting from the command line
|
|
||||
# when running make. I.E. "make CFLAGS=-Wmissing-prototypes".
|
|
||||
CFLAGS = -g |
|
||||
# INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
|
|
||||
INTERNAL_CFLAGS = ${CFLAGS} ${INCLUDE_CFLAGS} ${USER_CFLAGS} |
|
||||
LDFLAGS = $(CFLAGS) |
|
||||
|
|
||||
# Perhaps should come from parent Makefile
|
|
||||
VERSION = gdbserve-4.12 |
|
||||
DIST=gdb |
|
||||
|
|
||||
# target-dependent makefile fragment come in here.
|
|
||||
@target_makefile_frag@ |
|
||||
# End target-dependent makefile fragment
|
|
||||
|
|
||||
# All source files that go into linking GDB remote server.
|
|
||||
|
|
||||
DEPFILES = $(GDBSERVE_DEPFILES) |
|
||||
|
|
||||
SOURCES = $(ALLDEPFILES) |
|
||||
TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS} |
|
||||
|
|
||||
# Prevent Sun make from putting in the machine type. Setting
|
|
||||
# TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1.
|
|
||||
.c.o: |
|
||||
${CC_FOR_TARGET} -c ${INTERNAL_CFLAGS} $< |
|
||||
|
|
||||
.S.o: |
|
||||
${CC_FOR_TARGET} -c ${INTERNAL_CFLAGS} $< |
|
||||
|
|
||||
all: gdbserve.nlm |
|
||||
|
|
||||
# Traditionally "install" depends on "all". But it may be useful
|
|
||||
# not to; for example, if the user has made some trivial change to a
|
|
||||
# source file and doesn't care about rebuilding or just wants to save the
|
|
||||
# time it takes for make to check that all is up to date.
|
|
||||
# install-only is intended to address that need.
|
|
||||
install: all install-only |
|
||||
install-only: |
|
||||
$(INSTALL) gdbserve.nlm $(bindir)/gdbserve.nlm |
|
||||
|
|
||||
uninstall: force |
|
||||
rm -f $(bindir)/gdbserve.nlm |
|
||||
|
|
||||
installcheck: |
|
||||
check: |
|
||||
info dvi: |
|
||||
install-info: |
|
||||
clean-info: |
|
||||
html: |
|
||||
install-html: |
|
||||
|
|
||||
gdbserve.nlm: gdbserve.O $(srcdir)/gdbserve.def |
|
||||
${NLMCONV_FOR_TARGET} -T $(srcdir)/gdbserve.def |
|
||||
|
|
||||
gdbserve.O: prelude.o gdbserve.o $(TDEPFILES) |
|
||||
${CC_FOR_TARGET} $(LDFLAGS) -r -o gdbserve.O prelude.o gdbserve.o ${TDEPFILES} |
|
||||
|
|
||||
# Put the proper machine-specific files first, so M-. on a machine
|
|
||||
# specific routine gets the one for the correct machine.
|
|
||||
# The xyzzy stuff below deals with empty DEPFILES
|
|
||||
TAGS: ${TAGFILES} |
|
||||
etags `find ${srcdir}/../config -name $(DEPRECATED_TM_FILE) -print` \
|
|
||||
`find ${srcdir}/../config -name ${XM_FILE} -print` \
|
|
||||
`find ${srcdir}/../config -name ${NAT_FILE} -print` \
|
|
||||
`for i in yzzy ${DEPFILES}; do \
|
|
||||
if [ x$$i != xyzzy ]; then \
|
|
||||
echo ${srcdir}/$$i | sed -e 's/\.o$$/\.c/' ; \
|
|
||||
fi; \
|
|
||||
done` \
|
|
||||
${TAGFILES} |
|
||||
tags: TAGS |
|
||||
|
|
||||
clean: |
|
||||
rm -f *.o ${ADD_FILES} *~ |
|
||||
rm -f gdbserve.O gdbserve.nlm core make.log |
|
||||
|
|
||||
distclean: clean TAGS |
|
||||
rm -f config.log config.cache config.status |
|
||||
rm -f Makefile |
|
||||
|
|
||||
maintainer-clean realclean: clean |
|
||||
rm -f TAGS |
|
||||
rm -f config.log config.cache config.status |
|
||||
rm -f Makefile |
|
||||
|
|
||||
Makefile: Makefile.in config.status @target_makefile_frag_path@ |
|
||||
$(SHELL) config.status |
|
||||
|
|
||||
config.status: configure |
|
||||
$(SHELL) config.status --recheck |
|
||||
|
|
||||
force: |
|
||||
|
|
||||
# GNU Make has an annoying habit of putting *all* the Makefile variables
|
|
||||
# into the environment, unless you include this target as a circumvention.
|
|
||||
# Rumor is that this will be fixed (and this target can be removed)
|
|
||||
# in GNU Make 4.0.
|
|
||||
.NOEXPORT: |
|
||||
|
|
||||
# GNU Make 3.63 has a different problem: it keeps tacking command line
|
|
||||
# overrides onto the definition of $(MAKE). This variable setting
|
|
||||
# will remove them.
|
|
||||
MAKEOVERRIDES= |
|
||||
|
|
||||
# This is the end of "Makefile.in".
|
|
||||
File diff suppressed because it is too large
@ -1,55 +0,0 @@ |
|||||
dnl Process this file with autoconf to produce a configure script. |
|
||||
AC_PREREQ(2.12.1)dnl |
|
||||
AC_INIT(gdbserve.c) |
|
||||
|
|
||||
AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..) |
|
||||
AC_CANONICAL_SYSTEM |
|
||||
AC_ARG_PROGRAM |
|
||||
|
|
||||
AC_PROG_INSTALL |
|
||||
|
|
||||
# Map target cpu into the config cpu subdirectory name. |
|
||||
# The default is $target_cpu. |
|
||||
changequote(,)dnl |
|
||||
case "${target_cpu}" in |
|
||||
alpha) gdb_target_cpu=alpha ;; |
|
||||
c[12]) gdb_target_cpu=convex ;; |
|
||||
hppa*) gdb_target_cpu=pa ;; |
|
||||
i[34567]86) gdb_target_cpu=i386 ;; |
|
||||
m68*) gdb_target_cpu=m68k ;; |
|
||||
np1) gdb_target_cpu=gould ;; |
|
||||
pn) gdb_target_cpu=gould ;; |
|
||||
pyramid) gdb_target_cpu=pyr ;; |
|
||||
sparc*) gdb_target_cpu=sparc ;; |
|
||||
*) gdb_target_cpu=$target_cpu ;; |
|
||||
esac |
|
||||
changequote([,])dnl |
|
||||
|
|
||||
target_makefile_frag=${srcdir}/../config/${gdb_target_cpu}/gdbserve.mt |
|
||||
if [ ! -f ${target_makefile_frag} ]; then |
|
||||
AC_MSG_ERROR("*** GDBSERVE does not support target ${target}") |
|
||||
fi |
|
||||
|
|
||||
dnl We have to assign the same value to other variables because autoconf |
|
||||
dnl doesn't provide a mechanism to substitute a replacement keyword with |
|
||||
dnl arbitrary data or pathnames. |
|
||||
dnl |
|
||||
target_makefile_frag_path=$target_makefile_frag |
|
||||
AC_SUBST(target_makefile_frag_path) |
|
||||
AC_SUBST_FILE(target_makefile_frag) |
|
||||
|
|
||||
cpufile=`sed -n ' |
|
||||
s/CPU_FILE[ ]*=[ ]*\([^ ]*\)/\1/p |
|
||||
' ${target_makefile_frag} |
|
||||
|
|
||||
files= |
|
||||
links= |
|
||||
rm -f cpu.h |
|
||||
if [ "${cpufile}" != "" ]; then |
|
||||
files="${files} ${cpufile}.h" |
|
||||
links="${links} cpu.h" |
|
||||
fi |
|
||||
|
|
||||
AC_LINK_FILES($files, $links) |
|
||||
AC_OUTPUT(Makefile) |
|
||||
|
|
||||
File diff suppressed because it is too large
@ -1,42 +0,0 @@ |
|||||
description "GDB debugger stub" |
|
||||
version 1,2 |
|
||||
debug |
|
||||
module clib |
|
||||
screenname "System Console" |
|
||||
input gdbserve.O |
|
||||
output gdbserve.nlm |
|
||||
start _Prelude |
|
||||
exit _Stop |
|
||||
import |
|
||||
AllocateResourceTag |
|
||||
ConsolePrintf |
|
||||
GetCurrentScreen |
|
||||
GetNLMHandle |
|
||||
GetThreadID |
|
||||
KillMe |
|
||||
LoadModule |
|
||||
ReadByteAltDebugger |
|
||||
RegisterDebuggerRTag |
|
||||
ResumeThread |
|
||||
SuspendThread |
|
||||
UnRegisterDebugger |
|
||||
WriteByteAltDebugger |
|
||||
_GetCLibNLMLibHandle |
|
||||
_NWRegisterNLMLibraryUser |
|
||||
_SetupArgv |
|
||||
_StartNLM |
|
||||
_TerminateNLM |
|
||||
__GetScreenID |
|
||||
__get_errno_ptr |
|
||||
exit |
|
||||
fprintf |
|
||||
getcmd |
|
||||
memcmp |
|
||||
memcpy |
|
||||
memset |
|
||||
sprintf |
|
||||
strcmp |
|
||||
strcpy |
|
||||
strlen |
|
||||
strnicmp |
|
||||
strtol |
|
||||
@ -1,100 +0,0 @@ |
|||||
#include <dfs.h> |
|
||||
#include <stdio.h> |
|
||||
#include <string.h> |
|
||||
#include <stdlib.h> |
|
||||
#include <ctype.h> |
|
||||
#include <time.h> |
|
||||
#include <conio.h> |
|
||||
#include <advanced.h> |
|
||||
#include <debugapi.h> |
|
||||
#include <process.h> |
|
||||
#include <errno.h> |
|
||||
#include "i386.h" |
|
||||
|
|
||||
extern char *mem2hex (void *mem, char *buf, int count, int may_fault); |
|
||||
extern char *hex2mem (char *buf, void *mem, int count, int may_fault); |
|
||||
extern int computeSignal (int exceptionVector); |
|
||||
|
|
||||
void |
|
||||
flush_i_cache (void) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
/* Get the registers out of the frame information. */ |
|
||||
|
|
||||
void |
|
||||
frame_to_registers (struct StackFrame *frame, char *regs) |
|
||||
{ |
|
||||
/* Copy EAX -> EDI */ |
|
||||
mem2hex (&frame->ExceptionEAX, ®s[0 * 4 * 2], 4 * 8, 0); |
|
||||
|
|
||||
/* Copy EIP & PS */ |
|
||||
mem2hex (&frame->ExceptionPC, ®s[8 * 4 * 2], 4 * 2, 0); |
|
||||
|
|
||||
/* Copy CS, SS, DS */ |
|
||||
mem2hex (&frame->ExceptionCS, ®s[10 * 4 * 2], 4 * 3, 0); |
|
||||
|
|
||||
/* Copy ES */ |
|
||||
mem2hex (&frame->ExceptionES, ®s[13 * 4 * 2], 4 * 1, 0); |
|
||||
|
|
||||
/* Copy FS & GS */ |
|
||||
mem2hex (&frame->ExceptionFS, ®s[14 * 4 * 2], 4 * 2, 0); |
|
||||
} |
|
||||
|
|
||||
/* Put the registers back into the frame information. */ |
|
||||
|
|
||||
void |
|
||||
registers_to_frame (char *regs, struct StackFrame *frame) |
|
||||
{ |
|
||||
/* Copy EAX -> EDI */ |
|
||||
hex2mem (®s[0 * 4 * 2], &frame->ExceptionEAX, 4 * 8, 0); |
|
||||
|
|
||||
/* Copy EIP & PS */ |
|
||||
hex2mem (®s[8 * 4 * 2], &frame->ExceptionPC, 4 * 2, 0); |
|
||||
|
|
||||
/* Copy CS, SS, DS */ |
|
||||
hex2mem (®s[10 * 4 * 2], &frame->ExceptionCS, 4 * 3, 0); |
|
||||
|
|
||||
/* Copy ES */ |
|
||||
hex2mem (®s[13 * 4 * 2], &frame->ExceptionES, 4 * 1, 0); |
|
||||
|
|
||||
/* Copy FS & GS */ |
|
||||
hex2mem (®s[14 * 4 * 2], &frame->ExceptionFS, 4 * 2, 0); |
|
||||
} |
|
||||
|
|
||||
void |
|
||||
set_step_traps (struct StackFrame *frame) |
|
||||
{ |
|
||||
frame->ExceptionSystemFlags |= 0x100; |
|
||||
} |
|
||||
|
|
||||
void |
|
||||
clear_step_traps (struct StackFrame *frame) |
|
||||
{ |
|
||||
frame->ExceptionSystemFlags &= ~0x100; |
|
||||
} |
|
||||
|
|
||||
void |
|
||||
do_status (char *ptr, struct StackFrame *frame) |
|
||||
{ |
|
||||
int sigval; |
|
||||
|
|
||||
sigval = computeSignal (frame->ExceptionNumber); |
|
||||
|
|
||||
sprintf (ptr, "T%02x", sigval); |
|
||||
ptr += 3; |
|
||||
|
|
||||
sprintf (ptr, "%02x:", PC_REGNUM); |
|
||||
ptr = mem2hex (&frame->ExceptionPC, ptr + 3, 4, 0); |
|
||||
*ptr++ = ';'; |
|
||||
|
|
||||
sprintf (ptr, "%02x:", SP_REGNUM); |
|
||||
ptr = mem2hex (&frame->ExceptionESP, ptr + 3, 4, 0); |
|
||||
*ptr++ = ';'; |
|
||||
|
|
||||
sprintf (ptr, "%02x:", DEPRECATED_FP_REGNUM); |
|
||||
ptr = mem2hex (&frame->ExceptionEBP, ptr + 3, 4, 0); |
|
||||
*ptr++ = ';'; |
|
||||
|
|
||||
*ptr = '\000'; |
|
||||
} |
|
||||
@ -1,13 +0,0 @@ |
|||||
/* Register values. All of these values *MUST* agree with tm.h */ |
|
||||
#define SP_REGNUM 4 /* Contains address of top of stack */ |
|
||||
#define PC_REGNUM 8 /* Contains program counter */ |
|
||||
#define DEPRECATED_FP_REGNUM 5 /* Virtual frame pointer */ |
|
||||
#define NUM_REGS 16 /* Number of machine registers */ |
|
||||
#define REGISTER_BYTES (NUM_REGS * 4) /* Total size of registers array */ |
|
||||
|
|
||||
#define ExceptionPC ExceptionEIP |
|
||||
#define DECR_PC_AFTER_BREAK 1 /* int 3 leaves PC pointing after insn */ |
|
||||
#define BREAKPOINT {0xcc} |
|
||||
#define BREAKPOINT_SIZE (sizeof breakpoint_insn) |
|
||||
|
|
||||
#define StackFrame T_TSS_StackFrame |
|
||||
@ -1,244 +0,0 @@ |
|||||
#include <stdio.h> |
|
||||
#include <string.h> |
|
||||
#include <stdlib.h> |
|
||||
#include <time.h> |
|
||||
#include <errno.h> |
|
||||
|
|
||||
#include <nwtypes.h> |
|
||||
#include <nwdfs.h> |
|
||||
#include <nwconio.h> |
|
||||
#include <nwadv.h> |
|
||||
#include <nwdbgapi.h> |
|
||||
#include <nwthread.h> |
|
||||
#include "ppc.h" |
|
||||
|
|
||||
extern char *mem2hex (void *mem, char *buf, int count, int may_fault); |
|
||||
extern char *hex2mem (char *buf, void *mem, int count, int may_fault); |
|
||||
extern int computeSignal (int exceptionVector); |
|
||||
|
|
||||
void |
|
||||
flush_i_cache (void) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
/* Get the registers out of the frame information. */ |
|
||||
|
|
||||
void |
|
||||
frame_to_registers (struct StackFrame *frame, char *regs) |
|
||||
{ |
|
||||
mem2hex (&frame->ExceptionState.CsavedRegs, ®s[GP0_REGNUM * 4 * 2], 4 * 32, 0); |
|
||||
|
|
||||
mem2hex (&frame->ExceptionState.CSavedFPRegs, ®s[FP0_REGNUM * 4 * 2], 4 * 32, 0); |
|
||||
|
|
||||
mem2hex (&frame->ExceptionPC, ®s[PC_REGNUM * 4 * 2], 4 * 1, 0); |
|
||||
|
|
||||
mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedSRR1, ®s[CR_REGNUM * 4 * 2], 4 * 1, 0); |
|
||||
mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedLR, ®s[LR_REGNUM * 4 * 2], 4 * 1, 0); |
|
||||
mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedCTR, ®s[CTR_REGNUM * 4 * 2], 4 * 1, 0); |
|
||||
mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedXER, ®s[XER_REGNUM * 4 * 2], 4 * 1, 0); |
|
||||
mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedMQ, ®s[MQ_REGNUM * 4 * 2], 4 * 1, 0); |
|
||||
} |
|
||||
|
|
||||
/* Put the registers back into the frame information. */ |
|
||||
|
|
||||
void |
|
||||
registers_to_frame (char *regs, struct StackFrame *frame) |
|
||||
{ |
|
||||
hex2mem (®s[GP0_REGNUM * 4 * 2], &frame->ExceptionState.CsavedRegs, 4 * 32, 0); |
|
||||
|
|
||||
hex2mem (®s[FP0_REGNUM * 4 * 2], &frame->ExceptionState.CSavedFPRegs, 4 * 32, 0); |
|
||||
|
|
||||
hex2mem (®s[PC_REGNUM * 4 * 2], &frame->ExceptionPC, 4 * 1, 0); |
|
||||
|
|
||||
hex2mem (®s[CR_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedSRR1, 4 * 1, 0); |
|
||||
hex2mem (®s[LR_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedLR, 4 * 1, 0); |
|
||||
hex2mem (®s[CTR_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedCTR, 4 * 1, 0); |
|
||||
hex2mem (®s[XER_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedXER, 4 * 1, 0); |
|
||||
hex2mem (®s[MQ_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedMQ, 4 * 1, 0); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
extern volatile int mem_err; |
|
||||
|
|
||||
#ifdef ALTERNATE_MEM_FUNCS |
|
||||
extern int ReadByteAltDebugger (char* addr, char *theByte); |
|
||||
extern int WriteByteAltDebugger (char* addr, char theByte); |
|
||||
int |
|
||||
get_char (char *addr) |
|
||||
{ |
|
||||
char c; |
|
||||
|
|
||||
if (!ReadByteAltDebugger (addr, &c)) |
|
||||
mem_err = 1; |
|
||||
|
|
||||
return c; |
|
||||
} |
|
||||
|
|
||||
void |
|
||||
set_char (char *addr, int val) |
|
||||
{ |
|
||||
if (!WriteByteAltDebugger (addr, val)) |
|
||||
mem_err = 1; |
|
||||
} |
|
||||
#endif |
|
||||
|
|
||||
int |
|
||||
mem_write (char *dst, char *src, int len) |
|
||||
{ |
|
||||
while (len-- && !mem_err) |
|
||||
set_char (dst++, *src++); |
|
||||
|
|
||||
return mem_err; |
|
||||
} |
|
||||
|
|
||||
union inst |
|
||||
{ |
|
||||
LONG l; |
|
||||
|
|
||||
struct |
|
||||
{ |
|
||||
union |
|
||||
{ |
|
||||
struct /* Unconditional branch */ |
|
||||
{ |
|
||||
unsigned opcode : 6; /* 18 */ |
|
||||
signed li : 24; |
|
||||
unsigned aa : 1; |
|
||||
unsigned lk : 1; |
|
||||
} b; |
|
||||
struct /* Conditional branch */ |
|
||||
{ |
|
||||
unsigned opcode : 6; /* 16 */ |
|
||||
unsigned bo : 5; |
|
||||
unsigned bi : 5; |
|
||||
signed bd : 14; |
|
||||
unsigned aa : 1; |
|
||||
unsigned lk : 1; |
|
||||
} bc; |
|
||||
struct /* Conditional branch to ctr or lr reg */ |
|
||||
{ |
|
||||
unsigned opcode : 6; /* 19 */ |
|
||||
unsigned bo : 5; |
|
||||
unsigned bi : 5; |
|
||||
unsigned type : 15; /* 528 = ctr, 16 = lr */ |
|
||||
unsigned lk : 1; |
|
||||
} bclr; |
|
||||
} variant; |
|
||||
} inst; |
|
||||
}; |
|
||||
|
|
||||
static LONG saved_inst; |
|
||||
static LONG *saved_inst_pc = 0; |
|
||||
static LONG saved_target_inst; |
|
||||
static LONG *saved_target_inst_pc = 0; |
|
||||
|
|
||||
void |
|
||||
set_step_traps (struct StackFrame *frame) |
|
||||
{ |
|
||||
union inst inst; |
|
||||
LONG *target; |
|
||||
int opcode; |
|
||||
int ra, rb; |
|
||||
LONG *pc = (LONG *)frame->ExceptionPC; |
|
||||
|
|
||||
inst.l = *pc++; |
|
||||
|
|
||||
opcode = inst.inst.variant.b.opcode; |
|
||||
|
|
||||
target = pc; |
|
||||
|
|
||||
switch (opcode) |
|
||||
{ |
|
||||
case 18: /* Unconditional branch */ |
|
||||
|
|
||||
if (inst.inst.variant.b.aa) /* Absolute? */ |
|
||||
target = 0; |
|
||||
target += inst.inst.variant.b.li; |
|
||||
|
|
||||
break; |
|
||||
case 16: /* Conditional branch */ |
|
||||
|
|
||||
if (!inst.inst.variant.bc.aa) /* Absolute? */ |
|
||||
target = 0; |
|
||||
target += inst.inst.variant.bc.bd; |
|
||||
|
|
||||
break; |
|
||||
case 19: /* Cond. branch via ctr or lr reg */ |
|
||||
switch (inst.inst.variant.bclr.type) |
|
||||
{ |
|
||||
case 528: /* ctr */ |
|
||||
target = (LONG *)frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedCTR; |
|
||||
break; |
|
||||
case 16: /* lr */ |
|
||||
target = (LONG *)frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedLR; |
|
||||
break; |
|
||||
} |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
saved_inst = *pc; |
|
||||
mem_write (pc, breakpoint_insn, BREAKPOINT_SIZE); |
|
||||
saved_inst_pc = pc; |
|
||||
|
|
||||
if (target != pc) |
|
||||
{ |
|
||||
saved_target_inst = *target; |
|
||||
mem_write (target, breakpoint_insn, BREAKPOINT_SIZE); |
|
||||
saved_target_inst_pc = target; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/* Remove step breakpoints. Returns non-zero if pc was at a step breakpoint,
|
|
||||
zero otherwise. This routine works even if there were no step breakpoints |
|
||||
set. */ |
|
||||
|
|
||||
int |
|
||||
clear_step_traps (struct StackFrame *frame) |
|
||||
{ |
|
||||
int retcode; |
|
||||
LONG *pc = (LONG *)frame->ExceptionPC; |
|
||||
|
|
||||
if (saved_inst_pc == pc || saved_target_inst_pc == pc) |
|
||||
retcode = 1; |
|
||||
else |
|
||||
retcode = 0; |
|
||||
|
|
||||
if (saved_inst_pc) |
|
||||
{ |
|
||||
mem_write (saved_inst_pc, saved_inst, BREAKPOINT_SIZE); |
|
||||
saved_inst_pc = 0; |
|
||||
} |
|
||||
|
|
||||
if (saved_target_inst_pc) |
|
||||
{ |
|
||||
mem_write (saved_target_inst_pc, saved_target_inst, BREAKPOINT_SIZE); |
|
||||
saved_target_inst_pc = 0; |
|
||||
} |
|
||||
|
|
||||
return retcode; |
|
||||
} |
|
||||
|
|
||||
void |
|
||||
do_status (char *ptr, struct StackFrame *frame) |
|
||||
{ |
|
||||
int sigval; |
|
||||
|
|
||||
sigval = computeSignal (frame->ExceptionNumber); |
|
||||
|
|
||||
sprintf (ptr, "T%02x", sigval); |
|
||||
ptr += 3; |
|
||||
|
|
||||
sprintf (ptr, "%02x:", PC_REGNUM); |
|
||||
ptr = mem2hex (&frame->ExceptionPC, ptr + 3, 4, 0); |
|
||||
*ptr++ = ';'; |
|
||||
|
|
||||
sprintf (ptr, "%02x:", SP_REGNUM); |
|
||||
ptr = mem2hex (&frame->ExceptionState.CsavedRegs[SP_REGNUM], ptr + 3, 4, 0); |
|
||||
*ptr++ = ';'; |
|
||||
|
|
||||
sprintf (ptr, "%02x:", LR_REGNUM); |
|
||||
ptr = mem2hex (&frame->ExceptionState.CsavedRegs[LR_REGNUM], ptr + 3, 4, 0); |
|
||||
*ptr++ = ';'; |
|
||||
|
|
||||
*ptr = '\000'; |
|
||||
} |
|
||||
@ -1,165 +0,0 @@ |
|||||
typedef long Long; |
|
||||
|
|
||||
/* The following enum is used to access the special registers in
|
|
||||
the saved machine state. */ |
|
||||
|
|
||||
typedef enum |
|
||||
{ |
|
||||
kDc_SavedPC = 0, /* really SRR0 */ |
|
||||
kDc_SavedMSR = 1, /* really SRR1 */ |
|
||||
kDc_SavedCR = 2, |
|
||||
kDc_SavedLR = 3, |
|
||||
kDc_SavedDSISR = 4, |
|
||||
kDc_SavedDAR = 5, |
|
||||
kDc_SavedXER = 6, |
|
||||
kDc_SavedCTR = 7, |
|
||||
kDc_SavedSDR1 = 8, |
|
||||
kDc_SavedRTCU = 9, |
|
||||
kDc_SavedRTCL = 10, |
|
||||
kDc_SavedDEC = 11, |
|
||||
kDc_SavedSR00 = 12, /* The Segement Registers are consecutive */ |
|
||||
kDc_SavedSR01 = 13, /* kDc_SavedSR00 + n is supported */ |
|
||||
kDc_SavedSR02 = 14, |
|
||||
kDc_SavedSR03 = 15, |
|
||||
kDc_SavedSR04 = 16, |
|
||||
kDc_SavedSR05 = 17, |
|
||||
kDc_SavedSR06 = 18, |
|
||||
kDc_SavedSR07 = 19, |
|
||||
kDc_SavedSR08 = 20, |
|
||||
kDc_SavedSR09 = 21, |
|
||||
kDc_SavedSR10 = 22, |
|
||||
kDc_SavedSR11 = 23, |
|
||||
kDc_SavedSR12 = 24, |
|
||||
kDc_SavedSR13 = 25, |
|
||||
kDc_SavedSR14 = 26, |
|
||||
kDc_SavedSR15 = 27, |
|
||||
kDc_SavedFPSCR = 29, |
|
||||
kDc_SavedMQ = 30, |
|
||||
kDc_SavedBAT0U = 31, |
|
||||
kDc_SavedBAT0L = 32, |
|
||||
kDc_SavedBAT1U = 33, |
|
||||
kDc_SavedBAT1L = 34, |
|
||||
kDc_SavedBAT2U = 35, |
|
||||
kDc_SavedBAT2L = 36, |
|
||||
kDc_SavedBAT3U = 37, |
|
||||
kDc_SavedBAT3L = 38, |
|
||||
|
|
||||
kNumberSpecialRegisters = 39 |
|
||||
} Dc_SavedRegisterName; |
|
||||
|
|
||||
/* Access to floating points is not very easy. This allows the number to be
|
|
||||
accessed both as a floating number and as a pair of Longs. */ |
|
||||
|
|
||||
typedef union |
|
||||
{ |
|
||||
double asfloat; /* access the variable as a floating number */ |
|
||||
struct |
|
||||
{ |
|
||||
Long high; |
|
||||
Long low; |
|
||||
} |
|
||||
asLONG; /* access the variable as two Longs */ |
|
||||
} FloatingPoints; |
|
||||
|
|
||||
/* The following is the standard record for Saving a machine state */ |
|
||||
|
|
||||
struct SavedMachineState |
|
||||
{ |
|
||||
FloatingPoints CSavedFPRegs[32]; /* The floating point registers [0->31] */ |
|
||||
/* ***32bit assumption*** */ |
|
||||
Long CsavedRegs[32]; /* space to save the General Registers */ |
|
||||
/* These are saved 0->31 */ |
|
||||
Long CexReason; |
|
||||
Long SavedDomainID; |
|
||||
union |
|
||||
{ /* must be 8-byte aligned, so doubleFPSCR is 8-byte aligned */ |
|
||||
struct |
|
||||
{ |
|
||||
Long CsavedSRR0; /* Index 0 - The saved PC */ |
|
||||
Long CsavedSRR1; /* 1 saved MSR */ |
|
||||
Long CsavedCR; /* 2 */ |
|
||||
Long CsavedLR; /* 3 */ |
|
||||
Long CsavedDSISR; /* 4 */ |
|
||||
Long CsavedDAR; /* 5 */ |
|
||||
|
|
||||
Long CsavedXER; /* 6 */ |
|
||||
Long CsavedCTR; /* 7 */ |
|
||||
Long CsavedSDR1; /* 8 */ |
|
||||
Long CsavedRTCU; /* 9 */ |
|
||||
Long CsavedRTCL; /* 10 */ |
|
||||
Long CsavedDEC; /* 11 */ |
|
||||
Long CsavedSR0; /* 12 */ |
|
||||
Long CsavedSR1; /* 13 */ |
|
||||
Long CsavedSR2; /* 14 */ |
|
||||
Long CsavedSR3; /* 15 */ |
|
||||
Long CsavedSR4; /* 16 */ |
|
||||
Long CsavedSR5; /* 17 */ |
|
||||
Long CsavedSR6; /* 18 */ |
|
||||
Long CsavedSR7; /* 19 */ |
|
||||
Long CsavedSR8; /* 20 */ |
|
||||
Long CsavedSR9; /* 21 */ |
|
||||
Long CsavedSR10; /* 22 */ |
|
||||
Long CsavedSR11; /* 23 */ |
|
||||
Long CsavedSR12; /* 24 */ |
|
||||
Long CsavedSR13; /* 25 */ |
|
||||
Long CsavedSR14; /* 26 */ |
|
||||
Long CsavedSR15; /* 27 */ |
|
||||
/* CdoubleFPSCR must be double word aligned */ |
|
||||
Long CdoubleFPSCR; /* 28 this is the upper part of the store and has
|
|
||||
no meaning */ |
|
||||
Long CsavedFPSCR; /* 29 */ |
|
||||
Long CsavedMQ; /* 30 */ |
|
||||
Long CsavedBAT0U; /* 31 */ |
|
||||
Long CsavedBAT0L; /* 32 */ |
|
||||
Long CsavedBAT1U; /* 33 */ |
|
||||
Long CsavedBAT1L; /* 34 */ |
|
||||
Long CsavedBAT2U; /* 35 */ |
|
||||
Long CsavedBAT2L; /* 36 */ |
|
||||
Long CsavedBAT3U; /* 37 */ |
|
||||
Long CsavedBAT3L; /* 38 */ |
|
||||
} |
|
||||
SpecialRegistersEnumerated; |
|
||||
|
|
||||
Long SpecialRegistersIndexed[kNumberSpecialRegisters]; |
|
||||
} u; |
|
||||
|
|
||||
Long Padding[3]; /* Needed for quad-word alignment */ |
|
||||
}; |
|
||||
|
|
||||
struct StackFrame |
|
||||
{ |
|
||||
LONG *ExceptionDomainID; |
|
||||
/*ProcessorStructure*/ int *ExceptionProcessorID; |
|
||||
BYTE *ExceptionDescription; |
|
||||
LONG ExceptionFlags; |
|
||||
LONG ExceptionErrorCode; |
|
||||
LONG ExceptionNumber; |
|
||||
struct SavedMachineState ExceptionState; |
|
||||
}; |
|
||||
|
|
||||
/* Register values. All of these values *MUST* agree with tm.h */ |
|
||||
#define GP0_REGNUM 0 /* GPR register 0 */ |
|
||||
#define SP_REGNUM 1 /* Contains address of top of stack */ |
|
||||
#define FP0_REGNUM 32 /* FPR (Floating point) register 0 */ |
|
||||
#define PC_REGNUM 64 /* Contains program counter */ |
|
||||
#define PS_REGNUM 65 /* Processor (or machine) status (%msr) */ |
|
||||
#define CR_REGNUM 66 /* Condition register */ |
|
||||
#define LR_REGNUM 67 /* Link register */ |
|
||||
#define CTR_REGNUM 68 /* Count register */ |
|
||||
#define XER_REGNUM 69 /* Fixed point exception registers */ |
|
||||
#define MQ_REGNUM 70 /* Multiply/quotient register */ |
|
||||
#define NUM_REGS 71 /* Number of machine registers */ |
|
||||
#define REGISTER_BYTES (420) /* Total size of registers array */ |
|
||||
|
|
||||
#define ExceptionPC ExceptionState.u.SpecialRegistersEnumerated.CsavedSRR0 |
|
||||
#define DECR_PC_AFTER_BREAK 0 /* PPCs get this right! */ |
|
||||
#define BREAKPOINT {0x7d, 0x82, 0x10, 0x08} |
|
||||
extern unsigned char breakpoint_insn[]; |
|
||||
#define BREAKPOINT_SIZE 4 |
|
||||
|
|
||||
#if 0 |
|
||||
#define ALTERNATE_MEM_FUNCS /* We need our own get_char/set_char */ |
|
||||
#endif |
|
||||
|
|
||||
extern int get_char (char *addr); |
|
||||
extern void set_char (char *addr, int val); |
|
||||
@ -1,67 +0,0 @@ |
|||||
/*===========================================================================
|
|
||||
= Novell Standard C Library for NetWare Loadable Modules |
|
||||
= |
|
||||
= Unpublished Copyright (C) 1993 by Novell, Inc. All rights reserved. |
|
||||
= |
|
||||
= No part of this file may be duplicated, revised, translated, localized or |
|
||||
= modified in any manner or compiled, linked or uploaded or downloaded to or |
|
||||
= from any computer system without the prior written consent of Novell, Inc. |
|
||||
============================================================================== |
|
||||
= The object produced by compiling this file is for use by the client of this |
|
||||
= library and is not linked in; Prelude.Obj is therefore one of the files to |
|
||||
= be distributed with CLib.NLM and its headers. |
|
||||
============================================================================== |
|
||||
*/ |
|
||||
|
|
||||
#include <stddef.h> |
|
||||
#if defined(__netware__) && defined(__i386__) |
|
||||
#define TERMINATE_BY_UNLOAD 5 |
|
||||
#else |
|
||||
#include <nwpre.h> |
|
||||
#endif |
|
||||
/*#include "libhooks.h"*/ |
|
||||
|
|
||||
extern int main (int, char **); |
|
||||
|
|
||||
static int NLMID; |
|
||||
|
|
||||
|
|
||||
void _Stop( void ) |
|
||||
{ |
|
||||
_TerminateNLM(NLMID, NULL, TERMINATE_BY_UNLOAD); |
|
||||
} |
|
||||
|
|
||||
int _cstart_( void ) |
|
||||
{ |
|
||||
return _SetupArgv(main); |
|
||||
} |
|
||||
|
|
||||
int _Prelude |
|
||||
( |
|
||||
int NLMHandle, |
|
||||
int initErrorScreenID, |
|
||||
char *commandLine, |
|
||||
char *loadDirectoryPath, |
|
||||
int uninitializedDataLength, |
|
||||
int NLMFileHandle, |
|
||||
int (*readRoutineP)(), |
|
||||
int customDataOffset, |
|
||||
int customDataSize |
|
||||
) |
|
||||
{ |
|
||||
int rc; |
|
||||
|
|
||||
rc = _StartNLM(NLMHandle, |
|
||||
initErrorScreenID, |
|
||||
commandLine, |
|
||||
loadDirectoryPath, |
|
||||
uninitializedDataLength, |
|
||||
NLMFileHandle, |
|
||||
readRoutineP, |
|
||||
customDataOffset, |
|
||||
customDataSize, |
|
||||
&NLMID, |
|
||||
_cstart_); |
|
||||
|
|
||||
return rc; |
|
||||
} |
|
||||
Loading…
Reference in new issue