2 static char RCSId
[] = "$Id: dump.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
3 static char Copyright
[] = "Copyright Robert J. Amstadt, 1993";
12 #include <linux/unistd.h>
13 #include <linux/head.h>
14 #include <linux/ldt.h>
19 #include "prototypes.h"
21 /**********************************************************************
25 PrintFileHeader(struct ne_header_s
*ne_header
)
27 printf("ne_header: %c%c\n",
28 ne_header
->header_type
[0],
29 ne_header
->header_type
[1]);
30 printf("linker version: %d.%d\n", ne_header
->linker_version
,
31 ne_header
->linker_revision
);
32 printf("format flags: %04.4x\n", ne_header
->format_flags
);
33 printf("automatic data segment: %04.4x\n", ne_header
->auto_data_seg
);
34 printf("CS:IP %04.4x:%04.4x\n", ne_header
->cs
, ne_header
->ip
);
35 printf("SS:SP %04.4x:%04.4x\n", ne_header
->ss
, ne_header
->sp
);
36 printf("additional flags: %02.2x\n", ne_header
->additional_flags
);
37 printf("operating system: %02.2x\n", ne_header
->operating_system
);
38 printf("fast load offset: %04.4x\n", ne_header
->fastload_offset
);
39 printf("fast load length: %04.4x\n", ne_header
->fastload_length
);
42 /**********************************************************************
46 PrintSegmentTable(struct ne_segment_table_entry_s
*seg_table
, int nentries
)
50 for (i
= 0; i
< nentries
; i
++)
52 printf(" %2d: OFFSET %04.4x, LENGTH %04.4x, ",
53 i
+ 1, seg_table
[i
].seg_data_offset
,
54 seg_table
[i
].seg_data_length
);
55 printf("FLAGS %04.4x, MIN ALLOC %04.4x\n",
56 seg_table
[i
].seg_flags
, seg_table
[i
].min_alloc
);
60 /**********************************************************************
61 * PrintRelocationTable
64 PrintRelocationTable(char *exe_ptr
,
65 struct ne_segment_table_entry_s
*seg_entry_p
,
68 struct relocation_entry_s
*rep
;
71 u_short n_entries
, *sp
;
73 printf("RELOCATION TABLE %d:\n", segment
+ 1);
75 if (seg_entry_p
->seg_data_offset
== 0)
78 offset
= seg_entry_p
->seg_data_length
;
82 sp
= (u_short
*) (exe_ptr
+ seg_entry_p
->seg_data_offset
* 512 + offset
);
85 rep
= (struct relocation_entry_s
*) (sp
+ 1);
86 for (i
= 0; i
< n_entries
; i
++, rep
++)
88 printf(" ADDR TYPE %d, TYPE %d, OFFSET %04.4x,",
89 rep
->address_type
, rep
->relocation_type
, rep
->offset
);
90 printf("TARGET %04.4x %04.4x\n", rep
->target1
, rep
->target2
);
93 #endif /* ifndef WINELIB */