Docs : loader/cpu

This commit is contained in:
Adrien Bourmault 2020-02-24 10:00:23 +01:00
parent c479273cab
commit 45cb784846
No known key found for this signature in database
GPG Key ID: AFEE5788AEE3F4EC
4 changed files with 70 additions and 5 deletions

View File

@ -23,7 +23,7 @@
#=----------------------------------------------------------------------------=#
2018-10-00 @os-k-team <os-k-team@os-k.eu>
Adrien Bourmault and Julian Barathie started talking about making their own OS
Adrien Bourmault and Julian Barathieu started talking about making their own OS
2018-11-00 @os-k-team <os-k-team@os-k.eu>
Name decided & creation of os-k.eu

View File

@ -12,7 +12,17 @@
# Foundation; with no Invariant Sections, no Front-Cover Texts, and #
# no Back-Cover Texts. A copy of the license is included in the #
# file entitled "COPYING.GFDL" #
#=-----------------------------------------------------------------------------#
#=----------------------------------------------------------------------------=#
WIP
This folder contains the GRUB configuration file, `boot/grub/grub.cfg`,
used by GRUB to know which OS to boot and how to boot it.
The GRUB configuration is pretty simple. We choose to use a 0 timeout, a
single entry that starts OS/K.
Because OS/K is a multiboot compliant kernel, we launch it with the multiboot
command.
For instance, we ask vbe and vga modules to be provided, but OS/K doesn't use
these modules.

51
docs/boot/loader/cpu Normal file
View File

@ -0,0 +1,51 @@
#=----------------------------------------------------------------------------=#
# GNU GPL OS/K Documentation #
# #
# Desc: OS/K Loader : CPU Management functions #
# #
# #
# Copyright © 2018-2020 The OS/K Team #
# #
# Permission is granted to copy, distribute and/or modify this #
# document under the terms of the GNU Free Documentation License, #
# Version 1.3 or any later version published by the Free Software #
# Foundation; with no Invariant Sections, no Front-Cover Texts, and #
# no Back-Cover Texts. A copy of the license is included in the #
# file entitled "COPYING.GFDL" #
#=----------------------------------------------------------------------------=#
This folder contains two files, `boot/loader/cpu/cpu.inc` and
boot/loader/cpu/cpu32.inc`.
The `boot/loader/cpu/cpu32.inc` is intented to provide 32 bits protected mode
function that can control wether the CPU is qualified to run the OS/K code.
The `boot/loader/cpu/cpu3.inc` provides 64 bits long mode temporization function
used by the loader when necessary.
There is two functions in `cpu32.inc` :
- Is64Bits(), intented to check if the CPU is "ok" with 64 bit code,
if it supports long mode and will not burn if we ask it to execute OS/K
(i.e trigger a #UD fault).
For this check, we use first the 0x80000000 function of the CPUID instruction
that returns the highest CPUID function available. It must return at least
0x80000001, otherwise we can't check the long mode presence and it is most
likely absent. We pass the function number in the eax register.
As soon as 0x80000001 is available, we use it and verify it flips to 1 the bit
29 in edx.
- Check_cpuid(), that check if the CPUID instruction is supported by the CPU
before use it (don't want #UD).
For this, we use the FLAGS register and check if we can flip (overwrite with
a 1 persistantly) the bit 21. If it is possible, then CPUID is supported.
The temporize(), bitemporize() and tritemporize() functions in `cpu.inc`
are juste loops that make the cpu busy to wait. These temporization are not
precise at all, and are not intented to wait for a determined time lapse.

View File

@ -12,7 +12,7 @@
# Foundation; with no Invariant Sections, no Front-Cover Texts, and #
# no Back-Cover Texts. A copy of the license is included in the #
# file entitled "COPYING.GFDL" #
#=-----------------------------------------------------------------------------#
#=----------------------------------------------------------------------------=#
This folder contains the source for OS/K's early loader.
@ -31,3 +31,7 @@ specified address and prepare it for the hard work it have to do :
infos, prepared by GRUB.
- Switch into long mode.
- Jump to Kaleid kernel.
Our loader contains the multiboot header used by GRUB to check if the kernel
can be started with the multiboot method. We use an ELF multiboot format, because
it is more convenient.