-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[kernel] Add capability to load and execute OS/2 binary executables #1924
Conversation
ELKS support for running unmodified OS/2 binaries created using the Open Watcom C toolchain is pretty much complete. The At this point, all memory models are supported, including those such as large and compact that may produce multiple data and/or code segments, allowing for pretty large programs. For kernel space reasons, there is a currently limit of five 64k segments allowing programs of 320K+ size to run. This can easily be changed by editing limits.h, and the loader will produce an error should your program be too large. This is pretty exciting as the multiple segment load/execution capability added to the kernel allows for much larger programs to be ported to ELKS. Currently, the user must manually install and/or compile the Open Watcom toolchain, this could change in the future and have it automatically done just as is done for the IA16 GCC compiler. Both IBM and PC-98 automatic builds have the OS/2 binary execution capability (CONFIG_EXEC_OS2) enabled by default. |
Fantastic! Thank you. |
Thank you @ghaerr ! That is a big contribution to ELKS! Awesome! |
Hello @ghaerr , I am trying the latest environment. |
Hello @tyama501, It seems that OWC is telling you that your default data segment is 2514 bytes greater than 64K. In large or compact models, OWC allows for multiple data segments, but declarations including the stack, heap and data declared of size less than 32K or so gets put in the default data segment. That is, it seems that the programmer must break up data segments into various pieces in order to keep any given segment from becoming >= 64K. In my testing, I used I haven't looked at your source, are there array declarations that are large, or is this just tons of smaller constant strings? We may need to take a look at the OWC C Reference Manual or Programmers Reference Manual in order to decide how to handle this. |
See page 48 of the Watcom C/C++ Users Guide (https://openwatcom.org/ftp/archive/11.0c/docs/cuserguide.pdf): This describes using the
I will play around a bit with this as well. I need to know more information about how your program defines data in order to best solve this. That is, is it array declarations or just static strings that is causing this issue. |
https://github.com/tyama501/sjis-to-utf8_elks/blob/main/sjis_to_utf8.c There are big table.h. It could link with the previous environment. I will try the option later. I may play with other codes since this code works well with gcc ia16 and it does not need to use owc. Thanks. |
Which previous environment, do you mean something to do with ELKS? The error you are getting is from Open Watcom Linker, not an ELKS tool. It could be another option in
If those tables are declared |
The previous ELKS ewcc, ewlink, libc I have been using here. I updated to the latest ELKS but the owc is same as before. |
Oh, I see. Yes, I think I added the following two lines to
|
Hello @ghaerr , OK. By -zt1024 option, the tables moved to far data segment. (Confirmed with wdis) And it finally worked! I confirmed the converted 165KB file is the same as the file I got by gcc ia16 version. Thank you. |
Hello @tyama501, Thank you for getting your large-model program working and tested with our new multi-far-segment loader program execution capability. This is really great knowing all this actually works and is useful!! Over time, the rest of the system calls can be fleshed out as needed for other new programs. |
Work in progress... will be several commits before complete. Discussion encouraged.
Adds major new capability to load 16-bit OS/2 v1.x binary images easily produced by the OpenWatcom C compiler and toolchain.
After studying the native OS/2 binary format produced by Watcom as well as ELKS' a.out format, having ELKS load and execute OS/2 binaries directly is thought to be the best way forward to enable using Watcom C, which will allow for all memory models produced by Watcom (small, medium, compact and large) to be executed directly by ELKS without any conversion.
Note: OS/2 binary images produced for OS/2 itself won't run on ELKS, as the OS/2 system calls are different. However, the current
ewcc
andewlink
scripts allow for easy compilation and linking using Watcom C, which for the moment still require conversion from OS/2 to ELKS binary format usingos2toelks
, and are limited to a single code and data segment. After this PR, the OS/2 -> ELKS executable format conversion step will no longer be required, which should enhance correctness and permit large applications with multiple code and data segments to be runnable on ELKS.This optional capability will be controlled via CONFIG_EXEC_OS2.