From b4f824db27afae3626d0beb096ac8e3172831145 Mon Sep 17 00:00:00 2001 From: Alexander Kuleshov Date: Thu, 14 Jun 2018 23:47:54 +0600 Subject: [PATCH] fix order of calling set_bios_mode() Signed-off-by: Alexander Kuleshov --- Booting/linux-bootstrap-2.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Booting/linux-bootstrap-2.md b/Booting/linux-bootstrap-2.md index 54aeb59..b91b961 100644 --- a/Booting/linux-bootstrap-2.md +++ b/Booting/linux-bootstrap-2.md @@ -358,6 +358,24 @@ if (cpu_level < req_level) { The `check_cpu` function checks the CPU's flags, the presence of [long mode](http://en.wikipedia.org/wiki/Long_mode) in the case of x86_64(64-bit) CPU, checks the processor's vendor and makes preparations for certain vendors like turning off SSE+SSE2 for AMD if they are missing, etc. +at the next step, we may see a call to the `set_bios_mode` function after setup code found that a CPU is suitable. As we may see, this function is implemented only for the `x86_64` mode: + +```C +static void set_bios_mode(void) +{ +#ifdef CONFIG_X86_64 + struct biosregs ireg; + + initregs(&ireg); + ireg.ax = 0xec00; + ireg.bx = 2; + intcall(0x15, &ireg, NULL); +#endif +} +``` + +The `set_bios_mode` function executes the `0x15` BIOS interrupt to tell the BIOS that [long mode](https://en.wikipedia.org/wiki/Long_mode) (if `bx == 2`) will be used. + Memory detection -------------------------------------------------------------------------------- @@ -404,24 +422,6 @@ You can see the result of this in the `dmesg` output, something like: [ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved ``` -Next, we may see a call to the `set_bios_mode` function. As we may see, this function is implemented only for the `x86_64` mode: - -```C -static void set_bios_mode(void) -{ -#ifdef CONFIG_X86_64 - struct biosregs ireg; - - initregs(&ireg); - ireg.ax = 0xec00; - ireg.bx = 2; - intcall(0x15, &ireg, NULL); -#endif -} -``` - -The `set_bios_mode` function executes the `0x15` BIOS interrupt to tell the BIOS that [long mode](https://en.wikipedia.org/wiki/Long_mode) (if `bx == 2`) will be used. - Keyboard initialization --------------------------------------------------------------------------------