title: Is it possible to execute 32-bit code in 64-bit process by doing mode-switching?
body: <p>In this page, <a href="http://www.x86-64.org/pipermail/discuss/2004-August/005020.html" rel="nofollow">http://www.x86-64.org/pipermail/discuss/2004-August/005020.html</a>
  He said that there is a way to mix 32-bit code and 64-bit code in a application. He assumed the application is 32-bit (in compatibility mode) and then switch to 64-bit mode to execute 64-bit code and vice versa.</p>
  
  <p>Assume my OS is 64-bit linux and my application is 64-bit. I do a far jump to switch to compatibility mode and execute 32-bit code. Does it can work correctly when I do a system call or function call ? </p>
  
  <p>Is there any overhead of mode switching between compatibility mode and 64-bit mode ? I think one of the overhead is I need separate stack for 32-bit and 64-bit.</p>
  
  <p>Could I integrate this idea into JVM, maybe I can dynamic generate 32-bit code in 64-bit JVM, and execute it by mode switching ?</p>