[haiku-commits] Change in haiku[master]: system/boot: Unify spin design, add missing symbols to asm/ld

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 26 Feb 2020 18:58:40 +0000

From Alex von Gluck IV <kallisti5@xxxxxxxxxxx>:

Alex von Gluck IV has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/2283 ;)


Change subject: system/boot: Unify spin design, add missing symbols to asm/ld
......................................................................

system/boot: Unify spin design, add missing symbols to asm/ld

Change-Id: I1dd98a2243d498ec1c827f7a60385237d12a0d39
---
M src/system/boot/arch/arm/arch_cpu.cpp
M src/system/boot/arch/arm/arch_cpu.h
M src/system/boot/platform/efi/arch/arm/crt0-efi-arm.S
M src/system/boot/platform/efi/arch/arm64/crt0-efi-arm64.S
M src/system/boot/platform/u-boot/arch/ppc/arch_cpu.cpp
M src/system/boot/platform/u-boot/cpu.cpp
M src/system/boot/platform/u-boot/cpu.h
M src/system/ldscripts/arm/boot_loader_efi.ld
M src/system/ldscripts/riscv64/boot_loader_efi.ld
9 files changed, 28 insertions(+), 23 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/83/2283/1

diff --git a/src/system/boot/arch/arm/arch_cpu.cpp 
b/src/system/boot/arch/arm/arch_cpu.cpp
index 5bb64e5..fdd6d07 100644
--- a/src/system/boot/arch/arm/arch_cpu.cpp
+++ b/src/system/boot/arch/arm/arch_cpu.cpp
@@ -123,13 +123,6 @@
 }


-extern "C" void
-arch_spin(bigtime_t microseconds)
-{
-       panic("No timing support in bootloader yet!");
-}
-
-
 extern "C" status_t
 boot_arch_cpu_init(void)
 {
@@ -144,3 +137,21 @@
 
        return B_OK;
 }
