retire PUBLIC, PRIVATE and FORWARD

This commit is contained in:
Ben Gras
2012-03-25 20:25:53 +02:00
parent 6a73e85ad1
commit 7336a67dfe
603 changed files with 5776 additions and 5779 deletions

View File

@@ -27,7 +27,7 @@ extern struct proc *prc;
#define BSIZE 512
#define LOGBS 9
PRIVATE struct file {
static struct file {
int fid;
char *name;
long cblock;
@@ -47,26 +47,26 @@ PRIVATE struct file {
#define e3 smap[1]
#define f3 smap[2]
PRIVATE long cnt[3]; /* Sizes of segments */
PRIVATE int h_size; /* Size of core header */
PRIVATE char def_name[] = "core"; /* Default core name */
static long cnt[3]; /* Sizes of segments */
static int h_size; /* Size of core header */
static char def_name[] = "core"; /* Default core name */
#define SIZE_MP_SEG (sizeof(struct mem_map) * NR_LOCAL_SEGS)
#define SIZE_KINFO sizeof(struct proc)
#define SIZE_HEADER SIZE_MP_SEG
FORWARD int kernel_info(int fd );
FORWARD void setmap(struct file *fp );
FORWARD void read_info(struct file *fp );
FORWARD void ill_addr(long d , int segment );
FORWARD long map_addr(long d , int segment );
FORWARD unsigned long c_status(void);
FORWARD long getn(long d, int s);
static int kernel_info(int fd );
static void setmap(struct file *fp );
static void read_info(struct file *fp );
static void ill_addr(long d , int segment );
static long map_addr(long d , int segment );
static unsigned long c_status(void);
static long getn(long d, int s);
/*
* set and display mapping for core file
*/
PRIVATE void setmap(fp)
static void setmap(fp)
struct file *fp;
{
long h = (long) h_size;
@@ -107,7 +107,7 @@ long h = (long) h_size;
}
/* Print mapping */
PUBLIC void prtmap()
void prtmap()
{
Printf("%s I & D space\t", (is_separate) ? "Separate " : "Combined ");
if (corepid > 0) {
@@ -123,7 +123,7 @@ PUBLIC void prtmap()
}
/* Illegal address */
PRIVATE void ill_addr(d, segment)
static void ill_addr(d, segment)
long d;
int segment;
{
@@ -134,7 +134,7 @@ int segment;
/* Map virtual address -> core file addresses
* depends on current segment if Separate I & D
*/
PRIVATE long map_addr(d, segment)
static long map_addr(d, segment)
long d;
int segment;
{
@@ -175,7 +175,7 @@ int segment;
/* Get value with address d and segment s */
PRIVATE long getn(d, s)
static long getn(d, s)
long d;
int s;
{
@@ -209,7 +209,7 @@ int s;
}
/* Read kernel info from core file into lbuf[] */
PRIVATE int kernel_info(fd)
static int kernel_info(fd)
int fd;
{
int r;
@@ -225,7 +225,7 @@ int fd;
/*
* Print status info from core - returns PC
*/
PRIVATE unsigned long c_status()
static unsigned long c_status()
{
fprintf(stderr, "WARNING: don't know pid from core; using proc nr for pid.\n");
@@ -241,7 +241,7 @@ PRIVATE unsigned long c_status()
}
/* Read memory maps and kernel info from core file */
PRIVATE void read_info(fp)
static void read_info(fp)
struct file *fp;
{
struct mem_map seg[NR_LOCAL_SEGS];
@@ -292,7 +292,7 @@ struct file *fp;
/* initialization for core files
* returns PC address from core file
*/
PUBLIC unsigned long core_init(filename)
unsigned long core_init(filename)
char *filename;
{
core_file = &Core_File;
@@ -321,7 +321,7 @@ char *filename;
* always returns 0
* Similar to core files.
*/
PUBLIC unsigned long file_init(filename)
unsigned long file_init(filename)
char *filename;
{
core_file = &Core_File;
@@ -349,7 +349,7 @@ char *filename;
* Read from core file
* Called by mdbtrace()
*/
PUBLIC long read_core(req, addr, data)
long read_core(req, addr, data)
int req;
long addr, data;
{

View File

@@ -14,13 +14,13 @@
#include <minix/callnr.h>
#include "proto.h"
FORWARD void get_message(message *m, unsigned bx);
FORWARD void get_data(char *s, unsigned bx, int cnt);
static void get_message(message *m, unsigned bx);
static void get_data(char *s, unsigned bx, int cnt);
PRIVATE message sent;
PRIVATE message recv;
PRIVATE unsigned saved_addr;
PRIVATE int last_call;
static message sent;
static message recv;
static unsigned saved_addr;
static int last_call;
#define NOSYS 0
#define NOP 1
@@ -164,7 +164,7 @@ struct decode_system {
REBOOT, M1_I1, NOP, "REBOOT"
};
PRIVATE void get_message(m,bx)
static void get_message(m,bx)
message *m;
unsigned bx;
{
@@ -181,7 +181,7 @@ unsigned bx;
}
PRIVATE void get_data(s, bx, cnt)
static void get_data(s, bx, cnt)
char *s;
unsigned bx;
int cnt;
@@ -199,7 +199,7 @@ int cnt;
}
PUBLIC void decode_result()
void decode_result()
{
/* Update message */

View File

@@ -48,18 +48,18 @@ struct symtab_s
unsigned int nsym;
};
PRIVATE struct symtab_s symtab;
static struct symtab_s symtab;
FORWARD void gnu_sort(struct newnlist *array , struct newnlist *top );
FORWARD int gnu_symeq(char *t , struct newnlist *sp );
FORWARD int gnu_symprefix(char *t , struct newnlist *sp );
FORWARD struct newnlist *gnu_sname(char *name, int is_text, int
static void gnu_sort(struct newnlist *array , struct newnlist *top );
static int gnu_symeq(char *t , struct newnlist *sp );
static int gnu_symprefix(char *t , struct newnlist *sp );
static struct newnlist *gnu_sname(char *name, int is_text, int
allflag);
FORWARD struct newnlist *gnu_sval(off_t value, int where);
FORWARD void gnu_sym(struct newnlist *sp, off_t off);
static struct newnlist *gnu_sval(off_t value, int where);
static void gnu_sym(struct newnlist *sp, off_t off);
PUBLIC void gnu_init( filename )
void gnu_init( filename )
char *filename;
{
struct exec header;
@@ -131,7 +131,7 @@ char *filename;
}
PUBLIC long gnu_symbolvalue( name, is_text )
long gnu_symbolvalue( name, is_text )
char *name;
int is_text;
{
@@ -144,7 +144,7 @@ int is_text;
}
PRIVATE struct newnlist *gnu_sname( name, is_text, allflag )
static struct newnlist *gnu_sname( name, is_text, allflag )
char *name;
int is_text;
int allflag;
@@ -204,7 +204,7 @@ int allflag;
return NULL;
}
PRIVATE struct newnlist *gnu_sval( value, where )
static struct newnlist *gnu_sval( value, where )
off_t value;
int where;
{
@@ -242,7 +242,7 @@ int where;
}
PRIVATE void gnu_sym( sp, off )
static void gnu_sym( sp, off )
struct newnlist *sp;
off_t off;
{
@@ -260,7 +260,7 @@ off_t off;
/* shell sort symbols on value */
PRIVATE void gnu_sort( array, top )
static void gnu_sort( array, top )
struct newnlist *array;
struct newnlist *top;
{
@@ -294,7 +294,7 @@ struct newnlist *top;
while ( (gap /= 3) != 0 );
}
PUBLIC void gnu_symbolic( value, separator )
void gnu_symbolic( value, separator )
off_t value;
int separator;
{
@@ -330,14 +330,14 @@ int separator;
}
PRIVATE int gnu_symeq( t, sp )
static int gnu_symeq( t, sp )
register char *t;
struct newnlist *sp;
{
return strncmp( t, sp->n_un.n_name, strlen(t) ) == 0;
}
PRIVATE int gnu_symprefix( t, sp )
static int gnu_symprefix( t, sp )
register char *t;
struct newnlist *sp;
{
@@ -356,7 +356,7 @@ struct newnlist *sp;
/* list all symbols - test for selection criteria */
PUBLIC void gnu_listsym( tchar )
void gnu_listsym( tchar )
char tchar;
{
register struct symtab_s *tp;
@@ -396,7 +396,7 @@ char tchar;
}
}
PUBLIC int gnu_text_symbol(value)
int gnu_text_symbol(value)
off_t value;
{
struct newnlist *sp;
@@ -410,7 +410,7 @@ off_t value;
return FALSE;
}
PUBLIC int gnu_finds_data(off,data_seg)
int gnu_finds_data(off,data_seg)
off_t off;
int data_seg;
{
@@ -425,7 +425,7 @@ int data_seg;
return FALSE;
}
PUBLIC int gnu_finds_pc(pc)
int gnu_finds_pc(pc)
off_t pc;
{
struct newnlist *sp;

View File

@@ -13,21 +13,21 @@
#define OUTBUFSIZE 512
#define PAGESIZE 24
PRIVATE int forceupper = FALSE;
PRIVATE int someupper = FALSE;
PRIVATE int stringcount = 0;
PRIVATE char *string_ptr = NULL; /* stringptr ambiguous at 8th char */
PRIVATE char *stringstart = NULL;
static int forceupper = FALSE;
static int someupper = FALSE;
static int stringcount = 0;
static char *string_ptr = NULL; /* stringptr ambiguous at 8th char */
static char *stringstart = NULL;
PRIVATE char outbuf[OUTBUFSIZE];
PRIVATE FILE *cmdfile = stdin;
PRIVATE FILE *outfile = stdout;
PRIVATE FILE *logfile;
PRIVATE int lineno;
static char outbuf[OUTBUFSIZE];
static FILE *cmdfile = stdin;
static FILE *outfile = stdout;
static FILE *logfile;
static int lineno;
int _doprnt(const char *format, va_list ap, FILE *stream );
PUBLIC char *get_cmd(cbuf, csize)
char *get_cmd(cbuf, csize)
char *cbuf;
int csize;
{
@@ -50,7 +50,7 @@ char *r;
return r;
}
PUBLIC void openin(s)
void openin(s)
char *s;
{
char *t;
@@ -70,7 +70,7 @@ char *t;
* from MINIX library
* followed by outstr()
*/
PUBLIC int Printf(const char *format, ...)
int Printf(const char *format, ...)
{
va_list ap;
int retval;
@@ -102,7 +102,7 @@ PUBLIC int Printf(const char *format, ...)
/*
* Set logging options
*/
PUBLIC void logging( c, name )
void logging( c, name )
int c;
char *name;
{
@@ -142,7 +142,7 @@ char *t;
}
/* Output system error string */
PUBLIC void do_error(m)
void do_error(m)
char *m;
{
outstr(m);
@@ -151,7 +151,7 @@ char *m;
outstr("\n");
}
PUBLIC void closestring()
void closestring()
{
/* close string device */
@@ -159,7 +159,7 @@ PUBLIC void closestring()
stringstart = string_ptr = NULL;
}
PUBLIC int mytolower(ch)
int mytolower(ch)
int ch;
{
/* convert char to lower case */
@@ -170,7 +170,7 @@ int ch;
}
PUBLIC void openstring(string)
void openstring(string)
char *string;
{
/* open string device */
@@ -179,7 +179,7 @@ char *string;
stringstart = string_ptr = string;
}
PUBLIC void outbyte(byte)
void outbyte(byte)
int byte;
{
/* print char to currently open output devices */
@@ -215,15 +215,15 @@ int byte;
}
PUBLIC void outcomma()
void outcomma()
{
/* print comma */
outbyte(',');
}
PRIVATE char hexdigits[] = "0123456789ABCDEF";
PUBLIC void outh4(num)
static char hexdigits[] = "0123456789ABCDEF";
void outh4(num)
unsigned num;
{
/* print 4 bits hex */
@@ -231,7 +231,7 @@ unsigned num;
outbyte(hexdigits[num % 16]);
}
PUBLIC void outh8(num)
void outh8(num)
unsigned num;
{
/* print 8 bits hex */
@@ -240,7 +240,7 @@ unsigned num;
outh4(num);
}
PUBLIC void outh16(num)
void outh16(num)
unsigned num;
{
/* print 16 bits hex */
@@ -249,7 +249,7 @@ unsigned num;
outh8(num);
}
PUBLIC void outh32(num)
void outh32(num)
unsigned num;
{
/* print 32 bits hex */
@@ -258,14 +258,14 @@ unsigned num;
outh16((u16_t) num);
}
PUBLIC void outspace()
void outspace()
{
/* print space */
outbyte(' ');
}
PUBLIC void outstr(s)
void outstr(s)
register char *s;
{
/* print string */
@@ -274,14 +274,14 @@ register char *s;
outbyte(*s++);
}
PUBLIC void outtab()
void outtab()
{
/* print tab */
outbyte('\t');
}
PUBLIC void outustr(s)
void outustr(s)
register char *s;
{
/* print string, perhaps converting case to upper */
@@ -293,14 +293,14 @@ register char *s;
}
PUBLIC int stringpos()
int stringpos()
{
/* return current offset of string device */
return string_ptr - stringstart;
}
PUBLIC int stringtab()
int stringtab()
{
/* return current "tab" spot of string device */

View File

@@ -15,7 +15,7 @@
#include <sgtty.h>
#include "proto.h"
PRIVATE int get_request;
static int get_request;
/*
* decode ioctl call

View File

@@ -24,12 +24,12 @@
struct proc *prc;
long lbuf[SIZ];
PRIVATE char segment_name[] = "TDS";
static char segment_name[] = "TDS";
/*
* Display memory maps
*/
PUBLIC void disp_maps()
void disp_maps()
{
int i;
long int vir, phy, len;
@@ -45,7 +45,7 @@ PUBLIC void disp_maps()
}
}
PUBLIC void update()
void update()
{
int i;
@@ -68,7 +68,7 @@ PUBLIC void update()
}
PUBLIC int disp_regs()
int disp_regs()
{
int i;
@@ -118,13 +118,13 @@ PUBLIC int disp_regs()
#ifdef MINIX_PC
#ifdef __i386
PRIVATE char regs[] = "fs gs ds es di si bp bx dx cx ax ip cs ps sp ss";
static char regs[] = "fs gs ds es di si bp bx dx cx ax ip cs ps sp ss";
#else
PRIVATE char regs[] = "es ds di si bp bx dx cx ax ip cs ps sp ss";
static char regs[] = "es ds di si bp bx dx cx ax ip cs ps sp ss";
#endif
/* Get register for pid at offset k */
PUBLIC long get_reg(pid, k)
long get_reg(pid, k)
int pid;
long k;
{
@@ -149,7 +149,7 @@ long k;
/* Set register for pid at offset k */
PUBLIC void set_reg(pid, k, value)
void set_reg(pid, k, value)
int pid;
long k;
long value;
@@ -164,7 +164,7 @@ long value;
}
PUBLIC long reg_addr(s)
long reg_addr(s)
char *s;
{
long val;
@@ -198,7 +198,7 @@ char *s;
}
PUBLIC int outsegreg(num)
int outsegreg(num)
off_t num;
{
/* print segment register */
@@ -217,14 +217,14 @@ off_t num;
#ifdef MINIX_ST
/* Get register for pid at offset k */
PUBLIC long get_reg(pid, k)
long get_reg(pid, k)
int pid;
long k;
{
return ptrace(T_GETUSER, pid, k, 0L);
}
PUBLIC long reg_addr(s)
long reg_addr(s)
char *s;
{
long val;

View File

@@ -56,14 +56,14 @@ extern struct proc *prc;
#define MAXLINE 128
#define MAXARG 20
PRIVATE unsigned long lastexp = 0L; /* last expression and segment */
PRIVATE int lastseg = NOSEG;
PRIVATE char *prog; /* prog name */
PRIVATE char sbuf[MAXLINE];
PRIVATE char cbuf[MAXLINE];
PRIVATE char *cmd; /* current command */
PRIVATE char *cmdstart; /* start of command */
PRIVATE jmp_buf mainlp;
static unsigned long lastexp = 0L; /* last expression and segment */
static int lastseg = NOSEG;
static char *prog; /* prog name */
static char sbuf[MAXLINE];
static char cbuf[MAXLINE];
static char *cmd; /* current command */
static char *cmdstart; /* start of command */
static jmp_buf mainlp;
struct b_pnt {
@@ -75,30 +75,30 @@ struct b_pnt {
int main(int argc, char *argv[]);
FORWARD void cleanup(void);
FORWARD void freepnt(struct b_pnt *pnt );
FORWARD void findbpnt(int verbose );
FORWARD int exebpnt(int restart );
FORWARD void catch(int sig );
FORWARD int run(char *name , char *argstr , int tflg );
FORWARD int dowait(void);
FORWARD void backtrace(int all );
FORWARD void modify(long addr , int cnt , int verbose , int size );
FORWARD void display(long addr , int req );
FORWARD void fill(long addr , int req );
FORWARD void dorun(char *cmd );
FORWARD void not_for_core(void);
FORWARD void command(void);
static void cleanup(void);
static void freepnt(struct b_pnt *pnt );
static void findbpnt(int verbose );
static int exebpnt(int restart );
static void catch(int sig );
static int run(char *name , char *argstr , int tflg );
static int dowait(void);
static void backtrace(int all );
static void modify(long addr , int cnt , int verbose , int size );
static void display(long addr , int req );
static void fill(long addr , int req );
static void dorun(char *cmd );
static void not_for_core(void);
static void command(void);
PRIVATE void cleanup()
static void cleanup()
{
curpid = 0;
curpnt = NULL;
while (b_head) freepnt(b_head);
}
PRIVATE void findbpnt(verbose)
static void findbpnt(verbose)
int verbose;
{
for (curpnt = b_head; curpnt; curpnt = curpnt->nxt) {
@@ -121,7 +121,7 @@ int verbose;
if (verbose) Printf("Unknown breakpoint hit.\n");
}
PRIVATE int exebpnt(restart)
static int exebpnt(restart)
int restart;
{
ptrace(T_STEP, curpid, 0L, (long) restart);
@@ -132,7 +132,7 @@ int restart;
}
PRIVATE void freepnt(pnt)
static void freepnt(pnt)
struct b_pnt *pnt;
{
if (pnt->prv)
@@ -146,7 +146,7 @@ struct b_pnt *pnt;
}
PUBLIC long breakpt(addr, cmd)
long breakpt(addr, cmd)
long addr;
char *cmd;
{
@@ -182,7 +182,7 @@ char *cmd;
return new->oldval;
}
PRIVATE void catch(sig)
static void catch(sig)
int sig;
{
signal(sig, catch);
@@ -192,7 +192,7 @@ int sig;
}
PRIVATE int dowait()
static int dowait()
{
int stat;
@@ -215,7 +215,7 @@ PRIVATE int dowait()
PUBLIC void tstart(req, verbose, val, cnt)
void tstart(req, verbose, val, cnt)
int req, verbose, val, cnt;
{
if (curpid == 0) {
@@ -255,7 +255,7 @@ int req, verbose, val, cnt;
if ( verbose ) dasm((long) PC_MEMBER(prc), 1, 1);
}
PRIVATE int run(name, argstr, tflg)
static int run(name, argstr, tflg)
char *name, *argstr;
int tflg;
{
@@ -301,7 +301,7 @@ int tflg;
}
PRIVATE void dorun(cmd)
static void dorun(cmd)
char *cmd;
{
if (curpid = run(prog, cmd, 1)) {
@@ -316,7 +316,7 @@ char *cmd;
/*
* backtrace - inspect the stack
*/
PRIVATE void backtrace(all)
static void backtrace(all)
int all;
{
unsigned long pc, bp, off, val, obp;
@@ -397,7 +397,7 @@ skiplp:
while (all && (reg_t) bp);
}
PRIVATE void modify(addr, cnt, verbose, size)
static void modify(addr, cnt, verbose, size)
long addr;
int cnt, verbose, size;
{
@@ -438,7 +438,7 @@ int cnt, verbose, size;
return;
}
PRIVATE void display(addr, req)
static void display(addr, req)
long addr;
int req;
{
@@ -533,7 +533,7 @@ exitlp:
Printf("\n");
}
PRIVATE void fill(addr, req)
static void fill(addr, req)
long addr;
int req;
{
@@ -579,13 +579,13 @@ int req;
while (--count > 0);
}
PRIVATE void not_for_core()
static void not_for_core()
{
if (corepid > 0)
mdb_error("Illegal command for 'core' file\n");
}
PRIVATE void command()
static void command()
{
char c, *p;
int i;
@@ -856,14 +856,14 @@ PRIVATE void command()
if (*cmd == ';') cmd = skip(cmd + 1);
}
PUBLIC void mdb_error(s)
void mdb_error(s)
char *s;
{
Printf("%s",s);
longjmp(mainlp, 0);
}
PUBLIC int main(argc, argv)
int main(argc, argv)
int argc;
char *argv[];
{

View File

@@ -15,18 +15,18 @@ struct address_s
off_t base;
};
PRIVATE int bits32;
PRIVATE struct address_s uptr;
static int bits32;
static struct address_s uptr;
FORWARD u8_t get8(void);
FORWARD u16_t get16(void);
FORWARD u32_t get32(void);
FORWARD u8_t peek_byte(off_t addr);
FORWARD u16_t peek_word(off_t addr);
FORWARD int puti(void);
FORWARD int outsegaddr(struct address_s *addr);
FORWARD int outssegaddr(struct address_s *addr);
FORWARD int show1instruction(void);
static u8_t get8(void);
static u16_t get16(void);
static u32_t get32(void);
static u8_t peek_byte(off_t addr);
static u16_t peek_word(off_t addr);
static int puti(void);
static int outsegaddr(struct address_s *addr);
static int outssegaddr(struct address_s *addr);
static int show1instruction(void);
/************************* UNASM ******************************/
@@ -62,73 +62,73 @@ typedef int reg_pt;
typedef int su16_t;
typedef int su8_pt;
FORWARD su8_pt get8s(void);
FORWARD void getmodregrm(void);
FORWARD void i_00_to_3f(opcode_pt opc );
FORWARD void i_40_to_5f(opcode_pt opc );
FORWARD void i_60_to_6f(opcode_pt opc );
FORWARD void i_70_to_7f(opcode_pt opc );
FORWARD void i_80(opcode_pt opc );
FORWARD void i_88(opcode_pt opc );
FORWARD void i_90(opcode_pt opc );
FORWARD void i_98(opcode_pt opc );
FORWARD void i_a0(opcode_pt opc );
FORWARD void i_a8(opcode_pt opc );
FORWARD void i_b0(opcode_pt opc );
FORWARD void i_b8(opcode_pt opc );
FORWARD void i_c0(opcode_pt opc );
FORWARD void i_c8(opcode_pt opc );
FORWARD void i_d0(opcode_pt opc );
FORWARD void i_d8(opcode_pt opc );
FORWARD void i_e0(opcode_pt opc );
FORWARD void i_e8(opcode_pt opc );
FORWARD void i_f0(opcode_pt opc );
FORWARD void i_f8(opcode_pt opc );
FORWARD void outad(opcode_pt opc );
FORWARD void outad1(opcode_pt opc );
FORWARD void outalorx(opcode_pt opc );
FORWARD void outax(void);
FORWARD void outbptr(void);
FORWARD void outbwptr(opcode_pt opc );
FORWARD void outea(opcode_pt wordflags );
FORWARD void outf1(void);
FORWARD void out32offset(void);
FORWARD void outfishy(void);
FORWARD void outgetaddr(void);
FORWARD void outimmed(opcode_pt signwordflag );
FORWARD void outpc(off_t pc );
FORWARD void outsegpc(void);
FORWARD void oututstr(char *s );
FORWARD void outword(void);
FORWARD void outwptr(void);
FORWARD void outwsize(void);
FORWARD void pagef(void);
FORWARD void shift(opcode_pt opc );
FORWARD void checkmemory(void);
FORWARD void CL(void);
FORWARD void Eb(void);
FORWARD void Ev(void);
FORWARD void EvGv(void);
FORWARD void EvIb(void);
FORWARD void Ew(void);
FORWARD void EwRw(void);
FORWARD void Gv(void);
FORWARD void Gv1(void);
FORWARD void GvEv(void);
FORWARD void GvEw(void);
FORWARD void GvM(void);
FORWARD void GvMa(void);
FORWARD void GvMp(void);
FORWARD void Ib(void);
FORWARD void Iw(void);
FORWARD void Iv(void);
FORWARD void Jb(void);
FORWARD void Jv(void);
FORWARD void Ms(void);
static su8_pt get8s(void);
static void getmodregrm(void);
static void i_00_to_3f(opcode_pt opc );
static void i_40_to_5f(opcode_pt opc );
static void i_60_to_6f(opcode_pt opc );
static void i_70_to_7f(opcode_pt opc );
static void i_80(opcode_pt opc );
static void i_88(opcode_pt opc );
static void i_90(opcode_pt opc );
static void i_98(opcode_pt opc );
static void i_a0(opcode_pt opc );
static void i_a8(opcode_pt opc );
static void i_b0(opcode_pt opc );
static void i_b8(opcode_pt opc );
static void i_c0(opcode_pt opc );
static void i_c8(opcode_pt opc );
static void i_d0(opcode_pt opc );
static void i_d8(opcode_pt opc );
static void i_e0(opcode_pt opc );
static void i_e8(opcode_pt opc );
static void i_f0(opcode_pt opc );
static void i_f8(opcode_pt opc );
static void outad(opcode_pt opc );
static void outad1(opcode_pt opc );
static void outalorx(opcode_pt opc );
static void outax(void);
static void outbptr(void);
static void outbwptr(opcode_pt opc );
static void outea(opcode_pt wordflags );
static void outf1(void);
static void out32offset(void);
static void outfishy(void);
static void outgetaddr(void);
static void outimmed(opcode_pt signwordflag );
static void outpc(off_t pc );
static void outsegpc(void);
static void oututstr(char *s );
static void outword(void);
static void outwptr(void);
static void outwsize(void);
static void pagef(void);
static void shift(opcode_pt opc );
static void checkmemory(void);
static void CL(void);
static void Eb(void);
static void Ev(void);
static void EvGv(void);
static void EvIb(void);
static void Ew(void);
static void EwRw(void);
static void Gv(void);
static void Gv1(void);
static void GvEv(void);
static void GvEw(void);
static void GvM(void);
static void GvMa(void);
static void GvMp(void);
static void Ib(void);
static void Iw(void);
static void Iv(void);
static void Jb(void);
static void Jv(void);
static void Ms(void);
typedef void(*pfv_t) (opcode_pt opc );
PRIVATE pfv_t optable[] =
static pfv_t optable[] =
{
i_00_to_3f,
i_00_to_3f,
@@ -164,33 +164,33 @@ PRIVATE pfv_t optable[] =
i_f8,
};
PRIVATE char fishy[] = "???";
PRIVATE char movtab[] = "mov\t";
static char fishy[] = "???";
static char movtab[] = "mov\t";
PRIVATE char *genreg[] =
static char *genreg[] =
{
"al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
"ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
};
PRIVATE char *segreg[] =
static char *segreg[] =
{
"es", "cs", "ss", "ds", "fs", "gs", "?s", "?s",
};
PRIVATE char *indreg[] =
static char *indreg[] =
{
"bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx",
};
PRIVATE char *str_00_to_3f[] =
static char *str_00_to_3f[] =
{
/* index by (opcode >> 3) & 7 */
"add", "or", "adc", "sbb", "and", "sub", "xor", "cmp",
};
PRIVATE char *sstr_00_to_3f[] =
static char *sstr_00_to_3f[] =
{
/* index ((opc>>2) & 0x0E) + (opc & 7) - 6 */
"push\tes", "pop\tes", "push\tcs", "pop\tcs",
@@ -198,7 +198,7 @@ PRIVATE char *sstr_00_to_3f[] =
"es:", "daa", "cs:", "das", "ss:", "aaa", "ds:", "aas",
};
PRIVATE char *sstr_0f[] =
static char *sstr_0f[] =
{
"push\tfs", "pop\tfs", fishy, "bt\t", "shld\t", "shld\t", fishy, fishy,
"push\tgs", "pop\tgs", fishy, "bts\t", "shrd\t", "shrd\t", fishy, "imul\t",
@@ -206,69 +206,69 @@ PRIVATE char *sstr_0f[] =
fishy, fishy, "", "btc\t", "bsf\t", "bsr\t", "movsx\t", "movsx\t",
};
PRIVATE char *ssstr_0f[] =
static char *ssstr_0f[] =
{
"sldt\t", "str\t", "lldt\t", "ltr\t", "verr\t", "verw\t", fishy, fishy,
"sgdt\t", "sidt\t", "lgdt\t", "lidt\t", "smsw\t", fishy, "lmsw\t", fishy,
fishy, fishy, fishy, fishy, "bt\t", "bts\t", "btr\t", "btc\t",
};
PRIVATE char *str_40_to_5f[] =
static char *str_40_to_5f[] =
{
/* index by (opcode >> 3) & 3 */
"inc\t", "dec\t", "push\t", "pop\t",
};
PRIVATE char *str_60_to_6f[] =
static char *str_60_to_6f[] =
{
"pusha", "popa", "bound\t", "arpl\t", "fs:", "gs:", "os:", "as:",
"push\t", "imul\t", "push\t", "imul\t", "insb", "ins", "outsb", "outs",
};
PRIVATE char *str_flags[] =
static char *str_flags[] =
{
/* opcodes 0x70 to 0x7F, and 0x0F80 to 0x0F9F */
"o", "no", "b", "nb", "z", "nz", "be", "a",
"s", "ns", "pe", "po", "l", "ge", "le", "g",
};
PRIVATE char *str_98[] =
static char *str_98[] =
{
"cbw", "cwd", "call\t", "wait", "pushf", "popf", "sahf", "lahf",
"cwde", "cdq", "call\t", "wait", "pushfd", "popfd", "sahf", "lahf",
};
PRIVATE char *str_a0[] =
static char *str_a0[] =
{
movtab, movtab, movtab, movtab, "movsb", "movs", "cmpsb", "cmps",
};
PRIVATE char *str_a8[] =
static char *str_a8[] =
{
"test\t", "test\t", "stosb", "stos", "lodsb", "lods", "scasb", "scas",
};
PRIVATE char *str_c0[] =
static char *str_c0[] =
{
"", "", "ret\t", "ret", "les\t", "lds\t", movtab, movtab,
};
PRIVATE char *str_c8[] =
static char *str_c8[] =
{
"enter\t", "leave", "retf\t", "retf", "int\t3", "int\t", "into", "iret",
};
PRIVATE char *str_d0[] =
static char *str_d0[] =
{
"aam", "aad", "db\td6", "xlat",
};
PRIVATE char *sstr_d0[] =
static char *sstr_d0[] =
{
"rol", "ror", "rcl", "rcr", "shl", "shr", fishy, "sar",
};
PRIVATE char *str_d8[] =
static char *str_d8[] =
{
"fadd", "fmul", "fcom", "fcomp", "fsub", "fsubr", "fdiv", "fdivr",
"fld", NULL, "fst", "fstp", "fldenv", "fldcw", "fstenv", "fstcw",
@@ -280,7 +280,7 @@ PRIVATE char *str_d8[] =
"fild", NULL, "fist", "fistp", "fbld", "fild", "fbstp", "fistp",
};
PRIVATE char *str1_d8[] =
static char *str1_d8[] =
{
"fadd", "fmul", "fcom", "fcomp", "fsub", "fsubr", "fdiv", "fdivr",
"fld", "fxch", "\0\0", NULL, "\0\10", "\0\20", "\0\30", "\0\40",
@@ -292,7 +292,7 @@ PRIVATE char *str1_d8[] =
NULL, NULL, NULL, NULL, "\0\100", NULL, NULL, NULL,
};
PRIVATE unsigned char size_d8[] =
static unsigned char size_d8[] =
{
4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 4, 14-28, 2, 14-28, 2,
4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 4, 0, 10, 0, 10,
@@ -300,7 +300,7 @@ PRIVATE unsigned char size_d8[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 10, 8, 10, 8,
};
PRIVATE char *sstr_d8[] =
static char *sstr_d8[] =
{
"fnop", NULL, NULL, NULL, /* D9D0 */
NULL, NULL, NULL, NULL,
@@ -322,57 +322,57 @@ PRIVATE char *sstr_d8[] =
"fstsw\tax", NULL, NULL, NULL,
};
PRIVATE char *str_e0[] =
static char *str_e0[] =
{
"loopnz\t", "loopz\t", "loop\t", "jcxz\t",
"in\t", "in\t", "out\t", "out\t",
};
PRIVATE char *str_e8[] =
static char *str_e8[] =
{
"call\t", "jmp\t", "jmp\t", "jmp\t",
"in\t", "in\t", "out\t", "out\t",
};
PRIVATE char *str_f0[] =
static char *str_f0[] =
{
"lock\t", "db\tf1", "repnz\t", "repz\t",
"hlt", "cmc",
/* other 2 from sstr_f0 */
};
PRIVATE char *sstr_f0[] =
static char *sstr_f0[] =
{
"test\t", fishy, "not\t", "neg\t",
"mul\t", "imul\t", "div\t", "idiv\t",
};
PRIVATE char *str_f8[] =
static char *str_f8[] =
{
"clc", "stc", "cli", "sti",
"cld", "std",
/* other 2 from sstr_f8 */
};
PRIVATE char *sstr_f8[] =
static char *sstr_f8[] =
{
"inc\t", "dec\t", "call\t", "call\tfar ",
"jmp\t", "jmp\tfar ", "push\t", "???\t",
};
PRIVATE int data_seg; /* data segment (munged name for asld) */
PRIVATE unsigned hasize; /* half address size in bits */
PRIVATE unsigned hdefsize;
PRIVATE unsigned hosize; /* half operand size in bits */
static int data_seg; /* data segment (munged name for asld) */
static unsigned hasize; /* half address size in bits */
static unsigned hdefsize;
static unsigned hosize; /* half operand size in bits */
/* for easy index into reg tables */
PRIVATE opcode_pt mod;
PRIVATE off_t offtable[2];
PRIVATE off_t *offptr;
PRIVATE off_t *off1ptr;
PRIVATE opcode_pt reg;
PRIVATE opcode_pt rm;
static opcode_pt mod;
static off_t offtable[2];
static off_t *offptr;
static off_t *off1ptr;
static opcode_pt reg;
static opcode_pt rm;
PRIVATE su8_pt get8s()
static su8_pt get8s()
{
su8_pt got;
@@ -381,7 +381,7 @@ PRIVATE su8_pt get8s()
return got;
}
PRIVATE void getmodregrm()
static void getmodregrm()
{
opcode_pt modregrm;
@@ -391,7 +391,7 @@ PRIVATE void getmodregrm()
rm = (modregrm & RM_MASK) >> RM_SHIFT;
}
PRIVATE void i_00_to_3f(opc)
static void i_00_to_3f(opc)
opcode_pt opc;
{
opcode_pt sub;
@@ -424,14 +424,14 @@ opcode_pt opc;
}
}
PRIVATE void i_40_to_5f(opc)
static void i_40_to_5f(opc)
opcode_pt opc;
{
outustr(str_40_to_5f[(opc >> 3) & 3]);
outustr(genreg[hosize + (opc & 7)]);
}
PRIVATE void i_60_to_6f(opc)
static void i_60_to_6f(opc)
opcode_pt opc;
{
/* most for 386, some for 286 */
@@ -485,7 +485,7 @@ opcode_pt opc;
}
}
PRIVATE void i_70_to_7f(opc)
static void i_70_to_7f(opc)
opcode_pt opc;
{
outustr("j");
@@ -493,7 +493,7 @@ opcode_pt opc;
Jb();
}
PRIVATE void i_80(opc)
static void i_80(opc)
opcode_pt opc;
{
if (opc >= 4)
@@ -519,7 +519,7 @@ opcode_pt opc;
}
}
PRIVATE void i_88(opc)
static void i_88(opc)
opcode_pt opc;
{
if (opc < 4)
@@ -559,7 +559,7 @@ opcode_pt opc;
}
}
PRIVATE void i_90(opc)
static void i_90(opc)
opcode_pt opc;
{
if (opc == 0)
@@ -573,7 +573,7 @@ opcode_pt opc;
}
}
PRIVATE void i_98(opc)
static void i_98(opc)
opcode_pt opc;
{
outustr((str_98 - 8)[opc + hosize]);
@@ -581,7 +581,7 @@ opcode_pt opc;
outsegpc();
}
PRIVATE void i_a0(opc)
static void i_a0(opc)
opcode_pt opc;
{
outustr(str_a0[opc]);
@@ -599,7 +599,7 @@ opcode_pt opc;
outwsize();
}
PRIVATE void i_a8(opc)
static void i_a8(opc)
opcode_pt opc;
{
outustr(str_a8[opc]);
@@ -613,7 +613,7 @@ opcode_pt opc;
outwsize();
}
PRIVATE void i_b0(opc)
static void i_b0(opc)
opcode_pt opc;
{
outustr(movtab);
@@ -622,7 +622,7 @@ opcode_pt opc;
Ib();
}
PRIVATE void i_b8(opc)
static void i_b8(opc)
opcode_pt opc;
{
outustr(movtab);
@@ -631,7 +631,7 @@ opcode_pt opc;
Iv();
}
PRIVATE void i_c0(opc)
static void i_c0(opc)
opcode_pt opc;
{
outustr(str_c0[opc]);
@@ -654,7 +654,7 @@ opcode_pt opc;
shift(opc);
}
PRIVATE void i_c8(opc)
static void i_c8(opc)
opcode_pt opc;
{
outustr(str_c8[opc]);
@@ -672,7 +672,7 @@ opcode_pt opc;
outwsize();
}
PRIVATE void i_d0(opc)
static void i_d0(opc)
opcode_pt opc;
{
opcode_pt aabyte;
@@ -691,7 +691,7 @@ opcode_pt opc;
}
}
PRIVATE void i_d8(opc)
static void i_d8(opc)
opcode_pt opc;
{
opcode_pt esc;
@@ -746,7 +746,7 @@ escape:
outea(opc);
}
PRIVATE void i_e0(opc)
static void i_e0(opc)
opcode_pt opc;
{
outustr(str_e0[opc]);
@@ -766,7 +766,7 @@ opcode_pt opc;
}
}
PRIVATE void i_e8(opc)
static void i_e8(opc)
opcode_pt opc;
{
outustr(str_e8[opc]);
@@ -793,7 +793,7 @@ opcode_pt opc;
}
}
PRIVATE void i_f0(opc)
static void i_f0(opc)
opcode_pt opc;
{
if (opc < 6)
@@ -812,7 +812,7 @@ opcode_pt opc;
}
}
PRIVATE void i_f8(opc)
static void i_f8(opc)
opcode_pt opc;
{
if (opc < 6)
@@ -829,14 +829,14 @@ opcode_pt opc;
}
}
PRIVATE void outad(opc)
static void outad(opc)
opcode_pt opc;
{
getmodregrm();
outad1(opc);
}
PRIVATE void outad1(opc)
static void outad1(opc)
opcode_pt opc;
{
if (!(opc & TOREGBIT))
@@ -855,7 +855,7 @@ opcode_pt opc;
}
}
PRIVATE void outalorx(opc)
static void outalorx(opc)
opcode_pt opc;
{
if (opc & WORDBIT)
@@ -864,17 +864,17 @@ opcode_pt opc;
outustr(genreg[0]);
}
PRIVATE void outax()
static void outax()
{
outustr(genreg[hosize]);
}
PRIVATE void outbptr()
static void outbptr()
{
outustr("byte ptr ");
}
PRIVATE void outbwptr(opc)
static void outbwptr(opc)
opcode_pt opc;
{
if (mod != REG_MOD)
@@ -886,7 +886,7 @@ opcode_pt opc;
}
}
PRIVATE void outea(wordflags)
static void outea(wordflags)
opcode_pt wordflags;
{
reg_pt base;
@@ -943,7 +943,7 @@ opcode_pt wordflags;
}
}
PRIVATE void outf1()
static void outf1()
{
outustr("st(");
outbyte((int) (rm + '0'));
@@ -952,7 +952,7 @@ PRIVATE void outf1()
#if (_WORD_SIZE == 4)
PRIVATE void out32offset()
static void out32offset()
{
off_t off;
@@ -965,12 +965,12 @@ PRIVATE void out32offset()
}
#endif
PRIVATE void outfishy()
static void outfishy()
{
outustr("\t???");
}
PRIVATE void outgetaddr()
static void outgetaddr()
{
off_t off;
@@ -987,7 +987,7 @@ PRIVATE void outgetaddr()
outh16((u16_t) off);
}
PRIVATE void outimmed(signwordflag)
static void outimmed(signwordflag)
opcode_pt signwordflag;
{
su8_pt byte;
@@ -1012,7 +1012,7 @@ opcode_pt signwordflag;
Ib();
}
PRIVATE void outpc(pc)
static void outpc(pc)
off_t pc;
{
if (hosize == 8)
@@ -1026,7 +1026,7 @@ off_t pc;
outh16((u16_t) pc);
}
PRIVATE void outsegpc()
static void outsegpc()
{
off_t oldbase;
off_t pc;
@@ -1043,25 +1043,25 @@ PRIVATE void outsegpc()
uptr.base = oldbase;
}
PRIVATE void oututstr(s)
static void oututstr(s)
char *s;
{
outustr(s);
outtab();
}
PRIVATE void outword()
static void outword()
{
outustr("dword " + ((16 - hosize) >> 3));
}
PRIVATE void outwptr()
static void outwptr()
{
outword();
outustr("ptr ");
}
PRIVATE void outwsize()
static void outwsize()
{
if (hosize == 16)
outustr("d");
@@ -1069,7 +1069,7 @@ PRIVATE void outwsize()
outustr("w");
}
PRIVATE void pagef()
static void pagef()
{
opcode_pt opc;
int regbad;
@@ -1214,7 +1214,7 @@ PRIVATE void pagef()
outstr(fishy);
}
PRIVATE int puti()
static int puti()
{
static int hadprefix;
opcode_pt opcode;
@@ -1270,7 +1270,7 @@ more:
return TRUE;
}
PRIVATE void shift(opc)
static void shift(opc)
opcode_pt opc;
{
getmodregrm();
@@ -1286,28 +1286,28 @@ opcode_pt opc;
outbyte('1');
}
PRIVATE void checkmemory()
static void checkmemory()
{
if (mod == REG_MOD)
outfishy();
}
PRIVATE void CL()
static void CL()
{
outustr(genreg[1]);
}
PRIVATE void Eb()
static void Eb()
{
outea(0);
}
PRIVATE void Ev()
static void Ev()
{
outea(WORDBIT);
}
PRIVATE void EvGv()
static void EvGv()
{
getmodregrm();
Ev();
@@ -1315,77 +1315,77 @@ PRIVATE void EvGv()
Gv1();
}
PRIVATE void EvIb()
static void EvIb()
{
Ev();
outcomma();
Ib();
}
PRIVATE void Ew()
static void Ew()
{
hosize = 8;
Ev();
}
PRIVATE void EwRw()
static void EwRw()
{
hosize = 8;
EvGv();
}
PRIVATE void Gv()
static void Gv()
{
getmodregrm();
Gv1();
}
PRIVATE void Gv1()
static void Gv1()
{
outustr(genreg[hosize + reg]);
}
PRIVATE void GvEv()
static void GvEv()
{
Gv();
outcomma();
Ev();
}
PRIVATE void GvEw()
static void GvEw()
{
Gv();
outcomma();
Ew();
}
PRIVATE void GvM()
static void GvM()
{
GvEv();
checkmemory();
}
PRIVATE void GvMa()
static void GvMa()
{
GvM();
}
PRIVATE void GvMp()
static void GvMp()
{
GvM();
}
PRIVATE void Ib()
static void Ib()
{
outh8(get8());
}
PRIVATE void Iw()
static void Iw()
{
outh16(get16());
}
PRIVATE void Iv()
static void Iv()
{
if (hosize == 16)
outh32(get32());
@@ -1393,7 +1393,7 @@ PRIVATE void Iv()
Iw();
}
PRIVATE void Jb()
static void Jb()
{
off_t pcjump;
@@ -1401,7 +1401,7 @@ PRIVATE void Jb()
outpc(pcjump + uptr.off);
}
PRIVATE void Jv()
static void Jv()
{
off_t pcjump;
@@ -1412,7 +1412,7 @@ PRIVATE void Jv()
outpc(pcjump + uptr.off);
}
PRIVATE void Ms()
static void Ms()
{
Ev();
checkmemory();
@@ -1420,7 +1420,7 @@ PRIVATE void Ms()
/********************* DASM ******************************/
PUBLIC long dasm( addr, count, symflg )
long dasm( addr, count, symflg )
long addr;
int count;
int symflg;
@@ -1437,7 +1437,7 @@ int symflg;
}
PRIVATE int show1instruction()
static int show1instruction()
{
register int column;
int idone;
@@ -1481,7 +1481,7 @@ PRIVATE int show1instruction()
}
PRIVATE u8_t get8()
static u8_t get8()
{
/* get 8 bits current instruction pointer and advance pointer */
@@ -1492,7 +1492,7 @@ PRIVATE u8_t get8()
return temp;
}
PRIVATE u16_t get16()
static u16_t get16()
{
/* get 16 bits from current instruction pointer and advance pointer */
@@ -1503,7 +1503,7 @@ PRIVATE u16_t get16()
return temp;
}
PRIVATE u32_t get32()
static u32_t get32()
{
/* get 32 bits from current instruction pointer and advance pointer */
@@ -1515,7 +1515,7 @@ PRIVATE u32_t get32()
}
PRIVATE int outsegaddr(addr)
static int outsegaddr(addr)
struct address_s *addr;
{
/* print segmented address */
@@ -1538,7 +1538,7 @@ struct address_s *addr;
return bytes_printed + 4;
}
PRIVATE int outssegaddr(addr)
static int outssegaddr(addr)
struct address_s *addr;
{
/* print 32 bit segmented address and 2 spaces */
@@ -1551,13 +1551,13 @@ struct address_s *addr;
return bytes_printed + 2;
}
PRIVATE u8_t peek_byte(addr)
static u8_t peek_byte(addr)
off_t addr;
{
return (u8_t) peek_dword(addr) & 0xFF; /* 8 bits only */
}
PRIVATE u16_t peek_word(addr)
static u16_t peek_word(addr)
off_t addr;
{
return (u16_t) peek_dword(addr);

View File

@@ -16,15 +16,15 @@
#include <string.h>
#include "proto.h"
FORWARD long value(char *s , char **s_p , int *seg_p );
FORWARD long lookup(char *s , char **s_p , int *seg_p );
static long value(char *s , char **s_p , int *seg_p );
static long lookup(char *s , char **s_p , int *seg_p );
#define idchar(c) (isalpha(c) || isdigit(c) || (c) == '_')
/*
* Get an expression for mdb
*/
PUBLIC char *getexp(buf, exp_p, seg_p)
char *getexp(buf, exp_p, seg_p)
char *buf;
int *seg_p;
long *exp_p;
@@ -62,7 +62,7 @@ long *exp_p;
* \n 0L
* then calls lookup for symbols
*/
PRIVATE long value(s, s_p, seg_p)
static long value(s, s_p, seg_p)
char *s, **s_p;
int *seg_p;
{
@@ -94,7 +94,7 @@ int *seg_p;
* Handle special cases: _start T: D: S:
* then call symbolvalue()
*/
PRIVATE long lookup(s, s_p, seg_p)
static long lookup(s, s_p, seg_p)
char *s, **s_p;
int *seg_p;
{
@@ -148,7 +148,7 @@ int *seg_p;
}
/* Skip spaces */
PUBLIC char *skip(s)
char *skip(s)
register char *s;
{
while (isspace(*s)) ++s;

View File

@@ -12,10 +12,10 @@
#include <sys/ptrace.h>
#include "proto.h"
FORWARD void pr_ascii(long val , int size );
static void pr_ascii(long val , int size );
/* Print ascii */
PRIVATE void pr_ascii(val, size)
static void pr_ascii(val, size)
long val;
int size;
{
@@ -42,7 +42,7 @@ int size;
}
/* Dump stack */
PUBLIC void dump_stack(cnt)
void dump_stack(cnt)
long cnt;
{
vir_bytes v, vi;
@@ -81,7 +81,7 @@ long cnt;
/* Get file size */
PUBLIC off_t file_size(fd)
off_t file_size(fd)
int fd;
{
struct stat st;
@@ -95,7 +95,7 @@ struct stat st;
}
/* Print help page */
PUBLIC void help_page()
void help_page()
{
outstr("\nHelp for mdb. For more details, type 'command ?'\n");
outstr("!#\t- Shell escape / Set Variable or register\n");
@@ -133,7 +133,7 @@ PUBLIC void help_page()
outstr(" mdb [-fc] file\n");
}
PUBLIC void version_info()
void version_info()
{
Printf("\nmdb version %s.%d for Minix", MDBVERSION, MDBBUILD );
Printf(" %s.%s", OS_RELEASE, OS_VERSION);
@@ -151,7 +151,7 @@ PUBLIC void version_info()
}
/* Print help message on command */
PUBLIC void help_on(h)
void help_on(h)
int h;
{

View File

@@ -20,18 +20,18 @@ struct symtab_s
unsigned nsym;
};
PRIVATE struct symtab_s symtab;
PRIVATE int type_of_exec;
static struct symtab_s symtab;
static int type_of_exec;
FORWARD int check_exec(struct exec *hdr);
FORWARD void sortsyms(struct nlist *array , struct nlist *top );
FORWARD int symeq(char *t , struct nlist *sp );
FORWARD int symprefix(char *t , struct nlist *sp );
FORWARD struct nlist *findsname(char *name, int is_text, int allflag);
FORWARD void outsym(struct nlist *sp, off_t off);
FORWARD struct nlist *findsval(off_t value, int where);
static int check_exec(struct exec *hdr);
static void sortsyms(struct nlist *array , struct nlist *top );
static int symeq(char *t , struct nlist *sp );
static int symprefix(char *t , struct nlist *sp );
static struct nlist *findsname(char *name, int is_text, int allflag);
static void outsym(struct nlist *sp, off_t off);
static struct nlist *findsval(off_t value, int where);
PUBLIC void syminit( filename )
void syminit( filename )
char *filename;
{
int fd;
@@ -100,7 +100,7 @@ char *filename;
* return type of exec
* or exit
*/
PRIVATE int check_exec(hdr)
static int check_exec(hdr)
struct exec *hdr;
{
long magic;
@@ -159,7 +159,7 @@ long magic;
}
PUBLIC long symbolvalue( name, is_text )
long symbolvalue( name, is_text )
char *name;
int is_text;
{
@@ -178,7 +178,7 @@ register struct nlist *sp;
return 0L;
}
PRIVATE struct nlist *findsname( name, is_text, allflag )
static struct nlist *findsname( name, is_text, allflag )
char *name;
int is_text;
int allflag;
@@ -240,7 +240,7 @@ int allflag;
return NULL;
}
PRIVATE struct nlist *findsval( value, where )
static struct nlist *findsval( value, where )
off_t value;
int where;
{
@@ -277,7 +277,7 @@ int where;
}
PUBLIC void printhex(v)
void printhex(v)
off_t v;
{
if ( v >= 65536L )
@@ -289,7 +289,7 @@ off_t v;
}
PRIVATE void outsym( sp, off )
static void outsym( sp, off )
struct nlist *sp;
off_t off;
{
@@ -307,7 +307,7 @@ off_t off;
/* shell sort symbols on value */
PRIVATE void sortsyms( array, top )
static void sortsyms( array, top )
struct nlist *array;
struct nlist *top;
{
@@ -341,7 +341,7 @@ struct nlist *top;
while ( (gap /= 3) != 0 );
}
PUBLIC void symbolic( value, separator )
void symbolic( value, separator )
off_t value;
int separator;
{
@@ -386,14 +386,14 @@ int separator;
}
PRIVATE int symeq( t, sp )
static int symeq( t, sp )
register char *t;
struct nlist *sp;
{
return strncmp( t, sp->n_name, sizeof sp->n_name ) == 0;
}
PRIVATE int symprefix( t, sp )
static int symprefix( t, sp )
register char *t;
struct nlist *sp;
{
@@ -412,7 +412,7 @@ struct nlist *sp;
/* list all symbols - test for selection criteria */
PUBLIC void listsym(cmd)
void listsym(cmd)
char *cmd;
{
register struct symtab_s *tp;
@@ -473,7 +473,7 @@ char *cmd;
}
PUBLIC int text_symbol(value)
int text_symbol(value)
off_t value;
{
struct nlist *sp;
@@ -492,7 +492,7 @@ struct nlist *sp;
return FALSE;
}
PUBLIC int finds_data(off,data_seg)
int finds_data(off,data_seg)
off_t off;
int data_seg;
{
@@ -512,7 +512,7 @@ struct nlist *sp;
return FALSE;
}
PUBLIC int finds_pc(pc)
int finds_pc(pc)
off_t pc;
{
struct nlist *sp;

View File

@@ -17,9 +17,9 @@
#define SYSCALL_OLD 0x20CD
#endif
PRIVATE long intaddr;
static long intaddr;
PUBLIC void start_syscall(addr)
void start_syscall(addr)
long addr;
{
long old;
@@ -45,7 +45,7 @@ long old;
}
PUBLIC void do_syscall(addr)
void do_syscall(addr)
long addr;
{
unsigned reg_ax,reg_bx;

View File

@@ -11,7 +11,7 @@
* Call ptrace and check for error if debugging running process
* Otherwise read 'core' file
*/
PUBLIC long mdbtrace(req, pid, addr, data)
long mdbtrace(req, pid, addr, data)
int req, pid;
long addr, data;
{
@@ -43,7 +43,7 @@ long addr, data;
}
/* Used by disassembler */
PUBLIC u32_t peek_dword(addr)
u32_t peek_dword(addr)
off_t addr;
{
return mdbtrace(T_GETINS, curpid, addr, 0L);

View File

@@ -100,8 +100,8 @@ void eat_dir(Ino_t parent);
void eat_file(Ino_t inode, int f);
void enter_dir(Ino_t parent, char *name, Ino_t child);
void incr_size(Ino_t n, long count);
PRIVATE ino_t alloc_inode(int mode, int usrid, int grpid);
PRIVATE zone_t alloc_zone(void);
static ino_t alloc_inode(int mode, int usrid, int grpid);
static zone_t alloc_zone(void);
void add_zone(Ino_t n, zone_t z, long bytes, long cur_time);
void add_z_1(Ino_t n, zone_t z, long bytes, long cur_time);
void add_z_2(Ino_t n, zone_t z, long bytes, long cur_time);
@@ -880,7 +880,7 @@ long count;
/*================================================================
* allocation assist group
*===============================================================*/
PRIVATE ino_t alloc_inode(mode, usrid, grpid)
static ino_t alloc_inode(mode, usrid, grpid)
int mode, usrid, grpid;
{
ino_t num;
@@ -924,7 +924,7 @@ int mode, usrid, grpid;
}
PRIVATE zone_t alloc_zone()
static zone_t alloc_zone()
{
/* Allocate a new zone */
/* Works for zone > block */

View File

@@ -135,7 +135,7 @@ int gettynames(void);
* Tname assumes that the first three letters of the tty's name can be omitted
* and returns the rest (except for the console, which yields "co").
*/
PRIVATE char *tname(dev_t dev_nr)
static char *tname(dev_t dev_nr)
{
unsigned int i;
@@ -149,7 +149,7 @@ PRIVATE char *tname(dev_t dev_nr)
}
/* Find a task by its endpoint. */
PRIVATE struct pstat *findtask(endpoint_t endpt)
static struct pstat *findtask(endpoint_t endpt)
{
struct pstat *ps;
unsigned int slot;
@@ -168,7 +168,7 @@ PRIVATE struct pstat *findtask(endpoint_t endpt)
}
/* Return canonical task name of the given endpoint. */
PRIVATE char *taskname(endpoint_t endpt)
static char *taskname(endpoint_t endpt)
{
struct pstat *ps;
@@ -180,7 +180,7 @@ PRIVATE char *taskname(endpoint_t endpt)
/* Prrecv prints the RECV field for process with pstat buffer pointer ps.
* This is either "ANY", "taskname", or "(blockreason) taskname".
*/
PRIVATE char *prrecv(struct pstat *ps)
static char *prrecv(struct pstat *ps)
{
char *blkstr, *task; /* reason for blocking and task */
static char recvstr[20];
@@ -212,7 +212,7 @@ PRIVATE char *prrecv(struct pstat *ps)
return recvstr;
}
PRIVATE void getkinfo(void)
static void getkinfo(void)
{
FILE *fp;

View File

@@ -32,14 +32,14 @@
#include "config.h"
#include "proto.h"
PRIVATE int class_recurs; /* Nesting level of class statements */
static int class_recurs; /* Nesting level of class statements */
#define MAX_CLASS_RECURS 100 /* Max nesting level for classes */
#include "parse.h"
FORWARD void do_service(config_t *cpe, config_t *config, struct rs_config *);
static void do_service(config_t *cpe, config_t *config, struct rs_config *);
PRIVATE void do_class(config_t *cpe, config_t *config, struct rs_config *rs_config)
static void do_class(config_t *cpe, config_t *config, struct rs_config *rs_config)
{
config_t *cp, *cp1;
@@ -110,7 +110,7 @@ PRIVATE void do_class(config_t *cpe, config_t *config, struct rs_config *rs_conf
class_recurs--;
}
PRIVATE void do_uid(config_t *cpe, struct rs_start *rs_start)
static void do_uid(config_t *cpe, struct rs_start *rs_start)
{
uid_t uid;
struct passwd *pw;
@@ -155,7 +155,7 @@ PRIVATE void do_uid(config_t *cpe, struct rs_start *rs_start)
rs_start->rss_uid= uid;
}
PRIVATE void do_sigmgr(config_t *cpe, struct rs_start *rs_start)
static void do_sigmgr(config_t *cpe, struct rs_start *rs_start)
{
endpoint_t sigmgr_ep;
int r;
@@ -192,7 +192,7 @@ PRIVATE void do_sigmgr(config_t *cpe, struct rs_start *rs_start)
rs_start->rss_sigmgr= sigmgr_ep;
}
PRIVATE void do_type(config_t *cpe, struct rs_config *rs_config)
static void do_type(config_t *cpe, struct rs_config *rs_config)
{
if (cpe->next != NULL)
{
@@ -223,7 +223,7 @@ PRIVATE void do_type(config_t *cpe, struct rs_config *rs_config)
cpe->file, cpe->line);
}
PRIVATE void do_descr(config_t *cpe, struct rs_config *rs_config)
static void do_descr(config_t *cpe, struct rs_config *rs_config)
{
if (cpe->next != NULL)
{
@@ -249,7 +249,7 @@ PRIVATE void do_descr(config_t *cpe, struct rs_config *rs_config)
rs_config->descr = cpe->word;
}
PRIVATE void do_scheduler(config_t *cpe, struct rs_start *rs_start)
static void do_scheduler(config_t *cpe, struct rs_start *rs_start)
{
endpoint_t scheduler_ep;
int r;
@@ -286,7 +286,7 @@ PRIVATE void do_scheduler(config_t *cpe, struct rs_start *rs_start)
rs_start->rss_scheduler= scheduler_ep;
}
PRIVATE void do_priority(config_t *cpe, struct rs_start *rs_start)
static void do_priority(config_t *cpe, struct rs_start *rs_start)
{
int priority_val;
char *check;
@@ -324,7 +324,7 @@ PRIVATE void do_priority(config_t *cpe, struct rs_start *rs_start)
rs_start->rss_priority= priority_val;
}
PRIVATE void do_quantum(config_t *cpe, struct rs_start *rs_start)
static void do_quantum(config_t *cpe, struct rs_start *rs_start)
{
int quantum_val;
char *check;
@@ -362,7 +362,7 @@ PRIVATE void do_quantum(config_t *cpe, struct rs_start *rs_start)
rs_start->rss_quantum= quantum_val;
}
PRIVATE void do_cpu(config_t *cpe, struct rs_start *rs_start)
static void do_cpu(config_t *cpe, struct rs_start *rs_start)
{
int cpu;
char *check;
@@ -400,7 +400,7 @@ PRIVATE void do_cpu(config_t *cpe, struct rs_start *rs_start)
rs_start->rss_cpu= cpu;
}
PRIVATE void do_irq(config_t *cpe, struct rs_start *rs_start)
static void do_irq(config_t *cpe, struct rs_start *rs_start)
{
int irq;
int first;
@@ -455,7 +455,7 @@ PRIVATE void do_irq(config_t *cpe, struct rs_start *rs_start)
}
}
PRIVATE void do_io(config_t *cpe, struct rs_start *rs_start)
static void do_io(config_t *cpe, struct rs_start *rs_start)
{
unsigned base, len;
int first;
@@ -517,7 +517,7 @@ PRIVATE void do_io(config_t *cpe, struct rs_start *rs_start)
}
}
PRIVATE void do_pci_device(config_t *cpe, struct rs_start *rs_start)
static void do_pci_device(config_t *cpe, struct rs_start *rs_start)
{
u16_t vid, did;
char *check, *check2;
@@ -554,7 +554,7 @@ PRIVATE void do_pci_device(config_t *cpe, struct rs_start *rs_start)
}
}
PRIVATE void do_pci_class(config_t *cpe, struct rs_start *rs_start)
static void do_pci_class(config_t *cpe, struct rs_start *rs_start)
{
u8_t baseclass, subclass, interface;
u32_t class_id, mask;
@@ -607,7 +607,7 @@ PRIVATE void do_pci_class(config_t *cpe, struct rs_start *rs_start)
}
}
PRIVATE void do_pci(config_t *cpe, struct rs_start *rs_start)
static void do_pci(config_t *cpe, struct rs_start *rs_start)
{
if (cpe == NULL)
return; /* Empty PCI statement */
@@ -637,7 +637,7 @@ PRIVATE void do_pci(config_t *cpe, struct rs_start *rs_start)
cpe->word, cpe->file, cpe->line);
}
PRIVATE void do_ipc(config_t *cpe, struct rs_start *rs_start)
static void do_ipc(config_t *cpe, struct rs_start *rs_start)
{
char *list;
const char *word;
@@ -734,7 +734,7 @@ struct
{ NULL, 0 },
};
PRIVATE void do_vm(config_t *cpe, struct rs_start *rs_start)
static void do_vm(config_t *cpe, struct rs_start *rs_start)
{
int i, first;
@@ -821,7 +821,7 @@ struct
{ NULL, 0 }
};
PRIVATE void do_system(config_t *cpe, struct rs_start *rs_start)
static void do_system(config_t *cpe, struct rs_start *rs_start)
{
int i, first;
@@ -882,7 +882,7 @@ PRIVATE void do_system(config_t *cpe, struct rs_start *rs_start)
}
}
PRIVATE void do_control(config_t *cpe, struct rs_start *rs_start)
static void do_control(config_t *cpe, struct rs_start *rs_start)
{
int nr_control = 0;
@@ -912,7 +912,7 @@ PRIVATE void do_control(config_t *cpe, struct rs_start *rs_start)
}
}
PRIVATE void do_service(config_t *cpe, config_t *config, struct rs_config *rs_config)
static void do_service(config_t *cpe, config_t *config, struct rs_config *rs_config)
{
struct rs_start *rs_start = &rs_config->rs_start;
config_t *cp;
@@ -1031,7 +1031,7 @@ PRIVATE void do_service(config_t *cpe, config_t *config, struct rs_config *rs_co
}
}
PRIVATE const char *do_config(const char *label, char *filename, struct rs_config *rs_config)
static const char *do_config(const char *label, char *filename, struct rs_config *rs_config)
{
config_t *config, *cp, *cpe;
struct passwd *pw;
@@ -1109,7 +1109,7 @@ PRIVATE const char *do_config(const char *label, char *filename, struct rs_confi
}
/* returns failure */
PUBLIC const char *parse_config(char *progname, int custom_config, char *req_config,
const char *parse_config(char *progname, int custom_config, char *req_config,
struct rs_config *rs_config)
{
char *specificconfig, *specific_pkg_config;

View File

@@ -40,7 +40,7 @@
#include "proto.h"
/* This array defines all known requests. */
PRIVATE char *known_requests[] = {
static char *known_requests[] = {
"up",
"down",
"refresh",
@@ -105,28 +105,28 @@ PRIVATE char *known_requests[] = {
* parameters passed to this utility. Request parameters that are needed
* are stored globally in the following variables:
*/
PRIVATE int req_type;
PRIVATE int do_run= 0; /* 'run' command instead of 'up' */
PRIVATE char *req_label = NULL;
PRIVATE char *req_path = NULL;
PRIVATE char *req_path_self = SELF_REQ_PATH;
PRIVATE char *req_args = "";
PRIVATE int req_major = 0;
PRIVATE int devman_id = 0;
PRIVATE int req_dev_style = STYLE_NDEV;
PRIVATE long req_period = 0;
PRIVATE char *req_script = NULL;
PRIVATE char *req_config = PATH_CONFIG;
PRIVATE int custom_config_file = 0;
PRIVATE int req_lu_state = DEFAULT_LU_STATE;
PRIVATE int req_lu_maxtime = DEFAULT_LU_MAXTIME;
static int req_type;
static int do_run= 0; /* 'run' command instead of 'up' */
static char *req_label = NULL;
static char *req_path = NULL;
static char *req_path_self = SELF_REQ_PATH;
static char *req_args = "";
static int req_major = 0;
static int devman_id = 0;
static int req_dev_style = STYLE_NDEV;
static long req_period = 0;
static char *req_script = NULL;
static char *req_config = PATH_CONFIG;
static int custom_config_file = 0;
static int req_lu_state = DEFAULT_LU_STATE;
static int req_lu_maxtime = DEFAULT_LU_MAXTIME;
/* Buffer to build "/command arg1 arg2 ..." string to pass to RS server. */
PRIVATE char command[4096];
static char command[4096];
/* An error occurred. Report the problem, print the usage, and exit.
*/
PRIVATE void print_usage(char *app_name, char *problem)
static void print_usage(char *app_name, char *problem)
{
fprintf(stderr, "Warning, %s\n", problem);
fprintf(stderr, "Usage:\n");
@@ -145,7 +145,7 @@ PRIVATE void print_usage(char *app_name, char *problem)
/* A request to the RS server failed. Report and exit.
*/
PRIVATE void failure(int request)
static void failure(int request)
{
fprintf(stderr, "Request 0x%x to RS failed: %s (error %d)\n", request, strerror(errno), errno);
exit(errno);
@@ -155,7 +155,7 @@ PRIVATE void failure(int request)
/* Parse and verify correctness of arguments. Report problem and exit if an
* error is found. Store needed parameters in global variables.
*/
PRIVATE int parse_arguments(int argc, char **argv, u32_t *rss_flags)
static int parse_arguments(int argc, char **argv, u32_t *rss_flags)
{
struct stat stat_buf;
char *hz, *buff;
@@ -412,7 +412,7 @@ PRIVATE int parse_arguments(int argc, char **argv, u32_t *rss_flags)
/* Main program.
*/
PUBLIC int main(int argc, char **argv)
int main(int argc, char **argv)
{
message m;
int result = EXIT_SUCCESS;