OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 26, 2024 11:43 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Linux ELF semi-compatibility
PostPosted: Fri Mar 22, 2024 6:58 pm 
Offline
Member
Member

Joined: Fri Nov 17, 2006 5:26 am
Posts: 248
AndrewAPrice wrote:
kerravon wrote:
AndrewAPrice wrote:
If you ported your own libc you implement the compatibility layer via functions in a vtable. Then once at program startup (in your crt0) detect the OS and fill in the vtable with pointers to the OS-specific functions.


I agree that it would work, I just don't like the different code paths.

So with regard to the one place that has a different code path:

/* user pressing ESC will always be 1 character on MSDOS,
but not PDOS */


So in this case, you'd have a binary that uses libc, but there will still be things that function a little differently on different operating systems (especially if you deal with external processess - such as how the terminal emulator feeds characters into your program). Perhaps it would be best to build upon a higher level library such as SDL that hides many of these platform differences.


For starters - I am aiming for public domain code - I just checked and that is under a license.

Secondly - I'm not sure what I want to "build upon" anything at all - PDPCLIB is already built. My question was more refinement or a feature within that already-built product.

And it is the C library's job to hide platform differences - and that has already been done (over the last 3 decades).

BTW, in the last 24 hours, pdld has started producing 64-bit ELFs. And I can thus produce them purely on PDOS/386. But the compiler I am using (a fork of gcc 3.2.3) is using Win64 function call convention. Because I have no external dependencies other than the syscalls, that is the point where I translate from Win64 to Linux syscall register convention (which is slightly different from Linux function call convention).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group