1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
/* djgpp2.c --
This file is part of the lzop file compressor.
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
lzop and the LZO library are free software; you can redistribute them
and/or modify them 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; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
http://www.oberhumer.com/opensource/lzop/
*/
#include "conf.h"
#if defined(__DJGPP__)
#include <dpmi.h>
#include <go32.h>
/*************************************************************************
// init
**************************************************************************/
/* Minimum stack */
unsigned _stklen = 65536;
/* This is called before 'main'. */
static void __attribute__((__constructor__))
djgpp_startup (void)
{
const char *s;
static char lfn_y[] = "LFN=y";
static char lfn_n[] = "LFN=n";
s = getenv("LZOP_LFN");
if (s == NULL || (s[0] != 'n' && s[0] != 'N'))
putenv(lfn_y);
else
{
putenv(lfn_n);
_crt0_startup_flags |= _CRT0_FLAG_NO_LFN;
}
_djstat_flags |= _STAT_INODE;
_djstat_flags |= _STAT_EXEC_EXT;
_djstat_flags |= _STAT_EXEC_MAGIC;
_djstat_flags |= _STAT_DIRSIZE;
_djstat_flags |= _STAT_ROOT_TIME;
}
/* No need for loading the environment. */
void __crt0_load_environment_file(char *app_name) { UNUSED(app_name); }
/* No need for this function */
int _is_executable(const char *filename, int fhandle, const char *extension)
{
UNUSED(filename);
UNUSED(fhandle);
UNUSED(extension);
return 0;
}
/*************************************************************************
// info
**************************************************************************/
#if 0
typedef struct {
unsigned long largest_available_free_block_in_bytes;
unsigned long maximum_unlocked_page_allocation_in_pages;
unsigned long maximum_locked_page_allocation_in_pages;
unsigned long linear_address_space_size_in_pages;
unsigned long total_number_of_unlocked_pages;
unsigned long total_number_of_free_pages;
unsigned long total_number_of_physical_pages;
unsigned long free_linear_address_space_in_pages;
unsigned long size_of_paging_file_partition_in_pages;
unsigned long reserved[3];
} __dpmi_free_mem_info;
typedef struct {
unsigned long available_memory;
unsigned long available_pages;
unsigned long available_lockable_pages;
unsigned long linear_space;
unsigned long unlocked_pages;
unsigned long available_physical_pages;
unsigned long total_physical_pages;
unsigned long free_linear_space;
unsigned long max_pages_in_paging_file;
unsigned long reserved[3];
} _go32_dpmi_meminfo;
#endif
static void meminfo(void)
{
__dpmi_free_mem_info info;
const unsigned long err = (unsigned long) -1;
unsigned long ps = 0;
unsigned long k;
if (__dpmi_get_page_size(&ps) != 0 || ps <= 0)
return;
if (__dpmi_get_free_memory_information(&info) != 0)
return;
#if 0
k = info.largest_available_free_block_in_bytes;
if (k == err)
{
k = info.maximum_unlocked_page_allocation_in_pages;
if (k != err)
k *= ps;
else
k = info.largest_available_free_block_in_bytes;
}
#endif
#if 0
k = info.total_number_of_physical_pages;
k = info.total_number_of_unlocked_pages;
#endif
k = info.total_number_of_free_pages;
if (k != err)
{
k = (k * ps) / 1024;
con_fprintf(con_term,"DPMI physical memory available: %6ld kB\n",k);
}
k = info.maximum_unlocked_page_allocation_in_pages;
if (k != err)
{
k = (k * ps) / 1024;
con_fprintf(con_term,"DPMI virtual memory available: %6ld kB\n",k);
}
con_fprintf(con_term,"\n");
}
void sysinfo_djgpp(void)
{
meminfo();
if (_USE_LFN)
con_fprintf(con_term,"Long filenames are supported.\n");
else
con_fprintf(con_term,"Long filenames are not supported.\n");
con_fprintf(con_term,"\n");
}
#endif /* __DJGPP__ */
/*
vi:ts=4:et
*/
|