+
+
+extern "C" bigtime_t
+system_time()
+{
+       #warning Implement system_time in ARM bootloader!
+       return 0;
+}
+
+
+extern "C" void
+spin(bigtime_t microseconds)
+{
+       #warning Implment spin in ARM bootloader!
+       //bigtime_t time = system_time();
+       //while ((system_time() - time) < microseconds)
+       //      asm volatile ("nop;");
+}
diff --git a/src/system/boot/arch/arm/arch_cpu.h 
b/src/system/boot/arch/arm/arch_cpu.h
index beebacb..f904cf2 100644
--- a/src/system/boot/arch/arm/arch_cpu.h
+++ b/src/system/boot/arch/arm/arch_cpu.h
@@ -13,7 +13,6 @@
 extern "C" {
 #endif

-extern void arch_spin(bigtime_t microseconds);
 extern void arch_cpu_memory_read_barrier(void);
 extern void arch_cpu_memory_write_barrier(void);
 extern status_t boot_arch_cpu_init(void);
diff --git a/src/system/boot/platform/efi/arch/arm/crt0-efi-arm.S 
b/src/system/boot/platform/efi/arch/arm/crt0-efi-arm.S
index c5bb6d4..817d8a7 100644
--- a/src/system/boot/platform/efi/arch/arm/crt0-efi-arm.S
+++ b/src/system/boot/platform/efi/arch/arm/crt0-efi-arm.S
@@ -69,7 +69,7 @@
        // Everything before the kernel image is considered part of the header
        .long   _start - ImageBase              // SizeOfHeaders
        .long   0                               // CheckSum
-       .short  EFI_SUBSYSTEM                   // Subsystem
+       .short  10                              // Subsystem (EFI)
        .short  0                               // DllCharacteristics
        .long   0                               // SizeOfStackReserve
        .long   0                               // SizeOfStackCommit
@@ -122,6 +122,7 @@
        .short  0               // NumberOfLineNumbers  (0 for executables)
        .long   0xe0500020      // Characteristics (section flags)

+       .globl _start
 _start:
        stmfd           sp!, {r0-r2, lr}

diff --git a/src/system/boot/platform/efi/arch/arm64/crt0-efi-arm64.S 
b/src/system/boot/platform/efi/arch/arm64/crt0-efi-arm64.S
index c300d89..481bdb4 100644
--- a/src/system/boot/platform/efi/arch/arm64/crt0-efi-arm64.S
+++ b/src/system/boot/platform/efi/arch/arm64/crt0-efi-arm64.S
@@ -67,7 +67,7 @@
        // Everything before the kernel image is considered part of the header
        .long   _start - ImageBase              // SizeOfHeaders
        .long   0                               // CheckSum
-       .short  EFI_SUBSYSTEM                   // Subsystem
+       .short  10                              // Subsystem (EFI)
        .short  0                               // DllCharacteristics
        .quad   0                               // SizeOfStackReserve
        .quad   0                               // SizeOfStackCommit
@@ -110,6 +110,8 @@
        .long   0xc0000040      // Characteristics (section flags)

        .align          12
+
+       .globl _start
 _start:
        stp             x29, x30, [sp, #-32]!
        mov             x29, sp
diff --git a/src/system/boot/platform/u-boot/arch/ppc/arch_cpu.cpp 
b/src/system/boot/platform/u-boot/arch/ppc/arch_cpu.cpp
index 68c338e..dff416c 100644
--- a/src/system/boot/platform/u-boot/arch/ppc/arch_cpu.cpp
+++ b/src/system/boot/platform/u-boot/arch/ppc/arch_cpu.cpp
@@ -257,7 +257,7 @@


 extern "C" void
-arch_spin(bigtime_t microseconds)
+spin(bigtime_t microseconds)
 {
        for(bigtime_t i=0;i<microseconds;i=i+1)
        {
diff --git a/src/system/boot/platform/u-boot/cpu.cpp 
b/src/system/boot/platform/u-boot/cpu.cpp
index 96c4265..a4e601e 100644
--- a/src/system/boot/platform/u-boot/cpu.cpp
+++ b/src/system/boot/platform/u-boot/cpu.cpp
@@ -27,17 +27,6 @@


 extern "C" void
-spin(bigtime_t microseconds)
-{
-       #warning U-Boot:TODO!!
-       // TODO: use API if available
-
-       // fallback to arch-specific code
-       arch_spin(microseconds);
-}
-
-
-extern "C" void
 cpu_init()
 {
        gKernelArgs.num_cpus = 1;
diff --git a/src/system/boot/platform/u-boot/cpu.h 
b/src/system/boot/platform/u-boot/cpu.h
index dd9de74..66523a6 100644
--- a/src/system/boot/platform/u-boot/cpu.h
+++ b/src/system/boot/platform/u-boot/cpu.h
@@ -13,7 +13,6 @@
 extern "C" {
 #endif

-extern void arch_spin(bigtime_t microseconds);
 extern status_t boot_arch_cpu_init(void);
 extern void cpu_init(void);

diff --git a/src/system/ldscripts/arm/boot_loader_efi.ld 
b/src/system/ldscripts/arm/boot_loader_efi.ld
index 6851c1f..22a734a 100644
--- a/src/system/ldscripts/arm/boot_loader_efi.ld
+++ b/src/system/ldscripts/arm/boot_loader_efi.ld
@@ -55,6 +55,8 @@
   . = ALIGN(4096);
   .dynstr   : { *(.dynstr) }
   . = ALIGN(4096);
+
+  _end = . ;
   .note.gnu.build-id : { *(.note.gnu.build-id) }
   /DISCARD/ :
   {
diff --git a/src/system/ldscripts/riscv64/boot_loader_efi.ld 
b/src/system/ldscripts/riscv64/boot_loader_efi.ld
index aece030..455ba0d 100644
--- a/src/system/ldscripts/riscv64/boot_loader_efi.ld
+++ b/src/system/ldscripts/riscv64/boot_loader_efi.ld
@@ -61,6 +61,8 @@
        . = ALIGN(4096);
        .dynstr   : { *(.dynstr) }
        . = ALIGN(4096);
+
+       _end = . ;
        .note.gnu.build-id : { *(.note.gnu.build-id) }
        /DISCARD/ : {
                *(.rel.reloc)

--
To view, visit https://review.haiku-os.org/c/haiku/+/2283
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I1dd98a2243d498ec1c827f7a60385237d12a0d39
Gerrit-Change-Number: 2283
Gerrit-PatchSet: 1
Gerrit-Owner: Alex von Gluck IV <kallisti5@xxxxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: system/boot: Unify spin design, add missing symbols to asm/ld - Gerrit