From: cross@spitfire.i.gajendra.net   
      
   In article ,   
   muta...@gmail.com wrote:   
   >I thought that it was not possible to run 80386 software on an x64 in lm64   
   because they took away push eax etc so you only have push rax   
   >   
   >But I just realized that you can manipulate the stack manually. Ie mov eax to   
   offset 4 from esp etc.   
   >   
   >And sub esp, 4   
   >   
   >I don't mind writing a new compiler and I don't mind recompiling everything.   
      
   I wouldn't do that if I were you.   
      
   >So   
   >   
   >Is it possible to write 80386 code that runs on lm64 without issue?   
      
   Yes. That was one of the important design criteria for 64-bit   
   x86, in fact. However, you're generally going to do so by   
   entering 32-bit mode. E.g., the system might boot up and run in   
   64-bit mode in the kernel (ring 0), but then execute user code   
   in 32-bit mode (e.g., in ring 3).   
      
   >Ie are sufficient instructions available for a general purpose application?   
   >   
   >I would be running under 64 bit EFI   
   >   
   >Using only memory below 4 GB   
   >   
   >And without paging.   
      
   It's unclear what you mean here: if you're in long mode, you   
   must enable paging. That doesn't mean that you can't run 32-bit   
   code, but the machine must be an architecturally well-defined   
   state.   
      
   It's unclear what you mean when you say, "I would be running   
   under 64 bit EFI": do you mean you'd be executing something   
   integrated with UEFI (such as a DXE provider?) or do you mean   
   that that's just how your machine would boot?   
      
   >The 32 bit code would be in a.out format and I would load it myself.   
      
   Before one can really address this, one needs more contextual   
   information. Would this code be run in user mode? If so, what   
   you could do is simply leave the kernel and enter a 32-bit   
   user mode executing this code (e.g., in a 32-bit code segment).   
      
   But if begs the question: if you're willing to both write your   
   own compiler and recompile your code, why not simply build it   
   as 64-bit code and avoid the hassle?   
      
    - Dan C.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|