🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.misc
Article #11786

8086 & 8026 code growing out of 64K

#11786
From: John PR Archer SE141 X4763
Date: Thu, 21 Jan 1993 16:07
65 lines
3484 bytes
Hi, 

I posted this to the intel.sys group and got no response, it's not directly a 
PC problem but  I'm pretty sure that some of you PC gurus can answer my 
question(s) and maybe give me some references.

Problem: 8086 and 80286 source growing out of 64K

Framework: 
We have our own 8086 and 286 code generators and can change or upgrade  
them as required. We have some very large modules that are approaching 
64K of 8086 or 80286 code and extra functionality has to be added 
to these modules quickly. Our system does not support modular programming 
very well and so splitting up the large modules is a painful process. 
A solution could be to upgrade to 386 machines running in protected 
mode this means that the code size limitation of 64K could be removed.
(I should add that our system does not (currently) support multi code segment 
modules either! Configuration management restrictions, 1 source -> 1 code seg )   
 
Questions: 
Without changing any of the existing source code is it possible to 
have a code segment of more than 64K described as a 16 bit segment 
(D bit set to 0)? Will the code execute correctly when it passes the 
64K boundary? When in 16 bit mode, is the 32 bit instruction pointer 
(EIP) maintained correctly, or is only the lower half maintained (old 
16 bit IP)? 

Our code never makes calls or jumps to other code segments but if 
we allow code sizes to grow out of 64K we may well jump or call out 
of the 64K boundary. 
 
If we change our code generators to generate the operand and address 
size override prefixes for all jumps and call - return instructions 
and remove the 64k size limitation on code segments only, can we then create 
descriptors with the D bit cleared so that the code will execute correctly 
on a 386 (protected mode)? 
 
Will the 386 trap out if it finds a code segment descriptor with the 
D bit cleared but a code size greater than 64K, does it simply ignore 
bits 19-16 of the segment (size) limit field and continue but then 
fall over when you try to go past 64K? 
  
Comment: 
I know I am probably asking the same question in several different 
ways. I really want the reply to be "yes it'll all work fine".  I 
can find nothing concrete in the Intel 386DX  "Programmer's Reference 
Manual" (1990)  that says  NO , but James L Turley's "Advanced 
80386 Programming Techniques"  implies that it is will not work. Also neither
MASM nor Intel's ASM386 allow USE16 modules to have more than 64K, but I am still
hoping. 
 
Alternative: 
The alternative is to maintain that the code segment is a 32 bit segment 
(D bit set) and  then use the prefixes 66H and 67H to override  
every  existing instruction and addressing operation  except  
the jumps and calls. We estimate that this could increase the code 
sizes by 35-50% and also involves a much larger change to our code 
generators.  
Would this massive use of override prefixes slow down the processing 
appreciably?  

Thanks in advance.
                      Cheers,
                              John
Technical Details
Message-ID: <1445@se.alcbel.be>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!ub4b!alcbel!se.alcbel!se.alcbel.be!jpra

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!ub4b!alcbel!se.alcbel!se.alcbel.be!jpra
From: jpra@se.alcbel.be (John PR Archer   SE141    X4763)
Newsgroups: comp.sys.ibm.pc.misc
Subject: 8086 & 8026 code growing out of 64K
Message-ID: <1445@se.alcbel.be>
Date: 21 Jan 93 16:07:48 GMT
Sender: jpra@se.alcbel.be
Reply-To: jpra@se.alcbel.be
Organization: Alcatel Bell
Lines: 65
Nntp-Posting-Host: btmw89