From 45cb784846296c28959368b3b8b3562c2cc8a33c Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 24 Feb 2020 10:00:23 +0100 Subject: [PATCH] Docs : loader/cpu --- ChangeLog | 2 +- docs/boot/grub/grub.desc | 14 ++++++++-- docs/boot/loader/cpu | 51 ++++++++++++++++++++++++++++++++++++ docs/boot/loader/loader.desc | 8 ++++-- 4 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 docs/boot/loader/cpu diff --git a/ChangeLog b/ChangeLog index 7ce7dd9..462a2bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,7 +23,7 @@ #=----------------------------------------------------------------------------=# 2018-10-00 @os-k-team -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 Name decided & creation of os-k.eu diff --git a/docs/boot/grub/grub.desc b/docs/boot/grub/grub.desc index dcced46..f1cb311 100644 --- a/docs/boot/grub/grub.desc +++ b/docs/boot/grub/grub.desc @@ -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 \ No newline at end of file + 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. \ No newline at end of file diff --git a/docs/boot/loader/cpu b/docs/boot/loader/cpu new file mode 100644 index 0000000..e89f174 --- /dev/null +++ b/docs/boot/loader/cpu @@ -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. \ No newline at end of file diff --git a/docs/boot/loader/loader.desc b/docs/boot/loader/loader.desc index 7e80d64..5f1880f 100644 --- a/docs/boot/loader/loader.desc +++ b/docs/boot/loader/loader.desc @@ -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. @@ -30,4 +30,8 @@ specified address and prepare it for the hard work it have to do : - Send a structure for it with memory map, cpu infos, and other devices infos, prepared by GRUB. - Switch into long mode. - - Jump to Kaleid kernel. \ No newline at end of file + - 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.