[haiku-development] Re: Implement 32 bit userland support for 64 bit Haiku

  • From: "Adrien Destugues" <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 02 May 2018 08:55:19 +0000

2 mai 2018 10:47 "Dario Casalinuovo" <b.vitruvio@xxxxxxxxx> a écrit:

Hi,

One question is if there will be issues with 32 bit pointers. Long mode 
seems to support PAE, so
Adrien suggested this isn't a problem?

There will be some work needed, still. IOW, there may be problems, but only 
solvable ones.
If I understand this correctly, 32bit apps don't run in long mode, and we 
swithc between long and
normal mode as needed (on syscalls, and on interrupts?). But I'm not very 
familiar with how this
works.

AFAIK, there are two general modes which consists of various sub modes to 
handle the different
stages, the legacy mode where you run a legacy 32 bit operating system (and 
other compats which I'm
not going to state here), and the long mode which consists of two sub-modes, 
the true 64 bit one
and the compat mode which is meant to run 32 bit code on a 64 bit OS.


Doesn't we need also to wrap fork() and similar functions? It seems under 
linux they do it, while
I
didn't investigate why.

fork() is a syscall.

Sure, but for most syscalls I think it's enough to translate the calling 
convention, so basically
the registers used from 32 bit to 64 bit.

As korli said, it's not just the registers, but the whole ABI. Syscalls have 
input and output in memory, often as structures. Any field in these structures 
which has a different size (pointers, size_t, ...) needs to be adjusted, and 
all following fields need to be offset, if we want to share the same 
kernel-side code. In some cases this may end up being more code than the actual 
processing.

Other related posts: