mirror of
https://github.com/reactos/reactos.git
synced 2025-04-04 20:50:41 +00:00
Original source code for linux kernel debugger. To be ported to reactos.
svn path=/trunk/; revision=2306
This commit is contained in:
parent
f81d856c00
commit
0356076d35
67 changed files with 29771 additions and 0 deletions
1018
reactos/apps/utils/pice/loader/main.c
Normal file
1018
reactos/apps/utils/pice/loader/main.c
Normal file
File diff suppressed because it is too large
Load diff
14
reactos/apps/utils/pice/loader/makefile
Normal file
14
reactos/apps/utils/pice/loader/makefile
Normal file
|
@ -0,0 +1,14 @@
|
|||
CC = gcc
|
||||
CFLAGS := -Wall -fomit-frame-pointer -O2 -DLINUX
|
||||
LDFLAGS := -dynamic -lncurses
|
||||
|
||||
OBJS = main.o terminal.o
|
||||
|
||||
|
||||
loader: $(OBJS)
|
||||
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^
|
||||
|
||||
clean:
|
||||
@echo deleting all intermediate files
|
||||
@rm $(OBJS) loader -f
|
||||
make
|
15
reactos/apps/utils/pice/loader/retypes.h
Normal file
15
reactos/apps/utils/pice/loader/retypes.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
typedef unsigned int ULONG,*PULONG;
|
||||
typedef unsigned short USHORT,*PUSHORT;
|
||||
typedef unsigned char UCHAR,*PUCHAR;
|
||||
|
||||
typedef signed int LONG,*PLONG;
|
||||
typedef signed short SHORT,*PSHORT;
|
||||
typedef signed char CHAR,*PCHAR,*LPSTR,*PSTR;
|
||||
|
||||
typedef void VOID,*PVOID;
|
||||
|
||||
typedef char BOOLEAN,*PBOOLEAN;
|
||||
|
||||
#define FALSE (0==1)
|
||||
#define TRUE (1==1)
|
||||
|
264
reactos/apps/utils/pice/loader/stab.def
Normal file
264
reactos/apps/utils/pice/loader/stab.def
Normal file
|
@ -0,0 +1,264 @@
|
|||
/* Table of DBX symbol codes for the GNU system.
|
||||
Copyright (C) 1988, 91, 92, 93, 94, 95, 1996 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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* New stab from Solaris 2. This uses an n_type of 0, which in a.out files
|
||||
overlaps the N_UNDF used for ordinary symbols. In ELF files, the
|
||||
debug information is in a different file section, so there is no conflict.
|
||||
This symbol's n_value gives the size of the string section associated
|
||||
with this file. The symbol's n_strx (relative to the just-updated
|
||||
string section start address) gives the name of the source file,
|
||||
e.g. "foo.c", without any path information. The symbol's n_desc gives
|
||||
the count of upcoming symbols associated with this file (not including
|
||||
this one). */
|
||||
__define_stab (N_UNDF, 0x00, "UNDF")
|
||||
|
||||
/* Global variable. Only the name is significant.
|
||||
To find the address, look in the corresponding external symbol. */
|
||||
__define_stab (N_GSYM, 0x20, "GSYM")
|
||||
|
||||
/* Function name for BSD Fortran. Only the name is significant.
|
||||
To find the address, look in the corresponding external symbol. */
|
||||
__define_stab (N_FNAME, 0x22, "FNAME")
|
||||
|
||||
/* Function name or text-segment variable for C. Value is its address.
|
||||
Desc is supposedly starting line number, but GCC doesn't set it
|
||||
and DBX seems not to miss it. */
|
||||
__define_stab (N_FUN, 0x24, "FUN")
|
||||
|
||||
/* Data-segment variable with internal linkage. Value is its address.
|
||||
"Static Sym". */
|
||||
__define_stab (N_STSYM, 0x26, "STSYM")
|
||||
|
||||
/* BSS-segment variable with internal linkage. Value is its address. */
|
||||
__define_stab (N_LCSYM, 0x28, "LCSYM")
|
||||
|
||||
/* Name of main routine. Only the name is significant. */
|
||||
__define_stab (N_MAIN, 0x2a, "MAIN")
|
||||
|
||||
/* Solaris2: Read-only data symbols. */
|
||||
__define_stab (N_ROSYM, 0x2c, "ROSYM")
|
||||
|
||||
/* Global symbol in Pascal.
|
||||
Supposedly the value is its line number; I'm skeptical. */
|
||||
__define_stab (N_PC, 0x30, "PC")
|
||||
|
||||
/* Number of symbols: 0, files,,funcs,lines according to Ultrix V4.0. */
|
||||
__define_stab (N_NSYMS, 0x32, "NSYMS")
|
||||
|
||||
/* "No DST map for sym: name, ,0,type,ignored" according to Ultrix V4.0. */
|
||||
__define_stab (N_NOMAP, 0x34, "NOMAP")
|
||||
|
||||
/* New stab from Solaris 2. Like N_SO, but for the object file. Two in
|
||||
a row provide the build directory and the relative path of the .o from it.
|
||||
Solaris2 uses this to avoid putting the stabs info into the linked
|
||||
executable; this stab goes into the ".stab.index" section, and the debugger
|
||||
reads the real stabs directly from the .o files instead. */
|
||||
__define_stab (N_OBJ, 0x38, "OBJ")
|
||||
|
||||
/* New stab from Solaris 2. Options for the debugger, related to the
|
||||
source language for this module. E.g. whether to use ANSI
|
||||
integral promotions or traditional integral promotions. */
|
||||
__define_stab (N_OPT, 0x3c, "OPT")
|
||||
|
||||
/* Register variable. Value is number of register. */
|
||||
__define_stab (N_RSYM, 0x40, "RSYM")
|
||||
|
||||
/* Modula-2 compilation unit. Can someone say what info it contains? */
|
||||
__define_stab (N_M2C, 0x42, "M2C")
|
||||
|
||||
/* Line number in text segment. Desc is the line number;
|
||||
value is corresponding address. On Solaris2, the line number is
|
||||
relative to the start of the current function. */
|
||||
__define_stab (N_SLINE, 0x44, "SLINE")
|
||||
|
||||
/* Similar, for data segment. */
|
||||
__define_stab (N_DSLINE, 0x46, "DSLINE")
|
||||
|
||||
/* Similar, for bss segment. */
|
||||
__define_stab (N_BSLINE, 0x48, "BSLINE")
|
||||
|
||||
/* Sun's source-code browser stabs. ?? Don't know what the fields are.
|
||||
Supposedly the field is "path to associated .cb file". THIS VALUE
|
||||
OVERLAPS WITH N_BSLINE! */
|
||||
__define_stab_duplicate (N_BROWS, 0x48, "BROWS")
|
||||
|
||||
/* GNU Modula-2 definition module dependency. Value is the modification time
|
||||
of the definition file. Other is non-zero if it is imported with the
|
||||
GNU M2 keyword %INITIALIZE. Perhaps N_M2C can be used if there
|
||||
are enough empty fields? */
|
||||
__define_stab(N_DEFD, 0x4a, "DEFD")
|
||||
|
||||
/* New in Solaris2. Function start/body/end line numbers. */
|
||||
__define_stab(N_FLINE, 0x4C, "FLINE")
|
||||
|
||||
/* THE FOLLOWING TWO STAB VALUES CONFLICT. Happily, one is for Modula-2
|
||||
and one is for C++. Still,... */
|
||||
/* GNU C++ exception variable. Name is variable name. */
|
||||
__define_stab (N_EHDECL, 0x50, "EHDECL")
|
||||
/* Modula2 info "for imc": name,,0,0,0 according to Ultrix V4.0. */
|
||||
__define_stab_duplicate (N_MOD2, 0x50, "MOD2")
|
||||
|
||||
/* GNU C++ `catch' clause. Value is its address. Desc is nonzero if
|
||||
this entry is immediately followed by a CAUGHT stab saying what exception
|
||||
was caught. Multiple CAUGHT stabs means that multiple exceptions
|
||||
can be caught here. If Desc is 0, it means all exceptions are caught
|
||||
here. */
|
||||
__define_stab (N_CATCH, 0x54, "CATCH")
|
||||
|
||||
/* Structure or union element. Value is offset in the structure. */
|
||||
__define_stab (N_SSYM, 0x60, "SSYM")
|
||||
|
||||
/* Solaris2: Last stab emitted for module. */
|
||||
__define_stab (N_ENDM, 0x62, "ENDM")
|
||||
|
||||
/* Name of main source file.
|
||||
Value is starting text address of the compilation.
|
||||
If multiple N_SO's appear, the first to contain a trailing / is the
|
||||
compilation directory. The first to not contain a trailing / is the
|
||||
source file name, relative to the compilation directory. Others (perhaps
|
||||
resulting from cfront) are ignored.
|
||||
On Solaris2, value is undefined, but desc is a source-language code. */
|
||||
|
||||
__define_stab (N_SO, 0x64, "SO")
|
||||
|
||||
/* Automatic variable in the stack. Value is offset from frame pointer.
|
||||
Also used for type descriptions. */
|
||||
__define_stab (N_LSYM, 0x80, "LSYM")
|
||||
|
||||
/* Beginning of an include file. Only Sun uses this.
|
||||
In an object file, only the name is significant.
|
||||
The Sun linker puts data into some of the other fields. */
|
||||
__define_stab (N_BINCL, 0x82, "BINCL")
|
||||
|
||||
/* Name of sub-source file (#include file).
|
||||
Value is starting text address of the compilation. */
|
||||
__define_stab (N_SOL, 0x84, "SOL")
|
||||
|
||||
/* Parameter variable. Value is offset from argument pointer.
|
||||
(On most machines the argument pointer is the same as the frame pointer. */
|
||||
__define_stab (N_PSYM, 0xa0, "PSYM")
|
||||
|
||||
/* End of an include file. No name.
|
||||
This and N_BINCL act as brackets around the file's output.
|
||||
In an object file, there is no significant data in this entry.
|
||||
The Sun linker puts data into some of the fields. */
|
||||
__define_stab (N_EINCL, 0xa2, "EINCL")
|
||||
|
||||
/* Alternate entry point. Value is its address. */
|
||||
__define_stab (N_ENTRY, 0xa4, "ENTRY")
|
||||
|
||||
/* Beginning of lexical block.
|
||||
The desc is the nesting level in lexical blocks.
|
||||
The value is the address of the start of the text for the block.
|
||||
The variables declared inside the block *precede* the N_LBRAC symbol.
|
||||
On Solaris2, the value is relative to the start of the current function. */
|
||||
__define_stab (N_LBRAC, 0xc0, "LBRAC")
|
||||
|
||||
/* Place holder for deleted include file. Replaces a N_BINCL and everything
|
||||
up to the corresponding N_EINCL. The Sun linker generates these when
|
||||
it finds multiple identical copies of the symbols from an include file.
|
||||
This appears only in output from the Sun linker. */
|
||||
__define_stab (N_EXCL, 0xc2, "EXCL")
|
||||
|
||||
/* Modula-2 scope information. Can someone say what info it contains? */
|
||||
__define_stab (N_SCOPE, 0xc4, "SCOPE")
|
||||
|
||||
/* End of a lexical block. Desc matches the N_LBRAC's desc.
|
||||
The value is the address of the end of the text for the block.
|
||||
On Solaris2, the value is relative to the start of the current function. */
|
||||
__define_stab (N_RBRAC, 0xe0, "RBRAC")
|
||||
|
||||
/* Begin named common block. Only the name is significant. */
|
||||
__define_stab (N_BCOMM, 0xe2, "BCOMM")
|
||||
|
||||
/* End named common block. Only the name is significant
|
||||
(and it should match the N_BCOMM). */
|
||||
__define_stab (N_ECOMM, 0xe4, "ECOMM")
|
||||
|
||||
/* Member of a common block; value is offset within the common block.
|
||||
This should occur within a BCOMM/ECOMM pair. */
|
||||
__define_stab (N_ECOML, 0xe8, "ECOML")
|
||||
|
||||
/* Solaris2: Pascal "with" statement: type,,0,0,offset */
|
||||
__define_stab (N_WITH, 0xea, "WITH")
|
||||
|
||||
/* These STAB's are used on Gould systems for Non-Base register symbols
|
||||
or something like that. FIXME. I have assigned the values at random
|
||||
since I don't have a Gould here. Fixups from Gould folk welcome... */
|
||||
__define_stab (N_NBTEXT, 0xF0, "NBTEXT")
|
||||
__define_stab (N_NBDATA, 0xF2, "NBDATA")
|
||||
__define_stab (N_NBBSS, 0xF4, "NBBSS")
|
||||
__define_stab (N_NBSTS, 0xF6, "NBSTS")
|
||||
__define_stab (N_NBLCS, 0xF8, "NBLCS")
|
||||
|
||||
/* Second symbol entry containing a length-value for the preceding entry.
|
||||
The value is the length. */
|
||||
__define_stab (N_LENG, 0xfe, "LENG")
|
||||
|
||||
/* The above information, in matrix format.
|
||||
|
||||
STAB MATRIX
|
||||
_________________________________________________
|
||||
| 00 - 1F are not dbx stab symbols |
|
||||
| In most cases, the low bit is the EXTernal bit|
|
||||
|
||||
| 00 UNDEF | 02 ABS | 04 TEXT | 06 DATA |
|
||||
| 01 |EXT | 03 |EXT | 05 |EXT | 07 |EXT |
|
||||
|
||||
| 08 BSS | 0A INDR | 0C FN_SEQ | 0E WEAKA |
|
||||
| 09 |EXT | 0B | 0D WEAKU | 0F WEAKT |
|
||||
|
||||
| 10 WEAKD | 12 COMM | 14 SETA | 16 SETT |
|
||||
| 11 WEAKB | 13 | 15 | 17 |
|
||||
|
||||
| 18 SETD | 1A SETB | 1C SETV | 1E WARNING|
|
||||
| 19 | 1B | 1D | 1F FN |
|
||||
|
||||
|_______________________________________________|
|
||||
| Debug entries with bit 01 set are unused. |
|
||||
| 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM |
|
||||
| 28 LCSYM | 2A MAIN | 2C ROSYM | 2E |
|
||||
| 30 PC | 32 NSYMS | 34 NOMAP | 36 |
|
||||
| 38 OBJ | 3A | 3C OPT | 3E |
|
||||
| 40 RSYM | 42 M2C | 44 SLINE | 46 DSLINE |
|
||||
| 48 BSLINE*| 4A DEFD | 4C FLINE | 4E |
|
||||
| 50 EHDECL*| 52 | 54 CATCH | 56 |
|
||||
| 58 | 5A | 5C | 5E |
|
||||
| 60 SSYM | 62 ENDM | 64 SO | 66 |
|
||||
| 68 | 6A | 6C | 6E |
|
||||
| 70 | 72 | 74 | 76 |
|
||||
| 78 | 7A | 7C | 7E |
|
||||
| 80 LSYM | 82 BINCL | 84 SOL | 86 |
|
||||
| 88 | 8A | 8C | 8E |
|
||||
| 90 | 92 | 94 | 96 |
|
||||
| 98 | 9A | 9C | 9E |
|
||||
| A0 PSYM | A2 EINCL | A4 ENTRY | A6 |
|
||||
| A8 | AA | AC | AE |
|
||||
| B0 | B2 | B4 | B6 |
|
||||
| B8 | BA | BC | BE |
|
||||
| C0 LBRAC | C2 EXCL | C4 SCOPE | C6 |
|
||||
| C8 | CA | CC | CE |
|
||||
| D0 | D2 | D4 | D6 |
|
||||
| D8 | DA | DC | DE |
|
||||
| E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 |
|
||||
| E8 ECOML | EA WITH | EC | EE |
|
||||
| F0 | F2 | F4 | F6 |
|
||||
| F8 | FA | FC | FE LENG |
|
||||
+-----------------------------------------------+
|
||||
* 50 EHDECL is also MOD2.
|
||||
* 48 BSLINE is also BROWS.
|
||||
*/
|
37
reactos/apps/utils/pice/loader/stab_gnu.h
Normal file
37
reactos/apps/utils/pice/loader/stab_gnu.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
#ifndef __GNU_STAB__
|
||||
|
||||
/* Indicate the GNU stab.h is in use. */
|
||||
|
||||
#define __GNU_STAB__
|
||||
|
||||
#define __define_stab(NAME, CODE, STRING) NAME=CODE,
|
||||
#define __define_stab_duplicate(NAME, CODE, STRING) NAME=CODE,
|
||||
|
||||
enum __stab_debug_code
|
||||
{
|
||||
#include "stab.def"
|
||||
LAST_UNUSED_STAB_CODE
|
||||
};
|
||||
|
||||
#undef __define_stab
|
||||
|
||||
/* Definitions of "desc" field for N_SO stabs in Solaris2. */
|
||||
|
||||
#define N_SO_AS 1
|
||||
#define N_SO_C 2
|
||||
#define N_SO_ANSI_C 3
|
||||
#define N_SO_CC 4 /* C++ */
|
||||
#define N_SO_FORTRAN 5
|
||||
#define N_SO_PASCAL 6
|
||||
|
||||
/* Solaris2: Floating point type values in basic types. */
|
||||
|
||||
#define NF_NONE 0
|
||||
#define NF_SINGLE 1 /* IEEE 32-bit */
|
||||
#define NF_DOUBLE 2 /* IEEE 64-bit */
|
||||
#define NF_COMPLEX 3 /* Fortran complex */
|
||||
#define NF_COMPLEX16 4 /* Fortran double complex */
|
||||
#define NF_COMPLEX32 5 /* Fortran complex*16 */
|
||||
#define NF_LDOUBLE 6 /* Long double (whatever that is) */
|
||||
|
||||
#endif /* __GNU_STAB_ */
|
18
reactos/apps/utils/pice/loader/stdinc.h
Normal file
18
reactos/apps/utils/pice/loader/stdinc.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <linux/unistd.h>
|
||||
#include <elf.h>
|
||||
#include "stab_gnu.h"
|
||||
#include "retypes.h"
|
||||
#include "terminal.h"
|
||||
#include <termios.h>
|
||||
#include "../shared/shared.h"
|
||||
|
||||
|
428
reactos/apps/utils/pice/loader/terminal.c
Normal file
428
reactos/apps/utils/pice/loader/terminal.c
Normal file
|
@ -0,0 +1,428 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
termínal.c
|
||||
|
||||
Abstract:
|
||||
|
||||
serial terminal for pICE headless mode
|
||||
|
||||
Environment:
|
||||
|
||||
User mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
23-Jan-2001: created
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
#include "stdinc.h"
|
||||
#include <curses.h>
|
||||
|
||||
|
||||
#define CONSOLE_WIDTH (80)
|
||||
#define CONSOLE_HEIGHT (25)
|
||||
|
||||
USHORT major_version=0xFFFF,minor_version=0xFFFF,build_number=0xFFFF;
|
||||
|
||||
USHORT g_attr = 0;
|
||||
|
||||
USHORT usCurX,usCurY,xSize,ySize;
|
||||
|
||||
USHORT foreground_color_map[]=
|
||||
{
|
||||
};
|
||||
|
||||
USHORT background_color_map[]=
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
int fd_comm;
|
||||
struct termios oldtio;
|
||||
|
||||
//************************************************************************
|
||||
// CheckSum()
|
||||
//
|
||||
//************************************************************************
|
||||
UCHAR CheckSum(LPSTR p,ULONG Len)
|
||||
{
|
||||
UCHAR ucCheckSum = 0;
|
||||
ULONG i;
|
||||
for(i=0;i<Len;i++)
|
||||
{
|
||||
ucCheckSum ^= *p++;
|
||||
ucCheckSum += 1;
|
||||
}
|
||||
|
||||
return ucCheckSum;
|
||||
}
|
||||
|
||||
///************************************************************************
|
||||
// ReadByte()
|
||||
//
|
||||
///************************************************************************
|
||||
BOOLEAN ReadByte(PUCHAR pc)
|
||||
{
|
||||
return (read(fd_comm,pc,1) > 0);
|
||||
}
|
||||
|
||||
///************************************************************************
|
||||
// SendByte()
|
||||
//
|
||||
///************************************************************************
|
||||
BOOLEAN SendByte(UCHAR c)
|
||||
{
|
||||
return (write(fd_comm,&c,1) > 0);
|
||||
}
|
||||
|
||||
|
||||
///************************************************************************
|
||||
// ReadPacket()
|
||||
//
|
||||
///************************************************************************
|
||||
PSERIAL_PACKET ReadPacket(void)
|
||||
{
|
||||
ULONG i;
|
||||
PSERIAL_PACKET p;
|
||||
SERIAL_PACKET_HEADER header;
|
||||
PUCHAR pHeaderRaw,pData;
|
||||
char temp[256];
|
||||
ULONG ulCheckSum;
|
||||
|
||||
// read a packet header
|
||||
pHeaderRaw = (PUCHAR)&header;
|
||||
for(i=0;i<sizeof(SERIAL_PACKET_HEADER);i++)
|
||||
{
|
||||
// //printf("reading()\n");
|
||||
if(! ReadByte(pHeaderRaw))
|
||||
{
|
||||
// //printf("no header byte read!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pHeaderRaw++;
|
||||
}
|
||||
|
||||
//printf("received header!\n");
|
||||
|
||||
ulCheckSum = header.packet_header_chksum;
|
||||
header.packet_header_chksum = 0;
|
||||
|
||||
if(ulCheckSum != CheckSum((PUCHAR)&header,sizeof(SERIAL_PACKET_HEADER)) )
|
||||
{
|
||||
//printf("header checksum mismatch!\n");
|
||||
tcflush(fd_comm, TCIFLUSH);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = malloc(sizeof(SERIAL_PACKET_HEADER) + header.packet_size);
|
||||
if(!p)
|
||||
{
|
||||
//printf("out of memory!\n");
|
||||
return NULL;
|
||||
}
|
||||
memcpy(p,&header,sizeof(SERIAL_PACKET_HEADER));
|
||||
|
||||
sprintf(temp,"size %X chksum %x\n",header.packet_size,header.packet_chksum);
|
||||
//printf(temp);
|
||||
|
||||
// read the attached data
|
||||
pData = (PUCHAR)p + sizeof(header);
|
||||
for(i=0;i<header.packet_size;i++)
|
||||
{
|
||||
if(! ReadByte(pData))
|
||||
{
|
||||
//printf("no data byte read!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pData++;
|
||||
}
|
||||
|
||||
//printf("received data!\n");
|
||||
|
||||
pData = (PUCHAR)p + sizeof(header);
|
||||
if(header.packet_chksum != CheckSum(pData,header.packet_size))
|
||||
{
|
||||
free(p);
|
||||
p = NULL;
|
||||
//printf("data checksum mismatch!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while(!SendByte(ACK));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
///************************************************************************
|
||||
// SendPacket()
|
||||
//
|
||||
///************************************************************************
|
||||
BOOLEAN SendPacket(PSERIAL_PACKET p)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void DeletePacket(PSERIAL_PACKET p)
|
||||
{
|
||||
free(p);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
// SetupSerial()
|
||||
//
|
||||
//************************************************************************
|
||||
BOOLEAN SetupSerial(ULONG port,ULONG baudrate)
|
||||
{
|
||||
struct termios newtio;
|
||||
char* ports[]={"/dev/ttyS0","/dev/ttyS1","/dev/ttyS2","/dev/ttyS3"};
|
||||
|
||||
/*
|
||||
Open modem device for reading and writing and not as controlling tty
|
||||
because we don't want to get killed if linenoise sends CTRL-C.
|
||||
*/
|
||||
//printf("opening comm %s\n",ports[port-1]);
|
||||
fd_comm = open(ports[port-1], O_RDWR | O_NOCTTY);
|
||||
if (fd_comm <0)
|
||||
{
|
||||
perror(ports[port-1]);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
//printf("tcgetattr()\n");
|
||||
tcgetattr(fd_comm,&oldtio); /* save current modem settings */
|
||||
|
||||
/*
|
||||
Set bps rate and hardware flow control and 8n1 (8bit,no parity,1 stopbit).
|
||||
Also don't hangup automatically and ignore modem status.
|
||||
Finally enable receiving characters.
|
||||
*/
|
||||
newtio.c_cflag = baudrate | CS8 | CLOCAL | CREAD;
|
||||
|
||||
/*
|
||||
Ignore bytes with parity errors and make terminal raw and dumb.
|
||||
*/
|
||||
newtio.c_iflag = IGNPAR;
|
||||
|
||||
/*
|
||||
Raw output.
|
||||
*/
|
||||
newtio.c_oflag = 0;
|
||||
|
||||
/*
|
||||
Don't echo characters because if you connect to a host it or your
|
||||
modem will echo characters for you. Don't generate signals.
|
||||
*/
|
||||
newtio.c_lflag = 0;
|
||||
|
||||
/* blocking read until 1 char arrives */
|
||||
newtio.c_cc[VMIN]=0;
|
||||
newtio.c_cc[VTIME]=0;
|
||||
|
||||
/* now clean the modem line and activate the settings for modem */
|
||||
//printf("tcflush()\n");
|
||||
tcflush(fd_comm, TCIFLUSH);
|
||||
//printf("tcsetattr()\n");
|
||||
tcsetattr(fd_comm,TCSANOW,&newtio);
|
||||
|
||||
// NCURSES
|
||||
initscr();
|
||||
refresh();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
// CloseSerial()
|
||||
//
|
||||
//************************************************************************
|
||||
void CloseSerial(void)
|
||||
{
|
||||
// NCURSES
|
||||
endwin();
|
||||
|
||||
tcsetattr(fd_comm,TCSANOW,&oldtio); /* save current modem settings */
|
||||
close(fd_comm);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
// ClrLine()
|
||||
//
|
||||
//************************************************************************
|
||||
void ClrLine(UCHAR line)
|
||||
{
|
||||
move(line,0);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
// InvertLine()
|
||||
//
|
||||
//************************************************************************
|
||||
void InvertLine(UCHAR line)
|
||||
{
|
||||
move(line,0);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
// SetCursorPosition()
|
||||
//
|
||||
//************************************************************************
|
||||
void SetCursorPosition(USHORT x, USHORT y)
|
||||
{
|
||||
move(y,x);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
// GetCursorPosition()
|
||||
//
|
||||
//************************************************************************
|
||||
void GetCursorPosition(PUSHORT px,PUSHORT py)
|
||||
{
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
// SetCursorState()
|
||||
//
|
||||
//************************************************************************
|
||||
void SetCursorState(UCHAR c)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//************************************************************************
|
||||
// Print()
|
||||
//
|
||||
//************************************************************************
|
||||
void Print(LPSTR p,USHORT x,USHORT y)
|
||||
{
|
||||
// save the cursor pos
|
||||
GetCursorPosition(&usCurX,&usCurY);
|
||||
|
||||
if(y<25)
|
||||
{
|
||||
SetCursorPosition(x,y);
|
||||
refresh();
|
||||
|
||||
addstr(p);
|
||||
refresh();
|
||||
SetCursorPosition(usCurX,usCurY);
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
// ProcessPacket()
|
||||
//
|
||||
//************************************************************************
|
||||
void ProcessPacket(PSERIAL_PACKET p)
|
||||
{
|
||||
ULONG ulSize;
|
||||
PSERIAL_DATA_PACKET pData;
|
||||
|
||||
pData = (PSERIAL_DATA_PACKET)((PUCHAR)p + sizeof(SERIAL_PACKET_HEADER));
|
||||
ulSize = p->header.packet_size;
|
||||
|
||||
switch(pData->type)
|
||||
{
|
||||
case PACKET_TYPE_CONNECT:
|
||||
{
|
||||
PSERIAL_DATA_PACKET_CONNECT pDataConnect = (PSERIAL_DATA_PACKET_CONNECT)pData;
|
||||
UCHAR i;
|
||||
|
||||
for(i=0;i<ySize;i++)
|
||||
ClrLine(i);
|
||||
|
||||
SetCursorState(0);
|
||||
SetCursorPosition(0,0);
|
||||
// ResizeConsole(hConsole,pDataConnect->xsize,pDataConnect->ysize);
|
||||
xSize = pDataConnect->xsize;
|
||||
ySize = pDataConnect->ysize;
|
||||
}
|
||||
break;
|
||||
case PACKET_TYPE_CLRLINE:
|
||||
{
|
||||
PSERIAL_DATA_PACKET_CLRLINE pDataClrLine = (PSERIAL_DATA_PACKET_CLRLINE)pData;
|
||||
|
||||
ClrLine(pDataClrLine->line);
|
||||
}
|
||||
break;
|
||||
case PACKET_TYPE_INVERTLINE:
|
||||
{
|
||||
PSERIAL_DATA_PACKET_INVERTLINE pDataInvertLine = (PSERIAL_DATA_PACKET_INVERTLINE)pData;
|
||||
|
||||
InvertLine(pDataInvertLine->line);
|
||||
}
|
||||
break;
|
||||
case PACKET_TYPE_PRINT:
|
||||
{
|
||||
PSERIAL_DATA_PACKET_PRINT pDataPrint = (PSERIAL_DATA_PACKET_PRINT)pData;
|
||||
|
||||
Print(pDataPrint->string,pDataPrint->x,pDataPrint->y);
|
||||
}
|
||||
break;
|
||||
case PACKET_TYPE_CURSOR:
|
||||
{
|
||||
PSERIAL_DATA_PACKET_CURSOR pDataCursor = (PSERIAL_DATA_PACKET_CURSOR)pData;
|
||||
|
||||
SetCursorPosition(pDataCursor->x,pDataCursor->y);
|
||||
SetCursorState(pDataCursor->state);
|
||||
}
|
||||
break;
|
||||
case PACKET_TYPE_POLL:
|
||||
{
|
||||
PSERIAL_DATA_PACKET_POLL pDataPoll= (PSERIAL_DATA_PACKET_POLL)pData;
|
||||
|
||||
if( (major_version != pDataPoll->major_version) ||
|
||||
(minor_version != pDataPoll->minor_version) ||
|
||||
(build_number != pDataPoll->build_number) )
|
||||
{
|
||||
major_version = pDataPoll->major_version;
|
||||
minor_version = pDataPoll->minor_version;
|
||||
build_number = pDataPoll->build_number;
|
||||
|
||||
// SetAppTitle();
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//printf("UNHANDLED\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
// DebuggerShell()
|
||||
//
|
||||
//************************************************************************
|
||||
void DebuggerShell(void)
|
||||
{
|
||||
PSERIAL_PACKET p;
|
||||
|
||||
//printf("DebuggerShell()\n");
|
||||
for(;;)
|
||||
{
|
||||
p = ReadPacket();
|
||||
if(p)
|
||||
{
|
||||
ProcessPacket(p);
|
||||
DeletePacket(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
usleep(100*1000);
|
||||
}
|
||||
}
|
||||
}
|
34
reactos/apps/utils/pice/loader/terminal.h
Normal file
34
reactos/apps/utils/pice/loader/terminal.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
termínal.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for terminal.c
|
||||
|
||||
Environment:
|
||||
|
||||
User mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
23-Jan-2001: created
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
BOOLEAN SetupSerial(ULONG port,ULONG baudrate);
|
||||
void CloseSerial(void);
|
||||
|
||||
|
||||
void DebuggerShell(void);
|
2116
reactos/apps/utils/pice/module/animation.h
Normal file
2116
reactos/apps/utils/pice/module/animation.h
Normal file
File diff suppressed because it is too large
Load diff
704
reactos/apps/utils/pice/module/bp.c
Normal file
704
reactos/apps/utils/pice/module/bp.c
Normal file
|
@ -0,0 +1,704 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
bp.c
|
||||
|
||||
Abstract:
|
||||
|
||||
setting, listing and removing breakpoints
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
13-Nov-1999: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#include "remods.h"
|
||||
#include "precomp.h"
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// GLOBALS
|
||||
////
|
||||
char tempBp[1024];
|
||||
|
||||
ULONG OldInt3Handler=0;
|
||||
|
||||
SW_BP aSwBreakpoints[64]={{0,0,0,0},};
|
||||
|
||||
//*************************************************************************
|
||||
// FindSwBp()
|
||||
//
|
||||
//*************************************************************************
|
||||
PSW_BP FindSwBp(ULONG ulAddress)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
for(i=0;i<DIM(aSwBreakpoints);i++)
|
||||
{
|
||||
if(aSwBreakpoints[i].ulAddress == ulAddress && aSwBreakpoints[i].bUsed==TRUE && aSwBreakpoints[i].bVirtual==FALSE)
|
||||
return &aSwBreakpoints[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// FindEmptySwBpSlot()
|
||||
//
|
||||
//*************************************************************************
|
||||
PSW_BP FindEmptySwBpSlot(void)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++)
|
||||
{
|
||||
if(aSwBreakpoints[i].bUsed == FALSE)
|
||||
{
|
||||
return &aSwBreakpoints[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// FindVirtualSwBp()
|
||||
//
|
||||
//*************************************************************************
|
||||
PSW_BP FindVirtualSwBp(LPSTR ModName,LPSTR szFunctionName)
|
||||
{
|
||||
ULONG i;
|
||||
PSW_BP p;
|
||||
|
||||
for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++)
|
||||
{
|
||||
p = &aSwBreakpoints[i];
|
||||
|
||||
if(p->bUsed == TRUE &&
|
||||
p->bVirtual == TRUE &&
|
||||
PICE_strcmpi(p->szModName,ModName)==0 &&
|
||||
PICE_strcmpi(p->szFunctionName,szFunctionName)==0)
|
||||
{
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// IsSwBpAtAddressInstalled()
|
||||
//
|
||||
//*************************************************************************
|
||||
BOOLEAN IsSwBpAtAddressInstalled(ULONG ulAddress)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
for(i=0;i<DIM(aSwBreakpoints);i++)
|
||||
{
|
||||
if(aSwBreakpoints[i].ulAddress == ulAddress &&
|
||||
aSwBreakpoints[i].bUsed == TRUE &&
|
||||
aSwBreakpoints[i].bInstalled &&
|
||||
aSwBreakpoints[i].bVirtual == FALSE)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// IsSwBpAtAddress()
|
||||
//
|
||||
//*************************************************************************
|
||||
BOOLEAN IsSwBpAtAddress(ULONG ulAddress)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
for(i=0;i<DIM(aSwBreakpoints);i++)
|
||||
{
|
||||
if(aSwBreakpoints[i].ulAddress == ulAddress && aSwBreakpoints[i].bUsed==TRUE && aSwBreakpoints[i].bVirtual==FALSE)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// NeedToReInstallSWBreakpoints()
|
||||
//
|
||||
//*************************************************************************
|
||||
BOOLEAN NeedToReInstallSWBreakpoints(ULONG ulAddress,BOOLEAN bUseAddress)
|
||||
{
|
||||
PSW_BP p;
|
||||
BOOLEAN bResult = FALSE;
|
||||
ULONG i;
|
||||
|
||||
ENTER_FUNC();
|
||||
DPRINT((0,"NeedToReInstallSWBreakpoint() for %x (bUseAddress = %s)\n",ulAddress,bUseAddress?"TRUE":"FALSE"));
|
||||
|
||||
for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++)
|
||||
{
|
||||
p = &aSwBreakpoints[i];
|
||||
if(bUseAddress)
|
||||
{
|
||||
if(p->bUsed == TRUE && p->bInstalled == FALSE && p->ulAddress==ulAddress && p->bVirtual==FALSE)
|
||||
{
|
||||
if(IsAddressValid(p->ulAddress))
|
||||
{
|
||||
DPRINT((0,"NeedToReInstallSWBreakpoint(): [1] found BP\n"));
|
||||
bResult = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(p->bUsed == TRUE && p->bInstalled == FALSE && p->bVirtual == FALSE)
|
||||
{
|
||||
if(IsAddressValid(p->ulAddress))
|
||||
{
|
||||
DPRINT((0,"NeedToReInstallSWBreakpoint(): [2] found BP\n"));
|
||||
bResult = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// ReInstallSWBreakpoint()
|
||||
//
|
||||
//*************************************************************************
|
||||
BOOLEAN ReInstallSWBreakpoint(ULONG ulAddress)
|
||||
{
|
||||
PSW_BP p;
|
||||
BOOLEAN bResult = FALSE;
|
||||
ULONG i;
|
||||
|
||||
ENTER_FUNC();
|
||||
DPRINT((0,"ReInstallSWBreakpoint()\n"));
|
||||
|
||||
for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++)
|
||||
{
|
||||
p = &aSwBreakpoints[i];
|
||||
if(p->bUsed == TRUE && p->bInstalled == FALSE && p->ulAddress == ulAddress && p->bVirtual == FALSE)
|
||||
{
|
||||
if(IsAddressValid(p->ulAddress))
|
||||
{
|
||||
*(PUCHAR)(p->ulAddress) = 0xCC;
|
||||
p->bInstalled = TRUE;
|
||||
bResult = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// InstallSWBreakpoint()
|
||||
//
|
||||
//*************************************************************************
|
||||
BOOLEAN InstallSWBreakpoint(ULONG ulAddress,BOOLEAN bPermanent,void (*SWBreakpointCallback)(void))
|
||||
{
|
||||
PSW_BP p;
|
||||
BOOLEAN bResult = FALSE;
|
||||
|
||||
ENTER_FUNC();
|
||||
DPRINT((0,"InstallSWBreakpoint()\n"));
|
||||
|
||||
// check if page is present
|
||||
// TODO: must also check if it's a writable page
|
||||
if(IsAddressValid(ulAddress) )
|
||||
{
|
||||
DPRINT((0,"InstallSWBreakpoint(): %.8X is valid\n",ulAddress));
|
||||
if((p = FindSwBp(ulAddress))==NULL)
|
||||
{
|
||||
DPRINT((0,"InstallSWBreakpoint(): %.8X is free\n",ulAddress));
|
||||
if( (p=FindEmptySwBpSlot()) )
|
||||
{
|
||||
DPRINT((0,"InstallSWBreakpoint(): found empty slot\n"));
|
||||
|
||||
p->ucOriginalOpcode = *(PUCHAR)ulAddress;
|
||||
*(PUCHAR)ulAddress = 0xCC;
|
||||
p->bUsed = TRUE;
|
||||
p->bInstalled = TRUE;
|
||||
// find next address
|
||||
p->ulAddress = ulAddress;
|
||||
Disasm(&ulAddress,(PUCHAR)&tempBp);
|
||||
p->ulNextInstr = ulAddress;
|
||||
p->bPermanent = bPermanent;
|
||||
if(bPermanent)
|
||||
p->Callback = SWBreakpointCallback;
|
||||
else
|
||||
p->Callback = NULL;
|
||||
bResult = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT((0,"InstallSWBreakpoint(): %.8X is already used\n",ulAddress));
|
||||
if(p->bPermanent)
|
||||
{
|
||||
DPRINT((0,"InstallSWBreakpoint(): %.8X is a permanent breakpoint\n",ulAddress));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// InstallVirtualSWBreakpoint()
|
||||
//
|
||||
//*************************************************************************
|
||||
BOOLEAN InstallVirtualSWBreakpoint(LPSTR ModName,LPSTR FunctionName)
|
||||
{
|
||||
PSW_BP p;
|
||||
BOOLEAN bResult = FALSE;
|
||||
|
||||
ENTER_FUNC();
|
||||
DPRINT((0,"InstallVirtualSWBreakpoint(%s!%s)\n",ModName,FunctionName));
|
||||
|
||||
if( (p=FindEmptySwBpSlot()) )
|
||||
{
|
||||
DPRINT((0,"InstallVirtualSWBreakpoint(): found empty slot\n"));
|
||||
|
||||
p->bUsed = TRUE;
|
||||
p->bInstalled = TRUE;
|
||||
p->bVirtual = TRUE;
|
||||
p->Callback = NULL;
|
||||
PICE_strcpy(p->szModName,ModName);
|
||||
PICE_strcpy(p->szFunctionName,FunctionName);
|
||||
|
||||
bResult = TRUE;
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// TryToInstallVirtualSWBreakpoints()
|
||||
//
|
||||
//*************************************************************************
|
||||
void TryToInstallVirtualSWBreakpoints(void)
|
||||
{
|
||||
ULONG i,ulAddress;
|
||||
struct module* pMod;
|
||||
PSW_BP p;
|
||||
|
||||
DPRINT((0,"TryToInstallVirtualSWBreakpoints()\n"));
|
||||
|
||||
for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++)
|
||||
{
|
||||
p = &aSwBreakpoints[i];
|
||||
if(p->bUsed == TRUE && p->bVirtual)
|
||||
{
|
||||
if((pMod = IsModuleLoaded(p->szModName)))
|
||||
{
|
||||
if((ulAddress = FindFunctionInModuleByName(p->szFunctionName,pMod)))
|
||||
{
|
||||
if((p = FindVirtualSwBp(p->szModName,p->szFunctionName)))
|
||||
{
|
||||
ULONG ulAddressWithOffset = ulAddress+p->ulAddress;
|
||||
DPRINT((0,"TryToInstallVirtualSWBreakpoints(): ulAddressWithOffset = %x (offset = %x)\n",ulAddressWithOffset,p->ulAddress));
|
||||
|
||||
if(IsAddressValid(ulAddressWithOffset))
|
||||
{
|
||||
DPRINT((0,"TryToInstallVirtualSWBreakpoints(): installing...\n"));
|
||||
p->ucOriginalOpcode = *(PUCHAR)ulAddressWithOffset;
|
||||
*(PUCHAR)ulAddressWithOffset = 0xCC;
|
||||
p->bUsed = TRUE;
|
||||
p->bInstalled = TRUE;
|
||||
p->bVirtual = FALSE;
|
||||
// find next address
|
||||
p->ulAddress = ulAddressWithOffset;
|
||||
Disasm(&ulAddressWithOffset,(PUCHAR)&tempBp);
|
||||
p->ulNextInstr = ulAddressWithOffset;
|
||||
p->bPermanent = FALSE;
|
||||
p->Callback = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT((0,"TryToInstallVirtualSWBreakpoints(): not valid address\n"));
|
||||
PICE_memset(p,0,sizeof(*p));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// RemoveSWBreakpoint()
|
||||
//
|
||||
// removes breakpoint from breakpoint list
|
||||
//*************************************************************************
|
||||
BOOLEAN RemoveSWBreakpoint(ULONG ulAddress)
|
||||
{
|
||||
PSW_BP p;
|
||||
BOOLEAN bResult = FALSE;
|
||||
|
||||
ENTER_FUNC();
|
||||
DPRINT((0,"RemoveSWBreakpoint()\n"));
|
||||
|
||||
if( (p = FindSwBp(ulAddress)) )
|
||||
{
|
||||
if(IsAddressValid(ulAddress) && p->bInstalled == TRUE && p->bVirtual==FALSE)
|
||||
{
|
||||
// restore original opcode
|
||||
*(PUCHAR)(p->ulAddress) = p->ucOriginalOpcode;
|
||||
}
|
||||
|
||||
PICE_memset(p,0,sizeof(*p));
|
||||
|
||||
bResult = TRUE;
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// DeInstallSWBreakpoint()
|
||||
//
|
||||
//*************************************************************************
|
||||
BOOLEAN DeInstallSWBreakpoint(ULONG ulAddress)
|
||||
{
|
||||
PSW_BP p;
|
||||
BOOLEAN bResult = FALSE;
|
||||
|
||||
ENTER_FUNC();
|
||||
DPRINT((0,"DeInstallSWBreakpoint()\n"));
|
||||
|
||||
if( (p = FindSwBp(ulAddress)) )
|
||||
{
|
||||
if(IsAddressValid(ulAddress) && p->bInstalled == TRUE && p->bVirtual==FALSE)
|
||||
{
|
||||
// restore original opcode
|
||||
*(PUCHAR)(p->ulAddress) = p->ucOriginalOpcode;
|
||||
}
|
||||
|
||||
p->bInstalled = FALSE;
|
||||
|
||||
bResult = TRUE;
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// RemoveAllSWBreakpoints()
|
||||
//
|
||||
//*************************************************************************
|
||||
BOOLEAN RemoveAllSWBreakpoints(BOOLEAN bEvenPermanents)
|
||||
{
|
||||
PSW_BP p;
|
||||
BOOLEAN bResult = FALSE;
|
||||
ULONG i;
|
||||
|
||||
ENTER_FUNC();
|
||||
DPRINT((0,"RemoveAllSWBreakpoint()\n"));
|
||||
|
||||
for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++)
|
||||
{
|
||||
p = &aSwBreakpoints[i];
|
||||
if(p->bUsed == TRUE)
|
||||
{
|
||||
if(bEvenPermanents)
|
||||
{
|
||||
if(IsAddressValid(p->ulAddress) && p->bVirtual==FALSE)
|
||||
{
|
||||
*(PUCHAR)(p->ulAddress) = p->ucOriginalOpcode;
|
||||
bResult = TRUE;
|
||||
}
|
||||
PICE_memset(p,0,sizeof(*p));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!p->bPermanent)
|
||||
{
|
||||
if(IsAddressValid(p->ulAddress) && p->bVirtual==FALSE)
|
||||
{
|
||||
*(PUCHAR)(p->ulAddress) = p->ucOriginalOpcode;
|
||||
bResult = TRUE;
|
||||
}
|
||||
PICE_memset(p,0,sizeof(*p));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// IsPermanentSWBreakpoint()
|
||||
//
|
||||
//*************************************************************************
|
||||
PSW_BP IsPermanentSWBreakpoint(ULONG ulAddress)
|
||||
{
|
||||
PSW_BP p;
|
||||
ULONG i;
|
||||
|
||||
ENTER_FUNC();
|
||||
DPRINT((0,"IsPermanentSWBreakpoint(%.8X)\n",ulAddress));
|
||||
|
||||
for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(aSwBreakpoints[0]));i++)
|
||||
{
|
||||
p = &aSwBreakpoints[i];
|
||||
if(p->ulAddress == ulAddress &&
|
||||
p->bUsed == TRUE &&
|
||||
p->bPermanent == TRUE)
|
||||
{
|
||||
LEAVE_FUNC();
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// ListSWBreakpoints()
|
||||
//
|
||||
//*************************************************************************
|
||||
void ListSWBreakpoints(void)
|
||||
{
|
||||
PSW_BP p;
|
||||
ULONG i;
|
||||
LPSTR pSymbolName;
|
||||
struct module* pMod;
|
||||
|
||||
ENTER_FUNC();
|
||||
DPRINT((0,"ListSWBreakpoints()\n"));
|
||||
|
||||
for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++)
|
||||
{
|
||||
p = &aSwBreakpoints[i];
|
||||
if(p->bUsed == TRUE && p->bVirtual == FALSE)
|
||||
{
|
||||
if((pSymbolName = FindFunctionByAddress(p->ulAddress,NULL,NULL)) )
|
||||
{
|
||||
pMod = FindModuleFromAddress(p->ulAddress);
|
||||
PICE_sprintf(tempBp,"[%u] %.8X (%s!%s) %s\n",i,p->ulAddress,pMod->name,pSymbolName,p->bPermanent?"PERMANENT":"");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ScanExportsByAddress(&pSymbolName,p->ulAddress))
|
||||
PICE_sprintf(tempBp,"[%u] %.8X (%s) %s\n",i,p->ulAddress,pSymbolName,p->bPermanent?"PERMANENT":"");
|
||||
else
|
||||
PICE_sprintf(tempBp,"[%u] %.8X (no symbol) %s\n",i,p->ulAddress,p->bPermanent?"PERMANENT":"");
|
||||
}
|
||||
Print(OUTPUT_WINDOW,tempBp);
|
||||
}
|
||||
else if(p->bUsed == TRUE)
|
||||
{
|
||||
PICE_sprintf(tempBp,"[%u] xxxxxxxx (%s!%s) VIRTUAL\n",i,p->szModName,p->szFunctionName);
|
||||
Print(OUTPUT_WINDOW,tempBp);
|
||||
}
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// RevirtualizeBreakpointsForModule()
|
||||
//
|
||||
//*************************************************************************
|
||||
void RevirtualizeBreakpointsForModule(struct module* pMod)
|
||||
{
|
||||
ULONG i,start,end;
|
||||
PSW_BP p;
|
||||
|
||||
DPRINT((0,"RevirtualizeBreakpointsForModule(%x)\n",(ULONG)pMod));
|
||||
|
||||
if(IsRangeValid((ULONG)pMod,sizeof(struct module)) )
|
||||
{
|
||||
start = (ULONG)pMod;
|
||||
end = (ULONG)pMod+pMod->size;
|
||||
|
||||
DPRINT((0,"RevirtualizeBreakpointsForModule(): module %x (%x-%x)\n",(ULONG)pMod,start,end));
|
||||
// go through all breakpoints
|
||||
for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++)
|
||||
{
|
||||
p = &aSwBreakpoints[i];
|
||||
// if it's used and installed and not virtual
|
||||
if(p->bUsed && p->bInstalled && p->bVirtual == FALSE)
|
||||
{
|
||||
// make sure we're in module's bound
|
||||
if(p->ulAddress>=start && p->ulAddress<end)
|
||||
{
|
||||
LPSTR pFind;
|
||||
ULONG ulFunctionAddress;
|
||||
|
||||
DPRINT((0,"RevirtualizeBreakpointsForModule(): module breakpoint %u\n",i));
|
||||
// find the function in which this breakpoint resides
|
||||
if(ScanExportsByAddress(&pFind,p->ulAddress))
|
||||
{
|
||||
// from now on it's virtual again
|
||||
p->bVirtual = TRUE;
|
||||
if(IsAddressValid(p->ulAddress) )
|
||||
{
|
||||
DPRINT((0,"RevirtualizeBreakpointsForModule(): restoring original opcode @ %x\n",p->ulAddress));
|
||||
*(PUCHAR)(p->ulAddress) = p->ucOriginalOpcode;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT((0,"RevirtualizeBreakpointsForModule(): could not restore original opcode @ %x\n",p->ulAddress));
|
||||
}
|
||||
// skip past the module separator
|
||||
while(*pFind!='!')pFind++;
|
||||
pFind++;
|
||||
// remember the function and the module for reinstallation
|
||||
PICE_strcpy(p->szModName,(LPSTR)pMod->name);
|
||||
PICE_strcpy(p->szFunctionName,pFind);
|
||||
DPRINT((0,"RevirtualizeBreakpointsForModule(): %s!%s\n",p->szModName,p->szFunctionName));
|
||||
// if function name contains a '+' it's an offset
|
||||
pFind = p->szFunctionName;
|
||||
while(*pFind!=0)
|
||||
{
|
||||
DPRINT((0,"RevirtualizeBreakpointsForModule(): [1] %s\n",pFind));
|
||||
// found any offset to function
|
||||
if(*pFind=='+')
|
||||
{
|
||||
*pFind=0;
|
||||
break;
|
||||
}
|
||||
pFind++;
|
||||
}
|
||||
|
||||
DPRINT((0,"RevirtualizeBreakpointsForModule(): [2] %s\n",p->szFunctionName));
|
||||
if(ScanExports(p->szFunctionName,&ulFunctionAddress))
|
||||
{
|
||||
p->ulAddress -= ulFunctionAddress;
|
||||
DPRINT((0,"RevirtualizeBreakpointsForModule(): [1] function @ %x offset = %x\n",ulFunctionAddress,p->ulAddress));
|
||||
}
|
||||
else
|
||||
{
|
||||
if((ulFunctionAddress = FindFunctionInModuleByName(p->szFunctionName,pMod)) )
|
||||
{
|
||||
p->ulAddress -= ulFunctionAddress;
|
||||
DPRINT((0,"RevirtualizeBreakpointsForModule(): [2] function @ %x offset = %x\n",ulFunctionAddress,p->ulAddress));
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT((0,"RevirtualizeBreakpointsForModule(): Breakpoint %u could not be virtualized properly!\n",i));
|
||||
PICE_sprintf(tempBp,"Breakpoint %u could not be virtualized properly!\n",i);
|
||||
Print(OUTPUT_WINDOW,tempBp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT((0,"RevirtualizeBreakpointsForModule(): function for %x not found!\n",p->ulAddress));
|
||||
PICE_memset(p,0,sizeof(*p));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// NewInt3Handler()
|
||||
//
|
||||
//*************************************************************************
|
||||
__asm__ ("
|
||||
NewInt3Handler:
|
||||
pushl $" STR(REASON_INT3) "
|
||||
// call debugger loop
|
||||
jmp NewInt31Handler
|
||||
");
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// InstallInt3Hook()
|
||||
//
|
||||
//*************************************************************************
|
||||
void InstallInt3Hook(void)
|
||||
{
|
||||
ULONG LocalInt3Handler;
|
||||
|
||||
ENTER_FUNC();
|
||||
DPRINT((0,"enter InstallInt3Hook()...\n"));
|
||||
|
||||
MaskIrqs();
|
||||
if(!OldInt3Handler)
|
||||
{
|
||||
PICE_memset(aSwBreakpoints,0,sizeof(aSwBreakpoints));
|
||||
__asm__("mov $NewInt3Handler,%0"
|
||||
:"=r" (LocalInt3Handler)
|
||||
:
|
||||
:"eax");
|
||||
OldInt3Handler=SetGlobalInt(0x03,(ULONG)LocalInt3Handler);
|
||||
}
|
||||
UnmaskIrqs();
|
||||
|
||||
DPRINT((0,"leave InstallInt3Hook()...\n"));
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// DeInstallInt3Hook()
|
||||
//
|
||||
//*************************************************************************
|
||||
void DeInstallInt3Hook(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
DPRINT((0,"enter DeInstallInt3Hook()...\n"));
|
||||
|
||||
MaskIrqs();
|
||||
if(OldInt3Handler)
|
||||
{
|
||||
RemoveAllSWBreakpoints(TRUE);
|
||||
SetGlobalInt(0x03,(ULONG)OldInt3Handler);
|
||||
OldInt3Handler=0;
|
||||
}
|
||||
UnmaskIrqs();
|
||||
|
||||
DPRINT((0,"leave DeInstallInt3Hook()...\n"));
|
||||
LEAVE_FUNC();
|
||||
}
|
62
reactos/apps/utils/pice/module/bp.h
Normal file
62
reactos/apps/utils/pice/module/bp.h
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
bp.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for bp.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
typedef struct _SW_BP
|
||||
{
|
||||
ULONG ulAddress;
|
||||
ULONG ulNextInstr;
|
||||
UCHAR ucOriginalOpcode;
|
||||
BOOLEAN bUsed;
|
||||
BOOLEAN bInstalled;
|
||||
BOOLEAN bPermanent;
|
||||
BOOLEAN bVirtual;
|
||||
char szModName[128];
|
||||
char szFunctionName[128];
|
||||
void (*Callback)(void);
|
||||
}SW_BP,*PSW_BP;
|
||||
|
||||
BOOLEAN InstallSWBreakpoint(ULONG ulAddress,BOOLEAN bPermanent,void (*SWBreakpointCallback)(void));
|
||||
BOOLEAN InstallVirtualSWBreakpoint(LPSTR ModName,LPSTR Function);
|
||||
void TryToInstallVirtualSWBreakpoints(void);
|
||||
BOOLEAN DeInstallSWBreakpoint(ULONG ulAddress);
|
||||
BOOLEAN RemoveSWBreakpoint(ULONG ulAddress);
|
||||
BOOLEAN NeedToReInstallSWBreakpoints(ULONG ulAddress,BOOLEAN bUseAddress);
|
||||
BOOLEAN ReInstallSWBreakpoint(ULONG ulAddress);
|
||||
BOOLEAN RemoveAllSWBreakpoints(BOOLEAN bEvenPermanents);
|
||||
PSW_BP IsPermanentSWBreakpoint(ULONG ulAddress);
|
||||
void ListSWBreakpoints(void);
|
||||
PSW_BP FindSwBp(ULONG ulAddress);
|
||||
BOOLEAN IsSwBpAtAddress(ULONG ulAddress);
|
||||
BOOLEAN IsSwBpAtAddressInstalled(ULONG ulAddress);
|
||||
void RevirtualizeBreakpointsForModule(struct module* pMod);
|
||||
|
||||
void InstallInt3Hook(void);
|
||||
void DeInstallInt3Hook(void);
|
||||
|
2564
reactos/apps/utils/pice/module/charset.h
Normal file
2564
reactos/apps/utils/pice/module/charset.h
Normal file
File diff suppressed because it is too large
Load diff
135
reactos/apps/utils/pice/module/dblflt.c
Normal file
135
reactos/apps/utils/pice/module/dblflt.c
Normal file
|
@ -0,0 +1,135 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
dblflt.c
|
||||
|
||||
Abstract:
|
||||
|
||||
handle double faults on x86
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
13-Nov-1999: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#include "remods.h"
|
||||
#include <asm/delay.h>
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// GLOBALS
|
||||
////
|
||||
ULONG OldDblFltHandler = 0;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// FUNCTIONS
|
||||
////
|
||||
|
||||
//*************************************************************************
|
||||
// HandleDoubleFault()
|
||||
//
|
||||
//*************************************************************************
|
||||
void HandleDoubleFault(FRAME* ptr)
|
||||
{
|
||||
DPRINT((0,"HandleDoubleFault(): ptr = %x\n",ptr));
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// NewDblFltHandler()
|
||||
//
|
||||
//*************************************************************************
|
||||
__asm__ ("
|
||||
NewDblFltHandler:
|
||||
pushfl
|
||||
cli
|
||||
cld
|
||||
pushal
|
||||
pushl %ds
|
||||
|
||||
// setup default data selectors
|
||||
movw %ss,%ax
|
||||
movw %ax,%ds
|
||||
|
||||
// get frame ptr
|
||||
lea 40(%esp),%eax
|
||||
pushl %eax
|
||||
call HandleDoubleFault
|
||||
addl $4,%esp
|
||||
|
||||
popl %ds
|
||||
popal
|
||||
popfl
|
||||
// remove error code from stack and replace with reason code
|
||||
movl $" STR(REASON_DOUBLE_FAULT) ",(%esp)
|
||||
// call debugger loop
|
||||
jmp NewInt31Handler");
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// InstallDblFltHook()
|
||||
//
|
||||
//*************************************************************************
|
||||
void InstallDblFltHook(void)
|
||||
{
|
||||
ULONG LocalDblFltHandler;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
MaskIrqs();
|
||||
if(!OldDblFltHandler)
|
||||
{
|
||||
__asm__("mov $NewDblFltHandler,%0"
|
||||
:"=r" (LocalDblFltHandler)
|
||||
:
|
||||
:"eax");
|
||||
OldDblFltHandler=SetGlobalInt(0x08,(ULONG)LocalDblFltHandler);
|
||||
}
|
||||
UnmaskIrqs();
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// DeInstallDblFltHook()
|
||||
//
|
||||
//*************************************************************************
|
||||
void DeInstallDblFltHook(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
|
||||
MaskIrqs();
|
||||
if(OldDblFltHandler)
|
||||
{
|
||||
RemoveAllSWBreakpoints(TRUE);
|
||||
SetGlobalInt(0x08,(ULONG)OldDblFltHandler);
|
||||
OldDblFltHandler=0;
|
||||
}
|
||||
UnmaskIrqs();
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
// EOF
|
32
reactos/apps/utils/pice/module/dblflt.h
Normal file
32
reactos/apps/utils/pice/module/dblflt.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
dblflt.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for dblflt.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
void InstallDblFltHook(void);
|
||||
void DeInstallDblFltHook(void);
|
189
reactos/apps/utils/pice/module/debug.c
Normal file
189
reactos/apps/utils/pice/module/debug.c
Normal file
|
@ -0,0 +1,189 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
debug.c
|
||||
|
||||
Abstract:
|
||||
|
||||
debug output
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
04-Feb-1999: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#ifdef DEBUG
|
||||
#include "remods.h"
|
||||
|
||||
#include "precomp.h"
|
||||
#include <asm/io.h>
|
||||
#include <stdarg.h>
|
||||
#include "serial.h"
|
||||
#include "serial_port.h"
|
||||
|
||||
#define STANDARD_DEBUG_PREFIX "pICE: "
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// GLOBALS
|
||||
////
|
||||
LONG lDebugLevel = 0;
|
||||
ULONG ulDebugFlags;
|
||||
char tempDebug[2048];
|
||||
USHORT usDebugPortBase;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// FUNCTIONS
|
||||
////
|
||||
void DebugSendString(LPSTR s);
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// Pice_dprintf()
|
||||
//
|
||||
// internal debug print
|
||||
//*************************************************************************
|
||||
VOID Pice_dprintf(ULONG DebugLevel, PCHAR DebugMessage, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, DebugMessage);
|
||||
if (DebugLevel <= lDebugLevel)
|
||||
{
|
||||
save_flags(ulDebugFlags);
|
||||
cli();
|
||||
PICE_vsprintf(tempDebug, DebugMessage, ap);
|
||||
DebugSendString(tempDebug);
|
||||
restore_flags(ulDebugFlags);
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
// SendByte()
|
||||
//
|
||||
// Output a character to the serial port
|
||||
//************************************************************************
|
||||
BOOLEAN DebugSendByte(UCHAR x)
|
||||
{
|
||||
ULONG timeout;
|
||||
|
||||
timeout = 0x00FFFFL;
|
||||
|
||||
// Wait for transmitter to clear
|
||||
while ((inportb((USHORT)(usDebugPortBase + LSR)) & XMTRDY) == 0)
|
||||
if (!(--timeout))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
outportb((USHORT)(usDebugPortBase + TXR), x);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///************************************************************************
|
||||
// DebugSetSpeed()
|
||||
//
|
||||
///************************************************************************
|
||||
void DebugSendString(LPSTR s)
|
||||
{
|
||||
ULONG len = strlen(s),i;
|
||||
|
||||
for(i=0;i<len;i++)
|
||||
{
|
||||
DebugSendByte(s[i]);
|
||||
}
|
||||
DebugSendByte('\r');
|
||||
}
|
||||
|
||||
///************************************************************************
|
||||
// DebugSetSpeed()
|
||||
//
|
||||
///************************************************************************
|
||||
void DebugSetSpeed(ULONG baudrate)
|
||||
{
|
||||
UCHAR c;
|
||||
ULONG divisor;
|
||||
|
||||
divisor = (ULONG) (115200L/baudrate);
|
||||
|
||||
c = inportb((USHORT)(usDebugPortBase + LCR));
|
||||
outportb((USHORT)(usDebugPortBase + LCR), (UCHAR)(c | 0x80)); // Set DLAB
|
||||
outportb((USHORT)(usDebugPortBase + DLL), (UCHAR)(divisor & 0x00FF));
|
||||
outportb((USHORT)(usDebugPortBase + DLH), (UCHAR)((divisor >> 8) & 0x00FF));
|
||||
outportb((USHORT)(usDebugPortBase + LCR), c); // Reset DLAB
|
||||
|
||||
}
|
||||
|
||||
///************************************************************************
|
||||
// DebugSetOthers()
|
||||
//
|
||||
// Set other communications parameters
|
||||
//************************************************************************
|
||||
void DebugSetOthers(ULONG Parity, ULONG Bits, ULONG StopBit)
|
||||
{
|
||||
ULONG setting;
|
||||
UCHAR c;
|
||||
|
||||
if (usDebugPortBase == 0) return ;
|
||||
if (Bits < 5 || Bits > 8) return ;
|
||||
if (StopBit != 1 && StopBit != 2) return ;
|
||||
if (Parity != NO_PARITY && Parity != ODD_PARITY && Parity != EVEN_PARITY)
|
||||
return;
|
||||
|
||||
setting = Bits-5;
|
||||
setting |= ((StopBit == 1) ? 0x00 : 0x04);
|
||||
setting |= Parity;
|
||||
|
||||
c = inportb((USHORT)(usDebugPortBase + LCR));
|
||||
outportb((USHORT)(usDebugPortBase + LCR), (UCHAR)(c & ~0x80)); // Reset DLAB
|
||||
|
||||
// no ints
|
||||
outportb((USHORT)(usDebugPortBase + IER), (UCHAR)0);
|
||||
|
||||
outportb((USHORT)(usDebugPortBase + FCR), (UCHAR)0);
|
||||
|
||||
outportb((USHORT)(usDebugPortBase + LCR), (UCHAR)setting);
|
||||
|
||||
outportb((USHORT)(usDebugPortBase + MCR), DTR | RTS);
|
||||
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
///************************************************************************
|
||||
// DebugSetupSerial()
|
||||
//
|
||||
///************************************************************************
|
||||
void DebugSetupSerial(ULONG port,ULONG baudrate)
|
||||
{
|
||||
USHORT ports[]={COM1BASE,COM2BASE};
|
||||
|
||||
usDebugPortBase = ports[port-1];
|
||||
DebugSetOthers(NO_PARITY,8,1);
|
||||
DebugSetSpeed(baudrate);
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
||||
// EOF
|
47
reactos/apps/utils/pice/module/debug.h
Normal file
47
reactos/apps/utils/pice/module/debug.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
debug.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for debug.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
#ifdef DEBUG
|
||||
|
||||
#define ENTER_FUNC() DPRINT((0,"enter "__FUNCTION__"()\n"))
|
||||
|
||||
#define LEAVE_FUNC() DPRINT((0,"leave "__FUNCTION__"()\n"))
|
||||
|
||||
VOID Pice_dprintf(ULONG DebugLevel, PCHAR DebugMessage, ...);
|
||||
#define DPRINT(arg) Pice_dprintf arg
|
||||
|
||||
#else // DEBUG
|
||||
|
||||
#define ENTER_FUNC()
|
||||
#define LEAVE_FUNC()
|
||||
|
||||
#define DPRINT(arg)
|
||||
|
||||
#endif // DEBUG
|
716
reactos/apps/utils/pice/module/disassembler.c
Normal file
716
reactos/apps/utils/pice/module/disassembler.c
Normal file
|
@ -0,0 +1,716 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2000-2001 Goran Devic
|
||||
Modified (c) 2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
disassembler.c
|
||||
|
||||
Abstract:
|
||||
|
||||
line disassembler
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Goran Devic
|
||||
|
||||
Revision History:
|
||||
|
||||
17-Mar-2000: Original (Goran Devic)
|
||||
26-Apr-2000: Major rewrite, added coprocessor instructions (Goran Devic)
|
||||
04-Nov-2000: Modified for LinIce (Goran Devic)
|
||||
05-Jan-2001: Modified for pICE (Klaus P. Gerlicher)
|
||||
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Include Files *
|
||||
******************************************************************************/
|
||||
#include "remods.h"
|
||||
#include "precomp.h"
|
||||
|
||||
#include "disassemblerdata.h" // Include its own data
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This structure is used to pass parameters and options to the
|
||||
* line disassembler.
|
||||
*
|
||||
******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
ULONG dwFlags; // Generic flags (described below)
|
||||
USHORT wSel; // Selector to use to fetch code
|
||||
UCHAR *bpTarget; // Target pointer to disassemble
|
||||
UCHAR *szDisasm; // String where to put ascii result
|
||||
UCHAR Codes[20]; // Buffer where to store code UCHARs
|
||||
|
||||
UCHAR bAsciiLen; // Length of the ascii result
|
||||
UCHAR bInstrLen; // Instruction lenght in UCHARs
|
||||
|
||||
int nDisplacement; // Scanner: possible constant displacement
|
||||
int nScanEnum; // Scanner: specific flags SCAN_*
|
||||
|
||||
} TDisassembler;
|
||||
|
||||
// dwFlags contains a set of boolean flags with the following functionality
|
||||
|
||||
#define DIS_DATA32 0x0001 // Data size 16/32 bits (0/1)
|
||||
#define DIS_GETDATASIZE(flags) ((flags)&DIS_DATA32)
|
||||
#define DIS_ADDRESS32 0x0002 // Address size 16/32 bits (0/1)
|
||||
#define DIS_GETADDRSIZE(flags) (((flags)&DIS_ADDRESS32)?1:0)
|
||||
|
||||
#define DIS_SEGOVERRIDE 0x0004 // Default segment has been overriden
|
||||
|
||||
#define DIS_REP 0x0100 // Return: REP prefix found (followed by..)
|
||||
#define DIS_REPNE 0x0200 // Return: REPNE prefix found
|
||||
#define DIS_GETREPENUM(flags) (((flags)>>8)&3)
|
||||
#define DIS_ILLEGALOP 0x8000 // Return: illegal opcode
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Global Variables *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* External functions (optional) *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Local Defines, Variables and Macros *
|
||||
* *
|
||||
******************************************************************************/
|
||||
UCHAR GetUCHAR(ULONG addr)
|
||||
{
|
||||
if(IsAddressValid(addr))
|
||||
return *(PUCHAR)addr;
|
||||
else
|
||||
return 0x82; // INVALID OPCODE
|
||||
}
|
||||
|
||||
static UCHAR GetNextUCHAR(USHORT sel, UCHAR *offset, UCHAR *pCode)
|
||||
{
|
||||
pCode[0] = GetUCHAR((ULONG) offset + 0) & 0xFF;
|
||||
|
||||
return( pCode[0] );
|
||||
}
|
||||
|
||||
static USHORT GetNextUSHORT(USHORT sel, UCHAR *offset, UCHAR *pCode)
|
||||
{
|
||||
pCode[0] = GetUCHAR((ULONG) offset + 0) & 0xFF;
|
||||
pCode[1] = GetUCHAR((ULONG) offset + 1) & 0xFF;
|
||||
|
||||
return( *(USHORT *) pCode );
|
||||
}
|
||||
|
||||
static ULONG GetNextULONG(USHORT sel, UCHAR *offset, UCHAR *pCode)
|
||||
{
|
||||
pCode[0] = GetUCHAR((ULONG) offset + 0) & 0xFF;
|
||||
pCode[1] = GetUCHAR((ULONG) offset + 1) & 0xFF;
|
||||
pCode[2] = GetUCHAR((ULONG) offset + 2) & 0xFF;
|
||||
pCode[3] = GetUCHAR((ULONG) offset + 3) & 0xFF;
|
||||
|
||||
return( *(ULONG *) pCode );
|
||||
}
|
||||
|
||||
|
||||
#define NEXTUCHAR GetNextUCHAR( pDis->wSel, bpTarget, bpCode); bpCode += 1; bpTarget += 1; bInstrLen += 1
|
||||
|
||||
#define NEXTUSHORT GetNextUSHORT( pDis->wSel, bpTarget, bpCode); bpCode += 2; bpTarget += 2; bInstrLen += 2
|
||||
|
||||
#define NEXTULONG GetNextULONG(pDis->wSel, bpTarget, bpCode); bpCode += 4; bpTarget += 4; bInstrLen += 4
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Functions *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* UCHAR Disassembler( TDisassembler *pDis ); *
|
||||
* *
|
||||
*******************************************************************************
|
||||
*
|
||||
* This is a generic Intel line disassembler.
|
||||
*
|
||||
* Where:
|
||||
* TDisassembler:
|
||||
* bpTarget is the address of instruction to disassemble
|
||||
* szDisasm is the address of the buffer to print a line into
|
||||
* dwFlags contains the default operand and address bits
|
||||
* pCode is the address to store code UCHARs (up to 16)
|
||||
*
|
||||
* Disassembled instruction is stored as an ASCIIZ string pointed by
|
||||
* szDisasm pointer (from the pDis structure).
|
||||
*
|
||||
* Returns:
|
||||
* TDisassembler:
|
||||
* *szDisasm contains the disassembled instruction string
|
||||
* bAsciiLen is set to the length of the printed string
|
||||
* bInstrLen is set to instruction length in UCHARs
|
||||
* dwFlags - has operand and address size flags adjusted
|
||||
* - DIS_ILLEGALOP set if that was illegal instruction
|
||||
* UCHAR - instruction length in UCHARs
|
||||
*
|
||||
******************************************************************************/
|
||||
UCHAR Disassembler( TDisassembler *pDis )
|
||||
{
|
||||
TOpcodeData *p; // Pointer to a current instruction record
|
||||
UCHAR *bpTarget; // Pointer to the target code to be disassembled
|
||||
UCHAR *bpCode; // Pointer to code UCHARs
|
||||
ULONG arg; // Argument counter
|
||||
char *sPtr; // Message selection pointer
|
||||
int nPos; // Printing position in the output string
|
||||
UCHAR *pArg; // Pointer to record where instruction arguments are
|
||||
ULONG dwULONG; // Temporary ULONG storage
|
||||
USHORT wUSHORT; // Temporary USHORT storage
|
||||
UCHAR bUCHAR; // Temporary UCHAR storage
|
||||
UCHAR bInstrLen; // Current instruction lenght in UCHARs
|
||||
UCHAR bOpcode; // Current opcode that is being disassembled
|
||||
UCHAR bSegOverride; // 0 default segment. >0, segment index
|
||||
UCHAR bMod=0; // Mod field of the instruction
|
||||
UCHAR bReg=0; // Register field of the instruction
|
||||
UCHAR bRm=0; // R/M field of the instruction
|
||||
UCHAR bW; // Width bit for the register selection
|
||||
|
||||
UCHAR bSib; // S-I-B UCHAR for the instruction
|
||||
UCHAR bSs; // SS field of the s-i-b UCHAR
|
||||
UCHAR bIndex; // Index field of the s-i-b UCHAR
|
||||
UCHAR bBase; // Base field of the s-i-b UCHAR
|
||||
LPSTR pSymbolName; // used to symbolic name of value
|
||||
|
||||
bInstrLen = 0; // Reset instruction lenght to zero
|
||||
bSegOverride = 0; // Set default segment (no override)
|
||||
nPos = 0; // Reset printing position
|
||||
sPtr = NULL; // Points to no message by default
|
||||
bpTarget = pDis->bpTarget; // Set internal pointer to a target address
|
||||
bpCode = pDis->Codes; // Set internal pointer to code UCHARs
|
||||
|
||||
do
|
||||
{
|
||||
bOpcode = NEXTUCHAR; // Get the first opcode UCHAR from the target address
|
||||
p = &Op1[bOpcode]; // Get the address of the instruction record
|
||||
|
||||
if( p->flags & DIS_SPECIAL )
|
||||
{
|
||||
// Opcode is one of the special ones, so do what needs to be done there
|
||||
|
||||
switch( p->name )
|
||||
{
|
||||
case _EscD8:
|
||||
case _EscD9:
|
||||
case _EscDA:
|
||||
case _EscDB:
|
||||
case _EscDC:
|
||||
case _EscDD:
|
||||
case _EscDE:
|
||||
case _EscDF: // Coprocessor escape: UCHARs D8 - DF
|
||||
bOpcode = NEXTUCHAR; // Get the modRM UCHAR of the instruction
|
||||
|
||||
if( bOpcode < 0xC0 )
|
||||
{
|
||||
// Opcodes 00-BF use Coproc1 table
|
||||
|
||||
bReg = (bOpcode >> 3) & 7;
|
||||
p = &Coproc1[ p->name - _EscD8 ][ bReg ];
|
||||
|
||||
goto StartInstructionParseMODRM;
|
||||
}
|
||||
// Opcodes C0-FF use Coproc2 table
|
||||
|
||||
p = &Coproc2[ p->name - _EscD8 ][ bOpcode - 0xC0 ];
|
||||
|
||||
goto StartInstructionNoMODRM;
|
||||
|
||||
case _S_ES: // Segment override
|
||||
case _S_CS:
|
||||
case _S_SS:
|
||||
case _S_DS:
|
||||
case _S_FS:
|
||||
case _S_GS:
|
||||
bSegOverride = p->name - _S_ES + 1;
|
||||
continue;
|
||||
|
||||
case _OPSIZ: // Operand size override - toggle
|
||||
pDis->dwFlags ^= DIS_DATA32;
|
||||
continue;
|
||||
|
||||
case _ADSIZ: // Address size override - toggle
|
||||
pDis->dwFlags ^= DIS_ADDRESS32;
|
||||
continue;
|
||||
|
||||
case _REPNE: // REPNE/REPNZ prefix
|
||||
pDis->dwFlags |= DIS_REPNE;
|
||||
continue;
|
||||
|
||||
case _REP: // REP/REPE/REPZ prefix
|
||||
pDis->dwFlags |= DIS_REP;
|
||||
continue;
|
||||
|
||||
case _2BESC: // 2 UCHAR escape code 0x0F
|
||||
bOpcode = NEXTUCHAR; // Get the second UCHAR of the instruction
|
||||
p = &Op2[bOpcode]; // Get the address of the instruction record
|
||||
|
||||
if( !(p->flags & DIS_SPECIAL) ) goto StartInstruction;
|
||||
if( p->name < _GRP6 ) goto IllegalOpcode;
|
||||
|
||||
case _GRP1a: // Additional groups of instructions
|
||||
case _GRP1b:
|
||||
case _GRP1c:
|
||||
case _GRP2a:
|
||||
case _GRP2b:
|
||||
case _GRP2c:
|
||||
case _GRP2d:
|
||||
case _GRP2e:
|
||||
case _GRP2f:
|
||||
case _GRP3a:
|
||||
case _GRP3b:
|
||||
case _GRP4:
|
||||
case _GRP5:
|
||||
case _GRP6:
|
||||
case _GRP7:
|
||||
case _GRP8:
|
||||
case _GRP9:
|
||||
|
||||
bOpcode = NEXTUCHAR; // Get the Mod R/M UCHAR whose...
|
||||
// bits 3,4,5 select instruction
|
||||
|
||||
bReg = (bOpcode >> 3) & 7;
|
||||
p = &Groups[p->name - _GRP1a][ bReg ];
|
||||
|
||||
if( !(p->flags & DIS_SPECIAL) ) goto StartInstructionParseMODRM;
|
||||
|
||||
case _NDEF : // Not defined or illegal opcode
|
||||
goto IllegalOpcode;
|
||||
|
||||
default :; // Should not happen
|
||||
}
|
||||
}
|
||||
else
|
||||
goto StartInstruction;
|
||||
}
|
||||
while( bInstrLen < 15 );
|
||||
|
||||
IllegalOpcode:
|
||||
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "invalid");
|
||||
pDis->dwFlags |= DIS_ILLEGALOP;
|
||||
|
||||
goto DisEnd;
|
||||
|
||||
StartInstruction:
|
||||
|
||||
// If this instruction needs additional Mod R/M UCHAR, fetch it
|
||||
|
||||
if( p->flags & DIS_MODRM )
|
||||
{
|
||||
// Get the next UCHAR (modR/M bit field)
|
||||
bOpcode = NEXTUCHAR;
|
||||
|
||||
bReg = (bOpcode >> 3) & 7;
|
||||
|
||||
StartInstructionParseMODRM:
|
||||
|
||||
// Parse that UCHAR and get mod, reg and rm fields
|
||||
bMod = bOpcode >> 6;
|
||||
bRm = bOpcode & 7;
|
||||
}
|
||||
|
||||
StartInstructionNoMODRM:
|
||||
|
||||
// Print the possible repeat prefix followed by the instruction
|
||||
|
||||
if( p->flags & DIS_COPROC )
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%-6s ", sCoprocNames[ p->name ]);
|
||||
else
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s%-6s ",
|
||||
sRep[DIS_GETREPENUM(pDis->dwFlags)],
|
||||
sNames[ p->name + (DIS_GETNAMEFLAG(p->flags) & DIS_GETDATASIZE(pDis->dwFlags)) ] );
|
||||
|
||||
// Do instruction argument processing, up to 3 times
|
||||
|
||||
pArg = &p->dest;
|
||||
|
||||
for( arg=p->args; arg!=0; arg--, pArg++, arg? nPos += PICE_sprintf( pDis->szDisasm+nPos,", ") : 0 )
|
||||
{
|
||||
switch( *pArg )
|
||||
{
|
||||
case _Eb : // modR/M used - bW = 0
|
||||
bW = 0;
|
||||
goto _E;
|
||||
|
||||
case _Ev : // modR/M used - bW = 1
|
||||
bW = 1;
|
||||
goto _E;
|
||||
|
||||
case _Ew : // always USHORT size
|
||||
pDis->dwFlags &= ~DIS_DATA32;
|
||||
bW = 1;
|
||||
goto _E;
|
||||
|
||||
case _Ms : // fword ptr (sgdt,sidt,lgdt,lidt)
|
||||
sPtr = sFwordPtr;
|
||||
goto _E1;
|
||||
|
||||
case _Mq : // qword ptr (cmpxchg8b)
|
||||
sPtr = sQwordPtr;
|
||||
goto _E1;
|
||||
|
||||
case _Mp : // 32 or 48 bit pointer (les,lds,lfs,lss,lgs)
|
||||
case _Ep : // Always a memory pointer (call, jmp)
|
||||
if( pDis->dwFlags & DIS_DATA32 )
|
||||
sPtr = sFwordPtr;
|
||||
else
|
||||
sPtr = sDwordPtr;
|
||||
goto _E1;
|
||||
|
||||
_E:
|
||||
// Do registers first so that the rest may be done together
|
||||
if( bMod == 3 )
|
||||
{
|
||||
// Registers depending on the w field and data size
|
||||
nPos+=PICE_sprintf(pDis->szDisasm+nPos, "%s", sRegs1[DIS_GETDATASIZE(pDis->dwFlags)][bW][bRm] );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if( bW==0 )
|
||||
sPtr = sBytePtr;
|
||||
else
|
||||
if( pDis->dwFlags & DIS_DATA32 )
|
||||
sPtr = sDwordPtr;
|
||||
else
|
||||
sPtr = sWordPtr;
|
||||
|
||||
case _M : // Pure memory pointer (lea,invlpg,floats)
|
||||
if( bMod == 3 ) goto IllegalOpcode;
|
||||
|
||||
_E1:
|
||||
|
||||
if( sPtr )
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sPtr );
|
||||
|
||||
case _Ma : // Used by bound instruction, skip the pointer info
|
||||
|
||||
// Print the segment if it is overriden
|
||||
//
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s", sSegOverride[ bSegOverride ] );
|
||||
|
||||
//
|
||||
// Special case when sib UCHAR is present in 32 address encoding
|
||||
//
|
||||
if( (bRm==4) && (pDis->dwFlags & DIS_ADDRESS32) )
|
||||
{
|
||||
//
|
||||
// Get the s-i-b UCHAR and parse it
|
||||
//
|
||||
bSib = NEXTUCHAR;
|
||||
|
||||
bSs = bSib >> 6;
|
||||
bIndex = (bSib >> 3) & 7;
|
||||
bBase = bSib & 7;
|
||||
|
||||
// Special case for base=5 && mod==0 -> fetch 32 bit offset
|
||||
if( (bBase==5) && (bMod==0) )
|
||||
{
|
||||
dwULONG = NEXTULONG;
|
||||
if(ScanExportsByAddress(&pSymbolName,dwULONG))
|
||||
{
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%s", pSymbolName );
|
||||
}
|
||||
else
|
||||
{
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%08X", (unsigned int) dwULONG );
|
||||
}
|
||||
}
|
||||
else
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%s", sGenReg16_32[ 1 ][ bBase ] );
|
||||
|
||||
// Scaled index, no index if bIndex is 4
|
||||
if( bIndex != 4 )
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"+%s%s", sScale[ bSs ], sGenReg16_32[ 1 ][ bIndex ] );
|
||||
else
|
||||
if(bSs != 0)
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"<INVALID MODE>" );
|
||||
|
||||
// Offset 8 bit or 32 bit
|
||||
if( bMod == 1 )
|
||||
{
|
||||
bUCHAR = NEXTUCHAR;
|
||||
if( (signed char)bUCHAR < 0 )
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"-%02X", 0-(signed char)bUCHAR );
|
||||
else
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"+%02X", bUCHAR );
|
||||
}
|
||||
|
||||
if( bMod == 2 )
|
||||
{
|
||||
dwULONG = NEXTULONG;
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"+%08X", (unsigned int) dwULONG );
|
||||
}
|
||||
|
||||
// Wrap up the instruction
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"]" );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// 16 or 32 address bit cases with mod zero, one or two
|
||||
//
|
||||
// Special cases when r/m is 5 and mod is 0, immediate d16 or d32
|
||||
if( bMod==0 && ((bRm==6 && !(pDis->dwFlags & DIS_ADDRESS32)) || (bRm==5 && (pDis->dwFlags & DIS_ADDRESS32))) )
|
||||
{
|
||||
if( pDis->dwFlags & DIS_ADDRESS32 )
|
||||
{
|
||||
dwULONG = NEXTULONG;
|
||||
if(ScanExportsByAddress(&pSymbolName,dwULONG))
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%s]", pSymbolName );
|
||||
else
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%08X]", (unsigned int) dwULONG );
|
||||
}
|
||||
else
|
||||
{
|
||||
wUSHORT = NEXTUSHORT;
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%04X]", wUSHORT );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Print the start of the line
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%s", sAdr1[DIS_GETADDRSIZE(pDis->dwFlags)][ bRm ] );
|
||||
|
||||
// Offset (8 or 16) or (8 or 32) bit - 16, 32 bits are unsigned
|
||||
if( bMod==1 )
|
||||
{
|
||||
bUCHAR = NEXTUCHAR;
|
||||
if( (signed char)bUCHAR < 0 )
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"-%02X", 0-(signed char)bUCHAR );
|
||||
else
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"+%02X", bUCHAR );
|
||||
}
|
||||
|
||||
if( bMod==2 )
|
||||
{
|
||||
if( pDis->dwFlags & DIS_ADDRESS32 )
|
||||
{
|
||||
dwULONG = NEXTULONG;
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"+%08X", (unsigned int) dwULONG );
|
||||
}
|
||||
else
|
||||
{
|
||||
wUSHORT = NEXTUSHORT;
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"+%04X", wUSHORT );
|
||||
}
|
||||
}
|
||||
|
||||
// Wrap up the instruction
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"]" );
|
||||
|
||||
break;
|
||||
|
||||
case _Gb : // general, UCHAR register
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sRegs1[0][0][ bReg ] );
|
||||
break;
|
||||
|
||||
case _Gv : // general, (d)USHORT register
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sGenReg16_32[DIS_GETDATASIZE(pDis->dwFlags)][ bReg ] );
|
||||
break;
|
||||
|
||||
case _Yb : // ES:(E)DI pointer
|
||||
case _Yv :
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s%s", sSegOverrideDefaultES[ bSegOverride ], sYptr[DIS_GETADDRSIZE(pDis->dwFlags)] );
|
||||
break;
|
||||
|
||||
case _Xb : // DS:(E)SI pointer
|
||||
case _Xv :
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s%s", sSegOverrideDefaultDS[ bSegOverride ], sXptr[DIS_GETADDRSIZE(pDis->dwFlags)] );
|
||||
break;
|
||||
|
||||
case _Rd : // general register double USHORT
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sGenReg16_32[ 1 ][ bRm ] );
|
||||
break;
|
||||
|
||||
case _Rw : // register USHORT
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sGenReg16_32[ 0 ][ bMod ] );
|
||||
break;
|
||||
|
||||
case _Sw : // segment register
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sSeg[ bReg ] );
|
||||
break;
|
||||
|
||||
case _Cd : // control register
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sControl[ bReg ] );
|
||||
break;
|
||||
|
||||
case _Dd : // debug register
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sDebug[ bReg ] );
|
||||
break;
|
||||
|
||||
case _Td : // test register
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sTest[ bReg ] );
|
||||
break;
|
||||
|
||||
|
||||
case _Jb : // immediate UCHAR, relative offset
|
||||
bUCHAR = NEXTUCHAR;
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "short %08X", (unsigned int)(pDis->bpTarget + (signed char)bUCHAR + bInstrLen) );
|
||||
break;
|
||||
|
||||
case _Jv : // immediate USHORT or ULONG, relative offset
|
||||
if( pDis->dwFlags & DIS_DATA32 )
|
||||
{
|
||||
dwULONG = NEXTULONG;
|
||||
if(ScanExportsByAddress(&pSymbolName,(unsigned int)(pDis->bpTarget + (signed long)dwULONG + bInstrLen)))
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", pSymbolName );
|
||||
else
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%08X", (unsigned int)(pDis->bpTarget + (signed long)dwULONG + bInstrLen) );
|
||||
}
|
||||
else
|
||||
{
|
||||
wUSHORT = NEXTUSHORT;
|
||||
if(ScanExportsByAddress(&pSymbolName,(unsigned int)(pDis->bpTarget + (signed short)wUSHORT + bInstrLen)))
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", pSymbolName );
|
||||
else
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%08X", (unsigned int)(pDis->bpTarget + (signed short)wUSHORT + bInstrLen) );
|
||||
}
|
||||
break;
|
||||
|
||||
case _O : // Simple USHORT or ULONG offset
|
||||
if( pDis->dwFlags & DIS_ADDRESS32 ) // depending on the address size
|
||||
{
|
||||
dwULONG = NEXTULONG;
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s[%08X]", sSegOverride[ bSegOverride ], (unsigned int) dwULONG );
|
||||
}
|
||||
else
|
||||
{
|
||||
wUSHORT = NEXTUSHORT;
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s[%04X]", sSegOverride[ bSegOverride ], wUSHORT );
|
||||
}
|
||||
break;
|
||||
|
||||
case _Ib : // immediate UCHAR
|
||||
bUCHAR = NEXTUCHAR;
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"%02X", bUCHAR );
|
||||
break;
|
||||
|
||||
case _Iv : // immediate USHORT or ULONG
|
||||
if( pDis->dwFlags & DIS_DATA32 )
|
||||
{
|
||||
dwULONG = NEXTULONG;
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%08X", (unsigned int) dwULONG );
|
||||
}
|
||||
else
|
||||
{
|
||||
wUSHORT = NEXTUSHORT;
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%04X", wUSHORT );
|
||||
}
|
||||
break;
|
||||
|
||||
case _Iw : // Immediate USHORT
|
||||
wUSHORT = NEXTUSHORT;
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%04X", wUSHORT );
|
||||
break;
|
||||
|
||||
case _Ap : // 32 bit or 48 bit pointer (call far, jump far)
|
||||
if( pDis->dwFlags & DIS_DATA32 )
|
||||
{
|
||||
dwULONG = NEXTULONG;
|
||||
wUSHORT = NEXTUSHORT;
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%04X:%08X", wUSHORT, (unsigned int) dwULONG );
|
||||
}
|
||||
else
|
||||
{
|
||||
dwULONG = NEXTULONG;
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%08X", (unsigned int) dwULONG );
|
||||
}
|
||||
break;
|
||||
|
||||
case _1 : // numerical 1
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"1" );
|
||||
break;
|
||||
|
||||
case _3 : // numerical 3
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"3" );
|
||||
break;
|
||||
|
||||
// Hard coded registers
|
||||
case _DX: case _AL: case _AH: case _BL: case _BH: case _CL: case _CH:
|
||||
case _DL: case _DH: case _CS: case _DS: case _ES: case _SS: case _FS:
|
||||
case _GS:
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s", sRegs2[ *pArg - _DX ] );
|
||||
break;
|
||||
|
||||
case _eAX: case _eBX: case _eCX: case _eDX:
|
||||
case _eSP: case _eBP: case _eSI: case _eDI:
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sGenReg16_32[DIS_GETDATASIZE(pDis->dwFlags)][ *pArg - _eAX ]);
|
||||
break;
|
||||
|
||||
case _ST: // Coprocessor ST
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s", sST[9] );
|
||||
break;
|
||||
|
||||
case _ST0: // Coprocessor ST(0) - ST(7)
|
||||
case _ST1:
|
||||
case _ST2:
|
||||
case _ST3:
|
||||
case _ST4:
|
||||
case _ST5:
|
||||
case _ST6:
|
||||
case _ST7:
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s", sST[ *pArg - _ST0 ] );
|
||||
break;
|
||||
|
||||
case _AX: // Coprocessor AX
|
||||
nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s", sGenReg16_32[0][0] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DisEnd:
|
||||
|
||||
// Set the returning values and return with the bInstrLen field
|
||||
|
||||
pDis->bAsciiLen = (UCHAR) nPos;
|
||||
pDis->bInstrLen = bInstrLen;
|
||||
|
||||
return bInstrLen;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* BOOLEAN Disasm(PULONG pOffset,PUCHAR pchDst) *
|
||||
* *
|
||||
* entry point for disassembly from other modules *
|
||||
******************************************************************************/
|
||||
BOOLEAN Disasm(PULONG pOffset,PUCHAR pchDst)
|
||||
{
|
||||
TDisassembler dis;
|
||||
|
||||
dis.dwFlags = DIS_DATA32 | DIS_ADDRESS32;
|
||||
dis.bpTarget = (UCHAR*)*pOffset;
|
||||
dis.szDisasm = pchDst;
|
||||
dis.wSel = CurrentCS;
|
||||
|
||||
*pOffset += (ULONG)Disassembler( &dis);
|
||||
return TRUE;
|
||||
}
|
159
reactos/apps/utils/pice/module/disassembler.h
Normal file
159
reactos/apps/utils/pice/module/disassembler.h
Normal file
|
@ -0,0 +1,159 @@
|
|||
/* Operand and instruction types */
|
||||
#define OP_REG 0x100 /* register */
|
||||
#define OP_IMM 0x200 /* immediate value */
|
||||
#define OP_IND 0x300 /* indirect memory reference */
|
||||
#define OP_BPTR 0x400 /* BYTE Pointer */
|
||||
#define OP_WPTR 0x500 /* WORD Pointer */
|
||||
#define OP_DPTR 0x600 /* DWORD Pointer */
|
||||
#define OP_UNK 0x900
|
||||
//#define INS_INVALID 0x00 /* Not a valid instruction */
|
||||
/* Branch Instruction types */
|
||||
#define INS_BRANCH 0x01 /* Unconditional branch */
|
||||
#define INS_COND 0x02 /* Conditional branch */
|
||||
#define INS_SUB 0x04 /* Jump to subroutine */
|
||||
#define INS_RET 0x08 /* Return from subroutine */
|
||||
/* modify ( 'w' ) instructions */
|
||||
#define INS_ARITH 0x10 /* Arithmetic inst */
|
||||
#define INS_LOGIC 0x20 /* logical inst */
|
||||
#define INS_FPU 0x40 /* Floating Point inst */
|
||||
#define INS_FLAG 0x80 /* Modify flags */
|
||||
/* misc Instruction Types */
|
||||
#define INS_MOVE 0x0100
|
||||
#define INS_ARRAY 0x0200 /* String and XLAT ops */
|
||||
#define INS_PTR 0x0400 /* Load EA/pointer */
|
||||
#define INS_STACK 0x1000 /* PUSH, POP, etc */
|
||||
#define INS_FRAME 0x2000 /* ENTER, LEAVE, etc */
|
||||
#define INS_SYSTEM 0x4000 /* CPUID, WBINVD, etc */
|
||||
|
||||
/* Other info */
|
||||
#define BIG_ENDIAN_ORDER 0
|
||||
#define LITTLE_ENDIAN_ORDER 1
|
||||
|
||||
struct code { /* size 100 */
|
||||
unsigned long rva;
|
||||
unsigned short flags;
|
||||
char mnemonic[16];
|
||||
char dest[32];
|
||||
char src[32];
|
||||
char aux[32];
|
||||
int mnemType;
|
||||
int destType;
|
||||
int srcType;
|
||||
int auxType;
|
||||
};
|
||||
|
||||
/* struct used in Init routine */
|
||||
struct CPU_TYPE{
|
||||
char vendor;
|
||||
char model[12];
|
||||
};
|
||||
|
||||
#define cpu_80386 0x01
|
||||
#define cpu_80486 0x02
|
||||
#define cpu_PENTIUM 0x04
|
||||
#define cpu_PENTMMX 0x08
|
||||
#define cpu_PENTPRO 0x10
|
||||
#define cpu_PENTIUM2 0x20
|
||||
#define cpu_PENTIUM3 0x40
|
||||
#define cpu_PENTIUM4 0x80
|
||||
|
||||
#define FLAGS_MODRM 0x00001 //contains mod r/m byte
|
||||
#define FLAGS_8BIT 0x00002 //force 8-bit arguments
|
||||
#define FLAGS_16BIT 0x00004 //force 16-bit arguments
|
||||
#define FLAGS_32BIT 0x00008 //force 32-bit arguments
|
||||
#define FLAGS_REAL 0x00010 //real mode only
|
||||
#define FLAGS_PMODE 0x00020 //protected mode only
|
||||
#define FLAGS_PREFIX 0x00040 //for lock and rep prefix
|
||||
#define FLAGS_MMX 0x00080 //mmx instruction/registers
|
||||
#define FLAGS_FPU 0x00100 //fpu instruction/registers
|
||||
#define FLAGS_CJMP 0x00200 //codeflow - conditional jump
|
||||
#define FLAGS_JMP 0x00400 //codeflow - jump
|
||||
#define FLAGS_IJMP 0x00800 //codeflow - indexed jump
|
||||
#define FLAGS_CALL 0x01000 //codeflow - call
|
||||
#define FLAGS_ICALL 0x02000 //codeflow - indexed call
|
||||
#define FLAGS_RET 0x04000 //codeflow - return
|
||||
#define FLAGS_SEGPREFIX 0x08000 //segment prefix
|
||||
#define FLAGS_OPERPREFIX 0x10000 //operand prefix
|
||||
#define FLAGS_ADDRPREFIX 0x20000 //address prefix
|
||||
#define FLAGS_OMODE16 0x40000 //16-bit operand mode only
|
||||
#define FLAGS_OMODE32 0x80000 //32-bit operand mode only
|
||||
|
||||
enum argtype {
|
||||
ARG_REG=1,ARG_IMM,ARG_NONE,ARG_MODRM,ARG_REG_AX,
|
||||
ARG_REG_ES,ARG_REG_CS,ARG_REG_SS,ARG_REG_DS,ARG_REG_FS,ARG_REG_GS,ARG_REG_BX,
|
||||
ARG_REG_CX,ARG_REG_DX,
|
||||
ARG_REG_SP,ARG_REG_BP,ARG_REG_SI,ARG_REG_DI,ARG_IMM8,ARG_RELIMM8,ARG_FADDR,ARG_REG_AL,
|
||||
ARG_MEMLOC,ARG_SREG,ARG_RELIMM,ARG_16REG_DX,ARG_REG_CL,ARG_REG_DL,ARG_REG_BL,ARG_REG_AH,
|
||||
ARG_REG_CH,ARG_REG_DH,ARG_REG_BH,ARG_MODREG,ARG_CREG,ARG_DREG,ARG_TREG_67,ARG_TREG,
|
||||
ARG_MREG,ARG_MMXMODRM,ARG_MODRM8,ARG_IMM_1,ARG_MODRM_FPTR,ARG_MODRM_S,ARG_MODRMM512,
|
||||
ARG_MODRMQ,ARG_MODRM_SREAL,ARG_REG_ST0,ARG_FREG,ARG_MODRM_PTR,ARG_MODRM_WORD,ARG_MODRM_SINT,
|
||||
ARG_MODRM_EREAL,ARG_MODRM_DREAL,ARG_MODRM_WINT,ARG_MODRM_LINT,ARG_REG_BC,ARG_REG_DE,
|
||||
ARG_REG_HL,ARG_REG_DE_IND,ARG_REG_HL_IND,ARG_REG_BC_IND,ARG_REG_SP_IND,ARG_REG_A,
|
||||
ARG_REG_B,ARG_REG_C,ARG_REG_D,ARG_REG_E,ARG_REG_H,ARG_REG_L,ARG_IMM16,ARG_REG_AF,
|
||||
ARG_REG_AF2,ARG_MEMLOC16,ARG_IMM8_IND,ARG_BIT,ARG_REG_IX,ARG_REG_IX_IND,ARG_REG_IY,
|
||||
ARG_REG_IY_IND,ARG_REG_C_IND,ARG_REG_I,ARG_REG_R,ARG_IMM16_A,ARG_MODRM16,ARG_SIMM8,
|
||||
ARG_IMM32,ARG_STRING,ARG_MODRM_BCD,ARG_PSTRING,ARG_DOSSTRING,ARG_CUNICODESTRING,
|
||||
ARG_PUNICODESTRING,ARG_NONEBYTE,ARG_XREG,ARG_XMMMODRM};
|
||||
|
||||
typedef struct x86_inst {
|
||||
int flags;
|
||||
int destType, srcType, auxType;
|
||||
int cpu_type;
|
||||
int inst_type;
|
||||
char *mnem;
|
||||
char *dest, *src, *aux;
|
||||
} instr;
|
||||
|
||||
|
||||
#define GENREG_8 0x0001
|
||||
#define GENREG_16 0x0002
|
||||
#define GENREG_32 0x0004
|
||||
#define SEGREG 0x0008
|
||||
#define MMXREG 0x0010
|
||||
#define SIMDREG 0x0020
|
||||
#define DEBUGREG 0x0040
|
||||
#define CONTROLREG 0x0080
|
||||
#define TESTREG 0x0100
|
||||
|
||||
#define NO_REG 0x100
|
||||
#define DIRECT_REG 0x200
|
||||
#define NO_BASE 0x400
|
||||
#define NO_INDEX 0x800
|
||||
#define DISP8 0x1000
|
||||
#define DISP32 0x2000
|
||||
#define HAS_SIB 0x4000
|
||||
#define HAS_MODRM 0x8000
|
||||
|
||||
struct OPERAND { //arg1, arg2, arg3
|
||||
char * str; //temporary buffer for building arg text
|
||||
int type; //argument type
|
||||
int * flag; //pointer to CODE arg flags
|
||||
char * text; //pointer to CODE arg text
|
||||
};
|
||||
|
||||
struct EA { //effective address [SIB/disp]
|
||||
int mode, flags;
|
||||
int mod, rm, reg;
|
||||
long disp;
|
||||
char sib[32];
|
||||
};
|
||||
|
||||
struct modRM_byte {
|
||||
unsigned int mod : 2;
|
||||
unsigned int reg : 3;
|
||||
unsigned int rm : 3;
|
||||
};
|
||||
|
||||
struct SIB_byte {
|
||||
unsigned int scale : 2;
|
||||
unsigned int index : 3;
|
||||
unsigned int base : 3;
|
||||
};
|
||||
|
||||
typedef struct x86_table { //Assembly instruction tables
|
||||
instr *table; //Pointer to table of instruction encodings
|
||||
char divisor; // number to divide by for look up
|
||||
char mask; // bit mask for look up
|
||||
char minlim,maxlim; // limits on min/max entries.
|
||||
char modrmpos; // modrm byte position plus
|
||||
} asmtable;
|
1802
reactos/apps/utils/pice/module/disassemblerdata.h
Normal file
1802
reactos/apps/utils/pice/module/disassemblerdata.h
Normal file
File diff suppressed because it is too large
Load diff
515
reactos/apps/utils/pice/module/disassemblerdefines.h
Normal file
515
reactos/apps/utils/pice/module/disassemblerdefines.h
Normal file
|
@ -0,0 +1,515 @@
|
|||
/******************************************************************************
|
||||
* *
|
||||
* Module: disassemblerdefines.h *
|
||||
* *
|
||||
* Revision: 1.00 *
|
||||
* *
|
||||
* Date: 3/17/2000 *
|
||||
* *
|
||||
* Copyright (c) 2000 Goran Devic *
|
||||
* *
|
||||
* Author: Goran Devic *
|
||||
* *
|
||||
*******************************************************************************
|
||||
|
||||
Module Description:
|
||||
|
||||
This is a header file containing the disassembler defines that are
|
||||
used in DisassemblerData.h
|
||||
|
||||
*******************************************************************************
|
||||
* *
|
||||
* Changes: *
|
||||
* *
|
||||
* DATE DESCRIPTION OF CHANGES AUTHOR *
|
||||
* -------- --------------------------------------------------- ----------- *
|
||||
* 4/28/2000 Original Goran Devic *
|
||||
* 11/4/2000 Modified for LinIce Goran Devic *
|
||||
* -------- --------------------------------------------------- ----------- *
|
||||
*******************************************************************************
|
||||
* Important Defines *
|
||||
******************************************************************************/
|
||||
#ifndef _DDEF_H_
|
||||
#define _DDEF_H_
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Groups and special codes in place of name index
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _NDEF 0x00 // Udefined/reserved opcode
|
||||
#define _2BESC 0x01 // 2 byte escape code
|
||||
#define _S_ES 0x02 // Segment ES override | these defines
|
||||
#define _S_CS 0x03 // Segment CS override | must have
|
||||
#define _S_SS 0x04 // Segment SS override | consecutive
|
||||
#define _S_DS 0x05 // Segment DS override | enumeration
|
||||
#define _S_FS 0x06 // Segment FS override | numbers.
|
||||
#define _S_GS 0x07 // Segment GS override |
|
||||
#define _OPSIZ 0x08 // Operand size override
|
||||
#define _ADSIZ 0x09 // Address size override
|
||||
#define _REPNE 0x0A // REPNE/REPNZ prefix
|
||||
#define _REP 0x0B // REP/REPE/REPZ prefix
|
||||
#define _EscD8 0x0C // Escape to coprocessor set: prefix D8
|
||||
#define _EscD9 0x0D // Escape to coprocessor set: prefix D9
|
||||
#define _EscDA 0x0E // Escape to coprocessor set: prefix DA
|
||||
#define _EscDB 0x0F // Escape to coprocessor set: prefix DB
|
||||
#define _EscDC 0x10 // Escape to coprocessor set: prefix DC
|
||||
#define _EscDD 0x11 // Escape to coprocessor set: prefix DD
|
||||
#define _EscDE 0x12 // Escape to coprocessor set: prefix DE
|
||||
#define _EscDF 0x13 // Escape to coprocessor set: prefix DF
|
||||
#define _GRP1a 0x14 // Group 1a extended opcode
|
||||
#define _GRP1b 0x15 // Group 1b extended opcode
|
||||
#define _GRP1c 0x16 // Group 1c extended opcode
|
||||
#define _GRP2a 0x17 // Group 2a extended opcode
|
||||
#define _GRP2b 0x18 // Group 2b extended opcode
|
||||
#define _GRP2c 0x19 // Group 2c extended opcode
|
||||
#define _GRP2d 0x1A // Group 2d extended opcode
|
||||
#define _GRP2e 0x1B // Group 2e extended opcode
|
||||
#define _GRP2f 0x1C // Group 2f extended opcode
|
||||
#define _GRP3a 0x1D // Group 3a extended opcode
|
||||
#define _GRP3b 0x1E // Group 3b extended opcode
|
||||
#define _GRP4 0x1F // Group 4 extended opcode
|
||||
#define _GRP5 0x20 // Group 5 extended opcode
|
||||
#define _GRP6 0x21 // Group 6 extended opcode
|
||||
#define _GRP7 0x22 // Group 7 extended opcode
|
||||
#define _GRP8 0x23 // Group 8 extended opcode
|
||||
#define _GRP9 0x24 // Group 9 extended opcode
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Addressing modes argument definiton for the opcodes in a table
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _O 0x01
|
||||
|
||||
#define _Ib 0x03
|
||||
#define _Iv 0x04
|
||||
#define _Iw 0x05
|
||||
#define _Yb 0x06
|
||||
#define _Yv 0x07
|
||||
#define _Xb 0x08
|
||||
#define _Xv 0x09
|
||||
#define _Jb 0x0A
|
||||
#define _Jv 0x0B
|
||||
#define _Ap 0x0C
|
||||
#define _1 0x10
|
||||
#define _3 0x11
|
||||
#define _DX 0x12
|
||||
#define _AL 0x13
|
||||
#define _AH 0x14
|
||||
#define _BL 0x15
|
||||
#define _BH 0x16
|
||||
#define _CL 0x17
|
||||
#define _CH 0x18
|
||||
#define _DL 0x19
|
||||
#define _DH 0x1A
|
||||
#define _CS 0x1B
|
||||
#define _DS 0x1C
|
||||
#define _ES 0x1D
|
||||
#define _SS 0x1E
|
||||
#define _FS 0x1F
|
||||
#define _GS 0x20
|
||||
#define _eAX 0x21
|
||||
#define _eCX 0x22
|
||||
#define _eDX 0x23
|
||||
#define _eBX 0x24
|
||||
#define _eSP 0x25
|
||||
#define _eBP 0x26
|
||||
#define _eSI 0x27
|
||||
#define _eDI 0x28
|
||||
#define _Eb 0x2F
|
||||
#define _Ev 0x30
|
||||
#define _Ew 0x31
|
||||
#define _Ep 0x32
|
||||
#define _Gb 0x33
|
||||
#define _Gv 0x34
|
||||
#define _M 0x35
|
||||
#define _Ma 0x36
|
||||
#define _Mp 0x37
|
||||
#define _Ms 0x38
|
||||
#define _Mq 0x39
|
||||
#define _Rd 0x3A
|
||||
#define _Rw 0x3B
|
||||
#define _Sw 0x3C
|
||||
#define _Cd 0x3D
|
||||
#define _Dd 0x3E
|
||||
#define _Td 0x3F
|
||||
#define _ST 0x40
|
||||
#define _ST0 0x41
|
||||
#define _ST1 0x42
|
||||
#define _ST2 0x43
|
||||
#define _ST3 0x44
|
||||
#define _ST4 0x45
|
||||
#define _ST5 0x46
|
||||
#define _ST6 0x47
|
||||
#define _ST7 0x48
|
||||
#define _AX 0x49
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Define holding structure for opcode
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UCHAR name; // Index into the opcode name table
|
||||
UCHAR args; // Number of addressing codes that follow
|
||||
UCHAR dest; // Destination operand addressing code
|
||||
UCHAR src; // Source operand addressing code
|
||||
UCHAR thrid; // Third operand addressing code
|
||||
UCHAR v_instruction; // Virtual instruction index
|
||||
UCHAR access; // Instruction data access type
|
||||
UCHAR flags; // Miscellaneous flags
|
||||
} TOpcodeData;
|
||||
|
||||
// `access' field:
|
||||
// Data access flags are used with memory access instructions
|
||||
|
||||
#define INSTR_READ 0x80 // Faulting instruction reads memory
|
||||
#define INSTR_WRITE 0x40 // Faulting instruction writes to memory
|
||||
#define INSTR_READ_WRITE 0x20 // Faulting instruction is read-modify-write
|
||||
|
||||
// Low nibble contains the data length code - do not change these values as
|
||||
// they represent the data width value as well
|
||||
|
||||
#define INSTR_BYTE 0x01 // Byte access instruction
|
||||
#define INSTR_WORD 0x02 // Word access instruction
|
||||
#define INSTR_WORD_DWORD 0x03 // Word or dword, depending on operand size
|
||||
#define INSTR_DWORD 0x04 // Dword access instruction
|
||||
|
||||
// `flags' field:
|
||||
// Disassembler flags; bottom 4 bits are used by the scanner flags
|
||||
|
||||
#define DIS_SPECIAL 0x80 // Special opcode
|
||||
#define DIS_NAME_FLAG 0x40 // Name changes
|
||||
#define DIS_GETNAMEFLAG(flags) (((flags)>>6)&1)
|
||||
#define DIS_COPROC 0x20 // Coprocessor instruction
|
||||
#define DIS_MODRM 0x10 // Use additional Mod R/M byte
|
||||
|
||||
// Scanner enums: 4 bits wide
|
||||
|
||||
#define SCAN_NATIVE 0x0 // Native instruction are default 0
|
||||
#define SCAN_JUMP 0x1 // Evaluate new path
|
||||
#define SCAN_COND_JUMP 0x2 // Evaluate both paths
|
||||
#define SCAN_TERMINATING 0x3 // Terminating instruction needs virtualization
|
||||
#define SCAN_TERM_PMODE 0x4 // Terminating instruction in protected mode only
|
||||
#define SCAN_SINGLE_STEP 0x5 // Single-step instruction
|
||||
|
||||
// Define values stored in meta pages (bits [7:4])
|
||||
|
||||
#define META_NATIVE 0x0 // Native instruction are default 0
|
||||
#define META_UNDEF 0x1 // Undefined/illegal instruction
|
||||
#define META_TERMINATING 0x2 // Terminating instruction
|
||||
#define META_SINGLE_STEP 0x3 // Execute natively single step
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Define opcode values for the main table *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#define _aaa 0x001
|
||||
#define _aad 0x002
|
||||
#define _aam 0x003
|
||||
#define _aas 0x004
|
||||
#define _adc 0x005
|
||||
#define _add 0x006
|
||||
#define _and 0x007
|
||||
#define _arpl 0x008
|
||||
#define _bound 0x009
|
||||
#define _bsf 0x00a
|
||||
#define _bsr 0x00b
|
||||
#define _bt 0x00c
|
||||
#define _btc 0x00d
|
||||
#define _btr 0x00e
|
||||
#define _bts 0x00f
|
||||
#define _call 0x010
|
||||
#define _cbw 0x011
|
||||
#define _cwde 0x012
|
||||
#define _clc 0x013
|
||||
#define _cld 0x014
|
||||
#define _cli 0x015
|
||||
#define _clts 0x016
|
||||
#define _cmc 0x017
|
||||
#define _cmp 0x018
|
||||
#define _cmps 0x019
|
||||
#define _cmpsb 0x01a
|
||||
#define _cmpsw 0x01b
|
||||
#define _cmpsd 0x01c
|
||||
#define _cwd 0x01d
|
||||
#define _cdq 0x01e
|
||||
#define _daa 0x01f
|
||||
#define _das 0x020
|
||||
#define _dec 0x021
|
||||
#define _div 0x022
|
||||
#define _enter 0x023
|
||||
#define _hlt 0x024
|
||||
#define _idiv 0x025
|
||||
#define _imul 0x026
|
||||
#define _in 0x027
|
||||
#define _inc 0x028
|
||||
#define _ins 0x029
|
||||
#define _insb 0x02a
|
||||
#define _insw 0x02b
|
||||
#define _insd 0x02c
|
||||
#define _int 0x02d
|
||||
#define _into 0x02e
|
||||
#define _iret 0x02f
|
||||
#define _iretd 0x030
|
||||
#define _jo 0x031
|
||||
#define _jno 0x032
|
||||
#define _jb 0x033
|
||||
#define _jnb 0x034
|
||||
#define _jz 0x035
|
||||
#define _jnz 0x036
|
||||
#define _jbe 0x037
|
||||
#define _jnbe 0x038
|
||||
#define _js 0x039
|
||||
#define _jns 0x03a
|
||||
#define _jp 0x03b
|
||||
#define _jnp 0x03c
|
||||
#define _jl 0x03d
|
||||
#define _jnl 0x03e
|
||||
#define _jle 0x03f
|
||||
#define _jnle 0x040
|
||||
#define _jmp 0x041
|
||||
#define _lahf 0x042
|
||||
#define _lar 0x043
|
||||
#define _lea 0x044
|
||||
#define _leave 0x045
|
||||
#define _lgdt 0x046
|
||||
#define _lidt 0x047
|
||||
#define _lgs 0x048
|
||||
#define _lss 0x049
|
||||
#define _lds 0x04a
|
||||
#define _les 0x04b
|
||||
#define _lfs 0x04c
|
||||
#define _lldt 0x04d
|
||||
#define _lmsw 0x04e
|
||||
#define _lock 0x04f
|
||||
#define _lods 0x050
|
||||
#define _lodsb 0x051
|
||||
#define _lodsw 0x052
|
||||
#define _lodsd 0x053
|
||||
#define _loop 0x054
|
||||
#define _loope 0x055
|
||||
#define _loopz 0x056
|
||||
#define _loopne 0x057
|
||||
#define _loopnz 0x058
|
||||
#define _lsl 0x059
|
||||
#define _ltr 0x05a
|
||||
#define _mov 0x05b
|
||||
#define _movs 0x05c
|
||||
#define _movsb 0x05d
|
||||
#define _movsw 0x05e
|
||||
#define _movsd 0x05f
|
||||
#define _movsx 0x060
|
||||
#define _movzx 0x061
|
||||
#define _mul 0x062
|
||||
#define _neg 0x063
|
||||
#define _nop 0x064
|
||||
#define _not 0x065
|
||||
#define _or 0x066
|
||||
#define _out 0x067
|
||||
#define _outs 0x068
|
||||
#define _outsb 0x069
|
||||
#define _outsw 0x06a
|
||||
#define _outsd 0x06b
|
||||
#define _pop 0x06c
|
||||
#define _popa 0x06d
|
||||
#define _popad 0x06e
|
||||
#define _popf 0x06f
|
||||
#define _popfd 0x070
|
||||
#define _push 0x071
|
||||
#define _pusha 0x072
|
||||
#define _pushad 0x073
|
||||
#define _pushf 0x074
|
||||
#define _pushfd 0x075
|
||||
#define _rcl 0x076
|
||||
#define _rcr 0x077
|
||||
#define _rol 0x078
|
||||
#define _ror 0x079
|
||||
#define _rep 0x07a
|
||||
#define _repe 0x07b
|
||||
#define _repz 0x07c
|
||||
#define _repne 0x07d
|
||||
#define _repnz 0x07e
|
||||
#define _ret 0x07f
|
||||
#define _sahf 0x080
|
||||
#define _sal 0x081
|
||||
#define _sar 0x082
|
||||
#define _shl 0x083
|
||||
#define _shr 0x084
|
||||
#define _sbb 0x085
|
||||
#define _scas 0x086
|
||||
#define _scasb 0x087
|
||||
#define _scasw 0x088
|
||||
#define _scasd 0x089
|
||||
#define _set 0x08a
|
||||
#define _sgdt 0x08b
|
||||
#define _sidt 0x08c
|
||||
#define _shld 0x08d
|
||||
#define _shrd 0x08e
|
||||
#define _sldt 0x08f
|
||||
#define _smsw 0x090
|
||||
#define _stc 0x091
|
||||
#define _std 0x092
|
||||
#define _sti 0x093
|
||||
#define _stos 0x094
|
||||
#define _stosb 0x095
|
||||
#define _stosw 0x096
|
||||
#define _stosd 0x097
|
||||
#define _str 0x098
|
||||
#define _sub 0x099
|
||||
#define _test 0x09a
|
||||
#define _verr 0x09b
|
||||
#define _verw 0x09c
|
||||
#define _wait 0x09d
|
||||
#define _xchg 0x09e
|
||||
#define _xlat 0x09f
|
||||
#define _xlatb 0x0a0
|
||||
#define _xor 0x0a1
|
||||
#define _jcxz 0x0a2
|
||||
#define _loadall 0x0a3
|
||||
#define _invd 0x0a4
|
||||
#define _wbinv 0x0a5
|
||||
#define _seto 0x0a6
|
||||
#define _setno 0x0a7
|
||||
#define _setb 0x0a8
|
||||
#define _setnb 0x0a9
|
||||
#define _setz 0x0aa
|
||||
#define _setnz 0x0ab
|
||||
#define _setbe 0x0ac
|
||||
#define _setnbe 0x0ad
|
||||
#define _sets 0x0ae
|
||||
#define _setns 0x0af
|
||||
#define _setp 0x0b0
|
||||
#define _setnp 0x0b1
|
||||
#define _setl 0x0b2
|
||||
#define _setnl 0x0b3
|
||||
#define _setle 0x0b4
|
||||
#define _setnle 0x0b5
|
||||
#define _wrmsr 0x0b6
|
||||
#define _rdtsc 0x0b7
|
||||
#define _rdmsr 0x0b8
|
||||
#define _cpuid 0x0b9
|
||||
#define _rsm 0x0ba
|
||||
#define _cmpx 0x0bb
|
||||
#define _xadd 0x0bc
|
||||
#define _bswap 0x0bd
|
||||
#define _invpg 0x0be
|
||||
#define _cmpx8 0x0bf
|
||||
#define _jmpf 0x0c0
|
||||
#define _retf 0x0c1
|
||||
#define _rdpmc 0x0c2
|
||||
|
||||
#define _f2xm1 0x001
|
||||
#define _fabs 0x002
|
||||
#define _fadd 0x003
|
||||
#define _faddp 0x004
|
||||
#define _fbld 0x005
|
||||
#define _fbstp 0x006
|
||||
#define _fchs 0x007
|
||||
#define _fclex 0x008
|
||||
#define _fcom 0x009
|
||||
#define _fcomp 0x00a
|
||||
#define _fcompp 0x00b
|
||||
#define _fcos 0x00c
|
||||
#define _fdecstp 0x00d
|
||||
#define _fdiv 0x00e
|
||||
#define _fdivp 0x00f
|
||||
#define _fdivr 0x010
|
||||
#define _fdivrp 0x011
|
||||
#define _ffree 0x012
|
||||
#define _fiadd 0x013
|
||||
#define _ficom 0x014
|
||||
#define _ficomp 0x015
|
||||
#define _fidiv 0x016
|
||||
#define _fidivr 0x017
|
||||
#define _fild 0x018
|
||||
#define _fimul 0x019
|
||||
#define _fincstp 0x01a
|
||||
#define _finit 0x01b
|
||||
#define _fist 0x01c
|
||||
#define _fistp 0x01d
|
||||
#define _fisub 0x01e
|
||||
#define _fisubr 0x01f
|
||||
#define _fld 0x020
|
||||
#define _fld1 0x021
|
||||
#define _fldcw 0x022
|
||||
#define _fldenv 0x023
|
||||
#define _fldl2e 0x024
|
||||
#define _fldl2t 0x025
|
||||
#define _fldlg2 0x026
|
||||
#define _fldln2 0x027
|
||||
#define _fldpi 0x028
|
||||
#define _fldz 0x029
|
||||
#define _fmul 0x02a
|
||||
#define _fmulp 0x02b
|
||||
#define _fnop 0x02c
|
||||
#define _fpatan 0x02d
|
||||
#define _fprem 0x02e
|
||||
#define _fprem1 0x02f
|
||||
#define _fptan 0x030
|
||||
#define _frndint 0x031
|
||||
#define _frstor 0x032
|
||||
#define _fsave 0x033
|
||||
#define _fscale 0x034
|
||||
#define _fsin 0x035
|
||||
#define _fsincos 0x036
|
||||
#define _fsqrt 0x037
|
||||
#define _fst 0x038
|
||||
#define _fstcw 0x039
|
||||
#define _fstenv 0x03a
|
||||
#define _fstp 0x03b
|
||||
#define _fstsw 0x03c
|
||||
#define _fsub 0x03d
|
||||
#define _fsubp 0x03e
|
||||
#define _fsubr 0x03f
|
||||
#define _fsubrp 0x040
|
||||
#define _ftst 0x041
|
||||
#define _fucom 0x042
|
||||
#define _fucomp 0x043
|
||||
#define _fucompp 0x044
|
||||
#define _fxam 0x045
|
||||
#define _fxch 0x046
|
||||
#define _fxtract 0x047
|
||||
#define _fyl2x 0x048
|
||||
#define _fyl2xp1 0x049
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* External data and strings
|
||||
*
|
||||
******************************************************************************/
|
||||
extern char* sNames[];
|
||||
extern char* sCoprocNames[];
|
||||
extern TOpcodeData Op1[ 256 ];
|
||||
extern TOpcodeData Op2[ 256 ];
|
||||
extern TOpcodeData Groups[ 17 ][ 8 ];
|
||||
extern TOpcodeData Coproc1[ 8 ][ 8 ];
|
||||
extern TOpcodeData Coproc2[ 8 ][ 16 * 4 ];
|
||||
extern char *sBytePtr;
|
||||
extern char *sWordPtr;
|
||||
extern char *sDwordPtr;
|
||||
extern char *sFwordPtr;
|
||||
extern char *sQwordPtr;
|
||||
extern char *sGenReg16_32[ 2 ][ 8 ];
|
||||
extern char *sSeg[ 8 ];
|
||||
extern char *sSegOverride[ 8 ];
|
||||
extern char *sSegOverrideDefaultES[ 8 ];
|
||||
extern char *sSegOverrideDefaultDS[ 8 ];
|
||||
extern char *sScale[ 4 ];
|
||||
extern char *sAdr1[ 2 ][ 8 ];
|
||||
extern char *sRegs1[ 2 ][ 2 ][ 8 ];
|
||||
extern char *sRegs2[];
|
||||
extern char *sControl[ 8 ];
|
||||
extern char *sDebug[ 8 ];
|
||||
extern char *sTest[ 8 ];
|
||||
extern char *sYptr[ 2 ];
|
||||
extern char *sXptr[ 2 ];
|
||||
extern char *sRep[ 4 ];
|
||||
extern char *sST[ 9 ];
|
||||
|
||||
|
||||
#endif // _DDEF_H_
|
135
reactos/apps/utils/pice/module/gpfault.c
Normal file
135
reactos/apps/utils/pice/module/gpfault.c
Normal file
|
@ -0,0 +1,135 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
GPFault.c
|
||||
|
||||
Abstract:
|
||||
|
||||
handle general protection faults on x86
|
||||
|
||||
Environment:
|
||||
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
13-Nov-1999: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#include "remods.h"
|
||||
#include <asm/delay.h>
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// GLOBALS
|
||||
////
|
||||
ULONG OldGPFaultHandler = 0;
|
||||
|
||||
char tempGP[1024];
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// FUNCTIONS
|
||||
////
|
||||
|
||||
//*************************************************************************
|
||||
// NewGPFaultHandler()
|
||||
//
|
||||
//*************************************************************************
|
||||
void HandleGPFault(FRAME* ptr)
|
||||
{
|
||||
DPRINT((0,"HandleGPFault(): ptr = %x\n",ptr));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// NewGPFaultHandler()
|
||||
//
|
||||
//*************************************************************************
|
||||
__asm__ ("
|
||||
NewGPFaultHandler:
|
||||
pushfl
|
||||
cli
|
||||
cld
|
||||
pushal
|
||||
pushl %ds
|
||||
|
||||
// setup default data selectors
|
||||
movw %ss,%ax
|
||||
movw %ax,%ds
|
||||
|
||||
// get frame ptr
|
||||
lea 40(%esp),%eax
|
||||
pushl %eax
|
||||
call HandleGPFault
|
||||
addl $4,%esp
|
||||
|
||||
popl %ds
|
||||
popal
|
||||
popfl
|
||||
// remove error code from stack and replace with reason code
|
||||
movl $" STR(REASON_GP_FAULT) ",(%esp)
|
||||
// call debugger loop
|
||||
jmp NewInt31Handler");
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// InstallGPFaultHook()
|
||||
//
|
||||
//*************************************************************************
|
||||
void InstallGPFaultHook(void)
|
||||
{
|
||||
ULONG LocalGPFaultHandler;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
MaskIrqs();
|
||||
if(!OldGPFaultHandler)
|
||||
{
|
||||
__asm__("mov $NewGPFaultHandler,%0"
|
||||
:"=r" (LocalGPFaultHandler)
|
||||
:
|
||||
:"eax");
|
||||
OldGPFaultHandler=SetGlobalInt(0x0D,(ULONG)LocalGPFaultHandler);
|
||||
}
|
||||
UnmaskIrqs();
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// DeInstallGPFaultHook()
|
||||
//
|
||||
//*************************************************************************
|
||||
void DeInstallGPFaultHook(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
|
||||
MaskIrqs();
|
||||
if(OldGPFaultHandler)
|
||||
{
|
||||
RemoveAllSWBreakpoints(TRUE);
|
||||
SetGlobalInt(0x0D,(ULONG)OldGPFaultHandler);
|
||||
OldGPFaultHandler=0;
|
||||
}
|
||||
UnmaskIrqs();
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
// EOF
|
34
reactos/apps/utils/pice/module/gpfault.h
Normal file
34
reactos/apps/utils/pice/module/gpfault.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
gpfault.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for gpfault.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
void InstallGPFaultHook(void);
|
||||
void DeInstallGPFaultHook(void);
|
||||
|
||||
extern ULONG OldGPFaultHandler;
|
1044
reactos/apps/utils/pice/module/hardware.c
Normal file
1044
reactos/apps/utils/pice/module/hardware.c
Normal file
File diff suppressed because it is too large
Load diff
164
reactos/apps/utils/pice/module/hardware.h
Normal file
164
reactos/apps/utils/pice/module/hardware.h
Normal file
|
@ -0,0 +1,164 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
hardwar.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for hardware.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
typedef struct tagWindow
|
||||
{
|
||||
USHORT y,cy;
|
||||
USHORT usCurX,usCurY;
|
||||
BOOLEAN bScrollDisabled;
|
||||
}WINDOW,*PWINDOW;
|
||||
|
||||
// pointer indirection table for output functions
|
||||
typedef struct _OUTPUT_HANDLERS
|
||||
{
|
||||
void (*CopyLineTo) (USHORT dest,USHORT src);
|
||||
void (*PrintGraf) (ULONG x,ULONG y,UCHAR c);
|
||||
void (*Flush) (void);
|
||||
void (*ClrLine) (ULONG line);
|
||||
void (*InvertLine) (ULONG line);
|
||||
void (*HatchLine) (ULONG line);
|
||||
void (*PrintLogo) (BOOLEAN bShow);
|
||||
void (*PrintCursor) (BOOLEAN bForce);
|
||||
void (*SaveGraphicsState) (void);
|
||||
void (*RestoreGraphicsState) (void);
|
||||
void (*ShowCursor) (void);
|
||||
void (*HideCursor) (void);
|
||||
void (*SetForegroundColor) (ECOLORS);
|
||||
void (*SetBackgroundColor) (ECOLORS);
|
||||
}OUTPUT_HANDLERS,*POUTPUT_HANDLERS;
|
||||
|
||||
// pointer indirection table for input functions
|
||||
typedef struct _INPUT_HANDLERS
|
||||
{
|
||||
UCHAR (*GetKeyPolled) (void);
|
||||
void (*FlushKeyboardQueue) (void);
|
||||
}INPUT_HANDLERS,*PINPUT_HANDLERS;
|
||||
|
||||
extern OUTPUT_HANDLERS ohandlers;
|
||||
extern INPUT_HANDLERS ihandlers;
|
||||
|
||||
enum
|
||||
{
|
||||
REGISTER_WINDOW = 0 ,
|
||||
DATA_WINDOW ,
|
||||
SOURCE_WINDOW ,
|
||||
OUTPUT_WINDOW ,
|
||||
OUTPUT_WINDOW_UNBUFFERED
|
||||
};
|
||||
|
||||
typedef enum _ETERMINALMODE
|
||||
{
|
||||
TERMINAL_MODE_HERCULES_GRAPHICS = 0 ,
|
||||
TERMINAL_MODE_HERCULES_TEXT,
|
||||
TERMINAL_MODE_VGA_TEXT,
|
||||
TERMINAL_MODE_SERIAL,
|
||||
TERMINAL_MODE_NONE
|
||||
}ETERMINALMODE;
|
||||
|
||||
extern ETERMINALMODE eTerminalMode;
|
||||
|
||||
extern WINDOW wWindow[];
|
||||
extern BOOLEAN bRev;
|
||||
extern BOOLEAN bGrayed;
|
||||
extern BOOLEAN bCursorEnabled;
|
||||
|
||||
// install and remove handler
|
||||
BOOLEAN ConsoleInit(void);
|
||||
void ConsoleShutdown(void);
|
||||
|
||||
// OUTPUT handler
|
||||
void Print(USHORT Window,LPSTR p);
|
||||
void SetBackgroundColor(ECOLORS c);
|
||||
void SetForegroundColor(ECOLORS c);
|
||||
void Clear(USHORT window);
|
||||
void PutChar(LPSTR p,ULONG x,ULONG y);
|
||||
void ClrLine(ULONG line);
|
||||
void ShowCursor(void);
|
||||
void HideCursor(void);
|
||||
void EnableScroll(USHORT Window);
|
||||
void DisableScroll(USHORT Window);
|
||||
void CopyLineTo(USHORT dest,USHORT src);
|
||||
void PrintLogo(BOOLEAN bShow);
|
||||
void PrintCursor(BOOLEAN bForce);
|
||||
void PrintGraf(ULONG x,ULONG y,UCHAR c);
|
||||
void ScrollUp(USHORT Window);
|
||||
void Home(USHORT Window);
|
||||
void InvertLine(ULONG line);
|
||||
void FillLine(ULONG line,UCHAR c);
|
||||
void PrintTemplate(void);
|
||||
void PrintCaption(void);
|
||||
void ClrLineToEnd(USHORT Window,ULONG line,ULONG x);
|
||||
void SuspendPrintRingBuffer(BOOLEAN bSuspend);
|
||||
void HatchLine(ULONG line);
|
||||
void SaveGraphicsState(void);
|
||||
void RestoreGraphicsState(void);
|
||||
void SetWindowGeometry(PVOID pWindow);
|
||||
|
||||
// INPUT handler
|
||||
UCHAR GetKeyPolled(void);
|
||||
void FlushKeyboardQueue(void);
|
||||
|
||||
|
||||
BOOLEAN PrintRingBufferOffset(ULONG ulLines,ULONG ulOffset);
|
||||
BOOLEAN PrintRingBufferHome(ULONG ulLines);
|
||||
void PrintRingBuffer(ULONG ulLines);
|
||||
ULONG LinesInRingBuffer(void);
|
||||
void ReplaceRingBufferCurrent(LPSTR s);
|
||||
void EmptyRingBuffer(void);
|
||||
void CheckRingBuffer(void);
|
||||
BOOLEAN AddToRingBuffer(LPSTR p);
|
||||
void ResetColor(void);
|
||||
|
||||
extern ULONG GLOBAL_SCREEN_WIDTH;
|
||||
extern ULONG GLOBAL_SCREEN_HEIGHT;
|
||||
|
||||
extern ULONG ulOutputLock;
|
||||
|
||||
#define Acquire_Output_Lock() \
|
||||
{ \
|
||||
save_flags(ulOutputLock); \
|
||||
cli(); \
|
||||
}
|
||||
|
||||
#define Release_Output_Lock() \
|
||||
restore_flags(ulOutputLock);
|
||||
|
||||
#define NOT_IMPLEMENTED()
|
||||
|
||||
extern USHORT usCaptionColor;
|
||||
#define COLOR_CAPTION usCaptionColor
|
||||
extern USHORT usCaptionText;
|
||||
#define COLOR_TEXT usCaptionText
|
||||
extern USHORT usForegroundColor;
|
||||
#define COLOR_FOREGROUND usForegroundColor
|
||||
extern USHORT usBackgroundColor;
|
||||
#define COLOR_BACKGROUND usBackgroundColor
|
||||
extern USHORT usHiLiteColor;
|
||||
#define COLOR_HILITE usHiLiteColor
|
489
reactos/apps/utils/pice/module/hercules.c
Normal file
489
reactos/apps/utils/pice/module/hercules.c
Normal file
|
@ -0,0 +1,489 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
hercules.c
|
||||
|
||||
Abstract:
|
||||
|
||||
HW dependent draw routines
|
||||
|
||||
Environment:
|
||||
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
04-Aug-1998: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#include "remods.h"
|
||||
#include "precomp.h"
|
||||
#include <linux/pci.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/delay.h>
|
||||
#include <linux/ctype.h>
|
||||
|
||||
#include "charset.h"
|
||||
#include "logo.h"
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// PROTOTYPES
|
||||
////
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// DEFINES
|
||||
////
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// GLOBALS
|
||||
////
|
||||
// cursor state
|
||||
BOOLEAN bRev=FALSE;
|
||||
|
||||
// HERCULES graphics adapter stuff
|
||||
// 43 line graphics mode
|
||||
UCHAR MGATable43[]={53,45,46, 7,96, 2,91,91, 2, 3, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
PUCHAR pVgaOffset[4];
|
||||
// END of HERCULES graphics adapter stuff
|
||||
|
||||
// used for HERCULES graphics mode
|
||||
WINDOW wWindowHercGraph[4]=
|
||||
{
|
||||
{1,3,1,0,FALSE},
|
||||
{5,6,1,0,FALSE},
|
||||
{12,19,1,0,FALSE},
|
||||
{32,12,1,0,FALSE}
|
||||
};
|
||||
// used for HERCUELS text and VGA text mode
|
||||
WINDOW wWindowHerc[4]=
|
||||
{
|
||||
{1,3,1,0,FALSE},
|
||||
{5,4,1,0,FALSE},
|
||||
{10,9,1,0,FALSE},
|
||||
{20,4,1,0,FALSE}
|
||||
};
|
||||
|
||||
PUCHAR pScreenBufferHercules;
|
||||
|
||||
struct _attr
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
|
||||
UCHAR fgcol : 4;
|
||||
UCHAR bkcol : 3;
|
||||
UCHAR blink : 1;
|
||||
}bits;
|
||||
UCHAR Asuchar;
|
||||
}u;
|
||||
}attr;
|
||||
|
||||
//*************************************************************************
|
||||
// SetForegroundColorVga()
|
||||
//
|
||||
//*************************************************************************
|
||||
void SetForegroundColorHercules(ECOLORS col)
|
||||
{
|
||||
attr.u.bits.fgcol = col;
|
||||
attr.u.bits.blink = 0;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// SetBackgroundColorVga()
|
||||
//
|
||||
//*************************************************************************
|
||||
void SetBackgroundColorHercules(ECOLORS col)
|
||||
{
|
||||
attr.u.bits.bkcol = col;
|
||||
attr.u.bits.blink = 0;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// PrintGrafHercules()
|
||||
//
|
||||
//*************************************************************************
|
||||
void PrintGrafHercules(ULONG x,ULONG y,UCHAR c)
|
||||
{
|
||||
ULONG i;
|
||||
PUCHAR p;
|
||||
ULONG _line = y<<3;
|
||||
|
||||
if(!pScreenBufferHercules)
|
||||
return;
|
||||
|
||||
p=&cGraphTable[(ULONG)c<<3];
|
||||
|
||||
if((attr.u.bits.bkcol == COLOR_FOREGROUND && attr.u.bits.fgcol == COLOR_BACKGROUND) ||
|
||||
(attr.u.bits.bkcol == COLOR_CAPTION && attr.u.bits.fgcol == COLOR_TEXT) )
|
||||
for(i=0 ;i<8 ;i++,_line++)
|
||||
{
|
||||
*(PUCHAR)(pVgaOffset[_line & 0x3] + ( 90* (_line >> 2) ) + x) = ~*p++;
|
||||
}
|
||||
else
|
||||
for(i=0 ;i<8 ;i++,_line++)
|
||||
{
|
||||
*(PUCHAR)(pVgaOffset[_line & 0x3] + ( 90* (_line >> 2) ) + x) = *p++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// FlushHercules()
|
||||
//
|
||||
//*************************************************************************
|
||||
void FlushHercules(void)
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// ShowCursor()
|
||||
//
|
||||
// show hardware cursor
|
||||
//*************************************************************************
|
||||
void ShowCursorHercules(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
|
||||
bCursorEnabled=TRUE;
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// HideCursorHercules()
|
||||
//
|
||||
// hide hardware cursor
|
||||
//*************************************************************************
|
||||
void HideCursorHercules(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
|
||||
bCursorEnabled=FALSE;
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// CopyLineTo()
|
||||
//
|
||||
// copy a line from src to dest
|
||||
//*************************************************************************
|
||||
void CopyLineToHercules(USHORT dest,USHORT src)
|
||||
{
|
||||
USHORT i,j;
|
||||
PULONG pDest,pSrc;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
dest <<= 3;
|
||||
src <<= 3;
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
(PUCHAR)pDest = (PUCHAR)pScreenBufferHercules + ( ( ( dest+i )&3) <<13 )+ 90 * ((dest+i) >> 2);
|
||||
(PUCHAR)pSrc = (PUCHAR)pScreenBufferHercules + ( ( ( src+i )&3) <<13 )+ 90 * ((src+i) >> 2);
|
||||
for(j=0;j<(GLOBAL_SCREEN_WIDTH>>2);j++)
|
||||
{
|
||||
*pDest++=*pSrc++;
|
||||
}
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// InvertLineHercules()
|
||||
//
|
||||
// invert a line on the screen
|
||||
//*************************************************************************
|
||||
void InvertLineHercules(ULONG line)
|
||||
{
|
||||
ULONG i,j;
|
||||
ULONG _line = line<<3;
|
||||
PUSHORT p;
|
||||
|
||||
//ENTER_FUNC();
|
||||
|
||||
for(j=0;j<8;j++)
|
||||
{
|
||||
p=(PUSHORT)( pVgaOffset[_line&3] + (90*(_line>>2)) );
|
||||
for(i=0;i<(GLOBAL_SCREEN_WIDTH>>1);i++)
|
||||
{
|
||||
p[i]=~p[i];
|
||||
}
|
||||
_line++;
|
||||
}
|
||||
|
||||
//LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// HatchLineHercules()
|
||||
//
|
||||
// hatches a line on the screen
|
||||
//*************************************************************************
|
||||
void HatchLineHercules(ULONG line)
|
||||
{
|
||||
USHORT cc;
|
||||
ULONG i,j;
|
||||
ULONG _line = (line<<3) ;
|
||||
PUSHORT p;
|
||||
USHORT mask_odd[]={0x8888,0x2222};
|
||||
USHORT mask_even[]={0xaaaa,0x5555};
|
||||
PUSHORT pmask;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
pmask = (line&1)?mask_odd:mask_even;
|
||||
|
||||
for(j=0;j<8;j++,_line++)
|
||||
{
|
||||
p=(PUSHORT)( pVgaOffset[_line&3] + (90*(_line>>2)) );
|
||||
for(i=0;i<(GLOBAL_SCREEN_WIDTH/sizeof(USHORT));i++)
|
||||
{
|
||||
cc = p[i];
|
||||
|
||||
p[i]=(p[i]^pmask[j&1])|cc;
|
||||
}
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// ClrLineHercules()
|
||||
//
|
||||
// clear a line on the screen
|
||||
//*************************************************************************
|
||||
void ClrLineHercules(ULONG line)
|
||||
{
|
||||
ULONG j;
|
||||
BOOLEAN bTemplateLine=( (USHORT)line==wWindow[DATA_WINDOW].y-1 ||
|
||||
(USHORT)line==wWindow[SOURCE_WINDOW].y-1 ||
|
||||
(USHORT)line==wWindow[OUTPUT_WINDOW].y-1 ||
|
||||
0);
|
||||
ULONG _line = line<<3;
|
||||
ULONG cc=0;
|
||||
PUCHAR p;
|
||||
|
||||
// ENTER_FUNC();
|
||||
|
||||
if(line > GLOBAL_SCREEN_HEIGHT )
|
||||
{
|
||||
DPRINT((0,"ClrLineHercules(): line %u is out of screen\n",line));
|
||||
//LEAVE_FUNC();
|
||||
return;
|
||||
}
|
||||
|
||||
if(attr.u.bits.bkcol == COLOR_CAPTION && attr.u.bits.fgcol == COLOR_TEXT )
|
||||
cc=~cc;
|
||||
|
||||
if(bTemplateLine)
|
||||
{
|
||||
for(j=0;j<8;j++,_line++)
|
||||
{
|
||||
p = (PUCHAR)(pVgaOffset[_line&3] + (90*(_line>>2)) );
|
||||
|
||||
/*
|
||||
if(j==2 || j==5)cc=0xFF;
|
||||
else if(j==3)cc=0xaa;
|
||||
else if(j==4)cc=0x55;
|
||||
else cc = 0;*/
|
||||
if(j==2 || j==5)cc=0xFF;
|
||||
else cc = 0;
|
||||
|
||||
PICE_memset(p,(UCHAR)cc,GLOBAL_SCREEN_WIDTH);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(j=0;j<8;j++,_line++)
|
||||
{
|
||||
p = (PUCHAR)(pVgaOffset[_line&3] + (90*(_line>>2)) );
|
||||
|
||||
PICE_memset(p,(UCHAR)cc,GLOBAL_SCREEN_WIDTH);
|
||||
}
|
||||
}
|
||||
//LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// PrintLogoHercules()
|
||||
//
|
||||
//*************************************************************************
|
||||
void PrintLogoHercules(BOOLEAN bShow)
|
||||
{
|
||||
LONG x,y;
|
||||
PUCHAR p;
|
||||
|
||||
p=(PUCHAR)pScreenBufferHercules;
|
||||
for(y=0;y<24;y++)
|
||||
{
|
||||
for(x=0;x<8;x++)
|
||||
{
|
||||
p[ ( 0x2000* (( y + 8 ) & 0x3) )+
|
||||
( 90* ( (y + 8 ) >> 2) )+
|
||||
(81+x)] = cLogo[y*8+x];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// PrintCursorHercules()
|
||||
//
|
||||
// emulate a blinking cursor block
|
||||
//*************************************************************************
|
||||
void PrintCursorHercules(BOOLEAN bForce)
|
||||
{
|
||||
static ULONG count=0;
|
||||
|
||||
if( (bForce) || ((count++>100) && bCursorEnabled) )
|
||||
{
|
||||
ULONG i;
|
||||
ULONG x,y;
|
||||
ULONG _line;
|
||||
|
||||
x=wWindow[OUTPUT_WINDOW].usCurX;
|
||||
y=wWindow[OUTPUT_WINDOW].y+wWindow[OUTPUT_WINDOW].usCurY;
|
||||
|
||||
_line = y<<3;
|
||||
for(i=0;i<8;i++,_line++)
|
||||
{
|
||||
*(PUCHAR)(pVgaOffset[_line & 0x3] + ( 90* (_line >> 2) ) + x) ^= 0xFF ;
|
||||
}
|
||||
bRev=!bRev;
|
||||
count=0;
|
||||
}
|
||||
|
||||
__udelay(2500);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// SaveGraphicsHercules()
|
||||
//
|
||||
//*************************************************************************
|
||||
void SaveGraphicsStateHercules(void)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// RestoreGraphicsStateHercules()
|
||||
//
|
||||
//*************************************************************************
|
||||
void RestoreGraphicsStateHercules(void)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// ConsoleInitHercules()
|
||||
//
|
||||
// init terminal screen
|
||||
//*************************************************************************
|
||||
BOOLEAN ConsoleInitHercules(void)
|
||||
{
|
||||
BOOLEAN bResult = FALSE;
|
||||
PUCHAR pMGATable = MGATable43;
|
||||
UCHAR i,reg,data;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
ohandlers.CopyLineTo = CopyLineToHercules;
|
||||
ohandlers.PrintGraf = PrintGrafHercules;
|
||||
ohandlers.Flush = FlushHercules;
|
||||
ohandlers.ClrLine = ClrLineHercules;
|
||||
ohandlers.InvertLine = InvertLineHercules;
|
||||
ohandlers.HatchLine = HatchLineHercules;
|
||||
ohandlers.PrintLogo = PrintLogoHercules;
|
||||
ohandlers.PrintCursor = PrintCursorHercules;
|
||||
ohandlers.SaveGraphicsState = SaveGraphicsStateHercules;
|
||||
ohandlers.RestoreGraphicsState = RestoreGraphicsStateHercules;
|
||||
ohandlers.ShowCursor = ShowCursorHercules;
|
||||
ohandlers.HideCursor = HideCursorHercules;
|
||||
ohandlers.SetForegroundColor = SetForegroundColorHercules;
|
||||
ohandlers.SetBackgroundColor = SetBackgroundColorHercules;
|
||||
|
||||
ihandlers.GetKeyPolled = KeyboardGetKeyPolled;
|
||||
ihandlers.FlushKeyboardQueue = KeyboardFlushKeyboardQueue;
|
||||
|
||||
// init HERCULES adapter
|
||||
outb_p(0,0x3b8);
|
||||
outb_p(0x03,0x3bf);
|
||||
for(i=0;i<sizeof(MGATable43);i++)
|
||||
{
|
||||
reg=i;
|
||||
outb_p(reg,0x3b4);
|
||||
data=pMGATable[i];
|
||||
outb_p(data,0x3b5);
|
||||
}
|
||||
outb_p(0x0a,0x3b8);
|
||||
|
||||
SetWindowGeometry(wWindowHercGraph);
|
||||
|
||||
GLOBAL_SCREEN_WIDTH = 90;
|
||||
GLOBAL_SCREEN_HEIGHT = 45;
|
||||
|
||||
attr.u.Asuchar = 0x07;
|
||||
|
||||
pScreenBufferHercules=ioremap(0xb0000,FRAMEBUFFER_SIZE);
|
||||
|
||||
DPRINT((0,"VGA memory phys. 0xb0000 mapped to virt. 0x%x\n",pScreenBufferHercules));
|
||||
|
||||
if(pScreenBufferHercules)
|
||||
{
|
||||
for(i=0;i<4;i++)
|
||||
{
|
||||
pVgaOffset[i] = (PUCHAR)pScreenBufferHercules+0x2000*i;
|
||||
DPRINT((0,"VGA offset %u = 0x%.8X\n",i,pVgaOffset[i]));
|
||||
}
|
||||
bResult = TRUE;
|
||||
|
||||
PICE_memset(pScreenBufferHercules,0x0,FRAMEBUFFER_SIZE);
|
||||
|
||||
EmptyRingBuffer();
|
||||
|
||||
DPRINT((0,"ConsoleInitHercules() SUCCESS!\n"));
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// ConsoleShutdownHercules()
|
||||
//
|
||||
// exit terminal screen
|
||||
//*************************************************************************
|
||||
void ConsoleShutdownHercules(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
|
||||
// HERC video off
|
||||
outb_p(0,0x3b8);
|
||||
outb_p(0,0x3bf);
|
||||
|
||||
if(pScreenBufferHercules)
|
||||
iounmap(pScreenBufferHercules);
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
32
reactos/apps/utils/pice/module/hercules.h
Normal file
32
reactos/apps/utils/pice/module/hercules.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
hercules.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for hercules.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
BOOLEAN ConsoleInitHercules(void);
|
||||
void ConsoleShutdownHercules(void);
|
179
reactos/apps/utils/pice/module/hooks.c
Normal file
179
reactos/apps/utils/pice/module/hooks.c
Normal file
|
@ -0,0 +1,179 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
hooks.c
|
||||
|
||||
Abstract:
|
||||
|
||||
hooking of interrupts
|
||||
|
||||
Environment:
|
||||
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
16-Jul-1998: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#include "remods.h"
|
||||
#include "precomp.h"
|
||||
|
||||
#include <asm/io.h>
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// PROTOTYPES
|
||||
////
|
||||
void DeinstallHooks(void);
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// DEFINES
|
||||
////
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// GLOBALS
|
||||
////
|
||||
|
||||
// IDT entries
|
||||
//PIDTENTRY pidt[256];
|
||||
IDTENTRY oldidt[256]={{0},};
|
||||
|
||||
IDTENTRY idt_snapshot[256]={{0},};
|
||||
|
||||
// processor flag for interrupt suspension
|
||||
ULONG ulOldFlags;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// PROCEDURES
|
||||
////
|
||||
|
||||
//*************************************************************************
|
||||
// MaskIrqs()
|
||||
//
|
||||
//*************************************************************************
|
||||
void MaskIrqs(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
|
||||
save_flags(ulOldFlags);
|
||||
cli();
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// UnmaskIrqs()
|
||||
//
|
||||
//*************************************************************************
|
||||
void UnmaskIrqs(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
|
||||
restore_flags(ulOldFlags);
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// SetGlobalInt()
|
||||
//
|
||||
//*************************************************************************
|
||||
ULONG SetGlobalInt(ULONG dwInt,ULONG NewIntHandler)
|
||||
{
|
||||
ULONG idt[2];
|
||||
ULONG OldIntHandler;
|
||||
struct IdtEntry* pidt;
|
||||
struct IdtEntry oldidt;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
// get linear location of IDT
|
||||
__asm__("sidt %0":"=m" (idt));
|
||||
|
||||
// get pointer to idte for int 3
|
||||
pidt=((struct IdtEntry*)((idt[1]<<16)|((idt[0]>>16)&0x0000FFFF)))+dwInt;
|
||||
|
||||
oldidt=*pidt;
|
||||
|
||||
// set new handler address
|
||||
pidt->HiOffset=(USHORT)(((ULONG)NewIntHandler)>>16);
|
||||
pidt->LoOffset=(USHORT)(((ULONG)NewIntHandler)&0x0000FFFF);
|
||||
|
||||
DPRINT((0,"new INT(%0.2x) handler = %0.4x:%x\n",dwInt,pidt->SegSel,(pidt->HiOffset<<16)|(pidt->LoOffset&0x0000FFFF)));
|
||||
|
||||
OldIntHandler=(oldidt.HiOffset<<16)|(oldidt.LoOffset&0x0000FFFF);
|
||||
|
||||
DPRINT((0,"old INT(%0.2x) handler = %0.4x:%x\n",dwInt,pidt->SegSel,OldIntHandler));
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return OldIntHandler;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// TakeIdtSnapshot()
|
||||
//
|
||||
//*************************************************************************
|
||||
void TakeIdtSnapshot(void)
|
||||
{
|
||||
ULONG idt[2],i;
|
||||
struct IdtEntry* pidt;
|
||||
|
||||
__asm__("sidt %0":"=m" (idt));
|
||||
|
||||
// get pointer to idte for int 3
|
||||
pidt=((struct IdtEntry*)((idt[1]<<16)|((idt[0]>>16)&0x0000FFFF)));
|
||||
|
||||
for(i=0;i<256;i++)
|
||||
{
|
||||
DPRINT((0,"TakeIdtSnapShot(): saving vector %u\n",i));
|
||||
if(IsRangeValid((ULONG)pidt,sizeof(*pidt)) )
|
||||
{
|
||||
DPRINT((0,"TakeIdtSnapShot(): vector %u valid\n",i));
|
||||
idt_snapshot[i] = *pidt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// RestoreIdt()
|
||||
//
|
||||
//*************************************************************************
|
||||
void RestoreIdt(void)
|
||||
{
|
||||
ULONG idt[2],i;
|
||||
struct IdtEntry* pidt;
|
||||
|
||||
__asm__("sidt %0":"=m" (idt));
|
||||
|
||||
// get pointer to idte for int 3
|
||||
pidt=((struct IdtEntry*)((idt[1]<<16)|((idt[0]>>16)&0x0000FFFF)));
|
||||
|
||||
for(i=0;i<256;i++)
|
||||
{
|
||||
DPRINT((0,"TakeIdtSnapShot(): restoring vector %u\n",i));
|
||||
if(IsRangeValid((ULONG)pidt,sizeof(*pidt)) )
|
||||
{
|
||||
DPRINT((0,"TakeIdtSnapShot(): vector %u valid\n",i));
|
||||
*pidt++ = idt_snapshot[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
49
reactos/apps/utils/pice/module/hooks.h
Normal file
49
reactos/apps/utils/pice/module/hooks.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
hooks.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for hooks.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
void DeinstallHooks(void);
|
||||
//ULONG HookInt(ULONG dwInt,ULONG NewIntHandler);
|
||||
//void UnhookInt(ULONG dwInt);
|
||||
void MaskIrqs(void);
|
||||
void UnmaskIrqs(void);
|
||||
ULONG SetGlobalInt(ULONG dwInt,ULONG NewIntHandler);
|
||||
ULONG GetIRQVector(ULONG dwInt);
|
||||
void TakeIdtSnapshot(void);
|
||||
void RestoreIdt(void);
|
||||
|
||||
// structure of an IDT entry
|
||||
typedef struct IdtEntry
|
||||
{
|
||||
USHORT LoOffset;
|
||||
USHORT SegSel;
|
||||
USHORT Flags;
|
||||
USHORT HiOffset;
|
||||
}IDTENTRY,*PIDTENTRY;
|
||||
|
325
reactos/apps/utils/pice/module/init.c
Normal file
325
reactos/apps/utils/pice/module/init.c
Normal file
|
@ -0,0 +1,325 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
init.c
|
||||
|
||||
Abstract:
|
||||
|
||||
initialisation and cleanup of debugger kernel module
|
||||
|
||||
Environment:
|
||||
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
25-Jan-1999: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#include "remods.h"
|
||||
#include "precomp.h"
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/delay.h>
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// GLOBALS
|
||||
ULONG ulDoInitialBreak=1;
|
||||
char szBootParams[1024]="";
|
||||
char tempInit[256];
|
||||
|
||||
//*************************************************************************
|
||||
// InitPICE()
|
||||
//
|
||||
//*************************************************************************
|
||||
BOOLEAN InitPICE(void)
|
||||
{
|
||||
ULONG ulHandleScancode=0,ulHandleKbdEvent=0;
|
||||
ARGS Args;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 1\n"));
|
||||
// enable monochrome passthrough on BX type chipset
|
||||
EnablePassThrough();
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 2\n"));
|
||||
// now load all symbol files described in /etc/pice.conf
|
||||
if(!LoadSymbolsFromConfig(FALSE))
|
||||
{
|
||||
DPRINT((0,"InitPICE: LoadSymbolsFromConfig() failed\n"));
|
||||
LEAVE_FUNC();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 3\n"));
|
||||
// init the output console
|
||||
// this might be one of the following depending setup
|
||||
// a) monochrome card
|
||||
// b) serial terminal (TODO)
|
||||
if(!ConsoleInit())
|
||||
{
|
||||
DPRINT((0,"InitPICE: ConsoleInit() failed\n"));
|
||||
UnloadSymbols();
|
||||
LEAVE_FUNC();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 4\n"));
|
||||
// print the initial screen template
|
||||
PrintTemplate();
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 5\n"));
|
||||
// ask the user if he wants to abort the debugger load
|
||||
if(!CheckLoadAbort())
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: ABORT (abort by user)\n");
|
||||
UnloadSymbols();
|
||||
ConsoleShutdown();
|
||||
LEAVE_FUNC();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 6\n"));
|
||||
// get kernel mm_struct
|
||||
my_init_mm = GetInitMm();
|
||||
if(!my_init_mm)
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: ABORT (initial memory map not found)\n");
|
||||
Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n");
|
||||
while(!GetKeyPolled());
|
||||
UnloadSymbols();
|
||||
ConsoleShutdown();
|
||||
LEAVE_FUNC();
|
||||
return FALSE;
|
||||
}
|
||||
DPRINT((0,"init_mm @ %X\n",my_init_mm));
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 7\n"));
|
||||
// load the file /boot/System.map.
|
||||
// !!! It must be consistent with the current kernel at all cost!!!
|
||||
if(!LoadExports())
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: failed to load exports\n");
|
||||
Print(OUTPUT_WINDOW,"press any key to continue...\n");
|
||||
while(!GetKeyPolled());
|
||||
UnloadSymbols();
|
||||
ConsoleShutdown();
|
||||
LEAVE_FUNC();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 8\n"));
|
||||
// end of the kernel
|
||||
ScanExports("_end",(PULONG)&kernel_end);
|
||||
if(!kernel_end)
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: ABORT (kernel size is unknown)\n");
|
||||
Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n");
|
||||
while(!GetKeyPolled());
|
||||
UnloadExports();
|
||||
UnloadSymbols();
|
||||
ConsoleShutdown();
|
||||
LEAVE_FUNC();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 9\n"));
|
||||
// the loaded module list
|
||||
ScanExports("module_list",(PULONG)&pmodule_list);
|
||||
if(!pmodule_list)
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: ABORT (couldn't retreive kernel module list)\n");
|
||||
Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n");
|
||||
while(!GetKeyPolled());
|
||||
UnloadExports();
|
||||
UnloadSymbols();
|
||||
ConsoleShutdown();
|
||||
LEAVE_FUNC();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 10\n"));
|
||||
// setup a fake module struct for use by symbol routines
|
||||
if(!InitFakeKernelModule())
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: ABORT (couldn't initialize kernel module)\n");
|
||||
Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n");
|
||||
while(!GetKeyPolled());
|
||||
UnloadExports();
|
||||
UnloadSymbols();
|
||||
ConsoleShutdown();
|
||||
LEAVE_FUNC();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 11\n"));
|
||||
// do a sanity check on exports
|
||||
if(!SanityCheckExports())
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: ABORT (exports are conflicting with kernel symbols)\n");
|
||||
Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n");
|
||||
while(!GetKeyPolled());
|
||||
UnloadExports();
|
||||
UnloadSymbols();
|
||||
ConsoleShutdown();
|
||||
LEAVE_FUNC();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 12\n"));
|
||||
// need these two to hook the keyboard
|
||||
ScanExports("handle_scancode",&ulHandleScancode);
|
||||
ScanExports("handle_kbd_event",&ulHandleKbdEvent);
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 13\n"));
|
||||
// patch the keyboard driver
|
||||
if(!(ulHandleScancode && ulHandleKbdEvent && PatchKeyboardDriver(ulHandleKbdEvent,ulHandleScancode)) )
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: ABORT (couldn't patch keyboard driver)\n");
|
||||
Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n");
|
||||
while(!GetKeyPolled());
|
||||
UnloadSymbols();
|
||||
UnloadExports();
|
||||
ConsoleShutdown();
|
||||
LEAVE_FUNC();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 14\n"));
|
||||
// partial init of shadow registers
|
||||
CurrentCS = GLOBAL_CODE_SEGMENT;
|
||||
CurrentEIP = (ULONG)RealIsr;
|
||||
|
||||
CurrentDS = CurrentSS = GLOBAL_DATA_SEGMENT;
|
||||
__asm__("
|
||||
mov %%esp,%%eax
|
||||
mov %%eax,CurrentESP
|
||||
":::"eax");
|
||||
|
||||
|
||||
// display version and symbol information
|
||||
Ver(NULL);
|
||||
|
||||
// disable HW breakpoints
|
||||
__asm__("
|
||||
xorl %%eax,%%eax
|
||||
mov %%eax,%%dr6
|
||||
mov %%eax,%%dr7
|
||||
mov %%dr0,%%eax
|
||||
mov %%dr1,%%eax
|
||||
mov %%dr2,%%eax
|
||||
mov %%dr3,%%eax"
|
||||
:::"eax"
|
||||
);
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 15\n"));
|
||||
TakeIdtSnapshot();
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 16\n"));
|
||||
// install all hooks
|
||||
InstallTraceHook();
|
||||
InstallGlobalKeyboardHook();
|
||||
InstallSyscallHook();
|
||||
InstallInt3Hook();
|
||||
InstallPrintkHook();
|
||||
InstallDblFltHook();
|
||||
InstallGPFaultHook();
|
||||
InstallIntEHook();
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 16\n"));
|
||||
if(ulDoInitialBreak)
|
||||
{
|
||||
DPRINT((0,"about to do initial break...\n"));
|
||||
|
||||
// simulate an initial break
|
||||
__asm__("
|
||||
pushfl
|
||||
pushl %cs
|
||||
pushl $initialreturnpoint
|
||||
pushl $" STR(REASON_CTRLF) "
|
||||
jmp NewInt31Handler
|
||||
initialreturnpoint:");
|
||||
}
|
||||
else
|
||||
{
|
||||
// display register contents
|
||||
DisplayRegs();
|
||||
|
||||
// display data window
|
||||
Args.Value[0]=CurrentDS;
|
||||
Args.Value[1]=CurrentEIP;
|
||||
Args.Count=2;
|
||||
DisplayMemory(&Args);
|
||||
|
||||
// disassembly from current address
|
||||
Args.Value[0]=CurrentCS;
|
||||
Args.Value[1]=CurrentEIP;
|
||||
Args.Count=2;
|
||||
Unassemble(&Args);
|
||||
}
|
||||
|
||||
DPRINT((0,"InitPICE(): trace step 17\n"));
|
||||
InitPiceRunningTimer();
|
||||
|
||||
LEAVE_FUNC();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// CleanUpPICE()
|
||||
//
|
||||
//*************************************************************************
|
||||
void CleanUpPICE(void)
|
||||
{
|
||||
DPRINT((0,"CleanUpPICE(): trace step 1\n"));
|
||||
RemovePiceRunningTimer();
|
||||
|
||||
DPRINT((0,"CleanUpPICE(): trace step 2\n"));
|
||||
// de-install all hooks
|
||||
DeInstallGlobalKeyboardHook();
|
||||
DeInstallSyscallHook();
|
||||
DeInstallInt3Hook();
|
||||
DeInstallPrintkHook();
|
||||
DeInstallDblFltHook();
|
||||
DeInstallGPFaultHook();
|
||||
DeInstallIntEHook();
|
||||
DeInstallTraceHook();
|
||||
|
||||
DPRINT((0,"CleanUpPICE(): trace step 3\n"));
|
||||
RestoreIdt();
|
||||
|
||||
DPRINT((0,"CleanUpPICE(): trace step 4\n"));
|
||||
UnloadExports(); // don't use ScanExports() after this
|
||||
UnloadSymbols();
|
||||
|
||||
DPRINT((0,"CleanUpPICE(): trace step 5\n"));
|
||||
// restore patch of keyboard driver
|
||||
RestoreKeyboardDriver();
|
||||
|
||||
DPRINT((0,"CleanUpPICE(): trace step 6\n"));
|
||||
Print(OUTPUT_WINDOW,"pICE: shutting down...\n");
|
||||
|
||||
DPRINT((0,"CleanUpPICE(): trace step 7\n"));
|
||||
// cleanup the console
|
||||
ConsoleShutdown();
|
||||
}
|
35
reactos/apps/utils/pice/module/init.h
Normal file
35
reactos/apps/utils/pice/module/init.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
init.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for init.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
BOOLEAN InitPICE(void);
|
||||
void CleanUpPICE(void);
|
||||
|
||||
extern char szBootParams[1024];
|
38
reactos/apps/utils/pice/module/ldrsym.h
Normal file
38
reactos/apps/utils/pice/module/ldrsym.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
// start of
|
||||
// structure of symbol file
|
||||
///////////////////////////////////////////////////
|
||||
typedef struct tagLoaderSymbolHeader
|
||||
{
|
||||
ULONG dwMagic,dwSize;
|
||||
char Copyright[256];
|
||||
char ModuleName[256];
|
||||
ULONG NumberOfSymbols;
|
||||
ULONG Reserved; // for future extension
|
||||
}LOADERSYMBOLHEADER,*PLOADERSYMBOLHEADER;
|
||||
|
||||
typedef struct tagLoaderSymbolRecord
|
||||
{
|
||||
ULONG ModuleNameLength;
|
||||
ULONG NameLength;
|
||||
ULONG Address;
|
||||
ULONG Type;
|
||||
ULONG Class;
|
||||
}LOADERSYMBOLRECORD,*PLOADERSYMBOLRECORD;
|
||||
|
||||
typedef struct tagLoaderSymbolFile
|
||||
{
|
||||
LOADERSYMBOLHEADER LoaderSymbolHeader; // file header
|
||||
LOADERSYMBOLRECORD LoaderSymbolRecord[1]; // symbol records (symbol + source file)
|
||||
}LOADERSYMBOLFILE,*PLOADERSYMBOLFILE;
|
||||
|
||||
typedef struct tagLoaderSymbolPool
|
||||
{
|
||||
ULONG NumberOfFiles;
|
||||
ULONG SizeOfThisHeap;
|
||||
LOADERSYMBOLHEADER LoaderSymbolHeader; // file header
|
||||
LOADERSYMBOLRECORD LoaderSymbolRecord[1]; // symbol records (symbol + source file)
|
||||
}LOADERSYMBOLPOOL,*PLOADERSYMBOLPOOL;
|
||||
|
||||
// end of
|
||||
// structure of symbol file
|
||||
///////////////////////////////////////////////////
|
100
reactos/apps/utils/pice/module/logo.h
Normal file
100
reactos/apps/utils/pice/module/logo.h
Normal file
|
@ -0,0 +1,100 @@
|
|||
// this file is dynamically generated: DON'T TOUCH
|
||||
|
||||
UCHAR cLogo[96]={
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
0xab,
|
||||
0xeb,
|
||||
0xfb,
|
||||
0xaf,
|
||||
0xbf,
|
||||
0xbf,
|
||||
0xab,
|
||||
0xab,
|
||||
0x81,
|
||||
0xe0,
|
||||
0x78,
|
||||
0x37,
|
||||
0x9c,
|
||||
0x1c,
|
||||
0x03,
|
||||
0x01,
|
||||
0x88,
|
||||
0xe2,
|
||||
0x3c,
|
||||
0x63,
|
||||
0x9e,
|
||||
0x3f,
|
||||
0x8f,
|
||||
0x1f,
|
||||
0x9c,
|
||||
0x67,
|
||||
0x1c,
|
||||
0x71,
|
||||
0x1c,
|
||||
0x1f,
|
||||
0x1f,
|
||||
0x1f,
|
||||
0x98,
|
||||
0xe2,
|
||||
0x3c,
|
||||
0x73,
|
||||
0x3c,
|
||||
0x9f,
|
||||
0x9f,
|
||||
0x03,
|
||||
0x81,
|
||||
0xe0,
|
||||
0x7c,
|
||||
0x71,
|
||||
0x3d,
|
||||
0xdf,
|
||||
0x1f,
|
||||
0x17,
|
||||
0x83,
|
||||
0xe0,
|
||||
0x7c,
|
||||
0x78,
|
||||
0x38,
|
||||
0x0f,
|
||||
0x9f,
|
||||
0x3f,
|
||||
0x9f,
|
||||
0xe7,
|
||||
0x3c,
|
||||
0x7c,
|
||||
0x70,
|
||||
0x07,
|
||||
0x1f,
|
||||
0x1f,
|
||||
0x8f,
|
||||
0xe3,
|
||||
0x38,
|
||||
0x38,
|
||||
0x79,
|
||||
0xcf,
|
||||
0x9f,
|
||||
0x03,
|
||||
0x9f,
|
||||
0xe7,
|
||||
0x18,
|
||||
0x3c,
|
||||
0x71,
|
||||
0xc7,
|
||||
0x1f,
|
||||
0x01,
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
};
|
103
reactos/apps/utils/pice/module/makefile
Normal file
103
reactos/apps/utils/pice/module/makefile
Normal file
|
@ -0,0 +1,103 @@
|
|||
CC = gcc
|
||||
#MODCFLAGS := -Wall -c -m486 -g -fomit-frame-pointer -O2 -DMODULE -D__KERNEL__ -DLINUX -DDEBUG -DEXPORT_SYMTAB
|
||||
MODCFLAGS := -Wall -c -m486 -fomit-frame-pointer -O2 -DMODULE -D__KERNEL__ -DLINUX -DEXPORT_SYMTAB
|
||||
#MODCFLAGS := -Wall -g -c -m486 -O2 -DMODULE -D__KERNEL__ -DLINUX -DEXPORT_SYMTAB
|
||||
#MODCFLAGS := -Wall -g -c -m486 -O2 -DMODULE -D__KERNEL__ -DLINUX -DDEBUG -DEXPORT_SYMTAB
|
||||
|
||||
TARGET = pice.o
|
||||
OBJS = disassembler.o debug.o privateice.o hardware.o hooks.o init.o shell.o parse.o trace.o\
|
||||
serial.o utils.o patch.o symbols.o syscall.o bp.o output.o dblflt.o pgflt.o gpfault.o\
|
||||
hercules.o vga.o
|
||||
|
||||
defaultrule: $(TARGET)
|
||||
|
||||
# real world targets
|
||||
$(TARGET): $(OBJS) debug
|
||||
ld -m elf_i386 -r -o ./pice.o $(OBJS)
|
||||
|
||||
debug:
|
||||
mkdir debug
|
||||
|
||||
bp.o: bp.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) bp.c
|
||||
|
||||
dblflt.o: dblflt.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) dblflt.c
|
||||
|
||||
debug.o: debug.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) debug.c
|
||||
|
||||
disassembler.o: disassembler.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) disassembler.c
|
||||
|
||||
gpfault.o: gpfault.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) gpfault.c
|
||||
|
||||
hardware.o: hardware.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) hardware.c
|
||||
|
||||
hercules.o: hercules.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) hercules.c
|
||||
|
||||
hooks.o: hooks.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) hooks.c
|
||||
|
||||
init.o: init.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) init.c
|
||||
|
||||
shell.o: shell.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) shell.c
|
||||
|
||||
output.o: output.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) output.c
|
||||
|
||||
parse.o: parse.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) parse.c
|
||||
|
||||
patch.o: patch.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) patch.c
|
||||
|
||||
pgflt.o: pgflt.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) pgflt.c
|
||||
|
||||
privateice.o: privateice.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) privateice.c
|
||||
|
||||
serial.o: serial.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) serial.c
|
||||
|
||||
symbols.o: symbols.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) symbols.c
|
||||
|
||||
syscall.o: syscall.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) syscall.c
|
||||
|
||||
trace.o: trace.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) trace.c
|
||||
|
||||
utils.o: utils.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) utils.c
|
||||
|
||||
vga.o: vga.c /usr/include/linux/version.h
|
||||
$(CC) $(MODCFLAGS) vga.c
|
||||
|
||||
all: clean
|
||||
@rm -f $(OBJS)
|
||||
@rm -f *~
|
||||
@chmod -x *
|
||||
@touch *
|
||||
@make 2> make.txt
|
||||
@objdump --disassemble ./pice.o > ./pice.o.txt
|
||||
|
||||
distclean: clean
|
||||
@rm -f $(TARGET)
|
||||
@rm -f ./pice.txt
|
||||
@echo target files cleaned up
|
||||
|
||||
clean:
|
||||
@rm -f $(OBJS)
|
||||
@rm -f *~
|
||||
@rm -f make.txt
|
||||
@echo intermediate files cleaned up
|
||||
|
||||
|
261
reactos/apps/utils/pice/module/output.c
Normal file
261
reactos/apps/utils/pice/module/output.c
Normal file
|
@ -0,0 +1,261 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
output.c
|
||||
|
||||
Abstract:
|
||||
|
||||
catch debugging outputs
|
||||
|
||||
Environment:
|
||||
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
14-Nov-1999: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#include "remods.h"
|
||||
#include "precomp.h"
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <linux/utsname.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/console.h>
|
||||
#include <asm/delay.h>
|
||||
|
||||
char tempOutput[1024],tempOutput2[1024];
|
||||
|
||||
ULONG ulPrintk=0;
|
||||
BOOLEAN bInPrintk = FALSE;
|
||||
BOOLEAN bIsDebugPrint = FALSE;
|
||||
|
||||
ULONG ulCountTimerEvents = 0;
|
||||
struct timer_list sPiceRunningTimer;
|
||||
|
||||
asmlinkage int printk(const char *fmt, ...);
|
||||
|
||||
EXPORT_SYMBOL(printk);
|
||||
|
||||
//*************************************************************************
|
||||
// printk()
|
||||
//
|
||||
// this function overrides printk() in the kernel
|
||||
//*************************************************************************
|
||||
asmlinkage int printk(const char *fmt, ...)
|
||||
{
|
||||
ULONG len,ulRingBufferLock;
|
||||
static ULONG ulOldJiffies = 0;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
if((len = PICE_strlen((LPSTR)fmt)) )
|
||||
{
|
||||
save_flags(ulRingBufferLock);
|
||||
cli();
|
||||
|
||||
PICE_vsprintf(tempOutput, fmt, args);
|
||||
bIsDebugPrint = TRUE;
|
||||
// if the last debug print was longer than 5 timer ticks ago
|
||||
// directly print it, else just add it to the ring buffer
|
||||
// and let the timer process it.
|
||||
if( (jiffies-ulOldJiffies) > (1*wWindow[OUTPUT_WINDOW].cy)/2)
|
||||
{
|
||||
ulOldJiffies = jiffies;
|
||||
Print(OUTPUT_WINDOW,tempOutput);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddToRingBuffer(tempOutput);
|
||||
}
|
||||
|
||||
bIsDebugPrint = FALSE;
|
||||
restore_flags(ulRingBufferLock);
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// CountArgs()
|
||||
//
|
||||
// count occurrence of '%' in format string (except %%)
|
||||
// validity of whole format string must have been enforced
|
||||
//*************************************************************************
|
||||
ULONG CountArgs(LPSTR fmt)
|
||||
{
|
||||
ULONG count=0;
|
||||
|
||||
while(*fmt)
|
||||
{
|
||||
if(*fmt=='%' && *(fmt+1)!='%')
|
||||
count++;
|
||||
fmt++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// PrintkCallback()
|
||||
//
|
||||
// called from RealIsr() when processing INT3 placed
|
||||
//*************************************************************************
|
||||
void PrintkCallback(void)
|
||||
{
|
||||
LPSTR fmt,args;
|
||||
ULONG ulAddress;
|
||||
ULONG countArgs,i,len;
|
||||
|
||||
bInPrintk = TRUE;
|
||||
|
||||
// get the linear address of stack where string resides
|
||||
ulAddress = GetLinearAddress(CurrentSS,CurrentESP);
|
||||
if(ulAddress)
|
||||
{
|
||||
if(IsAddressValid(ulAddress+sizeof(char *)) )
|
||||
{
|
||||
fmt = (LPSTR)*(PULONG)(ulAddress+sizeof(char *));
|
||||
|
||||
// validate format string
|
||||
if((len = PICE_strlen(fmt)) )
|
||||
{
|
||||
// skip debug prefix if present
|
||||
if(len>=3 && *fmt=='<' && *(fmt+2)=='>')
|
||||
fmt += 3;
|
||||
|
||||
if((countArgs = CountArgs(fmt))>0)
|
||||
{
|
||||
|
||||
args = (LPSTR)(ulAddress+2*sizeof(char *));
|
||||
if(IsAddressValid((ULONG)args))
|
||||
{
|
||||
// validate passed in args
|
||||
for(i=0;i<countArgs;i++)
|
||||
{
|
||||
if(!IsRangeValid((ULONG)(args+i*sizeof(ULONG)),sizeof(ULONG)) )
|
||||
{
|
||||
PICE_sprintf(tempOutput,"printk(%s): argument #%u is not valid!\n",(LPSTR)fmt,i);
|
||||
Print(OUTPUT_WINDOW,tempOutput);
|
||||
bInPrintk = FALSE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
PICE_vsprintf(tempOutput2, fmt, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"printk(): ARGS are passed in but not valid!\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PICE_strcpy(tempOutput2, fmt);
|
||||
}
|
||||
Print(OUTPUT_WINDOW,tempOutput2);
|
||||
}
|
||||
}
|
||||
}
|
||||
bInPrintk = FALSE;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// PiceRunningTimer()
|
||||
//
|
||||
//*************************************************************************
|
||||
void PiceRunningTimer(unsigned long param)
|
||||
{
|
||||
mod_timer(&sPiceRunningTimer,jiffies + HZ/10);
|
||||
|
||||
CheckRingBuffer();
|
||||
|
||||
if(ulCountTimerEvents++ > 10)
|
||||
{
|
||||
ulCountTimerEvents = 0;
|
||||
|
||||
SetForegroundColor(COLOR_TEXT);
|
||||
SetBackgroundColor(COLOR_CAPTION);
|
||||
PICE_sprintf(tempOutput,"jiffies = %.8X\n",jiffies);
|
||||
PutChar(tempOutput,GLOBAL_SCREEN_WIDTH-strlen(tempOutput),GLOBAL_SCREEN_HEIGHT-1);
|
||||
ResetColor();
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// InitPiceRunningTimer()
|
||||
//
|
||||
//*************************************************************************
|
||||
void InitPiceRunningTimer(void)
|
||||
{
|
||||
init_timer(&sPiceRunningTimer);
|
||||
sPiceRunningTimer.data = 0;
|
||||
sPiceRunningTimer.function = PiceRunningTimer;
|
||||
sPiceRunningTimer.expires = jiffies + HZ;
|
||||
add_timer(&sPiceRunningTimer);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// RemovePiceRunningTimer()
|
||||
//
|
||||
//*************************************************************************
|
||||
void RemovePiceRunningTimer(void)
|
||||
{
|
||||
del_timer(&sPiceRunningTimer);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// InstallPrintkHook()
|
||||
//
|
||||
//*************************************************************************
|
||||
void InstallPrintkHook(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
DPRINT((0,"enter InstallPrintk()\n"));
|
||||
|
||||
ScanExports("printk",(PULONG)&ulPrintk);
|
||||
if(ulPrintk)
|
||||
{
|
||||
InstallSWBreakpoint(ulPrintk,TRUE,PrintkCallback);
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// DeInstallPrintkHook()
|
||||
//
|
||||
//*************************************************************************
|
||||
void DeInstallPrintkHook(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
DPRINT((0,"enter DeInstallPrintkHook()\n"));
|
||||
|
||||
if(ulPrintk)
|
||||
{
|
||||
// will be done on exit debugger
|
||||
DeInstallSWBreakpoint(ulPrintk);
|
||||
}
|
||||
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
38
reactos/apps/utils/pice/module/output.h
Normal file
38
reactos/apps/utils/pice/module/output.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
output.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for output.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
void InstallPrintkHook(void);
|
||||
void DeInstallPrintkHook(void);
|
||||
extern ULONG ulPrintk;
|
||||
extern BOOLEAN bInPrintk;
|
||||
extern BOOLEAN bIsDebugPrint;
|
||||
|
||||
void InitPiceRunningTimer(void);
|
||||
void RemovePiceRunningTimer(void);
|
4181
reactos/apps/utils/pice/module/parse.c
Normal file
4181
reactos/apps/utils/pice/module/parse.c
Normal file
File diff suppressed because it is too large
Load diff
167
reactos/apps/utils/pice/module/parse.h
Normal file
167
reactos/apps/utils/pice/module/parse.h
Normal file
|
@ -0,0 +1,167 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
parse.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for parse.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
typedef struct TagArgs
|
||||
{
|
||||
ULONG Value[16];
|
||||
ULONG Count;
|
||||
UCHAR Switch[16];
|
||||
ULONG CountSwitches;
|
||||
BOOLEAN bNotTranslated[16];
|
||||
LPSTR pToken[16];
|
||||
}ARGS,*PARGS;
|
||||
|
||||
typedef struct tagCPUInfo
|
||||
{
|
||||
char *Name;
|
||||
PULONG pValue;
|
||||
}CPUINFO;
|
||||
|
||||
typedef BOOLEAN (*PFN)(PARGS);
|
||||
|
||||
#define MAX_ARGS (5)
|
||||
|
||||
typedef struct _CMDTABLE
|
||||
{
|
||||
char * Cmd;
|
||||
PFN Handler;
|
||||
char * Help;
|
||||
ULONG Flags;
|
||||
ULONG ParamFlags[MAX_ARGS];
|
||||
LPSTR pszRecognizedSwitches;
|
||||
ULONG CommandGroup;
|
||||
}CMDTABLE,*PCMDTABLE;
|
||||
|
||||
typedef struct tagKeyWords
|
||||
{
|
||||
char* KeyWord;
|
||||
PVOID pValue;
|
||||
ULONG ulSize;
|
||||
}KEYWORDS;
|
||||
|
||||
typedef struct tagSETGETREGS
|
||||
{
|
||||
char *RegName;
|
||||
PULONG RegAddr;
|
||||
}SETGETREGS;
|
||||
|
||||
typedef struct tag_BP
|
||||
{
|
||||
ULONG LinearAddress;
|
||||
ULONG Segment,Offset;
|
||||
BOOLEAN Used;
|
||||
BOOLEAN Active;
|
||||
BOOLEAN Virtual;
|
||||
char ModName[256];
|
||||
char SymName[256];
|
||||
}BP;
|
||||
|
||||
extern BOOLEAN bNeedToFillBuffer;
|
||||
|
||||
extern BOOLEAN bCodeOn;
|
||||
extern BOOLEAN bShowSrc;
|
||||
extern BP Bp[];
|
||||
extern BOOLEAN bInt3Here;
|
||||
|
||||
extern BOOLEAN bStepping;
|
||||
|
||||
extern char szCurrentFile[256];
|
||||
extern struct module* pCurrentMod;
|
||||
extern PICE_SYMBOLFILE_HEADER* pCurrentSymbols;
|
||||
extern LONG ulCurrentlyDisplayedLineNumber;
|
||||
|
||||
BOOLEAN AsciiToHex(LPSTR p,PULONG pValue);
|
||||
void Parse(LPSTR pCmdLine,BOOLEAN bInvokedByFkey);
|
||||
LPSTR FindCommand(LPSTR p);
|
||||
ULONG StrLenUpToWhiteChar(LPSTR p,LPSTR lpszWhiteChars);
|
||||
BOOLEAN WaitForKey(void);
|
||||
BOOLEAN ConvertTokenToHex(LPSTR p,PULONG pValue);
|
||||
void DisplaySourceFile(LPSTR pSrcLine,LPSTR pSrcEnd,ULONG ulLineNumber,ULONG ulLineNumberToInvert);
|
||||
BOOLEAN ConvertTokenToSrcFile(LPSTR p,PULONG pValue);
|
||||
void RepaintDesktop(void);
|
||||
void PutStatusText(LPSTR p);
|
||||
void UnassembleOneLineDown(void);
|
||||
void UnassembleOnePageDown(ULONG page);
|
||||
void UnassembleOneLineUp(void);
|
||||
void UnassembleOnePageUp(ULONG page);
|
||||
|
||||
extern BOOLEAN (*DisplayMemory)(PARGS pArgs);
|
||||
|
||||
#define COMMAND_PROTOTYPE(arg) BOOLEAN arg(PARGS pArgs)
|
||||
#define COMMAND_RET return TRUE
|
||||
|
||||
// available commands
|
||||
COMMAND_PROTOTYPE(ShowGdt);
|
||||
COMMAND_PROTOTYPE(LeaveIce);
|
||||
COMMAND_PROTOTYPE(SingleStep);
|
||||
COMMAND_PROTOTYPE(ShowHelp);
|
||||
COMMAND_PROTOTYPE(ShowPageDirs);
|
||||
COMMAND_PROTOTYPE(ShowProcesses);
|
||||
COMMAND_PROTOTYPE(DisplayMemoryDword);
|
||||
COMMAND_PROTOTYPE(DisplayMemoryByte);
|
||||
COMMAND_PROTOTYPE(DisplayPhysMemDword);
|
||||
COMMAND_PROTOTYPE(Unassemble);
|
||||
COMMAND_PROTOTYPE(ShowSymbols);
|
||||
COMMAND_PROTOTYPE(ShowModules);
|
||||
COMMAND_PROTOTYPE(SetBreakpoint);
|
||||
COMMAND_PROTOTYPE(ListBreakpoints);
|
||||
COMMAND_PROTOTYPE(ClearBreakpoints);
|
||||
COMMAND_PROTOTYPE(Ver);
|
||||
COMMAND_PROTOTYPE(Hboot);
|
||||
COMMAND_PROTOTYPE(I3here);
|
||||
COMMAND_PROTOTYPE(I1here);
|
||||
COMMAND_PROTOTYPE(SetSrcDisplay);
|
||||
COMMAND_PROTOTYPE(ShowIdt);
|
||||
COMMAND_PROTOTYPE(StepOver);
|
||||
COMMAND_PROTOTYPE(StepInto);
|
||||
COMMAND_PROTOTYPE(SetGetRegisters);
|
||||
COMMAND_PROTOTYPE(SetCodeDisplay);
|
||||
COMMAND_PROTOTYPE(NextInstr);
|
||||
COMMAND_PROTOTYPE(ShowCPU);
|
||||
COMMAND_PROTOTYPE(ShowTables);
|
||||
COMMAND_PROTOTYPE(WalkStack);
|
||||
COMMAND_PROTOTYPE(ShowVirtualMemory);
|
||||
COMMAND_PROTOTYPE(UnassembleAtCurrentEip);
|
||||
COMMAND_PROTOTYPE(PokeMemory);
|
||||
COMMAND_PROTOTYPE(PeekMemory);
|
||||
COMMAND_PROTOTYPE(ShowLocals);
|
||||
COMMAND_PROTOTYPE(SwitchTables);
|
||||
COMMAND_PROTOTYPE(SwitchFiles);
|
||||
COMMAND_PROTOTYPE(EvaluateExpression);
|
||||
COMMAND_PROTOTYPE(SizeCodeWindow);
|
||||
COMMAND_PROTOTYPE(SizeDataWindow);
|
||||
COMMAND_PROTOTYPE(ClearScreen);
|
||||
COMMAND_PROTOTYPE(ShowMappings);
|
||||
COMMAND_PROTOTYPE(ShowTimers);
|
||||
COMMAND_PROTOTYPE(ShowPCI);
|
||||
COMMAND_PROTOTYPE(SetKeyboardLayout);
|
||||
COMMAND_PROTOTYPE(ShowSysCallTable);
|
||||
COMMAND_PROTOTYPE(SetAltKey);
|
||||
COMMAND_PROTOTYPE(ShowContext);
|
177
reactos/apps/utils/pice/module/patch.c
Normal file
177
reactos/apps/utils/pice/module/patch.c
Normal file
|
@ -0,0 +1,177 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
patch.c
|
||||
|
||||
Abstract:
|
||||
|
||||
hooking of kernel internal keyboard interrupt handler
|
||||
|
||||
Environment:
|
||||
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
10-Jul-1999: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#include "remods.h"
|
||||
#include "precomp.h"
|
||||
|
||||
#include <asm/system.h>
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// GLOBALS
|
||||
////
|
||||
|
||||
static PUCHAR pPatchAddress;
|
||||
static ULONG ulOldOffset = 0;
|
||||
static ULONG ulKeyPatchFlags;
|
||||
BOOLEAN bPatched = FALSE;
|
||||
void (*old_handle_scancode)(UCHAR,int);
|
||||
char tempPatch[256];
|
||||
UCHAR ucBreakKey = 'D'; // key that will break into debugger in combination with CTRL
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// FUNCTIONS
|
||||
////
|
||||
|
||||
// the keyboard hook
|
||||
void pice_handle_scancode(UCHAR scancode,int bKeyPressed)
|
||||
{
|
||||
UCHAR ucKey = scancode & 0x7f;
|
||||
static BOOLEAN bControl = FALSE;
|
||||
BOOLEAN bForward=TRUE;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
DPRINT((0,"pice_handle_scancode(%x,%u)\n",scancode,bKeyPressed));
|
||||
DPRINT((0,"pice_handle_scancode(1): bControl = %u bForward = %u bEnterNow = %u\n",bControl,bForward,bEnterNow));
|
||||
if(bKeyPressed)
|
||||
{
|
||||
// CTRL pressed
|
||||
if(ucKey==0x1d)
|
||||
{
|
||||
bControl=TRUE;
|
||||
}
|
||||
else if(bControl==TRUE && ucKey==AsciiToScan(ucBreakKey)) // CTRL-F
|
||||
{
|
||||
// fake a CTRL-F release call
|
||||
old_handle_scancode(0x1d|0x80,FALSE);
|
||||
old_handle_scancode(AsciiToScan(ucBreakKey)|0x80,FALSE);
|
||||
bForward=FALSE;
|
||||
bEnterNow=TRUE;
|
||||
bControl=FALSE;
|
||||
}
|
||||
else if((ucKey == 66|| ucKey == 68) && bStepping)
|
||||
{
|
||||
bForward=FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// CTRL released
|
||||
if(ucKey==0x1d)
|
||||
{
|
||||
bControl=FALSE;
|
||||
}
|
||||
else if((ucKey == 66|| ucKey == 68) && bStepping)
|
||||
{
|
||||
bForward=FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if(bForward)
|
||||
{
|
||||
DPRINT((0,"pice_handle_scancode(): forwarding key stroke\n"));
|
||||
old_handle_scancode(scancode,bKeyPressed);
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
BOOLEAN PatchKeyboardDriver(ULONG AddrOfKbdEvent,ULONG AddrOfScancode)
|
||||
{
|
||||
UCHAR ucPattern[5] = {0xE8,0x0,0x0,0x0,0x0};
|
||||
PULONG pOffset = (PULONG)&ucPattern[1];
|
||||
ULONG ulOffset,countBytes = 0;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
(void*)old_handle_scancode = AddrOfScancode;
|
||||
DPRINT((0,"handle_scancode = %X\n",AddrOfScancode));
|
||||
|
||||
pPatchAddress = (PUCHAR)AddrOfKbdEvent; // handle_kbd_event
|
||||
DPRINT((0,"initial patch address = %X\n",AddrOfKbdEvent));
|
||||
ulOffset = (ULONG)old_handle_scancode - ((ULONG)pPatchAddress+sizeof(ULONG)+1);
|
||||
DPRINT((0,"initial offset = %X\n",ulOffset));
|
||||
*pOffset = ulOffset;
|
||||
|
||||
while((memcmp(pPatchAddress,ucPattern,sizeof(ucPattern))!=0) &&
|
||||
(countBytes<0x1000))
|
||||
{
|
||||
/* DPRINT((0,"offset = %X\n",ulOffset));
|
||||
DPRINT((0,"patch address = %X\n",pPatchAddress));
|
||||
DPRINT((0,"pattern1 = %.2X %.2X %.2X %.2X %.2X\n",ucPattern[0],ucPattern[1],ucPattern[2],ucPattern[3],ucPattern[4]));
|
||||
DPRINT((0,"pattern2 = %.2X %.2X %.2X %.2X %.2X\n",pPatchAddress[0],pPatchAddress[1],pPatchAddress[2],pPatchAddress[3],pPatchAddress[4]));*/
|
||||
|
||||
countBytes++;
|
||||
pPatchAddress++;
|
||||
|
||||
ulOffset = (ULONG)old_handle_scancode - ((ULONG)pPatchAddress+sizeof(ULONG)+1);
|
||||
*pOffset = ulOffset;
|
||||
}
|
||||
|
||||
if(memcmp(pPatchAddress,ucPattern,sizeof(ucPattern))==0)
|
||||
{
|
||||
DPRINT((0,"pattern found @ %x\n",pPatchAddress));
|
||||
|
||||
ulOffset = (ULONG)&pice_handle_scancode - ((ULONG)pPatchAddress+sizeof(ULONG)+1);
|
||||
ulOldOffset = *(PULONG)(pPatchAddress + 1);
|
||||
DPRINT((0,"old offset = %x new offset = %x\n",ulOldOffset,ulOffset));
|
||||
|
||||
save_flags(ulKeyPatchFlags);
|
||||
cli();
|
||||
*(PULONG)(pPatchAddress + 1) = ulOffset;
|
||||
|
||||
bPatched = TRUE;
|
||||
|
||||
restore_flags(ulKeyPatchFlags);
|
||||
DPRINT((0,"PatchKeyboardDriver(): SUCCESS!\n"));
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return bPatched;
|
||||
}
|
||||
|
||||
void RestoreKeyboardDriver(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
if(bPatched)
|
||||
{
|
||||
save_flags(ulKeyPatchFlags);
|
||||
cli();
|
||||
*(PULONG)(pPatchAddress + 1) = ulOldOffset;
|
||||
restore_flags(ulKeyPatchFlags);
|
||||
}
|
||||
LEAVE_FUNC();
|
||||
}
|
34
reactos/apps/utils/pice/module/patch.h
Normal file
34
reactos/apps/utils/pice/module/patch.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
patch.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for patch.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
BOOLEAN PatchKeyboardDriver(ULONG AddrOfKbdEvent,ULONG AddrOfScancode);
|
||||
void RestoreKeyboardDriver(void);
|
||||
|
||||
extern UCHAR ucBreakKey;
|
905
reactos/apps/utils/pice/module/pci_ids.h
Normal file
905
reactos/apps/utils/pice/module/pci_ids.h
Normal file
|
@ -0,0 +1,905 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
pci_ids.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER, PCI vendor IDs
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
struct _PCI_VENDOR_IDS
|
||||
{
|
||||
USHORT vendorid;
|
||||
char* vendor_name;
|
||||
}PCIVendorIDs[]=
|
||||
{
|
||||
{0x0033 ,"PARADYNE CORP."},
|
||||
{0x003D ,"REAL 3D"},
|
||||
{0x0100 ,"NCIPHER CORP. LTD"},
|
||||
{0x0A89 ,"BREA TECHNOLOGIES INC"},
|
||||
{0x0E11 ,"COMPAQ COMPUTER CORP."},
|
||||
{0x1000 ,"SYMBIOS LOGIC INC/LSI LOGIC"},
|
||||
{0x1001 ,"KOLTER ELECTRONIC"},
|
||||
{0x1002 ,"ATI TECHNOLOGIES INC"},
|
||||
{0x1004 ,"VLSI TECHNOLOGY INC"},
|
||||
{0x100B ,"NATIONAL SEMICONDUCTOR CORPORATION"},
|
||||
{0x1010 ,"VIDEO LOGIC LTD"},
|
||||
{0x1014 ,"IBM"},
|
||||
{0x1018 ,"UNISYS CORPORATION"},
|
||||
{0x1019 ,"ELITEGROUP COMPUTER SYS"},
|
||||
{0x101A ,"NCR"},
|
||||
{0x101E ,"AMERICAN MEGATRENDS"},
|
||||
{0x1020 ,"HITACHI COMPUTER PRODUCTS"},
|
||||
{0x1021 ,"OKI ELECTRIC INDUSTRY CO. LTD."},
|
||||
{0x1022 ,"ADVANCED MICRO DEVICES"},
|
||||
{0x1023 ,"TRIDENT MICROSYSTEMS"},
|
||||
{0x1028 ,"DELL COMPUTER CORPORATION"},
|
||||
{0x102A ,"LSI LOGIC CORPORATION"},
|
||||
{0x102B ,"MATROX GRAPHICS, INC."},
|
||||
{0x102F ,"TOSHIBA AMERICA, ELEC. COMPANY"},
|
||||
{0x1033 ,"NEC CORPORATION"},
|
||||
{0x1038 ,"AMP, INC"},
|
||||
{0x1039 ,"SILICON INTEGRATED SYSTEMS"},
|
||||
{0x103C ,"HEWLETT PACKARD"},
|
||||
{0x103F ,"SYNOPSYS/LOGIC MODELING GROUP"},
|
||||
{0x1042 ,"MICRON ELECTRONICS, INC."},
|
||||
{0x1043 ,"ASUSTEK COMPUTER, INC."},
|
||||
{0x1044 ,"DISTRIBUTED PROCESSING TECHNOLOGY"},
|
||||
{0x1045 ,"OPTI INC."},
|
||||
{0x1048 ,"ELSA AG"},
|
||||
{0x1049 ,"FOUNTAIN TECHNOLOGIES, INC."},
|
||||
{0x104C ,"TEXAS INSTRUMENTS"},
|
||||
{0x104D ,"SONY CORPORATION"},
|
||||
{0x1050 ,"WINBOND ELECTRONICS CORP"},
|
||||
{0x1054 ,"HITACHI, LTD"},
|
||||
{0x1055 ,"STANDARD MICROSYSTEMS CORP."},
|
||||
{0x1057 ,"MOTOROLA"},
|
||||
{0x1058 ,"ETRI"},
|
||||
{0x1059 ,"TEKNOR INDUSTRIAL COMPUTERS INC"},
|
||||
{0x105A ,"PROMISE TECHNOLOGY, INC."},
|
||||
{0x105B ,"FOXCONN INTERNATIONAL INC"},
|
||||
{0x105D ,"NUMBER 9 VISUAL TECHNOLOGY"},
|
||||
{0x105F ,"INFOTRONIC AMERICA INC"},
|
||||
{0x1063 ,"OCEAN MANUFACTURING LTD"},
|
||||
{0x1064 ,"ALCATEL"},
|
||||
{0x1067 ,"MITSUBISHI ELECTRIC AMERICA"},
|
||||
{0x1068 ,"DIVERSIFIED TECHNOLOGY"},
|
||||
{0x1069 ,"MYLEX CORPORATION"},
|
||||
{0x106B ,"APPLE COMPUTER INC."},
|
||||
{0x106D ,"SEQUENT COMPUTER SYSTEMS"},
|
||||
{0x1070 ,"DAEWOO TELECOM LTD"},
|
||||
{0x1071 ,"MITAC"},
|
||||
{0x1073 ,"YAMAHA CORPORATION"},
|
||||
{0x1077 ,"QLOGIC"},
|
||||
{0x1079 ,"I-BUS"},
|
||||
{0x107B ,"GATEWAY 2000"},
|
||||
{0x107E ,"INTERPHASE CORPORATION"},
|
||||
{0x108D ,"OLICOM"},
|
||||
{0x1095 ,"CMD TECHNOLOGY INC"},
|
||||
{0x1096 ,"ALACRON"},
|
||||
{0x1097 ,"APPIAN/ETMA"},
|
||||
{0x109A ,"PACKARD BELL NEC"},
|
||||
{0x109E ,"BROOKTREE CORPORATION"},
|
||||
{0x109F ,"TRIGEM COMPUTER INC."},
|
||||
{0x10A0 ,"MEIDENSHA CORPORATION"},
|
||||
{0x10A2 ,"QUANTUM EFFECT DESIGN"},
|
||||
{0x10A9 ,"SILICON GRAPHICS"},
|
||||
{0x10AC ,"HONEYWELL IAC"},
|
||||
{0x10AF ,"MICRO COMPUTER SYSTEMS INC"},
|
||||
{0x10B5 ,"PLX TECHNOLOGY, INC."},
|
||||
{0x10B6 ,"MADGE NETWORKS"},
|
||||
{0x10B7 ,"3COM CORPORATION"},
|
||||
{0x10B9 ,"ACER LABS INC."},
|
||||
{0x10BA ,"MITSUBISHI ELECTRIC CORP."},
|
||||
{0x10C2 ,"AUSPEX SYSTEMS INC."},
|
||||
{0x10C8 ,"NEOMAGIC CORPORATION"},
|
||||
{0x10CA ,"FUJITSU MICROELECTRONIC., INC."},
|
||||
{0x10CB ,"OMRON CORPORATION"},
|
||||
{0x10CD ,"ADVANCED SYSTEM PRODUCTS, INC"},
|
||||
{0x10CF ,"FUJITSU LIMITED"},
|
||||
{0x10D1 ,"FUTUREPLUS SYSTEMS CORP."},
|
||||
{0x10D2 ,"MOLEX INCORPORATED"},
|
||||
{0x10DB ,"ROHM LSI SYSTEMS"},
|
||||
{0x10DD ,"EVANS & SUTHERLAND"},
|
||||
{0x10DE ,"NVIDIA CORPORATION"},
|
||||
{0x10DF ,"EMULEX CORPORATION"},
|
||||
{0x10E1 ,"TEKRAM TECHNOLOGY CO.,LTD."},
|
||||
{0x10E3 ,"TUNDRA SEMICONDUCTOR CORP."},
|
||||
{0x10E5 ,"MICRO INDUSTRIES CORPORATION"},
|
||||
{0x10EC ,"REALTEK SEMICONDUCTOR CORP."},
|
||||
{0x10EE ,"XILINX, INC."},
|
||||
{0x10F1 ,"TYAN COMPUTER"},
|
||||
{0x10F5 ,"NKK CORPORATION"},
|
||||
{0x10F6 ,"CREATIVE ELECTRONIC SYSTEMS SA"},
|
||||
{0x10FC ,"I-O DATA DEVICE, INC."},
|
||||
{0x10FE ,"FAST MULTIMEDIA AG"},
|
||||
{0x1101 ,"INITIO CORPORATION"},
|
||||
{0x1102 ,"CREATIVE LABS"},
|
||||
{0x1105 ,"SIGMA DESIGNS, INC"},
|
||||
{0x1106 ,"VIA TECHNOLOGIES, INC."},
|
||||
{0x1107 ,"ASCEND COMMUNICATIONS, INC."},
|
||||
{0x1109 ,"ADAPTEC/COGENT DATA TECHNOLOGIES INC"},
|
||||
{0x110A ,"SIEMENS PC SYSTEME GMBH"},
|
||||
{0x1111 ,"SANTA CRUZ OPERATION"},
|
||||
{0x1113 ,"ACCTON TECHNOLOGY CORPORATION"},
|
||||
{0x1116 ,"MEDIA 100, INC"},
|
||||
{0x1117 ,"DATACUBE, INC"},
|
||||
{0x1118 ,"FCI ELECTRONICS"},
|
||||
{0x1119 ,"ICP-VORTEX COMPUTERSYSTEM GMBH"},
|
||||
{0x111A ,"EFFICIENT NETWORKS, INC"},
|
||||
{0x111D ,"INTEGRATED DEVICE TECH"},
|
||||
{0x1120 ,"EMC CORPORATION"},
|
||||
{0x1127 ,"FORE SYSTEMS INC"},
|
||||
{0x112A ,"HERMES ELECTRONICS COMPANY, LTD."},
|
||||
{0x112F ,"IMAGING TECHNOLOGY, INC"},
|
||||
{0x1131 ,"PHILIPS SEMICONDUCTORS"},
|
||||
{0x1132 ,"MITEL CORP."},
|
||||
{0x1133 ,"EICON TECHNOLOGY CORPORATION"},
|
||||
{0x1134 ,"MERCURY COMPUTER SYSTEMS"},
|
||||
{0x1135 ,"FUJI XEROX CO LTD"},
|
||||
{0x1136 ,"MOMENTUM DATA SYSTEMS"},
|
||||
{0x1137 ,"CISCO SYSTEMS INC"},
|
||||
{0x1138 ,"ZIATECH CORPORATION"},
|
||||
{0x113C ,"CYCLONE MICROSYSTEMS, INC."},
|
||||
{0x113E ,"SANYO ELECTRIC CO - INFORMATION SYSTEMS DIVISION"},
|
||||
{0x1141 ,"CREST MICROSYSTEM INC."},
|
||||
{0x1145 ,"WORKBIT CORPORATION"},
|
||||
{0x1146 ,"FORCE COMPUTERS GMBH"},
|
||||
{0x1148 ,"SYSKONNECT"},
|
||||
{0x114C ,"ANNABOOKS"},
|
||||
{0x114F ,"DIGI INTERNATIONAL"},
|
||||
{0x1154 ,"MELCO INC"},
|
||||
{0x115C ,"PHOTRON LTD."},
|
||||
{0x115D ,"XIRCOM"},
|
||||
{0x1161 ,"PFU LIMITED"},
|
||||
{0x1163 ,"RENDITION, A DIVISION OF MICRON"},
|
||||
{0x1166 ,"RELIANCE COMPUTER"},
|
||||
{0x116E ,"ELECTRONICS FOR IMAGING"},
|
||||
{0x1170 ,"INVENTEC CORPORATION"},
|
||||
{0x1171 ,"BLUE WAVE SYSTEMS"},
|
||||
{0x1172 ,"ALTERA CORPORATION"},
|
||||
{0x1179 ,"TOSHIBA AMERICA INFO SYSTEMS"},
|
||||
{0x1180 ,"RICOH CO LTD"},
|
||||
{0x1186 ,"D-LINK SYSTEM INC"},
|
||||
{0x1187 ,"ADVANCED TECHNOLOGY LABORATORIES, INC."},
|
||||
{0x1189 ,"MATSUSHITA ELECTIC INDUSTRIAL CO LTD"},
|
||||
{0x118B ,"PLATYPUS TECHNOLOGY PTY LTD"},
|
||||
{0x118C ,"COROLLARY, INC"},
|
||||
{0x1191 ,"ACARD TECHNOLOGY CORP"},
|
||||
{0x1195 ,"RATOC SYSTEMS INC"},
|
||||
{0x119A ,"MINDSHARE, INC."},
|
||||
{0x119D ,"BUG, INC."},
|
||||
{0x119E ,"FUJITSU MICROELECTRONICS LTD."},
|
||||
{0x119F ,"BULL HN INFORMATION SYSTEMS"},
|
||||
{0x11A1 ,"HAMAMATSU PHOTONICS K.K."},
|
||||
{0x11A9 ,"INNOSYS"},
|
||||
{0x11AA ,"ACTEL"},
|
||||
{0x11AB ,"GALILEO TECHNOLOGY LTD."},
|
||||
{0x11AD ,"LITE-ON COMMUNICATIONS INC"},
|
||||
{0x11AE ,"SCITEX CORPORATION"},
|
||||
{0x11AF ,"AVID TECHNOLOGY INC"},
|
||||
{0x11B0 ,"V3 SEMICONDUCTOR INC."},
|
||||
{0x11B2 ,"EASTMAN KODAK"},
|
||||
{0x11B3 ,"BARR SYSTEMS INC."},
|
||||
{0x11BF ,"ASTRODESIGN, INC."},
|
||||
{0x11C6 ,"DAINIPPON SCREEN MFG. CO. LTD"},
|
||||
{0x11C8 ,"DOLPHIN INTERCONNECT SOLUTIONS AS"},
|
||||
{0x11C9 ,"MAGMA"},
|
||||
{0x11CA ,"LSI SYSTEMS, INC"},
|
||||
{0x11CB ,"SPECIALIX INTERNATIONAL LTD"},
|
||||
{0x11CE ,"NETACCESS"},
|
||||
{0x11D0 ,"LOCKHEED MARTIN - ELECTRONISS & COMMUNICATIONS"},
|
||||
{0x11D1 ,"AURAVISION"},
|
||||
{0x11D2 ,"INTERCOM INC."},
|
||||
{0x11D4 ,"ANALOG DEVICES"},
|
||||
{0x11D5 ,"IKON CORPORATION"},
|
||||
{0x11D9 ,"TOSHIBA TEC CORPORATION"},
|
||||
{0x11DA ,"NOVELL"},
|
||||
{0x11DF ,"NEW WAVE PDG"},
|
||||
{0x11E3 ,"QUICKLOGIC CORPORATION"},
|
||||
{0x11EC ,"CORECO INC"},
|
||||
{0x11EE ,"DOME IMAGING SYSTEMS INC"},
|
||||
{0x11F8 ,"PMC-SIERRA INC"},
|
||||
{0x1203 ,"AGFA CORPORATION"},
|
||||
{0x1206 ,"AMDAHL CORPORATION"},
|
||||
{0x120F ,"ESSENTIAL COMMUNICATIONS"},
|
||||
{0x1214 ,"PERFORMANCE TECHNOLOGIES, INC."},
|
||||
{0x1216 ,"PURUP - ESKOFOT A/S"},
|
||||
{0x1217 ,"O2MICRO, INC."},
|
||||
{0x121A ,"3DFX INTERACTIVE, INC."},
|
||||
{0x121B ,"VIRATA LTD"},
|
||||
{0x1221 ,"CONTEC CO., LTD"},
|
||||
{0x1223 ,"ARTESYN COMMUNICATIONS PRODUCTS INC"},
|
||||
{0x1227 ,"TECH-SOURCE"},
|
||||
{0x122C ,"SICAN GMBH"},
|
||||
{0x1232 ,"MARCONI COMMUNICATIONS LTD"},
|
||||
{0x123C ,"CENTURY SYSTEMS, INC."},
|
||||
{0x123D ,"ENGINEERING DESIGN TEAM, INC."},
|
||||
{0x123F ,"C-CUBE MICROSYSTEMS"},
|
||||
{0x1242 ,"JAYCOR NETWORKS INC."},
|
||||
{0x1244 ,"AVM AUDIOVISUELLES MKTG & COMPUTER SYSTEM GMBH"},
|
||||
{0x124B ,"SBS TECHNOLOGIES"},
|
||||
{0x1250 ,"HITACHI ULSI SYSTEMS CO LTD"},
|
||||
{0x1253 ,"GUZIK TECHNICAL ENTERPRISES"},
|
||||
{0x1255 ,"OPTIBASE LTD"},
|
||||
{0x1259 ,"ALLIED TELESYN INTERNATIONAL"},
|
||||
{0x125C ,"AURORA TECHNOLOGIES, INC."},
|
||||
{0x125F ,"CONCURRENT TECHNOLOGIES"},
|
||||
{0x1260 ,"INTERSIL CORP"},
|
||||
{0x1261 ,"MATSUSHITA-KOTOBUKI ELECTRONICS INDUSTRIES, LTD."},
|
||||
{0x1264 ,"AVAL NAGASAKI CORPORATION"},
|
||||
{0x1268 ,"TEKTRONIX"},
|
||||
{0x126C ,"NORTEL NETWORKS"},
|
||||
{0x126D ,"SPLASH TECHNOLOGY, INC."},
|
||||
{0x126E ,"SUMITOMO METAL INDUSTRIES, LTD."},
|
||||
{0x126F ,"SILICON MOTION, INC."},
|
||||
{0x1270 ,"OLYMPUS OPTICAL CO., LTD."},
|
||||
{0x1274 ,"CREATIVE LABS, INC. MALVERN"},
|
||||
{0x1275 ,"NETWORK APPLIANCE CORPORATION"},
|
||||
{0x1278 ,"TRANSTECH DSP LTD"},
|
||||
{0x1279 ,"TRANSMETA CORPORATION"},
|
||||
{0x127D ,"VELA RESEARCH LP"},
|
||||
{0x127F ,"FUJIFILM"},
|
||||
{0x1281 ,"YOKOGAWA ELECTRIC CORPORATION"},
|
||||
{0x1283 ,"INTEGRATED TECHNOLOGY EXPRESS, INC."},
|
||||
{0x1286 ,"MAZET GMBH"},
|
||||
{0x128B ,"TRANSWITCH CORPORATION"},
|
||||
{0x128D ,"G2 NETWORKS, INC."},
|
||||
{0x128F ,"TATENO DENNOU, INC."},
|
||||
{0x1290 ,"TOSHIBA PERSONAL COMPUTER SYSTEM CORP."},
|
||||
{0x1291 ,"NCS COMPUTER ITALIA SRL"},
|
||||
{0x1292 ,"TRITECH MICROELECTRONICS INC"},
|
||||
{0x1297 ,"SHUTTLE COMPUTER"},
|
||||
{0x1299 ,"KNOWLEDGE TECHNOLOGY LAB."},
|
||||
{0x129A ,"VMETRO, INC."},
|
||||
{0x129E ,"VICTOR COMPANY OF JAPAN, LTD."},
|
||||
{0x12A0 ,"ALLEN- BRADLEY COMPANY"},
|
||||
{0x12A3 ,"LUCENT TECHNOLOGIES"},
|
||||
{0x12A7 ,"AMO GMBH"},
|
||||
{0x12A9 ,"XIOTECH CORPORATION"},
|
||||
{0x12AB ,"YUAN YUAN ENTERPRISE CO., LTD."},
|
||||
{0x12AE ,"ALTEON WEBSYSTEMS INC"},
|
||||
{0x12B6 ,"NATURAL MICROSYSTEMS"},
|
||||
{0x12B7 ,"COGNEX MODULAR VISION SYSTEMS DIV. - ACUMEN INC."},
|
||||
{0x12B9 ,"3COM CORP."},
|
||||
{0x12BC ,"ARRAY MICROSYSTEMS"},
|
||||
{0x12BE ,"ANCHOR CHIPS INC."},
|
||||
{0x12BF ,"FUJIFILM MICRODEVICES"},
|
||||
{0x12C0 ,"INFIMED"},
|
||||
{0x12C3 ,"HOLTEK SEMICONDUCTOR INC"},
|
||||
{0x12C4 ,"CONNECT TECH INC"},
|
||||
{0x12C6 ,"MITAN CORPORATION"},
|
||||
{0x12C7 ,"DIALOGIC CORP"},
|
||||
{0x12CA ,"INTEGRATED COMPUTING ENGINES"},
|
||||
{0x12CD ,"AIMS LAB"},
|
||||
{0x12D3 ,"GE VINGMED ULTRASOUND AS"},
|
||||
{0x12D4 ,"COMVERSE NETWORKS SYSTEM & ULTICOM, INC."},
|
||||
{0x12D5 ,"EQUATOR TECHNOLOGIES"},
|
||||
{0x12D6 ,"ANALOGIC CORP"},
|
||||
{0x12D8 ,"PERICOM SEMICONDUCTOR"},
|
||||
{0x12D9 ,"ACULAB PLC"},
|
||||
{0x12DA ,"TRUE TIME INC."},
|
||||
{0x12DE ,"RAINBOW TECHNOLOGIES"},
|
||||
{0x12DF ,"SBS TECHNOLOGIES INC"},
|
||||
{0x12E0 ,"CHASE RESEARCH"},
|
||||
{0x12E2 ,"DATUM INC. BANCOMM-TIMING DIVISION"},
|
||||
{0x12E4 ,"BROOKTROUT TECHNOLOGY INC"},
|
||||
{0x12E7 ,"SEBRING SYSTEMS, INC"},
|
||||
{0x12EA ,"REAL VISION, INC"},
|
||||
{0x12EB ,"AUREAL INC."},
|
||||
{0x12EC ,"3A INTERNATIONAL, INC."},
|
||||
{0x12F0 ,"PENTEK"},
|
||||
{0x12F7 ,"COGNEX INC."},
|
||||
{0x12FB ,"SPECTRUM SIGNAL PROCESSING"},
|
||||
{0x12FC ,"CAPITAL EQUIPMENT CORP"},
|
||||
{0x12FE ,"ESD ELECTRONIC SYSTEM DESIGN GMBH"},
|
||||
{0x1304 ,"JUNIPER NETWORKS INC."},
|
||||
{0x1307 ,"COMPUTER BOARDS"},
|
||||
{0x1308 ,"LEVEL ONE COMMUNICATIONS INC"},
|
||||
{0x130A ,"MITSUBISHI ELECTRIC MICROCOMPUTER"},
|
||||
{0x130B ,"COLORGRAPHIC COMMUNICATIONS CORP"},
|
||||
{0x130F ,"ADVANET INC"},
|
||||
{0x1310 ,"GESPAC"},
|
||||
{0x1313 ,"YASKAWA ELECTRIC CO."},
|
||||
{0x1316 ,"TERADYNE INC."},
|
||||
{0x1317 ,"ADMTEK INC"},
|
||||
{0x1318 ,"PACKET ENGINES INC."},
|
||||
{0x1319 ,"FORTEMEDIA, INC"},
|
||||
{0x131F ,"SIIG INC"},
|
||||
{0x1325 ,"SALIX TECHNOLOGIES INC"},
|
||||
{0x1326 ,"SEACHANGE INTERNATIONAL"},
|
||||
{0x1331 ,"RADISYS CORP."},
|
||||
{0x133D ,"PRISA NETWORKS"},
|
||||
{0x133F ,"SCM MICROSYSTEMS"},
|
||||
{0x1342 ,"PROMAX SYSTEMS INC"},
|
||||
{0x1344 ,"MICRON TECHNOLOGY INC"},
|
||||
{0x134B ,"ARK RESEARCH CORP."},
|
||||
{0x134C ,"CHORI JOHO SYSTEM CO. LTD"},
|
||||
{0x134D ,"PC-TEL INC"},
|
||||
{0x135A ,"BRAIN BOXES LIMITED"},
|
||||
{0x135C ,"QUATECH INC"},
|
||||
{0x135E ,"SEALEVEL SYSTEMS INC"},
|
||||
{0x135F ,"I-DATA INTERNATIONAL A-S"},
|
||||
{0x1360 ,"MEINBERG FUNKUHREN"},
|
||||
{0x1361 ,"SOLITON SYSTEMS K.K."},
|
||||
{0x1363 ,"PHOENIX TECHNOLOGIES LTD"},
|
||||
{0x1367 ,"HITACHI ZOSEN CORPORATION"},
|
||||
{0x1368 ,"SKYWARE CORPORATION"},
|
||||
{0x1369 ,"DIGIGRAM"},
|
||||
{0x136B ,"KAWASAKI STEEL CORPORATION"},
|
||||
{0x136C ,"ADTEK SYSTEM SCIENCE CO LTD"},
|
||||
{0x1375 ,"BOEING - SUNNYVALE"},
|
||||
{0x1377 ,"ELECTRONIC EQUIPMENT PRODUUTION & DISTRIBUTION GMBH"},
|
||||
{0x137A ,"MARK OF THE UNICORN INC"},
|
||||
{0x137B ,"PPT VISION"},
|
||||
{0x137C ,"IWATSU ELECTRIC CO LTD"},
|
||||
{0x137D ,"DYNACHIP CORPORATION"},
|
||||
{0x1380 ,"SANRITZ AUTOMATION CO LTC"},
|
||||
{0x1381 ,"BRAINS CO. LTD"},
|
||||
{0x1383 ,"CONTROLNET INC"},
|
||||
{0x1384 ,"STELLAR SEMICONDUCTOR INC"},
|
||||
{0x1385 ,"NETGEAR"},
|
||||
{0x1387 ,"SYSTRAN CORP"},
|
||||
{0x1388 ,"HITACHI INFORMATION TECHNOLOGY CO LTD"},
|
||||
{0x1389 ,"APPLICOM INTERNATIONAL"},
|
||||
{0x138A ,"SITERA"},
|
||||
{0x138B ,"TOKIMEC INC"},
|
||||
{0x138E ,"BASLER GMBH"},
|
||||
{0x138F ,"PATAPSCO DESIGNS INC"},
|
||||
{0x1393 ,"MOXA TECHNOLOGIES CO LTD"},
|
||||
{0x1394 ,"LEVEL ONE COMMUNICATIONS"},
|
||||
{0x1395 ,"AMBICOM INC"},
|
||||
{0x1396 ,"CIPHER SYSTEMS INC"},
|
||||
{0x1397 ,"COLOGNE CHIP DESIGNS GMBH"},
|
||||
{0x1398 ,"CLARION CO. LTD"},
|
||||
{0x1399 ,"RIOS SYSTEMS CO LTD"},
|
||||
{0x139A ,"ALACRITECH INC"},
|
||||
{0x139C ,"QUANTUM 3D INC"},
|
||||
{0x139D ,"XSTREAMS PLC/ EPL LIMITED"},
|
||||
{0x139E ,"ECHOSTAR DATA NETWORKS"},
|
||||
{0x139F ,"AETHRA S.R.L."},
|
||||
{0x13A0 ,"CRYSTAL GROUP INC"},
|
||||
{0x13A1 ,"KAWASAKI HEAVY INDUSTRIES LTD"},
|
||||
{0x13A2 ,"OSITECH COMMUNICATIONS INC"},
|
||||
{0x13A4 ,"RASCOM INC"},
|
||||
{0x13A7 ,"TELES AG"},
|
||||
{0x13A8 ,"EXAR CORP."},
|
||||
{0x13A9 ,"SIEMENS MEDICAL SYSTEMS, ULTRASOUND GROUP"},
|
||||
{0x13AA ,"NORTEL NETWORKS - BWA DIVISION"},
|
||||
{0x13AF ,"T.SQWARE"},
|
||||
{0x13B1 ,"TAMURA CORPORATION"},
|
||||
{0x13B4 ,"WELLBEAN CO INC"},
|
||||
{0x13B5 ,"ARM LTD"},
|
||||
{0x13B6 ,"DLOG GMBH"},
|
||||
{0x13B8 ,"NOKIA TELECOMMUNICATIONS OY"},
|
||||
{0x13BD ,"SHARP CORPORATION"},
|
||||
{0x13BF ,"SHAREWAVE INC"},
|
||||
{0x13C1 ,"3WARE INC"},
|
||||
{0x13C2 ,"TECHNOTREND SYSTEMTECHNIK GMBH"},
|
||||
{0x13C3 ,"JANZ COMPUTER AG"},
|
||||
{0x13C6 ,"CONDOR ENGINEERING INC"},
|
||||
{0x13C7 ,"BLUE CHIP TECHNOLOGY LTD"},
|
||||
{0x13CA ,"IOMEGA CORPORATION"},
|
||||
{0x13CC ,"METHEUS CORPORATION"},
|
||||
{0x13CF ,"STUDIO AUDIO & VIDEO LTD"},
|
||||
{0x13D0 ,"B2C2, INC"},
|
||||
{0x13D1 ,"ABOCOM SYSTEMS INC"},
|
||||
{0x13D2 ,"SHARK MULTIMEDIA INC"},
|
||||
{0x13D3 ,"IMC NETWORKS"},
|
||||
{0x13D4 ,"GRAPHICS MICROSYSTEMS INC"},
|
||||
{0x13D6 ,"K.I. TECHNOLOGY CO LTD"},
|
||||
{0x13D7 ,"TOSHIBA ENGINEERING CORPORATION"},
|
||||
{0x13D8 ,"PHOBOS CORPORATION"},
|
||||
{0x13D9 ,"APEX INC"},
|
||||
{0x13DC ,"NETBOOST CORPORATION"},
|
||||
{0x13DE ,"ABB ROBOTICS PRODUCTS AB"},
|
||||
{0x13DF ,"E-TECH INC"},
|
||||
{0x13E0 ,"GVC CORPORATION"},
|
||||
{0x13E3 ,"NEST INC"},
|
||||
{0x13E4 ,"CALCULEX INC"},
|
||||
{0x13E5 ,"TELESOFT DESIGN LTD"},
|
||||
{0x13E9 ,"INTRASERVER TECHNOLOGY INC"},
|
||||
{0x13EA ,"DALLAS SEMICONDUCTOR"},
|
||||
{0x13F0 ,"SUNDANCE TECHNOLOGY INC"},
|
||||
{0x13F1 ,"OCE' - TECHNOLOGIES B.V."},
|
||||
{0x13F2 ,"FORD MICROELECTRONICS INC"},
|
||||
{0x13F4 ,"TROIKA NETWORKS INC"},
|
||||
{0x13F6 ,"C-MEDIA ELECTRONICS INC"},
|
||||
{0x13F9 ,"NTT ADVANCED TECHNOLOGY CORP."},
|
||||
{0x13FB ,"AYDIN CORP"},
|
||||
{0x13FD ,"MICRO SCIENCE INC"},
|
||||
{0x1400 ,"ARTX INC"},
|
||||
{0x1402 ,"MEILHAUS ELECTRONIC GMBH"},
|
||||
{0x1404 ,"FUNDAMENTAL SOFTWARE INC"},
|
||||
{0x1406 ,"OCE' PRINTING SYSTEMS GMBH"},
|
||||
{0x1407 ,"LAVA COMPUTER MFG INC"},
|
||||
{0x1408 ,"ALOKA CO. LTD"},
|
||||
{0x140A ,"DSP RESEARCH INC"},
|
||||
{0x140B ,"RAMIX INC"},
|
||||
{0x140D ,"MATSUSHITA ELECTRIC WORKS LTD"},
|
||||
{0x1413 ,"ADDONICS"},
|
||||
{0x1415 ,"OXFORD SEMICONDUCTOR LTD"},
|
||||
{0x1418 ,"KYUSHU ELECTRONICS SYSTEMS INC"},
|
||||
{0x1419 ,"EXCEL SWITCHING CORP"},
|
||||
{0x141B ,"ZOOM TELEPHONICS INC"},
|
||||
{0x141E ,"FANUC LTD"},
|
||||
{0x1420 ,"PSION DACOM PLC"},
|
||||
{0x1428 ,"EDEC CO LTD"},
|
||||
{0x1429 ,"UNEX TECHNOLOGY CORP."},
|
||||
{0x142A ,"KINGMAX TECHNOLOGY INC"},
|
||||
{0x142B ,"RADIOLAN"},
|
||||
{0x142C ,"MINTON OPTIC INDUSTRY CO LTD"},
|
||||
{0x142D ,"PIXSTREAM INC"},
|
||||
{0x1430 ,"ITT AEROSPACE/COMMUNICATIONS DIVISION"},
|
||||
{0x1433 ,"ELTEC ELEKTRONIK GMBH"},
|
||||
{0x1436 ,"CIS TECHNOLOGY INC"},
|
||||
{0x1437 ,"NISSIN INC CO"},
|
||||
{0x1438 ,"ATMEL-DREAM"},
|
||||
{0x143F ,"LIGHTWELL CO LTD - ZAX DIVISION"},
|
||||
{0x1441 ,"AGIE SA."},
|
||||
{0x1445 ,"LOGICAL CO LTD"},
|
||||
{0x1446 ,"GRAPHIN CO. LTD"},
|
||||
{0x1447 ,"AIM GMBH"},
|
||||
{0x144A ,"ADLINK TECHNOLOGY"},
|
||||
{0x144B ,"LORONIX INFORMATION SYSTEMS INC"},
|
||||
{0x144D ,"SAMSUNG ELECTRONICS CO LTD"},
|
||||
{0x1450 ,"OCTAVE COMMUNICATIONS IND."},
|
||||
{0x1451 ,"SP3D CHIP DESIGN GMBH"},
|
||||
{0x1453 ,"MYCOM INC"},
|
||||
{0x1455 ,"LOGIC PLUS PLUS INC"},
|
||||
{0x1458 ,"GIGA-BYTE TECHNOLOGY"},
|
||||
{0x145C ,"CRYPTEK"},
|
||||
{0x145F ,"BALDOR ELECTRIC COMPANY"},
|
||||
{0x1460 ,"DYNARC INC"},
|
||||
{0x1462 ,"MICRO-STAR INTERNATIONAL CO LTD"},
|
||||
{0x1463 ,"FAST CORPORATION"},
|
||||
{0x1464 ,"INTERACTIVE CIRCUITS & SYSTEMS LTD"},
|
||||
{0x1465 ,"GN NETTEST TELECOM DIV."},
|
||||
{0x1468 ,"AMBIT MICROSYSTEMS CORP."},
|
||||
{0x1469 ,"CLEVELAND MOTION CONTROLS"},
|
||||
{0x146C ,"RUBY TECH CORP."},
|
||||
{0x146D ,"TACHYON, INC."},
|
||||
{0x146E ,"WILLIAMS ELECTRONICS GAMES, INC."},
|
||||
{0x1471 ,"INTEGRATED TELECOM EXPRESS INC"},
|
||||
{0x1473 ,"ZAPEX TECHNOLOGIES INC"},
|
||||
{0x1474 ,"DOUG CARSON & ASSOCIATES"},
|
||||
{0x1477 ,"NET INSIGHT"},
|
||||
{0x1478 ,"DIATREND CORPORATION"},
|
||||
{0x147B ,"ABIT COMPUTER CORP."},
|
||||
{0x147F ,"NIHON UNISYS, LTD."},
|
||||
{0x1482 ,"ISYTEC - INTEGRIERTE SYSTEMTECHNIK GMBH"},
|
||||
{0x1483 ,"LABWAY COPORATION"},
|
||||
{0x1485 ,"ERMA - ELECTRONIC GMBH"},
|
||||
{0x1489 ,"KYE SYSTEMS CORPORATION"},
|
||||
{0x148A ,"OPTO 22"},
|
||||
{0x148B ,"INNOMEDIALOGIC INC."},
|
||||
{0x148E ,"OSI PLUS CORPORATION"},
|
||||
{0x148F ,"PLANT EQUIPMENT, INC."},
|
||||
{0x1490 ,"TC LABS PTY LTD."},
|
||||
{0x1493 ,"MAKER COMMUNICATIONS"},
|
||||
{0x1495 ,"TOKAI COMMUNICATIONS INDUSTRY CO. LTD"},
|
||||
{0x1496 ,"JOYTECH COMPUTER CO., LTD."},
|
||||
{0x1497 ,"SMA REGELSYSTEME GMBH"},
|
||||
{0x1499 ,"EMTEC CO., LTD"},
|
||||
{0x149A ,"ANDOR TECHNOLOGY LTD"},
|
||||
{0x149B ,"SEIKO INSTRUMENTS INC"},
|
||||
{0x149C ,"OVISLINK CORP."},
|
||||
{0x149D ,"NEWTEK INC"},
|
||||
{0x149E ,"MAPLETREE NETWORKS INC."},
|
||||
{0x149F ,"LECTRON CO LTD"},
|
||||
{0x14A0 ,"SOFTING GMBH"},
|
||||
{0x14A1 ,"SYSTEMBASE CO LTD"},
|
||||
{0x14A2 ,"MILLENNIUM ENGINEERING INC"},
|
||||
{0x14A3 ,"MAVERICK NETWORKS"},
|
||||
{0x14A4 ,"GVC/BCM ADVANCED RESEARCH"},
|
||||
{0x14A5 ,"XIONICS DOCUMENT TECHNOLOGIES INC."},
|
||||
{0x14A6 ,"INOVA COMPUTERS GMBH & CO KG"},
|
||||
{0x14A8 ,"FEATRON TECHNOLOGIES CORPORATION"},
|
||||
{0x14A9 ,"HIVERTEC INC."},
|
||||
{0x14AB ,"MENTOR GRAPHICS CORP."},
|
||||
{0x14AC ,"NOVAWEB TECHNOLOGIES INC"},
|
||||
{0x14AD ,"TIME SPACE RADIO AB"},
|
||||
{0x14AE ,"CTI PET SYSTEMS, INC"},
|
||||
{0x14AF ,"GUILLEMOT CORPORATION"},
|
||||
{0x14B0 ,"BST COMMUNICATION TECHNOLOGY LTD"},
|
||||
{0x14B1 ,"NEXTCOM K.K."},
|
||||
{0x14B2 ,"ENNOVATE NETWORKS INC"},
|
||||
{0x14B3 ,"XPEED INC."},
|
||||
{0x14B4 ,"PHILIPS BUSINESS ELECTRONICS B.V."},
|
||||
{0x14B5 ,"CREAMWARE GMBH"},
|
||||
{0x14B6 ,"QUANTUM DATA CORP."},
|
||||
{0x14B7 ,"PROXIM INC"},
|
||||
{0x14B8 ,"TECHSOFT TECHNOLOGY CO LTD"},
|
||||
{0x14B9 ,"AIRONET WIRELESS COMMUNICATIONS"},
|
||||
{0x14BA ,"INTERNIX INC."},
|
||||
{0x14BB ,"SEMTECH CORPORATION"},
|
||||
{0x14BC ,"GLOBESPAN SEMICONDUCTOR INC."},
|
||||
{0x14BD ,"CARDIO CONTROL N.V."},
|
||||
{0x14BE ,"L3 COMMUNICATIONS"},
|
||||
{0x14BF ,"SPIDER COMMUNICATIONS INC."},
|
||||
{0x14C0 ,"COMPAL ELECTRONICS INC"},
|
||||
{0x14C1 ,"MYRICOM INC."},
|
||||
{0x14C2 ,"DTK COMPUTER"},
|
||||
{0x14C3 ,"MEDIATEK CORP."},
|
||||
{0x14C4 ,"IWASAKI INFORMATION SYSTEMS CO LTD"},
|
||||
{0x14C5 ,"ABB AUTOMATION PRODUCTS AB"},
|
||||
{0x14C6 ,"DATA RACE INC"},
|
||||
{0x14C7 ,"MODULAR TECHNOLOY HOLDINGS LTD"},
|
||||
{0x14C8 ,"TURBOCOMM TECH. INC."},
|
||||
{0x14C9 ,"ODIN TELESYSTEMS INC"},
|
||||
{0x14CA ,"PE LOGIC CORP."},
|
||||
{0x14CB ,"BILLIONTON SYSTEMS INC./CADMUS MICRO INC."},
|
||||
{0x14CC ,"NAKAYO TELECOMMUNICATIONS INC"},
|
||||
{0x14CD ,"UNIVERSAL SCIENTIFIC IND."},
|
||||
{0x14CE ,"WHISTLE COMMUNICATIONS"},
|
||||
{0x14CF ,"TEK MICROSYSTEMS INC."},
|
||||
{0x14D0 ,"ERICSSON AXE R & D"},
|
||||
{0x14D1 ,"COMPUTER HI-TECH CO LTD"},
|
||||
{0x14D2 ,"TITAN ELECTRONICS INC"},
|
||||
{0x14D3 ,"CIRTECH (UK) LTD"},
|
||||
{0x14D4 ,"PANACOM TECHNOLOGY CORP"},
|
||||
{0x14D5 ,"NITSUKO CORPORATION"},
|
||||
{0x14D6 ,"ACCUSYS INC"},
|
||||
{0x14D7 ,"HIRAKAWA HEWTECH CORP"},
|
||||
{0x14D8 ,"HOPF ELEKTRONIK GMBH"},
|
||||
{0x14D9 ,"ALPHA PROCESSOR INC"},
|
||||
{0x14DA ,"NATIONAL AEROSPACE LABORATORIES"},
|
||||
{0x14DB ,"AVLAB TECHNOLOGY INC"},
|
||||
{0x14DC ,"AMPLICON LIVELINE LTD"},
|
||||
{0x14DD ,"IMODL INC."},
|
||||
{0x14DE ,"APPLIED INTEGRATION CORPORATION"},
|
||||
{0x14DF ,"BASIS COMMUNICATIONS CORP"},
|
||||
{0x14E1 ,"INVERTEX"},
|
||||
{0x14E2 ,"INFOLIBRIA"},
|
||||
{0x14E3 ,"AMTELCO"},
|
||||
{0x14E4 ,"BROADCOM CORPORATION"},
|
||||
{0x14E5 ,"PIXELFUSION LTD"},
|
||||
{0x14E6 ,"SHINING TECHNOLOGY INC"},
|
||||
{0x14E7 ,"3CX"},
|
||||
{0x14E8 ,"RAYCER INC"},
|
||||
{0x14E9 ,"GARNETS SYSTEM CO LTD"},
|
||||
{0x14EA ,"PLANEX COMMUNICATIONS INC"},
|
||||
{0x14EB ,"SEIKO EPSON CORPORATION"},
|
||||
{0x14EC ,"ACQIRIS"},
|
||||
{0x14ED ,"DATAKINETICS LTD"},
|
||||
{0x14EE ,"MASPRO KENKOH CORP"},
|
||||
{0x14EF ,"CARRY COMPUTER ENG. CO LTD"},
|
||||
{0x14F0 ,"CANON RESEACH CENTRE FRANCE"},
|
||||
{0x14F1 ,"CONEXANT"},
|
||||
{0x14F2 ,"MOBILITY ELECTRONICS"},
|
||||
{0x14F3 ,"BROADLOGIC"},
|
||||
{0x14F4 ,"TOKYO ELECTRONIC INDUSTRY CO LTD"},
|
||||
{0x14F5 ,"SOPAC LTD"},
|
||||
{0x14F6 ,"COYOTE TECHNOLOGIES LLC"},
|
||||
{0x14F7 ,"WOLF TECHNOLOGY INC"},
|
||||
{0x14F8 ,"AUDIOCODES INC"},
|
||||
{0x14F9 ,"AG COMMUNICATIONS"},
|
||||
{0x14FA ,"WAVETEK WANDEL & GOLTERMANN"},
|
||||
{0x14FB ,"TRANSAS MARINE (UK) LTD"},
|
||||
{0x14FC ,"QUADRICS SUPERCOMPUTERS WORLD"},
|
||||
{0x14FD ,"JAPAN COMPUTER INDUSTRY INC."},
|
||||
{0x14FE ,"ARCHTEK TELECOM CORP."},
|
||||
{0x14FF ,"TWINHEAD INTERNATIONAL CORP."},
|
||||
{0x1500 ,"LANTECH COMPUTER COMPANY"},
|
||||
{0x1501 ,"BANKSOFT CANADA LTD"},
|
||||
{0x1502 ,"MITSUBISHI ELECTRIC LOGISTICS SUPPORT CO LTD"},
|
||||
{0x1503 ,"KAWASAKI LSI USA INC"},
|
||||
{0x1504 ,"KAISER ELECTRONICS"},
|
||||
{0x1505 ,"ITA INGENIEURBURO FUR TESTAUFGABEN GMBH"},
|
||||
{0x1506 ,"CHAMELEON SYSTEMS INC"},
|
||||
{0x1507 ,"HTEC LTD"},
|
||||
{0x1508 ,"HONDA CONNECTORS/MHOTRONICS INC"},
|
||||
{0x1509 ,"FIRST INTERNATIONAL COMPUTER INC"},
|
||||
{0x150A ,"FORVUS RESEARCH INC"},
|
||||
{0x150B ,"YAMASHITA SYSTEMS CORP"},
|
||||
{0x150C ,"KYOPAL CO LTD"},
|
||||
{0x150D ,"WARPSPPED INC"},
|
||||
{0x150E ,"C-PORT CORPORATION"},
|
||||
{0x150F ,"INTEC GMBH"},
|
||||
{0x1510 ,"BEHAVIOR TECH COMPUTER CORP"},
|
||||
{0x1511 ,"CENTILLIUM TECHNOLOGY CORP"},
|
||||
{0x1512 ,"ROSUN TECHNOLOGIES INC"},
|
||||
{0x1513 ,"RAYCHEM"},
|
||||
{0x1514 ,"TFL LAN INC"},
|
||||
{0x1515 ,"ICS ADVENT"},
|
||||
{0x1516 ,"MYSON TECHNOLOGY INC"},
|
||||
{0x1517 ,"ECHOTEK CORPORATION"},
|
||||
{0x1518 ,"PEP MODULAR COMPUTERS GMBH"},
|
||||
{0x1519 ,"TELEFON AKTIEBOLAGET LM ERICSSON"},
|
||||
{0x151A ,"GLOBETEK INC"},
|
||||
{0x151B ,"COMBOX LTD"},
|
||||
{0x151C ,"DIGITAL AUDIO LABS INC"},
|
||||
{0x151D ,"FUJITSU COMPUTER PRODUCTS OF AMERICA"},
|
||||
{0x151E ,"MATRIX CORP."},
|
||||
{0x151F ,"TOPIC SEMICONDUCTOR CORP"},
|
||||
{0x1520 ,"CHAPLET SYSTEM INC"},
|
||||
{0x1521 ,"BELL CORPORATION"},
|
||||
{0x1522 ,"MAINPINE LIMITED"},
|
||||
{0x1523 ,"MUSIC SEMICONDUCTORS"},
|
||||
{0x1524 ,"ENE TECHNOLOGY INC"},
|
||||
{0x1525 ,"IMPACT TECHNOLOGIES"},
|
||||
{0x1526 ,"ISS, INC"},
|
||||
{0x1527 ,"SOLECTRON"},
|
||||
{0x1528 ,"ACKSYS"},
|
||||
{0x1529 ,"AMERICAN MICROSYSTEMS INC"},
|
||||
{0x152A ,"QUICKTURN DESIGN SYSTEMS"},
|
||||
{0x152B ,"FLYTECH TECHNOLOGY CO LTD"},
|
||||
{0x152C ,"MACRAIGOR SYSTEMS LLC"},
|
||||
{0x152D ,"QUANTA COMPUTER INC"},
|
||||
{0x152E ,"MELEC INC"},
|
||||
{0x152F ,"PHILIPS - CRYPTO"},
|
||||
{0x1530 ,"ACQIS TECHNOLOGY INC"},
|
||||
{0x1531 ,"CHRYON CORP."},
|
||||
{0x1532 ,"ECHELON CORPORATION"},
|
||||
{0x1533 ,"BALTIMORE"},
|
||||
{0x1534 ,"ROAD CORPORATION"},
|
||||
{0x1535 ,"EVERGREEN TECHNOLOGIES INC"},
|
||||
{0x1537 ,"DATALEX COMMUNCATIONS"},
|
||||
{0x1538 ,"ARALION INC."},
|
||||
{0x1539 ,"ATELIER INFORMATIQUES ET ELECTRONIQUE ETUDES S.A."},
|
||||
{0x153A ,"ONO SOKKI"},
|
||||
{0x153B ,"TERRATEC ELECTRONIC GMBH"},
|
||||
{0x153C ,"ANTAL ELECTRONIC"},
|
||||
{0x153D ,"FILANET CORPORATION"},
|
||||
{0x153E ,"TECHWELL INC"},
|
||||
{0x153F ,"MIPS DENMARK"},
|
||||
{0x1540 ,"PROVIDEO MULTIMEDIA CO LTD"},
|
||||
{0x1541 ,"TELOSITY INC."},
|
||||
{0x1542 ,"VIVID TECHNOLOGY INC"},
|
||||
{0x1543 ,"SILICON LABORATORIES"},
|
||||
{0x1544 ,"DCM DATA SYSTEMS"},
|
||||
{0x1545 ,"VISIONTEK"},
|
||||
{0x1546 ,"IOI TECHNOLOGY CORP."},
|
||||
{0x1547 ,"MITUTOYO CORPORATION"},
|
||||
{0x1548 ,"JET PROPULSION LABORATORY"},
|
||||
{0x1549 ,"INTERCONNECT SYSTEMS SOLUTIONS"},
|
||||
{0x154A ,"MAX TECHNOLOGIES INC."},
|
||||
{0x154B ,"COMPUTEX CO LTD"},
|
||||
{0x154C ,"VISUAL TECHNOLOGY INC."},
|
||||
{0x154D ,"PAN INTERNATIONAL INDUSTRIAL CORP"},
|
||||
{0x154E ,"SERVOTEST LTD"},
|
||||
{0x154F ,"STRATABEAM TECHNOLOGY"},
|
||||
{0x1550 ,"OPEN NETWORK CO LTD"},
|
||||
{0x1551 ,"SMART ELECTRONIC DEVELOPMENT GMBH"},
|
||||
{0x1552 ,"RACAL AIRTECH LTD"},
|
||||
{0x1553 ,"CHICONY ELECTRONICS CO LTD"},
|
||||
{0x1554 ,"PROLINK MICROSYSTEMS CORP."},
|
||||
{0x1555 ,"GESYTEC GMBH"},
|
||||
{0x1556 ,"PLD APPLICATIONS"},
|
||||
{0x1557 ,"MEDIASTAR CO. LTD"},
|
||||
{0x1558 ,"CLEVO/KAPOK COMPUTER"},
|
||||
{0x1559 ,"SI LOGIC LTD"},
|
||||
{0x155A ,"INNOMEDIA INC"},
|
||||
{0x155B ,"PROTAC INTERNATIONAL CORP"},
|
||||
{0x155C ,"CEMAX-ICON INC"},
|
||||
{0x155D ,"MAC SYSTEM CO LTD"},
|
||||
{0x155E ,"LP ELEKTRONIK GMBH"},
|
||||
{0x155F ,"PERLE SYSTEMS LIMITED"},
|
||||
{0x1560 ,"TERAYON COMMUNICATIONS SYSTEMS"},
|
||||
{0x1561 ,"VIEWGRAPHICS INC"},
|
||||
{0x1562 ,"SYMBOL TECHNOLOGIES"},
|
||||
{0x1563 ,"A-TREND TECHNOLOGY CO LTD"},
|
||||
{0x1564 ,"YAMAKATSU ELECTRONICS INDUSTRY CO LTD"},
|
||||
{0x1565 ,"BIOSTAR MICROTECH INT'L CORP"},
|
||||
{0x1566 ,"ARDENT TECHNOLOGIES INC"},
|
||||
{0x1567 ,"JUNGSOFT"},
|
||||
{0x1568 ,"DDK ELECTRONICS INC"},
|
||||
{0x1569 ,"PALIT MICROSYSTEMS INC"},
|
||||
{0x156A ,"AVTEC SYSTEMS"},
|
||||
{0x156B ,"2WIRE, INC"},
|
||||
{0x156C ,"VIDAC ELECTRONICS GMBH"},
|
||||
{0x156D ,"ALPHA-TOP CORP"},
|
||||
{0x156E ,"ALFA INC."},
|
||||
{0x156F ,"M-SYSTEMS FLASH DISK PIONEERS LTD"},
|
||||
{0x1570 ,"LECROY CORPORATION"},
|
||||
{0x1571 ,"CONTEMPORARY CONTROLS"},
|
||||
{0x1572 ,"OTIS ELEVATOR COMPANY"},
|
||||
{0x1573 ,"LATTICE - VANTIS"},
|
||||
{0x1574 ,"FAIRCHILD SEMICONDUCTOR"},
|
||||
{0x1575 ,"VOLTAIRE ADVANCED DATA SECURITY LTD"},
|
||||
{0x1576 ,"VIEWCAST COM"},
|
||||
{0x1578 ,"HITT"},
|
||||
{0x1579 ,"DUAL TECHNOLOGY CORPORATION"},
|
||||
{0x157A ,"JAPAN ELECRONICS IND. INC"},
|
||||
{0x157B ,"STAR MULTIMEDIA CORP."},
|
||||
{0x157C ,"EUROSOFT (UK) LTD"},
|
||||
{0x157D ,"GEMFLEX NETWORKS"},
|
||||
{0x157E ,"TRANSITION NETWORKS"},
|
||||
{0x157F ,"PX INSTRUMENTS TECHNOLOGY LTD"},
|
||||
{0x1580 ,"PRIMEX AEROSPACE CO."},
|
||||
{0x1581 ,"SEH COMPUTERTECHNIK GMBH"},
|
||||
{0x1582 ,"CYTEC CORPORATION"},
|
||||
{0x1583 ,"INET TECHNOLOGIES INC"},
|
||||
{0x1584 ,"UNIWILL COMPUTER CORP."},
|
||||
{0x1585 ,"LOGITRON"},
|
||||
{0x1586 ,"LANCAST INC"},
|
||||
{0x1587 ,"KONICA CORPORATION"},
|
||||
{0x1588 ,"SOLIDUM SYSTEMS CORP"},
|
||||
{0x1589 ,"ATLANTEK MICROSYSTEMS PTY LTD"},
|
||||
{0x158A ,"DIGALOG SYSTEMS INC"},
|
||||
{0x158B ,"ALLIED DATA TECHNOLOGIES"},
|
||||
{0x158C ,"HITACHI SEMICONDUCTOR & DEVICES SALES CO LTD"},
|
||||
{0x158D ,"POINT MULTIMEDIA SYSTEMS"},
|
||||
{0x158E ,"LARA TECHNOLOGY INC"},
|
||||
{0x158F ,"DITECT COOP"},
|
||||
{0x1590 ,"3PARDATA INC."},
|
||||
{0x1591 ,"ARN"},
|
||||
{0x1592 ,"SYBA TECH LIMITED"},
|
||||
{0x1593 ,"BOPS INC"},
|
||||
{0x1594 ,"NETGAME LTD"},
|
||||
{0x1595 ,"DIVA SYSTEMS CORP."},
|
||||
{0x1596 ,"FOLSOM RESEARCH INC"},
|
||||
{0x1597 ,"MEMEC DESIGN SERVICES"},
|
||||
{0x1598 ,"GRANITE MICROSYSTEMS"},
|
||||
{0x1599 ,"DELTA ELECTRONICS INC"},
|
||||
{0x159A ,"GENERAL INSTRUMENT"},
|
||||
{0x159B ,"FARADAY TECHNOLOGY CORP"},
|
||||
{0x159C ,"STRATUS COMPUTER SYSTEMS"},
|
||||
{0x159D ,"NINGBO HARRISON ELECTRONICS CO LTD"},
|
||||
{0x159E ,"A-MAX TECHNOLOGY CO LTD"},
|
||||
{0x159F ,"GALEA NETWORK SECURITY"},
|
||||
{0x15A0 ,"COMPUMASTER SRL"},
|
||||
{0x15A1 ,"GEOCAST NETWORK SYSTEMS INC"},
|
||||
{0x15A2 ,"CATALYST ENTERPRISES INC"},
|
||||
{0x15A3 ,"ITALTEL"},
|
||||
{0x15A4 ,"X-NET OY"},
|
||||
{0x15A5 ,"TOYOTA MACS INC"},
|
||||
{0x15A6 ,"SUNLIGHT ULTRASOUND TECHNOLOGIES LTD"},
|
||||
{0x15A7 ,"SSE TELECOM INC"},
|
||||
{0x15A8 ,"SHANGHAI COMMUNICATIONS TECHNOLOGIES CENTER"},
|
||||
{0x15AA ,"MORETON BAY"},
|
||||
{0x15AB ,"BLUESTEEL NETWORKS INC"},
|
||||
{0x15AC ,"NORTH ATLANTIC INSTRUMENTS"},
|
||||
{0x15AD ,"VMWARE"},
|
||||
{0x15AE ,"AMERSHAM PHARMACIA BIOTECH"},
|
||||
{0x15B0 ,"ZOLTRIX INTERNATIONAL LIMITED"},
|
||||
{0x15B1 ,"SOURCE TECHNOLOGY INC"},
|
||||
{0x15B2 ,"MOSAID TECHNOLOGIES INC."},
|
||||
{0x15B3 ,"MELLANOX TECHNOLOGY"},
|
||||
{0x15B4 ,"CCI/TRIAD"},
|
||||
{0x15B5 ,"CIMETRICS INC"},
|
||||
{0x15B6 ,"TEXAS MEMORY SYSTEMS INC"},
|
||||
{0x15B7 ,"SANDISK CORP."},
|
||||
{0x15B8 ,"ADDI-DATA GMBH"},
|
||||
{0x15B9 ,"MAESTRO DIGITAL COMMUNICATIONS"},
|
||||
{0x15BA ,"IMPACCT TECHNOLOGY CORP"},
|
||||
{0x15BB ,"PORTWELL INC"},
|
||||
{0x15BC ,"AGILENT TECHNOLOGIES"},
|
||||
{0x15BD ,"DFI INC."},
|
||||
{0x15BE ,"SOLA ELECTRONICS"},
|
||||
{0x15BF ,"HIGH TECH COMPUTER CORP (HTC)"},
|
||||
{0x15C0 ,"BVM LIMITED"},
|
||||
{0x15C1 ,"QUANTEL"},
|
||||
{0x15C2 ,"NEWER TECHNOLOGY INC"},
|
||||
{0x15C3 ,"TAIWAN MYCOMP CO LTD"},
|
||||
{0x15C4 ,"EVSX, INC"},
|
||||
{0x15C5 ,"PROCOMP INFORMATICS LTD"},
|
||||
{0x15C6 ,"TECHNICAL UNIVERSITY OF BUDAPEST"},
|
||||
{0x15C7 ,"TATEYAMA SYSTEM LABORATORY CO LTD"},
|
||||
{0x15C8 ,"PENTA MEDIA CO. LTD"},
|
||||
{0x15C9 ,"SEROME TECHNOLOGY INC"},
|
||||
{0x15CA ,"BITBOYS OY"},
|
||||
{0x15CB ,"AG ELECTRONICS LTD"},
|
||||
{0x15CC ,"HOTRAIL INC."},
|
||||
{0x15CD ,"DREAMTECH CO LTD"},
|
||||
{0x15CE ,"GENRAD INC."},
|
||||
{0x15CF ,"HILSCHER GMBH"},
|
||||
{0x15D1 ,"INFINEON TECHNOLOGIES AG"},
|
||||
{0x15D2 ,"FIC (FIRST INTERNATIONAL COMPUTER INC)"},
|
||||
{0x15D3 ,"NDS TECHNOLOGIES ISRAEL LTD"},
|
||||
{0x15D4 ,"IWILL CORPORATION"},
|
||||
{0x15D5 ,"TATUNG CO."},
|
||||
{0x15D6 ,"ENTRIDIA CORPORATION"},
|
||||
{0x15D7 ,"ROCKWELL-COLLINS, INC"},
|
||||
{0x15D8 ,"CYBERNETICS TECHNOLOGY CO LTD"},
|
||||
{0x15D9 ,"SUPER MICRO COMPUTER INC"},
|
||||
{0x15DA ,"CYBERFIRM INC."},
|
||||
{0x15DB ,"APPLIED COMPUTING SYSTEMS INC."},
|
||||
{0x15DC ,"LITRONIC INC"},
|
||||
{0x15DD ,"SIGMATEL INC."},
|
||||
{0x15DE ,"MALLEABLE TECHNOLOGIES INC"},
|
||||
{0x15DF ,"INFINILINK CORP."},
|
||||
{0x15E0 ,"CACHEFLOW INC"},
|
||||
{0x15E1 ,"VOICE TECHNOLOGIES GROUP INC."},
|
||||
{0x15E2 ,"QUICKNET TECHNOLOGIES INC"},
|
||||
{0x15E3 ,"NETWORTH TECHNOLOGIES INC"},
|
||||
{0x15E4 ,"VSN SYSTEMEN BV"},
|
||||
{0x15E5 ,"VALLEY TECHNOLOGIES INC"},
|
||||
{0x15E6 ,"AGERE INC."},
|
||||
{0x15E7 ,"GET ENGINEERING CORP."},
|
||||
{0x15E8 ,"NATIONAL DATACOMM CORP."},
|
||||
{0x15E9 ,"PACIFIC DIGITAL CORP."},
|
||||
{0x15EA ,"TOKYO DENSHI SEKEI K.K."},
|
||||
{0x15EB ,"DRSEARCH GMBH"},
|
||||
{0x15EC ,"BECKHOFF GMBH"},
|
||||
{0x15ED ,"MACROLINK INC"},
|
||||
{0x15EE ,"IN WIN DEVELOPMENT INC."},
|
||||
{0x15EF ,"INTELLIGENT PARADIGM INC"},
|
||||
{0x15F0 ,"B-TREE SYSTEMS INC"},
|
||||
{0x15F1 ,"TIMES N SYSTEMS INC"},
|
||||
{0x15F2 ,"DIAGNOSTIC INSTRUMENTS INC"},
|
||||
{0x15F3 ,"DIGITMEDIA CORP."},
|
||||
{0x15F4 ,"VALUESOFT"},
|
||||
{0x15F5 ,"POWER MICRO RESEARCH"},
|
||||
{0x15F6 ,"EXTREME PACKET DEVICE INC"},
|
||||
{0x15F7 ,"BANCTEC"},
|
||||
{0x15F8 ,"KOGA ELECTRONICS CO"},
|
||||
{0x15F9 ,"ZENITH ELECTRONICS CORPORATION"},
|
||||
{0x15FA ,"J.P. AXZAM CORPORATION"},
|
||||
{0x15FB ,"ZILOG INC."},
|
||||
{0x15FC ,"TECHSAN ELECTRONICS CO LTD"},
|
||||
{0x15FD ,"N-CUBED.NET"},
|
||||
{0x15FE ,"KINPO ELECTRONICS INC"},
|
||||
{0x15FF ,"FASTPOINT TECHNOLOGIES INC."},
|
||||
{0x1600 ,"NORTHROP GRUMMAN - CANADA LTD"},
|
||||
{0x1601 ,"TENTA TECHNOLOGY"},
|
||||
{0x1602 ,"PROSYS-TEC INC."},
|
||||
{0x1603 ,"NOKIA WIRELESS BUSINESS COMMUNICATIONS"},
|
||||
{0x1604 ,"CENTRAL SYSTEM RESEARCH CO LTD"},
|
||||
{0x1605 ,"PAIRGAIN TECHNOLOGIES"},
|
||||
{0x1606 ,"EUROPOP AG"},
|
||||
{0x1607 ,"LAVA SEMICONDUCTOR MANUFACTURING INC."},
|
||||
{0x1608 ,"AUTOMATED WAGERING INTERNATIONAL"},
|
||||
{0x1609 ,"SCIEMETRIC INSTRUMENTS INC"},
|
||||
{0x1813 ,"AMBIENT TECHNOLOGIES INC"},
|
||||
{0x1B13 ,"JATON CORP"},
|
||||
{0x2001 ,"TEMPORAL RESEARCH LTD"},
|
||||
{0x270F ,"CHAINTECH COMPUTER CO. LTD"},
|
||||
{0x3388 ,"HINT CORP"},
|
||||
{0x3411 ,"QUANTUM DESIGNS (H.K.) INC."},
|
||||
{0x4005 ,"AVANCE LOGIC INC"},
|
||||
{0x4033 ,"DELTA NETWORKS INC"},
|
||||
{0x416C ,"ALADDIN KNOWLEDGE SYSTEMS"},
|
||||
{0x4444 ,"ICOMPRESION INC."},
|
||||
{0x4943 ,"GROWTH NETWORKS"},
|
||||
{0x4CA1 ,"SEANIX TECHNOLOGY INC"},
|
||||
{0x4D51 ,"MEDIAQ INC."},
|
||||
{0x4D54 ,"MICROTECHNICA CO LTD"},
|
||||
{0x5136 ,"S S TECHNOLOGIES"},
|
||||
{0x5333 ,"S3 INC."},
|
||||
{0x544C ,"TERALOGIC INC"},
|
||||
{0x5555 ,"GENROCO INC"},
|
||||
{0x6409 ,"LOGITEC CORP."},
|
||||
{0x6666 ,"DECISION COMPUTER INTERNATIONAL CO."},
|
||||
{0x8086 ,"INTEL CORP."},
|
||||
{0x8888 ,"SILICON MAGIC CORP."},
|
||||
{0x8E0E ,"COMPUTONE CORPORATION"},
|
||||
{0x9004 ,"ADAPTEC"},
|
||||
{0x919A ,"GIGAPIXEL CORP"},
|
||||
{0x9699 ,"OMNI MEDIA TECHNOLOGY INC."},
|
||||
{0xA0A0 ,"AOPEN INC."},
|
||||
{0xA0F1 ,"UNISYS CORPORATION"},
|
||||
{0xA259 ,"HEWLETT PACKARD"},
|
||||
{0xAC1E ,"DIGITAL RECEIVER TECHNOLOGY INC"},
|
||||
{0xC0DE ,"MOTOROLA"},
|
||||
{0xC0FE ,"MOTION ENGINEERING, INC."},
|
||||
{0xCA50 ,"VARIAN AUSTRIALIA PTY LTD"},
|
||||
{0xCAFE ,"CHRYSALIS-ITS"},
|
||||
{0xCCCC ,"CATAPULT COMMUNICATIONS"},
|
||||
{0xD4D4 ,"DY4 SYSTEMS INC"},
|
||||
{0xE4BF ,"EKF ELEKTRONIK GMBH"},
|
||||
{0xEA01 ,"EAGLE TECHNOLOGY"},
|
||||
{0xFA57 ,"FAST SEARCH & TRANSFER ASA"},
|
||||
{0xFEDA ,"EPIGRAM INC"}
|
||||
};
|
389
reactos/apps/utils/pice/module/pgflt.c
Normal file
389
reactos/apps/utils/pice/module/pgflt.c
Normal file
|
@ -0,0 +1,389 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
pgflt.c
|
||||
|
||||
Abstract:
|
||||
|
||||
page fault handling on x86
|
||||
|
||||
Environment:
|
||||
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
25-Nov-1999: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#include "remods.h"
|
||||
|
||||
#include "precomp.h"
|
||||
#include <asm/io.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// GLOBALS
|
||||
////
|
||||
|
||||
char tempPageFault[1024];
|
||||
|
||||
ULONG OldIntEHandler=0;
|
||||
ULONG error_code;
|
||||
BOOLEAN bInPageFaultHandler = FALSE;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// FUNCTIONS
|
||||
////
|
||||
|
||||
//*************************************************************************
|
||||
// HandleInDebuggerFault()
|
||||
//
|
||||
//*************************************************************************
|
||||
ULONG HandleInDebuggerFault(FRAME* ptr,ULONG address)
|
||||
{
|
||||
struct task_struct *tsk;
|
||||
struct mm_struct *mm;
|
||||
struct mm_struct *p = NULL;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
DPRINT((0,"HandleInDebuggerFault(): ###### page fault @ %.8X while inside debugger\n",address));
|
||||
|
||||
// fault in this page fault handler
|
||||
if(bInPageFaultHandler)
|
||||
{
|
||||
DPRINT((0,"HandleInDebuggerFault(): ###### page fault @ %.8X while in page fault handler\n",address));
|
||||
|
||||
DPRINT((0,"!!! machine is halted !!!\n"));
|
||||
|
||||
__asm__ __volatile__ ("hlt");
|
||||
|
||||
LEAVE_FUNC();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bInPageFaultHandler = TRUE;
|
||||
|
||||
// when we come here from DebuggerShell() we live on a different stack
|
||||
// so the current task is different as well
|
||||
tsk = (struct task_struct *)(0xFFFFE000 & ulRealStackPtr);
|
||||
mm = tsk->mm;
|
||||
|
||||
DPRINT((0,"%.8X (%.4X:%.8X %.8X %s %s %s task=%.8X mm=%.8X)\n",
|
||||
address,
|
||||
ptr->cs,
|
||||
ptr->eip,
|
||||
ptr->eflags,
|
||||
(ptr->error_code&1)?"PLP":"NP",
|
||||
(ptr->error_code&2)?"WRITE":"READ",
|
||||
(ptr->error_code&4)?"USER-MODE":"KERNEL-MODE",
|
||||
(ULONG)tsk,
|
||||
(ULONG)mm));
|
||||
|
||||
if(!bInPrintk)
|
||||
{
|
||||
DPRINT((0,"HandleInDebuggerFault(): unexpected pagefault in command handler!\n",address));
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT((0,"HandleInDebuggerFault(): unexpected pagefault in command handler while in PrintkCallback()!\n",address));
|
||||
}
|
||||
|
||||
|
||||
if(address < TASK_SIZE)
|
||||
{
|
||||
p = mm;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = my_init_mm;
|
||||
}
|
||||
|
||||
if(p)
|
||||
{
|
||||
pgd_t * pPGD;
|
||||
pmd_t * pPMD;
|
||||
pte_t * pPTE;
|
||||
|
||||
pPGD = pgd_offset(p,address);
|
||||
|
||||
DPRINT((0,"PGD for %.8X @ %.8X = %.8X\n",address,(ULONG)pPGD,(ULONG)pgd_val(*pPGD) ));
|
||||
|
||||
if(pPGD && pgd_val(*pPGD)&_PAGE_PRESENT)
|
||||
{
|
||||
// not large page
|
||||
if(!(pgd_val(*pPGD)&_PAGE_4M))
|
||||
{
|
||||
pPMD = pmd_offset(pPGD,address);
|
||||
if(pPMD)
|
||||
{
|
||||
pPTE = pte_offset(pPMD,address);
|
||||
if(pPTE)
|
||||
{
|
||||
DPRINT((0,"PTE for %.8X @ %.8X = %.8X\n",address,(ULONG)pPTE,(ULONG)pte_val(*pPTE) ));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IntelStackWalk(ptr->eip,CurrentEBP,ulRealStackPtr);
|
||||
|
||||
DPRINT((0,"!!! machine is halted !!!\n"));
|
||||
|
||||
__asm__ __volatile__ ("hlt");
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// HandlePageFault()
|
||||
//
|
||||
// returns:
|
||||
// 0 = let the system handle it
|
||||
// 1 = call DebuggerShell()
|
||||
// 2 = FATAL error inside debugger
|
||||
//*************************************************************************
|
||||
ULONG HandlePageFault(FRAME* ptr)
|
||||
{
|
||||
ULONG address;
|
||||
struct task_struct *tsk;
|
||||
struct mm_struct *mm;
|
||||
struct vm_area_struct * vma;
|
||||
|
||||
// get linear address of page fault
|
||||
__asm__("movl %%cr2,%0":"=r" (address));
|
||||
|
||||
// current process
|
||||
tsk = current;
|
||||
|
||||
// there's something terribly wrong if we get a fault in our command handler
|
||||
if(bInDebuggerShell)
|
||||
{
|
||||
return HandleInDebuggerFault(ptr,address);
|
||||
}
|
||||
|
||||
// remember error code so we can push it back on the stack
|
||||
error_code = ptr->error_code;
|
||||
|
||||
//////////////////////////////////////
|
||||
// kernel page fault
|
||||
|
||||
// since LINUX kernel is not pageable this is death
|
||||
// so call handler
|
||||
if(address >= TASK_SIZE)
|
||||
{
|
||||
//
|
||||
if(error_code & 4)
|
||||
{
|
||||
PICE_sprintf(tempPageFault,"pICE: kernel page fault from user-mode code (error code %x)!\n",error_code);
|
||||
Print(OUTPUT_WINDOW,tempPageFault);
|
||||
}
|
||||
else
|
||||
{
|
||||
PICE_sprintf(tempPageFault,"pICE: kernel page fault from kernel-mode code (error code %x)!\n",error_code);
|
||||
Print(OUTPUT_WINDOW,tempPageFault);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// and it's memory environment
|
||||
mm = tsk->mm;
|
||||
|
||||
//////////////////////////////////////
|
||||
// user page fault
|
||||
// fault address is below TASK_SIZE
|
||||
|
||||
// no user context, i.e. no pages below TASK_SIZE are mapped
|
||||
if(mm == my_init_mm)
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: there's no user context!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// interrupt handlers can't have page faults
|
||||
if(in_interrupt())
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: system is currently processing an interrupt!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// lookup VMA for this address
|
||||
vma = find_vma(mm, address);
|
||||
if(!vma)
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: no virtual memory arena at this address!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// address is greater than the start of this VMA
|
||||
if (address >= vma->vm_start)
|
||||
{
|
||||
// WRITE ACCESS
|
||||
// write bit set in error_code
|
||||
if(error_code & 2)
|
||||
{
|
||||
// area was not writable
|
||||
if(!(vma->vm_flags & VM_WRITE))
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: virtual memory arena is not writeable!\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// READ ACCESS
|
||||
else
|
||||
{
|
||||
// test EXT bit in error code
|
||||
if (error_code & 1)
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: page-level protection fault!\n");
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: VMA is not readable!\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// let the system handle it
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
if (!(vma->vm_flags & VM_GROWSDOWN))
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: virtual memory arena doesn't grow down!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// let the system handle it
|
||||
return 0;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// NewIntEHandler()
|
||||
//
|
||||
//*************************************************************************
|
||||
__asm__ ("
|
||||
NewIntEHandler:
|
||||
pushfl
|
||||
cli
|
||||
cld
|
||||
pushal
|
||||
pushl %ds
|
||||
|
||||
// setup default data selectors
|
||||
movw %ss,%ax
|
||||
movw %ax,%ds
|
||||
|
||||
// get frame ptr
|
||||
lea 40(%esp),%eax
|
||||
pushl %eax
|
||||
call HandlePageFault
|
||||
addl $4,%esp
|
||||
|
||||
cmpl $0,%eax
|
||||
je call_old_inte_handler
|
||||
|
||||
cmpl $2,%eax
|
||||
je call_handler_unknown_reason
|
||||
|
||||
popl %ds
|
||||
popal
|
||||
popfl
|
||||
// remove error code. will be restored later when we call
|
||||
// original handler again.
|
||||
addl $4,%esp
|
||||
// call debugger loop
|
||||
pushl $" STR(REASON_PAGEFAULT) "
|
||||
jmp NewInt31Handler
|
||||
|
||||
call_old_inte_handler:
|
||||
popl %ds
|
||||
popal
|
||||
popfl
|
||||
// chain to old handler
|
||||
.byte 0x2e
|
||||
jmp *OldIntEHandler
|
||||
|
||||
call_handler_unknown_reason:
|
||||
popl %ds
|
||||
popal
|
||||
popfl
|
||||
// remove error code. will be restored later when we call
|
||||
// original handler again.
|
||||
addl $4,%esp
|
||||
// call debugger loop
|
||||
pushl $" STR(REASON_INTERNAL_ERROR) "
|
||||
jmp NewInt31Handler
|
||||
");
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// InstallIntEHook()
|
||||
//
|
||||
//*************************************************************************
|
||||
void InstallIntEHook(void)
|
||||
{
|
||||
ULONG LocalIntEHandler;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
MaskIrqs();
|
||||
if(!OldIntEHandler)
|
||||
{
|
||||
__asm__("mov $NewIntEHandler,%0"
|
||||
:"=r" (LocalIntEHandler)
|
||||
:
|
||||
:"eax");
|
||||
OldIntEHandler=SetGlobalInt(0x0E,(ULONG)LocalIntEHandler);
|
||||
}
|
||||
UnmaskIrqs();
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// DeInstallIntEHook()
|
||||
//
|
||||
//*************************************************************************
|
||||
void DeInstallIntEHook(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
|
||||
MaskIrqs();
|
||||
if(OldIntEHandler)
|
||||
{
|
||||
SetGlobalInt(0x0E,(ULONG)OldIntEHandler);
|
||||
OldIntEHandler=0;
|
||||
}
|
||||
UnmaskIrqs();
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
34
reactos/apps/utils/pice/module/pgflt.h
Normal file
34
reactos/apps/utils/pice/module/pgflt.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
pgflt.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for pgflt.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
void InstallIntEHook(void);
|
||||
void DeInstallIntEHook(void);
|
||||
|
||||
extern ULONG error_code;
|
36
reactos/apps/utils/pice/module/pice_ver.h
Normal file
36
reactos/apps/utils/pice/module/pice_ver.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
pice_ver.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER , pICE debugger version
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
// versions below 1.0 are BETA
|
||||
#define PICE_MAJOR_VERSION (0)
|
||||
#define PICE_MINOR_VERSION (99)
|
||||
// reset this on major or minor version change
|
||||
// increment this on every release build
|
||||
#define PICE_BUILD (0007)
|
59
reactos/apps/utils/pice/module/precomp.h
Normal file
59
reactos/apps/utils/pice/module/precomp.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
precomp.h
|
||||
|
||||
Abstract:
|
||||
|
||||
precompiled headers
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
#define FRAMEBUFFER_SIZE (0x8000)
|
||||
#define LINES_IN_BUFFER (2048)
|
||||
|
||||
#define REAL_LINUX_VERSION_CODE LINUX_VERSION_CODE
|
||||
|
||||
#include "retypes.h"
|
||||
#include <asm/segment.h>
|
||||
#include "../shared/shared.h"
|
||||
#include "debug.h"
|
||||
#include "hardware.h"
|
||||
#include "utils.h"
|
||||
#include "init.h"
|
||||
#include "shell.h"
|
||||
#include "trace.h"
|
||||
#include "hooks.h"
|
||||
#include "patch.h" // patch the keyboard driver
|
||||
#include "symbols.h"
|
||||
#include "parse.h"
|
||||
#include "syscall.h"
|
||||
#include "bp.h"
|
||||
#include "scancodes.h"
|
||||
#include "output.h"
|
||||
#include "dblflt.h"
|
||||
#include "pgflt.h"
|
||||
#include "gpfault.h"
|
||||
#include "serial.h"
|
||||
#include "hercules.h"
|
||||
#include "vga.h"
|
||||
#include "pice_ver.h"
|
290
reactos/apps/utils/pice/module/privateice.c
Normal file
290
reactos/apps/utils/pice/module/privateice.c
Normal file
|
@ -0,0 +1,290 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
privateice.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X/2.4.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
16-Jul-1998: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
19-Jan-2001: renamed to privateice.c
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/config.h>
|
||||
#include <linux/sched.h>
|
||||
#include <asm/unistd.h>
|
||||
#include <linux/string.h>
|
||||
#include "precomp.h"
|
||||
#include "serial.h"
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// GLOBALS
|
||||
////
|
||||
|
||||
// this is for the command line to insmod (pice="...")
|
||||
MODULE_AUTHOR("Klaus P. Gerlicher");
|
||||
MODULE_DESCRIPTION("Linux system level symbolic debugger");
|
||||
|
||||
BOOLEAN bDeviceAlreadyOpen = FALSE;
|
||||
int major_device_number;
|
||||
|
||||
char tempPICE[1024];
|
||||
|
||||
typedef asmlinkage int (*PFNMKNOD)(const char * filename, int mode, dev_t dev);
|
||||
PFNMKNOD sys_mknod;
|
||||
typedef asmlinkage int (*PFNUNLINK)(const char * pathname);
|
||||
PFNUNLINK sys_unlink;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// FUNCTIONS
|
||||
////
|
||||
|
||||
//*************************************************************************
|
||||
// pice_open()
|
||||
//
|
||||
//*************************************************************************
|
||||
static int pice_open(struct inode *inode,
|
||||
struct file *file)
|
||||
{
|
||||
DPRINT((0,"pice_open(%p)\n", file));
|
||||
|
||||
/* We don't want to talk to two processes at the
|
||||
* same time */
|
||||
if (bDeviceAlreadyOpen)
|
||||
return -EBUSY;
|
||||
|
||||
bDeviceAlreadyOpen = TRUE;
|
||||
|
||||
MOD_INC_USE_COUNT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// pice_close()
|
||||
//
|
||||
//*************************************************************************
|
||||
#if REAL_LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
|
||||
static int pice_close(struct inode *inode,
|
||||
struct file *file)
|
||||
#else
|
||||
static void pice_close(struct inode *inode,
|
||||
struct file *file)
|
||||
#endif
|
||||
{
|
||||
DPRINT((0,"device_release(%p,%p)\n", inode, file));
|
||||
|
||||
/* We're now ready for our next caller */
|
||||
bDeviceAlreadyOpen = FALSE;
|
||||
|
||||
MOD_DEC_USE_COUNT;
|
||||
|
||||
#if REAL_LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// pice_ioctl()
|
||||
//
|
||||
//*************************************************************************
|
||||
static int pice_ioctl(struct inode *inode,struct file *file,unsigned int ioctl_num,unsigned long ioctl_param)
|
||||
{
|
||||
// char* pFilename = (char*) ioctl_param;
|
||||
|
||||
if(_IOC_TYPE(ioctl_num) != PICE_IOCTL_MAGIC)
|
||||
return -EINVAL;
|
||||
|
||||
if(!capable(CAP_SYS_ADMIN))
|
||||
{
|
||||
Print(OUTPUT_WINDOW,"pICE: sorry, you must have superuser privileges\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch(ioctl_num)
|
||||
{
|
||||
case PICE_IOCTL_LOAD:
|
||||
break;
|
||||
case PICE_IOCTL_RELOAD:
|
||||
if(!ReloadSymbols())
|
||||
{
|
||||
PICE_sprintf(tempPICE,"pICE: not able to reload symbols\n");
|
||||
Print(OUTPUT_WINDOW,tempPICE);
|
||||
}
|
||||
break;
|
||||
case PICE_IOCTL_UNLOAD:
|
||||
UnloadSymbols();
|
||||
break;
|
||||
case PICE_IOCTL_BREAK:
|
||||
PICE_sprintf(tempPICE,"pICE: forcible break\n");
|
||||
Print(OUTPUT_WINDOW,tempPICE);
|
||||
__asm__ __volatile("int $3");
|
||||
break;
|
||||
case PICE_IOCTL_STATUS:
|
||||
{
|
||||
PDEBUGGER_STATUS_BLOCK ustatus_block_p = (PDEBUGGER_STATUS_BLOCK)ioctl_param;
|
||||
DEBUGGER_STATUS_BLOCK kstatus_block;
|
||||
int err;
|
||||
|
||||
err = verify_area(VERIFY_WRITE,ustatus_block_p ,sizeof(DEBUGGER_STATUS_BLOCK));
|
||||
if(err)return err;
|
||||
|
||||
kstatus_block.Test = 0x12345678;
|
||||
copy_to_user(ustatus_block_p, &kstatus_block, sizeof(DEBUGGER_STATUS_BLOCK) );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This structure will hold the functions to be called
|
||||
* when a process does something to the device we
|
||||
* created. Since a pointer to this structure is kept in
|
||||
* the devices table, it can't be local to
|
||||
* init_module. NULL is for unimplemented functions. */
|
||||
struct file_operations pice_fops = {
|
||||
ioctl: pice_ioctl,
|
||||
open: pice_open,
|
||||
release: pice_close,
|
||||
/* all others are NULL -> default handler */
|
||||
};
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// RegisterDriver()
|
||||
//
|
||||
//*************************************************************************
|
||||
int RegisterDriver(void)
|
||||
{
|
||||
// register the driver
|
||||
major_device_number= register_chrdev(0,"pice",&pice_fops);
|
||||
return major_device_number;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// UnregisterDriver()
|
||||
//
|
||||
//*************************************************************************
|
||||
void UnregisterDriver(void)
|
||||
{
|
||||
// unregister the driver
|
||||
unregister_chrdev(major_device_number,"pice");
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// init_module()
|
||||
//
|
||||
//*************************************************************************
|
||||
int init_module(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
#ifdef DEBUG
|
||||
// first we enable output of debug strings to COM port
|
||||
DebugSetupSerial(1,115200);
|
||||
#endif // DEBUG
|
||||
|
||||
DPRINT((0,"init_module()\n"));
|
||||
|
||||
// initialize debugger
|
||||
if(InitPICE())
|
||||
{
|
||||
mm_segment_t oldfs;
|
||||
|
||||
// tell system we're here
|
||||
if(RegisterDriver() < 0)
|
||||
{
|
||||
CleanUpPICE();
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
sys_mknod = (PFNMKNOD)sys_call_table[__NR_mknod];
|
||||
sys_unlink = (PFNUNLINK)sys_call_table[__NR_unlink];
|
||||
if(!sys_mknod || !sys_unlink)
|
||||
{
|
||||
// tell system we're gone
|
||||
UnregisterDriver();
|
||||
// cleanup
|
||||
CleanUpPICE();
|
||||
return -EFAULT;
|
||||
}
|
||||
//
|
||||
|
||||
oldfs = get_fs(); set_fs(KERNEL_DS);
|
||||
sys_unlink("/dev/pice0");
|
||||
if(0 > (err = sys_mknod("/dev/pice0",S_IFCHR|S_IRWXUGO,(major_device_number<<8))) )
|
||||
{
|
||||
set_fs(oldfs);
|
||||
sprintf(tempPICE,"PICE: couldn't create device node (err = %u)\n",-err);
|
||||
Print(OUTPUT_WINDOW,tempPICE);
|
||||
// tell system we're gone
|
||||
UnregisterDriver();
|
||||
// cleanup
|
||||
CleanUpPICE();
|
||||
return -EFAULT;
|
||||
}
|
||||
set_fs(oldfs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// cleanup_module()
|
||||
//
|
||||
//*************************************************************************
|
||||
void cleanup_module(void)
|
||||
{
|
||||
mm_segment_t oldfs;
|
||||
|
||||
DPRINT((0,"cleanup_module()\n"));
|
||||
|
||||
// remove symbolic link
|
||||
if(sys_unlink)
|
||||
{
|
||||
oldfs = get_fs(); set_fs(KERNEL_DS);
|
||||
sys_unlink("/dev/pice0");
|
||||
set_fs(oldfs);
|
||||
}
|
||||
|
||||
// remove all internal stuff
|
||||
CleanUpPICE();
|
||||
|
||||
// tell system we're gone
|
||||
UnregisterDriver();
|
||||
}
|
||||
|
||||
|
122
reactos/apps/utils/pice/module/regs.h
Normal file
122
reactos/apps/utils/pice/module/regs.h
Normal file
|
@ -0,0 +1,122 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
regs.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for disasm.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
#define REGGS 0
|
||||
#define REGFS 1
|
||||
#define REGES 2
|
||||
#define REGDS 3
|
||||
#define REGEDI 4
|
||||
#define REGESI 5
|
||||
#define REGEBX 6
|
||||
#define REGEDX 7
|
||||
#define REGECX 8
|
||||
#define REGEAX 9
|
||||
#define REGEBP 10
|
||||
#define REGEIP 11
|
||||
#define REGCS 12
|
||||
#define REGEFL 13
|
||||
#define REGESP 14
|
||||
#define REGSS 15
|
||||
|
||||
#ifdef KERNEL
|
||||
#define REGCR0 16
|
||||
#define REGCR2 17
|
||||
#define REGCR3 18
|
||||
#define REGCR4 19
|
||||
#endif
|
||||
|
||||
#define REGDR0 20
|
||||
#define REGDR1 21
|
||||
#define REGDR2 22
|
||||
#define REGDR3 23
|
||||
#define REGDR6 24
|
||||
#define REGDR7 25
|
||||
|
||||
#ifdef KERNEL
|
||||
#define REGGDTR 26
|
||||
#define REGGDTL 27
|
||||
#define REGIDTR 28
|
||||
#define REGIDTL 29
|
||||
#define REGTR 30
|
||||
#define REGLDTR 31
|
||||
#endif
|
||||
|
||||
// Pseudo-registers:
|
||||
#define PREGEA 40
|
||||
#define PREGBASE PREGEA
|
||||
#define PREGEXP 41
|
||||
#define PREGRA 42
|
||||
#define PREGP 43
|
||||
#define PREGU0 44
|
||||
#define PREGU1 45
|
||||
#define PREGU2 46
|
||||
#define PREGU3 47
|
||||
#define PREGU4 48
|
||||
#define PREGU5 49
|
||||
#define PREGU6 50
|
||||
#define PREGU7 51
|
||||
#define PREGU8 52
|
||||
#define PREGU9 53
|
||||
|
||||
#define FLAGBASE 100
|
||||
#define REGDI 100
|
||||
#define REGSI 101
|
||||
#define REGBX 102
|
||||
#define REGDX 103
|
||||
#define REGCX 104
|
||||
#define REGAX 105
|
||||
#define REGBP 106
|
||||
#define REGIP 107
|
||||
#define REGFL 108
|
||||
#define REGSP 109
|
||||
#define REGBL 110
|
||||
#define REGDL 111
|
||||
#define REGCL 112
|
||||
#define REGAL 113
|
||||
#define REGBH 114
|
||||
#define REGDH 115
|
||||
#define REGCH 116
|
||||
#define REGAH 117
|
||||
#define FLAGIOPL 118
|
||||
#define FLAGOF 119
|
||||
#define FLAGDF 120
|
||||
#define FLAGIF 121
|
||||
#define FLAGTF 122
|
||||
#define FLAGSF 123
|
||||
#define FLAGZF 124
|
||||
#define FLAGAF 125
|
||||
#define FLAGPF 126
|
||||
#define FLAGCF 127
|
||||
#define FLAGVIP 128
|
||||
#define FLAGVIF 129
|
||||
|
||||
|
||||
#define REGFIR REGEIP
|
36
reactos/apps/utils/pice/module/remods.h
Normal file
36
reactos/apps/utils/pice/module/remods.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
remods.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for kernel module creation
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
#include <linux/kernel.h>
|
||||
#define __NO_VERSION__
|
||||
#include <linux/module.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
|
51
reactos/apps/utils/pice/module/retypes.h
Normal file
51
reactos/apps/utils/pice/module/retypes.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
retypes.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for type remapping (porting from NT code)
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
typedef unsigned int ULONG,*PULONG;
|
||||
typedef unsigned short USHORT,*PUSHORT;
|
||||
typedef unsigned char UCHAR,*PUCHAR,BYTE,*PBYTE;
|
||||
|
||||
typedef signed int LONG,*PLONG;
|
||||
typedef signed short SHORT,*PSHORT;
|
||||
typedef signed char CHAR,*PCHAR,*LPSTR,*PSTR;
|
||||
|
||||
typedef void VOID,*PVOID;
|
||||
|
||||
typedef char BOOLEAN,*PBOOLEAN;
|
||||
|
||||
#define FALSE (0==1)
|
||||
#define TRUE (1==1)
|
||||
#ifndef NULL
|
||||
#define NULL ((void*)0)
|
||||
#endif
|
||||
|
||||
// dimension macro
|
||||
#define DIM(name) (sizeof(name)/sizeof(name[0]))
|
||||
|
106
reactos/apps/utils/pice/module/scancodes.h
Normal file
106
reactos/apps/utils/pice/module/scancodes.h
Normal file
|
@ -0,0 +1,106 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
scancodes.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER, scancodes of IBM keyboard
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
/*
|
||||
** Scan Code Definitions . . .
|
||||
*/
|
||||
// System Keys
|
||||
#define SCANCODE_ESC 0x01
|
||||
#define SCANCODE_BACKSPACE 0x0E
|
||||
#define SCANCODE_TAB 0x0F
|
||||
|
||||
#define SCANCODE_ENTER 0x1C
|
||||
#define SCANCODE_L_CTRL 0x1D
|
||||
#define SCANCODE_R_CTRL 0x5A
|
||||
#define SCANCODE_L_SHIFT 0x2A
|
||||
#define SCANCODE_R_SHIFT 0x36
|
||||
#define SCANCODE_L_ALT 0x38
|
||||
#define SCANCODE_R_ALT 0x5C
|
||||
|
||||
#define SCANCODE_SPACE 0x39
|
||||
#define SCANCODE_CAPS_LOCK 0x3A
|
||||
#define SCANCODE_NUM_LOCK 0x45
|
||||
#define SCANCODE_PRNT_SCRN 0x47
|
||||
#define SCANCODE_SCROLL_LOCK 0x57
|
||||
|
||||
// Function Keys
|
||||
#define SCANCODE_F1 0x3b
|
||||
#define SCANCODE_F2 0x3c
|
||||
#define SCANCODE_F3 0x3d
|
||||
#define SCANCODE_F4 0x3e
|
||||
#define SCANCODE_F5 0x3f
|
||||
#define SCANCODE_F6 0x40
|
||||
#define SCANCODE_F7 0x41
|
||||
#define SCANCODE_F8 0x42
|
||||
#define SCANCODE_F9 0x43
|
||||
#define SCANCODE_F10 0x44
|
||||
#define SCANCODE_F11 0x57
|
||||
#define SCANCODE_F12 0x58
|
||||
|
||||
// Directional Control Keys
|
||||
#define SCANCODE_HOME 0x47
|
||||
#define SCANCODE_UP 0x48
|
||||
#define SCANCODE_PGUP 0x49
|
||||
#define SCANCODE_LEFT 0x4b
|
||||
#define SCANCODE_CENTER 0x4c
|
||||
#define SCANCODE_RIGHT 0x4d
|
||||
#define SCANCODE_END 0x4f
|
||||
#define SCANCODE_DOWN 0x50
|
||||
#define SCANCODE_PGDN 0x51
|
||||
#define SCANCODE_INS 0x52
|
||||
#define SCANCODE_DEL 0x53
|
||||
|
||||
// Cluster Directional Control Keys
|
||||
#define SCANCODE_C_ENTER 0x59
|
||||
#define SCANCODE_C_HOME 0x5d
|
||||
#define SCANCODE_C_UP 0x5e
|
||||
#define SCANCODE_C_PGUP 0x5f
|
||||
#define SCANCODE_C_LEFT 0x60
|
||||
#define SCANCODE_C_RIGHT 0x61
|
||||
#define SCANCODE_C_END 0x62
|
||||
#define SCANCODE_C_DOWN 0x63
|
||||
#define SCANCODE_C_PGDN 0x64
|
||||
#define SCANCODE_C_INS 0x65
|
||||
#define SCANCODE_C_DEL 0x66
|
||||
|
||||
|
||||
// Alphanumerics
|
||||
#define SCANCODE_1 0x02
|
||||
#define SCANCODE_2 0x03
|
||||
#define SCANCODE_3 0x04
|
||||
#define SCANCODE_4 0x05
|
||||
#define SCANCODE_5 0x06
|
||||
#define SCANCODE_6 0x07
|
||||
#define SCANCODE_7 0x08
|
||||
#define SCANCODE_8 0x09
|
||||
#define SCANCODE_9 0x0A
|
||||
#define SCANCODE_0 0x0B
|
||||
|
||||
#define SCANCODE_EXTENDED 0xE0
|
657
reactos/apps/utils/pice/module/serial.c
Normal file
657
reactos/apps/utils/pice/module/serial.c
Normal file
|
@ -0,0 +1,657 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
serial.c
|
||||
|
||||
Abstract:
|
||||
|
||||
serial debugger connection
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
19-Aug-2000: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
#include "remods.h"
|
||||
#include <asm/io.h>
|
||||
#include "precomp.h"
|
||||
#include "serial_port.h"
|
||||
|
||||
BOOLEAN SerialReadByte(PUCHAR px);
|
||||
|
||||
|
||||
// used for SERIAL window creation
|
||||
// NB: at the moment the terminal is 60 lines high.
|
||||
WINDOW wWindowSerial[4]=
|
||||
{
|
||||
{1,3,1,0,FALSE},
|
||||
{5,8,1,0,FALSE},
|
||||
{14,26,1,0,FALSE},
|
||||
{41,18,1,0,FALSE}
|
||||
};
|
||||
|
||||
PUCHAR pScreenBufferSerial;
|
||||
|
||||
USHORT usSerialPortBase;
|
||||
|
||||
UCHAR packet[PAGE_SIZE];
|
||||
UCHAR assemble_packet[PAGE_SIZE];
|
||||
|
||||
UCHAR flush_buffer[PAGE_SIZE],g_x,g_y;
|
||||
ULONG ulFlushBufferPos = 0;
|
||||
|
||||
UCHAR ucLastKeyRead;
|
||||
ECOLORS eForegroundColor=WHITE,eBackgroundColor=BLACK;
|
||||
|
||||
///************************************************************************
|
||||
// SerialSetSpeed()
|
||||
//
|
||||
///************************************************************************
|
||||
void SerialSetSpeed(ULONG baudrate)
|
||||
{
|
||||
UCHAR c;
|
||||
ULONG divisor;
|
||||
|
||||
divisor = (ULONG) (115200L/baudrate);
|
||||
|
||||
c = inportb((USHORT)(usSerialPortBase + LCR));
|
||||
outportb((USHORT)(usSerialPortBase + LCR), (UCHAR)(c | 0x80)); // Set DLAB
|
||||
outportb((USHORT)(usSerialPortBase + DLL), (UCHAR)(divisor & 0x00FF));
|
||||
outportb((USHORT)(usSerialPortBase + DLH), (UCHAR)((divisor >> 8) & 0x00FF));
|
||||
outportb((USHORT)(usSerialPortBase + LCR), c); // Reset DLAB
|
||||
|
||||
}
|
||||
|
||||
///************************************************************************
|
||||
// SerialSetOthers()
|
||||
//
|
||||
// Set other communications parameters
|
||||
//************************************************************************
|
||||
void SerialSetOthers(ULONG Parity, ULONG Bits, ULONG StopBit)
|
||||
{
|
||||
ULONG setting;
|
||||
UCHAR c;
|
||||
|
||||
if (usSerialPortBase == 0) return ;
|
||||
if (Bits < 5 || Bits > 8) return ;
|
||||
if (StopBit != 1 && StopBit != 2) return ;
|
||||
if (Parity != NO_PARITY && Parity != ODD_PARITY && Parity != EVEN_PARITY)
|
||||
return;
|
||||
|
||||
setting = Bits-5;
|
||||
setting |= ((StopBit == 1) ? 0x00 : 0x04);
|
||||
setting |= Parity;
|
||||
|
||||
c = inportb((USHORT)(usSerialPortBase + LCR));
|
||||
outportb((USHORT)(usSerialPortBase + LCR), (UCHAR)(c & ~0x80)); // Reset DLAB
|
||||
|
||||
// no ints
|
||||
outportb((USHORT)(usSerialPortBase + IER), (UCHAR)0);
|
||||
|
||||
// clear FIFO and disable them
|
||||
outportb((USHORT)(usSerialPortBase + FCR), (UCHAR)0);
|
||||
|
||||
outportb((USHORT)(usSerialPortBase + LCR), (UCHAR)setting);
|
||||
|
||||
outportb((USHORT)(usSerialPortBase + MCR), DTR | RTS);
|
||||
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
///************************************************************************
|
||||
// FlushSerialBuffer()
|
||||
//
|
||||
///************************************************************************
|
||||
void FlushSerialBuffer(void)
|
||||
{
|
||||
UCHAR c;
|
||||
|
||||
while(SerialReadByte(&c));
|
||||
}
|
||||
|
||||
///************************************************************************
|
||||
// SetupSerial()
|
||||
//
|
||||
///************************************************************************
|
||||
void SetupSerial(ULONG port,ULONG baudrate)
|
||||
{
|
||||
USHORT ports[]={COM1BASE,COM2BASE,COM3BASE,COM4BASE};
|
||||
|
||||
usSerialPortBase = ports[port-1];
|
||||
SerialSetOthers(NO_PARITY,8,1);
|
||||
SerialSetSpeed(baudrate);
|
||||
|
||||
// clear out received bytes
|
||||
// else we would think there's a terminal connected
|
||||
FlushSerialBuffer();
|
||||
}
|
||||
|
||||
|
||||
///************************************************************************
|
||||
// SerialReadByte()
|
||||
//
|
||||
// Output a character to the serial port
|
||||
//************************************************************************
|
||||
BOOLEAN SerialReadByte(PUCHAR px)
|
||||
{
|
||||
ULONG timeout;
|
||||
|
||||
timeout = 0x00FFFFL;
|
||||
|
||||
// Wait for transmitter to clear
|
||||
while ((inportb((USHORT)(usSerialPortBase + LSR)) & RCVRDY) == 0)
|
||||
if (!(--timeout))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*px = inportb((USHORT)(usSerialPortBase + RXR));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///************************************************************************
|
||||
// SerialSendByte()
|
||||
//
|
||||
// Output a character to the serial port
|
||||
//************************************************************************
|
||||
BOOLEAN SerialSendByte(UCHAR x)
|
||||
{
|
||||
ULONG timeout;
|
||||
|
||||
timeout = 0x00FFFFL;
|
||||
|
||||
// Wait for transmitter to clear
|
||||
while ((inportb((USHORT)(usSerialPortBase + LSR)) & XMTRDY) == 0)
|
||||
if (!(--timeout))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
outportb((USHORT)(usSerialPortBase + TXR), x);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
// CheckSum()
|
||||
//
|
||||
//************************************************************************
|
||||
UCHAR CheckSum(LPSTR p,ULONG Len)
|
||||
{
|
||||
UCHAR ucCheckSum = 0;
|
||||
ULONG i;
|
||||
for(i=0;i<Len;i++)
|
||||
{
|
||||
ucCheckSum ^= *p++;
|
||||
ucCheckSum += 1;
|
||||
}
|
||||
|
||||
return ucCheckSum;
|
||||
}
|
||||
|
||||
|
||||
///************************************************************************
|
||||
// ReadPacket()
|
||||
//
|
||||
///************************************************************************
|
||||
BOOLEAN ReadPacket(PSERIAL_PACKET p)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///************************************************************************
|
||||
// SendPacket()
|
||||
//
|
||||
///************************************************************************
|
||||
BOOLEAN SendPacket(PSERIAL_PACKET p)
|
||||
{
|
||||
PUCHAR pHeader = (PUCHAR)&p->header;
|
||||
ULONG i;
|
||||
UCHAR c;
|
||||
ULONG timeout;
|
||||
|
||||
do
|
||||
{
|
||||
timeout = 10;
|
||||
pHeader = (PUCHAR)&p->header;
|
||||
for(i=0;i<(sizeof(SERIAL_PACKET_HEADER)+p->header.packet_size);i++)
|
||||
{
|
||||
if(!SerialSendByte(*pHeader++))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
c = 0;
|
||||
SerialReadByte(&c);
|
||||
if(c != ACK)
|
||||
ucLastKeyRead = c;
|
||||
}while(c != ACK && timeout--);
|
||||
|
||||
}while(c != ACK);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///************************************************************************
|
||||
// SendPacketTimeout()
|
||||
//
|
||||
///************************************************************************
|
||||
BOOLEAN SendPacketTimeout(PSERIAL_PACKET p)
|
||||
{
|
||||
PUCHAR pHeader = (PUCHAR)&p->header;
|
||||
ULONG i;
|
||||
UCHAR c;
|
||||
ULONG timeout = 20;
|
||||
BOOLEAN bResult = TRUE;
|
||||
|
||||
pHeader = (PUCHAR)&p->header;
|
||||
for(i=0;i<(sizeof(SERIAL_PACKET_HEADER)+p->header.packet_size);i++)
|
||||
{
|
||||
if(!SerialSendByte(*pHeader++))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
c = 0xFF;
|
||||
SerialReadByte(&c);
|
||||
}while(c != ACK && timeout--);
|
||||
|
||||
if(c != ACK)
|
||||
bResult = FALSE;
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
//************************************************************************
|
||||
// AssemblePacket()
|
||||
//
|
||||
//************************************************************************
|
||||
PSERIAL_PACKET AssemblePacket(PUCHAR pData,ULONG ulSize)
|
||||
{
|
||||
PSERIAL_PACKET p;
|
||||
ULONG ulCheckSum;
|
||||
|
||||
p = (PSERIAL_PACKET)assemble_packet;
|
||||
|
||||
// fill in header
|
||||
p->header.packet_chksum = CheckSum(pData,ulSize);
|
||||
p->header.packet_size = ulSize;
|
||||
p->header.packet_header_chksum = 0;
|
||||
ulCheckSum = (ULONG)CheckSum((PUCHAR)p,sizeof(SERIAL_PACKET_HEADER));
|
||||
p->header.packet_header_chksum = ulCheckSum;
|
||||
// attach data to packet
|
||||
memcpy(p->data,pData,ulSize);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
// OUTPUT handlers
|
||||
|
||||
//*************************************************************************
|
||||
// SetForegroundColorVga()
|
||||
//
|
||||
//*************************************************************************
|
||||
void SetForegroundColorSerial(ECOLORS col)
|
||||
{
|
||||
eForegroundColor = col;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// SetBackgroundColorVga()
|
||||
//
|
||||
//*************************************************************************
|
||||
void SetBackgroundColorSerial(ECOLORS col)
|
||||
{
|
||||
eBackgroundColor = col;
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// PrintGrafSerial()
|
||||
//
|
||||
//*************************************************************************
|
||||
void PrintGrafSerial(ULONG x,ULONG y,UCHAR c)
|
||||
{
|
||||
// put this into memory
|
||||
pScreenBufferSerial[y*GLOBAL_SCREEN_WIDTH + x] = c;
|
||||
|
||||
// put this into cache
|
||||
if(ulFlushBufferPos == 0)
|
||||
{
|
||||
g_x = x;
|
||||
g_y = y;
|
||||
}
|
||||
|
||||
flush_buffer[ulFlushBufferPos++] = c;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// FlushSerial()
|
||||
//
|
||||
//*************************************************************************
|
||||
void FlushSerial(void)
|
||||
{
|
||||
PSERIAL_DATA_PACKET_PRINT pPrint;
|
||||
PSERIAL_PACKET p;
|
||||
|
||||
pPrint = (PSERIAL_DATA_PACKET_PRINT)packet;
|
||||
pPrint->type = PACKET_TYPE_PRINT;
|
||||
pPrint->x = g_x;
|
||||
pPrint->y = g_y;
|
||||
pPrint->fgcol = eForegroundColor;
|
||||
pPrint->bkcol = eBackgroundColor;
|
||||
flush_buffer[ulFlushBufferPos++] = 0;
|
||||
strcpy(pPrint->string,flush_buffer);
|
||||
ulFlushBufferPos = 0;
|
||||
|
||||
p = AssemblePacket((PUCHAR)pPrint,sizeof(SERIAL_DATA_PACKET_PRINT)+strlen(flush_buffer));
|
||||
SendPacket(p);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// ShowCursorSerial()
|
||||
//
|
||||
// show hardware cursor
|
||||
//*************************************************************************
|
||||
void ShowCursorSerial(void)
|
||||
{
|
||||
PSERIAL_DATA_PACKET_CURSOR pCursor;
|
||||
PSERIAL_PACKET p;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
bCursorEnabled = TRUE;
|
||||
|
||||
pCursor = (PSERIAL_DATA_PACKET_CURSOR)packet;
|
||||
pCursor->type = PACKET_TYPE_CURSOR;
|
||||
pCursor->state = (UCHAR)TRUE;
|
||||
pCursor->x = (UCHAR)wWindow[OUTPUT_WINDOW].usCurX;
|
||||
pCursor->y = (UCHAR)wWindow[OUTPUT_WINDOW].usCurY;
|
||||
|
||||
p = AssemblePacket((PUCHAR)pCursor,sizeof(SERIAL_DATA_PACKET_CURSOR));
|
||||
SendPacket(p);
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// HideCursorSerial()
|
||||
//
|
||||
// hide hardware cursor
|
||||
//*************************************************************************
|
||||
void HideCursorSerial(void)
|
||||
{
|
||||
PSERIAL_DATA_PACKET_CURSOR pCursor;
|
||||
PSERIAL_PACKET p;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
bCursorEnabled = FALSE;
|
||||
|
||||
pCursor = (PSERIAL_DATA_PACKET_CURSOR)packet;
|
||||
pCursor->type = PACKET_TYPE_CURSOR;
|
||||
pCursor->state = (UCHAR)TRUE;
|
||||
|
||||
p = AssemblePacket((PUCHAR)pCursor,sizeof(SERIAL_DATA_PACKET_CURSOR));
|
||||
SendPacket(p);
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// CopyLineToSerial()
|
||||
//
|
||||
// copy a line from src to dest
|
||||
//*************************************************************************
|
||||
void CopyLineToSerial(USHORT dest,USHORT src)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// InvertLineSerial()
|
||||
//
|
||||
// invert a line on the screen
|
||||
//*************************************************************************
|
||||
void InvertLineSerial(ULONG line)
|
||||
{
|
||||
PSERIAL_DATA_PACKET_INVERTLINE pInvertLine;
|
||||
PSERIAL_PACKET p;
|
||||
|
||||
pInvertLine = (PSERIAL_DATA_PACKET_INVERTLINE)packet;
|
||||
pInvertLine->type = PACKET_TYPE_INVERTLINE;
|
||||
pInvertLine->line = line;
|
||||
|
||||
p = AssemblePacket((PUCHAR)pInvertLine,sizeof(SERIAL_DATA_PACKET_INVERTLINE));
|
||||
SendPacket(p);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// HatchLineSerial()
|
||||
//
|
||||
// hatches a line on the screen
|
||||
//*************************************************************************
|
||||
void HatchLineSerial(ULONG line)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// ClrLineSerial()
|
||||
//
|
||||
// clear a line on the screen
|
||||
//*************************************************************************
|
||||
void ClrLineSerial(ULONG line)
|
||||
{
|
||||
PSERIAL_DATA_PACKET_CLRLINE pClrLine;
|
||||
PSERIAL_PACKET p;
|
||||
|
||||
pClrLine = (PSERIAL_DATA_PACKET_CLRLINE)packet;
|
||||
pClrLine->type = PACKET_TYPE_CLRLINE;
|
||||
pClrLine->fgcol = eForegroundColor;
|
||||
pClrLine->bkcol = eBackgroundColor;
|
||||
pClrLine->line = line;
|
||||
|
||||
p = AssemblePacket((PUCHAR)pClrLine,sizeof(SERIAL_DATA_PACKET_CLRLINE));
|
||||
SendPacket(p);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// PrintLogoSerial()
|
||||
//
|
||||
//*************************************************************************
|
||||
void PrintLogoSerial(BOOLEAN bShow)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// PrintCursorSerial()
|
||||
//
|
||||
// emulate a blinking cursor block
|
||||
//*************************************************************************
|
||||
void PrintCursorSerial(BOOLEAN bForce)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// SaveGraphicsStateSerial()
|
||||
//
|
||||
//*************************************************************************
|
||||
void SaveGraphicsStateSerial(void)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// RestoreGraphicsStateSerial()
|
||||
//
|
||||
//*************************************************************************
|
||||
void RestoreGraphicsStateSerial(void)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
// INPUT handlers
|
||||
//*************************************************************************
|
||||
// GetKeyPolledSerial()
|
||||
//
|
||||
//*************************************************************************
|
||||
UCHAR GetKeyPolledSerial(void)
|
||||
{
|
||||
UCHAR ucResult;
|
||||
PSERIAL_DATA_PACKET_POLL pPoll;
|
||||
PSERIAL_PACKET p;
|
||||
|
||||
pPoll = (PSERIAL_DATA_PACKET_POLL)packet;
|
||||
pPoll->type = PACKET_TYPE_POLL;
|
||||
pPoll->major_version = PICE_MAJOR_VERSION;
|
||||
pPoll->minor_version = PICE_MINOR_VERSION;
|
||||
pPoll->build_number = PICE_BUILD;
|
||||
|
||||
p = AssemblePacket((PUCHAR)pPoll,sizeof(SERIAL_DATA_PACKET_POLL));
|
||||
SendPacket(p);
|
||||
|
||||
ucResult = ucLastKeyRead;
|
||||
|
||||
ucLastKeyRead = 0;
|
||||
|
||||
return ucResult;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// FlushKeyboardQueueSerial()
|
||||
//
|
||||
//*************************************************************************
|
||||
void FlushKeyboardQueueSerial(void)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// Connect()
|
||||
//
|
||||
//*************************************************************************
|
||||
BOOLEAN Connect(USHORT xSize,USHORT ySize)
|
||||
{
|
||||
PSERIAL_DATA_PACKET_CONNECT pConnect;
|
||||
PSERIAL_PACKET p;
|
||||
|
||||
pConnect = (PSERIAL_DATA_PACKET_CONNECT)packet;
|
||||
pConnect->type = PACKET_TYPE_CONNECT;
|
||||
pConnect->xsize = xSize;
|
||||
pConnect->ysize = ySize;
|
||||
|
||||
p = AssemblePacket((PUCHAR)pConnect,sizeof(SERIAL_DATA_PACKET_CONNECT));
|
||||
return SendPacketTimeout(p);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// ConsoleInitSerial()
|
||||
//
|
||||
// init terminal screen
|
||||
//*************************************************************************
|
||||
BOOLEAN ConsoleInitSerial(void)
|
||||
{
|
||||
BOOLEAN bResult = FALSE;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
ohandlers.CopyLineTo = CopyLineToSerial;
|
||||
ohandlers.PrintGraf = PrintGrafSerial;
|
||||
ohandlers.Flush = FlushSerial;
|
||||
ohandlers.ClrLine = ClrLineSerial;
|
||||
ohandlers.InvertLine = InvertLineSerial;
|
||||
ohandlers.HatchLine = HatchLineSerial;
|
||||
ohandlers.PrintLogo = PrintLogoSerial;
|
||||
ohandlers.PrintCursor = PrintCursorSerial;
|
||||
ohandlers.SaveGraphicsState = SaveGraphicsStateSerial;
|
||||
ohandlers.RestoreGraphicsState = RestoreGraphicsStateSerial;
|
||||
ohandlers.ShowCursor = ShowCursorSerial;
|
||||
ohandlers.HideCursor = HideCursorSerial;
|
||||
ohandlers.SetForegroundColor = SetForegroundColorSerial;
|
||||
ohandlers.SetBackgroundColor = SetBackgroundColorSerial;
|
||||
|
||||
ihandlers.GetKeyPolled = GetKeyPolledSerial;
|
||||
ihandlers.FlushKeyboardQueue = FlushKeyboardQueueSerial;
|
||||
|
||||
SetWindowGeometry(wWindowSerial);
|
||||
|
||||
GLOBAL_SCREEN_WIDTH = 80;
|
||||
GLOBAL_SCREEN_HEIGHT = 60;
|
||||
|
||||
pScreenBufferSerial = vmalloc(FRAMEBUFFER_SIZE);
|
||||
|
||||
if(pScreenBufferSerial)
|
||||
{
|
||||
bResult = TRUE;
|
||||
|
||||
EmptyRingBuffer();
|
||||
|
||||
SetupSerial(1,115200);
|
||||
|
||||
// connect to terminal, if none's there, we give up
|
||||
bResult = Connect(GLOBAL_SCREEN_WIDTH,GLOBAL_SCREEN_HEIGHT);
|
||||
|
||||
if(bResult)
|
||||
{
|
||||
GetKeyPolledSerial();
|
||||
}
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// ConsoleShutdownSerial()
|
||||
//
|
||||
// exit terminal screen
|
||||
//*************************************************************************
|
||||
void ConsoleShutdownSerial(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
|
||||
Connect(80,25);
|
||||
|
||||
FlushSerialBuffer();
|
||||
|
||||
if(pScreenBufferSerial)
|
||||
vfree(pScreenBufferSerial);
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
|
||||
|
36
reactos/apps/utils/pice/module/serial.h
Normal file
36
reactos/apps/utils/pice/module/serial.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
serial.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for serial.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
void SendString(LPSTR s);
|
||||
void SetupSerial(ULONG port,ULONG baudrate);
|
||||
|
||||
BOOLEAN ConsoleInitSerial(void);
|
||||
void ConsoleShutdownSerial(void);
|
||||
|
173
reactos/apps/utils/pice/module/serial_port.h
Normal file
173
reactos/apps/utils/pice/module/serial_port.h
Normal file
|
@ -0,0 +1,173 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
serial_port.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for serial.c
|
||||
|
||||
serial port HW defines
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
#define COM1 1
|
||||
#define COM2 2
|
||||
#define COM1BASE 0x3F8 /* Base port address for COM1 */
|
||||
#define COM2BASE 0x2F8 /* Base port address for COM2 */
|
||||
|
||||
// FIX these
|
||||
#define COM3BASE 0x3F8 /* Base port address for COM3 */
|
||||
#define COM4BASE 0x2F8 /* Base port address for COM4 */
|
||||
|
||||
/*
|
||||
The 8250 UART has 10 registers accessible through 7 port addresses.
|
||||
Here are their addresses relative to COM1BASE and COM2BASE. Note
|
||||
that the baud rate registers, (DLL) and (DLH) are active only when
|
||||
the Divisor-Latch Access-Bit (DLAB) is on. The (DLAB) is bit 7 of
|
||||
the (LCR).
|
||||
|
||||
o TXR Output data to the serial port.
|
||||
o RXR Input data from the serial port.
|
||||
o LCR Initialize the serial port.
|
||||
o IER Controls interrupt generation.
|
||||
o IIR Identifies interrupts.
|
||||
o MCR Send contorl signals to the modem.
|
||||
o LSR Monitor the status of the serial port.
|
||||
o MSR Receive status of the modem.
|
||||
o DLL Low byte of baud rate divisor.
|
||||
o DHH High byte of baud rate divisor.
|
||||
*/
|
||||
#define TXR 0 /* Transmit register (WRITE) */
|
||||
#define RXR 0 /* Receive register (READ) */
|
||||
#define IER 1 /* Interrupt Enable */
|
||||
#define IIR 2 /* Interrupt ID */
|
||||
#define FCR 2 /* FIFO control */
|
||||
#define LCR 3 /* Line control */
|
||||
#define MCR 4 /* Modem control */
|
||||
#define LSR 5 /* Line Status */
|
||||
#define MSR 6 /* Modem Status */
|
||||
#define DLL 0 /* Divisor Latch Low */
|
||||
#define DLH 1 /* Divisor latch High */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------*
|
||||
Bit values held in the Line Control Register (LCR).
|
||||
bit meaning
|
||||
--- -------
|
||||
0-1 00=5 bits, 01=6 bits, 10=7 bits, 11=8 bits.
|
||||
2 Stop bits.
|
||||
3 0=parity off, 1=parity on.
|
||||
4 0=parity odd, 1=parity even.
|
||||
5 Sticky parity.
|
||||
6 Set break.
|
||||
7 Toggle port addresses.
|
||||
*-------------------------------------------------------------------*/
|
||||
#define NO_PARITY 0x00
|
||||
#define EVEN_PARITY 0x18
|
||||
#define ODD_PARITY 0x08
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------*
|
||||
Bit values held in the Line Status Register (LSR).
|
||||
bit meaning
|
||||
--- -------
|
||||
0 Data ready.
|
||||
1 Overrun error - Data register overwritten.
|
||||
2 Parity error - bad transmission.
|
||||
3 Framing error - No stop bit was found.
|
||||
4 Break detect - End to transmission requested.
|
||||
5 Transmitter holding register is empty.
|
||||
6 Transmitter shift register is empty.
|
||||
7 Time out - off line.
|
||||
*-------------------------------------------------------------------*/
|
||||
#define RCVRDY 0x01
|
||||
#define OVRERR 0x02
|
||||
#define PRTYERR 0x04
|
||||
#define FRMERR 0x08
|
||||
#define BRKERR 0x10
|
||||
#define XMTRDY 0x20
|
||||
#define XMTRSR 0x40
|
||||
#define TIMEOUT 0x80
|
||||
|
||||
/*-------------------------------------------------------------------*
|
||||
Bit values held in the Modem Output Control Register (MCR).
|
||||
bit meaning
|
||||
--- -------
|
||||
0 Data Terminal Ready. Computer ready to go.
|
||||
1 Request To Send. Computer wants to send data.
|
||||
2 auxillary output #1.
|
||||
3 auxillary output #2.(Note: This bit must be
|
||||
set to allow the communications card to send
|
||||
interrupts to the system)
|
||||
4 UART ouput looped back as input.
|
||||
5-7 not used.
|
||||
*------------------------------------------------------------------*/
|
||||
#define DTR 0x01
|
||||
#define RTS 0x02
|
||||
|
||||
|
||||
/*------------------------------------------------------------------*
|
||||
Bit values held in the Modem Input Status Register (MSR).
|
||||
bit meaning
|
||||
--- -------
|
||||
0 delta Clear To Send.
|
||||
1 delta Data Set Ready.
|
||||
2 delta Ring Indicator.
|
||||
3 delta Data Carrier Detect.
|
||||
4 Clear To Send.
|
||||
5 Data Set Ready.
|
||||
6 Ring Indicator.
|
||||
7 Data Carrier Detect.
|
||||
*------------------------------------------------------------------*/
|
||||
#define CTS 0x10
|
||||
#define DSR 0x20
|
||||
|
||||
|
||||
/*------------------------------------------------------------------*
|
||||
Bit values held in the Interrupt Enable Register (IER).
|
||||
bit meaning
|
||||
--- -------
|
||||
0 Interrupt when data received.
|
||||
1 Interrupt when transmitter holding reg. empty.
|
||||
2 Interrupt when data reception error.
|
||||
3 Interrupt when change in modem status register.
|
||||
4-7 Not used.
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_INT 0x01
|
||||
|
||||
|
||||
/*------------------------------------------------------------------*
|
||||
Bit values held in the Interrupt Identification Register (IIR).
|
||||
bit meaning
|
||||
--- -------
|
||||
0 Interrupt pending
|
||||
1-2 Interrupt ID code
|
||||
00=Change in modem status register,
|
||||
01=Transmitter holding register empty,
|
||||
10=Data received,
|
||||
11=reception error, or break encountered.
|
||||
3-7 Not used.
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_ID 0x04
|
||||
#define RX_MASK 0x07
|
1662
reactos/apps/utils/pice/module/shell.c
Normal file
1662
reactos/apps/utils/pice/module/shell.c
Normal file
File diff suppressed because it is too large
Load diff
93
reactos/apps/utils/pice/module/shell.h
Normal file
93
reactos/apps/utils/pice/module/shell.h
Normal file
|
@ -0,0 +1,93 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
shell.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for shell.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
void InstallKeyboardHook(void);
|
||||
void DeInstallKeyboardHook(void);
|
||||
void InstallGlobalKeyboardHook(void);
|
||||
void DeInstallGlobalKeyboardHook(void);
|
||||
|
||||
void RealIsr(ULONG dwReasonForBreak);
|
||||
void NewInt31Handler(void);
|
||||
|
||||
extern volatile BOOLEAN bNotifyToExit;
|
||||
extern volatile BOOLEAN bSingleStep;
|
||||
extern volatile UCHAR ucKeyPressedWhileIdle;
|
||||
extern volatile BOOLEAN bInDebuggerShell;
|
||||
|
||||
extern ULONG CurrentEIP,CurrentEFL;
|
||||
extern ULONG CurrentEAX,CurrentEBX,CurrentECX,CurrentEDX;
|
||||
extern ULONG CurrentESP,CurrentEBP,CurrentESI,CurrentEDI;
|
||||
extern ULONG CurrentDR0,CurrentDR1,CurrentDR2,CurrentDR3,CurrentDR6,CurrentDR7;
|
||||
extern ULONG CurrentCR0,CurrentCR2,CurrentCR3;
|
||||
extern USHORT CurrentCS,CurrentDS,CurrentES,CurrentFS,CurrentGS,CurrentSS;
|
||||
extern volatile BOOLEAN bControl; // TRUE when CTRL key was pressed
|
||||
extern volatile BOOLEAN bShift; // TRUE when SHIFT key was pressed
|
||||
extern volatile BOOLEAN bAlt; // TRUE when SHIFT key was pressed
|
||||
|
||||
// previous context
|
||||
extern ULONG OldEIP,OldEFL;
|
||||
extern ULONG OldEAX,OldEBX,OldECX,OldEDX;
|
||||
extern ULONG OldESP,OldEBP,OldESI,OldEDI;
|
||||
extern USHORT OldCS,OldDS,OldES,OldFS,OldGS,OldSS;
|
||||
|
||||
extern ULONG CurrentProcess;
|
||||
|
||||
extern USHORT OldSelector;
|
||||
extern ULONG OldOffset;
|
||||
|
||||
extern ULONG ulRealStackPtr; // serves as current process pointer too!!
|
||||
|
||||
extern ULONG g_ulLineNumberStart;
|
||||
extern BOOLEAN bStepThroughSource;
|
||||
extern BOOLEAN bStepInto;
|
||||
|
||||
#define REASON_INT3 (0)
|
||||
#define REASON_SINGLESTEP (1)
|
||||
#define REASON_CTRLF (2)
|
||||
#define REASON_PAGEFAULT (3)
|
||||
#define REASON_GP_FAULT (4)
|
||||
#define REASON_HARDWARE_BP (5)
|
||||
#define REASON_DOUBLE_FAULT (6)
|
||||
#define REASON_MODULE_LOAD (7)
|
||||
#define REASON_INTERNAL_ERROR (8)
|
||||
|
||||
extern volatile BOOLEAN bEnterNow;
|
||||
|
||||
// keyboard controller defines
|
||||
#define I8042_PHYSICAL_BASE 0x60
|
||||
#define I8042_DATA_REGISTER_OFFSET 0
|
||||
#define I8042_COMMAND_REGISTER_OFFSET 4
|
||||
#define I8042_STATUS_REGISTER_OFFSET 4
|
||||
|
||||
void ShowStatusLine(void);
|
||||
|
||||
#define USA (0)
|
||||
#define GERMANY (1)
|
||||
extern UCHAR ucKeyboardLayout;
|
265
reactos/apps/utils/pice/module/stab.def
Normal file
265
reactos/apps/utils/pice/module/stab.def
Normal file
|
@ -0,0 +1,265 @@
|
|||
/* Table of DBX symbol codes for the GNU system.
|
||||
Copyright (C) 1988, 91, 92, 93, 94, 95, 1996 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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
/* New stab from Solaris 2. This uses an n_type of 0, which in a.out files
|
||||
overlaps the N_UNDF used for ordinary symbols. In ELF files, the
|
||||
debug information is in a different file section, so there is no conflict.
|
||||
This symbol's n_value gives the size of the string section associated
|
||||
with this file. The symbol's n_strx (relative to the just-updated
|
||||
string section start address) gives the name of the source file,
|
||||
e.g. "foo.c", without any path information. The symbol's n_desc gives
|
||||
the count of upcoming symbols associated with this file (not including
|
||||
this one). */
|
||||
__define_stab (N_UNDF, 0x00, "UNDF")
|
||||
|
||||
/* Global variable. Only the name is significant.
|
||||
To find the address, look in the corresponding external symbol. */
|
||||
__define_stab (N_GSYM, 0x20, "GSYM")
|
||||
|
||||
/* Function name for BSD Fortran. Only the name is significant.
|
||||
To find the address, look in the corresponding external symbol. */
|
||||
__define_stab (N_FNAME, 0x22, "FNAME")
|
||||
|
||||
/* Function name or text-segment variable for C. Value is its address.
|
||||
Desc is supposedly starting line number, but GCC doesn't set it
|
||||
and DBX seems not to miss it. */
|
||||
__define_stab (N_FUN, 0x24, "FUN")
|
||||
|
||||
/* Data-segment variable with internal linkage. Value is its address.
|
||||
"Static Sym". */
|
||||
__define_stab (N_STSYM, 0x26, "STSYM")
|
||||
|
||||
/* BSS-segment variable with internal linkage. Value is its address. */
|
||||
__define_stab (N_LCSYM, 0x28, "LCSYM")
|
||||
|
||||
/* Name of main routine. Only the name is significant. */
|
||||
__define_stab (N_MAIN, 0x2a, "MAIN")
|
||||
|
||||
/* Solaris2: Read-only data symbols. */
|
||||
__define_stab (N_ROSYM, 0x2c, "ROSYM")
|
||||
|
||||
/* Global symbol in Pascal.
|
||||
Supposedly the value is its line number; I'm skeptical. */
|
||||
__define_stab (N_PC, 0x30, "PC")
|
||||
|
||||
/* Number of symbols: 0, files,,funcs,lines according to Ultrix V4.0. */
|
||||
__define_stab (N_NSYMS, 0x32, "NSYMS")
|
||||
|
||||
/* "No DST map for sym: name, ,0,type,ignored" according to Ultrix V4.0. */
|
||||
__define_stab (N_NOMAP, 0x34, "NOMAP")
|
||||
|
||||
/* New stab from Solaris 2. Like N_SO, but for the object file. Two in
|
||||
a row provide the build directory and the relative path of the .o from it.
|
||||
Solaris2 uses this to avoid putting the stabs info into the linked
|
||||
executable; this stab goes into the ".stab.index" section, and the debugger
|
||||
reads the real stabs directly from the .o files instead. */
|
||||
__define_stab (N_OBJ, 0x38, "OBJ")
|
||||
|
||||
/* New stab from Solaris 2. Options for the debugger, related to the
|
||||
source language for this module. E.g. whether to use ANSI
|
||||
integral promotions or traditional integral promotions. */
|
||||
__define_stab (N_OPT, 0x3c, "OPT")
|
||||
|
||||
/* Register variable. Value is number of register. */
|
||||
__define_stab (N_RSYM, 0x40, "RSYM")
|
||||
|
||||
/* Modula-2 compilation unit. Can someone say what info it contains? */
|
||||
__define_stab (N_M2C, 0x42, "M2C")
|
||||
|
||||
/* Line number in text segment. Desc is the line number;
|
||||
value is corresponding address. On Solaris2, the line number is
|
||||
relative to the start of the current function. */
|
||||
__define_stab (N_SLINE, 0x44, "SLINE")
|
||||
|
||||
/* Similar, for data segment. */
|
||||
__define_stab (N_DSLINE, 0x46, "DSLINE")
|
||||
|
||||
/* Similar, for bss segment. */
|
||||
__define_stab (N_BSLINE, 0x48, "BSLINE")
|
||||
|
||||
/* Sun's source-code browser stabs. ?? Don't know what the fields are.
|
||||
Supposedly the field is "path to associated .cb file". THIS VALUE
|
||||
OVERLAPS WITH N_BSLINE! */
|
||||
__define_stab_duplicate (N_BROWS, 0x48, "BROWS")
|
||||
|
||||
/* GNU Modula-2 definition module dependency. Value is the modification time
|
||||
of the definition file. Other is non-zero if it is imported with the
|
||||
GNU M2 keyword %INITIALIZE. Perhaps N_M2C can be used if there
|
||||
are enough empty fields? */
|
||||
__define_stab(N_DEFD, 0x4a, "DEFD")
|
||||
|
||||
/* New in Solaris2. Function start/body/end line numbers. */
|
||||
__define_stab(N_FLINE, 0x4C, "FLINE")
|
||||
|
||||
/* THE FOLLOWING TWO STAB VALUES CONFLICT. Happily, one is for Modula-2
|
||||
and one is for C++. Still,... */
|
||||
/* GNU C++ exception variable. Name is variable name. */
|
||||
__define_stab (N_EHDECL, 0x50, "EHDECL")
|
||||
/* Modula2 info "for imc": name,,0,0,0 according to Ultrix V4.0. */
|
||||
__define_stab_duplicate (N_MOD2, 0x50, "MOD2")
|
||||
|
||||
/* GNU C++ `catch' clause. Value is its address. Desc is nonzero if
|
||||
this entry is immediately followed by a CAUGHT stab saying what exception
|
||||
was caught. Multiple CAUGHT stabs means that multiple exceptions
|
||||
can be caught here. If Desc is 0, it means all exceptions are caught
|
||||
here. */
|
||||
__define_stab (N_CATCH, 0x54, "CATCH")
|
||||
|
||||
/* Structure or union element. Value is offset in the structure. */
|
||||
__define_stab (N_SSYM, 0x60, "SSYM")
|
||||
|
||||
/* Solaris2: Last stab emitted for module. */
|
||||
__define_stab (N_ENDM, 0x62, "ENDM")
|
||||
|
||||
/* Name of main source file.
|
||||
Value is starting text address of the compilation.
|
||||
If multiple N_SO's appear, the first to contain a trailing / is the
|
||||
compilation directory. The first to not contain a trailing / is the
|
||||
source file name, relative to the compilation directory. Others (perhaps
|
||||
resulting from cfront) are ignored.
|
||||
On Solaris2, value is undefined, but desc is a source-language code. */
|
||||
|
||||
__define_stab (N_SO, 0x64, "SO")
|
||||
|
||||
/* Automatic variable in the stack. Value is offset from frame pointer.
|
||||
Also used for type descriptions. */
|
||||
__define_stab (N_LSYM, 0x80, "LSYM")
|
||||
|
||||
/* Beginning of an include file. Only Sun uses this.
|
||||
In an object file, only the name is significant.
|
||||
The Sun linker puts data into some of the other fields. */
|
||||
__define_stab (N_BINCL, 0x82, "BINCL")
|
||||
|
||||
/* Name of sub-source file (#include file).
|
||||
Value is starting text address of the compilation. */
|
||||
__define_stab (N_SOL, 0x84, "SOL")
|
||||
|
||||
/* Parameter variable. Value is offset from argument pointer.
|
||||
(On most machines the argument pointer is the same as the frame pointer. */
|
||||
__define_stab (N_PSYM, 0xa0, "PSYM")
|
||||
|
||||
/* End of an include file. No name.
|
||||
This and N_BINCL act as brackets around the file's output.
|
||||
In an object file, there is no significant data in this entry.
|
||||
The Sun linker puts data into some of the fields. */
|
||||
__define_stab (N_EINCL, 0xa2, "EINCL")
|
||||
|
||||
/* Alternate entry point. Value is its address. */
|
||||
__define_stab (N_ENTRY, 0xa4, "ENTRY")
|
||||
|
||||
/* Beginning of lexical block.
|
||||
The desc is the nesting level in lexical blocks.
|
||||
The value is the address of the start of the text for the block.
|
||||
The variables declared inside the block *precede* the N_LBRAC symbol.
|
||||
On Solaris2, the value is relative to the start of the current function. */
|
||||
__define_stab (N_LBRAC, 0xc0, "LBRAC")
|
||||
|
||||
/* Place holder for deleted include file. Replaces a N_BINCL and everything
|
||||
up to the corresponding N_EINCL. The Sun linker generates these when
|
||||
it finds multiple identical copies of the symbols from an include file.
|
||||
This appears only in output from the Sun linker. */
|
||||
__define_stab (N_EXCL, 0xc2, "EXCL")
|
||||
|
||||
/* Modula-2 scope information. Can someone say what info it contains? */
|
||||
__define_stab (N_SCOPE, 0xc4, "SCOPE")
|
||||
|
||||
/* End of a lexical block. Desc matches the N_LBRAC's desc.
|
||||
The value is the address of the end of the text for the block.
|
||||
On Solaris2, the value is relative to the start of the current function. */
|
||||
__define_stab (N_RBRAC, 0xe0, "RBRAC")
|
||||
|
||||
/* Begin named common block. Only the name is significant. */
|
||||
__define_stab (N_BCOMM, 0xe2, "BCOMM")
|
||||
|
||||
/* End named common block. Only the name is significant
|
||||
(and it should match the N_BCOMM). */
|
||||
__define_stab (N_ECOMM, 0xe4, "ECOMM")
|
||||
|
||||
/* Member of a common block; value is offset within the common block.
|
||||
This should occur within a BCOMM/ECOMM pair. */
|
||||
__define_stab (N_ECOML, 0xe8, "ECOML")
|
||||
|
||||
/* Solaris2: Pascal "with" statement: type,,0,0,offset */
|
||||
__define_stab (N_WITH, 0xea, "WITH")
|
||||
|
||||
/* These STAB's are used on Gould systems for Non-Base register symbols
|
||||
or something like that. FIXME. I have assigned the values at random
|
||||
since I don't have a Gould here. Fixups from Gould folk welcome... */
|
||||
__define_stab (N_NBTEXT, 0xF0, "NBTEXT")
|
||||
__define_stab (N_NBDATA, 0xF2, "NBDATA")
|
||||
__define_stab (N_NBBSS, 0xF4, "NBBSS")
|
||||
__define_stab (N_NBSTS, 0xF6, "NBSTS")
|
||||
__define_stab (N_NBLCS, 0xF8, "NBLCS")
|
||||
|
||||
/* Second symbol entry containing a length-value for the preceding entry.
|
||||
The value is the length. */
|
||||
__define_stab (N_LENG, 0xfe, "LENG")
|
||||
|
||||
/* The above information, in matrix format.
|
||||
|
||||
STAB MATRIX
|
||||
_________________________________________________
|
||||
| 00 - 1F are not dbx stab symbols |
|
||||
| In most cases, the low bit is the EXTernal bit|
|
||||
|
||||
| 00 UNDEF | 02 ABS | 04 TEXT | 06 DATA |
|
||||
| 01 |EXT | 03 |EXT | 05 |EXT | 07 |EXT |
|
||||
|
||||
| 08 BSS | 0A INDR | 0C FN_SEQ | 0E WEAKA |
|
||||
| 09 |EXT | 0B | 0D WEAKU | 0F WEAKT |
|
||||
|
||||
| 10 WEAKD | 12 COMM | 14 SETA | 16 SETT |
|
||||
| 11 WEAKB | 13 | 15 | 17 |
|
||||
|
||||
| 18 SETD | 1A SETB | 1C SETV | 1E WARNING|
|
||||
| 19 | 1B | 1D | 1F FN |
|
||||
|
||||
|_______________________________________________|
|
||||
| Debug entries with bit 01 set are unused. |
|
||||
| 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM |
|
||||
| 28 LCSYM | 2A MAIN | 2C ROSYM | 2E |
|
||||
| 30 PC | 32 NSYMS | 34 NOMAP | 36 |
|
||||
| 38 OBJ | 3A | 3C OPT | 3E |
|
||||
| 40 RSYM | 42 M2C | 44 SLINE | 46 DSLINE |
|
||||
| 48 BSLINE*| 4A DEFD | 4C FLINE | 4E |
|
||||
| 50 EHDECL*| 52 | 54 CATCH | 56 |
|
||||
| 58 | 5A | 5C | 5E |
|
||||
| 60 SSYM | 62 ENDM | 64 SO | 66 |
|
||||
| 68 | 6A | 6C | 6E |
|
||||
| 70 | 72 | 74 | 76 |
|
||||
| 78 | 7A | 7C | 7E |
|
||||
| 80 LSYM | 82 BINCL | 84 SOL | 86 |
|
||||
| 88 | 8A | 8C | 8E |
|
||||
| 90 | 92 | 94 | 96 |
|
||||
| 98 | 9A | 9C | 9E |
|
||||
| A0 PSYM | A2 EINCL | A4 ENTRY | A6 |
|
||||
| A8 | AA | AC | AE |
|
||||
| B0 | B2 | B4 | B6 |
|
||||
| B8 | BA | BC | BE |
|
||||
| C0 LBRAC | C2 EXCL | C4 SCOPE | C6 |
|
||||
| C8 | CA | CC | CE |
|
||||
| D0 | D2 | D4 | D6 |
|
||||
| D8 | DA | DC | DE |
|
||||
| E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 |
|
||||
| E8 ECOML | EA WITH | EC | EE |
|
||||
| F0 | F2 | F4 | F6 |
|
||||
| F8 | FA | FC | FE LENG |
|
||||
+-----------------------------------------------+
|
||||
* 50 EHDECL is also MOD2.
|
||||
* 48 BSLINE is also BROWS.
|
||||
*/
|
67
reactos/apps/utils/pice/module/stab_gnu.h
Normal file
67
reactos/apps/utils/pice/module/stab_gnu.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
stab_gnu.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER, GNU stabs symbols
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
#ifndef __GNU_STAB__
|
||||
|
||||
/* Indicate the GNU stab.h is in use. */
|
||||
|
||||
#define __GNU_STAB__
|
||||
|
||||
#define __define_stab(NAME, CODE, STRING) NAME=CODE,
|
||||
#define __define_stab_duplicate(NAME, CODE, STRING) NAME=CODE,
|
||||
|
||||
enum __stab_debug_code
|
||||
{
|
||||
#include "stab.def"
|
||||
LAST_UNUSED_STAB_CODE
|
||||
};
|
||||
|
||||
#undef __define_stab
|
||||
|
||||
/* Definitions of "desc" field for N_SO stabs in Solaris2. */
|
||||
|
||||
#define N_SO_AS 1
|
||||
#define N_SO_C 2
|
||||
#define N_SO_ANSI_C 3
|
||||
#define N_SO_CC 4 /* C++ */
|
||||
#define N_SO_FORTRAN 5
|
||||
#define N_SO_PASCAL 6
|
||||
|
||||
/* Solaris2: Floating point type values in basic types. */
|
||||
|
||||
#define NF_NONE 0
|
||||
#define NF_SINGLE 1 /* IEEE 32-bit */
|
||||
#define NF_DOUBLE 2 /* IEEE 64-bit */
|
||||
#define NF_COMPLEX 3 /* Fortran complex */
|
||||
#define NF_COMPLEX16 4 /* Fortran double complex */
|
||||
#define NF_COMPLEX32 5 /* Fortran complex*16 */
|
||||
#define NF_LDOUBLE 6 /* Long double (whatever that is) */
|
||||
|
||||
#endif /* __GNU_STAB_ */
|
2883
reactos/apps/utils/pice/module/symbols.c
Normal file
2883
reactos/apps/utils/pice/module/symbols.c
Normal file
File diff suppressed because it is too large
Load diff
71
reactos/apps/utils/pice/module/symbols.h
Normal file
71
reactos/apps/utils/pice/module/symbols.h
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
symbols.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for symbols.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
// constant defines
|
||||
|
||||
typedef struct _LOCAL_VARIABLE
|
||||
{
|
||||
char type_name[64];
|
||||
char name[64];
|
||||
ULONG value,offset,line;
|
||||
BOOLEAN bRegister;
|
||||
}LOCAL_VARIABLE,*PLOCAL_VARIABLE;
|
||||
|
||||
BOOLEAN InitFakeKernelModule(void);
|
||||
BOOLEAN LoadExports(void);
|
||||
BOOLEAN SanityCheckExports(void);
|
||||
void UnloadExports(void);
|
||||
BOOLEAN ScanExports(const char *pFind,PULONG pValue);
|
||||
BOOLEAN ScanExportsByAddress(LPSTR *pFind,ULONG ulValue);
|
||||
PICE_SYMBOLFILE_HEADER* LoadSymbols(LPSTR filename);
|
||||
BOOLEAN LoadSymbolsFromConfig(BOOLEAN bIgnoreBootParams);
|
||||
void UnloadSymbols(void);
|
||||
BOOLEAN ReloadSymbols(void);
|
||||
LPSTR FindFunctionByAddress(ULONG ulValue,PULONG pulstart,PULONG pulend);
|
||||
LPSTR FindSourceLineForAddress(ULONG addr,PULONG pulLineNumber,LPSTR* ppSrcStart,LPSTR* ppSrcEnd,LPSTR* ppFilename);
|
||||
PLOCAL_VARIABLE FindLocalsByAddress(ULONG addr);
|
||||
ULONG FindFunctionInModuleByName(LPSTR szFunctionname,struct module* pMod);
|
||||
PICE_SYMBOLFILE_HEADER* FindModuleSymbolsByModuleName(LPSTR modname);
|
||||
BOOLEAN FindAddressForSourceLine(ULONG ulLineNumber,LPSTR pFilename,struct module* pMod,PULONG pValue);
|
||||
ULONG ConvertDecimalToUlong(LPSTR p);
|
||||
struct module* FindModuleFromAddress(ULONG addr);
|
||||
PICE_SYMBOLFILE_HEADER* FindModuleSymbols(ULONG addr);
|
||||
ULONG ListSymbolStartingAt(struct module* pMod,PICE_SYMBOLFILE_HEADER* pSymbols,ULONG index,LPSTR pOutput);
|
||||
struct module* FindModuleByName(LPSTR modname);
|
||||
void Evaluate(PICE_SYMBOLFILE_HEADER* pSymbols,LPSTR p);
|
||||
LONG ExtractNumber(LPSTR p);
|
||||
LPSTR ExtractTypeName(LPSTR p);
|
||||
|
||||
extern ULONG kernel_end;
|
||||
extern PICE_SYMBOLFILE_HEADER* apSymbols[32];
|
||||
|
||||
extern struct module fake_kernel_module;
|
||||
#define KERNEL_START (0xc0100000)
|
237
reactos/apps/utils/pice/module/syscall.c
Normal file
237
reactos/apps/utils/pice/module/syscall.c
Normal file
|
@ -0,0 +1,237 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
syscall.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Environment:
|
||||
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
12-Nov-1999: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#include "remods.h"
|
||||
#include "precomp.h"
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <linux/utsname.h>
|
||||
#include <linux/sched.h>
|
||||
#include <asm/unistd.h>
|
||||
|
||||
char syscallTemp[1024];
|
||||
|
||||
typedef struct _FRAME_SYSCALL
|
||||
{
|
||||
ULONG eip;
|
||||
ULONG cs;
|
||||
ULONG eflags;
|
||||
}FRAME_SYSCALL;
|
||||
|
||||
BOOLEAN bReportProcessEvents = TRUE;
|
||||
|
||||
ULONG OldSyscallHandler=0;
|
||||
|
||||
ULONG ulFreeModule=0;
|
||||
|
||||
struct module* pModJustFreed=NULL;
|
||||
void (*old_cleanup_module)(void)=NULL;
|
||||
|
||||
void other_module_cleanup_module(void)
|
||||
{
|
||||
DPRINT((0,"other_module_cleanup_module()\n"));
|
||||
|
||||
if(old_cleanup_module)
|
||||
{
|
||||
DPRINT((0,"other_module_cleanup_module(): calling %x\n",(ULONG)old_cleanup_module));
|
||||
old_cleanup_module();
|
||||
}
|
||||
|
||||
if(pModJustFreed)
|
||||
{
|
||||
DPRINT((0,"other_module_cleanup_module(): calling RevirtualizeBreakpointsForModule(%x)\n",(ULONG)pModJustFreed));
|
||||
RevirtualizeBreakpointsForModule(pModJustFreed);
|
||||
}
|
||||
}
|
||||
|
||||
void CSyscallHandler(FRAME_SYSCALL* ptr,ULONG ulSysCall,ULONG ebx)
|
||||
{
|
||||
// DPRINT((0,"CSyscallHandler(): %.4X:%.8X (syscall = %u)\n",ptr->cs,ptr->eip,ulSysCall));
|
||||
switch(ulSysCall)
|
||||
{
|
||||
case 1: // sys_exit
|
||||
DPRINT((0,"CSysCallHandler(): 1\n"));
|
||||
if(bReportProcessEvents)
|
||||
{
|
||||
PICE_sprintf(syscallTemp,"pICE: process destroyed \"%s\" PID=%.4X\n",current->comm,current->pid);
|
||||
AddToRingBuffer(syscallTemp);
|
||||
}
|
||||
break;
|
||||
case 11: // sys_execve
|
||||
DPRINT((0,"CSysCallHandler(): 11\n"));
|
||||
if(bReportProcessEvents)
|
||||
{
|
||||
if(PICE_strlen((char*)ebx))
|
||||
PICE_sprintf(syscallTemp,"pICE: process created \"%s\" PID=%.4X (parent \"%s\")\n",(char *)ebx,current->pid,current->comm);
|
||||
else
|
||||
PICE_sprintf(syscallTemp,"pICE: process created PID=%.4X (parent \"%s\")\n",current->pid,current->comm);
|
||||
AddToRingBuffer(syscallTemp);
|
||||
}
|
||||
break;
|
||||
case 128: // sys_init_module
|
||||
DPRINT((0,"CSysCallHandler(): 128\n"));
|
||||
if(PICE_strlen((char *)ebx))
|
||||
{
|
||||
if(pmodule_list)
|
||||
{
|
||||
struct module* pMod = *pmodule_list;
|
||||
do
|
||||
{
|
||||
if(PICE_strcmpi((char*)ebx,(LPSTR)pMod->name)==0)
|
||||
{
|
||||
ULONG ulInitAddress;
|
||||
PICE_sprintf(syscallTemp,"pICE: module \"%s\" loaded (%x-%x init @ %x)\n",(char*)ebx,pMod,(ULONG)pMod+pMod->size,pMod->init);
|
||||
if((ulInitAddress=FindFunctionInModuleByName("init_module",pMod)))
|
||||
{
|
||||
DPRINT((0,"setting DR1=%.8x\n",ulInitAddress));
|
||||
|
||||
SetHardwareBreakPoint(ulInitAddress,1);
|
||||
}
|
||||
}
|
||||
}while((pMod = pMod->next));
|
||||
}
|
||||
else
|
||||
{
|
||||
PICE_sprintf(syscallTemp,"pICE: module loaded \"%s\"\n",(char *)ebx);
|
||||
}
|
||||
}
|
||||
else
|
||||
PICE_sprintf(syscallTemp,"pICE: module loaded\n");
|
||||
AddToRingBuffer(syscallTemp);
|
||||
break;
|
||||
case 129: // sys_delete_module
|
||||
DPRINT((0,"CSysCallHandler(): 129\n"));
|
||||
if(PICE_strlen((char *)ebx))
|
||||
{
|
||||
if(IsModuleLoaded((LPSTR)ebx)!=NULL && PICE_strcmpi((char*)ebx,"pice")!=0 )
|
||||
{
|
||||
PICE_sprintf(syscallTemp,"pICE: module freed \"%s\"\n",(char *)ebx);
|
||||
Print(OUTPUT_WINDOW,syscallTemp);
|
||||
if((pModJustFreed = FindModuleByName((char*)ebx)) )
|
||||
{
|
||||
if(pModJustFreed->cleanup)
|
||||
{
|
||||
old_cleanup_module = pModJustFreed->cleanup;
|
||||
pModJustFreed->cleanup = other_module_cleanup_module;
|
||||
}
|
||||
else
|
||||
{
|
||||
RevirtualizeBreakpointsForModule(pModJustFreed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PICE_sprintf(syscallTemp,"pICE: module freed\n");
|
||||
AddToRingBuffer(syscallTemp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
__asm__ ("
|
||||
NewSyscallHandler:
|
||||
// save used regs
|
||||
pushfl
|
||||
cli
|
||||
cld
|
||||
pushal
|
||||
pushl %ds
|
||||
|
||||
// push the syscall number
|
||||
pushl %ebx
|
||||
pushl %eax
|
||||
|
||||
// frame ptr
|
||||
lea 48(%esp),%eax
|
||||
pushl %eax
|
||||
|
||||
// setup default data selectors
|
||||
movw %ss,%ax
|
||||
movw %ax,%ds
|
||||
|
||||
call CSyscallHandler
|
||||
|
||||
// remove pushed params
|
||||
add $12,%esp
|
||||
|
||||
// restore used regs
|
||||
popl %ds
|
||||
popal
|
||||
popfl
|
||||
|
||||
// chain to old handler
|
||||
.byte 0x2e
|
||||
jmp *OldSyscallHandler");
|
||||
|
||||
void InstallSyscallHook(void)
|
||||
{
|
||||
ULONG LocalSyscallHandler;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
MaskIrqs();
|
||||
if(!OldSyscallHandler)
|
||||
{
|
||||
__asm__("mov $NewSyscallHandler,%0"
|
||||
:"=r" (LocalSyscallHandler)
|
||||
:
|
||||
:"eax");
|
||||
OldSyscallHandler=SetGlobalInt(0x80,(ULONG)LocalSyscallHandler);
|
||||
|
||||
ScanExports("free_module",(PULONG)&ulFreeModule);
|
||||
|
||||
DPRINT((0,"InstallSyscallHook(): free_module @ %x\n",ulFreeModule));
|
||||
}
|
||||
UnmaskIrqs();
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
void DeInstallSyscallHook(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
|
||||
MaskIrqs();
|
||||
if(OldSyscallHandler)
|
||||
{
|
||||
SetGlobalInt(0x80,(ULONG)OldSyscallHandler);
|
||||
(ULONG)OldSyscallHandler=0;
|
||||
}
|
||||
UnmaskIrqs();
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
35
reactos/apps/utils/pice/module/syscall.h
Normal file
35
reactos/apps/utils/pice/module/syscall.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
syscall.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for syscall.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
void InstallSyscallHook(void);
|
||||
void DeInstallSyscallHook(void);
|
||||
|
||||
void CReturnFromSyscallHandler(void);
|
||||
|
87
reactos/apps/utils/pice/module/trace.c
Normal file
87
reactos/apps/utils/pice/module/trace.c
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
trace.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Environment:
|
||||
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
19-Aug-1998: created
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#include "remods.h"
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
void DeInstallTraceHook(void);
|
||||
|
||||
volatile ULONG OldInt1Handler=0;
|
||||
|
||||
__asm__("
|
||||
NewInt1Handler:
|
||||
pushl %eax
|
||||
movl %dr6,%eax
|
||||
testl $(1<<14),%eax
|
||||
jz exceptionnotsinglestep
|
||||
|
||||
popl %eax
|
||||
pushl $" STR(REASON_SINGLESTEP) "
|
||||
jmp NewInt31Handler
|
||||
|
||||
exceptionnotsinglestep:
|
||||
popl %eax
|
||||
pushl $" STR(REASON_HARDWARE_BP) "
|
||||
jmp NewInt31Handler
|
||||
");
|
||||
|
||||
BOOLEAN InstallTraceHook(void)
|
||||
{
|
||||
ULONG LocalInt1Handler;
|
||||
|
||||
DPRINT((0,"InstallTraceHook(OldInt1Handler=%0.8x)...\n",OldInt1Handler));
|
||||
|
||||
MaskIrqs();
|
||||
if(!OldInt1Handler)
|
||||
{
|
||||
__asm__("mov $NewInt1Handler,%0"
|
||||
:"=r" (LocalInt1Handler)
|
||||
:
|
||||
:"eax");
|
||||
OldInt1Handler=SetGlobalInt(0x01,(ULONG)LocalInt1Handler);
|
||||
}
|
||||
UnmaskIrqs();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void DeInstallTraceHook(void)
|
||||
{
|
||||
DPRINT((0,"DeInstallTraceHook(OldInt1Handler=%0.8x)...\n",OldInt1Handler));
|
||||
|
||||
MaskIrqs();
|
||||
if(OldInt1Handler)
|
||||
{
|
||||
SetGlobalInt(0x01,(ULONG)OldInt1Handler);
|
||||
OldInt1Handler = 0;
|
||||
}
|
||||
UnmaskIrqs();
|
||||
}
|
35
reactos/apps/utils/pice/module/trace.h
Normal file
35
reactos/apps/utils/pice/module/trace.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
trace.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for trace.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
void DeInstallTraceHook(void);
|
||||
BOOLEAN InstallTraceHook(void);
|
||||
void NewInt1Handler(void);
|
||||
|
||||
extern volatile ULONG OldInt1Handler;
|
2070
reactos/apps/utils/pice/module/utils.c
Normal file
2070
reactos/apps/utils/pice/module/utils.c
Normal file
File diff suppressed because it is too large
Load diff
246
reactos/apps/utils/pice/module/utils.h
Normal file
246
reactos/apps/utils/pice/module/utils.h
Normal file
|
@ -0,0 +1,246 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
utils.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for utils.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
#define __STR(x) #x
|
||||
#define STR(x) __STR(x)
|
||||
|
||||
typedef struct _FRAME
|
||||
{
|
||||
ULONG error_code;
|
||||
ULONG eip;
|
||||
ULONG cs;
|
||||
ULONG eflags;
|
||||
}FRAME;
|
||||
|
||||
#define SHOW_FIELD_BYTE(ptr,field,wait)\
|
||||
{\
|
||||
if(wait && WaitForKey()==FALSE)\
|
||||
return TRUE;\
|
||||
PICE_sprintf(tempCmd,#field" = %.2x\n",ptr->##field);\
|
||||
Print(OUTPUT_WINDOW,tempCmd);\
|
||||
}
|
||||
|
||||
#define SHOW_FIELD_WORD(ptr,field,wait)\
|
||||
{\
|
||||
if(wait && WaitForKey()==FALSE)\
|
||||
return TRUE;\
|
||||
PICE_sprintf(tempCmd,#field" = %.4x\n",ptr->##field);\
|
||||
Print(OUTPUT_WINDOW,tempCmd);\
|
||||
}
|
||||
|
||||
#define SHOW_FIELD_DWORD(ptr,field,wait)\
|
||||
{\
|
||||
if(wait && WaitForKey()==FALSE)\
|
||||
return TRUE;\
|
||||
sprintf(tempCmd,#field" = %.8x\n",ptr->##field);\
|
||||
Print(OUTPUT_WINDOW,tempCmd);\
|
||||
}
|
||||
|
||||
#define SHOW_FIELD_SEG_OFS(ptr,field1,field2,wait)\
|
||||
{\
|
||||
if(wait && WaitForKey()==FALSE)\
|
||||
return TRUE;\
|
||||
PICE_sprintf(tempCmd,#field1":"#field2" = %.4x:%.8x\n",ptr->##field1,ptr->##field2);\
|
||||
Print(OUTPUT_WINDOW,tempCmd);\
|
||||
}
|
||||
|
||||
typedef struct _PCI_NUMBER
|
||||
{
|
||||
union {
|
||||
struct
|
||||
{
|
||||
ULONG res2 : 2;
|
||||
ULONG reg : 6; // 64 regs per function
|
||||
ULONG func : 3; // 8 functions per device
|
||||
ULONG dev : 5; // 32 device per bus
|
||||
ULONG bus : 8; // 256 buses
|
||||
ULONG res1 : 7;
|
||||
ULONG ce : 1; // 1 to enable
|
||||
}bits;
|
||||
ULONG AsUlong;
|
||||
}u;
|
||||
}PCI_NUMBER;
|
||||
|
||||
typedef struct _PCI_COMMON_CONFIG {
|
||||
USHORT VendorID; // (ro)
|
||||
USHORT DeviceID; // (ro)
|
||||
USHORT Command; // Device control
|
||||
USHORT Status;
|
||||
UCHAR RevisionID; // (ro)
|
||||
UCHAR ProgIf; // (ro)
|
||||
UCHAR SubClass; // (ro)
|
||||
UCHAR BaseClass; // (ro)
|
||||
UCHAR CacheLineSize; // (ro+)
|
||||
UCHAR LatencyTimer; // (ro+)
|
||||
UCHAR HeaderType; // (ro)
|
||||
UCHAR BIST; // Built in self test
|
||||
ULONG BaseAddresses[6];
|
||||
ULONG CIS;
|
||||
USHORT SubVendorID;
|
||||
USHORT SubSystemID;
|
||||
ULONG ROMBaseAddress;
|
||||
UCHAR CapabilitiesPtr;
|
||||
UCHAR Reserved1[3];
|
||||
ULONG Reserved2;
|
||||
UCHAR InterruptLine; //
|
||||
UCHAR InterruptPin; // (ro)
|
||||
UCHAR MinimumGrant; // (ro)
|
||||
UCHAR MaximumLatency; // (ro)
|
||||
}PCI_COMMON_CONFIG;
|
||||
|
||||
typedef struct tagPageDir
|
||||
{
|
||||
ULONG P :1;
|
||||
ULONG RW :1;
|
||||
ULONG US :1;
|
||||
ULONG PWT :1;
|
||||
ULONG PCD :1;
|
||||
ULONG A :1;
|
||||
ULONG dummy :1;
|
||||
ULONG PS :1;
|
||||
ULONG G :1;
|
||||
ULONG Avail :3;
|
||||
ULONG PTBase :20;
|
||||
}PAGEDIR,*PPAGEDIR;
|
||||
|
||||
extern struct mm_struct* my_init_mm;
|
||||
|
||||
typedef struct tagGdt
|
||||
{
|
||||
ULONG Limit_15_0 :16;
|
||||
ULONG Base_15_0 :16;
|
||||
ULONG Base_23_16 :8;
|
||||
ULONG SegType :4;
|
||||
ULONG DescType :1;
|
||||
ULONG Dpl :2;
|
||||
ULONG Present :1;
|
||||
ULONG Limit_19_16 :4;
|
||||
ULONG Avl :1;
|
||||
ULONG Reserved :1;
|
||||
ULONG DefOp :1;
|
||||
ULONG Gran :1;
|
||||
ULONG Base_31_24 :8;
|
||||
}GDT,*PGDT;
|
||||
|
||||
typedef struct tagIdt
|
||||
{
|
||||
ULONG Offset_15_0 :16;
|
||||
ULONG Selector :16;
|
||||
ULONG Reserved :8;
|
||||
ULONG DescType :5;
|
||||
ULONG Dpl :2;
|
||||
ULONG Present :1;
|
||||
ULONG Offset_31_16 :16;
|
||||
}IDT,*PIDT;
|
||||
|
||||
typedef struct tagDESCRIPTOR
|
||||
{
|
||||
USHORT Cpl :2; // current privilege level
|
||||
USHORT Ti :1; // table index (GDT=0 LDT=1)
|
||||
USHORT Val :13; // index into table
|
||||
}DESCRIPTOR,*PDESCRIPTOR;
|
||||
|
||||
extern struct module **pmodule_list;
|
||||
|
||||
void PICE_memset(void* p,unsigned char c,int sz);
|
||||
void PICE_memcpy(void* t,void* s,int sz);
|
||||
char *PICE_strrev(char *);
|
||||
ULONG PICE_strcmp(char* s1,char* s2);
|
||||
ULONG PICE_strcmpi(char* s1,char* s2);
|
||||
ULONG PICE_strncmpi(char* s1,char* s2,ULONG len);
|
||||
USHORT PICE_strlen(char* s);
|
||||
char* PICE_strcat(char* s1,char* s2);
|
||||
BOOLEAN PICE_isprint(char c);
|
||||
char* PICE_strcpy(char* s1,char* s2);
|
||||
char* PICE_strncpy(char* s1,char* s2,int len);
|
||||
char* PICE_strchr(char* s,char c);
|
||||
|
||||
int PICE_sprintf(char * buf, const char *fmt, ...);
|
||||
int PICE_vsprintf(char *buf, const char *fmt, va_list args);
|
||||
|
||||
BOOLEAN IsAddressValid(ULONG Addr);
|
||||
BOOLEAN IsAddressWriteable(ULONG Addr);
|
||||
BOOLEAN SetAddressWriteable(ULONG address,BOOLEAN bSet);
|
||||
BOOLEAN IsRangeValid(ULONG addr,ULONG Length);
|
||||
void IntelStackWalk(ULONG pc,ULONG ebp,ULONG esp);
|
||||
struct module* IsModuleLoaded(LPSTR p);
|
||||
|
||||
ULONG ReadPhysMem(ULONG Address,ULONG ulSize);
|
||||
void WritePhysMem(ULONG Address,ULONG Datum,ULONG ulSize);
|
||||
|
||||
BOOLEAN IsRetAtEIP(void);
|
||||
BOOLEAN IsCallInstrAtEIP(void);
|
||||
|
||||
ULONG GetLinearAddress(USHORT Segment,ULONG Offset);
|
||||
|
||||
#define OUTPUT_BUFFER_FULL 0x01
|
||||
#define INPUT_BUFFER_FULL 0x02
|
||||
#define MOUSE_OUTPUT_BUFFER_FULL 0x20
|
||||
|
||||
void ShowStoppedMsg(void);
|
||||
void ShowRunningMsg(void);
|
||||
|
||||
void SetHardwareBreakPoints(void);
|
||||
void SetHardwareBreakPoint(ULONG ulAddress,ULONG ulReg);
|
||||
|
||||
// this should be in disasm.h but someone misused the header files
|
||||
BOOLEAN Disasm(PULONG pOffset, PUCHAR pchDst);
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLOBAL_CODE_SEGMENT (__KERNEL_CS)
|
||||
#define GLOBAL_DATA_SEGMENT (__KERNEL_DS)
|
||||
|
||||
#define OVR_CS .byte 0x2e
|
||||
#define OVR_FS .byte 0x64
|
||||
|
||||
void DisplayRegs(void);
|
||||
void SaveOldRegs(void);
|
||||
|
||||
BOOLEAN CheckLoadAbort(void);
|
||||
|
||||
UCHAR KeyboardGetKeyPolled(void);
|
||||
void KeyboardFlushKeyboardQueue(void);
|
||||
|
||||
#if REAL_LINUX_VERSION_CODE >= 0x020400
|
||||
#define _PAGE_4M _PAGE_PSE
|
||||
#endif
|
||||
|
||||
UCHAR AsciiFromScan(UCHAR s);
|
||||
UCHAR AsciiToScan(UCHAR s);
|
||||
|
||||
void outportb(USHORT port,UCHAR data);
|
||||
UCHAR inportb(USHORT port);
|
||||
|
||||
extern unsigned long sys_call_table[];
|
||||
|
||||
struct mm_struct *GetInitMm(void);
|
||||
|
||||
void EnablePassThrough(void);
|
463
reactos/apps/utils/pice/module/vga.c
Normal file
463
reactos/apps/utils/pice/module/vga.c
Normal file
|
@ -0,0 +1,463 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
vga.c
|
||||
|
||||
Abstract:
|
||||
|
||||
VGA HW dependent draw routines
|
||||
|
||||
Environment:
|
||||
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
04-Aug-1998: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// INCLUDES
|
||||
////
|
||||
#include "remods.h"
|
||||
#include "precomp.h"
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <linux/ctype.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// PROTOTYPES
|
||||
////
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// DEFINES
|
||||
////
|
||||
#define LOCAL_CONSOLE // undefine this to get text only hercules version
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// GLOBALS
|
||||
////
|
||||
// used for HERCUELS text and VGA text mode
|
||||
WINDOW wWindowVga[4]=
|
||||
{
|
||||
{1,3,1,0,FALSE},
|
||||
{5,4,1,0,FALSE},
|
||||
{10,9,1,0,FALSE},
|
||||
{20,4,1,0,FALSE}
|
||||
};
|
||||
|
||||
// 25 line text mode
|
||||
UCHAR MGATable25[]={97,80,82,15,25, 6,25,25, 2,13,11,12, 0, 0, 0, 0};
|
||||
|
||||
PUCHAR pScreenBufferVga;
|
||||
PUCHAR pScreenBufferSaveVga = NULL;
|
||||
PUCHAR pScreenBufferTempVga;
|
||||
PUCHAR pScreenBufferHardwareVga;
|
||||
|
||||
UCHAR offset_a = 0;
|
||||
UCHAR offset_c = 0,offset_d = 0;
|
||||
UCHAR offset_e = 0,offset_f = 0;
|
||||
|
||||
struct _attr
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
|
||||
UCHAR fgcol : 4;
|
||||
UCHAR bkcol : 3;
|
||||
UCHAR blink : 1;
|
||||
}bits;
|
||||
UCHAR Asuchar;
|
||||
}u;
|
||||
}attr;
|
||||
|
||||
//*************************************************************************
|
||||
// SetForegroundColorVga()
|
||||
//
|
||||
//*************************************************************************
|
||||
void SetForegroundColorVga(ECOLORS col)
|
||||
{
|
||||
attr.u.bits.fgcol = col;
|
||||
attr.u.bits.blink = 0;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// SetBackgroundColorVga()
|
||||
//
|
||||
//*************************************************************************
|
||||
void SetBackgroundColorVga(ECOLORS col)
|
||||
{
|
||||
attr.u.bits.bkcol = col;
|
||||
attr.u.bits.blink = 0;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// PrintGrafVga()
|
||||
//
|
||||
//*************************************************************************
|
||||
void PrintGrafVga(ULONG x,ULONG y,UCHAR c)
|
||||
{
|
||||
((PUSHORT)pScreenBufferVga)[y*GLOBAL_SCREEN_WIDTH + x] = (USHORT)((attr.u.Asuchar<<8)|c);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// ShowCursor()
|
||||
//
|
||||
// show hardware cursor
|
||||
//*************************************************************************
|
||||
void ShowCursorVga(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
|
||||
bCursorEnabled=TRUE;
|
||||
|
||||
#ifdef LOCAL_CONSOLE
|
||||
outb_p(0x0a,0x3d4);
|
||||
outb_p(inb_p(0x3d5)&~0x20,0x3d5);
|
||||
#else
|
||||
outb_p(0x0a,0x3b4);
|
||||
outb_p(inb_p(0x3b5)&~0x20,0x3b5);
|
||||
#endif
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// HideCursorVga()
|
||||
//
|
||||
// hide hardware cursor
|
||||
//*************************************************************************
|
||||
void HideCursorVga(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
bCursorEnabled=FALSE;
|
||||
|
||||
#ifdef LOCAL_CONSOLE
|
||||
outb_p(0x0a,0x3d4);
|
||||
outb_p(inb_p(0x3d5)|0x20,0x3d5);
|
||||
#else
|
||||
outb_p(0x0a,0x3b4);
|
||||
outb_p(inb_p(0x3b5)|0x20,0x3b5);
|
||||
#endif
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// CopyLineTo()
|
||||
//
|
||||
// copy a line from src to dest
|
||||
//*************************************************************************
|
||||
void CopyLineToVga(USHORT dest,USHORT src)
|
||||
{
|
||||
USHORT i;
|
||||
PUSHORT p = (PUSHORT)pScreenBufferVga;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
for(i=0;i<GLOBAL_SCREEN_WIDTH;i++)
|
||||
p[dest*GLOBAL_SCREEN_WIDTH+i] = p[src*GLOBAL_SCREEN_WIDTH+i];
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// InvertLineVga()
|
||||
//
|
||||
// invert a line on the screen
|
||||
//*************************************************************************
|
||||
void InvertLineVga(ULONG line)
|
||||
{
|
||||
ULONG i;
|
||||
PUSHORT p = (PUSHORT)pScreenBufferVga;
|
||||
#ifdef LOCAL_CONSOLE
|
||||
USHORT attr;
|
||||
#endif
|
||||
|
||||
if(line<25)
|
||||
{
|
||||
#ifdef LOCAL_CONSOLE
|
||||
attr = p[line*GLOBAL_SCREEN_WIDTH]>>8;
|
||||
attr = ((attr & 0x07)<<4) | ((attr & 0xF0)>>4);
|
||||
attr <<= 8;
|
||||
for(i=0;i<GLOBAL_SCREEN_WIDTH;i++)
|
||||
p[line*GLOBAL_SCREEN_WIDTH + i] = (p[line*GLOBAL_SCREEN_WIDTH + i] & 0x00FF) | attr;
|
||||
#else
|
||||
for(i=0;i<GLOBAL_SCREEN_WIDTH;i++)
|
||||
p[line*GLOBAL_SCREEN_WIDTH + i] = p[line*GLOBAL_SCREEN_WIDTH + i] ^ 0xFF00;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// HatchLineVga()
|
||||
//
|
||||
// hatches a line on the screen
|
||||
//*************************************************************************
|
||||
void HatchLineVga(ULONG line)
|
||||
{
|
||||
ULONG i;
|
||||
PUSHORT p = (PUSHORT)pScreenBufferVga;
|
||||
|
||||
if(line<GLOBAL_SCREEN_HEIGHT)
|
||||
{
|
||||
for(i=0;i<GLOBAL_SCREEN_WIDTH;i++)
|
||||
p[line*GLOBAL_SCREEN_WIDTH + i] = (p[line*GLOBAL_SCREEN_WIDTH + i] & 0xF0FF) | 0x0c00;
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// ClrLineVga()
|
||||
//
|
||||
// clear a line on the screen
|
||||
//*************************************************************************
|
||||
void ClrLineVga(ULONG line)
|
||||
{
|
||||
ULONG i;
|
||||
PUSHORT p = (PUSHORT)pScreenBufferVga;
|
||||
|
||||
if(line<GLOBAL_SCREEN_HEIGHT)
|
||||
{
|
||||
for(i=0;i<GLOBAL_SCREEN_WIDTH;i++)
|
||||
p[line*GLOBAL_SCREEN_WIDTH + i] = (USHORT)((attr.u.Asuchar<<8) | 0x20);
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// PrintLogoVga()
|
||||
//
|
||||
//*************************************************************************
|
||||
void PrintLogoVga(BOOLEAN bShow)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// PrintCursorVga()
|
||||
//
|
||||
// emulate a blinking cursor block
|
||||
//*************************************************************************
|
||||
void PrintCursorVga(BOOLEAN bForce)
|
||||
{
|
||||
static ULONG count=0;
|
||||
USHORT charoffset;
|
||||
UCHAR data;
|
||||
ULONG x=wWindow[OUTPUT_WINDOW].usCurX,y=wWindow[OUTPUT_WINDOW].y+wWindow[OUTPUT_WINDOW].usCurY;
|
||||
|
||||
if( count++>250 )
|
||||
{
|
||||
count=0;
|
||||
|
||||
charoffset = (y* GLOBAL_SCREEN_WIDTH + x);
|
||||
|
||||
#ifndef LOCAL_CONSOLE
|
||||
outb_p(0x0e,0x3b4);
|
||||
data=(UCHAR)((charoffset>>8)&0xFF);
|
||||
outb_p(data,0x3b5);
|
||||
|
||||
outb_p(0x0d,0x3b4);
|
||||
data=(UCHAR)(charoffset & 0xFF);
|
||||
outb_p(data,0x3b5);
|
||||
#else
|
||||
outb_p(0x0e,0x3d4);
|
||||
data=(UCHAR)((charoffset>>8)&0xFF);
|
||||
outb_p(data,0x3d5);
|
||||
|
||||
outb_p(0x0f,0x3d4);
|
||||
data=(UCHAR)(charoffset & 0xFF);
|
||||
outb_p(data,0x3d5);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// SaveGraphicsVga()
|
||||
//
|
||||
//*************************************************************************
|
||||
void SaveGraphicsStateVga(void)
|
||||
{
|
||||
#ifdef LOCAL_CONSOLE
|
||||
// copy the screen content to temp area
|
||||
memcpy(pScreenBufferTempVga,pScreenBufferHardwareVga,FRAMEBUFFER_SIZE);
|
||||
// copy the console to the screen
|
||||
memcpy(pScreenBufferHardwareVga,pScreenBufferVga,FRAMEBUFFER_SIZE);
|
||||
// save original pointer
|
||||
pScreenBufferSaveVga = pScreenBufferVga;
|
||||
// pScreenBufferVga now points to screen
|
||||
pScreenBufferVga = pScreenBufferHardwareVga;
|
||||
|
||||
// save video RAM start address
|
||||
outb_p(0xc,0x3d4);
|
||||
offset_c = inb_p(0x3d5);
|
||||
outb_p(0x0,0x3d5);
|
||||
outb_p(0xd,0x3d4);
|
||||
offset_d = inb_p(0x3d5);
|
||||
outb_p(0x0,0x3d5);
|
||||
|
||||
// cursor state
|
||||
outb_p(0x0a,0x3d4);
|
||||
offset_a = inb_p(0x3d5);
|
||||
// cursor position
|
||||
outb_p(0x0e,0x3d4);
|
||||
offset_e = inb_p(0x3d5);
|
||||
outb_p(0x0f,0x3d4);
|
||||
offset_f = inb_p(0x3d5);
|
||||
#endif
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// RestoreGraphicsStateVga()
|
||||
//
|
||||
//*************************************************************************
|
||||
void RestoreGraphicsStateVga(void)
|
||||
{
|
||||
#ifdef LOCAL_CONSOLE
|
||||
pScreenBufferVga = pScreenBufferSaveVga;
|
||||
// copy screen to the console
|
||||
memcpy(pScreenBufferVga,pScreenBufferHardwareVga,FRAMEBUFFER_SIZE);
|
||||
// copy the temp area to the screen
|
||||
memcpy(pScreenBufferHardwareVga,pScreenBufferTempVga,FRAMEBUFFER_SIZE);
|
||||
|
||||
// restore video RAM start address
|
||||
outb_p(0xc,0x3d4);
|
||||
outb_p(offset_c,0x3d5);
|
||||
outb_p(0xd,0x3d4);
|
||||
outb_p(offset_d,0x3d5);
|
||||
|
||||
// cursor state
|
||||
outb_p(0x0a,0x3d4);
|
||||
outb_p(offset_a,0x3d5);
|
||||
// cursor position
|
||||
outb_p(0x0e,0x3d4);
|
||||
outb_p(offset_e,0x3d5);
|
||||
outb_p(0x0f,0x3d4);
|
||||
outb_p(offset_f,0x3d5);
|
||||
#endif
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// ConsoleInitVga()
|
||||
//
|
||||
// init terminal screen
|
||||
//*************************************************************************
|
||||
BOOLEAN ConsoleInitVga(void)
|
||||
{
|
||||
BOOLEAN bResult = FALSE;
|
||||
#ifndef LOCAL_CONSOLE
|
||||
PUCHAR pMGATable = MGATable25;
|
||||
UCHAR i,reg,data;
|
||||
#endif
|
||||
PUSHORT p;
|
||||
|
||||
ENTER_FUNC();
|
||||
|
||||
ohandlers.CopyLineTo = CopyLineToVga;
|
||||
ohandlers.PrintGraf = PrintGrafVga;
|
||||
ohandlers.ClrLine = ClrLineVga;
|
||||
ohandlers.InvertLine = InvertLineVga;
|
||||
ohandlers.HatchLine = HatchLineVga;
|
||||
ohandlers.PrintLogo = PrintLogoVga;
|
||||
ohandlers.PrintCursor = PrintCursorVga;
|
||||
ohandlers.SaveGraphicsState = SaveGraphicsStateVga;
|
||||
ohandlers.RestoreGraphicsState = RestoreGraphicsStateVga;
|
||||
ohandlers.ShowCursor = ShowCursorVga;
|
||||
ohandlers.HideCursor = HideCursorVga;
|
||||
ohandlers.SetForegroundColor = SetForegroundColorVga;
|
||||
ohandlers.SetBackgroundColor = SetBackgroundColorVga;
|
||||
|
||||
ihandlers.GetKeyPolled = KeyboardGetKeyPolled;
|
||||
ihandlers.FlushKeyboardQueue = KeyboardFlushKeyboardQueue;
|
||||
|
||||
SetWindowGeometry(wWindowVga);
|
||||
|
||||
GLOBAL_SCREEN_WIDTH = 80;
|
||||
GLOBAL_SCREEN_HEIGHT = 25;
|
||||
|
||||
attr.u.Asuchar = 0x07;
|
||||
|
||||
#ifdef LOCAL_CONSOLE
|
||||
// the real framebuffer
|
||||
pScreenBufferHardwareVga = ioremap(0xB8000,FRAMEBUFFER_SIZE);
|
||||
// the console
|
||||
pScreenBufferVga = vmalloc(FRAMEBUFFER_SIZE);
|
||||
// the save area
|
||||
pScreenBufferTempVga = vmalloc(FRAMEBUFFER_SIZE);
|
||||
#else
|
||||
outb_p(0,0x3b8);
|
||||
outb_p(0,0x3bf);
|
||||
for(i=0;i<sizeof(MGATable25);i++)
|
||||
{
|
||||
reg=i;
|
||||
outb_p(reg,0x3b4);
|
||||
data=pMGATable[i];
|
||||
outb_p(data,0x3b5);
|
||||
}
|
||||
outb_p(0x08,0x3b8);
|
||||
|
||||
pScreenBufferVga=ioremap(0xB0000,FRAMEBUFFER_SIZE);
|
||||
#endif
|
||||
if(pScreenBufferVga)
|
||||
{
|
||||
DPRINT((0,"VGA memory phys. 0x000b0000 mapped to virt. 0x%x\n",pScreenBufferVga));
|
||||
|
||||
bResult = TRUE;
|
||||
|
||||
p = (PUSHORT)pScreenBufferVga;
|
||||
|
||||
PICE_memset(pScreenBufferVga,0x0,FRAMEBUFFER_SIZE);
|
||||
|
||||
DPRINT((0,"VGA memory cleared!\n"));
|
||||
|
||||
EmptyRingBuffer();
|
||||
|
||||
DPRINT((0,"ConsoleInitVga() SUCCESS!\n"));
|
||||
}
|
||||
|
||||
LEAVE_FUNC();
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// ConsoleShutdownVga()
|
||||
//
|
||||
// exit terminal screen
|
||||
//*************************************************************************
|
||||
void ConsoleShutdownVga(void)
|
||||
{
|
||||
ENTER_FUNC();
|
||||
|
||||
#ifdef LOCAL_CONSOLE
|
||||
if(pScreenBufferVga)
|
||||
{
|
||||
vfree(pScreenBufferVga);
|
||||
vfree(pScreenBufferTempVga);
|
||||
iounmap(pScreenBufferHardwareVga);
|
||||
}
|
||||
#else
|
||||
// HERC video off
|
||||
outb_p(0,0x3b8);
|
||||
outb_p(0,0x3bf);
|
||||
|
||||
if(pScreenBufferVga)
|
||||
iounmap(pScreenBufferVga);
|
||||
#endif
|
||||
|
||||
LEAVE_FUNC();
|
||||
}
|
32
reactos/apps/utils/pice/module/vga.h
Normal file
32
reactos/apps/utils/pice/module/vga.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
vga.h
|
||||
|
||||
Abstract:
|
||||
|
||||
HEADER for vga.c
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
BOOLEAN ConsoleInitVga(void);
|
||||
void ConsoleShutdownVga(void);
|
177
reactos/apps/utils/pice/shared/shared.h
Normal file
177
reactos/apps/utils/pice/shared/shared.h
Normal file
|
@ -0,0 +1,177 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998-2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
|
||||
shared.h
|
||||
|
||||
Abstract:
|
||||
|
||||
shared stuff between module and loader
|
||||
|
||||
Environment:
|
||||
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
Revision History:
|
||||
|
||||
13-Nov-1999: created
|
||||
15-Nov-2000: general cleanup of source files
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
#ifdef LINUX
|
||||
|
||||
#define PICE_IOCTL_MAGIC 'p'
|
||||
|
||||
#define PICE_IOCTL_LOAD _IO(PICE_IOCTL_MAGIC,0)
|
||||
#define PICE_IOCTL_UNLOAD _IO(PICE_IOCTL_MAGIC,1)
|
||||
#define PICE_IOCTL_RELOAD _IO(PICE_IOCTL_MAGIC,2)
|
||||
#define PICE_IOCTL_BREAK _IO(PICE_IOCTL_MAGIC,3)
|
||||
#define PICE_IOCTL_STATUS _IO(PICE_IOCTL_MAGIC,4)
|
||||
|
||||
|
||||
typedef struct _DEBUGGER_STATUS_BLOCK
|
||||
{
|
||||
ULONG Test;
|
||||
}DEBUGGER_STATUS_BLOCK,*PDEBUGGER_STATUS_BLOCK;
|
||||
|
||||
#define MAGIC_ULONG( ch0, ch1, ch2, ch3 ) \
|
||||
( (ULONG)(UCHAR)(ch0) | \
|
||||
( (ULONG)(UCHAR)(ch1) << 8 ) | \
|
||||
( (ULONG)(UCHAR)(ch2) << 16 ) | \
|
||||
( (ULONG)(UCHAR)(ch3) << 24 ) )
|
||||
|
||||
#define PICE_MAGIC MAGIC_ULONG('P','I','C','E')
|
||||
|
||||
typedef struct _PICE_SYMBOLFILE_HEADER
|
||||
{
|
||||
ULONG magic;
|
||||
char name[32];
|
||||
ULONG ulOffsetToHeaders,ulSizeOfHeader;
|
||||
ULONG ulOffsetToGlobals,ulSizeOfGlobals;
|
||||
ULONG ulOffsetToGlobalsStrings,ulSizeOfGlobalsStrings;
|
||||
ULONG ulOffsetToStabs,ulSizeOfStabs;
|
||||
ULONG ulOffsetToStabsStrings,ulSizeOfStabsStrings;
|
||||
ULONG ulOffsetToSrcFiles,ulNumberOfSrcFiles;
|
||||
}PICE_SYMBOLFILE_HEADER;
|
||||
|
||||
typedef struct _STAB_ENTRY
|
||||
{
|
||||
unsigned long n_strx;
|
||||
unsigned char n_type;
|
||||
unsigned char n_other;
|
||||
unsigned short n_desc;
|
||||
unsigned long n_value;
|
||||
}STAB_ENTRY,*PSTAB_ENTRY;
|
||||
|
||||
typedef struct _PICE_SYMBOLFILE_SOURCE
|
||||
{
|
||||
char filename[256];
|
||||
ULONG ulOffsetToNext;
|
||||
}PICE_SYMBOLFILE_SOURCE;
|
||||
#endif // LINUX
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// serial stuff
|
||||
typedef struct _SERIAL_PACKET_HEADER
|
||||
{
|
||||
ULONG packet_size;
|
||||
ULONG packet_header_chksum;
|
||||
ULONG packet_chksum;
|
||||
}SERIAL_PACKET_HEADER,*PSERIAL_PACKET_HEADER;
|
||||
|
||||
typedef struct _SERIAL_PACKET
|
||||
{
|
||||
SERIAL_PACKET_HEADER header;
|
||||
UCHAR data[1];
|
||||
}SERIAL_PACKET,*PSERIAL_PACKET;
|
||||
|
||||
#define ACK (0)
|
||||
|
||||
typedef enum _ECOLORS
|
||||
{
|
||||
BLACK = 0,
|
||||
BLUE,
|
||||
GREEN,
|
||||
TURK,
|
||||
RED,
|
||||
VIOLET,
|
||||
BROWN,
|
||||
LTGRAY,
|
||||
GRAY,
|
||||
LTBLUE,
|
||||
LT_GREEN,
|
||||
LTTURK,
|
||||
LTRED,
|
||||
LTVIOLET,
|
||||
YELLOW,
|
||||
WHITE
|
||||
}ECOLORS;
|
||||
|
||||
typedef struct _SERIAL_DATA_PACKET
|
||||
{
|
||||
UCHAR type;
|
||||
UCHAR data[1];
|
||||
}SERIAL_DATA_PACKET,*PSERIAL_DATA_PACKET;
|
||||
|
||||
#define PACKET_TYPE_CLRLINE (0)
|
||||
typedef struct _SERIAL_DATA_PACKET_CLRLINE
|
||||
{
|
||||
UCHAR type;
|
||||
ECOLORS fgcol,bkcol;
|
||||
UCHAR line;
|
||||
}SERIAL_DATA_PACKET_CLRLINE,*PSERIAL_DATA_PACKET_CLRLINE;
|
||||
|
||||
#define PACKET_TYPE_PRINT (1)
|
||||
typedef struct _SERIAL_DATA_PACKET_PRINT
|
||||
{
|
||||
UCHAR type;
|
||||
UCHAR x;
|
||||
UCHAR y;
|
||||
ECOLORS fgcol,bkcol;
|
||||
UCHAR string[1];
|
||||
}SERIAL_DATA_PACKET_PRINT,*PSERIAL_DATA_PACKET_PRINT;
|
||||
|
||||
#define PACKET_TYPE_CONNECT (2)
|
||||
typedef struct _SERIAL_DATA_PACKET_CONNECT
|
||||
{
|
||||
UCHAR type;
|
||||
UCHAR xsize,ysize;
|
||||
}SERIAL_DATA_PACKET_CONNECT,*PSERIAL_DATA_PACKET_CONNECT;
|
||||
|
||||
#define PACKET_TYPE_CURSOR (3)
|
||||
typedef struct _SERIAL_DATA_PACKET_CURSOR
|
||||
{
|
||||
UCHAR type;
|
||||
UCHAR state,x,y;
|
||||
}SERIAL_DATA_PACKET_CURSOR,*PSERIAL_DATA_PACKET_CURSOR;
|
||||
|
||||
#define PACKET_TYPE_INVERTLINE (4)
|
||||
typedef struct _SERIAL_DATA_PACKET_INVERTLINE
|
||||
{
|
||||
UCHAR type;
|
||||
UCHAR line;
|
||||
}SERIAL_DATA_PACKET_INVERTLINE,*PSERIAL_DATA_PACKET_INVERTLINE;
|
||||
|
||||
#define PACKET_TYPE_POLL (5)
|
||||
typedef struct _SERIAL_DATA_PACKET_POLL
|
||||
{
|
||||
UCHAR type;
|
||||
USHORT major_version,minor_version,build_number;
|
||||
}SERIAL_DATA_PACKET_POLL,*PSERIAL_DATA_PACKET_POLL;
|
||||
|
||||
// END of serial stuff
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// EOF
|
Loading…
Reference in a new issue