Open TheMachine02 opened 3 years ago
Which bytes/memory areas would I need to leave untouched and which syscalls are needed / where these syscalls are needed?
The dual boot allow booting between a monolithic OS install in the same area than the TI OS and executable kernel's discovered on the filesystem. Of course it is based on TI OS stuff, so I should make the dual boot kinda more plateform agnostic. It uses _os_GetSystemStats to get the version information at install time, but an installer could be adapted for BOS to fetch from somewhere else (and install itself elsewhere too, right now at $B00000 page in flash, end of TI OS).
In RAM, it only need the byte $D0007F free to be able to switch between the monolithic and the executable kernel.
I think adapting BOS to an exectuable kernel/OS format would be quite hard (to have TI OS / BOS / other) but supporting dual boot for executable kernel with BOS should be doable.
The installer / dual boot just need to be aware of the filesystem (right now, it uses TI filesystem) and where to fetch version for display.
For a standalone BOS executable, it need to be quite reworked, since the kernel is in that case executed from RAM at specified adress (there is a custom executable format), and the syscall need to be adressed inside the kernel from an internal table (which reside in RAM). Harder, but also interesting.
Building an installer to install a second OS on BOS would have to be reassembled/recompiled anyways, so just use some assembly/compile-time if/elses for differences in filesystem structure. BOS provides a handy include file for the various functions it's jump table exposes. Additionally, BOS's filesystem is 512-byte aligned and a derivative of FAT. File entries contain the file's logical block address and size in bytes. Each of those are 16 bit integers, so the maximum file size is similar to TI's. However due to the file entry being placed seperately from the file data section, you could easily have a contiguous data section longer than the maximum file size by placing files end to end, which I can perhaps write a routine for. In order to programatically find out whether a given calc is running BOS, os_GetOSInfo returns a pointer to BOS's version string in HL. You can alternatively grab the pointer to the string at ((os_GetOSInfo+1)+1). The info string will always begin with "BOS", so it's fairly trivial to check for.
Well, based on this I could definitely craft a BOS version dual boot installer. Some more info though : were the OS end ? Any specific build particularity for the installer ?
I think this requires extra hardware and may not be feasible on the CE.
I just though it would be cool if it could be dual boot compatible using the Sorcery hypervisor. It would need to make all syscall portable and keep some bytes untouched though. Ive only parsed quickly the source code, but it shouldn't be impossible