/[packages]/updates/2/dosemu/current/SOURCES/dosemu-1.4.0.1.diff
ViewVC logotype

Contents of /updates/2/dosemu/current/SOURCES/dosemu-1.4.0.1.diff

Parent Directory Parent Directory | Revision Log Revision Log


Revision 238460 - (show annotations) (download)
Sun May 27 16:04:52 2012 UTC (12 years, 7 months ago) by schedbot
File size: 263845 byte(s)
SILENT: Branching dosemu at revision 220274 for Mageia 2
1 diff -urN dosemu-1.4.0/ChangeLog dosemu-1.4.0.1/ChangeLog
2 --- dosemu-1.4.0/ChangeLog 2007-05-05 11:39:58.000000000 -0400
3 +++ dosemu-1.4.0.1/ChangeLog 2008-03-27 12:16:38.000000000 -0400
4 @@ -1,9 +1,446 @@
5 +2008-03-27 Bart
6 +
7 + * [r1853] ChangeLog, NEWS:
8 + DOSEMU 1.4.0.1
9 +
10 + * [r1852] configure, configure.ac, src/commands/Makefile,
11 + src/plugin/commands/Makefile:
12 + Fix 64-bit compilation on 32-bit systems and vice versa.
13 +
14 + * [r1851] src/base/bios/hlt.c, src/dosext/mfs/mfs.c,
15 + src/plugin/kbd_unicode/keyb_raw.c:
16 + Fix more gcc warnings for 64-bit compilation.
17 +
18 + * [r1850] src/base/bios/int10.c, src/plugin/term/terminal.c:
19 + Cleaner fix for terminal memory map race.
20 +
21 +2008-03-26 Bart
22 +
23 + * [r1849] VERSION:
24 + DOSEMU 1.4.0.1
25 +
26 + * [r1848] Makefile:
27 + Remove configure.lineno on distclean.
28 +
29 + * [r1847] src/base/init/lexer.l.in:
30 + Avoid gcc-4.3 warning about unused input function in lexer.
31 +
32 + * [r1846] src/base/bios/int10.c, src/plugin/term/terminal.c:
33 + Add a call to video->update_screen to int10/ah=0 modesets to make
34 + sure the terminal is initialized. Fixes a race (though it should be
35 + done more cleanly).
36 +
37 +2008-03-25 Bart
38 +
39 + * [r1845] src/arch/linux/dosext/sound/midid/timid.c,
40 + src/plugin/midimisc/mid_o_tmdty.c:
41 + In timidity plugin and midid code: use socketpair as a bidirectional
42 + pipe: older versions (current as of 2008 :( ) of timidity write to
43 + stdin and we can catch that to avoid waiting 3 seconds at select at
44 + DOSEMU startup.
45 +
46 +2008-03-21 Bart
47 +
48 + * [r1844] src/dosext/mfs/lfn.c:
49 + Add missing "return" for LFN findnext error. Fixes #1801411: Running
50 + File Wizard crashes DOSEMU 1.4.0.0.
51 +
52 + * [r1843] src/plugin/term/keyb_slang.c, src/plugin/term/terminal.c:
53 + Added some diagnostics to check for UTF-8 terminal mismatches;
54 + "fixes" bug #1729556.
55 +
56 +2008-03-18 Bart
57 +
58 + * [r1842] src/emu-i386/simx86/trees.c:
59 + Try to fix #1910153 again: we need to round to PAGE_SIZE for the loop
60 + termination test because of backwards jumps and NOJUMPS.
61 +
62 + * [r1841] src/emu-i386/simx86/codegen-sim.c:
63 + SF-Patch #1683073: handle 16bit address overflow in string
64 + instructions. Fixes overflow in the simulator of cpu-emu. Adjusted
65 + from Michael Karcher's patch.
66 +
67 +2008-03-17 Bart
68 +
69 + * [r1840] src/emu-i386/simx86/trees.c:
70 + Bail out of node-to-invalidate check loop for the sorted list once
71 + the base (instead of the PC-beginning of the block) is past the
72 + affected address. Really fixes #1910153: SkyRoads failure: JIT fails
73 + some self-modifying code (Michael Karcher).
74 +
75 +2008-03-16 Bart
76 +
77 + * [r1839] src/emu-i386/simx86/trees.h:
78 + Fix #1910153 SkyRoads failure: JIT fails some self-modifying code.
79 + The dnpc field needs to be signed because it can be negative and is
80 + compared to negative "int"s in BreakNode.
81 +
82 +2008-03-11 Bart
83 +
84 + * [r1838] src/emu-i386/simx86/sigsegv.c:
85 + Patch #1910535, Michael Karcher: fix for "e_vgaemu_fault corrupts
86 + eip/rip"
87 +
88 + * [r1837] src/env/video/vgaemu.c:
89 + In Super-VGA modes, do *not* wrap memory at 256k. SF patch #1910415,
90 + Michael Karcher; fixes bug #1806787.
91 +
92 +2008-02-18 Stas
93 +
94 + * [r1836] src/base/dev/dma/dmanew.c, src/base/dev/sb16/sb16.c:
95 + OK, the good-bye cannot be that rude any more. My apologies to the
96 + sound.c authors for that silly remark of mine and I hope you can do a
97 + good work on my code.
98 +
99 +2007-12-06 Bart
100 +
101 + * [r1835] src/arch/linux/async/sigsegv.c:
102 + Use fpregset_t instead of _fpstate to avoid problems with Debian's
103 + glibc for x86_64.
104 +
105 +2007-09-24 Bart
106 +
107 + * [r1834] src/emu-i386/simx86/codegen-sim.h,
108 + src/emu-i386/simx86/codegen-x86.h:
109 + Replace BT24 and BTA inline asm by C.
110 +
111 +2007-09-23 Bart
112 +
113 + * [r1833] src/emu-i386/simx86/interp.c:
114 + Michael Karcher: #1800717 cpuemu: BOUND is signed. The current bound
115 + implementation does a signed compare instead of an unsigned one. This
116 + patch should fix it.
117 +
118 + * [r1832] src/base/async/int.c, src/base/dev/misc/lpt.c,
119 + src/emu-i386/simx86/interp.c:
120 + Implement the bound instruction (albeit fully interpreted). Make sure
121 + that int 5 does not try printscreen if there is no printer.
122 +
123 + * [r1831] src/emu-i386/simx86/interp.c:
124 + From Michael Karcher: #1763170 CPU emu: implement INTO correctly. The
125 + INTO instruction should generate the overflow execption only if the
126 + overflow flag is set, not on every invocation.
127 +
128 + * [r1830] src/emu-i386/simx86/interp.c:
129 + From Michael Karcher: SF #1763169 CPU emu: handle prefixed jumps
130 + correctly: The distance in a (not 8-bit) jump instruction is encoded
131 + according to operand size, not address size. There is some wrong
132 + documentation in this regard, even the processor reference manual I
133 + usually use. The size of CX used in JCXZ is depending on the address
134 + size, as correctly implemented in dosemu.
135 +
136 + * [r1829] src/emu-i386/simx86/interp.c:
137 + From Michael Karcher, #1763166 CPU emu: ignore access to unknown VGA
138 + ports Currently, dosemu crashes on read/write access to unhandled
139 + ports in the VGA range when cpuemu is enabled. While this is
140 + acceptable behaviour while developing, it is not helpful for the end
141 + user, who has a program probing for different SVGA cards by direct
142 + hardware access.
143 +
144 +2007-06-11 Bart
145 +
146 + * [r1828] src/dosext/mfs/lfn.c, src/tools/Makefile:
147 + Fixed some warnings with 64-bit builds.
148 +
149 +2007-06-05 Bart
150 +
151 + * [r1827] etc/global.conf, src/plugin/X/X.c:
152 + Fix $_X_winsize; also enable to use it, and X_aspect_43 with text
153 + modes with bitmapped fonts.
154 +
155 +2007-06-04 Bart
156 +
157 + * [r1826] src/dosext/dpmi/msdos.c:
158 + Add DPMI API translation support for int21/ax=71a6.
159 +
160 + * [r1825] src/base/async/int.c, src/dosext/mfs/lfn.c,
161 + src/dosext/mfs/mfs.c, src/dosext/mfs/mfs.h, src/include/dos2linux.h:
162 + Implement the LFN handle functions int21/ax=5704,5,6,7, and 71a6.
163 + Also avoid using the set attribute ioctl on non-FAT filesystems.
164 +
165 +2007-06-03 Bart
166 +
167 + * [r1824] dist/dosemu:
168 + Correct dosemu script.
169 +
170 + * [r1823] src/plugin/sdl/sdl.c:
171 + Fix SDL video mode chooser if only one mode is available.
172 +
173 + * [r1822] src/plugin/X/X.c:
174 + Fix "dosemu -w" for X and error messages for $DISPLAY not set.
175 +
176 + * [r1821] src/plugin/kbd_unicode/keymaps.c, src/plugin/term/terminal.c:
177 + Prompt if the keyboard layout can't be auto-detected. Initialize the
178 + SLang terminal screen draw routines as late as possible (the first
179 + time something needs to be drawn) so that other error messages can
180 + still be seen on the normal (non-SLang) terminal screen.
181 +
182 + * [r1820] dist/dosemu, dist/dosemu.bindist, dist/dosemu.systemwide,
183 + man/dosemu.bin.1.in, src/arch/linux/Makefile.main,
184 + src/base/init/config.c, src/include/emu.h, src/plugin/X/X.c,
185 + src/plugin/X/X_font.c, src/plugin/term/terminal.c:
186 + Move xset functionality to obtain the X fonts and the terminal < 25
187 + lines warnings from dosemu to dosemu.bin.
188 +
189 +2007-06-01 Bart
190 +
191 + * [r1819] src/base/async/int.c, src/base/bios/int10.c,
192 + src/base/dev/pic/pic.c, src/base/init/config.c,
193 + src/base/init/parser.y.in, src/base/misc/dump.c,
194 + src/dosext/dpmi/dpmi.c, src/dosext/mfs/mfs.c, src/dosext/mfs/mfs.h,
195 + src/dosext/misc/xms.c, src/dosext/net/net/pktnew.c,
196 + src/emu-i386/simx86/cpu-emu.c, src/include/Asm/vm86.h,
197 + src/include/machcompat.h:
198 + Change longs in vm86.h to ints to be consistent between x86-64 and
199 + i386.
200 +
201 + * [r1818] src/base/bios/int10.c, src/env/video/crtcemu.c,
202 + src/env/video/seqemu.c, src/env/video/vgaemu.c:
203 + Fix VESA text modes (fixes SR#1728817).
204 +
205 +2007-05-30 Bart
206 +
207 + * [r1817] src/plugin/commands/generic.S:
208 + Fix preprocessor confusion.
209 +
210 +2007-05-28 Bart
211 +
212 + * [r1816] src/base/async/int.c, src/base/misc/dos2linux.c,
213 + src/dosext/mfs/mangle.h, src/dosext/mfs/util.c,
214 + src/include/dos2linux.h, src/plugin/X/X.c, src/plugin/sdl/sdl.c,
215 + src/plugin/term/terminal.c, src/plugin/translate/include/translate.h,
216 + src/plugin/translate/translate.c:
217 + Better fix for X window titles & UTF-8. The title is now passed to
218 + the plugin using a wchar_t string.
219 +
220 +2007-05-25 Bart
221 +
222 + * [r1815] src/dosext/mfs/lfn.c, src/dosext/mfs/mfs.c,
223 + src/dosext/mfs/mfs.h:
224 + Let find_file report FILE_NOT_FOUND or PATH_NOT_FOUND in an extra
225 + parameter depending on whether the directory where the file to be
226 + searched would be in exists or not.
227 +
228 +2007-05-23 Bart
229 +
230 + * [r1814] src/base/init/parser.y.in, src/dosext/mfs/mfs.c,
231 + src/env/video/vgaemu.c:
232 + Fix a memory leak and some other issues found by Valgrind.
233 +
234 +2007-05-21 Bart
235 +
236 + * [r1813] src/emu-i386/simx86/sigsegv.c:
237 + CPUEMU: do not mix up LDT accesses with emulator page faults, and
238 + translate non-zero based DPMI addresses to the correct pointer.
239 +
240 +2007-05-18 Bart
241 +
242 + * [r1812] etc/global.conf, src/base/init/lexer.l.in,
243 + src/base/init/parser.y.in, src/env/video/vesa.c, src/include/emu.h:
244 + Use vgaemubios_file internally to get the Bochs BIOS to avoid mixing
245 + up with using it with console graphics, and be able to run it in a
246 + non-root console.
247 +
248 + * [r1811] src/doc/README/config, src/plugin/X/screen.c,
249 + src/plugin/kbd_unicode/include/keyb_clients.h,
250 + src/plugin/kbd_unicode/keyb_clients.c,
251 + src/plugin/translate/config/plugin_parser,
252 + src/plugin/translate/include/translate.h,
253 + src/plugin/translate/translate_config.c:
254 + Improve pasting in X into DOSEMU too, trying to ask for UTF-8, then
255 + iso2022, and then iso8859-1. This obsoletes the use of
256 + $_external_char_set for pasting.
257 +
258 + * [r1810] src/base/async/int.c:
259 + Add forgotten init memset of mbstate_t unix_state to 0. Fixes crash
260 + on x86-64.
261 +
262 + * [r1809] src/env/video/text.c, src/include/vgatext.h,
263 + src/plugin/X/screen.c:
264 + Improving pasting text from DOSEMU: follow guidelines about which
265 + character sets to use (in practise we must usually convert to UTF8
266 + nowadays).
267 +
268 + * [r1808] src/plugin/kbd_unicode/keyb_clients.c:
269 + Check for -1 return from character_count (if an invalid multibyte
270 + character string is pasted for example), so DOSEMU won't crash.
271 +
272 + * [r1807] src/base/bios/int10.c:
273 + Add missing semicolon in int10.c
274 +
275 + * [r1806] src/arch/linux/debugger/mhpdbgc.c, src/base/async/int.c,
276 + src/base/misc/disks.c, src/base/misc/fatfs.c,
277 + src/base/misc/userhook.c, src/base/misc/utilities.c,
278 + src/dosext/mfs/lfn.c, src/dosext/mfs/mangle.c,
279 + src/dosext/mfs/mangle.h, src/dosext/mfs/mfs.c,
280 + src/dosext/mfs/mscdex.c, src/dosext/mfs/util.c,
281 + src/include/dos2linux.h, src/include/utilities.h,
282 + src/plugin/commands/builtins.c, src/plugin/commands/commands.c,
283 + src/plugin/commands/dosdbg.c, src/plugin/commands/lredir.c,
284 + src/plugin/commands/msetenv.c, src/plugin/commands/xmode.c:
285 + Force within-ASCII uppercasing for ASCII letters for toupperDOS and
286 + friends. Consistently use toupperDOS etc. functions instead of
287 + toupper etc. to avoid problems with the dotless i as used in Turkish
288 + and some other languages. In fatfs.c convert from the Linux to the
289 + DOS character set, and vice versa for the X title display.
290 +
291 +2007-05-17 Bart
292 +
293 + * [r1805] src/base/bios/bios.S:
294 + Always covert ax=6cxx to 6c00 for the int21/ah=6c LFN->DOS converter.
295 +
296 +2007-05-16 Bart
297 +
298 + * [r1804] src/env/video/vesa.c:
299 + Allow larger Bochs vgabios'es to be used than 32K.
300 +
301 +2007-05-14 Bart
302 +
303 + * [r1803] src/emu-i386/simx86/interp.c:
304 + Implemented lock prefix (either ignored, or illegal op).
305 +
306 +2007-05-13 Bart
307 +
308 + * [r1802] src/emu-i386/simx86/cpu-emu.c:
309 + SIMX86: Don't try to stretch time using RDTSC if $_rdtsc=(off)
310 +
311 + * [r1801] src/emu-i386/simx86/cpu-emu.c, src/emu-i386/simx86/interp.c:
312 + Push IOPL_MASK on the stack for pushf and int. Fixes vm86 mode
313 + detection of DOS4GW when $_dpmi=(off).
314 +
315 + * [r1800] src/arch/linux/async/signal.c:
316 + Revert DPMI-inability detection change from #1799.
317 +
318 + * [r1799] src/arch/linux/async/signal.c,
319 + src/arch/linux/async/sigsegv.c, src/dosext/dpmi/dpmi.c,
320 + src/dosext/dpmi/dpmi.h, src/emu-i386/simx86/sigsegv.c,
321 + src/env/video/vgaemu.c:
322 + When handling signals, check for a valid DPMI selector, which means
323 + that it is an LDT selector and not reserved by glibc or similar, e.g.
324 + for pthreads. Else, and that includes the whole GDT, assume we
325 + interrupt DOSEMU code. SystemSelector() in DPMI now refers to
326 + anything not covered by the above, plus dpmi_sel16 & dpmi_sel32. This
327 + fixes crashes with Xen-DOM0 on x86-64 where cs is 0x33 on entry to
328 + signal handlers but set to 0xe033 after the first syscall.
329 +
330 +2007-05-11 Bart
331 +
332 + * [r1798] src/emu-i386/simx86/interp.c:
333 + Remove (replace by an e_printf) debug code that aborts CPUEMU if 4 or
334 + more 0's in a row are executed. Some .com programs do this to skip
335 + over data (Reinhard Karcher).
336 +
337 + * [r1797] dist/dosemu, src/emu.c:
338 + Moved DOSDRIVE_D environment manipulation from the dosemu script to
339 + dosemu.bin so it also works with sudo.
340 +
341 + * [r1796] src/arch/linux/async/debug.c, src/arch/linux/async/sigsegv.c,
342 + src/base/init/init.c:
343 + Reorganize some debug reporting a bit. uname and the GCC version
344 + number are now always reported in boot.log. Added some bug report
345 + instructions.
346 +
347 + * [r1795] src/plugin/X/X.c, src/plugin/sdl/sdl.c,
348 + src/plugin/term/term_core.c:
349 + Fix terminal init problem (no terminal input running xdosemu) if no
350 + dynamically linked plugins are used.
351 +
352 + * [r1794] default-configure:
353 + Check the default bitness of gcc, instead of blindly relying on
354 + uname.
355 +
356 + * [r1793] src/dosext/dpmi/dpmi.c, src/emu-i386/cpu.c,
357 + src/emu-i386/simx86/sigsegv.c, src/include/emu.h:
358 + Implement some workarounds for the CPU ESP bug. It is unlikely that
359 + it will be worked around in 64-bit kernels. Compare with segment
360 + limits instead of what is supposed to be kernel space (it isn't on
361 + x86-64). Fixes the ancient MS Linker and the Need For Speed demo on
362 + x86-64.
363 +
364 +2007-05-10 Bart
365 +
366 + * [r1792] src/emu-i386/simx86/sigsegv.c:
367 + Do not patch code that has just tried to overwrite code instead of
368 + data. Fixes a crash with Larry.
369 +
370 +2007-05-09 Bart
371 +
372 + * [r1791] src/dosext/mfs/mfs.c:
373 + As the read-only attribute is mostly ignored for directories in DOS,
374 + the dos_would_allow check for writable directories doesn't make much
375 + sense. Instead simply check if the file is writable.
376 +
377 + * [r1790] src/dosext/mfs/mfs.c:
378 + It is possible to work around the x86-64 FAT compat-ioctl kernel bug.
379 + Thanks to Wine.
380 +
381 +2007-05-08 Bart
382 +
383 + * [r1789] src/arch/linux/async/signal.c, src/emu.c:
384 + Force $_cpu_emu="full", and do not crash, if %cs is not saved for
385 + signal handlers on x86-64 (kernels < 2.6.15, #1713659).
386 +
387 + * [r1788] src/arch/linux/dosext/sound/midid/oss.c,
388 + src/arch/linux/dosext/sound/midid/timid.c,
389 + src/plugin/midimisc/mid_o_oss.c:
390 + Declare *seqbuf_dump static before including soundcard.h. Hopefully
391 + that solves all warnings and errors with the variations out there.
392 +
393 + * [r1787] src/plugin/kbd_unicode/keymaps.c:
394 + Do not attempt to load the X plugin if X isn't compiled.
395 +
396 + * [r1786] src/dosext/mfs/lfn.c:
397 + int21/ax=7160/cl=1,2 must return an error if the file does not exist.
398 + Fixes problems with FreeCOM mkdir not preserving the LFN directory
399 + name.
400 +
401 + * [r1785] src/dosext/mfs/mfs.c:
402 + Ignore attempts to translate the archive and read-only attributes to
403 + Unix permissions for directories. Fixes problem with pkunzip (Joe
404 + Ripley, linux-msdos).
405 +
406 +2007-05-07 Bart
407 +
408 + * [r1784] dist/autoexec.bat, dist/config.sys, src/base/async/int.c,
409 + src/plugin/commands/blaster.c:
410 + Reduce lines of output in config.sys, autoexec.bat, blaster, and the
411 + banner, so everything fits on 25 lines.
412 +
413 + * [r1783] src/dosext/mfs/lfn.c:
414 + Fix more illegal writes in the LFN code (crashed DJGPP gcc with
415 + cpuemu=vm86).
416 +
417 +2007-05-06 Bart
418 +
419 + * [r1782] Makefile, Makefile.conf.in, src/Makefile.common,
420 + src/arch/linux/Makefile.main, src/commands/Makefile:
421 + Speed up 'make' a bit: - don't use bash anymore; remove bash-isms and
422 + eliminate pwd -P - don't use the intermediate tmp directory for make
423 + install anymore - use -rR make flags to ignore built-ins and made
424 + some built-ins explicit
425 +
426 + * [r1781] configure, configure.ac, src/plugin/kbd_unicode/configure,
427 + src/plugin/sdl/configure:
428 + Execute sub-configures by hand to avoid autoconf warnings and
429 + possible future breakage.
430 +
431 + * [r1780] Makefile.conf.in, configure, configure.ac, default-configure:
432 + Allow dash to be used as sh in out-of-tree builds.
433 +
434 + * [r1779] Makefile.conf.in:
435 + Do not forget sndfile and alsa libraries when building without
436 + dynamically loaded plugins.
437 +
438 + * [r1778] src/base/bios/int10.c:
439 + Implement INT10/AH=1c (save/restore video state)
440 +
441 2007-05-05 Bart
442
443 - * [r1776] NEWS, ChangeLog, dist/config.sys, dist/mkbindist
444 - Last minute fix for 1.4.0: fix #1713278 COMSPEC setting wrong.
445 - Use config.sys/autoexec.bat distributed from here in the bindist
446 - instead of the one in dosemu-freedos-*-bin*.
447 + * [r1776] ChangeLog, NEWS, dist/config.sys, dist/dosemu.bindist,
448 + dist/mkbindist:
449 + Last minute fix for 1.4.0: fix #1713278 COMSPEC setting wrong. Use
450 + config.sys/autoexec.bat distributed from here in the bindist instead
451 + of the one in dosemu-freedos-*-bin*.
452
453 * [r1775] NEWS, ChangeLog:
454 Release 1.4.0.
455 diff -urN dosemu-1.4.0/configure dosemu-1.4.0.1/configure
456 --- dosemu-1.4.0/configure 2007-05-03 02:26:28.000000000 -0400
457 +++ dosemu-1.4.0.1/configure 2008-03-27 11:39:49.000000000 -0400
458 @@ -704,7 +704,6 @@
459 RELEASE_DATE
460 USE_MHPDBG
461 DEBUGGER
462 -subdirs
463 ASPI_SUPPORT
464 USE_SBEMU
465 OPTIONALSUBDIRS
466 @@ -728,7 +727,7 @@
467 YACC
468 YFLAGS
469 XMKMF'
470 -ac_subdirs_all='`touch ./plugin_configure; cat ./plugin_configure`'
471 +
472
473 # Initialize some variables set by options.
474 ac_init_help=
475 @@ -8869,7 +8868,8 @@
476 ln -sf ../../$j plugin/include/`basename $j`
477 done
478 else
479 - for j in $srcdir/src/$i/*.h; do
480 + abssrcdir=`cd .. && cd $srcdir && pwd`
481 + for j in $abssrcdir/src/$i/*.h; do
482 ln -sf $j plugin/include/`basename $j`
483 done
484 fi
485 @@ -8885,9 +8885,6 @@
486 echo "$as_me: Compiling without plug-ins..." >&6;}
487 fi
488
489 -subdirs="$subdirs `touch ./plugin_configure; cat ./plugin_configure`"
490 -
491 -
492 # Check whether --enable-debug was given.
493 if test "${enable_debug+set}" = set; then
494 enableval=$enable_debug;
495 @@ -9999,13 +9996,13 @@
496 RELEASE_DATE!$RELEASE_DATE$ac_delim
497 USE_MHPDBG!$USE_MHPDBG$ac_delim
498 DEBUGGER!$DEBUGGER$ac_delim
499 -subdirs!$subdirs$ac_delim
500 ASPI_SUPPORT!$ASPI_SUPPORT$ac_delim
501 USE_SBEMU!$USE_SBEMU$ac_delim
502 OPTIONALSUBDIRS!$OPTIONALSUBDIRS$ac_delim
503 REQUIRED!$REQUIRED$ac_delim
504 PLUGINSUBDIRS!$PLUGINSUBDIRS$ac_delim
505 INCDIR!$INCDIR$ac_delim
506 +X86_EMULATOR!$X86_EMULATOR$ac_delim
507 _ACEOF
508
509 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
510 @@ -10047,13 +10044,12 @@
511 ac_delim='%!_!# '
512 for ac_last_try in false false false false false :; do
513 cat >conf$$subs.sed <<_ACEOF
514 -X86_EMULATOR!$X86_EMULATOR$ac_delim
515 ASM_PEDANTIC!$ASM_PEDANTIC$ac_delim
516 LIBOBJS!$LIBOBJS$ac_delim
517 LTLIBOBJS!$LTLIBOBJS$ac_delim
518 _ACEOF
519
520 - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 4; then
521 + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 3; then
522 break
523 elif $ac_last_try; then
524 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
525 @@ -10457,10 +10453,11 @@
526
527 case $ac_file$ac_mode in
528 "Makefile":C) if ! test -f configure.ac; then
529 - mkdir -p `(cd $srcdir; find . -type d)`
530 - for i in `(cd $srcdir; find . -name Makefile)`; do
531 - echo ln -sf $srcdir/$i $i
532 - ln -sf $srcdir/$i $i
533 + abssrcdir=`cd $srcdir && pwd`
534 + mkdir -p `(cd $abssrcdir; find . -name .svn -prune -o -name CVS -prune -o -type d -print)`
535 + for i in `(cd $abssrcdir; find . -name Makefile)`; do
536 + echo ln -sf $abssrcdir/$i $i
537 + ln -sf $abssrcdir/$i $i
538 done
539 fi
540 ;;
541 @@ -10496,186 +10493,21 @@
542 $ac_cs_success || { (exit 1); exit 1; }
543 fi
544
545 -#
546 -# CONFIG_SUBDIRS section.
547 -#
548 -if test "$no_recursion" != yes; then
549 -
550 - # Remove --cache-file and --srcdir arguments so they do not pile up.
551 - ac_sub_configure_args=
552 - ac_prev=
553 - eval "set x $ac_configure_args"
554 - shift
555 - for ac_arg
556 - do
557 - if test -n "$ac_prev"; then
558 - ac_prev=
559 - continue
560 - fi
561 - case $ac_arg in
562 - -cache-file | --cache-file | --cache-fil | --cache-fi \
563 - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
564 - ac_prev=cache_file ;;
565 - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
566 - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
567 - | --c=*)
568 - ;;
569 - --config-cache | -C)
570 - ;;
571 - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
572 - ac_prev=srcdir ;;
573 - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
574 - ;;
575 - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
576 - ac_prev=prefix ;;
577 - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
578 - ;;
579 - *)
580 - case $ac_arg in
581 - *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
582 - esac
583 - ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
584 - esac
585 - done
586 -
587 - # Always prepend --prefix to ensure using the same prefix
588 - # in subdir configurations.
589 - ac_arg="--prefix=$prefix"
590 - case $ac_arg in
591 - *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
592 - esac
593 - ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args"
594
595 - # Pass --silent
596 - if test "$silent" = yes; then
597 - ac_sub_configure_args="--silent $ac_sub_configure_args"
598 +#AC_CONFIG_SUBDIRS(`touch ./plugin_configure; cat ./plugin_configure`)
599 +for i in `touch ./plugin_configure; cat ./plugin_configure`; do
600 + popdir=`pwd`
601 + if test -f ../configure.ac; then
602 + abs_i=$i
603 + else
604 + abs_i=`cd $srcdir && pwd`/$i
605 fi
606 -
607 - ac_popdir=`pwd`
608 - for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
609 -
610 - # Do not complain, so a configure script can configure whichever
611 - # parts of a large source tree are present.
612 - test -d "$srcdir/$ac_dir" || continue
613 -
614 - ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
615 - echo "$as_me:$LINENO: $ac_msg" >&5
616 - echo "$ac_msg" >&6
617 - { as_dir="$ac_dir"
618 - case $as_dir in #(
619 - -*) as_dir=./$as_dir;;
620 - esac
621 - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
622 - as_dirs=
623 - while :; do
624 - case $as_dir in #(
625 - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
626 - *) as_qdir=$as_dir;;
627 - esac
628 - as_dirs="'$as_qdir' $as_dirs"
629 - as_dir=`$as_dirname -- "$as_dir" ||
630 -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
631 - X"$as_dir" : 'X\(//\)[^/]' \| \
632 - X"$as_dir" : 'X\(//\)$' \| \
633 - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
634 -echo X"$as_dir" |
635 - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
636 - s//\1/
637 - q
638 - }
639 - /^X\(\/\/\)[^/].*/{
640 - s//\1/
641 - q
642 - }
643 - /^X\(\/\/\)$/{
644 - s//\1/
645 - q
646 - }
647 - /^X\(\/\).*/{
648 - s//\1/
649 - q
650 - }
651 - s/.*/./; q'`
652 - test -d "$as_dir" && break
653 - done
654 - test -z "$as_dirs" || eval "mkdir $as_dirs"
655 - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
656 -echo "$as_me: error: cannot create directory $as_dir" >&2;}
657 - { (exit 1); exit 1; }; }; }
658 - ac_builddir=.
659 -
660 -case "$ac_dir" in
661 -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
662 -*)
663 - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
664 - # A ".." for each directory in $ac_dir_suffix.
665 - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
666 - case $ac_top_builddir_sub in
667 - "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
668 - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
669 - esac ;;
670 -esac
671 -ac_abs_top_builddir=$ac_pwd
672 -ac_abs_builddir=$ac_pwd$ac_dir_suffix
673 -# for backward compatibility:
674 -ac_top_builddir=$ac_top_build_prefix
675 -
676 -case $srcdir in
677 - .) # We are building in place.
678 - ac_srcdir=.
679 - ac_top_srcdir=$ac_top_builddir_sub
680 - ac_abs_top_srcdir=$ac_pwd ;;
681 - [\\/]* | ?:[\\/]* ) # Absolute name.
682 - ac_srcdir=$srcdir$ac_dir_suffix;
683 - ac_top_srcdir=$srcdir
684 - ac_abs_top_srcdir=$srcdir ;;
685 - *) # Relative name.
686 - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
687 - ac_top_srcdir=$ac_top_build_prefix$srcdir
688 - ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
689 -esac
690 -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
691 -
692 -
693 - cd "$ac_dir"
694 -
695 - # Check for guested configure; otherwise get Cygnus style configure.
696 - if test -f "$ac_srcdir/configure.gnu"; then
697 - ac_sub_configure=$ac_srcdir/configure.gnu
698 - elif test -f "$ac_srcdir/configure"; then
699 - ac_sub_configure=$ac_srcdir/configure
700 - elif test -f "$ac_srcdir/configure.in"; then
701 - # This should be Cygnus configure.
702 - ac_sub_configure=$ac_aux_dir/configure
703 - else
704 - { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5
705 -echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;}
706 - ac_sub_configure=
707 - fi
708 -
709 - # The recursion is here.
710 - if test -n "$ac_sub_configure"; then
711 - # Make the cache file name correct relative to the subdirectory.
712 - case $cache_file in
713 - [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;;
714 - *) # Relative name.
715 - ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
716 - esac
717 -
718 - { echo "$as_me:$LINENO: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
719 -echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
720 - # The eval makes quoting arguments work.
721 - eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
722 - --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
723 - { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5
724 -echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;}
725 - { (exit 1); exit 1; }; }
726 - fi
727 -
728 - cd "$ac_popdir"
729 - done
730 -fi
731 -
732 + cd $i
733 + echo "=== configuring in $i"
734 + echo "Running $SHELL $abs_i/configure $ac_configure_args ..."
735 + eval ${SHELL} $abs_i/configure $ac_configure_args
736 + cd $popdir
737 +done
738
739
740 if test "$GCC" != "yes" ; then
741 diff -urN dosemu-1.4.0/configure.ac dosemu-1.4.0.1/configure.ac
742 --- dosemu-1.4.0/configure.ac 2007-05-04 01:59:48.000000000 -0400
743 +++ dosemu-1.4.0.1/configure.ac 2008-03-27 11:39:49.000000000 -0400
744 @@ -467,7 +467,8 @@
745 ln -sf ../../$j plugin/include/`basename $j`
746 done
747 else
748 - for j in $srcdir/src/$i/*.h; do
749 + abssrcdir=`cd .. && cd $srcdir && pwd`
750 + for j in $abssrcdir/src/$i/*.h; do
751 ln -sf $j plugin/include/`basename $j`
752 done
753 fi
754 @@ -481,9 +482,6 @@
755 AC_MSG_NOTICE(Compiling without plug-ins...)
756 fi
757
758 -dnl Setup to run plugin configure scripts
759 -AC_CONFIG_SUBDIRS(`touch ./plugin_configure; cat ./plugin_configure`)
760 -
761 dnl Do compilation for GDB
762 AC_ARG_ENABLE(debug,
763 [ --enable-debug compile with debug info])
764 @@ -706,10 +704,11 @@
765
766 AC_CONFIG_COMMANDS([Makefile],
767 [ if ! test -f configure.ac; then
768 - mkdir -p `(cd $srcdir; find . -type d)`
769 - for i in `(cd $srcdir; find . -name Makefile)`; do
770 - echo ln -sf $srcdir/$i $i
771 - ln -sf $srcdir/$i $i
772 + abssrcdir=`cd $srcdir && pwd`
773 + mkdir -p `(cd $abssrcdir; find . -name .svn -prune -o -name CVS -prune -o -type d -print)`
774 + for i in `(cd $abssrcdir; find . -name Makefile)`; do
775 + echo ln -sf $abssrcdir/$i $i
776 + ln -sf $abssrcdir/$i $i
777 done
778 fi
779 ])
780 @@ -909,6 +908,24 @@
781
782 AC_OUTPUT
783
784 +dnl Run plugin configure scripts
785 +dnl AC_CONFIG_SUBDIRS requires literal which doesn't work too well
786 +dnl with our approach
787 +#AC_CONFIG_SUBDIRS(`touch ./plugin_configure; cat ./plugin_configure`)
788 +for i in `touch ./plugin_configure; cat ./plugin_configure`; do
789 + popdir=`pwd`
790 + if test -f ../configure.ac; then
791 + abs_i=$i
792 + else
793 + abs_i=`cd $srcdir && pwd`/$i
794 + fi
795 + cd $i
796 + echo "=== configuring in $i"
797 + echo "Running $SHELL $abs_i/configure $ac_configure_args ..."
798 + eval ${SHELL} $abs_i/configure $ac_configure_args
799 + cd $popdir
800 +done
801 +
802 dnl Print some warnings (if neccessary)
803
804 if test "$GCC" != "yes" ; then
805 diff -urN dosemu-1.4.0/default-configure dosemu-1.4.0.1/default-configure
806 --- dosemu-1.4.0/default-configure 2006-12-10 09:03:24.000000000 -0500
807 +++ dosemu-1.4.0.1/default-configure 2007-05-10 20:40:09.000000000 -0400
808 @@ -1,4 +1,4 @@
809 -#! /bin/bash
810 +#! /bin/sh
811
812 if [ -n "$DOSEMU_DEFAULT_CONFIGURE" ] ; then
813 exit 0
814 @@ -91,9 +91,13 @@
815 ;;
816 target_bits)
817 if [ "$2" != "auto" ]; then
818 - if uname -m | grep 64 > /dev/null; then
819 - if [ "$2" = "32" ]; then
820 - STRING="$STRING --with-target-bits=32";
821 + if uname -m | grep -q 64; then
822 + otherbits=64
823 + if cpp -dM /dev/null | grep -q __x86_64__; then
824 + otherbits=32
825 + fi
826 + if [ "$2" = "$otherbits" ]; then
827 + STRING="$STRING --with-target-bits=$otherbits";
828 fi
829 elif [ "$2" = "64" ]; then
830 # cross compilation on pure 32-bit machines
831 diff -urN dosemu-1.4.0/dist/autoexec.bat dosemu-1.4.0.1/dist/autoexec.bat
832 --- dosemu-1.4.0/dist/autoexec.bat 2006-11-12 18:05:37.000000000 -0500
833 +++ dosemu-1.4.0.1/dist/autoexec.bat 2007-05-06 23:09:39.000000000 -0400
834 @@ -7,6 +7,7 @@
835 prompt $P$G
836 unix -s DOSDRIVE_D
837 if "%DOSDRIVE_D%" == "" goto nodrived
838 +lredir del d: > nul
839 lredir d: linux\fs%DOSDRIVE_D%
840 :nodrived
841 rem uncomment to load another bitmap font
842 diff -urN dosemu-1.4.0/dist/config.sys dosemu-1.4.0.1/dist/config.sys
843 --- dosemu-1.4.0/dist/config.sys 2007-05-05 11:39:58.000000000 -0400
844 +++ dosemu-1.4.0.1/dist/config.sys 2007-05-06 23:09:39.000000000 -0400
845 @@ -7,7 +7,7 @@
846 files=40
847 stacks=0
848 buffers=10
849 -devicehigh=d:\dosemu\ems.sys
850 +device=d:\dosemu\ems.sys
851 devicehigh=d:\dosemu\cdrom.sys
852 install=d:\dosemu\lredir.com z: linux\fs\${DOSEMU_LIB_DIR}/drive_z ro
853 shellhigh=z:\command.com /e:1024 /p
854 diff -urN dosemu-1.4.0/dist/dosemu dosemu-1.4.0.1/dist/dosemu
855 --- dosemu-1.4.0/dist/dosemu 2007-05-04 01:59:48.000000000 -0400
856 +++ dosemu-1.4.0.1/dist/dosemu 2007-06-03 03:13:10.000000000 -0400
857 @@ -73,6 +73,10 @@
858 esac
859 done
860
861 +if [ -z "$QUIET" ]; then
862 + SUFFIX="$SUFFIX \"-p\""
863 +fi
864 +
865 mkdir -p ~/.dosemu
866 BPATH_FILE=~/.dosemu/bindist_path
867
868 @@ -103,79 +107,6 @@
869 fi
870 fi
871
872 -if [ -n "$XFLAG" -o -n "$DISPLAY" -a -z "$DUMBTERM" ]; then
873 - if [ -z "$DISPLAY" ]; then
874 - echo "
875 - You do not have the DISPLAY variable set, but want to run DOSEMU
876 - in its own X-window. Set the DISPLAY variable such as
877 -
878 - DISPLAY=:0.0; export DISPLAY
879 -
880 - if running X locally or
881 -
882 - DISPLAY=host:0.0; export DISPLAY
883 -
884 - when running remotely ('host' being the machine where you are typing at)
885 -
886 - After this run xdosemu again.
887 -"
888 - exit 1
889 - fi
890 -
891 - if [ -f $HOME/.dosemurc ]; then
892 - FONT=`grep '$_X_font' $HOME/.dosemurc | \
893 - sed -e 's|[#[:space:]]*\$_X_font[[:space:]]*=[[:space:]]*\"\(.*\)\".*|\1|'`
894 - fi
895 -
896 - if [ "$FONT" = "" -a -n "$SYSTEM_CONF_PATH" -a -f $SYSTEM_CONF_PATH/dosemu.conf ]; then
897 - FONT=`grep '$_X_font' $SYSTEM_CONF_PATH/dosemu.conf | \
898 - sed -e 's|[#[:space:]]*\$_X_font[[:space:]]*=[[:space:]]*\"\(.*\)\".*|\1|'`
899 - fi
900 -
901 - if [ "$FONT" = "" ]; then
902 - FONT="vga"
903 - fi
904 -
905 - if [ "`xlsfonts -o -fn $FONT 2>/dev/null`" = "" ]; then
906 - if ! xset +fp $SYSTEM_XFONTS_PATH 2>/dev/null; then
907 - # messed up font path -- last resort
908 - xset fp default
909 - xset +fp $SYSTEM_XFONTS_PATH 2>/dev/null
910 - fi
911 - xset fp rehash
912 - fi
913 - if [ "`xlsfonts -o -fn $FONT 2>/dev/null`" = "" ]; then
914 - echo "
915 - You do not have the DOSEMU $FONT font installed and are running
916 - remote X. You need to install the $FONT font on your _local_ Xserver.
917 - Look at the readme for details. For now we start with an fixed font,
918 - which does not display all national characters correctly.
919 - ... be warned
920 -"
921 - fi
922 -else
923 - if test -z "$LINES" -o -z "$COLUMNS" ; then
924 - eval `stty size 2>/dev/null | (read L C; \
925 - echo LINES=${L:-24} COLUMNS=${C:-80})`
926 - fi
927 - test $LINES -eq 0 && LINES=24
928 - test $COLUMNS -eq 0 && COLUMNS=80
929 - if [ $LINES -lt 25 -a -z "$DUMBTERM" -a -z "$QUIET" ]; then
930 - echo "
931 - Note that DOS needs 25 lines. You might want to enlarge your
932 - window before continuing.
933 -"
934 - echo
935 - echo " Now type ENTER to start DOSEMU or <Ctrl>C to cancel"
936 - read dummy
937 - fi
938 -fi
939 -
940 -if [ -z "$DOSDRIVE_D" ]; then
941 - DOSDRIVE_D="$HOME"
942 - export DOSDRIVE_D
943 -fi
944 -
945 if [ `id -ur` = 0 -a -f $HOME/.dosemurc ]; then
946 # User is logged in as root. Need to check whether the config files
947 # are safe and not world writeable
948 diff -urN dosemu-1.4.0/dist/dosemu.bindist dosemu-1.4.0.1/dist/dosemu.bindist
949 --- dosemu-1.4.0/dist/dosemu.bindist 2007-05-05 11:39:58.000000000 -0400
950 +++ dosemu-1.4.0.1/dist/dosemu.bindist 2007-06-03 00:06:39.000000000 -0400
951 @@ -5,8 +5,6 @@
952 # for details see file COPYING.DOSEMU in the DOSEMU distribution
953 #
954
955 -SYSTEM_CONF_PATH=""
956 -
957 install_dos () {
958 if [ -n "$INSTALL" -o \
959 ! -e $HOME/.dosemu/drives/c -o \
960 @@ -53,7 +51,6 @@
961 if [ ! -f $BOOT_DIR_PATH/Xfonts/fonts.dir ]; then
962 (cd $BOOT_DIR_PATH/Xfonts; mkfontdir)
963 fi
964 - SYSTEM_XFONTS_PATH=$BOOT_DIR_PATH/Xfonts
965 fi
966 SUFFIX="$SUFFIX --Flibdir $BOOT_DIR_PATH"
967 }
968 diff -urN dosemu-1.4.0/dist/dosemu.systemwide dosemu-1.4.0.1/dist/dosemu.systemwide
969 --- dosemu-1.4.0/dist/dosemu.systemwide 2007-05-04 01:59:48.000000000 -0400
970 +++ dosemu-1.4.0.1/dist/dosemu.systemwide 2007-06-03 00:06:39.000000000 -0400
971 @@ -6,8 +6,6 @@
972 #
973
974 # the below lines get patched, when a systemwide install is done
975 -SYSTEM_CONF_PATH=NOT_SYSTEM_WIDE
976 -SYSTEM_XFONTS_PATH=NOT_SYSTEM_WIDE
977 SYSTEM_BIN_PATH=NOT_SYSTEM_WIDE
978
979 get_binary() {
980 diff -urN dosemu-1.4.0/etc/global.conf dosemu-1.4.0.1/etc/global.conf
981 --- dosemu-1.4.0/etc/global.conf 2006-11-29 05:05:27.000000000 -0500
982 +++ dosemu-1.4.0.1/etc/global.conf 2007-06-04 23:56:21.000000000 -0400
983 @@ -300,7 +300,7 @@
984 $yyy = (strstr($_X_winsize,","))
985 $yyy = " winsize (", strdel($_X_winsize,$yyy,999), ") , (",
986 strsplit($_X_winsize,$yyy+1,999), ")"
987 - $xxx = $xxx, " X_winsize '", $yyy, "'"
988 + $xxx = $xxx, $yyy
989 endif
990
991 if (strlen($_X_vesamode))
992 @@ -311,7 +311,7 @@
993 done
994 endif
995 $xxx = $xxx, ' mgrab_key "', $_X_mgrab_key, '"'
996 - warn "x keycode ", $xxx
997 + warn "x ", $xxx
998 X {
999 title $_X_title title_show_appname $_X_title_show_appname
1000 icon_name $_X_icon_name
1001 @@ -333,10 +333,11 @@
1002 $xxx = $xxx, " chipset ", $yyy
1003 if ($_vbios_post) $xxx = $xxx, " vbios_post " endif
1004 if ($_dualmon) $xxx = $xxx, " dualmon" endif
1005 + if (strlen($_vbios_file)) $xxx = $xxx, " vgaemubios_file ", $_vbios_file endif
1006 video { $$xxx }
1007 else
1008 $xxx = $_video
1009 - if (strlen($_vbios_file)) $xxx = $xxx, " vbios_file ", $_vbios_file endif
1010 + if (strlen($_vbios_file)) $xxx = $xxx, " vgaemubios_file ", $_vbios_file endif
1011 if ($_dualmon) $xxx = $xxx, " dualmon " endif
1012 if (strlen($xxx)) video { $$xxx } endif
1013 endif
1014 diff -urN dosemu-1.4.0/Makefile dosemu-1.4.0.1/Makefile
1015 --- dosemu-1.4.0/Makefile 2007-05-04 01:59:48.000000000 -0400
1016 +++ dosemu-1.4.0.1/Makefile 2008-03-26 15:52:17.000000000 -0400
1017 @@ -12,6 +12,7 @@
1018
1019 srcdir=.
1020 top_builddir=.
1021 +SUBDIR:=.
1022 -include Makefile.conf
1023
1024 Makefile.conf: $(srcdir)/Makefile.conf.in $(srcdir)/configure $(srcdir)/default-configure
1025 @@ -22,22 +23,22 @@
1026 @$(MAKE) -C src $@
1027
1028 dosbin:
1029 - @$(MAKE) -C src/commands dosbin
1030 + @$(MAKE) SUBDIR:=commands -C src/commands dosbin
1031
1032 docs:
1033 - @$(MAKE) -C src/doc all
1034 + @$(MAKE) SUBDIR:=doc -C src/doc all
1035
1036 docsinstall:
1037 - @$(MAKE) -C src/doc install
1038 + @$(MAKE) SUBDIR:=doc -C src/doc install
1039
1040 docsclean:
1041 - @$(MAKE) -C src/doc clean
1042 + @$(MAKE) SUBDIR:=doc -C src/doc clean
1043
1044 midid:
1045 - @$(MAKE) -C src/arch/linux/dosext/sound/midid
1046 + @$(MAKE) SUBDIR:=arch/linux/dosext/sound/midid -C src/arch/linux/dosext/sound/midid
1047
1048 mididclean:
1049 - @$(MAKE) -C src/arch/linux/dosext/sound/midid cleanall
1050 + @$(MAKE) SUBDIR:=arch/linux/dosext/sound/midid -C src/arch/linux/dosext/sound/midid cleanall
1051
1052 dosemu_script:
1053 @$(MAKE) -C src dosemu_script
1054 @@ -48,6 +49,7 @@
1055 rm -f core `find . -name config.cache`
1056 rm -f core `find . -name config.status`
1057 rm -f core `find . -name config.log`
1058 + rm -f core `find . -name configure.lineno`
1059 rm -f src/include/config.h
1060 rm -f src/include/confpath.h
1061 rm -f src/include/plugin_*.h
1062 diff -urN dosemu-1.4.0/Makefile.conf.in dosemu-1.4.0.1/Makefile.conf.in
1063 --- dosemu-1.4.0/Makefile.conf.in 2007-05-04 01:59:48.000000000 -0400
1064 +++ dosemu-1.4.0.1/Makefile.conf.in 2007-05-06 15:48:25.000000000 -0400
1065 @@ -7,14 +7,13 @@
1066 #
1067 # This file is included by all Makefiles
1068
1069 -SHELL = /bin/bash
1070 -
1071 DOSBIN = dosemu.bin
1072
1073 prefix:=@prefix@
1074 bindir:=@bindir@
1075 sysconfdir:=@sysconfdir@
1076 libdir:=@libdir@
1077 +datarootdir:=@datarootdir@
1078 datadir:=@datadir@
1079 mandir:=@mandir@
1080 docdir:=@docdir@
1081 @@ -23,9 +22,9 @@
1082 fdtarball:=@fdtarball@
1083 abs_top_srcdir:=@abs_top_srcdir@
1084 ifeq (0,${MAKELEVEL})
1085 - export abs_top_builddir:=$(shell cd $(top_builddir) && pwd -P)
1086 - SUBDIR := $(subst $(abs_top_builddir)/src/,,$(shell pwd -P))
1087 -else
1088 + SUBDIR := $(subst $(shell cd $(top_builddir) && pwd)/src/,,$(shell pwd))
1089 + # don't use built-in rules and variables for faster builds
1090 + MAKEFLAGS += -rR
1091 endif
1092 PACKAGE_VERSION:=@PACKAGE_VERSION@
1093 RELEASE_DATE:=@RELEASE_DATE@
1094 @@ -38,11 +37,16 @@
1095 srcdir:=.
1096 else
1097 top_srcdir:=$(abs_top_srcdir)
1098 - srcdir:=$(abs_top_srcdir)$(subst $(abs_top_builddir),,$(shell pwd -P))
1099 + ifeq ("$(top_builddir)",".")
1100 + srcdir:=$(abs_top_srcdir)
1101 + else
1102 + srcdir:=$(abs_top_srcdir)/src/$(SUBDIR)
1103 + endif
1104 INCDIR += -I${top_srcdir}/src/include
1105 endif
1106
1107 CFLAGS:=@CFLAGS@
1108 +ASFLAGS:=
1109 CPPFLAGS:=@CPPFLAGS@ ${INCDIR}
1110 X_CPPFLAGS:=@X_CFLAGS@
1111 SLANGINC:=@SLANGINC@
1112 @@ -112,6 +116,6 @@
1113 ifdef USE_DL_PLUGINS
1114 DL_CFLAGS:=-fPIC
1115 else
1116 -LIBS:=$(LIBS) $(SLANGLIB) $(X_LIBS) $(GPMLIB)
1117 +LIBS:=$(LIBS) $(SLANGLIB) $(X_LIBS) $(GPMLIB) $(ALSALIB) $(SNDFLIB)
1118 -include $(top_builddir)/src/plugin/*/Makefile.conf
1119 endif
1120 diff -urN dosemu-1.4.0/man/dosemu.bin.1.in dosemu-1.4.0.1/man/dosemu.bin.1.in
1121 --- dosemu-1.4.0/man/dosemu.bin.1.in 2007-05-03 22:31:34.000000000 -0400
1122 +++ dosemu-1.4.0.1/man/dosemu.bin.1.in 2007-06-03 00:06:39.000000000 -0400
1123 @@ -5,7 +5,7 @@
1124 .SH SYNOPSIS
1125 .B dosemu.bin
1126 [
1127 -.B \-234ABCcdKkmNnOSstVwX
1128 +.B \-234ABCcdKkmNnOpSstVwX
1129 ]
1130 [
1131 .B \-h
1132 @@ -271,6 +271,9 @@
1133 .I -P
1134 copy debugging output to FILE
1135 .TP
1136 +.I -p
1137 +stop for prompting if a non-fatal configuration problem is detected
1138 +.TP
1139 .I -S
1140 run using SDL
1141 .TP
1142 diff -urN dosemu-1.4.0/NEWS dosemu-1.4.0.1/NEWS
1143 --- dosemu-1.4.0/NEWS 2007-05-05 11:39:58.000000000 -0400
1144 +++ dosemu-1.4.0.1/NEWS 2008-03-27 12:16:38.000000000 -0400
1145 @@ -4,6 +4,38 @@
1146 This file contains a list of user visible changes in DOSEMU. For the
1147 raw developer changelog please refer to ChangeLog.
1148
1149 +Version 1.4.1 (2008-xx-xx)
1150 +=============
1151 +* Bug fixes, especially pertaining to the CPU emulator that is used in the
1152 + x86-64 port (also in combination with Xen), and for DPMI on x86-64.
1153 +* Better LFN support.
1154 +* Optionally prompt if the keyboard layout can't be auto-detected.
1155 +* Some things previously done by the dosemu script are now done by the
1156 + dosemu.bin binary (X font locations, terminal warnings,
1157 + DOSDRIVE_D environment variable handling).
1158 +* Handle UTF-8 in window titles.
1159 +* Improved copy and paste of text to and from DOSEMU.
1160 +* Avoid problems with the dotless i as used in Turkish and some other
1161 + languages.
1162 +* Reduce lines of output in config.sys, autoexec.bat, blaster, and the
1163 + banner, so everything fits on 25 lines.
1164 +
1165 +List of SourceForge tracker numbers with bugs that were closed:
1166 +
1167 +#1683073 P: handle 16bit address overflow in string instructions (simulator)
1168 +#1713659 Error Encountered on DOSEMU 1.4.0
1169 +#1728817 SR: 132character screen ?
1170 +#1729556 Added some diagnostics to check for UTF-8 terminal mismatches.
1171 +#1763166 P: CPU emu: ignore access to unknown VGA ports.
1172 +#1763169 P: CPU emu: handle prefixed jumps correctly.
1173 +#1763170 P: CPU emu: implement INTO correctly.
1174 +#1800717 P: cpuemu: BOUND is signed.
1175 +#1801411 Running File Wizard crashes DOSEMU 1.4.0.0.
1176 +#1910153 P: SkyRoads failure: JIT fails some self-modifying code
1177 +#1910415 P: Fix Non-VESA SVGA video (partly fixes #1806787:
1178 + Moraff's World high-res video bug(s))
1179 +#1910535 P: fix for "e_vgaemu_fault corrupts eip/rip"
1180 +
1181 Version 1.4.0 (2007-05-05)
1182 =============
1183 * Documentation updates.
1184 diff -urN dosemu-1.4.0/src/arch/linux/async/debug.c dosemu-1.4.0.1/src/arch/linux/async/debug.c
1185 --- dosemu-1.4.0/src/arch/linux/async/debug.c 2006-11-18 07:00:29.000000000 -0500
1186 +++ dosemu-1.4.0.1/src/arch/linux/async/debug.c 2007-05-11 02:28:16.000000000 -0400
1187 @@ -87,9 +87,7 @@
1188 char *cmd0 = "ldd %s";
1189 char *cmd1 = "getconf GNU_LIBC_VERSION";
1190 char *cmd2 = "getconf GNU_LIBPTHREAD_VERSION";
1191 - char *cmd3 = "gcc -v";
1192 - char *cmd4 = "uname -a";
1193 - char *cmd5 = "cat /proc/%i/maps";
1194 + char *cmd3 = "cat /proc/%i/maps";
1195 char *tmp;
1196
1197 printf("System info:\n");
1198 @@ -99,9 +97,7 @@
1199 free(tmp);
1200 system(cmd1);
1201 system(cmd2);
1202 - system(cmd3);
1203 - system(cmd4);
1204 - asprintf(&tmp, cmd5, pid);
1205 + asprintf(&tmp, cmd3, pid);
1206 system(tmp);
1207 free(tmp);
1208 print_trace();
1209 diff -urN dosemu-1.4.0/src/arch/linux/async/signal.c dosemu-1.4.0.1/src/arch/linux/async/signal.c
1210 --- dosemu-1.4.0/src/arch/linux/async/signal.c 2007-05-04 01:59:48.000000000 -0400
1211 +++ dosemu-1.4.0.1/src/arch/linux/async/signal.c 2007-05-13 00:07:08.000000000 -0400
1212 @@ -348,6 +348,20 @@
1213 _ss = getsegment(ss);
1214 _fs = getsegment(fs);
1215 _gs = getsegment(gs);
1216 + if (config.cpuemu > 3) {
1217 + _cs = getsegment(cs);
1218 + } else if (_cs == 0) {
1219 + if (config.dpmi) {
1220 + fprintf(stderr, "Cannot run DPMI code natively ");
1221 + if (kernel_version_code < 0x20600 + 15)
1222 + fprintf(stderr, "because your Linux kernel is older than version 2.6.15.\n");
1223 + else
1224 + fprintf(stderr, "for unknown reasons.\nPlease contact linux-msdos@vger.kernel.org.\n");
1225 + fprintf(stderr, "Set $_cpu_emu=\"full\" or \"fullsim\" to avoid this message.\n");
1226 + }
1227 + config.cpuemu = 4;
1228 + _cs = getsegment(cs);
1229 + }
1230 }
1231 #endif
1232
1233 @@ -366,7 +380,7 @@
1234 return;
1235 }
1236
1237 - if (scp && _cs == getsegment(cs)) return;
1238 + if (scp && !DPMIValidSelector(_cs)) return;
1239
1240 /* else interrupting DPMI code with an LDT %cs */
1241
1242 diff -urN dosemu-1.4.0/src/arch/linux/async/sigsegv.c dosemu-1.4.0.1/src/arch/linux/async/sigsegv.c
1243 --- dosemu-1.4.0/src/arch/linux/async/sigsegv.c 2007-05-04 01:59:48.000000000 -0400
1244 +++ dosemu-1.4.0.1/src/arch/linux/async/sigsegv.c 2007-12-06 10:56:46.000000000 -0500
1245 @@ -59,7 +59,7 @@
1246 if (fault_cnt > 1) {
1247 error("Fault handler re-entered! signal=%i _trapno=0x%lX\n",
1248 signal, _trapno);
1249 - if (!in_vm86 && _cs == getsegment(cs)) {
1250 + if (!in_vm86 && !DPMIValidSelector(_cs)) {
1251 /* TODO - we can start gdb here */
1252 /* start_gdb() */
1253 } else {
1254 @@ -188,7 +188,7 @@
1255 }
1256 #define VGA_ACCESS_HACK 1
1257 #if VGA_ACCESS_HACK
1258 - if(_trapno==0x0e && Video->update_screen && _cs==getsegment(cs)) {
1259 + if(_trapno==0x0e && Video->update_screen && !DPMIValidSelector(_cs)) {
1260 /* Well, there are currently some dosemu functions that touches video memory
1261 * without checking the permissions. This is a VERY BIG BUG.
1262 * Must be fixed ASAP.
1263 @@ -207,7 +207,7 @@
1264
1265 if (in_dpmi) {
1266 /* At first let's find out where we came from */
1267 - if (_cs==getsegment(cs)) {
1268 + if (!DPMIValidSelector(_cs)) {
1269 /* Fault in dosemu code */
1270 #ifdef __i386__
1271 /* Now see if it is HLT */
1272 @@ -228,7 +228,7 @@
1273 /* Going to die from here */
1274 goto bad; /* well, this goto is unnecessary but I like gotos:) */
1275 }
1276 - } /*_cs==getsegment(cs)*/
1277 + } /*!DPMIValidSelector(_cs)*/
1278 else {
1279 /* Not in dosemu code */
1280
1281 @@ -291,6 +291,13 @@
1282 _trapno, _err, _cr2,
1283 _rip, _rsp, _eflags, _cs, _ds, _es, _ss);
1284
1285 + error("Please report the contents of ~/.dosemu/boot.log at\n"
1286 +"http://sourceforge.net/tracker/?atid=457447&group_id=49784&func=browse\n"
1287 +#ifndef _DEBUG
1288 +"It would be even more helpful if would recompile DOSEMU and reproduce this\n"
1289 +"bug with \"debug on\" in compiletime-settings.\n"
1290 +#endif
1291 +);
1292 gdb_debug();
1293
1294 print_exception_info(scp);
1295 @@ -383,7 +390,7 @@
1296 }
1297
1298 #if defined(__x86_64__) || defined(X86_EMULATOR)
1299 - if (fault_cnt > 1 && _trapno == 0xe && getsegment(cs) == _cs) {
1300 + if (fault_cnt > 1 && _trapno == 0xe && !DPMIValidSelector(_cs)) {
1301 #ifdef __x86_64__
1302 /* see comment in signal.c, fix_fs_gs_base() */
1303 unsigned char *rip = (unsigned char *)_rip;
1304 @@ -600,15 +607,17 @@
1305 break;
1306
1307 case 0x10: {
1308 - struct _fpstate *p = scp->fpstate;
1309 int i, n;
1310 unsigned short sw;
1311 - error ("@Coprocessor Error:\n");
1312 #ifdef __x86_64__
1313 + fpregset_t p = ((mcontext_t *)scp)->fpregs;
1314 + error ("@Coprocessor Error:\n");
1315 error ("@cwd=%04x swd=%04x ftw=%04x\n", p->cwd, p->swd, p->ftw);
1316 error ("@cs:rip=%04x:%08lx ds:data=%04x:%08lx\n", _cs,p->rip,_ds,p->rdp);
1317 sw = p->swd;
1318 #else
1319 + struct _fpstate *p = scp->fpstate;
1320 + error ("@Coprocessor Error:\n");
1321 error ("@cw=%04x sw=%04x tag=%04x\n",
1322 *((unsigned short *)&(p->cw)),*((unsigned short *)&(p->sw)),
1323 *((unsigned short *)&(p->tag)));
1324 diff -urN dosemu-1.4.0/src/arch/linux/debugger/mhpdbgc.c dosemu-1.4.0.1/src/arch/linux/debugger/mhpdbgc.c
1325 --- dosemu-1.4.0/src/arch/linux/debugger/mhpdbgc.c 2007-05-04 01:59:48.000000000 -0400
1326 +++ dosemu-1.4.0.1/src/arch/linux/debugger/mhpdbgc.c 2007-05-17 20:22:52.000000000 -0400
1327 @@ -206,6 +206,16 @@
1328 static unsigned long mhp_axlist[AXLIST_SIZE];
1329 static int axlist_count=0;
1330
1331 +
1332 +/* simple ASCII only toupper, this to avoid problems with the dotless i
1333 + and here we only need to match the register si with SI etc. */
1334 +static unsigned char toupper_ascii(unsigned char c)
1335 +{
1336 + if (c >= 'a' && c <= 'z')
1337 + return c - ('a' - 'A');
1338 + return c;
1339 +}
1340 +
1341 int mhp_getaxlist_value(int v, int mask)
1342 {
1343 int i;
1344 @@ -439,7 +449,7 @@
1345 s=rn; n=0; rn[4]=0;
1346 while (n<4)
1347 {
1348 - *s++=(isalpha(*regn)? toupper(*regn++): ' '); n++;
1349 + *s++=(isalpha(*regn)? toupper_ascii(*regn++): ' '); n++;
1350 }
1351 if (!(s = strstr(reg_syms, rn)))
1352 return -1;
1353 @@ -824,6 +834,7 @@
1354 int len = strlen(s);
1355 int t;
1356 char *tt;
1357 + char *wl = " WL";
1358
1359 if (!len) return V_NONE;
1360 t = s[len-1];
1361 @@ -834,10 +845,10 @@
1362 return V_STRING;
1363 }
1364 }
1365 - if ((tt = strchr(" wl", tolower(t))) !=0) {
1366 + if ((tt = strchr(wl, toupper_ascii(t))) !=0) {
1367 len--;
1368 s[len] = 0;
1369 - t = (int)(tt - " wl") << 1;
1370 + t = (int)(tt - wl) << 1;
1371 }
1372 else t = V_NONE;
1373 if (len >2) {
1374 @@ -1249,7 +1260,7 @@
1375 }
1376 sscanf(argv[2], "%lx", &newval);
1377 i= strlen(argv[1]);
1378 - do argv[1][i] = toupper(argv[1][i]); while (i--);
1379 + do argv[1][i] = toupper_ascii(argv[1][i]); while (i--);
1380 mhp_setreg(argv[1], newval);
1381 if (newval == mhp_getreg(argv[1]))
1382 mhp_printf("reg %s changed to %04x\n", argv[1], mhp_getreg(argv[1]) );
1383 diff -urN dosemu-1.4.0/src/arch/linux/dosext/sound/midid/oss.c dosemu-1.4.0.1/src/arch/linux/dosext/sound/midid/oss.c
1384 --- dosemu-1.4.0/src/arch/linux/dosext/sound/midid/oss.c 2007-05-04 01:59:48.000000000 -0400
1385 +++ dosemu-1.4.0.1/src/arch/linux/dosext/sound/midid/oss.c 2007-05-08 12:09:21.000000000 -0400
1386 @@ -18,6 +18,9 @@
1387 #include <stdlib.h>
1388 #include <unistd.h>
1389
1390 +/* declare this here to avoid warnings from soundcard.h */
1391 +static void oss_seqbuf_dump(void);
1392 +
1393 #define seqbuf_dump oss_seqbuf_dump
1394 #define _seqbuf oss_seqbuf
1395 #define _seqbufptr oss_seqbufptr
1396 @@ -29,8 +32,6 @@
1397
1398 static int seqfd; /* Sequencer file handle */
1399
1400 -void oss_seqbuf_dump(void);
1401 -
1402 static bool oss_detect(void)
1403 {
1404 if ((seqfd = open(SEQUENCER_DEV, O_WRONLY)) == -1)
1405 @@ -52,7 +53,7 @@
1406 seqfd = -1;
1407 }
1408
1409 -void oss_seqbuf_dump(void)
1410 +static void oss_seqbuf_dump(void)
1411 {
1412 if (_seqbufptr) {
1413 if (write(seqfd, _seqbuf, _seqbufptr) == -1) {
1414 diff -urN dosemu-1.4.0/src/arch/linux/dosext/sound/midid/timid.c dosemu-1.4.0.1/src/arch/linux/dosext/sound/midid/timid.c
1415 --- dosemu-1.4.0/src/arch/linux/dosext/sound/midid/timid.c 2007-05-04 01:59:48.000000000 -0400
1416 +++ dosemu-1.4.0.1/src/arch/linux/dosext/sound/midid/timid.c 2008-03-25 13:13:15.000000000 -0400
1417 @@ -26,6 +26,9 @@
1418 #include <stdlib.h>
1419 #include <unistd.h>
1420
1421 +/* declare this here to avoid warnings from soundcard.h */
1422 +static void timid_seqbuf_dump(void);
1423 +
1424 #define seqbuf_dump timid_seqbuf_dump
1425 #define _seqbuf timid_seqbuf
1426 #define _seqbufptr timid_seqbufptr
1427 @@ -41,8 +44,6 @@
1428 #define SEQ_END_OF_MIDI 0x2f
1429 #define SEQ_SYNC 0x02
1430
1431 -void timid_seqbuf_dump(void);
1432 -
1433 static void timid_sync_timidity(void)
1434 {
1435 char buf[255];
1436 @@ -117,8 +118,12 @@
1437 char *tmdty_args[T_MAX_ARGS];
1438 char *ptr;
1439 int i;
1440 - if (pipe(tmdty_pipe_in) == -1 || pipe(tmdty_pipe_out) == -1) {
1441 - perror("pipe()");
1442 + /* the socketpair is used as a bidirectional pipe: older versions
1443 + (current as of 2008 :( ) of timidity write to stdin and we can
1444 + catch that to avoid waiting 3 seconds at select */
1445 + if (pipe(tmdty_pipe_in) == -1 ||
1446 + socketpair(AF_LOCAL, SOCK_STREAM, 0, tmdty_pipe_out) == -1) {
1447 + perror("pipe() or socketpair()");
1448 goto err_ds;
1449 }
1450 switch ((tmdty_pid = fork())) {
1451 @@ -187,13 +192,17 @@
1452 {
1453 fd_set rfds;
1454 struct timeval tv;
1455 - int selret, n;
1456 + int selret, n, ctrl_sock_max;
1457
1458 FD_ZERO(&rfds);
1459 FD_SET(ctrl_sock_in, &rfds);
1460 + FD_SET(ctrl_sock_out, &rfds);
1461 + ctrl_sock_max = (ctrl_sock_out > ctrl_sock_in) ? ctrl_sock_out : ctrl_sock_in;
1462 tv.tv_sec = 3;
1463 tv.tv_usec = 0;
1464 - while ((selret = select(ctrl_sock_in + 1, &rfds, NULL, NULL, &tv)) > 0) {
1465 + while ((selret = select(ctrl_sock_max + 1, &rfds, NULL, NULL, &tv)) > 0) {
1466 + if (!FD_ISSET(ctrl_sock_in, &rfds))
1467 + return FALSE;
1468 n = read(ctrl_sock_in, buf, size - 1);
1469 buf[n] = 0;
1470 if (!n)
1471 @@ -353,7 +362,7 @@
1472 fprintf(stderr, "\tPaused\n");
1473 }
1474
1475 -void seqbuf_dump(void)
1476 +static void timid_seqbuf_dump(void)
1477 {
1478 if (_seqbufptr)
1479 send(data_sock, _seqbuf, _seqbufptr, 0);
1480 diff -urN dosemu-1.4.0/src/arch/linux/Makefile.main dosemu-1.4.0.1/src/arch/linux/Makefile.main
1481 --- dosemu-1.4.0/src/arch/linux/Makefile.main 2007-05-04 10:18:48.000000000 -0400
1482 +++ dosemu-1.4.0.1/src/arch/linux/Makefile.main 2007-06-03 00:06:39.000000000 -0400
1483 @@ -8,7 +8,6 @@
1484 # You should do a "make" to compile and a "make install" as root to
1485 # install DOSEMU.
1486
1487 -TMP = $(abs_top_builddir)/tmp
1488 SYS = ../commands
1489 dosemudir = $(datadir)/dosemu
1490
1491 @@ -91,9 +90,7 @@
1492 endif
1493
1494 $(BINPATH)/bin/dosemu: $(REALTOPDIR)/dist/dosemu.systemwide $(REALTOPDIR)/dist/dosemu
1495 - sed -e "s|SYSTEM_CONF_PATH=NOT_SYSTEM_WIDE|SYSTEM_CONF_PATH=$(sysconfdir)|" \
1496 - -e "s|SYSTEM_XFONTS_PATH=NOT_SYSTEM_WIDE|SYSTEM_XFONTS_PATH=$(x11fontdir)|" \
1497 - -e "s|SYSTEM_BIN_PATH=NOT_SYSTEM_WIDE|SYSTEM_BIN_PATH=$(bindir)|" \
1498 + sed -e "s|SYSTEM_BIN_PATH=NOT_SYSTEM_WIDE|SYSTEM_BIN_PATH=$(bindir)|" \
1499 $< > $(BINPATH)/bin/dosemu
1500 tail -n +9 $(REALTOPDIR)/dist/dosemu >> $(BINPATH)/bin/dosemu
1501 chmod +x $(BINPATH)/bin/dosemu
1502 @@ -133,6 +130,7 @@
1503 echo '#define LIB_DEFAULT "$(libdir)"' >> $@
1504 echo '#define DOSEMULIB_DEFAULT "$(dosemudir)"' >> $@
1505 echo '#define DOSEMUHDIMAGE_DEFAULT "$(syshdimagedir)"' >> $@
1506 + echo '#define SYSTEM_XFONTS_PATH "$(x11fontdir)"' >> $@
1507
1508 doslib: $(REQUIRED) $(DOCS) dosemu
1509 @echo ""
1510 @@ -147,15 +145,7 @@
1511 $(MAKE) install
1512
1513 install:
1514 - rm -rf ../tmp
1515 - mkdir -p -m 0755 $(TMP)/dosemu
1516 $(INSTALL) -d $(DESTDIR)$(dosemudir)
1517 - for i in `find $(SYS)/* -type f`; do \
1518 - $(INSTALL) -m 0644 $$i $(TMP)/dosemu; \
1519 - done
1520 - cd $(SYS); for i in `find * -type l`; do \
1521 - ln -sf generic.com $(TMP)/dosemu/$$i; \
1522 - done
1523 -rm -rf $(DESTDIR)$(dosemudir)/commands $(DESTDIR)$(dosemudir)/freedos/dosemu
1524 -rm -rf $(DESTDIR)$(dosemudir)/drive_z/dosemu
1525 $(INSTALL) -d $(DESTDIR)$(sysconfdir)
1526 @@ -186,10 +176,14 @@
1527 ln -sf /tmp $(DESTDIR)$(dosemudir)/drive_z/tmp; \
1528 ln -sf drive_z $(DESTDIR)$(dosemudir)/freedos; \
1529 fi
1530 - mkdir -p -m 0755 $(DESTDIR)$(dosemudir)/drive_z
1531 - cp -a $(TMP)/dosemu $(DESTDIR)$(dosemudir)/drive_z/dosemu
1532 + $(INSTALL) -d $(DESTDIR)$(dosemudir)/drive_z/dosemu
1533 + for i in `find $(SYS)/* -type f`; do \
1534 + $(INSTALL) -m 0644 $$i $(DESTDIR)$(dosemudir)/drive_z/dosemu; \
1535 + done
1536 + cd $(SYS); for i in `find * -type l`; do \
1537 + ln -sf generic.com $(DESTDIR)$(dosemudir)/drive_z/dosemu/$$i; \
1538 + done
1539 ln -sf drive_z/dosemu $(DESTDIR)$(dosemudir)/commands
1540 - rm -rf ../tmp
1541 if [ ! -f $(DESTDIR)$(sysconfdir)/dosemu.conf ]; then \
1542 $(INSTALL) -m 0644 $(REALTOPDIR)/etc/dosemu.conf $(DESTDIR)$(sysconfdir); \
1543 $(INSTALL) -m 0644 $(REALTOPDIR)/etc/dosemu.users.example $(DESTDIR)$(sysconfdir)/dosemu.users; \
1544 @@ -219,11 +213,15 @@
1545 fi; \
1546 done
1547 $(INSTALL) -d $(DESTDIR)$(docdir)
1548 - $(INSTALL) -m 0644 $(REALTOPDIR)/{README.bindist,NEWS,THANKS,COPYING,COPYING.DOSEMU} $(DESTDIR)$(docdir)
1549 - $(INSTALL) -m 0644 $(REALTOPDIR)/doc/{README,README-tech,dosemu-HOWTO,sound-usage}.txt \
1550 - $(REALTOPDIR)/doc/announce $(DESTDIR)$(docdir)
1551 - $(INSTALL) -m 0644 $(REALTOPDIR)/doc/{DANG,EMUfailure,NOVELL-HOWTO}.txt \
1552 - $(REALTOPDIR)/doc/README.gdb $(DESTDIR)$(docdir)
1553 + for i in README.bindist NEWS THANKS COPYING COPYING.DOSEMU; do \
1554 + $(INSTALL) -m 0644 $(REALTOPDIR)/$$i $(DESTDIR)$(docdir); \
1555 + done
1556 + for i in README README-tech dosemu-HOWTO sound-usage DANG EMUfailure \
1557 + NOVELL-HOWTO; do \
1558 + $(INSTALL) -m 0644 $(REALTOPDIR)/doc/$$i.txt $(DESTDIR)$(docdir); \
1559 + done
1560 + $(INSTALL) -m 0644 $(REALTOPDIR)/doc/announce $(DESTDIR)$(docdir)
1561 + $(INSTALL) -m 0644 $(REALTOPDIR)/doc/README.gdb $(DESTDIR)$(docdir)
1562 ifdef X_SUPPORT
1563 if [ ! -e $(DESTDIR)$(bindir)/xdosemu ]; then ln -s dosemu $(DESTDIR)$(bindir)/xdosemu; fi
1564 $(INSTALL) -d $(DESTDIR)$(x11fontdir)
1565 @@ -248,7 +246,6 @@
1566 fi; \
1567 fi;
1568 endif
1569 - /bin/rm -rf ../tmp
1570 $(MAKE) -C ../man install
1571 @if test $(sysconfdir) != /etc; then \
1572 if [ -f $(DESTDIR)/etc/dosemu.users ]; then \
1573 diff -urN dosemu-1.4.0/src/base/async/int.c dosemu-1.4.0.1/src/base/async/int.c
1574 --- dosemu-1.4.0/src/base/async/int.c 2007-05-04 01:59:48.000000000 -0400
1575 +++ dosemu-1.4.0.1/src/base/async/int.c 2007-09-22 23:22:22.000000000 -0400
1576 @@ -266,17 +266,16 @@
1577 install_dos(1);
1578 if (!config.dosbanner)
1579 break;
1580 - p_dos_str("\n\nLinux DOS emulator " VERSTR " $" "Date: " VERDATE "$\n");
1581 - p_dos_str("Last configured at %s on %s\n", CONFIG_TIME, CONFIG_HOST);
1582 -#if 1
1583 + p_dos_str("\n\nDOSEMU " VERSTR ", released: " VERDATE ", configured: " CONFIG_TIME "\n");
1584 +#if 0
1585 + if (config.dpmi)
1586 + p_dos_str("DPMI-Server Version 0.9 installed");
1587 p_dos_str("This is work in progress.\n");
1588 +#endif
1589 p_dos_str("Please test against a recent version before reporting bugs and problems.\n");
1590 /* p_dos_str("Formerly maintained by Robert Sanders, gt8134b@prism.gatech.edu\n\n"); */
1591 - p_dos_str("Submit Bug Reports, Patches & New Code to linux-msdos@vger.kernel.org or via\n");
1592 - p_dos_str("the SourceForge tracking system at http://www.sourceforge.net/projects/dosemu\n\n");
1593 -#endif
1594 - if (config.dpmi)
1595 - p_dos_str("DPMI-Server Version 0.9 installed\n\n");
1596 + p_dos_str("Submit Bugs & Patches to linux-msdos@vger.kernel.org or via ");
1597 + p_dos_str("http://dosemu.org.\n");
1598 break;
1599
1600 case DOS_HELPER_INSERT_INTO_KEYBUFFER:
1601 @@ -313,15 +312,13 @@
1602
1603 case DOS_HELPER_GET_DEBUG_STRING:
1604 /* TRB - handle dynamic debug flags in dos_helper() */
1605 - LWORD(eax) = GetDebugFlagsHelper((char *) (((_regs.es & 0xffff) << 4) +
1606 - (_regs.edi & 0xffff)), 1);
1607 + LWORD(eax) = GetDebugFlagsHelper(MK_FP32(_regs.es, _regs.edi & 0xffff), 1);
1608 g_printf("DBG: Get flags\n");
1609 break;
1610
1611 case DOS_HELPER_SET_DEBUG_STRING:
1612 g_printf("DBG: Set flags\n");
1613 - LWORD(eax) = SetDebugFlagsHelper((char *) (((_regs.es & 0xffff) << 4) +
1614 - (_regs.edi & 0xffff)));
1615 + LWORD(eax) = SetDebugFlagsHelper(MK_FP32(_regs.es, _regs.edi & 0xffff));
1616 g_printf("DBG: Flags set\n");
1617 break;
1618
1619 @@ -767,7 +764,7 @@
1620 } else if (REG(eax) == 0xe820 && REG(edx) == 0x534d4150) {
1621 REG(eax) = REG(edx);
1622 if (REG(ebx) < system_memory_map_size) {
1623 - REG(ecx) = max(REG(ecx), 20L);
1624 + REG(ecx) = max(REG(ecx), 20);
1625 if (REG(ebx) + REG(ecx) >= system_memory_map_size)
1626 REG(ecx) = system_memory_map_size - REG(ebx);
1627 MEMCPY_2DOS(MK_FP32(_ES, _DI), (char *)system_memory_map + REG(ebx),
1628 @@ -1146,7 +1143,7 @@
1629
1630 static int int21lfnhook(void)
1631 {
1632 - if (HI(ax) != 0x71 || !mfs_lfn())
1633 + if (!(HI(ax) == 0x71 || HI(ax) == 0x57) || !mfs_lfn())
1634 fake_int_to(int21seg, int21off);
1635 return 1;
1636 }
1637 @@ -1294,7 +1291,7 @@
1638 return 0;
1639 tmp_ptr = ptr;
1640 while (*tmp_ptr) { /* Check whether the name is valid */
1641 - if (iscntrl(*tmp_ptr++))
1642 + if (iscntrlDOS(*tmp_ptr++))
1643 return 0;
1644 }
1645 strncpy(cmdname, ptr, TITLE_APPNAME_MAXLEN-1);
1646 @@ -1517,7 +1514,7 @@
1647 int co = READ_WORD(BIOS_SCREEN_COLUMNS);
1648 ushort *base=screen_adr(READ_BYTE(BIOS_CURRENT_SCREEN_PAGE));
1649 g_printf("PrintScreen: base=%p, lines=%i columns=%i\n", base, li, co);
1650 - printer_open(0);
1651 + if (printer_open(0) == -1) return;
1652 for (y_pos=0; y_pos < li; y_pos++) {
1653 for (x_pos=0; x_pos < co; x_pos++)
1654 printer_write(0, vga_read((unsigned char *)(base + y_pos*co + x_pos)));
1655 @@ -1762,12 +1759,12 @@
1656 return 0;
1657 tmp_ptr = ptr;
1658 while (*tmp_ptr) { /* Check whether the name is valid */
1659 - if (iscntrl(*tmp_ptr++))
1660 + if (iscntrlDOS(*tmp_ptr++))
1661 return 0;
1662 }
1663 strcpy(title_current, title_hint);
1664 snprintf(appname, TITLE_APPNAME_MAXLEN, "%s ( %s )",
1665 - title_current, strlower(ptr));
1666 + title_current, strlowerDOS(ptr));
1667 change_window_title(appname);
1668 return 0;
1669 }
1670 @@ -2266,7 +2263,7 @@
1671 cmdname[8] = 0;
1672 cmd_ptr = tmp_ptr = cmdname + strspn(cmdname, " \t");
1673 while (*tmp_ptr) { /* Check whether the name is valid */
1674 - if (iscntrl(*tmp_ptr++))
1675 + if (iscntrlDOS(*tmp_ptr++))
1676 return;
1677 }
1678
1679 diff -urN dosemu-1.4.0/src/base/bios/bios.S dosemu-1.4.0.1/src/base/bios/bios.S
1680 --- dosemu-1.4.0/src/base/bios/bios.S 2007-05-04 01:59:48.000000000 -0400
1681 +++ dosemu-1.4.0.1/src/base/bios/bios.S 2007-05-17 15:01:00.000000000 -0400
1682 @@ -839,9 +839,9 @@
1683 jmp do_int21
1684 do_6c:
1685 cmpb $1, %al /* ax=6c01 means created by lfn.c */
1686 + movb $0, %al
1687 jnz do_int21
1688 - movb $0, %al /* then transform to open (dl=1) */
1689 - movb $1, %dl
1690 + movb $1, %dl /* then transform to open (dl=1) */
1691 int $0x21
1692 movw $2, %cx /* flag creation */
1693 jmp after_int21
1694 diff -urN dosemu-1.4.0/src/base/bios/hlt.c dosemu-1.4.0.1/src/base/bios/hlt.c
1695 --- dosemu-1.4.0/src/base/bios/hlt.c 2007-05-04 01:59:48.000000000 -0400
1696 +++ dosemu-1.4.0.1/src/base/bios/hlt.c 2008-03-27 11:08:55.000000000 -0400
1697 @@ -115,7 +115,8 @@
1698 dpmi_init();
1699 }
1700 else if ((lina >= (Bit8u *)DPMI_ADD) &&
1701 - (lina < (Bit8u *)(DPMI_ADD + (Bit32u)DPMI_dummy_end-(Bit32u)DPMI_dummy_start))) {
1702 + (lina < (Bit8u *)(DPMI_ADD + (Bit32u)(uintptr_t)DPMI_dummy_end-
1703 + (Bit32u)(uintptr_t)DPMI_dummy_start))) {
1704 #if CONFIG_HLT_TRACE > 0
1705 h_printf("HLT: dpmi_realmode_hlt\n");
1706 #endif
1707 diff -urN dosemu-1.4.0/src/base/bios/int10.c dosemu-1.4.0.1/src/base/bios/int10.c
1708 --- dosemu-1.4.0/src/base/bios/int10.c 2007-05-04 01:59:48.000000000 -0400
1709 +++ dosemu-1.4.0.1/src/base/bios/int10.c 2008-03-27 11:08:01.000000000 -0400
1710 @@ -511,6 +511,8 @@
1711 WRITE_WORD(BIOS_VIDEO_PORT, port);
1712
1713 text_scanlines = get_text_scanlines();
1714 + if (mode > 0x13) /* VESA modes have their own scanlines */
1715 + text_scanlines = vmi->height;
1716 if (Video->update_screen == NULL) {
1717 int type=0;
1718 set_text_scanlines(400);
1719 @@ -594,7 +596,7 @@
1720 WRITE_BYTE(BIOS_VDU_COLOR_REGISTER, 0x30);
1721
1722 vga_font_height = vmi->char_height;
1723 - if (using_text_mode())
1724 + if (using_text_mode() && mode <= 0x13)
1725 vga_font_height = text_scanlines / li;
1726
1727 if (li <= MAX_LINES) {
1728 @@ -780,7 +782,7 @@
1729 if (debug_level('v') >= 3)
1730 {
1731 if (debug_level('v') >= 4)
1732 - i10_msg("near %04x:%08lx\n", READ_SEG_REG(cs), REG(eip));
1733 + i10_msg("near %04x:%08x\n", READ_SEG_REG(cs), REG(eip));
1734 if ( (LO(ax) >= ' ') && (LO(ax) < 0x7f) )
1735 i10_msg("AH=%02x AL=%02x '%c'\n",
1736 HI(ax), LO(ax), LO(ax));
1737 @@ -1437,7 +1439,7 @@
1738 old_x = get_bios_cursor_x_position(page);
1739 old_y = get_bios_cursor_y_position(page);
1740
1741 - set_cursor_pos(page, LO(dx), HI(dx))
1742 + set_cursor_pos(page, LO(dx), HI(dx));
1743
1744 i10_deb(
1745 "write string: page %u, x.y %d.%d, attr 0x%02x, len %u, addr 0x%04x:0x%04x\n",
1746 @@ -1497,9 +1499,155 @@
1747 break;
1748
1749
1750 - case 0x1c: /* save/restore video state */
1751 - i10_msg("save/restore: NOT IMPLEMETED\n");
1752 + case 0x1c: { /* save/restore video state */
1753 + unsigned base = _BX;
1754 + if (LO(ax) > 2)
1755 + break;
1756 + switch(LO(ax)) {
1757 + case 0: {
1758 + unsigned size = 0;
1759 + i10_msg("save/restore: return state buffer size\n");
1760 + if (LO(cx) & 1) {
1761 + /* video hardware */
1762 + size += 0x46;
1763 + }
1764 + if (LO(cx) & 2) {
1765 + /* BIOS */
1766 + size += 96;
1767 + }
1768 + if (LO(cx) & 4) {
1769 + /* DAC */
1770 + size += 0x304;
1771 + }
1772 + LWORD(ebx) = (size + 63)/64;
1773 + break;
1774 + }
1775 + case 1:
1776 + if (LO(cx) & 1) {
1777 + unsigned char buf[0x46];
1778 + unsigned crtc, ind;
1779 +
1780 + /* select crtc base address */
1781 + crtc = (inb(MISC_OUTPUT_R) & 1) ? 0x3d4 : 0x3b4;
1782 +
1783 + buf[0x0] = port_inb(SEQUENCER_INDEX);
1784 + buf[0x1] = port_inb(crtc);
1785 + buf[0x2] = port_inb(GFX_INDEX);
1786 + /* feature control */
1787 + buf[0x4] = port_inb(FEATURE_CONTROL_R);
1788 +
1789 + for (ind = 1; ind < 5; ind++) {
1790 + port_outb(SEQUENCER_INDEX, ind);
1791 + buf[0x4+ind] = port_inb(SEQUENCER_DATA);
1792 + }
1793 + port_outb(SEQUENCER_INDEX, 0);
1794 + buf[0x9] = port_inb(SEQUENCER_DATA);
1795 +
1796 + for (ind = 0; ind < 25; ind++) {
1797 + port_outb(crtc, ind);
1798 + buf[0x0a+ind] = port_inb(crtc + 1);
1799 + }
1800 +
1801 + /* reset flipflop ! */
1802 + port_inb(crtc + 0x6);
1803 + buf[0x3] = port_inb(ATTRIBUTE_INDEX);
1804 + for (ind = 0; ind < 20; ind++) {
1805 + port_inb(crtc + 0x6);
1806 + port_outb(ATTRIBUTE_INDEX, ind);
1807 + buf[0x23 + ind] = port_inb(ATTRIBUTE_DATA);
1808 + }
1809 + port_inb(crtc + 0x6);
1810 + port_outb(ATTRIBUTE_INDEX, buf[0x3]);
1811 + port_inb(crtc + 0x6);
1812 +
1813 + for (ind = 0; ind < 9; ind++) {
1814 + port_outb(GFX_INDEX, ind);
1815 + buf[0x37+ind] = port_inb(GFX_DATA);
1816 + }
1817 +
1818 + buf[0x40] = crtc & 0xff;
1819 + buf[0x41] = crtc >> 8;
1820 + /* VGA latches */
1821 + memcpy(&buf[0x42], vga.latch, 4);
1822 + MEMCPY_2DOS(MK_FP32(_ES, base), buf, sizeof(buf));
1823 + base += sizeof(buf);
1824 + }
1825 + if (LO(cx) & 2) {
1826 + MEMCPY_DOS2DOS(MK_FP32(_ES, base), (char *)0x449, 96);
1827 + base += 96;
1828 + }
1829 + if (LO(cx) & 4) {
1830 + unsigned char buf[0x304];
1831 + unsigned ind;
1832 + buf[0] = port_inb(DAC_STATE);
1833 + buf[1] = port_inb(DAC_WRITE_INDEX);
1834 + buf[2] = port_inb(DAC_PEL_MASK);
1835 + port_outb(DAC_READ_INDEX, 0x00);
1836 + for(ind = 0; ind < 768; ind++)
1837 + buf[0x3 + ind] = port_inb(DAC_DATA);
1838 + buf[0x303] = port_inb(COLOR_SELECT);
1839 +
1840 + MEMCPY_2DOS(MK_FP32(_ES, base), buf, sizeof(buf));
1841 + }
1842 + break;
1843 + case 2:
1844 + if (LO(cx) & 1) {
1845 + unsigned char buf[0x46];
1846 + unsigned crtc, ind;
1847 + MEMCPY_2UNIX(buf, MK_FP32(_ES, base), sizeof(buf));
1848 + base += sizeof(buf);
1849 + crtc = buf[0x40] | (buf[0x41] << 8);
1850 + for (ind = 1; ind < 5; ind++)
1851 + port_outw(SEQUENCER_INDEX, ind | (buf[0x04+ind] << 8));
1852 + port_outw(SEQUENCER_INDEX, buf[0x09] << 8);
1853 + /* disable write protection to index 0-7 */
1854 + port_outw(crtc, 0x0011);
1855 + for (ind = 0; ind < 25; ind++)
1856 + port_outw(crtc, ind | (buf[0x0a+ind] << 8));
1857 + /* select crtc base address */
1858 + outb(MISC_OUTPUT_W, (inb(MISC_OUTPUT_R) & ~0x01) | (crtc == 0x3d4));
1859 + /* reset flipflop ! */
1860 + port_inb(crtc + 0x6);
1861 + for (ind = 0; ind < 20; ind++) {
1862 + port_outb(ATTRIBUTE_INDEX, ind);
1863 + port_outb(ATTRIBUTE_INDEX, buf[0x23+ind]);
1864 + }
1865 + port_outb(ATTRIBUTE_INDEX, buf[0x3]);
1866 + port_inb(crtc + 0x6);
1867 + for (ind = 0; ind < 9; ind++)
1868 + port_outw(GFX_INDEX, ind | (buf[0x37+ind] << 8));
1869 +
1870 + port_outb(SEQUENCER_INDEX, buf[0x0]);
1871 + port_outb(crtc, buf[0x1]);
1872 + port_outb(GFX_INDEX, buf[0x2]);
1873 + /* feature control */
1874 + port_outb(crtc + 0x6, buf[0x4]);
1875 + /* VGA latches */
1876 + memcpy(vga.latch, &buf[0x42], 4);
1877 + }
1878 + if (LO(cx) & 2) {
1879 + MEMCPY_DOS2DOS((char *)0x449, MK_FP32(_ES, _BX), 96);
1880 + base += 96;
1881 + }
1882 + if (LO(cx) & 4) {
1883 + unsigned char buf[0x304];
1884 + unsigned ind;
1885 + MEMCPY_2UNIX(buf, MK_FP32(_ES, base), sizeof(buf));
1886 + port_outb(DAC_PEL_MASK, buf[2]);
1887 + port_outb(DAC_WRITE_INDEX, 0x00);
1888 + for(ind = 0; ind < 768; ind++)
1889 + port_outb(DAC_DATA, buf[0x3 + ind]);
1890 + port_outb(COLOR_SELECT, buf[0x303]);
1891 + if (buf[0] & 3)
1892 + port_outb(DAC_READ_INDEX, buf[1]);
1893 + else
1894 + port_outb(DAC_WRITE_INDEX, buf[1]);
1895 + }
1896 + break;
1897 + }
1898 + LO(ax) = 0x1c;
1899 break;
1900 + }
1901
1902
1903 case 0x4f: /* vesa interrupt */
1904 diff -urN dosemu-1.4.0/src/base/dev/dma/dmanew.c dosemu-1.4.0.1/src/base/dev/dma/dmanew.c
1905 --- dosemu-1.4.0/src/base/dev/dma/dmanew.c 2006-11-29 05:05:27.000000000 -0500
1906 +++ dosemu-1.4.0.1/src/base/dev/dma/dmanew.c 2008-02-18 15:33:31.000000000 -0500
1907 @@ -211,7 +211,7 @@
1908 }
1909 if ((dma[DI(ch)].status & 0xf0) || dma[DI(ch)].request) {
1910 error("DMA: channel %i already active! (m=%#x s=%#x r=%#x)\n",
1911 - dma[DI(ch)].chans[CI(ch)].mode, dma[DI(ch)].status,
1912 + ch, dma[DI(ch)].chans[CI(ch)].mode, dma[DI(ch)].status,
1913 dma[DI(ch)].request);
1914 ret = DMA_NO_DACK;
1915 }
1916 diff -urN dosemu-1.4.0/src/base/dev/misc/lpt.c dosemu-1.4.0.1/src/base/dev/misc/lpt.c
1917 --- dosemu-1.4.0/src/base/dev/misc/lpt.c 2007-05-04 01:59:48.000000000 -0400
1918 +++ dosemu-1.4.0.1/src/base/dev/misc/lpt.c 2007-09-22 23:22:22.000000000 -0400
1919 @@ -116,6 +116,9 @@
1920 if (lpt[prnum].file != NULL)
1921 return 0;
1922
1923 + if (lpt[prnum].fops.open == NULL)
1924 + return -1;
1925 +
1926 rc = lpt[prnum].fops.open(prnum);
1927 /* use line buffering so we don't need to have a long wait for output */
1928 setvbuf(lpt[prnum].file, NULL, _IOLBF, 0);
1929 diff -urN dosemu-1.4.0/src/base/dev/pic/pic.c dosemu-1.4.0.1/src/base/dev/pic/pic.c
1930 --- dosemu-1.4.0/src/base/dev/pic/pic.c 2007-05-04 01:59:48.000000000 -0400
1931 +++ dosemu-1.4.0.1/src/base/dev/pic/pic.c 2007-06-01 00:49:49.000000000 -0400
1932 @@ -722,7 +722,7 @@
1933 * PIC_SEG:PIC_OFF so we can catch it.
1934 */
1935 fake_call_to(PIC_SEG, PIC_OFF);
1936 - if(debug_level('r')>7) r_printf("PIC: setting iret trap at %04x:%04lx\n",
1937 + if(debug_level('r')>7) r_printf("PIC: setting iret trap at %04x:%04x\n",
1938 REG(cs), REG(eip));
1939 }
1940
1941 diff -urN dosemu-1.4.0/src/base/dev/sb16/sb16.c dosemu-1.4.0.1/src/base/dev/sb16/sb16.c
1942 --- dosemu-1.4.0/src/base/dev/sb16/sb16.c 2006-11-29 05:05:27.000000000 -0500
1943 +++ dosemu-1.4.0.1/src/base/dev/sb16/sb16.c 2008-02-18 15:33:31.000000000 -0500
1944 @@ -27,8 +27,7 @@
1945 * Author: Stas Sergeev.
1946 *
1947 * Some code is taken from an old sound.c by Joel N. Weber II,
1948 - * Alistair MacDonald, Michael Karcher and all the other authors
1949 - * of the bloat that made me so much of a headache...
1950 + * Alistair MacDonald, Michael Karcher and others - thanks.
1951 * Thanks to Vlad Romascanu and VDMSound project for the E2 code and some info.
1952 */
1953
1954 diff -urN dosemu-1.4.0/src/base/init/config.c dosemu-1.4.0.1/src/base/init/config.c
1955 --- dosemu-1.4.0/src/base/init/config.c 2007-05-04 10:19:41.000000000 -0400
1956 +++ dosemu-1.4.0.1/src/base/init/config.c 2007-06-03 00:06:39.000000000 -0400
1957 @@ -62,7 +62,7 @@
1958 * they are eaten by secure_option_preparse().
1959 */
1960 static const char * const getopt_string =
1961 - "23456ABCcD:dE:e:F:f:H:h:I:i::kL:M:mNOo:P:Sstu:Vv:wXx:U:"
1962 + "23456ABCcD:dE:e:F:f:H:h:I:i::kL:M:mNOo:P:pSstu:Vv:wXx:U:"
1963 "gK"/*NOPs kept for compat (not documented in usage())*/;
1964
1965
1966 @@ -574,7 +574,7 @@
1967 read_cpu_info();
1968 if (vm86s.cpu_type > config.realcpu) {
1969 vm86s.cpu_type = config.realcpu;
1970 - fprintf(stderr, "CONF: emulated CPU forced down to real CPU: %ld86\n",vm86s.cpu_type);
1971 + fprintf(stderr, "CONF: emulated CPU forced down to real CPU: %d86\n",vm86s.cpu_type);
1972 }
1973 if (config.rdtsc) {
1974 if (config.smp) {
1975 @@ -1038,6 +1038,9 @@
1976 case 'D':
1977 parse_debugflags(optarg, 1);
1978 break;
1979 + case 'p':
1980 + config.prompt = 1;
1981 + break;
1982 case 'P':
1983 if (terminal_fd == -1) {
1984 open_terminal_pipe(optarg);
1985 @@ -1175,6 +1178,7 @@
1986 " -O write debug messages to stderr\n"
1987 " -o FILE put debug messages in file\n"
1988 " -P copy debugging output to FILE\n"
1989 + " -p stop for prompting with a non-fatal configuration problem\n"
1990 " -s enable direct hardware access (full feature) (!%%)\n"
1991 " -t use terminal (S-Lang) mode\n"
1992 " -u set user configuration variable 'confvar' prefixed by 'u_'.\n"
1993 diff -urN dosemu-1.4.0/src/base/init/init.c dosemu-1.4.0.1/src/base/init/init.c
1994 --- dosemu-1.4.0/src/base/init/init.c 2007-05-04 01:59:48.000000000 -0400
1995 +++ dosemu-1.4.0.1/src/base/init/init.c 2007-05-11 02:28:16.000000000 -0400
1996 @@ -307,5 +307,15 @@
1997 struct utsname unames;
1998
1999 uname((struct utsname *)&unames);
2000 - warn("DOSEMU-%s is coming up on %s version %s\n", VERSTR, unames.sysname, unames.release);
2001 + warn("DOSEMU-%s is coming up on %s version %s %s %s\n", VERSTR,
2002 + unames.sysname, unames.release, unames.version, unames.machine);
2003 + warn("Compiled with GCC version %d.%d", __GNUC__, __GNUC_MINOR__);
2004 +#ifdef __GNUC_PATCHLEVEL__
2005 + warn(".%d",__GNUC_PATCHLEVEL__);
2006 +#endif
2007 +#ifdef i386
2008 + warn(" -m32\n");
2009 +#else
2010 + warn(" -m64\n");
2011 +#endif
2012 }
2013 diff -urN dosemu-1.4.0/src/base/init/lexer.l.in dosemu-1.4.0.1/src/base/init/lexer.l.in
2014 --- dosemu-1.4.0/src/base/init/lexer.l.in 2007-05-04 01:59:48.000000000 -0400
2015 +++ dosemu-1.4.0.1/src/base/init/lexer.l.in 2008-03-26 14:59:06.000000000 -0400
2016 @@ -4,7 +4,7 @@
2017 * for details see file COPYING.DOSEMU in the DOSEMU distribution
2018 */
2019
2020 -%option nounput
2021 +%option noinput nounput
2022 %{
2023
2024 #define YY_NO_UNPUT 1
2025 @@ -565,6 +565,7 @@
2026 memsize RETURN(MEMSIZE);
2027 fullrestore RETURN(FULLREST);
2028 partialrestore RETURN(PARTREST);
2029 +vgaemubios_file RETURN(VGAEMUBIOS_FILE);
2030 vbios_file RETURN(VBIOS_FILE);
2031 vbios_copy RETURN(VBIOS_COPY);
2032 vbios_mmap RETURN(VBIOS_MMAP);
2033 diff -urN dosemu-1.4.0/src/base/init/parser.y.in dosemu-1.4.0.1/src/base/init/parser.y.in
2034 --- dosemu-1.4.0/src/base/init/parser.y.in 2007-05-04 01:59:48.000000000 -0400
2035 +++ dosemu-1.4.0.1/src/base/init/parser.y.in 2007-06-01 00:49:49.000000000 -0400
2036 @@ -276,7 +276,8 @@
2037 %token X_GAMMA X_FULLSCREEN VGAEMU_MEMSIZE VESAMODE X_LFB X_PM_INTERFACE X_MGRAB_KEY X_BACKGROUND_PAUSE
2038 /* video */
2039 %token VGA MGA CGA EGA NONE CONSOLE GRAPHICS CHIPSET FULLREST PARTREST
2040 -%token MEMSIZE VBIOS_SIZE_TOK VBIOS_SEG VBIOS_FILE VBIOS_COPY VBIOS_MMAP DUALMON
2041 +%token MEMSIZE VBIOS_SIZE_TOK VBIOS_SEG VGAEMUBIOS_FILE VBIOS_FILE
2042 +%token VBIOS_COPY VBIOS_MMAP DUALMON
2043 %token VBIOS_POST
2044
2045 %token FORCE_VT_SWITCH PCI
2046 @@ -468,7 +469,7 @@
2047 vm86s.cpu_type = 5;
2048 #ifdef X86_EMULATOR
2049 config.cpuemu = 1;
2050 - c_printf("CONF: CPUEMU set to %d for %ld86\n",
2051 + c_printf("CONF: CPUEMU set to %d for %d86\n",
2052 config.cpuemu, vm86s.cpu_type);
2053 #endif
2054 }
2055 @@ -482,7 +483,7 @@
2056 config.cpusim = 1;
2057 #endif
2058 }
2059 - c_printf("CONF: %s CPUEMU set to %d for %ld86\n",
2060 + c_printf("CONF: %s CPUEMU set to %d for %d86\n",
2061 CONFIG_CPUSIM ? "simulated" : "JIT",
2062 config.cpuemu, vm86s.cpu_type);
2063 #endif
2064 @@ -1137,6 +1138,7 @@
2065 | VBIOS_FILE string_expr { free(config.vbios_file); config.vbios_file = $2;
2066 config.mapped_bios = 1;
2067 config.vbios_copy = 0; }
2068 + | VGAEMUBIOS_FILE string_expr { free(config.vgaemubios_file); config.vgaemubios_file = $2; }
2069 | VBIOS_COPY { free(config.vbios_file);
2070 config.vbios_file = NULL;
2071 config.mapped_bios = 1;
2072 @@ -3013,7 +3015,7 @@
2073 if (ret > 0) {
2074 ptr += ret;
2075 }
2076 - } while (ret >0 && *((int *)(buf+ptr-4)) );
2077 + } while (ret >0 && (ret < 4 || memcmp(buf+ptr-4,"\0\0\0",4)));
2078 close(pipefds[0]);
2079 waitpid(pid, &status, 0);
2080 buf[ptr] = 0;
2081 diff -urN dosemu-1.4.0/src/base/misc/disks.c dosemu-1.4.0.1/src/base/misc/disks.c
2082 --- dosemu-1.4.0/src/base/misc/disks.c 2007-05-04 01:59:48.000000000 -0400
2083 +++ dosemu-1.4.0.1/src/base/misc/disks.c 2007-05-17 20:22:52.000000000 -0400
2084 @@ -860,6 +860,7 @@
2085 #endif
2086
2087 disks_initiated = 1; /* disk_init has been called */
2088 + init_all_DOS_tables();
2089 if (config.bootdisk) {
2090 bootdisk.fdesc = open64(bootdisk.type == DIR_TYPE ? "/dev/null" : bootdisk.dev_name,
2091 bootdisk.rdonly ? O_RDONLY : O_RDWR, 0);
2092 diff -urN dosemu-1.4.0/src/base/misc/dos2linux.c dosemu-1.4.0.1/src/base/misc/dos2linux.c
2093 --- dosemu-1.4.0/src/base/misc/dos2linux.c 2007-05-04 01:59:48.000000000 -0400
2094 +++ dosemu-1.4.0.1/src/base/misc/dos2linux.c 2007-05-27 23:37:00.000000000 -0400
2095 @@ -569,6 +569,9 @@
2096 {
2097 /* high-level write (shows name of emulator + running app) */
2098 char title [TITLE_EMUNAME_MAXLEN + TITLE_APPNAME_MAXLEN + 35] = {0};
2099 + wchar_t wtitle [sizeof(title)];
2100 + char *unixptr = NULL;
2101 + char *s;
2102
2103 /* app - DOS in a BOX */
2104 /* name of running application (if any) */
2105 @@ -581,8 +584,9 @@
2106 strcat (title, title_emuname);
2107 } else if (strlen (config.X_title)) {
2108 if (strlen (title)) strcat (title, " - ");
2109 + unixptr = title + strlen (title);
2110 /* foreign string, cannot trust its length to be <= TITLE_EMUNAME_MAXLEN */
2111 - snprintf (title + strlen (title), TITLE_EMUNAME_MAXLEN, "%s ", config.X_title);
2112 + snprintf (unixptr, TITLE_EMUNAME_MAXLEN, "%s ", config.X_title);
2113 }
2114
2115 if (dosemu_frozen) {
2116 @@ -607,7 +611,18 @@
2117 }
2118
2119 /* now actually change the title of the Window */
2120 - Video->change_config (CHG_TITLE, title);
2121 + if (unixptr == NULL)
2122 + unixptr = strchr(title, '\0');
2123 + for (s = title; s < unixptr; s++)
2124 + wtitle[s - title] = dos_to_unicode_table[(unsigned char)*s];
2125 + wtitle[unixptr - title] = 0;
2126 + if (*unixptr) {
2127 + if (mbstowcs(&wtitle[unixptr - title], unixptr, TITLE_EMUNAME_MAXLEN)
2128 + == -1)
2129 + wtitle[unixptr - title] = 0;
2130 + wtitle[unixptr - title + TITLE_EMUNAME_MAXLEN] = 0;
2131 + }
2132 + Video->change_config (CHG_TITLE, wtitle);
2133 }
2134 break;
2135
2136 diff -urN dosemu-1.4.0/src/base/misc/dump.c dosemu-1.4.0.1/src/base/misc/dump.c
2137 --- dosemu-1.4.0/src/base/misc/dump.c 2007-05-04 01:59:48.000000000 -0400
2138 +++ dosemu-1.4.0.1/src/base/misc/dump.c 2007-06-01 00:49:49.000000000 -0400
2139 @@ -82,8 +82,8 @@
2140 sp = SEG_ADR((u_char *), ss, sp);
2141
2142 g_printf("Program=%s, Line=%d\n", file, line);
2143 - g_printf("EIP: %04x:%08lx", LWORD(cs), REG(eip));
2144 - g_printf(" ESP: %04x:%08lx", LWORD(ss), REG(esp));
2145 + g_printf("EIP: %04x:%08x", LWORD(cs), REG(eip));
2146 + g_printf(" ESP: %04x:%08x", LWORD(ss), REG(esp));
2147 #if 1
2148 g_printf(" VFLAGS(b): ");
2149 for (i = (1 << 0x14); i > 0; i = (i >> 1)) {
2150 @@ -95,9 +95,9 @@
2151 for (i = (1 << 0x11); i > 0; i = (i >> 1))
2152 g_printf((vflags & i) ? "1" : "0");
2153 #endif
2154 - g_printf("\nEAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx VFLAGS(h): %08lx",
2155 + g_printf("\nEAX: %08x EBX: %08x ECX: %08x EDX: %08x VFLAGS(h): %08lx",
2156 REG(eax), REG(ebx), REG(ecx), REG(edx), (unsigned long)vflags);
2157 - g_printf("\nESI: %08lx EDI: %08lx EBP: %08lx",
2158 + g_printf("\nESI: %08x EDI: %08x EBP: %08x",
2159 REG(esi), REG(edi), REG(ebp));
2160 g_printf(" DS: %04x ES: %04x FS: %04x GS: %04x\n",
2161 LWORD(ds), LWORD(es), LWORD(fs), LWORD(gs));
2162 diff -urN dosemu-1.4.0/src/base/misc/fatfs.c dosemu-1.4.0.1/src/base/misc/fatfs.c
2163 --- dosemu-1.4.0/src/base/misc/fatfs.c 2007-05-04 01:59:48.000000000 -0400
2164 +++ dosemu-1.4.0.1/src/base/misc/fatfs.c 2007-05-17 20:22:52.000000000 -0400
2165 @@ -54,7 +54,6 @@
2166 #include <string.h>
2167 #include <dirent.h>
2168 #include <time.h>
2169 -#include <ctype.h>
2170 #include <fcntl.h>
2171 #include <sys/types.h>
2172 #include <sys/stat.h>
2173 @@ -422,12 +421,14 @@
2174 void make_label(fatfs_t *f)
2175 {
2176 int i, j;
2177 - char *s = f->dir;
2178 + char *s = f->dir, sdos[strlen(s) + 1];
2179
2180 memset(f->label, ' ', 11);
2181 f->label[11] = 0;
2182
2183 if(*s == '/') s++;
2184 + name_ufs_to_dos(sdos, s);
2185 + s = sdos;
2186 i = strlen(s);
2187
2188 if(i > 11) {
2189 @@ -447,7 +448,7 @@
2190 memcpy(f->label, s, i);
2191 while ((s = strchr(f->label, '/')))
2192 *s = ' ';
2193 - strupr(f->label);
2194 + strupperDOS(f->label);
2195 }
2196 }
2197
2198 @@ -576,31 +577,31 @@
2199
2200 if((f->sys_type & 3) == 3) {
2201 f->sys_type = 3; /* MS-DOS */
2202 - sf[0] = "io.sys";
2203 - sf[1] = "msdos.sys";
2204 + sf[0] = "IO.SYS";
2205 + sf[1] = "MSDOS.SYS";
2206 sfs = 2;
2207 }
2208 if((f->sys_type & 0x4c) == 0x4c) {
2209 f->sys_type = 0x40; /* PC-DOS */
2210 - sf[0] = "ibmbio.com";
2211 - sf[1] = "ibmdos.com";
2212 + sf[0] = "IBMBIO.COM";
2213 + sf[1] = "IBMDOS.COM";
2214 sfs = 2;
2215 }
2216 if((f->sys_type & 0x0c) == 0x0c) {
2217 f->sys_type = 0x0c; /* DR-DOS */
2218 - sf[0] = "ibmbio.com";
2219 - sf[1] = "ibmdos.com";
2220 + sf[0] = "IBMBIO.COM";
2221 + sf[1] = "IBMDOS.COM";
2222 sfs = 2;
2223 }
2224 if((f->sys_type & 0x30) == 0x10) {
2225 f->sys_type = 0x10; /* FreeDOS, orig. Patv kernel */
2226 - sf[0] = "ipl.sys";
2227 + sf[0] = "IPL.SYS";
2228 sfs = 1;
2229 }
2230
2231 if((f->sys_type & 0x30) == 0x20) {
2232 f->sys_type = 0x20; /* FreeDOS, FD maintained kernel */
2233 - sf[0] = "kernel.sys";
2234 + sf[0] = "KERNEL.SYS";
2235 sfs = 1;
2236 }
2237
2238 @@ -609,9 +610,9 @@
2239 if (access(full_name(f, oi, sf[sfs]), R_OK) == 0) \
2240 sfs++
2241
2242 - TRY_ADD("command.com");
2243 - TRY_ADD("config.sys");
2244 - TRY_ADD("autoexec.bat");
2245 + TRY_ADD("COMMAND.COM");
2246 + TRY_ADD("CONFIG.SYS");
2247 + TRY_ADD("AUTOEXEC.BAT");
2248
2249 for (i = 0; i < sfs; i++)
2250 add_object(f, oi, sf[i]);
2251 @@ -628,9 +629,10 @@
2252 fatfs_msg("cannot read directory \"%s\"\n", name);
2253 } else {
2254 while((dent = readdir(dir))) {
2255 - for(i = 0; i < sfs; i++)
2256 - if(!strcasecmp(dent->d_name, sf[i]))
2257 + for(i = 0; i < sfs; i++) {
2258 + if(strequalDOS(dent->d_name, sf[i]))
2259 break;
2260 + }
2261 if(i == sfs)
2262 add_object(f, oi, dent->d_name);
2263 }
2264 @@ -676,7 +678,9 @@
2265
2266 j = strlen(name);
2267 if(j > MAX_FILE_NAME_LEN) return NULL;
2268 - strcpy(s + i, name);
2269 + do {
2270 + s[i + j] = tolowerDOS(name[j]);
2271 + } while (--j >= 0);
2272
2273 /* directory name cached ? */
2274 if(oi == f->ffn_obj) {
2275 @@ -748,7 +752,7 @@
2276 fatfs_deb("trying to add \"%s\":\n", s);
2277 if(stat(s, &sb)) {
2278 int found = 0;
2279 - if (strcmp(name, "kernel.sys") == 0) {
2280 + if (strcmp(name, "KERNEL.SYS") == 0) {
2281 char *libdir = getenv("DOSEMU_LIB_DIR");
2282 fatfs_deb("does not exist\n");
2283 if (libdir) {
2284 @@ -816,7 +820,7 @@
2285 unsigned make_dos_entry(fatfs_t *f, obj_t *o, unsigned char **e)
2286 {
2287 static unsigned char dos_ent[0x20];
2288 - char *s;
2289 + char *s, sdos[strlen(o->name) + 1];
2290 unsigned u, start;
2291 int i, l;
2292
2293 @@ -847,6 +851,8 @@
2294 o = f->obj + u;
2295 }
2296
2297 + name_ufs_to_dos(sdos, s);
2298 + s = sdos;
2299 l = strlen(s);
2300
2301 if(o->is.ro) dos_ent[0x0b] += 0x01;
2302 @@ -880,14 +886,14 @@
2303 if(!strcmp(s, "..")) { *dos_ent = dos_ent[1] = '.'; return 0x20; }
2304
2305 for(i = 0; i < l && i < 8 && s[i] != '.'; i++) {
2306 - dos_ent[i] = toupper(s[i]);
2307 + dos_ent[i] = toupperDOS(s[i]);
2308 }
2309
2310 if(!s[i]) return 0x20;
2311 if(s[i] != '.') return 0;
2312
2313 for(i++, s += i, l -= i, i = 0; i < l && i < 3; i++) {
2314 - dos_ent[8 + i] = toupper(s[i]);
2315 + dos_ent[8 + i] = toupperDOS(s[i]);
2316 }
2317 if(!s[i]) return 0x20;
2318
2319 diff -urN dosemu-1.4.0/src/base/misc/userhook.c dosemu-1.4.0.1/src/base/misc/userhook.c
2320 --- dosemu-1.4.0/src/base/misc/userhook.c 2007-05-04 01:59:48.000000000 -0400
2321 +++ dosemu-1.4.0.1/src/base/misc/userhook.c 2007-05-17 20:22:52.000000000 -0400
2322 @@ -32,6 +32,7 @@
2323 #include "userhook.h"
2324 #include "redirect.h"
2325 #include "keyboard.h"
2326 +#include "dos2linux.h"
2327
2328 static char *inpipename = 0;
2329 static char *outpipename = 0;
2330 @@ -288,7 +289,7 @@
2331
2332 if ((argc == 3) && (!strcmp(argv[1], "del")) && (strchr(argv[2], ':'))) {
2333 /* delete a redirection */
2334 - drive = tolower(argv[2][0]) - 'a';
2335 + drive = toupperDOS(argv[2][0]) - 'A';
2336 if (drive < 2) {
2337 uhook_printf("wrong drive, must be >= C:\n");
2338 return;
2339 @@ -302,7 +303,7 @@
2340 char *rootdir=NULL;
2341 int ro;
2342
2343 - drive = tolower(argv[1][0]) - 'a';
2344 + drive = toupperDOS(argv[1][0]) - 'A';
2345
2346 if (drive < 2) {
2347 uhook_printf("wrong drive, must be >= C:\n");
2348 @@ -325,7 +326,7 @@
2349 uhook_printf("wrong arguments\n");
2350 return;
2351 }
2352 - drive = tolower(argv[1][0]) - 'a';
2353 + drive = toupperDOS(argv[1][0]) - 'A';
2354 if (drive < 2) {
2355 uhook_printf("wrong drive, must be >= C:\n");
2356 return;
2357 diff -urN dosemu-1.4.0/src/base/misc/utilities.c dosemu-1.4.0.1/src/base/misc/utilities.c
2358 --- dosemu-1.4.0/src/base/misc/utilities.c 2007-05-04 01:59:48.000000000 -0400
2359 +++ dosemu-1.4.0.1/src/base/misc/utilities.c 2007-05-17 20:22:52.000000000 -0400
2360 @@ -31,6 +31,7 @@
2361 #include "dpmi.h"
2362 #include "debug.h"
2363 #include "utilities.h"
2364 +#include "dos2linux.h"
2365 #include "dosemu_config.h"
2366 #ifdef USE_MHPDBG
2367 #include "mhpdbg.h"
2368 @@ -528,7 +529,7 @@
2369 void subst_file_ext(char *ptr)
2370 {
2371 #define ext_fix(s) { char *r=(s); \
2372 - while (*r) { *r=toupper(*r); r++; } }
2373 + while (*r) { *r=toupperDOS(*r); r++; } }
2374 static int subst_sys=2;
2375
2376 if (ptr == NULL) {
2377 @@ -557,14 +558,14 @@
2378 */
2379
2380 /* skip the D for DCONFIG.SYS in DR-DOS */
2381 - if (toupper(ptr[0]) == 'D') ptr++;
2382 + if (toupperDOS(ptr[0]) == 'D') ptr++;
2383 #endif
2384 ext_fix(config.emusys);
2385 sprintf(config_name, "CONFIG.%-3s", config.emusys);
2386 - if (subst_sys == 1 && strcasecmp(ptr, config_name) &&
2387 - strcasecmp(ptr, "CONFIG.SYS")) {
2388 + if (subst_sys == 1 && !strequalDOS(ptr, config_name) &&
2389 + !strequalDOS(ptr, "CONFIG.SYS")) {
2390 subst_sys = 0;
2391 - } else if (!strcasecmp(ptr, "CONFIG.SYS")) {
2392 + } else if (strequalDOS(ptr, "CONFIG.SYS")) {
2393 strcpy(ptr, config_name);
2394 d_printf("DISK: Substituted %s for CONFIG.SYS\n", ptr);
2395 subst_sys = 1;
2396 @@ -680,26 +681,6 @@
2397 return buffer;
2398 }
2399
2400 -char * strupr(char *s)
2401 -{
2402 - char *p = s;
2403 - while (*p) {
2404 - *p = toupper(*p);
2405 - p++;
2406 - }
2407 - return s;
2408 -}
2409 -
2410 -char * strlower(char *s)
2411 -{
2412 - char *p = s;
2413 - while (*p) {
2414 - *p = tolower(*p);
2415 - p++;
2416 - }
2417 - return s;
2418 -}
2419 -
2420 void dosemu_error(char *fmt, ...)
2421 {
2422 va_list args;
2423 diff -urN dosemu-1.4.0/src/commands/Makefile dosemu-1.4.0.1/src/commands/Makefile
2424 --- dosemu-1.4.0/src/commands/Makefile 2007-05-04 01:59:48.000000000 -0400
2425 +++ dosemu-1.4.0.1/src/commands/Makefile 2008-03-27 11:39:49.000000000 -0400
2426 @@ -41,7 +41,7 @@
2427 #
2428 #CALLDOS=dos -D-a 2>/dev/null
2429 CALLDOS=../../bin/$(DOSBIN) -D-a 2>/dev/null
2430 -COMMANDDIR=$(shell pwd -P)
2431 +COMMANDDIR=$(shell pwd)
2432 BOOTUP=\P2;2\rn
2433 GOTARGET=lredir k: linux\\fs$(COMMANDDIR)\rk:\r
2434 DOSINVOKE='video {none} keystroke "$(BOOTUP)$(GOTARGET)COMMAND\rexitemu\r"'
2435 @@ -53,15 +53,14 @@
2436
2437 dosbin: $(COM1) $(COM2) $(SYS)
2438
2439 -%.o: %.S
2440 - $(CC) $(CPPFLAGS) -traditional -Wa,-a -c -o $@ $< > $*.s.out
2441 +ASFLAGS += -traditional -Wa,-a > $*.s.out
2442
2443 $(D)/%.sys: %.o
2444 - $(LD) -Wl,-Ttext,0,-e,_start16,--oformat,binary -nostdlib -s -o $@ $<
2445 + $(LD) $(LDFLAGS) -Wl,-Ttext,0,-e,_start16,--oformat,binary -nostdlib -s -o $@ $<
2446 chmod -x $@
2447
2448 $(D)/%.com: %.o
2449 - $(LD) -Wl,-Ttext,100,-e,_start16,--oformat,binary -nostdlib -s -o $@ $<
2450 + $(LD) $(LDFLAGS) -Wl,-Ttext,100,-e,_start16,--oformat,binary -nostdlib -s -o $@ $<
2451 chmod -x $@
2452
2453 precomp: $(PD)/unix.exe $(PD)/cmdline.exe $(PD)/emumouse.exe \
2454 diff -urN dosemu-1.4.0/src/doc/README/config dosemu-1.4.0.1/src/doc/README/config
2455 --- dosemu-1.4.0/src/doc/README/config 2007-05-05 00:22:31.000000000 -0400
2456 +++ dosemu-1.4.0.1/src/doc/README/config 2007-05-18 12:08:37.000000000 -0400
2457 @@ -677,12 +677,6 @@
2458 compute the character set index of unicode characters output to
2459 a terminal display screen.
2460 </para> </listitem>
2461 -<listitem> <para>
2462 - compute the unicode values of characters pasted into dosemu.
2463 -</para> </listitem>
2464 -<listitem> <para>
2465 - compute the unicode values of characters in file names.
2466 -</para> </listitem>
2467 </itemizedlist>
2468 The default is to use "", which denotes the current locale, and is usually
2469 the right setting.
2470 diff -urN dosemu-1.4.0/src/dosext/dpmi/dpmi.c dosemu-1.4.0.1/src/dosext/dpmi/dpmi.c
2471 --- dosemu-1.4.0/src/dosext/dpmi/dpmi.c 2007-05-04 01:59:48.000000000 -0400
2472 +++ dosemu-1.4.0.1/src/dosext/dpmi/dpmi.c 2007-06-01 00:49:49.000000000 -0400
2473 @@ -140,7 +140,7 @@
2474 }
2475
2476 #define CHECK_SELECTOR_ALLOC(x) \
2477 -{ if (!ValidSelector(x) || SystemSelector(x)) { \
2478 +{ if (SystemSelector(x)) { \
2479 _LWORD(eax) = 0x8022; \
2480 _eflags |= CF; \
2481 break; \
2482 @@ -149,7 +149,6 @@
2483
2484 static void quit_dpmi(struct sigcontext_struct *scp, unsigned short errcode,
2485 int tsr, unsigned short tsr_para, int dos_exit);
2486 -static inline int ValidSelector(unsigned short selector);
2487
2488 #ifdef __linux__
2489 #define modify_ldt dosemu_modify_ldt
2490 @@ -326,7 +325,7 @@
2491 #ifdef __x86_64__
2492 void dpmi_iret_setup(struct sigcontext_struct *scp)
2493 {
2494 - if (_cs == getsegment(cs)) return;
2495 + if (!DPMIValidSelector(_cs)) return;
2496
2497 loadregister(ds, _ds);
2498 loadregister(es, _es);
2499 @@ -497,7 +496,7 @@
2500
2501 /* STANDARD SWITCH example
2502 *
2503 - * run_dpmi() -> dpmi_control (_cs==getsegment(cs))
2504 + * run_dpmi() -> dpmi_control (!DPMIValidSelector(_cs))
2505 * -> dpmi_transfer, push registers,
2506 * save esp/rsp in emu_stack_ptr
2507 * -> DPMI_indirect_transfer ->
2508 @@ -572,9 +571,6 @@
2509 {
2510 D_printf("Request for DPMI entry\n");
2511
2512 - if (!config.dpmi)
2513 - return;
2514 -
2515 REG(eax) = 0; /* no error */
2516
2517 /* 32 bit programs are O.K. */
2518 @@ -601,7 +597,7 @@
2519 unsigned char is_big, unsigned char seg_not_present, unsigned char useable)
2520 {
2521 int ldt_entry = selector >> 3;
2522 - if (!ValidSelector(selector)) {
2523 + if (!DPMIValidSelector(selector)) {
2524 D_printf("ERROR: Invalid selector passed to SetSelector(): %#x\n", selector);
2525 return -1;
2526 }
2527 @@ -628,25 +624,8 @@
2528
2529 static int SystemSelector(unsigned short selector)
2530 {
2531 - unsigned short sel_no_rpl = selector & 0xfffc;
2532 - unsigned short cs_no_rpl = getsegment(cs) & 0xfffc;
2533 - if (
2534 - (sel_no_rpl == (dpmi_sel16 & 0xfffc)) ||
2535 - (sel_no_rpl == (dpmi_sel32 & 0xfffc)) ||
2536 - (sel_no_rpl == cs_no_rpl) ||
2537 -#ifdef __x86_64__
2538 - /* fixed GDT layout specified for SYSCALL */
2539 - (sel_no_rpl == cs_no_rpl - 8) ||
2540 - (sel_no_rpl == cs_no_rpl - 16) ||
2541 -#else
2542 - (sel_no_rpl == (getsegment(ds) & 0xfffc)) ||
2543 -#endif
2544 - (sel_no_rpl == (getsegment(fs) & 0xfffc)) ||
2545 - (sel_no_rpl == (getsegment(gs) & 0xfffc)) ||
2546 - (Segments[selector >> 3].used == 0xff)
2547 - )
2548 - return 1;
2549 - return 0;
2550 + /* 0xff refers to dpmi_sel16 & dpmi_sel32 */
2551 + return !DPMIValidSelector(selector) || Segments[selector >> 3].used == 0xff;
2552 }
2553
2554 static unsigned short AllocateDescriptorsAt(unsigned short selector,
2555 @@ -812,19 +791,9 @@
2556 return 8;
2557 }
2558
2559 -static inline int ValidSelector(unsigned short selector)
2560 -{
2561 - /* does this selector refer to the LDT? */
2562 -#if MAX_SELECTORS < 8192
2563 - return selector < (MAX_SELECTORS << 3) && (selector & 4);
2564 -#else
2565 - return selector & 4;
2566 -#endif
2567 -}
2568 -
2569 int ValidAndUsedSelector(unsigned short selector)
2570 {
2571 - return ValidSelector(selector) && Segments[selector >> 3].used;
2572 + return DPMIValidSelector(selector) && Segments[selector >> 3].used;
2573 }
2574
2575 static inline int check_verr(unsigned short selector)
2576 @@ -1082,7 +1051,7 @@
2577 {
2578 int typebyte;
2579 unsigned char *type_ptr;
2580 - if (!ValidSelector(selector) || SystemSelector(selector))
2581 + if (SystemSelector(selector))
2582 return -1; /* invalid value 8021 */
2583 #if 0
2584 modify_ldt(0, ldt_buffer, MAX_SELECTORS*LDT_ENTRY_SIZE);
2585 @@ -1203,7 +1172,7 @@
2586 3=vm86 only, 4=all active */
2587 return;
2588 #endif
2589 - if (_cs == getsegment(cs)) {
2590 + if (!DPMIValidSelector(_cs)) {
2591 dosemu_error("Return to dosemu requested within dosemu context\n");
2592 return;
2593 }
2594 @@ -2852,6 +2821,7 @@
2595 int i, type;
2596 unsigned int base_addr, limit, *lp;
2597
2598 + if (!config.dpmi) return;
2599 #ifdef __i386__
2600 #if DIRECT_DPMI_CONTEXT_SWITCH
2601 /* Allocate special buffer that is used for direct jumping to
2602 @@ -2921,7 +2891,7 @@
2603 type = (*lp >> 10) & 3;
2604 if (base_addr || limit || type) {
2605 D_printf("LDT entry 0x%x used: b=0x%x l=0x%x t=%i\n",i,base_addr,limit,type);
2606 - Segments[i].used = 0xff;
2607 + Segments[i].used = 0xfe;
2608 }
2609 }
2610
2611 @@ -3035,7 +3005,7 @@
2612 cp = MK_FP32(my_cs, my_ip);
2613
2614 D_printf("Going protected with fingers crossed\n"
2615 - "32bit=%d, CS=%04x SS=%04x DS=%04x PSP=%04x ip=%04x sp=%04lx\n",
2616 + "32bit=%d, CS=%04x SS=%04x DS=%04x PSP=%04x ip=%04x sp=%04x\n",
2617 LO(ax), my_cs, LWORD(ss), LWORD(ds), psp, my_ip, REG(esp));
2618 /* display the 10 bytes before and after CS:EIP. the -> points
2619 * to the byte at address CS:EIP
2620 @@ -3129,7 +3099,7 @@
2621
2622 void dpmi_sigio(struct sigcontext_struct *scp)
2623 {
2624 - if (_cs != getsegment(cs)) {
2625 + if (DPMIValidSelector(_cs)) {
2626 /* DANG_FIXTHIS We shouldn't return to dosemu code if IF=0, but it helps - WHY? */
2627 /*
2628 Because IF is not set by popf and because dosemu have to do some background
2629 @@ -3428,30 +3398,26 @@
2630 us *ssp;
2631 unsigned char *csp, *lina;
2632 int ret = 0;
2633 - int esp_fixed = 0;
2634 /* Note: in_dpmi/current_client can change within that finction. */
2635 int orig_client = current_client;
2636 #define ORIG_CTXP (current_client >= orig_client ? \
2637 &DPMIclient[orig_client].stack_frame : NULL)
2638
2639 -#if 1
2640 - /* Because of a CPU bug (see EMUFailures.txt:1.7.2), ESP can run to a
2641 - * kernel space, i.e. >= stack_init_top. Here we try to avoid that (also
2642 - * not letting it to go into dosemu stack, so comparing against
2643 - * stack_init_bot).
2644 - * This seem to help the ancient MS linker to work and avoids dosemu
2645 - * trying to access the kernel space (and crash).
2646 - */
2647 - if (_esp > stack_init_bot) {
2648 - if (debug_level('M') >= 5)
2649 - D_printf("DPMI: ESP bug, esp=%#x stack_bot=%#lx, cs32=%i ss32=%i\n",
2650 - _esp, stack_init_bot, Segments[_cs >> 3].is_32, Segments[_ss >> 3].is_32);
2651 - if (!Segments[_ss >> 3].is_32 || !Segments[_cs >> 3].is_32) {
2652 - _HWORD(esp) = 0;
2653 - esp_fixed = 1;
2654 - }
2655 + /* 32-bit ESP in 16-bit code on a 32-bit stack outside the limit...
2656 + this is so wrong that it can only happen inherited through a CPU bug
2657 + (see EMUFailures.txt:1.6.2) or if someone did it on purpose.
2658 + Happens with an ancient MS linker. Maybe fault again; ESP won't be
2659 + corrupted anymore after an IRET because the stack is 32-bits now.
2660 + Note: we used to check for kernel space bits in the high part of ESP
2661 + but that method is unreliable for 32-bit DOSEMU on x86-64 kernels.
2662 + */
2663 + if (_esp > 0xffff && !Segments[_cs >> 3].is_32 && Segments[_ss >> 3].is_32 &&
2664 + _esp > GetSegmentLimit(_ss)) {
2665 + D_printf("DPMI: ESP bug, esp=%#x, ebp=%#x, limit=%#lx\n",
2666 + _esp, _ebp, GetSegmentLimit(_ss));
2667 + _esp &= 0xffff;
2668 + return ret;
2669 }
2670 -#endif
2671
2672 csp = lina = (unsigned char *) SEL_ADR(_cs, _eip);
2673 ssp = (us *) SEL_ADR(_ss, _esp);
2674 @@ -4069,10 +4035,64 @@
2675 } /* _trapno==13 */
2676 else {
2677 if (_trapno == 0x0c) {
2678 - if (!Segments[_ss >> 3].is_32 && esp_fixed) {
2679 + if (Segments[_cs >> 3].is_32 && !Segments[_ss >> 3].is_32 &&
2680 + _esp > 0xffff) {
2681 + unsigned char *p = csp;
2682 + unsigned int *regs[8] = { &_eax, &_ecx, &_edx, &_ebx,
2683 + &_esp, &_ebp, &_esi, &_edi };
2684 + unsigned int *reg;
2685 + D_printf("DPMI: Stack Fault, ESP corrupted due to a CPU bug, "
2686 + "trying to recover.\n");
2687 + /* There are a few ways to recover:
2688 + * If the instruction was a normal push or a pop we wouldn't be here!
2689 + * Assume a modr/m instruction
2690 + * First decode what is the likely register that caused mayhem,
2691 + this is not 100% correct but works for known cases.
2692 + - Native 64-bit on __x86_64__:
2693 + simply zero out high parts of the offending register and ESP
2694 + and try again: the iret trampoline avoids recorruption.
2695 + - 32-bit DOSEMU:
2696 + If ESP did not cause the stack fault, then zero the high part
2697 + of the other register and try again,
2698 + else try to return to DOSEMU and retry via direct_dpmi_switch
2699 + if the trap flag is not set, so it won't recorrupt ESP,
2700 + else we're lost :(
2701 + but then this won't happen on i386 kernels >= 2.6.12 :)
2702 + */
2703 + if (*p == 0x66) p++; /* operand size override */
2704 + if (*p == 0x36) p++; /* ss: override */
2705 + if (*p == 0x66) p++; /* operand size override */
2706 + if (*p == 0x0f) p++; /* instruction shift */
2707 + p++; /* skip instruction, modr/m byte follows */
2708 + if ((*p & 7) == 4) p++; /* sib byte */
2709 + D_printf("DPMI: stack fault was caused by register %d\n", *p & 7);
2710 + reg = regs[*p & 7];
2711 + _esp &= 0xffff;
2712 +#ifdef __x86_64__
2713 + if (*reg > 0xffff) {
2714 + *reg &= 0xffff;
2715 + return ret;
2716 + }
2717 +#else
2718 + if (reg != &_esp) {
2719 + if (*reg > 0xffff) {
2720 + *reg &= 0xffff;
2721 + return ret;
2722 + }
2723 + }
2724 +#if DIRECT_DPMI_CONTEXT_SWITCH
2725 + else {
2726 + if (!(_eflags & TF)) {
2727 + D_printf("DPMI: retrying via direct switch.\n");
2728 + dpmi_return_request();
2729 + return ret;
2730 + }
2731 + }
2732 +#endif
2733 +#endif
2734 error("Stack Fault, ESP corrupted due to a CPU bug.\n"
2735 "For more details on that problem and possible work-arounds,\n"
2736 - "please read EMUfailure.txt, section 1.7.2.\n");
2737 + "please read EMUfailure.txt, section 1.6.2.\n");
2738 #if 0
2739 _HWORD(ebp) = 0;
2740 _HWORD(esp) = 0;
2741 diff -urN dosemu-1.4.0/src/dosext/dpmi/dpmi.h dosemu-1.4.0.1/src/dosext/dpmi/dpmi.h
2742 --- dosemu-1.4.0/src/dosext/dpmi/dpmi.h 2007-05-04 01:59:48.000000000 -0400
2743 +++ dosemu-1.4.0.1/src/dosext/dpmi/dpmi.h 2007-05-12 23:50:58.000000000 -0400
2744 @@ -67,6 +67,8 @@
2745 unsigned int not_present:1;
2746 unsigned int useable:1;
2747 unsigned int used; /* Segment in use by client # */
2748 + /* or Linux/GLibc (0xfe) */
2749 + /* or DOSEMU (0xff) */
2750 } SEGDESC;
2751
2752 struct sel_desc_s {
2753 @@ -237,4 +239,13 @@
2754 extern void pm_to_rm_regs(struct sigcontext_struct *scp, unsigned int mask);
2755 extern void rm_to_pm_regs(struct sigcontext_struct *scp, unsigned int mask);
2756
2757 +static inline int DPMIValidSelector(unsigned short selector)
2758 +{
2759 + /* does this selector refer to the LDT? */
2760 +#if MAX_SELECTORS < 8192
2761 + if (selector < (MAX_SELECTORS << 3)) return 0;
2762 +#endif
2763 + return Segments[selector >> 3].used != 0xfe && (selector & 4);
2764 +}
2765 +
2766 #endif /* DPMI_H */
2767 diff -urN dosemu-1.4.0/src/dosext/dpmi/msdos.c dosemu-1.4.0.1/src/dosext/dpmi/msdos.c
2768 --- dosemu-1.4.0/src/dosext/dpmi/msdos.c 2007-05-04 01:59:48.000000000 -0400
2769 +++ dosemu-1.4.0.1/src/dosext/dpmi/msdos.c 2007-06-04 14:06:21.000000000 -0400
2770 @@ -863,6 +863,11 @@
2771 return 0;
2772 case 0xA1: /* close find */
2773 return 0;
2774 + case 0xA6: /* get file info by handle */
2775 + prepare_ems_frame();
2776 + REG(ds) = TRANS_BUFFER_SEG;
2777 + REG(edx) = 0;
2778 + return 0;
2779 default: /* all other subfuntions currently not supported */
2780 _eflags |= CF;
2781 _eax = _eax & 0xFFFFFF00;
2782 @@ -1271,6 +1276,13 @@
2783 D_16_32(_edi), _LWORD(ecx), "%s",
2784 SEG_ADR((char *), es, di));
2785 break;
2786 + case 0xA6:
2787 + PRESERVE1(edx);
2788 + if (LWORD(eflags) & CF)
2789 + break;
2790 + MEMCPY_DOS2DOS((void *)GetSegmentBaseAddress(_ds) +
2791 + D_16_32(_edx), SEG_ADR((char *), ds, dx), 0x34);
2792 + break;
2793 };
2794
2795 default:
2796 diff -urN dosemu-1.4.0/src/dosext/mfs/lfn.c dosemu-1.4.0.1/src/dosext/mfs/lfn.c
2797 --- dosemu-1.4.0/src/dosext/mfs/lfn.c 2007-05-04 11:22:52.000000000 -0400
2798 +++ dosemu-1.4.0.1/src/dosext/mfs/lfn.c 2008-03-21 09:50:11.000000000 -0400
2799 @@ -53,6 +53,59 @@
2800 return (wt / 10000000) - (369 * 365 + 89)*24*60*60ULL;
2801 }
2802
2803 +/* returns: NULL: error (error code in fd; 0: SFT not owned by DOSEMU
2804 + otherwise it return the fd and the filename
2805 +*/
2806 +static char *handle_to_filename(int handle, int *fd)
2807 +{
2808 + struct PSP *p = MK_FP32(READ_WORD(&sda_cur_psp(sda)), 0);
2809 + unsigned char *filetab;
2810 + unsigned int sp;
2811 + unsigned char *sft;
2812 + int dd, idx;
2813 +
2814 + struct sfttbl {
2815 + FAR_PTR sftt_next;
2816 + unsigned short sftt_count;
2817 + unsigned char sftt_table[1];
2818 + } *spp;
2819 +
2820 + /* Look up the handle via the PSP */
2821 + *fd = HANDLE_INVALID;
2822 + if (handle >= READ_WORD(&p->max_open_files))
2823 + return NULL;
2824 +
2825 + filetab = (char *)rFAR_PTR(uintptr_t, READ_DWORD(&p->file_handles_ptr));
2826 + idx = READ_BYTE(filetab + handle);
2827 + if (idx == 0xff)
2828 + return NULL;
2829 +
2830 + /* Get the SFT block that contains the SFT */
2831 + sp = READ_DWORD(lol + 4);
2832 + while (sp != 0xffffffff) {
2833 + spp = (struct sfttbl *)rFAR_PTR(uintptr_t, sp);
2834 + if (idx < READ_WORD(&spp->sftt_count)) {
2835 + /* finally, point to the right entry */
2836 + sft = &spp->sftt_table[idx * sft_size];
2837 + break;
2838 + }
2839 + idx -= READ_WORD(&spp->sftt_count);
2840 + sp = READ_DWORD(&spp->sftt_next);
2841 + }
2842 + if (sp == 0xffffffff)
2843 + return NULL;
2844 +
2845 + /* do we "own" the drive? */
2846 + *fd = 0;
2847 + dd = READ_WORD(&sft_device_info(sft)) & 0x0d1f;
2848 + if (dd == 0 && (READ_WORD(&sft_device_info(sft)) & 0x8000))
2849 + dd = MAX_DRIVE - 1;
2850 + if (dd < 0 || dd >= MAX_DRIVE || !drives[dd].root)
2851 + return NULL;
2852 +
2853 + return sft_to_filename(sft, fd);
2854 +}
2855 +
2856 static int close_dirhandle(int handle)
2857 {
2858 struct lfndir *dir;
2859 @@ -249,8 +302,7 @@
2860 addChar(src0);
2861 unc_src++;
2862 } while (src0);
2863 - ((far_t *)&sda[sda_cds_off])->offset = 0xFFFF;
2864 - ((far_t *)&sda[sda_cds_off])->segment = 0xFFFF;
2865 + WRITE_DWORD(&sda[sda_cds_off], 0xFFFFFFFF);
2866 d_printf("Returning path: \"%s\"\n", dest);
2867 /* Flag as network - drive bits are empty but shouldn't get */
2868 /* referenced for network with empty current_ldt. */
2869 @@ -259,7 +311,7 @@
2870
2871 /* Do we have a drive? */
2872 if (src[1] == ':')
2873 - result = toupper(src0) - 'A';
2874 + result = toupperDOS(src0) - 'A';
2875 else
2876 result = sda_cur_drive(sda);
2877
2878 @@ -276,7 +328,7 @@
2879 if (!drives[result].root) {
2880 if (!(flags & CDSSUBST))
2881 return result;
2882 - result = toupper(cds_current_path(cds)[0]) - 'A';
2883 + result = toupperDOS(cds_current_path(cds)[0]) - 'A';
2884 if (result < 0 || result >= MAX_DRIVE ||
2885 result >= lol_last_drive(lol))
2886 return -PATH_NOT_FOUND;
2887 @@ -290,8 +342,8 @@
2888
2889 d_printf("CDS entry: #%u @%p (%u) '%s'\n", result, cds,
2890 cds_rootlen(cds), cds_current_path(cds));
2891 - ((far_t *)&sda[sda_cds_off])->offset =
2892 - lol_cdsfarptr(lol).offset + result * cds_record_size;
2893 + WRITE_WORD(&sda[sda_cds_off],
2894 + lol_cdsfarptr(lol).offset + result * cds_record_size);
2895
2896 dest[0] = (result & 0x1f) + 'A';
2897 dest[1] = ':';
2898 @@ -310,7 +362,7 @@
2899 int j;
2900 memcpy(dest + 3, src, 5);
2901 for (j = 0; j < 5; j++)
2902 - dest[3+j] = toupper(dest[3+j]);
2903 + dest[3+j] = toupperDOS(dest[3+j]);
2904 if (dest[3] == '/') dest[3] = '\\';
2905 if (dest[7] == '/') dest[7] = '\\';
2906 }
2907 @@ -341,7 +393,7 @@
2908 if (dest[1] == ':') {
2909 /* sanity check if this really
2910 is a local drive still */
2911 - unsigned i = toupper(dest[0]) - 'A';
2912 + unsigned i = toupperDOS(dest[0]) - 'A';
2913
2914 if (i < lol_last_drive(lol))
2915 /* sanity check #2 */
2916 @@ -468,9 +520,9 @@
2917 strcpy(dest + 2, dest + j);
2918 }
2919 result = (result & 0xffe0) | i;
2920 - ((far_t *)&sda[sda_cds_off])->offset =
2921 - lol_cdsfarptr(lol).offset +
2922 - (cdsp - cds_base);
2923 + WRITE_WORD(&sda[sda_cds_off],
2924 + lol_cdsfarptr(lol).offset +
2925 + (cdsp - cds_base));
2926 d_printf("JOINed path: \"%s\"\n", dest);
2927 return result;
2928 }
2929 @@ -495,7 +547,8 @@
2930
2931 static int lfn_error(int errorcode)
2932 {
2933 - _AX = sda_error_code(sda) = errorcode;
2934 + _AX = errorcode;
2935 + WRITE_WORD(&sda_error_code(sda), errorcode);
2936 CARRY;
2937 return 1;
2938 }
2939 @@ -577,7 +630,7 @@
2940 return !((*string == '\0') || (*string == '.' && string[1] == '\0'));
2941 }
2942
2943 -static int wild_match(char *pattern, char *string)
2944 +static int wild_match(const char *pattern, char *string)
2945 {
2946 char *dotpos;
2947 int rc;
2948 @@ -595,7 +648,7 @@
2949 return rc;
2950 }
2951
2952 -static int lfn_sfn_match(char *pattern, struct mfs_dirent *de, char *lfn, char *sfn)
2953 +static int lfn_sfn_match(const char *pattern, struct mfs_dirent *de, char *lfn, char *sfn)
2954 {
2955 if (!name_ufs_to_dos(lfn, de->d_long_name)) {
2956 name_convert(lfn, MANGLE);
2957 @@ -607,7 +660,7 @@
2958 wild_match(pattern, sfn) != 0;
2959 }
2960
2961 -static int getfindnext(struct mfs_dirent *de, struct lfndir *dir)
2962 +static int getfindnext(struct mfs_dirent *de, const struct lfndir *dir)
2963 {
2964 char name_8_3[PATH_MAX];
2965 char name_lfn[PATH_MAX];
2966 @@ -713,7 +766,7 @@
2967 if (slash == fpath)
2968 strcpy(fpath, "/");
2969 /* XXX check for device (special dir entry) */
2970 - if (!find_file(fpath, &st, drive) || is_dos_device(fpath)) {
2971 + if (!find_file(fpath, &st, drive, NULL) || is_dos_device(fpath)) {
2972 Debug0((dbg_fd, "Get failed: '%s'\n", fpath));
2973 return lfn_error(PATH_NOT_FOUND);
2974 }
2975 @@ -791,7 +844,7 @@
2976 char fpath[PATH_MAX];
2977 char fpath2[PATH_MAX];
2978
2979 - int drive, dirhandle = 0, rc;
2980 + int drive, dirhandle = 0, rc, doserrno = FILE_NOT_FOUND;
2981 unsigned int dest = SEGOFF2LINEAR(_ES, _DI);
2982 char *src = (char *)SEGOFF2LINEAR(_DS, _DX);
2983 struct stat st;
2984 @@ -803,6 +856,42 @@
2985
2986 d_printf("LFN: doing LFN!, AX=%x DL=%x\n", _AX, _DL);
2987 NOCARRY;
2988 +
2989 + if (_AH == 0x57) {
2990 + char *filename;
2991 + int fd;
2992 +
2993 + if (_AL < 4 || _AL > 7) return 0;
2994 + filename = handle_to_filename(_BX, &fd);
2995 + if (filename == NULL)
2996 + return fd ? lfn_error(fd) : 0;
2997 +
2998 + if (fstat(fd, &st))
2999 + return lfn_error(HANDLE_INVALID);
3000 + d_printf("LFN: handle function for BX=%x, path=%s, fd=%d\n",
3001 + _BX, filename, fd);
3002 +
3003 + switch (_AL) {
3004 + case 0x04: /* get last access date and time */
3005 + time_to_dos(st.st_atime, &_DX, &_CX);
3006 + _CX = 0;
3007 + break;
3008 + case 0x05: /* set last access date */
3009 + utimbuf.modtime = st.st_mtime;
3010 + utimbuf.actime = time_to_unix(_DX, _CX);
3011 + if (dos_utime(filename, &utimbuf) != 0)
3012 + return lfn_error(ACCESS_DENIED);
3013 + break;
3014 + case 0x06: /* get creation date/time */
3015 + time_to_dos(st.st_ctime, &_DX, &_CX);
3016 + _SI = (st.st_ctime & 1) ? 100 : 0;
3017 + /* fall through */
3018 + case 0x07: /* set creation date/time, impossible in Linux */
3019 + return 1;
3020 + }
3021 + return 1;
3022 + }
3023 + /* else _AH == 0x71 */
3024 switch (_AL) {
3025 case 0x0D: /* reset drive, nothing to do */
3026 break;
3027 @@ -824,7 +913,7 @@
3028 drive = build_posix_path(fpath, src, 0);
3029 if (drive < 0)
3030 return drive + 2;
3031 - if (!find_file(fpath, &st, drive) || !S_ISDIR(st.st_mode))
3032 + if (!find_file(fpath, &st, drive, NULL)|| !S_ISDIR(st.st_mode))
3033 return lfn_error(PATH_NOT_FOUND);
3034 make_unmake_dos_mangled_path(d, fpath, drive, 1);
3035 d_printf("LFN: New CWD will be %s\n", d);
3036 @@ -841,8 +930,8 @@
3037 return lfn_error(FILE_NOT_FOUND);
3038 if (_SI == 1)
3039 return wildcard_delete(fpath, drive);
3040 - if (!find_file(fpath, &st, drive))
3041 - return lfn_error(FILE_NOT_FOUND);
3042 + if (!find_file(fpath, &st, drive, &doserrno))
3043 + return lfn_error(doserrno);
3044 d_printf("LFN: deleting %s\n", fpath);
3045 if (unlink(fpath) != 0)
3046 return lfn_error(FILE_NOT_FOUND);
3047 @@ -854,9 +943,10 @@
3048 return drive + 2;
3049 if (drives[drive].read_only && (_BL < 8) && (_BL & 1))
3050 return lfn_error(ACCESS_DENIED);
3051 - if (!find_file(fpath, &st, drive) || is_dos_device(fpath)) {
3052 + if (!find_file(fpath, &st, drive, &doserrno) ||
3053 + is_dos_device(fpath)) {
3054 Debug0((dbg_fd, "Get failed: '%s'\n", fpath));
3055 - return lfn_error(FILE_NOT_FOUND);
3056 + return lfn_error(doserrno);
3057 }
3058 utimbuf.actime = st.st_atime;
3059 utimbuf.modtime = st.st_mtime;
3060 @@ -913,7 +1003,7 @@
3061 dest = SEGOFF2LINEAR(_DS, _SI);
3062 build_ufs_path(fpath, cwd, drive);
3063 d_printf("LFN: getcwd %s %s\n", cwd, fpath);
3064 - find_file(fpath, &st, drive);
3065 + find_file(fpath, &st, drive, NULL);
3066 d_printf("LFN: getcwd %s %s\n", cwd, fpath);
3067 d_printf("LFN: %p %d %#x %s\n", drive_cds(drive), drive, dest,
3068 fpath+drives[drive].root_len);
3069 @@ -964,7 +1054,8 @@
3070 }
3071
3072 /* XXX check for device (special dir entry) */
3073 - if (!find_file(dir->dirbase, &st, drive) || is_dos_device(fpath)) {
3074 + if (!find_file(dir->dirbase, &st, drive, NULL) ||
3075 + is_dos_device(fpath)) {
3076 Debug0((dbg_fd, "Get failed: '%s'\n", fpath));
3077 free(dir);
3078 return lfn_error(NO_MORE_FILES);
3079 @@ -989,7 +1080,7 @@
3080 if (dir == NULL)
3081 return 0;
3082 if (dir->dir == NULL)
3083 - lfn_error(NO_MORE_FILES);
3084 + return lfn_error(NO_MORE_FILES);
3085 do {
3086 de = dos_readdir(dir->dir);
3087 if (de == NULL) {
3088 @@ -1050,7 +1141,8 @@
3089
3090 if (_CL == 1 || _CL == 2) {
3091 build_ufs_path(fpath, filename, drive);
3092 - find_file(fpath, &st, drive);
3093 + if (!find_file(fpath, &st, drive, &doserrno))
3094 + return lfn_error(doserrno);
3095 make_unmake_dos_mangled_path(filename, fpath, drive, 2 - _CL);
3096 } else {
3097 strupperDOS(filename);
3098 @@ -1073,10 +1165,12 @@
3099 slash = strrchr(fpath, '/');
3100 strcpy(fpath2, slash);
3101 *slash = '\0';
3102 - if (slash != fpath && !find_file(fpath, &st, drive))
3103 + if (slash != fpath &&
3104 + !find_file(fpath, &st, drive, NULL))
3105 return lfn_error(PATH_NOT_FOUND);
3106 strcat(fpath, fpath2);
3107 - if (!find_file(fpath, &st, drive) && (_DX & 0x10)) {
3108 + if (!find_file(fpath, &st, drive, NULL) &&
3109 + (_DX & 0x10)) {
3110 int fd;
3111 if (drives[drive].read_only)
3112 return lfn_error(ACCESS_DENIED);
3113 @@ -1116,9 +1210,42 @@
3114 case 0xa1: /* findclose */
3115 d_printf("LFN: findclose %x\n", _BX);
3116 return close_dirhandle(_BX);
3117 - case 0xa6: /* get file info by handle */
3118 + case 0xa6: { /* get file info by handle */
3119 + int fd;
3120 + char *filename;
3121 + unsigned long long wtime;
3122 + unsigned int buffer = SEGOFF2LINEAR(_DS, _DX);
3123 +
3124 d_printf("LFN: get file info by handle %x\n", _BX);
3125 + filename = handle_to_filename(_BX, &fd);
3126 + if (filename == NULL)
3127 + return fd ? lfn_error(fd) : 0;
3128 +
3129 + if (fstat(fd, &st))
3130 + return lfn_error(HANDLE_INVALID);
3131 + d_printf("LFN: handle function for BX=%x, path=%s, fd=%d\n",
3132 + _BX, filename, fd);
3133 +
3134 + WRITE_DWORD(buffer, get_dos_attr_fd(fd, st.st_mode,
3135 + is_hidden(filename)));
3136 + wtime = unix_to_win_time(st.st_ctime);
3137 + WRITE_DWORD(buffer + 4, wtime);
3138 + WRITE_DWORD(buffer + 8, wtime >> 32);
3139 + wtime = unix_to_win_time(st.st_atime);
3140 + WRITE_DWORD(buffer + 0xc, wtime);
3141 + WRITE_DWORD(buffer + 0x10, wtime >> 32);
3142 + wtime = unix_to_win_time(st.st_mtime);
3143 + WRITE_DWORD(buffer + 0x14, wtime);
3144 + WRITE_DWORD(buffer + 0x18, wtime >> 32);
3145 + WRITE_DWORD(buffer + 0x1c, st.st_dev); /*volume serial number*/
3146 + WRITE_DWORD(buffer + 0x20, (unsigned long long)st.st_size >> 32);
3147 + WRITE_DWORD(buffer + 0x24, st.st_size);
3148 + WRITE_DWORD(buffer + 0x28, st.st_nlink);
3149 + /* fileid*/
3150 + WRITE_DWORD(buffer + 0x2c, (unsigned long long)st.st_ino >> 32);
3151 + WRITE_DWORD(buffer + 0x30, st.st_ino);
3152 return 0;
3153 + }
3154 case 0xa7: /* file time to DOS time and v.v. */
3155 if (_BL == 0) {
3156 src = (char *)SEGOFF2LINEAR(_DS, _SI);
3157 diff -urN dosemu-1.4.0/src/dosext/mfs/mangle.c dosemu-1.4.0.1/src/dosext/mfs/mangle.c
3158 --- dosemu-1.4.0/src/dosext/mfs/mangle.c 2007-05-04 01:59:48.000000000 -0400
3159 +++ dosemu-1.4.0.1/src/dosext/mfs/mangle.c 2007-05-17 20:22:52.000000000 -0400
3160 @@ -109,9 +109,6 @@
3161 for (i = 0; i < 8; i++)
3162 {
3163 char c1 = fname[i];
3164 - /* hopefully no device names with cyrillic characters exist ... */
3165 - if ((unsigned char)c1 >= 128) break;
3166 - if ((unsigned char)dev[0xa + i] >= 128) break;
3167 if (c1 == '.' || c1 == '\0')
3168 {
3169 /* check if remainder of device name consists of spaces or nulls */
3170 @@ -123,7 +120,7 @@
3171 }
3172 break;
3173 }
3174 - if (toupper(c1) != toupper(dev[0xa + i]))
3175 + if (toupperDOS(c1) != toupperDOS(dev[0xa + i]))
3176 break;
3177 }
3178 if (i == 8)
3179 @@ -303,7 +300,7 @@
3180 {
3181 strcpy(tmpname,mangled_stack[i]);
3182 mangle_name_83(tmpname, MangledMap);
3183 - if (strequal(tmpname,s))
3184 + if (strequalDOS(tmpname,s))
3185 {
3186 strcpy(s,mangled_stack[i]);
3187 break;
3188 @@ -313,7 +310,7 @@
3189 strcpy(tmpname,mangled_stack[i]);
3190 strcat(tmpname,extension);
3191 mangle_name_83(tmpname, MangledMap);
3192 - if (strequal(tmpname,s))
3193 + if (strequalDOS(tmpname,s))
3194 {
3195 strcpy(s,mangled_stack[i]);
3196 strcat(s,extension);
3197 diff -urN dosemu-1.4.0/src/dosext/mfs/mangle.h dosemu-1.4.0.1/src/dosext/mfs/mangle.h
3198 --- dosemu-1.4.0/src/dosext/mfs/mangle.h 2007-05-04 01:59:48.000000000 -0400
3199 +++ dosemu-1.4.0.1/src/dosext/mfs/mangle.h 2007-05-27 23:37:00.000000000 -0400
3200 @@ -55,26 +55,18 @@
3201 /* prototypes */
3202 extern unsigned long is_dos_device(const char *fname);
3203 extern void mangle_name_83(char *s, char *MangledMap);
3204 -extern BOOL name_ufs_to_dos(char *dest, const char *src);
3205 extern BOOL do_fwd_mangled_map(char *s, char *MangledMap);
3206 extern BOOL name_convert(char *Name,BOOL mangle);
3207 extern BOOL is_mangled(char *s);
3208 extern BOOL check_mangled_stack(char *s, char *MangledMap);
3209
3210 /* prototypes, found in util.c */
3211 -void init_all_DOS_tables(void);
3212 extern unsigned char unicode_to_dos_table[0x10000];
3213 -extern unsigned short dos_to_unicode_table[0x100];
3214 -extern unsigned char upperDOS_table[0x100];
3215
3216 BOOL isupperDOS(int c);
3217 -#define toupperDOS(c) (upperDOS_table[(unsigned char)(c)])
3218 BOOL islowerDOS(int c);
3219 -int tolowerDOS(int c);
3220 -void strupperDOS(char *s);
3221 BOOL strhasupperDOS(char *s);
3222 BOOL strhaslowerDOS(char *s);
3223 -void strlowerDOS(char *s);
3224 BOOL isalphaDOS(int c);
3225 BOOL isalnumDOS(int c);
3226 BOOL is_valid_DOS_char(int c);
3227 @@ -86,8 +78,6 @@
3228
3229 char *StrnCpy(char *dest,const char *src,int n);
3230 void array_promote(char *array,int elsize,int element);
3231 -BOOL strequalDOS(const char *s1, const char *s2);
3232 -BOOL strequal(char *s1,char *s2);
3233
3234
3235 extern BOOL valid_dos_char[256];
3236 diff -urN dosemu-1.4.0/src/dosext/mfs/mfs.c dosemu-1.4.0.1/src/dosext/mfs/mfs.c
3237 --- dosemu-1.4.0/src/dosext/mfs/mfs.c 2007-05-04 01:59:48.000000000 -0400
3238 +++ dosemu-1.4.0.1/src/dosext/mfs/mfs.c 2008-03-27 11:08:55.000000000 -0400
3239 @@ -173,6 +173,7 @@
3240 #include <stdlib.h>
3241 #include <utime.h>
3242 #include <wchar.h>
3243 +#include <sys/mman.h>
3244
3245 #if !DOSEMU
3246 #include <mach/message.h>
3247 @@ -328,6 +329,7 @@
3248 int sft_directory_entry_off = 0x1f;
3249 int sft_name_off = 0x20;
3250 int sft_ext_off = 0x28;
3251 +int sft_size = 0x38;
3252
3253 int cds_record_size = 0x51;
3254 int cds_current_path_off = 0x0;
3255 @@ -517,7 +519,7 @@
3256 }
3257
3258 if (!found)
3259 - dd = toupper(fn1[0]) - 'A';
3260 + dd = toupperDOS(fn1[0]) - 'A';
3261 if (dd >= 0 && dd < MAX_DRIVE && drives[dd].root) {
3262 /* removed ':' check so DRDOS would be happy,
3263 there is a slight worry about possible device name
3264 @@ -532,7 +534,7 @@
3265 if (strncasecmp(name, LINUX_RESOURCE, strlen(LINUX_RESOURCE)) == 0) {
3266 dd = MAX_DRIVE - 1;
3267 } else if (name[1] == ':') {
3268 - dd = toupper(name[0]) - 'A';
3269 + dd = toupperDOS(name[0]) - 'A';
3270 } else {
3271 dd = sda_cur_drive(sda);
3272 }
3273 @@ -576,6 +578,12 @@
3274 return statfs(name, &buf) == 0 && buf.f_type == MSDOS_SUPER_MAGIC;
3275 }
3276
3277 +static int fd_on_fat(int fd)
3278 +{
3279 + struct statfs buf;
3280 + return fstatfs(fd, &buf) == 0 && buf.f_type == MSDOS_SUPER_MAGIC;
3281 +}
3282 +
3283 int get_dos_attr(const char *fname,int mode,boolean_t hidden)
3284 {
3285 int attr = 0;
3286 @@ -601,6 +609,16 @@
3287 return (attr);
3288 }
3289
3290 +int get_dos_attr_fd(int fd,int mode,boolean_t hidden)
3291 +{
3292 + int attr;
3293 + if (fd_on_fat(fd) && (S_ISREG(mode) || S_ISDIR(mode)) &&
3294 + ioctl(fd, FAT_IOCTL_GET_ATTRIBUTES, &attr) == 0)
3295 + return attr;
3296 +
3297 + return get_dos_attr(NULL, mode, hidden);
3298 +}
3299 +
3300 int get_unix_attr(int mode, int attr)
3301 {
3302 enum { S_IWRITEA = S_IWUSR | S_IWGRP | S_IWOTH };
3303 @@ -608,6 +626,12 @@
3304 #if 0
3305 #define S_IWRITEA (S_IWUSR | S_IWGRP | S_IWOTH)
3306 #endif
3307 + /* Do not make directories read-only as this has completely different
3308 + semantics in DOS (mostly ignore) than in Unix.
3309 + Also do not reflect the archive bit as clearing the x bit as that
3310 + can cause inaccessible directories */
3311 + if (S_ISDIR(mode) || (attr & DIRECTORY))
3312 + attr &= DIRECTORY;
3313 mode &= ~(S_IFDIR | S_IWRITE | S_IEXEC);
3314 if (attr & DIRECTORY)
3315 mode |= S_IFDIR;
3316 @@ -689,7 +713,6 @@
3317 if (!drives_initialized) {
3318 Debug0((dbg_fd, "Inside initialization\n"));
3319 drives_initialized = TRUE;
3320 - init_all_DOS_tables();
3321 for (dd = 0; dd < MAX_DRIVE; dd++) {
3322 drives[dd].root = NULL;
3323 drives[dd].root_len = 0;
3324 @@ -802,7 +825,7 @@
3325 Debug0((dbg_fd,
3326 "Out of memory in path %s.\n",
3327 path));
3328 - return ((int) NULL);
3329 + return (0);
3330 }
3331 get_unix_path(new_path, path);
3332 new_len = strlen(new_path);
3333 @@ -815,7 +838,7 @@
3334 new_path[new_len - 1] = 0;
3335 drives[dd].root_len = 1;
3336 drives[dd].root = strdup("/");
3337 - if (!find_file(new_path, &st, dd)) {
3338 + if (!find_file(new_path, &st, dd, NULL)) {
3339 error("MFS: couldn't find root path %s\n", new_path);
3340 free(new_path);
3341 return (0);
3342 @@ -825,6 +848,7 @@
3343 free(new_path);
3344 return (0);
3345 }
3346 + free(drives[dd].root);
3347 new_path[new_len - 1] = '/';
3348 }
3349
3350 @@ -1000,7 +1024,7 @@
3351 char fullname[strlen(name) + 1 + NAME_MAX + 1];
3352 snprintf(fullname, sizeof(fullname), "%s/%s", name, filename);
3353 Debug0((dbg_fd, "exists() result = %s\n", fullname));
3354 - return find_file(fullname, st, drive);
3355 + return find_file(fullname, st, drive, NULL);
3356 }
3357
3358 static void fill_entry(struct dir_ent *entry, const char *name, int drive)
3359 @@ -1018,7 +1042,7 @@
3360 buf[slen] = '/';
3361 strcpy(sptr, entry->d_name);
3362
3363 - if (!find_file(buf, &sbuf, drive)) {
3364 + if (!find_file(buf, &sbuf, drive, NULL)) {
3365 Debug0((dbg_fd, "Can't findfile %s\n", buf));
3366 entry->mode = S_IFREG;
3367 entry->size = 0;
3368 @@ -1080,7 +1104,7 @@
3369 char fname[8];
3370 char fext[3];
3371
3372 - if(is_dos_device(name) || !find_file(name, &sbuf, drive))
3373 + if(is_dos_device(name) || !find_file(name, &sbuf, drive, NULL))
3374 return NULL;
3375
3376 if ((cur_dir = dos_opendir(name)) == NULL) {
3377 @@ -1246,6 +1270,7 @@
3378 sft_directory_entry_off = 0x1f;
3379 sft_name_off = 0x20;
3380 sft_ext_off = 0x28;
3381 + sft_size = 0x38;
3382
3383 cds_record_size = 0x51;
3384 cds_current_path_off = 0x0;
3385 @@ -1304,6 +1329,7 @@
3386 sft_directory_entry_off = 0x1f;
3387 sft_name_off = 0x20;
3388 sft_ext_off = 0x28;
3389 + sft_size = 0x3b;
3390
3391 /* done */ cds_record_size = 0x58;
3392 cds_current_path_off = 0x0;
3393 @@ -1368,6 +1394,7 @@
3394 sft_directory_entry_off = 0x1f;
3395 sft_name_off = 0x20;
3396 sft_ext_off = 0x28;
3397 + sft_size = 0x3b;
3398
3399 /* done */ cds_record_size = 0x58;
3400 cds_current_path_off = 0x0;
3401 @@ -1410,10 +1437,7 @@
3402 fd = open(name, O_RDONLY|O_DIRECTORY);
3403 if (fd == -1)
3404 return NULL;
3405 - de[0].d_name[1] = '.';
3406 - if (ioctl(fd, vfat_ioctl, (long)&de) != -1 &&
3407 - /* Bug in kernels <= 2.6.21.1 (ioctl32 on x86-64) */
3408 - de[0].d_name[1] == '\0') {
3409 + if (ioctl(fd, vfat_ioctl, (long)&de) != -1) {
3410 lseek(fd, 0, SEEK_SET);
3411 } else {
3412 close(fd);
3413 @@ -1444,11 +1468,28 @@
3414 return NULL;
3415 dir->de.d_name = dir->de.d_long_name = de->d_name;
3416 } else {
3417 - static struct kernel_dirent de[2];
3418 - int ret = (int)RPT_SYSCALL(ioctl(dir->fd, vfat_ioctl, (long)&de));
3419 + static struct kernel_dirent *de;
3420 + int ret;
3421 +
3422 + if (de == NULL) {
3423 + /* work around kernel 32-bit on x86-64 compat ioctl FAT bug in Linux
3424 + <= 2.6.21.1: put a barrier so that the kernel can't flood our
3425 + memory with random kernel stack garbage.
3426 + Thanks to Wine for this idea.
3427 + */
3428 + size_t pagesize = sysconf(_SC_PAGESIZE);
3429 + de = mmap(0, 2*pagesize, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
3430 + if (de == MAP_FAILED)
3431 + return NULL;
3432 + if (mprotect(de, pagesize, PROT_READ|PROT_WRITE) == -1)
3433 + return NULL;
3434 + }
3435 + ret = (int)RPT_SYSCALL(ioctl(dir->fd, vfat_ioctl, (long)de));
3436 if (ret == -1 || de[0].d_reclen == 0)
3437 return NULL;
3438 + de[0].d_name[min((size_t)de[0].d_reclen, sizeof(de[0].d_name)-1)] = '\0';
3439 dir->de.d_name = de[0].d_name;
3440 + de[1].d_name[min((size_t)de[1].d_reclen, sizeof(de[1].d_name)-1)] = '\0';
3441 dir->de.d_long_name = de[1].d_name;
3442 if (dir->de.d_long_name[0] == '\0' ||
3443 vfat_ioctl == VFAT_IOCTL_READDIR_SHORT) {
3444 @@ -1526,7 +1567,7 @@
3445 u_char drive_to_redirect;
3446 int dos_ver;
3447
3448 - Debug0((dbg_fd, "emufs operation: 0x%08lx\n", state->ebx));
3449 + Debug0((dbg_fd, "emufs operation: 0x%08x\n", state->ebx));
3450
3451 if (WORD(state->ebx) == 0x500) {
3452 init_all_drives();
3453 @@ -1610,7 +1651,7 @@
3454 opt = 0;
3455 if (t) {
3456 char *p = strtok(NULL, " \n\r\t");
3457 - opt = (p && (toupper(p[0]) == 'R'));
3458 + opt = (p && (toupperDOS(p[0]) == 'R'));
3459 }
3460 if (!init_drive(drive_to_redirect, t, opt)) {
3461 SETWORD(&(state->eax), 0);
3462 @@ -1712,9 +1753,10 @@
3463 }
3464 if (ch != EOS) {
3465 size_t result;
3466 - wchar_t symbol = dos_to_unicode_table[(unsigned char)ch];
3467 + wchar_t symbol;
3468 if (lowercase && !inenv)
3469 - symbol = towlower(symbol);
3470 + ch = tolowerDOS(ch);
3471 + symbol = dos_to_unicode_table[(unsigned char)ch];
3472 result = wcrtomb(&ufs[ufs_offset], symbol, &unix_state);
3473 if (result == -1)
3474 ufs[ufs_offset++] = '?';
3475 @@ -1759,7 +1801,7 @@
3476 i = 0;
3477 while (ufs[i]) {
3478 if (ufs[i] == '/' && ufs[i+1] == '/')
3479 - strcpy(&ufs[i], &ufs[i+1]);
3480 + memmove(&ufs[i], &ufs[i+1], strlen(&ufs[i]));
3481 else
3482 i++;
3483 }
3484 @@ -1862,7 +1904,7 @@
3485 * a new find_file that will do complete upper/lower case matching for the
3486 * whole path
3487 */
3488 -boolean_t find_file(char *fpath, struct stat * st, int drive)
3489 +boolean_t find_file(char *fpath, struct stat * st, int drive, int *doserrno)
3490 {
3491 char *slash1, *slash2;
3492
3493 @@ -1917,6 +1959,7 @@
3494 Debug0((dbg_fd, "find_file(): not a directory: %s\n", fpath));
3495 if (slash2)
3496 *slash2 = '/';
3497 + if (*doserrno) *doserrno = PATH_NOT_FOUND;
3498 return (FALSE);
3499 }
3500 else {
3501 @@ -1929,8 +1972,11 @@
3502 if (!scan_dir(fpath, slash1 + 1, drive)) {
3503 *slash1 = '/';
3504 Debug0((dbg_fd, "find_file(): no match: %s\n", fpath));
3505 - if (slash2)
3506 + if (slash2) {
3507 strcat(slash1+1,remainder);
3508 + if (*doserrno)
3509 + *doserrno = PATH_NOT_FOUND;
3510 + }
3511 return (FALSE);
3512 }
3513 else {
3514 @@ -2513,7 +2559,7 @@
3515 SETWORD(&(state->eax), FUNC_NUM_IVALID);
3516 return (FALSE);
3517 }
3518 - drive = toupper(deviceName[0]) - 'A';
3519 + drive = toupperDOS(deviceName[0]) - 'A';
3520
3521 /* see if drive is in range of valid drives */
3522 if (drive < 0 || drive > lol_last_drive(lol)) {
3523 @@ -2633,7 +2679,7 @@
3524 /* we only handle drive redirections, pass it through */
3525 return (REDIRECT);
3526 }
3527 - drive = toupper(deviceName[0]) - 'A';
3528 + drive = toupperDOS(deviceName[0]) - 'A';
3529
3530 /* see if drive is in range of valid drives */
3531 if (drive < 0 || drive > lol_last_drive(lol)) {
3532 @@ -2864,7 +2910,7 @@
3533 bs_pos--;
3534 buf = strdup(bs_pos);
3535 *bs_pos = EOS;
3536 - find_file(fpath, &st, drive);
3537 + find_file(fpath, &st, drive, NULL);
3538 strcat(fpath, buf);
3539 free(buf);
3540 }
3541 @@ -2887,23 +2933,18 @@
3542 sft_position(sft) = 0;
3543 }
3544
3545 -/* In writable Linux directories it is possible to have uids not equal
3546 +/* In any Linux directory it is possible to have uids not equal
3547 to your own one. In that case Linux denies any chmod or utime,
3548 but DOS really expects any attribute/time set to succeed. We'll fake it
3549 - with a warning */
3550 + with a warning, if the file is writable. */
3551 static boolean_t dos_would_allow(char *fpath, const char *op, boolean_t equal)
3552 {
3553 - char *slash;
3554 if (errno != EPERM)
3555 return FALSE;
3556
3557 - slash = strrchr(fpath, '/');
3558 - if (slash) *slash = '\0';
3559 - if (slash == fpath)
3560 - fpath = "/";
3561 + /* file not writable? */
3562 if (access(fpath, W_OK) != 0)
3563 return FALSE;
3564 - if (slash) *slash = '/';
3565
3566 /* no need to warn if there was nothing to do */
3567 if (equal)
3568 @@ -3031,6 +3072,14 @@
3569 free(label);
3570 }
3571
3572 +/* return the Linux filename corresponding to the sft */
3573 +char *sft_to_filename(const char *sft, int *fd)
3574 +{
3575 + int cnt = READ_BYTE(&sft_fd(sft));
3576 + *fd = open_files[cnt].name ? open_files[cnt].fd : 0;
3577 + return open_files[cnt].name;
3578 +}
3579 +
3580 int dos_rmdir(const char *filename1, int drive, int lfn)
3581 {
3582 struct stat st;
3583 @@ -3040,7 +3089,7 @@
3584 if (drives[drive].read_only)
3585 return ACCESS_DENIED;
3586 build_ufs_path_(fpath, filename1, drive, !lfn);
3587 - if (find_file(fpath, &st, drive) && !is_dos_device(fpath)) {
3588 + if (find_file(fpath, &st, drive, NULL) && !is_dos_device(fpath)) {
3589 if (rmdir(fpath) != 0) {
3590 Debug0((dbg_fd, "failed to remove directory %s\n", fpath));
3591 return ACCESS_DENIED;
3592 @@ -3062,7 +3111,7 @@
3593 if (drives[drive].read_only || (!lfn && is_long_path(filename1)))
3594 return ACCESS_DENIED;
3595 build_ufs_path_(fpath, filename1, drive, !lfn);
3596 - if (find_file(fpath, &st, drive) || is_dos_device(fpath)) {
3597 + if (find_file(fpath, &st, drive, NULL) || is_dos_device(fpath)) {
3598 Debug0((dbg_fd, "make failed already dir or file '%s'\n",
3599 fpath));
3600 return ACCESS_DENIED;
3601 @@ -3089,14 +3138,14 @@
3602 if (drives[drive].read_only)
3603 return ACCESS_DENIED;
3604 build_ufs_path_(fpath, filename2, drive, !lfn);
3605 - if (find_file(fpath, &st, drive) || is_dos_device(fpath)) {
3606 + if (find_file(fpath, &st, drive, NULL) || is_dos_device(fpath)) {
3607 Debug0((dbg_fd,"Rename, %s already exists\n", fpath));
3608 return ACCESS_DENIED;
3609 }
3610 find_dir(fpath, drive);
3611
3612 build_ufs_path_(buf, filename1, drive, !lfn);
3613 - if (!find_file(buf, &st, drive) || is_dos_device(buf)) {
3614 + if (!find_file(buf, &st, drive, NULL) || is_dos_device(buf)) {
3615 Debug0((dbg_fd, "Rename '%s' error.\n", buf));
3616 return PATH_NOT_FOUND;
3617 }
3618 @@ -3135,6 +3184,7 @@
3619 boolean_t long_path;
3620 struct dir_list *hlist;
3621 int hlist_index;
3622 + int doserrno = FILE_NOT_FOUND;
3623 #if 0
3624 static char last_find_name[8] = "";
3625 static char last_find_ext[3] = "";
3626 @@ -3200,7 +3250,7 @@
3627 Debug0((dbg_fd, "set directory to ufs path: %s\n", fpath));
3628
3629 /* Try the given path */
3630 - if (!find_file(fpath, &st, drive) || is_dos_device(fpath)) {
3631 + if (!find_file(fpath, &st, drive, NULL) || is_dos_device(fpath)) {
3632 SETWORD(&(state->eax), PATH_NOT_FOUND);
3633 return (FALSE);
3634 }
3635 @@ -3381,7 +3431,7 @@
3636 Debug0((dbg_fd, "Get Disk Space\n"));
3637 build_ufs_path(fpath, cds_current_path(drive_cds(drive)), drive);
3638
3639 - if (find_file(fpath, &st, drive)) {
3640 + if (find_file(fpath, &st, drive, NULL)) {
3641 if (get_disk_space(fpath, &free, &tot)) {
3642 /* return unit = 512-byte blocks @ 1 spc, std for floppy */
3643 int spc = 1;
3644 @@ -3431,8 +3481,8 @@
3645
3646 build_ufs_path(fpath, filename1, drive);
3647 Debug0((dbg_fd, "Set attr: '%s' --> 0%o\n", fpath, att));
3648 - if (!find_file(fpath, &st, drive) || is_dos_device(fpath)) {
3649 - SETWORD(&(state->eax), FILE_NOT_FOUND);
3650 + if (!find_file(fpath, &st, drive, &doserrno) || is_dos_device(fpath)) {
3651 + SETWORD(&(state->eax), doserrno);
3652 return (FALSE);
3653 }
3654 if (set_dos_attr(fpath, st.st_mode, att) != 0) {
3655 @@ -3446,9 +3496,9 @@
3656 case GET_FILE_ATTRIBUTES: /* 0x0f */
3657 Debug0((dbg_fd, "Get File Attributes %s\n", filename1));
3658 build_ufs_path(fpath, filename1, drive);
3659 - if (!find_file(fpath, &st, drive) || is_dos_device(fpath)) {
3660 + if (!find_file(fpath, &st, drive, &doserrno) || is_dos_device(fpath)) {
3661 Debug0((dbg_fd, "Get failed: '%s'\n", fpath));
3662 - SETWORD(&(state->eax), FILE_NOT_FOUND);
3663 + SETWORD(&(state->eax), doserrno);
3664 return (FALSE);
3665 }
3666
3667 @@ -3496,8 +3546,8 @@
3668
3669 if (dir_list == NULL) {
3670 build_ufs_path(fpath, filename1, drive);
3671 - if (!find_file(fpath, &st, drive)) {
3672 - SETWORD(&(state->eax), FILE_NOT_FOUND);
3673 + if (!find_file(fpath, &st, drive, &doserrno)) {
3674 + SETWORD(&(state->eax), doserrno);
3675 return (FALSE);
3676 }
3677 if (access(fpath, W_OK) == -1) {
3678 @@ -3523,7 +3573,7 @@
3679 for(i = 0; i < dir_list->nr_entries; i++, de++) {
3680 if ((de->mode & S_IFMT) == S_IFREG) {
3681 strcpy(fpath + cnt, de->d_name);
3682 - if (find_file(fpath, &st, drive)) {
3683 + if (find_file(fpath, &st, drive, NULL)) {
3684 if (access(fpath, W_OK) == -1) {
3685 errcode = EACCES;
3686 } else {
3687 @@ -3597,9 +3647,9 @@
3688 }
3689 build_ufs_path(fpath, filename1, drive);
3690 auspr(filename1, fname, fext);
3691 - if (!find_file(fpath, &st, drive)) {
3692 + if (!find_file(fpath, &st, drive, &doserrno)) {
3693 Debug0((dbg_fd, "open failed: '%s'\n", fpath));
3694 - SETWORD(&(state->eax), FILE_NOT_FOUND);
3695 + SETWORD(&(state->eax), doserrno);
3696 return (FALSE);
3697 }
3698 devptr = is_dos_device(fpath);
3699 @@ -3712,7 +3762,7 @@
3700 }
3701 build_ufs_path(fpath, filename1, drive);
3702 auspr(filename1, fname, fext);
3703 - if (find_file(fpath, &st, drive)) {
3704 + if (find_file(fpath, &st, drive, NULL)) {
3705 devptr = is_dos_device(fpath);
3706 if (devptr) {
3707 open_device (devptr, fname, sft);
3708 @@ -3736,14 +3786,15 @@
3709 Debug0((dbg_fd, "can't open %s: %s (%d)\n",
3710 fpath, strerror(errno), errno));
3711 #if 1
3712 - SETWORD(&(state->eax), FILE_NOT_FOUND);
3713 + SETWORD(&(state->eax), PATH_NOT_FOUND);
3714 #else
3715 SETWORD(&(state->eax), ACCESS_DENIED);
3716 #endif
3717 return (FALSE);
3718 }
3719 }
3720 - set_fat_attr(fd, attr);
3721 + if (file_on_fat(fpath))
3722 + set_fat_attr(fd, attr);
3723
3724 if (!share(fd, O_RDWR, drive, sft) || ftruncate(fd, 0) != 0) {
3725 Debug0((dbg_fd, "unable to truncate %s: %s (%d)\n",
3726 @@ -4086,13 +4137,13 @@
3727 mode, action, attr));
3728
3729 build_ufs_path(fpath, filename1, drive);
3730 - file_exists = find_file(fpath, &st, drive);
3731 + file_exists = find_file(fpath, &st, drive, &doserrno);
3732 if (file_exists && is_dos_device(fpath))
3733 goto do_open_existing;
3734
3735 if (((action & 0x10) == 0) && !file_exists) {
3736 /* Fail if file does not exist */
3737 - SETWORD(&(state->eax), FILE_NOT_FOUND);
3738 + SETWORD(&(state->eax), doserrno);
3739 return (FALSE);
3740 }
3741
3742 diff -urN dosemu-1.4.0/src/dosext/mfs/mfs.h dosemu-1.4.0.1/src/dosext/mfs/mfs.h
3743 --- dosemu-1.4.0/src/dosext/mfs/mfs.h 2007-05-04 01:59:48.000000000 -0400
3744 +++ dosemu-1.4.0.1/src/dosext/mfs/mfs.h 2007-06-04 00:46:42.000000000 -0400
3745 @@ -56,7 +56,7 @@
3746 typedef struct vm86_regs state_t;
3747 #endif
3748
3749 -#define Addr_8086(x,y) (( ((x) & 0xffff) << 4) + ((y) & 0xffff))
3750 +#define Addr_8086(x,y) ((uintptr_t)(( ((x) & 0xffff) << 4) + ((y) & 0xffff)))
3751 #define Addr(s,x,y) Addr_8086(((s)->x), ((s)->y))
3752 #define MASK8(x) ((x) & 0xff)
3753 #define MASK16(x) ((x) & 0xffff)
3754 @@ -351,9 +351,11 @@
3755
3756 extern int build_ufs_path_(char *ufs, const char *path, int drive,
3757 int lowercase);
3758 -extern boolean_t find_file(char *fpath, struct stat *st, int drive);
3759 +extern boolean_t find_file(char *fpath, struct stat *st, int drive,
3760 + int *doserror);
3761 extern boolean_t is_hidden(char *fname);
3762 extern int get_dos_attr(const char *fname,int mode,boolean_t hidden);
3763 +extern int get_dos_attr_fd(int fd,int mode,boolean_t hidden);
3764 extern int set_fat_attr(int fd,int attr);
3765 extern int set_dos_attr(char *fname,int mode,int attr);
3766 extern int dos_utime(char *fpath, struct utimbuf *ut);
3767 @@ -368,6 +370,7 @@
3768 extern int dos_rename(const char *filename1, const char *filename2, int drive, int lfn);
3769 extern int dos_mkdir(const char *filename, int drive, int lfn);
3770 extern int dos_rmdir(const char *filename, int drive, int lfn);
3771 +extern char *sft_to_filename(const char *sft, int *fd);
3772
3773 extern void register_cdrom(int drive, int device);
3774 extern void unregister_cdrom(int drive);
3775 diff -urN dosemu-1.4.0/src/dosext/mfs/mscdex.c dosemu-1.4.0.1/src/dosext/mfs/mscdex.c
3776 --- dosemu-1.4.0/src/dosext/mfs/mscdex.c 2007-05-04 01:59:48.000000000 -0400
3777 +++ dosemu-1.4.0.1/src/dosext/mfs/mscdex.c 2007-05-17 20:22:52.000000000 -0400
3778 @@ -21,6 +21,7 @@
3779 #include "mfs.h"
3780 #include "mangle.h"
3781 #include "utilities.h"
3782 +#include "dos2linux.h"
3783
3784 #define CALC_PTR(PTR,OFFSET,RESULT_TYPE) ((RESULT_TYPE *)(PTR+OFFSET))
3785
3786 diff -urN dosemu-1.4.0/src/dosext/mfs/util.c dosemu-1.4.0.1/src/dosext/mfs/util.c
3787 --- dosemu-1.4.0/src/dosext/mfs/util.c 2007-05-04 01:59:48.000000000 -0400
3788 +++ dosemu-1.4.0.1/src/dosext/mfs/util.c 2007-05-27 23:37:00.000000000 -0400
3789 @@ -8,6 +8,7 @@
3790 #include "emu.h"
3791 #include "mangle.h"
3792 #include "translate.h"
3793 +#include "dos2linux.h"
3794 #include <wctype.h>
3795 #include <errno.h>
3796
3797 @@ -80,23 +81,41 @@
3798
3799 /* uppercase table for DOS characters */
3800 unsigned char upperDOS_table[256];
3801 -static void init_upperDOS_table(void)
3802 +unsigned char lowerDOS_table[256];
3803 +static void init_upperlowerDOS_table(void)
3804 {
3805 struct char_set_state dos_state;
3806 - t_unicode symbol;
3807 + t_unicode symbol, symbolc;
3808 int i, result;
3809
3810 - for (i = 0; i < 256; i++) {
3811 - upperDOS_table[i] = i;
3812 + for (i = 0; i < 128; i++) {
3813 + /* force English ASCII handling for 0 -- 127 to avoid problems
3814 + with the Turkish dotless i */
3815 + upperDOS_table[i] = lowerDOS_table[i] = i;
3816 + if (i >= 'a' && i <= 'z')
3817 + upperDOS_table[i] = i - ('a' - 'A');
3818 + else if (i >= 'A' && i <= 'Z')
3819 + lowerDOS_table[i] = i + ('a' - 'A');
3820 + }
3821 + for (i = 128; i < 256; i++) {
3822 + upperDOS_table[i] = lowerDOS_table[i] = i;
3823 init_charset_state(&dos_state, trconfig.dos_charset);
3824 result = charset_to_unicode(&dos_state, &symbol, &upperDOS_table[i], 1);
3825 + cleanup_charset_state(&dos_state);
3826 if (result == 1) {
3827 - symbol = towupper(symbol);
3828 - result = unicode_to_charset(&dos_state, symbol, &upperDOS_table[i], 1);
3829 + symbolc = towupper(symbol);
3830 + init_charset_state(&dos_state, trconfig.dos_charset);
3831 + result = unicode_to_charset(&dos_state, symbolc, &upperDOS_table[i], 1);
3832 + cleanup_charset_state(&dos_state);
3833 if (result != 1)
3834 upperDOS_table[i] = i;
3835 + symbolc = towlower(symbol);
3836 + init_charset_state(&dos_state, trconfig.dos_charset);
3837 + result = unicode_to_charset(&dos_state, symbolc, &lowerDOS_table[i], 1);
3838 + cleanup_charset_state(&dos_state);
3839 + if (result != 1)
3840 + lowerDOS_table[i] = i;
3841 }
3842 - cleanup_charset_state(&dos_state);
3843 }
3844 }
3845
3846 @@ -105,7 +124,7 @@
3847 valid_initialise();
3848 init_unicode_to_dos_table();
3849 init_dos_to_unicode_table();
3850 - init_upperDOS_table();
3851 + init_upperlowerDOS_table();
3852 }
3853
3854 BOOL is_valid_DOS_char(int c)
3855 @@ -153,10 +172,20 @@
3856 return(result != -1 && iswupper(symbol));
3857 }
3858
3859 -void strupperDOS(char *src)
3860 +char *strupperDOS(char *src)
3861 {
3862 + char *s = src;
3863 for (; *src; src++)
3864 *src = toupperDOS(*src);
3865 + return s;
3866 +}
3867 +
3868 +char *strlowerDOS(char *src)
3869 +{
3870 + char *s = src;
3871 + for (; *src; src++)
3872 + *src = tolowerDOS(*src);
3873 + return s;
3874 }
3875
3876 /* locale-independent routins */
3877 @@ -194,14 +223,4 @@
3878 free(p);
3879 }
3880
3881 -/*******************************************************************
3882 - compare 2 strings
3883 -********************************************************************/
3884 -BOOL strequal(char *s1,char *s2)
3885 -{
3886 - if (!s1 || !s2) return(False);
3887 -
3888 - return(strcasecmp(s1,s2)==0);
3889 -}
3890 -
3891
3892 diff -urN dosemu-1.4.0/src/dosext/misc/xms.c dosemu-1.4.0.1/src/dosext/misc/xms.c
3893 --- dosemu-1.4.0/src/dosext/misc/xms.c 2007-05-04 01:59:48.000000000 -0400
3894 +++ dosemu-1.4.0.1/src/dosext/misc/xms.c 2007-06-01 00:49:49.000000000 -0400
3895 @@ -47,7 +47,7 @@
3896 static void xms_control(void);
3897
3898 /*
3899 -static char RCSxms[] = "$Id: xms.c 1769 2007-05-04 05:59:48Z bartoldeman $";
3900 +static char RCSxms[] = "$Id: xms.c 1819 2007-06-01 04:49:49Z bartoldeman $";
3901 */
3902
3903 #define XMS_GET_VERSION 0x00
3904 @@ -655,7 +655,7 @@
3905 else {
3906 REG(eax) = largest;
3907 REG(edx) = subtotal;
3908 - x_printf("XMS query free memory(new): %ldK %ldK\n",
3909 + x_printf("XMS query free memory(new): %dK %dK\n",
3910 REG(eax), REG(edx));
3911 }
3912 /* the following line is NOT superfluous!! (see above) */
3913 diff -urN dosemu-1.4.0/src/dosext/net/net/pktnew.c dosemu-1.4.0.1/src/dosext/net/net/pktnew.c
3914 --- dosemu-1.4.0/src/dosext/net/net/pktnew.c 2007-05-04 01:59:48.000000000 -0400
3915 +++ dosemu-1.4.0.1/src/dosext/net/net/pktnew.c 2007-06-01 00:49:49.000000000 -0400
3916 @@ -236,7 +236,7 @@
3917
3918 #if 1
3919 if (debug_level('P') > 8) {
3920 - pd_printf("NPKT: AX=%04x BX=%04x CX=%04x DX=%04x FLAGS=%08lx\n",
3921 + pd_printf("NPKT: AX=%04x BX=%04x CX=%04x DX=%04x FLAGS=%08x\n",
3922 LWORD(eax),LWORD(ebx),LWORD(ecx),LWORD(edx),REG(eflags));
3923 pd_printf(" SI=%04x DI=%04x BP=%04x SP=%04x CS=%04x DS=%04x ES=%04x SS=%04x\n",
3924 LWORD(esi),LWORD(edi),LWORD(ebp),LWORD(esp),
3925 @@ -289,7 +289,7 @@
3926 REG(edx) = pg.type; /* type (dummy) */
3927 REG(ds) = PKTDRV_SEG; /* driver name */
3928 REG(esi) = PKTDRV_OFF + MK_PKT_OFS(PKTDRV_driver_name);
3929 - pd_printf("Class returned = %ld, handle=%d, pg.classes[0]=%d \n",
3930 + pd_printf("Class returned = %d, handle=%d, pg.classes[0]=%d \n",
3931 REG(ecx)>>8, hdlp_handle, pg.classes[0] );
3932 return 1;
3933
3934 @@ -509,7 +509,7 @@
3935 /* fell through switch, indicate an error (DH set above) */
3936 CARRY;
3937
3938 - pd_printf("PD ERR: AX=%04x BX=%04x CX=%04x DX=%04x FLAGS=%08lx\n",
3939 + pd_printf("PD ERR: AX=%04x BX=%04x CX=%04x DX=%04x FLAGS=%08x\n",
3940 LWORD(eax),LWORD(ebx),LWORD(ecx),LWORD(edx),REG(eflags));
3941 pd_printf(" SI=%04x DI=%04x BP=%04x SP=%04x CS=%04x DS=%04x ES=%04x SS=%04x\n",
3942 LWORD(esi),LWORD(edi),LWORD(ebp),LWORD(esp),
3943 diff -urN dosemu-1.4.0/src/emu.c dosemu-1.4.0.1/src/emu.c
3944 --- dosemu-1.4.0/src/emu.c 2007-05-04 01:59:48.000000000 -0400
3945 +++ dosemu-1.4.0.1/src/emu.c 2007-05-11 03:02:59.000000000 -0400
3946 @@ -325,6 +325,8 @@
3947 srand(time(NULL));
3948 memset(&config, 0, sizeof(config));
3949 cstack = &signalstack;
3950 + /* zero signal stack to check for %cs x86-64 kernel <= 2.6.14 problem */
3951 + memset(signalstack, 0, sizeof(signalstack));
3952
3953 if ((e=sigsetjmp(NotJEnv, 1))) {
3954 flush_log();
3955 @@ -443,6 +445,10 @@
3956 mmap_mapping(MAPPING_LOWMEM, 0, config.mem_size * 1024,
3957 PROT_READ | PROT_WRITE | PROT_EXEC, 0);
3958
3959 + /* check DOSDRIVE_D (used to be done in the script) */
3960 + if (getenv("HOME"))
3961 + setenv("DOSDRIVE_D", getenv("HOME"), 0);
3962 +
3963 while (!fatalerr && !config.exitearly) {
3964 loopstep_run_vm86();
3965 }
3966 diff -urN dosemu-1.4.0/src/emu-i386/cpu.c dosemu-1.4.0.1/src/emu-i386/cpu.c
3967 --- dosemu-1.4.0/src/emu-i386/cpu.c 2007-05-04 01:59:48.000000000 -0400
3968 +++ dosemu-1.4.0.1/src/emu-i386/cpu.c 2007-05-10 20:39:15.000000000 -0400
3969 @@ -247,34 +247,11 @@
3970 */
3971 void cpu_setup(void)
3972 {
3973 - unsigned long int stk_ptr, stk_beg, stk_end;
3974 - FILE *fp;
3975 - int fd;
3976 -
3977 int_vector_setup();
3978
3979 cpu_reset();
3980
3981 savefpstate(vm86_fpu_state);
3982 -#ifdef __x86_64__
3983 - stk_ptr = getregister(rsp);
3984 -#else
3985 - stk_ptr = getregister(esp);
3986 -#endif
3987 -
3988 - fd = dup(dosemu_proc_self_maps_fd);
3989 - if ((fp = fdopen(fd, "r"))) {
3990 - while(fscanf(fp, "%lx-%lx%*[^\n]", &stk_beg, &stk_end) == 2) {
3991 - if (stk_ptr >= stk_beg && stk_ptr < stk_end) {
3992 - stack_init_top = stk_end;
3993 - stack_init_bot = stk_beg;
3994 - c_printf("CPU: Stack bottom %#lx, top %#lx, esp=%#lx\n",
3995 - stack_init_bot, stack_init_top, stk_ptr);
3996 - break;
3997 - }
3998 - }
3999 - fclose(fp);
4000 - }
4001
4002 #ifdef X86_EMULATOR
4003 if (config.cpuemu) {
4004 diff -urN dosemu-1.4.0/src/emu-i386/simx86/codegen-sim.c dosemu-1.4.0.1/src/emu-i386/simx86/codegen-sim.c
4005 --- dosemu-1.4.0/src/emu-i386/simx86/codegen-sim.c 2007-05-04 11:22:52.000000000 -0400
4006 +++ dosemu-1.4.0.1/src/emu-i386/simx86/codegen-sim.c 2008-03-18 09:39:44.000000000 -0400
4007 @@ -2204,10 +2204,12 @@
4008 break;
4009
4010 case O_MOVS_MovD: {
4011 - int df = CPUWORD(Ofs_FLAGS) & EFLAGS_DF;
4012 + int df = (CPUWORD(Ofs_FLAGS) & EFLAGS_DF? -1:1);
4013 register unsigned int i, v;
4014 i = TR1.d;
4015 GTRACE4("O_MOVS_MovD",0xff,0xff,df,i);
4016 + if(i == 0)
4017 + break;
4018 v = vga_read_access(AR2.d) | (vga_write_access(AR1.d) << 1);
4019 if (v) {
4020 int op;
4021 @@ -2216,7 +2218,6 @@
4022 _rdi = AR1.d;
4023 _rsi = AR2.d;
4024 _rcx = i;
4025 - df = 1 - 2*(df ? 1 : 0);
4026 op = 2 | (v == 3 ? 4 : 0);
4027 if (mode & MBYTE) {
4028 op |= 1;
4029 @@ -2229,8 +2230,48 @@
4030 e_VgaMovs(scp, op, (mode & DATA16) ? 1 : 0, df);
4031 AR1.d = _edi;
4032 AR2.d = _esi;
4033 + if (mode&(MREP|MREPNE)) TR1.d = 0;
4034 + break;
4035 + }
4036 + if(mode & ADDR16) {
4037 + unsigned int minofs, bytesbefore;
4038 + /* overflow check (DR2 is SI, SR1 is DI) */
4039 + if (df == -1) {
4040 + minofs = min(SR1.d,DR2.d);
4041 + bytesbefore = (i-1)*OPSIZE(mode);
4042 + } else {
4043 + minofs = 0x10000 - max(SR1.d,DR2.d);
4044 + bytesbefore = i*OPSIZE(mode);
4045 + }
4046 + if(bytesbefore > minofs) {
4047 + unsigned int possible;
4048 + /* caught 16 bit address overflow: do it piecewise */
4049 +
4050 + /* misaligned overflow generates trap. */
4051 + if(minofs & (OPSIZE(mode)-1)) {
4052 + TheCPU.err=EXCP0D_GPF;
4053 + break;
4054 + }
4055 +
4056 + /* do maximal possible amount */
4057 + possible = minofs / (OPSIZE(mode));
4058 + if (df < 0)
4059 + possible++;
4060 + TR1.d = possible;
4061 + Gen_sim(O_MOVS_MovD,mode);
4062 + /* emulate overflow */
4063 + if(SR1.d == minofs)
4064 + AR1.d -= df*0x10000;
4065 + if(DR2.d == minofs)
4066 + AR2.d -= df*0x10000;
4067 +
4068 + /* do the rest */
4069 + TR1.d = i - possible;
4070 + Gen_sim(O_MOVS_MovD,mode);
4071 + break;
4072 + }
4073 }
4074 - else if (df) {
4075 + if (df<0) {
4076 if (mode&MBYTE) {
4077 while (i--) *AR1.pu-- = *AR2.pu--;
4078 }
4079 @@ -2253,7 +2294,6 @@
4080 }
4081 }
4082 if (mode&(MREP|MREPNE)) TR1.d = 0;
4083 - // ! Warning DI,SI wrap in 16-bit mode
4084 }
4085 break;
4086 case O_MOVS_LodD: {
4087 @@ -2305,46 +2345,40 @@
4088 if (!(mode&DATA16)) AR1.pu += 2*df;
4089 }
4090 }
4091 + if (mode&(MREP|MREPNE)) TR1.d = 0;
4092 + break;
4093 }
4094 - else if(mode & ADDR16 && df == 1 &&
4095 - OPSIZE(mode)*i + SR1.d > 0x10000)
4096 - {
4097 - unsigned int possible, remaining;
4098 - /* 16 bit address overflow detected */
4099 - if(AR1.d & (OPSIZE(mode)-1))
4100 - {
4101 - /* misaligned overflow generates trap. */
4102 - TheCPU.err=EXCP0D_GPF;
4103 - break;
4104 - }
4105 - possible = (0x10000-SR1.d)/OPSIZE(mode);
4106 - remaining = i - possible;
4107 - TR1.d = possible;
4108 - Gen_sim(O_MOVS_StoD,mode);
4109 - AR1.d -= 0x10000;
4110 - TR1.d = remaining;
4111 - Gen_sim(O_MOVS_StoD,mode);
4112 - }
4113 - else if(mode & ADDR16 && df == -1 && i &&
4114 - OPSIZE(mode)*(i-1) > SR1.d)
4115 - {
4116 - unsigned int possible, remaining;
4117 - /* 16 bit address overflow detected */
4118 + if((mode & ADDR16) && i) {
4119 + unsigned int minofs, bytesbefore;
4120 + /* overflow check (SR1 is DI) */
4121 + if (df == -1) {
4122 + minofs = SR1.d;
4123 + bytesbefore = (i-1)*OPSIZE(mode);
4124 + } else {
4125 + minofs = 0x10000 - SR1.d;
4126 + bytesbefore = i*OPSIZE(mode);
4127 + }
4128 + if(bytesbefore > minofs) {
4129 + unsigned int possible;
4130 + /* caught 16 bit address overflow: do it piecewise */
4131 if(AR1.d & (OPSIZE(mode)-1))
4132 {
4133 /* misaligned overflow generates trap. */
4134 TheCPU.err=EXCP0D_GPF;
4135 break;
4136 }
4137 - possible = SR1.d/OPSIZE(mode) + 1;
4138 - remaining = i - possible;
4139 + possible = minofs / (OPSIZE(mode));
4140 + if (df < 0)
4141 + possible++;
4142 TR1.d = possible;
4143 Gen_sim(O_MOVS_StoD,mode);
4144 - AR1.d += 0x10000;
4145 - TR1.d = remaining;
4146 + AR1.d -= 0x10000*df;
4147 + TR1.d = i - possible;
4148 Gen_sim(O_MOVS_StoD,mode);
4149 + break;
4150 + }
4151 }
4152 - else if (mode&MBYTE) {
4153 + if (mode&MBYTE) {
4154 while (i--) { *AR1.pu = DR1.b.bl; AR1.pu += df; }
4155 }
4156 else if (mode&DATA16) {
4157 diff -urN dosemu-1.4.0/src/emu-i386/simx86/codegen-sim.h dosemu-1.4.0.1/src/emu-i386/simx86/codegen-sim.h
4158 --- dosemu-1.4.0/src/emu-i386/simx86/codegen-sim.h 2007-05-04 01:59:48.000000000 -0400
4159 +++ dosemu-1.4.0.1/src/emu-i386/simx86/codegen-sim.h 2007-09-24 06:01:48.000000000 -0400
4160 @@ -106,21 +106,10 @@
4161 /////////////////////////////////////////////////////////////////////////////
4162
4163 // returns 1(16 bit), 0(32 bit)
4164 -#define BTA(bpos, mode) ({ register int temp; \
4165 - __asm__ ("bt %1,%2\n \
4166 - rcrl $1,%0\n \
4167 - shrl $31,%0" \
4168 - : "=&r"(temp) \
4169 - : "i"(bpos), "g"(mode) ); temp; })
4170 +#define BTA(bpos, mode) (((mode) >> (bpos)) & 1)
4171
4172 // returns 2(16 bit), 4(32 bit)
4173 -#define BT24(bpos, mode) ({ register int temp; \
4174 - __asm__ ("movb $4,%b0\n \
4175 - bt %1,%2\n \
4176 - sbbb $0,%b0\n \
4177 - andl $6,%0" \
4178 - : "=&q"(temp) \
4179 - : "i"(bpos), "g"(mode) ); temp; })
4180 +#define BT24(bpos, mode) (4 - (((mode) << (1-(bpos))) & 2))
4181
4182 static __inline__ int FastLog2(register int v)
4183 {
4184 diff -urN dosemu-1.4.0/src/emu-i386/simx86/codegen-x86.h dosemu-1.4.0.1/src/emu-i386/simx86/codegen-x86.h
4185 --- dosemu-1.4.0/src/emu-i386/simx86/codegen-x86.h 2007-05-04 01:59:48.000000000 -0400
4186 +++ dosemu-1.4.0.1/src/emu-i386/simx86/codegen-x86.h 2007-09-24 06:01:48.000000000 -0400
4187 @@ -82,21 +82,10 @@
4188 /////////////////////////////////////////////////////////////////////////////
4189
4190 // returns 1(16 bit), 0(32 bit)
4191 -#define BTA(bpos, mode) ({ register int temp; \
4192 - __asm__ ("bt %1,%2\n \
4193 - rcrl $1,%0\n \
4194 - shrl $31,%0" \
4195 - : "=&r"(temp) \
4196 - : "i"(bpos), "g"(mode) ); temp; })
4197 +#define BTA(bpos, mode) (((mode) >> (bpos)) & 1)
4198
4199 // returns 2(16 bit), 4(32 bit)
4200 -#define BT24(bpos, mode) ({ register int temp; \
4201 - __asm__ ("movb $4,%b0\n \
4202 - bt %1,%2\n \
4203 - sbbb $0,%b0\n \
4204 - andl $6,%0" \
4205 - : "=&q"(temp) \
4206 - : "i"(bpos), "g"(mode) ); temp; })
4207 +#define BT24(bpos, mode) (4 - (((mode) << (1-(bpos))) & 2))
4208
4209 static __inline__ int FastLog2(register int v)
4210 {
4211 diff -urN dosemu-1.4.0/src/emu-i386/simx86/cpu-emu.c dosemu-1.4.0.1/src/emu-i386/simx86/cpu-emu.c
4212 --- dosemu-1.4.0/src/emu-i386/simx86/cpu-emu.c 2007-05-04 01:59:48.000000000 -0400
4213 +++ dosemu-1.4.0.1/src/emu-i386/simx86/cpu-emu.c 2007-06-01 00:49:49.000000000 -0400
4214 @@ -71,7 +71,7 @@
4215 static int iniflag = 0;
4216 static int vm86only = 0;
4217
4218 -hitimer_t sigEMUtime = 0;
4219 +static hitimer_t sigEMUtime = 0;
4220 static hitimer_t lastEMUsig = 0;
4221 static unsigned long sigEMUdelta = 0;
4222 int eTimeCorrect;
4223 @@ -519,7 +519,7 @@
4224 config.cpuemu=4-vm86only;
4225 }
4226
4227 - if (debug_level('e')>1) e_printf("Reg2Cpu> vm86=%08lx dpm=%08x emu=%08x evf=%08x\n",
4228 + if (debug_level('e')>1) e_printf("Reg2Cpu> vm86=%08x dpm=%08x emu=%08x evf=%08x\n",
4229 vm86s.regs.eflags,get_vFLAGS(TheCPU.eflags),TheCPU.eflags,TheCPU.veflags);
4230 TheCPU.eax = vm86s.regs.eax; /* 2c -> 18 */
4231 TheCPU.ebx = vm86s.regs.ebx; /* 20 -> 00 */
4232 @@ -541,10 +541,10 @@
4233 trans_addr = LONG_CS + TheCPU.eip;
4234
4235 if (debug_level('e')>1) {
4236 - if (debug_level('e')==3) e_printf("Reg2Cpu< vm86=%08lx dpm=%08x emu=%08x evf=%08x\n%s\n",
4237 + if (debug_level('e')==3) e_printf("Reg2Cpu< vm86=%08x dpm=%08x emu=%08x evf=%08x\n%s\n",
4238 vm86s.regs.eflags,get_vFLAGS(TheCPU.eflags),TheCPU.eflags,TheCPU.veflags,
4239 e_print_regs());
4240 - else e_printf("Reg2Cpu< vm86=%08lx dpm=%08x emu=%08x evf=%08x\n",
4241 + else e_printf("Reg2Cpu< vm86=%08x dpm=%08x emu=%08x evf=%08x\n",
4242 vm86s.regs.eflags,get_vFLAGS(TheCPU.eflags),TheCPU.eflags,TheCPU.veflags);
4243 }
4244 }
4245 @@ -555,7 +555,7 @@
4246 static void Cpu2Reg (void)
4247 {
4248 int mask;
4249 - if (debug_level('e')>1) e_printf("Cpu2Reg> vm86=%08lx dpm=%08x emu=%08x evf=%08x\n",
4250 + if (debug_level('e')>1) e_printf("Cpu2Reg> vm86=%08x dpm=%08x emu=%08x evf=%08x\n",
4251 vm86s.regs.eflags,get_vFLAGS(TheCPU.eflags),TheCPU.eflags,TheCPU.veflags);
4252 vm86s.regs.eax = TheCPU.eax;
4253 vm86s.regs.ebx = TheCPU.ebx;
4254 @@ -581,7 +581,7 @@
4255 vm86s.regs.eflags = (vm86s.regs.eflags & VIP) |
4256 (eVEFLAGS & mask) | (TheCPU.eflags & ~(mask|VIP));
4257
4258 - if (debug_level('e')>1) e_printf("Cpu2Reg< vm86=%08lx dpm=%08x emu=%08x evf=%08x\n",
4259 + if (debug_level('e')>1) e_printf("Cpu2Reg< vm86=%08x dpm=%08x emu=%08x evf=%08x\n",
4260 vm86s.regs.eflags,get_vFLAGS(TheCPU.eflags),TheCPU.eflags,TheCPU.veflags);
4261 }
4262
4263 @@ -697,7 +697,7 @@
4264 (eVEFLAGS & mask) | (TheCPU.eflags & ~(mask|VIP));
4265 _eflags = vm86s.regs.eflags & ~VM;
4266 }
4267 - if (debug_level('e')>1) e_printf("Cpu2Scp< scp=%08lx vm86=%08lx dpm=%08x fl=%08x vf=%08x\n",
4268 + if (debug_level('e')>1) e_printf("Cpu2Scp< scp=%08lx vm86=%08x dpm=%08x fl=%08x vf=%08x\n",
4269 _eflags,vm86s.regs.eflags,get_vFLAGS(TheCPU.eflags),TheCPU.eflags,eVEFLAGS);
4270 }
4271
4272 @@ -763,6 +763,9 @@
4273 if (!CONFIG_CPUSIM)
4274 eTimeCorrect = 1; // 1/2 backtime stretch
4275 #endif
4276 + if (!config.rdtsc)
4277 + eTimeCorrect = -1; // if we can't trust the TSC for time keeping
4278 + // then don't use it to stretch either
4279 if (config.cpuemu == 3)
4280 vm86only = 1;
4281 memset(&TheCPU, 0, sizeof(SynCPU));
4282 @@ -988,7 +991,7 @@
4283
4284 if (eVEFLAGS & VIF_MASK)
4285 flags |= IF_MASK;
4286 - return flags | (eVEFLAGS & eTSSMASK);
4287 + return flags | ((IOPL_MASK|eVEFLAGS) & eTSSMASK);
4288 }
4289
4290 static inline int e_revectored(int nr, struct revectored_struct * bitmap)
4291 @@ -1281,7 +1284,7 @@
4292 if (CONFIG_CPUSIM)
4293 FlagSync_All();
4294
4295 - if (debug_level('e')>1) e_printf("DPM86: EXCP %#x eflags=%08lx\n",
4296 + if (debug_level('e')>1) e_printf("DPM86: EXCP %#x eflags=%08x\n",
4297 xval-1, REG(eflags));
4298
4299 TheCPU.eflags &= ~TF; /* is it right? */
4300 diff -urN dosemu-1.4.0/src/emu-i386/simx86/interp.c dosemu-1.4.0.1/src/emu-i386/simx86/interp.c
4301 --- dosemu-1.4.0/src/emu-i386/simx86/interp.c 2007-05-04 01:59:48.000000000 -0400
4302 +++ dosemu-1.4.0.1/src/emu-i386/simx86/interp.c 2007-09-23 17:44:02.000000000 -0400
4303 @@ -163,12 +163,12 @@
4304 dsp = pskip + (signed char)Fetch(P2+1);
4305 }
4306 else if ((btype&5)==4) { // jmp (word/long)
4307 - pskip = 1 + BT24(BitADDR16,mode);
4308 - dsp = pskip + (int)AddrFetchWL_S(mode, P2+1);
4309 + pskip = 1 + BT24(BitDATA16,mode);
4310 + dsp = pskip + (int)DataFetchWL_S(mode, P2+1);
4311 }
4312 else { // long branch (word/long)
4313 - pskip = 2 + BT24(BitADDR16,mode);
4314 - dsp = pskip + (int)AddrFetchWL_S(mode, P2+2);
4315 + pskip = 2 + BT24(BitDATA16,mode);
4316 + dsp = pskip + (int)DataFetchWL_S(mode, P2+2);
4317 }
4318
4319 /* displacement for taken branch */
4320 @@ -199,17 +199,17 @@
4321 int dsp2 = (signed char)Fetch(P1+1) + 2;
4322 if (dsp2 < 0) mode |= CKSIGN;
4323 d_nt = ((long)P1 - LONG_CS) + dsp2;
4324 - if (mode&ADDR16) d_nt &= 0xffff;
4325 + if (mode&DATA16) d_nt &= 0xffff;
4326 j_nt = d_nt + LONG_CS;
4327 e_printf("JMPs (%02x,%d) at %08lx after Jcc: t=%08lx nt=%08lx\n",
4328 P1[0],dsp2,(long)P1,j_t,j_nt);
4329 }
4330 else if (Fetch(P1)==JMPd) { /* e9 xxxx{xxxx} */
4331 - int skp2 = BT24(BitADDR16,mode) + 1;
4332 - int dsp2 = skp2 + (int)AddrFetchWL_S(mode, P1+1);
4333 + int skp2 = BT24(BitDATA16,mode) + 1;
4334 + int dsp2 = skp2 + (int)DataFetchWL_S(mode, P1+1);
4335 if (dsp2 < 0) mode |= CKSIGN;
4336 d_nt = ((long)P1 - LONG_CS) + dsp2;
4337 - if (mode&ADDR16) d_nt &= 0xffff;
4338 + if (mode&DATA16) d_nt &= 0xffff;
4339 j_nt = d_nt + LONG_CS;
4340 e_printf("JMPl (%02x,%d) at %08lx after Jcc: t=%08lx nt=%08lx\n",
4341 P1[0],dsp2,(long)P1,j_t,j_nt);
4342 @@ -472,14 +472,10 @@
4343 CEmuStat |= CeS_TRAP;
4344 }
4345 }
4346 -// ------ temp ------- debug ------------------------
4347 if ((PC==NULL)||(*((int *)PC)==0)) {
4348 - set_debug_level('e',9);
4349 - dbug_printf("\n%s\nFetch %08x at %p mode %x\n",
4350 + e_printf("\n%s\nFetch %08x at %p mode %x\n",
4351 e_print_regs(),*((int *)PC),PC,mode);
4352 - TheCPU.err = -99; return PC;
4353 }
4354 -// ------ temp ------- debug ------------------------
4355 NewNode = 1;
4356
4357 override:
4358 @@ -657,7 +653,7 @@
4359 /* virtual-8086 monitor */
4360 temp = EFLAGS & 0xdff;
4361 if (eVEFLAGS & VIF) temp |= EFLAGS_IF;
4362 - temp |= ((eVEFLAGS & (eTSSMASK|VIF)) |
4363 + temp |= (((IOPL_MASK|eVEFLAGS) & (eTSSMASK|VIF)) |
4364 (vm86s.regs.eflags&VIP)); // this one FYI
4365 PUSH(mode, &temp);
4366 if (debug_level('e')>1)
4367 @@ -702,9 +698,22 @@
4368 e_printf("Undocumented op 0xd6\n");
4369 rAL = (EFLAGS & EFLAGS_CF? 0xff:0x00);
4370 PC++; break;
4371 -/*62*/ case BOUND:
4372 +/*62*/ case BOUND: {
4373 + signed int lo, hi, r;
4374 CODE_FLUSH();
4375 - goto not_implemented;
4376 + PC += ModRMSim(PC, mode);
4377 + r = GetCPU_WL(mode, REG1);
4378 + lo = DataGetWL_S(mode,TheCPU.mem_ref);
4379 + TheCPU.mem_ref += BT24(BitDATA16, mode);
4380 + hi = DataGetWL_S(mode,TheCPU.mem_ref);
4381 + if(r < lo || r > hi)
4382 + {
4383 + e_printf("Bound interrupt 05\n");
4384 + TheCPU.err=EXCP05_BOUND;
4385 + return PC;
4386 + }
4387 + break;
4388 + }
4389 /*63*/ case ARPL:
4390 CODE_FLUSH();
4391 goto not_implemented;
4392 @@ -783,6 +792,40 @@
4393 e_printf("ADDRoverride: new mode %04x\n",mode);
4394 PC++; goto override;
4395
4396 +/*f0*/ case LOCK: { int i = 1; unsigned char op;
4397 + do {
4398 + op = Fetch(PC+i);
4399 + i++;
4400 + } while (op == SEGcs || op == SEGss || op == SEGds ||
4401 + op == SEGes || op == SEGfs || op == SEGgs ||
4402 + op == OPERoverride || op == ADDRoverride);
4403 + /* LOCK is allowed on BTS, BTR, BTC, XCHG, ADD...XOR (but not CMP),
4404 + INC, DEC, NOT, NEG -- just ignore LOCK for now... */
4405 + if (op == 0x0f) {
4406 + op = Fetch(PC+i+1); /* BTS/BTR/BTC */
4407 + if (op == 0xab || op == 0xb3 || op == 0xbb) {
4408 + PC++; goto override;
4409 + }
4410 + } else if (op >= 0xf6 && op < 0xf8) { /*NOT/NEG*/
4411 + op = Fetch(PC+i+1);
4412 + if ((op & 0x30) == 0x10) {
4413 + PC++; goto override;
4414 + }
4415 + } else if (op >= 0xfe) { /*INC/DEC*/
4416 + op = Fetch(PC+i+1);
4417 + if ((op & 0x30) == 0x00) {
4418 + PC++; goto override;
4419 + }
4420 + }
4421 + else if ((op < 0x38 && (op & 0x8) < 6) || /*ADD..XOR*/
4422 + (op >= 0x40 && op < 0x50) || /*INC/DEC*/
4423 + (op >= 0x90 && op < 0x98) ||
4424 + op == 0x86 || op == 0x87) { /*XCHG*/
4425 + PC++; goto override;
4426 + }
4427 + CODE_FLUSH();
4428 + goto illegal_op;
4429 + }
4430 /*40*/ case INCax:
4431 /*41*/ case INCcx:
4432 /*42*/ case INCdx:
4433 @@ -1355,10 +1398,10 @@
4434 unsigned long oip,xcs,jip=0;
4435 CODE_FLUSH();
4436 /* get new cs:ip */
4437 - jip = AddrFetchWL_U(mode, PC+1);
4438 - INC_WL_PCA(mode,1);
4439 - jcs = AddrFetchWL_U(mode, PC);
4440 - INC_WL_PCA(mode,0);
4441 + jip = DataFetchWL_U(mode, PC+1);
4442 + INC_WL_PC(mode,1);
4443 + jcs = FetchW(PC);
4444 + PC+=2;
4445 /* check if new cs is valid, save old for error */
4446 ocs = TheCPU.cs;
4447 xcs = LONG_CS;
4448 @@ -1467,9 +1510,15 @@
4449 return PC;
4450 /*ce*/ case INTO:
4451 CODE_FLUSH();
4452 - e_printf("Overflow interrupt 04\n");
4453 - TheCPU.err=EXCP04_INTO;
4454 - return P0;
4455 + FlagSync_O();
4456 + PC++;
4457 + if(EFLAGS & EFLAGS_OF)
4458 + {
4459 + e_printf("Overflow interrupt 04\n");
4460 + TheCPU.err=EXCP04_INTO;
4461 + return PC;
4462 + }
4463 + break;
4464 /*cd*/ case INT:
4465 CODE_FLUSH();
4466 #ifdef ASM_DUMP
4467 @@ -1988,8 +2037,10 @@
4468 case 0x1a: /*INPUT_STATUS_1*/
4469 rAL = VGA_emulate_inb(a);
4470 break;
4471 - default: dbug_printf("not emulated EC %x\n",a);
4472 - leavedos(0);
4473 + default:
4474 + e_printf("Bad read from port %x, returning FF\n",a);
4475 + rAL = 0xFF;
4476 + break;
4477 }
4478 PC++; break;
4479 }
4480 @@ -2144,8 +2195,9 @@
4481 case 0x1a: /*FEATURE_CONTROL_W*/
4482 VGA_emulate_outb(a,rAL);
4483 break;
4484 - default: dbug_printf("not emulated EE %x\n",a);
4485 - leavedos(0);
4486 + default:
4487 + e_printf("Ignoring write to port %x\n",a);
4488 + break;
4489 }
4490 PC++; break;
4491 }
4492 diff -urN dosemu-1.4.0/src/emu-i386/simx86/sigsegv.c dosemu-1.4.0.1/src/emu-i386/simx86/sigsegv.c
4493 --- dosemu-1.4.0/src/emu-i386/simx86/sigsegv.c 2007-05-04 01:59:48.000000000 -0400
4494 +++ dosemu-1.4.0.1/src/emu-i386/simx86/sigsegv.c 2008-03-11 09:59:00.000000000 -0400
4495 @@ -271,7 +271,7 @@
4496 if ((_err&2)==0) goto badrw;
4497 if (p[1]!=0x07) goto unimp;
4498 e_VgaWrite(_edi,_eax,MBYTE);
4499 - _rip += (long)(p+2); break;
4500 + _rip = (long)(p+2); break;
4501 case 0x89: // write word
4502 if ((_err&2)==0) goto badrw;
4503 if (p[1]!=0x07) goto unimp;
4504 @@ -408,7 +408,7 @@
4505 /* if config.cpuemu==3 (only vm86 emulated) then this function can
4506 be trapped from within DPMI, and we still must be prepared to
4507 reset permissions on code pages */
4508 - if (_cs == getsegment(cs) && ((debug_level('e')>1) || (_trapno!=0x0e))) {
4509 + if (!DPMIValidSelector(_cs) && ((debug_level('e')>1) || (_trapno!=0x0e))) {
4510 dbug_printf("==============================================================\n");
4511 dbug_printf("CPU exception 0x%02x err=0x%08lx cr2=%08lx eip=%08lx\n",
4512 _trapno, _err, _cr2, _rip);
4513 @@ -434,7 +434,7 @@
4514
4515 if (_trapno==0x0e) {
4516 if (Video->update_screen) {
4517 - if (_cs == getsegment(cs)) {
4518 + if (!DPMIValidSelector(_cs)) {
4519 unsigned pf = (unsigned)_cr2 >> 12;
4520 if ((pf & 0xfffe0) == 0xa0) {
4521 TrapVgaOn = 1;
4522 @@ -458,11 +458,21 @@
4523 * bit 2 = 1 user mode
4524 * bit 3 = 0 no reserved bit err
4525 */
4526 - if (_cr2 > stack_init_bot) {
4527 +#ifdef __x86_64__
4528 + if (_cr2 > 0xffffffff)
4529 +#else
4530 + if (_cr2 > getregister(esp))
4531 +#endif
4532 + {
4533 error("Accessing reserved memory at %08lx\n"
4534 "\tMaybe a null segment register\n",_cr2);
4535 goto verybad;
4536 }
4537 + if (DPMIValidSelector(_cs) &&
4538 + (unsigned char *)_cr2 >= ldt_buffer &&
4539 + (unsigned char *)_cr2 < ldt_buffer + LDT_ENTRIES*LDT_ENTRY_SIZE)
4540 + /* LDT access emulation */
4541 + return 0;
4542 if ((_err&0x0f)==0x07) {
4543 unsigned char *p = (unsigned char *)_rip;
4544 int codehit = 0;
4545 @@ -488,7 +498,9 @@
4546 #ifdef PROFILE
4547 PageFaults++;
4548 #endif
4549 - if (debug_level('e') || (!InCompiledCode && _cs == getsegment(cs))) {
4550 + if (DPMIValidSelector(_cs))
4551 + p = (unsigned char *) SEL_ADR(_cs, _rip);
4552 + if (debug_level('e') || (!InCompiledCode && !DPMIValidSelector(_cs))) {
4553 v = *((int *)p);
4554 __asm__("bswap %0" : "=r" (v) : "0" (v));
4555 e_printf("Faulting ops: %08x\n",v);
4556 @@ -496,7 +508,7 @@
4557 if (!InCompiledCode) {
4558 dbug_printf("*\tFault out of %scode, cs:eip=%x:%lx,"
4559 " cr2=%lx, fault_cnt=%d\n",
4560 - _cs == getsegment(cs) ? "DOSEMU " : "",
4561 + !DPMIValidSelector(_cs) ? "DOSEMU " : "",
4562 _cs, _rip, _cr2, fault_cnt);
4563 }
4564 if (e_querymark((void *)_cr2)) {
4565 @@ -510,11 +522,11 @@
4566 * linked by Cpatch will do it */
4567 /* ACH: we can set up a data patch for code
4568 * which has not yet been executed! */
4569 - if (InCompiledCode && Cpatch(scp))
4570 + if (InCompiledCode && !e_querymark((void *)_cr2) && Cpatch(scp))
4571 return 1;
4572 /* We HAVE to invalidate all the code in the page
4573 * if the page is going to be unprotected */
4574 - InvalidateNodePage(_cr2, 0, _rip, &codehit);
4575 + InvalidateNodePage(_cr2, 0, (long)p, &codehit);
4576 e_resetpagemarks((void *)_cr2, 1);
4577 e_munprotect((void *)_cr2, 0);
4578 /* now go back and perform the faulting op */
4579 diff -urN dosemu-1.4.0/src/emu-i386/simx86/trees.c dosemu-1.4.0.1/src/emu-i386/simx86/trees.c
4580 --- dosemu-1.4.0/src/emu-i386/simx86/trees.c 2007-05-04 01:59:48.000000000 -0400
4581 +++ dosemu-1.4.0.1/src/emu-i386/simx86/trees.c 2008-03-18 10:39:17.000000000 -0400
4582 @@ -1194,6 +1194,7 @@
4583 int InvalidateSingleNode (long addr, long eip)
4584 {
4585 int nnh = 0;
4586 + long ah;
4587 TNode *G = &CollectTree.root;
4588 #ifdef PROFILE
4589 hitimer_t t0;
4590 @@ -1219,9 +1220,13 @@
4591 }
4592 if (debug_level('e')>1) e_printf("Invalidate from node %08x\n",G->key);
4593
4594 + /* we need to round to PAGE_SIZE for the loop termination test because of
4595 + backwards jumps and NOJUMPS */
4596 + ah = (addr & PAGE_MASK) + PAGE_SIZE;
4597 +
4598 /* walk tree in ascending, hopefully sorted, address order */
4599 for (;;) {
4600 - if ((G == &CollectTree.root) || (G->key > addr)) break;
4601 + if ((G == &CollectTree.root) || (G->key > ah)) break;
4602
4603 if (G->addr && (G->alive>0)) {
4604 long ahG = G->seqbase + G->seqlen;
4605 diff -urN dosemu-1.4.0/src/emu-i386/simx86/trees.h dosemu-1.4.0.1/src/emu-i386/simx86/trees.h
4606 --- dosemu-1.4.0/src/emu-i386/simx86/trees.h 2007-05-04 01:59:48.000000000 -0400
4607 +++ dosemu-1.4.0.1/src/emu-i386/simx86/trees.h 2008-03-16 11:24:28.000000000 -0400
4608 @@ -78,7 +78,8 @@
4609 } IGen;
4610
4611 typedef struct _ianpc {
4612 - unsigned short daddr, dnpc __attribute__ ((packed));
4613 + unsigned short daddr __attribute__ ((packed));
4614 + signed short dnpc __attribute__ ((packed));
4615 } Addr2Pc;
4616
4617 typedef struct _imeta {
4618 diff -urN dosemu-1.4.0/src/env/video/crtcemu.c dosemu-1.4.0.1/src/env/video/crtcemu.c
4619 --- dosemu-1.4.0/src/env/video/crtcemu.c 2007-05-04 01:59:48.000000000 -0400
4620 +++ dosemu-1.4.0.1/src/env/video/crtcemu.c 2007-06-01 00:16:29.000000000 -0400
4621 @@ -122,6 +122,10 @@
4622 (h & 0x100) >> (8 - 3);
4623 vga.crtc.data[0x9] &= ~0x20;
4624 vga.crtc.data[0x9] |= (h & 0x200) >> (9 - 5);
4625 + if (vga.mode_class == TEXT) {
4626 + vga.crtc.data[0x9] &= ~0x1f;
4627 + vga.crtc.data[0x9] |= (vga.char_height - 1) & 0x1f;
4628 + }
4629 }
4630 if (vga.scan_len < 2048 && vga.color_bits == 8) {
4631 vga.crtc.data[0x13] = vga.scan_len / 8;
4632 @@ -134,15 +138,6 @@
4633 }
4634 }
4635
4636 - vgaemu_adj_cfg(CFG_CRTC_ADDR_MODE, 1);
4637 - vgaemu_adj_cfg(CFG_CRTC_WIDTH, 1);
4638 - vgaemu_adj_cfg(CFG_CRTC_HEIGHT, 1);
4639 - vgaemu_adj_cfg(CFG_CRTC_LINE_COMPARE, 1);
4640 -#if 0
4641 - /* need to fix vgaemu before this is possible */
4642 - vgaemu_adj_cfg(CFG_MODE_CONTROL, 1);
4643 -#endif
4644 -
4645 crtc_msg("CRTC_init done\n");
4646 }
4647
4648 diff -urN dosemu-1.4.0/src/env/video/seqemu.c dosemu-1.4.0.1/src/env/video/seqemu.c
4649 --- dosemu-1.4.0/src/env/video/seqemu.c 2007-05-04 01:59:48.000000000 -0400
4650 +++ dosemu-1.4.0.1/src/env/video/seqemu.c 2007-06-01 00:16:29.000000000 -0400
4651 @@ -199,7 +199,6 @@
4652
4653 vga.seq.index = 0;
4654
4655 - vgaemu_adj_cfg(CFG_SEQ_ADDR_MODE, 1);
4656 vga.seq.map_mask = vga.seq.data[2] & 0xf;
4657
4658 seq_msg("Seq_init done\n");
4659 diff -urN dosemu-1.4.0/src/env/video/text.c dosemu-1.4.0.1/src/env/video/text.c
4660 --- dosemu-1.4.0/src/env/video/text.c 2007-05-04 01:59:48.000000000 -0400
4661 +++ dosemu-1.4.0.1/src/env/video/text.c 2007-05-18 00:33:49.000000000 -0400
4662 @@ -55,7 +55,7 @@
4663 #if CONFIG_SELECTION
4664 static int sel_start_row = -1, sel_end_row = -1, sel_start_col, sel_end_col;
4665 static unsigned short *sel_start = NULL, *sel_end = NULL;
4666 -static u_char *sel_text = NULL;
4667 +static t_unicode *sel_text = NULL;
4668 static Boolean doing_selection = FALSE, visible_selection = FALSE;
4669 #endif
4670
4671 @@ -820,30 +820,28 @@
4672 static void save_selection(int col1, int row1, int col2, int row2)
4673 {
4674 int row, col, line_start_col, line_end_col, co;
4675 - u_char *sel_text_dos, *sel_text_latin, *sel_text_ptr, *prev_sel_text_latin;
4676 + u_char *sel_text_dos, *sel_text_ptr;
4677 + t_unicode *sel_text_unicode, *prev_sel_text_unicode;
4678 size_t sel_space, sel_text_bytes;
4679 u_char *p;
4680 Bit16u *screen_adr;
4681
4682 - struct char_set_state paste_state;
4683 struct char_set_state video_state; /* must not have any... */
4684
4685 - struct char_set *paste_charset = trconfig.paste_charset;
4686 struct char_set *video_charset = trconfig.video_mem_charset;
4687
4688 init_charset_state(&video_state, video_charset);
4689 - init_charset_state(&paste_state, paste_charset);
4690
4691 co = vga.scan_len / 2;
4692 screen_adr = (Bit16u *)(vga.mem.base + vga.display_start);
4693 p = sel_text_dos = malloc(vga.text_width);
4694 sel_space = (row2-row1+1)*(co+1)*MB_LEN_MAX+1;
4695 - sel_text_latin = sel_text = malloc(sel_space);
4696 + sel_text_unicode = sel_text = malloc(sel_space * sizeof(t_unicode));
4697
4698 /* Copy the text data. */
4699 for (row = row1; (row <= row2); row++)
4700 {
4701 - prev_sel_text_latin = sel_text_latin;
4702 + prev_sel_text_unicode = sel_text_unicode;
4703 line_start_col = ((row == row1) ? col1 : 0);
4704 line_end_col = ((row == row2) ? col2 : vga.text_width-1);
4705 p = sel_text_ptr = sel_text_dos;
4706 @@ -864,29 +862,23 @@
4707 }
4708 sel_text_bytes -= result;
4709 sel_text_ptr += result;
4710 - result = unicode_to_charset(&paste_state, symbol,
4711 - sel_text_latin, sel_space);
4712 - if (result == -1) {
4713 - warn("save_selection unfinished2\n");
4714 - break;
4715 - }
4716 - sel_text_latin += result;
4717 - sel_space -= result;
4718 + *sel_text_unicode++ = symbol;
4719 }
4720 /* Remove end-of-line spaces and add a newline. */
4721 if (col == vga.text_width)
4722 {
4723 - sel_text_latin--;
4724 - while ((*sel_text_latin == ' ') && (sel_text_latin > prev_sel_text_latin)) {
4725 - sel_text_latin--;
4726 + sel_text_unicode--;
4727 + while ((*sel_text_unicode == ' ') &&
4728 + (sel_text_unicode > prev_sel_text_unicode)) {
4729 + sel_text_unicode--;
4730 sel_space++;
4731 }
4732 - sel_text_latin++;
4733 + sel_text_unicode++;
4734 if (!sel_space) {
4735 error("BUG: pasting OOM\n");
4736 leavedos(91);
4737 }
4738 - *sel_text_latin++ = '\n';
4739 + *sel_text_unicode++ = '\n';
4740 sel_space--;
4741 }
4742 }
4743 @@ -895,11 +887,10 @@
4744 error("BUG: pasting OOM2\n");
4745 leavedos(91);
4746 }
4747 - *sel_text_latin = '\0';
4748 + *sel_text_unicode = '\0';
4749 sel_space--;
4750
4751 cleanup_charset_state(&video_state);
4752 - cleanup_charset_state(&paste_state);
4753 }
4754
4755 /*
4756 @@ -927,18 +918,15 @@
4757
4758 save_selection(col1, row1, col2, row2);
4759
4760 - v_printf("VGAEMU: Selection, %d,%d->%d,%d, size=%zu\n",
4761 - col1, row1, col2, row2, strlen(sel_text));
4762 -
4763 - if (strlen(sel_text) == 0)
4764 - return;
4765 + v_printf("VGAEMU: Selection, %d,%d->%d,%d\n",
4766 + col1, row1, col2, row2);
4767 }
4768
4769
4770 /*
4771 * End of selection (button released).
4772 */
4773 -char *end_selection()
4774 +t_unicode *end_selection()
4775 {
4776 if (!doing_selection)
4777 return NULL;
4778 diff -urN dosemu-1.4.0/src/env/video/vesa.c dosemu-1.4.0.1/src/env/video/vesa.c
4779 --- dosemu-1.4.0/src/env/video/vesa.c 2007-05-04 01:59:48.000000000 -0400
4780 +++ dosemu-1.4.0.1/src/env/video/vesa.c 2007-05-18 14:17:36.000000000 -0400
4781 @@ -209,13 +209,14 @@
4782 dos_vga_bios[2] = (bios_ptr + ((1 << 9) - 1)) >> 9;
4783 vgaemu_bios.pages = (bios_ptr + ((1 << 12) - 1)) >> 12;
4784
4785 - if (config.vbios_file) {
4786 + if (config.vgaemubios_file) {
4787 /* EXPERIMENTAL: load and boot the Bochs BIOS */
4788 - int fd = open(config.vbios_file, O_RDONLY);
4789 + int fd = open(config.vgaemubios_file, O_RDONLY);
4790 + int bytes;
4791 if (fd != -1) {
4792 - read(fd, (void*)0xc0000, 32768);
4793 + bytes = read(fd, (void*)0xc0000, 65536);
4794 close(fd);
4795 - vgaemu_bios.pages = 8;
4796 + vgaemu_bios.pages = (bytes + PAGE_SIZE - 1) / PAGE_SIZE;
4797 config.vbios_post = 1;
4798 }
4799 }
4800 diff -urN dosemu-1.4.0/src/env/video/vgaemu.c dosemu-1.4.0.1/src/env/video/vgaemu.c
4801 --- dosemu-1.4.0/src/env/video/vgaemu.c 2007-05-04 01:59:48.000000000 -0400
4802 +++ dosemu-1.4.0.1/src/env/video/vgaemu.c 2008-03-11 09:53:48.000000000 -0400
4803 @@ -823,7 +823,7 @@
4804 {
4805 int i;
4806 if (!vga.inst_emu) {
4807 - MEMCPY_DOS2DOS(dst, src, len);
4808 + MEMMOVE_DOS2DOS(dst, src, len);
4809 return;
4810 }
4811 for (i = 0; i < len; i++)
4812 @@ -968,7 +968,7 @@
4813 if(vga_page < vga.mem.pages) {
4814 vga.mem.dirty_map[vga_page] = 1;
4815 #ifdef X86_EMULATOR
4816 - if (config.cpuemu>1 && _cs == getsegment(cs)) {
4817 + if (config.cpuemu>1 && !DPMIValidSelector(_cs)) {
4818 error("VGAEmu: CPU emulation collision, should not be here\n");
4819 leavedos(0x4945);
4820 }
4821 @@ -983,7 +983,7 @@
4822 * a bug. However for the video modes that do not require instremu, we
4823 * can allow that access. For the planar modes we cant and will fail :(
4824 */
4825 - if(pmode && _cs == getsegment(cs)) {
4826 + if(pmode && !DPMIValidSelector(_cs)) {
4827 error("BUG: dosemu touched the protected video memory!!!\n");
4828 return False;
4829 }
4830 @@ -2286,7 +2286,8 @@
4831 vga.mem.wrap = vmi->buffer_len * 1024;
4832 // unmap ???
4833
4834 - if(vga.color_bits >= 8 && (vga.mode & 0xffff) >= 0x100) {
4835 + /* In Super-VGA modes, do *not* wrap memory at 256k */
4836 + if(vga.color_bits >= 8 && (vga.mode & 0xffff) > 0x13) {
4837 vga.mem.wrap = vga.mem.size;
4838 if(vga.mem.lfb_base_page) {
4839 vga.mem.map[VGAEMU_MAP_LFB_MODE].base_page = vga.mem.lfb_base_page;
4840 @@ -2304,6 +2305,16 @@
4841 GFX_init();
4842 Misc_init();
4843 Herc_init();
4844 +
4845 + vgaemu_adj_cfg(CFG_SEQ_ADDR_MODE, 1);
4846 + vgaemu_adj_cfg(CFG_CRTC_ADDR_MODE, 1);
4847 + vgaemu_adj_cfg(CFG_CRTC_WIDTH, 1);
4848 + vgaemu_adj_cfg(CFG_CRTC_HEIGHT, 1);
4849 + vgaemu_adj_cfg(CFG_CRTC_LINE_COMPARE, 1);
4850 +#if 0
4851 + /* need to fix vgaemu before this is possible */
4852 + vgaemu_adj_cfg(CFG_MODE_CONTROL, 1);
4853 +#endif
4854
4855 vga_msg("vga_emu_setmode: mode initialized\n");
4856
4857 diff -urN dosemu-1.4.0/src/include/Asm/vm86.h dosemu-1.4.0.1/src/include/Asm/vm86.h
4858 --- dosemu-1.4.0/src/include/Asm/vm86.h 2005-07-21 17:15:49.000000000 -0400
4859 +++ dosemu-1.4.0.1/src/include/Asm/vm86.h 2007-06-01 00:49:49.000000000 -0400
4860 @@ -69,22 +69,22 @@
4861 /*
4862 * normal regs, with special meaning for the segment descriptors..
4863 */
4864 - long ebx;
4865 - long ecx;
4866 - long edx;
4867 - long esi;
4868 - long edi;
4869 - long ebp;
4870 - long eax;
4871 - long __null_ds;
4872 - long __null_es;
4873 - long __null_fs;
4874 - long __null_gs;
4875 - long orig_eax;
4876 - long eip;
4877 + int ebx;
4878 + int ecx;
4879 + int edx;
4880 + int esi;
4881 + int edi;
4882 + int ebp;
4883 + int eax;
4884 + int __null_ds;
4885 + int __null_es;
4886 + int __null_fs;
4887 + int __null_gs;
4888 + int orig_eax;
4889 + int eip;
4890 unsigned short cs, __csh;
4891 - long eflags;
4892 - long esp;
4893 + int eflags;
4894 + int esp;
4895 unsigned short ss, __ssh;
4896 /*
4897 * these are specific to v86 mode:
4898 @@ -96,14 +96,14 @@
4899 };
4900
4901 struct revectored_struct {
4902 - unsigned long __map[8]; /* 256 bits */
4903 + unsigned int __map[8]; /* 256 bits */
4904 };
4905
4906 struct vm86_struct {
4907 struct vm86_regs regs;
4908 - unsigned long flags;
4909 - unsigned long screen_bitmap;
4910 - unsigned long cpu_type;
4911 + unsigned int flags;
4912 + unsigned int screen_bitmap;
4913 + unsigned int cpu_type;
4914 struct revectored_struct int_revectored;
4915 struct revectored_struct int21_revectored;
4916 };
4917 @@ -114,19 +114,19 @@
4918 #define VM86_SCREEN_BITMAP 0x0001
4919
4920 struct vm86plus_info_struct {
4921 - unsigned long force_return_for_pic:1;
4922 - unsigned long vm86dbg_active:1; /* for debugger */
4923 - unsigned long vm86dbg_TFpendig:1; /* for debugger */
4924 - unsigned long unused:28;
4925 - unsigned long is_vm86pus:1; /* for vm86 internal use */
4926 + unsigned int force_return_for_pic:1;
4927 + unsigned int vm86dbg_active:1; /* for debugger */
4928 + unsigned int vm86dbg_TFpendig:1; /* for debugger */
4929 + unsigned int unused:28;
4930 + unsigned int is_vm86pus:1; /* for vm86 internal use */
4931 unsigned char vm86dbg_intxxtab[32]; /* for debugger */
4932 };
4933
4934 struct vm86plus_struct {
4935 struct vm86_regs regs;
4936 - unsigned long flags;
4937 - unsigned long screen_bitmap;
4938 - unsigned long cpu_type;
4939 + unsigned int flags;
4940 + unsigned int screen_bitmap;
4941 + unsigned int cpu_type;
4942 struct revectored_struct int_revectored;
4943 struct revectored_struct int21_revectored;
4944 struct vm86plus_info_struct vm86plus;
4945 diff -urN dosemu-1.4.0/src/include/dos2linux.h dosemu-1.4.0.1/src/include/dos2linux.h
4946 --- dosemu-1.4.0/src/include/dos2linux.h 2007-05-04 01:59:48.000000000 -0400
4947 +++ dosemu-1.4.0.1/src/include/dos2linux.h 2007-06-04 00:46:42.000000000 -0400
4948 @@ -213,6 +213,7 @@
4949 extern int sft_directory_entry_off;
4950 extern int sft_name_off;
4951 extern int sft_ext_off;
4952 +extern int sft_size;
4953
4954 extern int cds_record_size;
4955 extern int cds_current_path_off;
4956 @@ -287,4 +288,16 @@
4957 int com_biosgetch(void);
4958 int com_biosread(char *buf32, u_short size);
4959
4960 +void init_all_DOS_tables(void);
4961 +extern unsigned char upperDOS_table[0x100];
4962 +extern unsigned char lowerDOS_table[0x100];
4963 +extern unsigned short dos_to_unicode_table[0x100];
4964 +#define toupperDOS(c) (upperDOS_table[(unsigned char)(c)])
4965 +#define tolowerDOS(c) (lowerDOS_table[(unsigned char)(c)])
4966 +char *strupperDOS(char *s);
4967 +char *strlowerDOS(char *s);
4968 +#define iscntrlDOS(c) (((unsigned char)(c)) < 0x20)
4969 +int strequalDOS(const char *s1, const char *s2);
4970 +int name_ufs_to_dos(char *dest, const char *src);
4971 +
4972 #endif /* DOS2LINUX_H */
4973 diff -urN dosemu-1.4.0/src/include/emu.h dosemu-1.4.0.1/src/include/emu.h
4974 --- dosemu-1.4.0/src/include/emu.h 2007-05-04 01:59:48.000000000 -0400
4975 +++ dosemu-1.4.0.1/src/include/emu.h 2007-06-03 00:06:39.000000000 -0400
4976 @@ -217,6 +217,7 @@
4977 boolean X_keycode; /* use keycode field of event structure */
4978 boolean exitearly;
4979 boolean quiet;
4980 + boolean prompt;
4981 int realcpu;
4982 boolean mathco, smp, cpuprefetcht0, cpufxsr;
4983 boolean ipxsup;
4984 @@ -229,6 +230,7 @@
4985 boolean rdtsc;
4986 boolean mapped_bios; /* video BIOS */
4987 char *vbios_file; /* loaded VBIOS file */
4988 + char *vgaemubios_file; /* loaded VBIOS file */
4989 boolean vbios_copy;
4990 int vbios_seg; /* VGA-BIOS-segment for mapping */
4991 int vbios_size; /* size of VGA-BIOS (64K for vbios_seg=0xe000
4992 @@ -392,9 +394,6 @@
4993 EXTERN void SIG_close(void);
4994 #endif
4995
4996 -EXTERN unsigned long int stack_init_top INIT(0xffffffff);
4997 -EXTERN unsigned long int stack_init_bot INIT(0xffffffff);
4998 -
4999 /* signals for Linux's process control of consoles */
5000 #define SIG_RELEASE SIGUSR1
5001 #define SIG_ACQUIRE SIGUSR2
5002 diff -urN dosemu-1.4.0/src/include/machcompat.h dosemu-1.4.0.1/src/include/machcompat.h
5003 --- dosemu-1.4.0/src/include/machcompat.h 2007-05-04 01:59:48.000000000 -0400
5004 +++ dosemu-1.4.0.1/src/include/machcompat.h 2007-06-01 00:49:49.000000000 -0400