wok view linld/stuff/src/COMMON.H @ rev 24019

syslinux: fix build
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Feb 28 16:32:57 2021 +0000 (2021-02-28)
parents bc4b94310a29
children 217c02cbbe8d
line source
1 //#define WITH_XMM_ALLOC add himem.sys driver
2 //#define LARGE_ZIMAGE may load system in high memory temporarily
3 //#define INT15_E820 add int15/eax=E820 driver
4 //#define BASIC_ISO9660 non rockridge support
5 #define ROCKRIDGE iso 9660 posix name support
6 #define ISO9660 iso= support
7 #define QUICK_BOOT /q bypass shutdown hack, /v keeps v86
8 #define ISOHOOK iso image dos boot helper
9 #define MOVE_SETUP spare few Kb in setup location for zImage system
10 #define NO386 8088 support
11 #define CPU64 /64 support
12 #define LONG_FILENAME look for Win95+ long file name too
13 #define SHUTDOWN disable int19 hooked drivers
14 #define VCPI v86 mode support with VCPI 4.0+
15 #define LINUX001 linux 0.01 support
16 #define ELKS elks support
17 #define IPXE ipxe support
18 /* End of the optional features */
20 #ifdef ISOHOOK
21 #ifndef ISO9660
22 #define ISO9660
23 #endif
24 #ifndef ROCKRIDGE
25 #define ROCKRIDGE
26 #endif
27 #ifndef CPU64
28 #define CPU64
29 #endif
30 #endif
32 // This file is distributed under GPL
33 //
34 // Common defs not belonging to CRTL
36 #if defined(__BORLANDC__) && !defined(NO386)
37 #pragma option -3
38 asm{
39 .386p
40 }
41 #endif
43 #define NL "\n"
44 #define VERSION_STR "0.97"
46 #if 0 // DEBUG
47 #undef NDEBUG
48 #define DEBUG
49 #define static
50 #else // not DEBUG
51 #define NDEBUG
52 #undef DEBUG
53 #endif
55 typedef unsigned long u32; typedef signed long s32;
56 typedef unsigned short u16; typedef signed short s16;
57 typedef unsigned char u8; typedef signed char s8;
59 const u16 _16k = 16*1024u;
60 const u16 _32k = 32*1024u;
61 const u32 _64k = 64*1024ul;
62 const u32 _1m = 1024ul*1024ul;
63 const u32 _32m = 32*1024ul*1024ul;
64 const u32 _64m = 64*1024ul*1024ul;
66 const PAGE_BITS = 12;
67 const PAGE_SIZE = 1<<PAGE_BITS;
68 const PAGE_MASK = PAGE_SIZE-1;
70 // WARNING!
71 // BC 3.1 bug: seg() will generate incorrect code if inlined!
72 // replaced by _dirty_ hack for now
73 // u16 seg(const void far* p) { return FP_SEG(p); }
74 inline u16 seg(const void far*) { return _DS; }
76 inline u16 ofs(const void* p) { return FP_OFF(p); }
78 extern struct image_himem {
79 int fd;
80 u32 fallback;
81 u32 size;
82 u32 remaining;
83 u32 buf;
84 u32 *bufv;
85 u32 chunk_size;
86 u16 state;
87 u16 fd2close;
88 } imgs[2];
89 #define pm (imgs[0])
90 #define initrd (imgs[1])
91 #define pm2initrd(p) (p+1)
93 extern u8 pm_low;
95 extern u32 far *initrd_desc;
96 #define cmdline (cmdstr[0])
97 #define kernel_name (cmdstr[1])
98 #define initrd_name (cmdstr[2])
99 #define isofile (cmdstr[3])
100 extern const char* cmdstr[4];
102 #define root_dev (cmdnum[0])
103 #define vid_mode (cmdnum[1]) // -3 = ask, -2 = Extended VGA, -1 = Normal VGA, n = as "n" was pressed
104 #define topmem (cmdnum[2])
105 #define base_himem (cmdnum[3])
106 #define skip_alloc (* (char *) &cmdnum[4])
107 #ifdef QUICK_BOOT
108 extern u32 cmdnum[7];
109 #else
110 extern u32 cmdnum[5];
111 #endif
113 extern _fastcall void memcpy_image_kernel();
114 extern _fastcall void memcpy_image_initrd();
115 extern _fastcall void storepage(u32 *dst);
116 extern _fastcall void reset_bufv(unsigned long *p);
117 extern "C" unsigned long* prev_bufv();
118 extern "C" unsigned long* next_bufv();
119 #define next(p) p = next_bufv()
120 #define prev(p) p = prev_bufv()
121 extern char vcpi;
122 extern char version_string[];
123 // External asm helpers
124 #ifdef WITH_XMM_ALLOC
125 extern _fastcall void xmm_alloc(struct image_himem *m);
126 #endif
127 extern "C" u32 memtop();
128 extern "C" void enable_a20_or_die();
129 extern "C" void far vm2rm();
130 extern "C" void hook_int15_88();
132 // C++ helpers
133 #ifdef DEBUG
134 extern "C" void hang();
135 #endif
137 void load_image(struct image_himem *m);
138 extern _fastcall void open_image(struct image_himem *m, const char *name);
139 extern _fastcall int read_image(struct image_himem *m);
140 void load_kernel();
141 void load_initrd();
142 extern "C" void boot_kernel();