New RTL: Native NT user- and kernelmode
Original Reporter info from Mantis: PascalDragon @PascalDragon
-
Reporter name: Sven Barth
Original Reporter info from Mantis: PascalDragon @PascalDragon
- Reporter name: Sven Barth
Description:
Here's the RTL patch for the new Native NT target.
Whether one can use kernel- or usermode with this RTL is determined with a compiler define KMODE during compilation of the RTL.
This may seem a bit strange, but I didn't like the idea to add an extra target just for kernel mode. But this separation is needed, because the two modes follow different criterias:
* usermode code follows FPC's "write once, compile anywhere" approach (at least this is my goal)
* kernelmode code is VERY platform specific and complex (e. g. no full RTL)
Also using the kernel mode RTL is just a matter of compiling it with KMODE once, moving it to another directory and adjusting fpc.cfg.
Currently the only implemented RTL feature is the heap (usermode only). Also the RTL is currently not initialised in a DLL (some problems with heap-creation I'm facing).
Dynamical linked libraries (references solved by the OS) are working, but I have a problem with "GetProcAddress" in runtime linked ones (using "LoadLibrary).
Drivers are Libraries with {$apptype native} and need a RTL compiled with "-dKMODE". There is currently NO RTL code active in drivers (but PASCALMAIN is called and thus units are initialized).
I'm open to suggestions and/or corrections ;)
Additional information:
I added/stubbed the following units beside the normal RTL ones (similar to windows.pas ^^):
* NDK - Native Development Kit: basically methods from Jedi's jwanative.pas. But in Native NT this IS the OS interface so I need/want them in the RTL (some parts are also usable in kernelmode)
* NDKUtils: methods to ease the development with FPC on Native NT. For now it only contains a helper to convert ShortStrings to NtUnicodeString (also known as WideString - but that one is not implemented for now)
* DDK - Driver Development Kit: all methods and structures that are only useable/callable during driver development
Mantis conversion info:
- Mantis ID: 14887
- Fixed in version: 2.6.0
- Fixed in revision: 14568 (#d94f37e3)