1 /**
2  * @namespace   biew_plugins_auto
3  * @file        plugins/bin/lmf.c
4  * @brief       This file contains lmf file structures and constants.
5  * @version     -
6  * @remark      this source file is part of Binary vIEW project (BIEW).
7  *              The Binary vIEW (BIEW) is copyright (C) 1995 Nickols_K.
8  *              All rights reserved. This software is redistributable under the
9  *              licence given in the file "Licence.en" ("Licence.ru" in russian
10  *              translation) distributed in the BIEW archive.
11  * @note        Requires POSIX compatible development system
12  *              LMF file format header file based on Watcom C/QNX4 <sys/lmf.h>
13  * @author      Andrew Golovnia
14  * @since       2001
15  * @note        Development, fixes and improvements
16  * @todo        wc 10.6 debug information support!!! (need to use lmf.tgz)
17 **/
18 #ifndef __LMF_INC
19 #define __LMF_INC
20 
21 #ifndef __SYS_DEP_H
22 #include "_sys_dep.h"
23 #endif
24 
25 #if __WATCOMC__ > 1000
26 #pragma pack(__push,1);
27 #else
28 #pragma pack(1)
29 #endif
30 
31 /*	LMF structure defenitions
32  */
33 
34 typedef struct tag_lmf_header	/* This preceeds each record defined below */
35 {
36 	tInt8 rec_type,
37 		zero1;
38 	tUInt16 data_nbytes,
39 		spare;
40 } lmf_header;
41 
42 typedef struct tag_lmf_definition	/* Must be first record in load file */
43 {
44 	tUInt16 version_no,
45 		cflags,
46 		cpu,
47 		fpu,
48 		code_index,
49 		stack_index,
50 		heap_index,
51 		argv_index,
52 		zero1[4];
53 	tUInt32 code_offset,
54 		stack_nbytes,
55 		heap_nbytes,
56 		flat_offset,	/* Must be zero if not set _PCF_FLAT in cflags	(AG) */
57 		unmapped_size,	/* I never seen this field nonzero		(AG) */
58 		zero2;
59 	/* Variable length field of n longs starts here */
60 	/* Sizes of segments.      ^^^ n is segments number.		(AG) */
61 } lmf_definition;
62 
63 typedef struct tag_lmf_data	/* Code or data record to load into memory */
64 {
65 	tUInt16 index;
66 	tUInt32 offset;
67 	/* Variable length field of n bytes starts here */
68 	/* Data to load in         ^^^ n is a length of loading data
69 	   segment numbered        n = lmf_header.data_nbytes of this record
70 	   by index.                   - sizeof(lmf_data).			(AG) */
71 } lmf_data;
72 
73 typedef struct tag_lmf_resource
74 {
75 	tUInt16 resource_type;   /* 0 - usage messages */
76 	tUInt16 zero[3];
77 } lmf_resource;
78 
79 /*	Record types
80  */
81 
82 #define _LMF_DEFINITION_REC     0
83 #define _LMF_COMMENT_REC        1
84                             /* ^^^ Never seen this record.		(AG)  */
85 #define _LMF_DATA_REC           2
86 #define _LMF_FIXUP_SEG_REC      3
87 #define _LMF_FIXUP_80X87_REC    4
88 #define _LMF_EOF_REC            5
89 #define _LMF_RESOURCE_REC       6
90 #define _LMF_ENDDATA_REC        7
91 #define _LMF_FIXUP_LINEAR_REC   8
92                             /* ^^^ Never seen this record.		(AG)  */
93 #define _LMF_PHRESOURCE			9	/* A widget resource for photon apps */
94                             /* ^^^ Never seen this record.		(AG)  */
95 
96 /*	Bit defitions for lh_code_flags
97  */
98 
99 #define _PCF_LONG_LIVED     0x0001
100 #define _PCF_32BIT          0x0002
101 #define _PCF_PRIVMASK       0x000c   /* Two bits */
102 #define _PCF_FLAT           0x0010
103 #define _PCF_NOSHARE        0x0020
104 
105 /*	The top 4 bits of the segment sizes
106  */
107 
108 #define _LMF_CODE           0x2
109 
110 #if __WATCOMC__ > 1000
111 #pragma pack(__pop);
112 #else
113 #pragma pack()
114 #endif
115 
116 #endif/*__LMF_INC*/
117