aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-08-11 21:42:39 +0000
committerRichard M. Stallman1997-08-11 21:42:39 +0000
commite089dc624ffa09ad747e6e837f8fb4d96cfae31d (patch)
treee430a4effb08400e9ee445552e6667ea553f6ce4
parentdb72273572272309e0fca323847488fa90150cb0 (diff)
downloademacs-e089dc624ffa09ad747e6e837f8fb4d96cfae31d.tar.gz
emacs-e089dc624ffa09ad747e6e837f8fb4d96cfae31d.zip
(init_dosfns): Avoid calling DOS memory-allocation
service, NT DPMI server will crash Emacs in DOS box, if we do.
-rw-r--r--src/dosfns.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/src/dosfns.c b/src/dosfns.c
index f0b1c69124e..a70f16962f4 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -1,6 +1,6 @@
1/* MS-DOS specific Lisp utilities. Coded by Manabu Higashida, 1991. 1/* MS-DOS specific Lisp utilities. Coded by Manabu Higashida, 1991.
2 Major changes May-July 1993 Morten Welinder (only 10% original code left) 2 Major changes May-July 1993 Morten Welinder (only 10% original code left)
3 Copyright (C) 1991, 1993 Free Software Foundation, Inc. 3 Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -238,6 +238,20 @@ int dos_timezone_offset;
238int dos_decimal_point; 238int dos_decimal_point;
239int dos_keyboard_layout; 239int dos_keyboard_layout;
240unsigned char dos_country_info[DOS_COUNTRY_INFO]; 240unsigned char dos_country_info[DOS_COUNTRY_INFO];
241static unsigned char usa_country_info[DOS_COUNTRY_INFO] = {
242 0, 0, /* date format */
243 '$', 0, 0, 0, 0, /* currency string */
244 ',', 0, /* thousands separator */
245 '.', 0, /* decimal separator */
246 '/', 0, /* date separator */
247 ':', 0, /* time separator */
248 0, /* currency format */
249 2, /* digits after decimal in currency */
250 0, /* time format */
251 0, 0, 0, 0, /* address of case map routine, GPF if used */
252 ' ', 0, /* data-list separator (?) */
253 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* reserved */
254};
241 255
242int dos_hyper_key; 256int dos_hyper_key;
243int dos_super_key; 257int dos_super_key;
@@ -250,8 +264,8 @@ void
250init_dosfns () 264init_dosfns ()
251{ 265{
252 union REGS regs; 266 union REGS regs;
253 _go32_dpmi_seginfo info;
254 _go32_dpmi_registers dpmiregs; 267 _go32_dpmi_registers dpmiregs;
268 unsigned long xbuf = _go32_info_block.linear_address_of_transfer_buffer;
255 269
256#ifndef SYSTEM_MALLOC 270#ifndef SYSTEM_MALLOC
257 get_lim_data (); /* why the hell isn't this called elsewhere? */ 271 get_lim_data (); /* why the hell isn't this called elsewhere? */
@@ -261,21 +275,23 @@ init_dosfns ()
261 intdos (&regs, &regs); 275 intdos (&regs, &regs);
262 Vdos_version = Fcons (make_number (regs.h.al), make_number (regs.h.ah)); 276 Vdos_version = Fcons (make_number (regs.h.al), make_number (regs.h.ah));
263 277
264 /* Obtain the country code by calling Dos via Dpmi. Don't rely on GO32. */ 278 /* Obtain the country code via DPMI, use DJGPP transfer buffer. */
265 info.size = (sizeof(dos_country_info) + 15) / 16; 279 dpmiregs.x.ax = 0x3800;
266 if (_go32_dpmi_allocate_dos_memory (&info)) 280 dpmiregs.x.ds = xbuf;
267 dos_country_code = 1; 281 dpmiregs.x.dx = 0;
282 dpmiregs.x.ss = dpmiregs.x.sp = dpmiregs.x.flags = 0;
283 _go32_dpmi_simulate_int (0x21, &dpmiregs);
284 if (dpmiregs.x.flags & 1)
285 {
286 dos_country_code = 1; /* assume USA if 213800 failed */
287 memcpy (dos_country_info, usa_country_info, DOS_COUNTRY_INFO);
288 }
268 else 289 else
269 { 290 {
270 dpmiregs.x.ax = 0x3800;
271 dpmiregs.x.ds = info.rm_segment;
272 dpmiregs.x.dx = 0;
273 dpmiregs.x.ss = dpmiregs.x.sp = 0;
274 _go32_dpmi_simulate_int (0x21, &dpmiregs);
275 dos_country_code = dpmiregs.x.bx; 291 dos_country_code = dpmiregs.x.bx;
276 dosmemget (info.rm_segment * 16, DOS_COUNTRY_INFO, dos_country_info); 292 dosmemget (xbuf, DOS_COUNTRY_INFO, dos_country_info);
277 _go32_dpmi_free_dos_memory (&info);
278 } 293 }
294
279 dos_set_keyboard (dos_country_code, 0); 295 dos_set_keyboard (dos_country_code, 0);
280 296
281 regs.x.ax = 0x6601; 297 regs.x.ax = 0x6601;