aboutsummaryrefslogtreecommitdiff
path: root/kernel/head.S
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-04 17:23:57 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-04 17:23:57 +0100
commit22a681a07ab09922435ad0a9f665290a30f6b85b (patch)
tree084fd239e826c8ab03d0d5ade73eac26f05c1e3a /kernel/head.S
parent4c25981400e9d6d7c15df70dac32b6c8819b77a5 (diff)
downloadfbos-22a681a07ab09922435ad0a9f665290a30f6b85b.tar.gz
fbos-22a681a07ab09922435ad0a9f665290a30f6b85b.zip
Pass the hart ID on start_kernel instead
Instead of storing the hard ID as given by the bootloader into a C variable, pass it directly into the 'start_kernel' function since we don't need to tamper the value as originally laid out on the 'a0' register. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'kernel/head.S')
-rw-r--r--kernel/head.S17
1 files changed, 6 insertions, 11 deletions
diff --git a/kernel/head.S b/kernel/head.S
index 638e5e8..45e66a8 100644
--- a/kernel/head.S
+++ b/kernel/head.S
@@ -71,11 +71,6 @@ _start_kernel:
amoadd.w a3, a2, (a3)
bnez a3, .Lhart_wait
- // Store the hart id as we will tamper with the 'a0' register later when
- // performing the call to `start_kernel`.
- la a3, hart_id
- sw a0, 0(a3)
-
// Explicitely nullify the 'gp' and 'sscratch' registers, as they are a bit
// special but we are not using them. For the rest of the registers, we
// explicitely do not care to reset them.
@@ -90,12 +85,12 @@ _start_kernel:
// Point 'sp' the our global stack. See fbos/sched.h for more details.
la sp, stack + STACK_SIZE
- // The `start_kernel` function requires an argument to be passed, which is
- // the pointer to the `fdt` blob. The bootloader puts this on the `a1`
- // register, so let's move it now to `a0`.
- mv a0, a1
-
- // Start the kernel.
+ // Start the kernel. Notice that both 'a0' and 'a1' have been left
+ // untouched. This is no coincidence as the values as passed from the
+ // bootloader for both these two registers will be passed down to the kernel
+ // as is. As with the Linux kernel these two registers contain:
+ // - a0: boot hart id.
+ // - a1: pointer to the flattened device tree blob.
tail start_kernel
// We really shouldn't reach this point. If so, at least mask again all