From 94d0560e7ba431c1a3fb57076fdcd0d02e14afbd Mon Sep 17 00:00:00 2001 From: Eric Auer Date: Sat, 25 Aug 2007 02:37:59 +0000 Subject: [PATCH] Do not ABORT if image size is above 1 MB - Instead, handle size MODULO 1 MB (paras = low_16_bits(pages<<5) ...) because for e.g. Turbo C++ 3.0 needs this: Their IDE is 1.3 MB BOSS NE style EXE, the first < 0.3 MB load a DOS ext which loads and runs the rest. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1348 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/task.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/kernel/task.c b/kernel/task.c index b8f9950..0d61853 100644 --- a/kernel/task.c +++ b/kernel/task.c @@ -576,10 +576,15 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd) /* compute image size by removing the offset from the */ /* number pages scaled to bytes plus the remainder and */ /* the psp */ - /* First scale the size and remove the offset */ +#if 0 if (ExeHeader.exPages >= 2048) return DE_INVLDDATA; /* we're not able to get >=1MB in dos memory */ - image_size = ExeHeader.exPages * 32 - ExeHeader.exHeaderSize; +#else + /* TurboC++ 3 BOSS NE stub: image > 1 MB but load only "X mod 1 MB" */ + /* ExeHeader.exPages &= 0x7ff; */ /* just let << 5 do the clipping! */ +#endif + /* First scale the size and remove the offset */ + image_size = (ExeHeader.exPages << 5) - ExeHeader.exHeaderSize; /* We should not attempt to allocate memory if we are overlaying the current process, because the new @@ -593,7 +598,7 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd) COUNT rc; /* and finally add in the psp size */ - image_size += sizeof(psp) / 16; /*TE 03/20/01 */ + image_size += sizeof(psp) / 16; /* TE 03/20/01 */ exe_size = image_size + ExeHeader.exMinAlloc; /* Clone the environement and create a memory arena */