32-bit base subsystem

Introduction

In all versions of OS/2 some core API's (VIO, MOU, MON and KBD) still 16-bit. Exists two 32-bit API versions for IA-32 OS/2. One is EMXWRAP which actually provides only wrappers to 16-bit functions (but no thunking support required from compiler side) and con1632.dll. We selected first ABI because it is more known. con1632.dll only known in one application. If you require support for con1632.dll ABI please contact us or implement it by yourself.

Implementation

32-bit

All osFree applications links to emxwrap.dll. As result such applications works fine on original OS/2. osFree module manager replaces emxwrap.dll import entry to sub32.dll. sub32.dll has same ABI as emxwrap.dll so under osFree all works as expected too. As result we still have full binary compatibility for both OS/2 and osFree.

16-bit

Most problematic part is implementation of 16-bit API. At the present time this is only concept about implementation of it. We can divide all application which uses 16-bit api into 2 types:

  1. 32-bit applications with 16-bit thunking (LX format in most cases)
  2. Pure 16-bit applications (NE format in most cases)

So we propose 2 approaches to handle 16-bit APIs. First approach is on the fly replacement of thunking code by actial 32-bit calls. This can be done during LX module linking. We have not so many different compilers which produce OS/2 executables. Each compiler generate thunking code which can be detected and replaced by pure 32-bit code. So, we need to detect all required peaces of code generated by compilers. Cost of such solution is very low.

Much problems with 16-bit applications. For now we think not to support such applications at all. No so many pure 16-bit applications now and we can provide at least 2 solutions for it. One solution is virtualization of such applications and executions of them in some virtual machine. Another solution is binary retranslation. It is similar to QEMU emulation and UQBT Framework can be used as a base for it. Such solution requires many resources to implement so we need to think about real requirence of such approach.

Typical thunking code

ToDo

Here we will present typical code which must be searched in executable image and replaced by pure 32-bit code.