Author Topic: 83+ Operative Systems and Kernel  (Read 1954 times)

0 Members and 1 Guest are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
83+ Operative Systems and Kernel
« on: August 12, 2011, 11:37:16 am »
I never quite understood what "Kernel" is and how it's made.

Of course learning it for a computer would be really hard so like I did for most things I thought I'd take a look at some (kernel?) for the 84+.

http://knightos.svn.sourceforge.net/viewvc/knightos/

I checked the KnightOS Source Code Repository to find some "kernel", but I didn't find any "kernel", only asm files.

Well, I know Kernel is not a programming language, it is something else.

I don't have a question here, but can someone give me some explanation of Kernel in the 83+ Context and General Kernel? Or maybe give me some useful links? Thanks!

SirCmpwn

  • Guest
Re: 83+ Operative Systems and Kernel
« Reply #1 on: August 12, 2011, 11:51:39 am »
Well, a kernel is what interfaces with the hardware.  It doesn't do anything that the user can see.  I can explain some of the stuff in the repository, though it's pretty out of date.  What a kernel needs to do is get the calculator up and running, then run the OS.  It should also provide some basic services to the OS and programs, like multithreading with Knight Kernel.  All of KnightOS's kernel is stored in page 00.
Boot.asm is used to initialize the calculator.  It sets up the hardware and passes control to the OS (there's a program called boot.kxe that is executed by the kernel).  This file also handles multithreading.  The first part is the header, and line 39 is executed as soon as batteries are put in the calculator.  It just shuts down the calculator, because the hardware doesn't wait for the ON button to turn on the calc.  In order to shut down, a few things have to be initialized first, so it does those.  The rest of the hardware is initialized at line 73.  Line 91 starts running boot.kxe, and line 92 is what finally transfers all control from the kernel to the OS.
Boot.asm also provides a lot of services to the OS (remember that the kernel does two things - set up hardware and provide services).  Here's what it provides:
-kmacro facilitates relocatable code with kcall, kld, and kjp, starting at line 100
-lmacro facilitates library routines with lcall, lld, and ljp, starting at line 147
-The system interrupt facilitates multithreading at line 214.  The latest version of the interrupt also does some USB stuff, and is very different in the way it handles threads.
RAM.asm is the only other file that provides services to the OS.  It handles everything that has to do with RAM, including memory allocation and starting new threads.  Pretty much everything in this file is different from the latest version.
-LoadLibrary is at line 47, which loads a library file into RAM and sets up it's associated pointers
-GetThreadByID allows you to find information about an executing thread at line 120
-StartThread begins a thread with code from anywhere without an associated program at line 143
-ExecProgram executes a program from the filesystem as a new thread on line 234
-AllocateMem starts at line 296 and allocates RAM for program use

The rest of the Knight Kernel is routines, like CPHLDE.  Most of these aren't something you'd normally find in a kernel, but I have a lot of space left in the kernel and might as well fill it with routines.
« Last Edit: August 12, 2011, 12:03:32 pm by SirCmpwn »