Designing a hard-realtime addon to an operating system

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
rdos
Member
Member
Posts: 3276
Joined: Wed Oct 01, 2008 1:55 pm

Re: Designing a hard-realtime addon to an operating system

Post by rdos »

Finished with settting up the 64-bit environment, booting a core and setting up fault handlers. I have also integrated it into the kernel debugger and so I can step and run the 64-bit code from RDOS. I initially used my CPU emulator, but at this stage I think running it on real hardware is so much better. I use an interrupt from RDOS to the realtime core to implement debugging.

I think I will buy a two CPU server board using AMD Ryzen class processors and start trying to boot RDOS on it.

It would be nice to have a C compiler for the actual project, but I think I could also write it in x64 assembler.
rdos
Member
Member
Posts: 3276
Joined: Wed Oct 01, 2008 1:55 pm

Re: Designing a hard-realtime addon to an operating system

Post by rdos »

So, the realtime monitor boots up in 64-bit mode, the trap gates work, and it's all seemlessly integrated with normal kernel debugger. The monitor has a function to request physical memory from the operating system, and the page fault handler will automatically fill-up the 3 higher levels of the page table structure. The operating system can request that a linear address be mapped, and then get back the page entry. Using that page entry, the operating system can easily load application code in the realtime core context before starting the realtime program. The realtime program will run at user level.

I also started to implement signals from the realtime program to the operating system. These must have known maximum execution times, and this is achieved by setting a signal bit (with lock prefix), and then send an interrupt to the server core if the APIC is idle. To be able to run this as quickly as possible I mapped the APIC and monitor data for the application. There are 1024 different signals that each has it's own bit. On the operating system side, I have a C++ class that can be used to write an application that can interface with the realtime program. For the moment, the realtime program must be written in x64 assembler, but has a macro to send a signal.
Post Reply