TempleOS is an x86_64, multi-tasking, multi-cored, public domain, open source,
ring-0-only, single-address-map (identity-mapped), non-networked, PC operating
system for recreational programming.
Site: http://www.templeos.org/
Ad video: https://www.youtube.com/watch?v=MVMtfnyzzm4#at=601
Facts about TempleOS:
- Spoiler: Show
- * TempleOS runs in VGA 640x480 16 color graphics mode, not text mode. It
changes to this mode with a BIOS call while in real-mode before it switches to
64-bit mode. The text is drawn manually. If graphics mode fails, it falls-back
on text mode. You can force text mode with an Kernel config option.
* TempleOS identity-maps all memory, all the time. There is no "high half"
memory space. TempleOS is ring-0-only, so everything is kernel, even user
programs. There is a special task called "Adam" and he doesn't die, so his heap
never gets freed. That's as close to "kernel memory" as it gets.
* TempleOS puts all code in the lowest 2 Gig, so that REL32 addressing can be
used. TempleOS is 64-bit, but I just thought 2 Gig was enough for code. It
actually puts global variables there, too, but you can turn that off with
OPTf_GLBLS_ON_DATA_HEAP. MAlloc() can allocate any memory, of course.
* TempleOS doesn't use software interrupts or SYSCALL instructions because it
never needs to change out of ring-0, even running user programs. Calls are
always CALL REL32 instructions.
* The stack does not grow. In theory, memory gets fragmented, too.
* There is no PATH. You do not enter filenames at the command-line and expect
them to run. You enter C-like code. Get Started Here.
* If you use Grub, you "chain-load" like Windows. You can use the TempleOS
boot-loader. Master-Boot-Loader-Stage1, Master-Boot-Loader-Stage2,
Partition-Boot-Loader, CD-DVD-Boot-Loader.
* The boot-loaders must be patched by you running MakeOSInstallPrtBootLoader()
or InstallMasterBootLoader(). Those will write the block address into the
boot-loader because the boot-loaders do not navigate file systems to find the
Stage2 if you relocate it.
* TempleOS is 64-bit. Like all PC operating systems, the boot-loader starts in
16-bit real-mode. TempleOS calls a few BIOS info routines, switches to
VGA-640x480x4bit, switches to 32-bit, then, 64-bit mode. There is an odd thing
called a PCI BIOS which is 32-bit used for PCI config space access. TempleOS
calls that a couple times. It must temporarily drop-out-of 64-bit mode for that
and stop multi-tasking.
* PUSH EAX : All stack operations in 64-bit mode are 64-bits.
* XOR EAX,EAX : Operations on 32-bit registers clear the high 32-bits.
* MOV RAX,FS:[RAX] : FS can be set with a WRMSR, but displacement is RIP
relative, so it's tricky to use. FS is used for the current CTask, GS for CCPU.
* TempleOS uses JIT file compression on a file-by-file basis. Files are
compressed, not encrypted.
* TempleOS has a dictionary that is shipped compressed. When you boot the first
time it is uncompressed. TempleOS has a Windows utility for uncompressing.
That utility needs Microsoft DLL files. TempleOS does not use any libraries,
modules or code from other sources -- I wrote it all from scratch and it is
self-contained.
* There are no OBJ or EXE files. There are only two files compiled
ahead-of-time -- Kernel.BIN.C and Compiler.BIN.Z. You can delete them and
recompile with MakeOSInstallPrtBootLoader(). TempleOS is 122,879 lines.
Roughly 50,000 is compiled AOT and 50,000 during boot JIT. The rest is JIT
demos and applications.
* The main difference between TempleOS and other systems is that the heap and
compiler sym table are associated with tasks, not applications.
* There are sym(hash) tables maintained by each task. They are similar in scope
to environment variables. When a symbol is not found, the parent task's symbol
table is checked. All process chain back to the Adam process. Adam has the
symbols from headers you normally #include in other operating systems, so you do
not need to #include any headers in TempleOS.
* The compiler only creates pos independent code. You can't create code which
is loaded at a fixed, specified location. The code is pos independent by virtue
of the fact that abs addresses get patched.
* Binary executable files have export syms which are loaded into the sym tables.
The operating system Kernel has such an export table. In addition, some map
files are processed to provide more information on syms -- src file links. This
is how the Man()/WORDSTAT feature can find src lines.
* The word "public" does very little except allow the help_index and HashRep()
program varients to exclude meaningless syms. If you wish a full report of
public and nonpublic syms Click Here.
* When compilation takes place, the structures used by the compiler stick
around. Data on classes can be accessed by code. See ClassRep().
* Filenames ending in ".Z" are automatically compressed and uncompressed when
writing to disk. File size in directory listing is the compressed size. You
can view uncompressed size with Dir("*",TRUE); if you use the RedSea TempleOS
filesystem. See ::/TempleOS/Doc/TSZ.TXT for uncompressing from WINDOWS.
* Some memory objects are allocated when needed and will decrease the available
memory displayed. A task keeps mem objects smaller than a couple blocks in it's
own separate heap when freed and these are not counted in the available system
free memory, though they are free. They get returned to the system when the
task is killed. To get a sense of this, compile the operating system and see
the amount of mem used. Then, compile it again and far less will be allocated.
This is because it is reusing the small chunks. See Memory. Click Here for a
MemRep.
* The cursor location is stored as an ASCII 5 in files. ASCII 31 is SHIFT-SPACE
, a character which does not get converted to tabs by space-to-tabs, S2T(). The
ASCII 28 is SHIFT-ESC.
* Binary data is stored beyond the terminating NULL in text files. Map files
store debug src lines and other files store sprites.
* Sprites can be stored as vect graphics so they might take shockingly little
room. They can be converted to bitmaps.
* If you change code in the /TempleOS/Adam, /TempleOS/Adam or your HOME
directory, you don't need to recompile, you just need to reboot because those
directories get recompiled when you boot. It uses JIT compilation. There is no
".BIN" file for JIT compilation.
* If not found, ".Z" is added or removed and a search is done again. If a file
is still not found, the parent directories are searched for a file of the same
name.
* TempleOS supports FAT32 and RedSea file systems. The RedSea partitions will
appear as FAT32 to other operating systems, but will not work. Do not access
the native TempleOS partitions from other operating systems. This was to fool a
bootloader when I tricked it to use it's recovery partition feature.
* The CPU usage during disk operation expands to 99%. It polls while
swapping-out. You can do other, non-disk activity during disk operations
because it swaps-out a lot and task swaps take only half a microsecond, probably
a hundred times faster than a typical OS. See Cooperative Multitasking. It
does not break-up disk operations into small pieces for sharing, however, so the
disk is lock onto that one task.
* "Windows" is a trademark of MicroSoft Corp.