[haiku-commits] haiku: hrev54836 - headers/private/kernel/arch/sparc src/system/kernel/arch/sparc src/system/boot/platform/openfirmware

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 1 Jan 2021 17:04:17 -0500 (EST)

hrev54836 adds 3 changesets to branch 'master'
old head: 55cf87a88ce6d18da6ea97091e2fe8648d93028f
new head: a27d19ee57280e104d8db6d59b5fcc075a668c70
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=a27d19ee5728+%5E55cf87a88ce6

----------------------------------------------------------------------------

6f743e685316: sparc: remove unneeded atomic implementation
  
  The definition in SupportDefs.h using gcc builtins is sufficient. No
  need for a custom one. The same approach is used on x86 with gcc8
  already, but other platforms had not been adjusted to use it.
  
  Change-Id: I3973ff723a31f90cc8d19ac098eb1e85d471d610
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3594
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

0da81fed5406: sparc: fix interrupt enable/disable code
  
  The manually written code was all wrong (missing branch delay slots,
  wrong type of return instruction used, probably more bugs). Use the same
  approach as x86 to have inline functions instead, which is much better
  for performance and simpler to write.
  
  Change-Id: Iac0fc814c15311658f983da58ac7f9d3edd75b81
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3595
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

a27d19ee5728: openfirmware: move text cursor to top of screen before showing 
splashscreen
  
  If we need to display some text during boot, it's nicer to have it on
  top of the splashscreen, rather than scroll the display down.
  
  Change-Id: I897073d31120ec3eebd2edc4632960db7eb7977d
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3596
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                                   [ PulkoMandy <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 69 insertions(+), 112 deletions(-)
headers/private/kernel/arch/sparc/arch_atomic.h | 64 ---------------------
headers/private/kernel/arch/sparc/arch_int.h    | 59 ++++++++++++++++++-
src/system/boot/platform/openfirmware/video.cpp |  5 ++
src/system/kernel/arch/sparc/arch_asm.S         | 53 ++---------------

############################################################################

Commit:      6f743e68531634f1012c6cb6cc8fa3a7979a9482
URL:         https://git.haiku-os.org/haiku/commit/?id=6f743e685316
Author:      PulkoMandy <pulkomandy@xxxxxxxxxxxxx>
Date:        Fri Jan  1 17:44:11 2021 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Fri Jan  1 22:04:13 2021 UTC

sparc: remove unneeded atomic implementation

The definition in SupportDefs.h using gcc builtins is sufficient. No
need for a custom one. The same approach is used on x86 with gcc8
already, but other platforms had not been adjusted to use it.

Change-Id: I3973ff723a31f90cc8d19ac098eb1e85d471d610
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3594
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

----------------------------------------------------------------------------

diff --git a/headers/private/kernel/arch/sparc/arch_atomic.h 
b/headers/private/kernel/arch/sparc/arch_atomic.h
index 8ddbb554c2..98ed6a2a5b 100644
--- a/headers/private/kernel/arch/sparc/arch_atomic.h
+++ b/headers/private/kernel/arch/sparc/arch_atomic.h
@@ -35,69 +35,5 @@ memory_full_barrier_inline(void)
 #define memory_full_barrier            memory_full_barrier_inline
 
 
-static inline void
-atomic_set_inline(int32* value, int32 newValue)
-{
-       memory_write_barrier();
-       *(volatile int32*)value = newValue;
-}
-
-
-static inline int32
-atomic_get_and_set_inline(int32* value, int32 newValue)
-{
-       // BIG TODO: PowerPC Atomic get and set
-//     asm volatile("xchgl %0, (%1)"
-//             : "+r" (newValue)
-//             : "r" (value)
-//             : "memory");
-       return newValue;
-}
-
-
-static inline int32
-atomic_test_and_set_inline(int32* value, int32 newValue, int32 testAgainst)
-{
-       // BIG TODO: PowerPC Atomic test and set inline
-//     asm volatile("lock; cmpxchgl %2, (%3)"
-//             : "=a" (newValue)
-//             : "0" (testAgainst), "r" (newValue), "r" (value)
-//             : "memory");
-       return newValue;
-}
-
-
-static inline int32
-atomic_add_inline(int32* value, int32 newValue)
-{
-       // BIG TODO: PowerPC Atomic add inline
-//     asm volatile("lock; xaddl %0, (%1)"
-//             : "+r" (newValue)
-//             : "r" (value)
-//             : "memory");
-       return newValue;
-}
-
-
-static inline int32
-atomic_get_inline(int32* value)
-{
-       int32 newValue = *(volatile int32*)value;
-       memory_read_barrier();
-       return newValue;
-}
-
-
-#define atomic_set                             atomic_set_inline
-#define atomic_get_and_set             atomic_get_and_set_inline
-#ifndef atomic_test_and_set
-#      define atomic_test_and_set      atomic_test_and_set_inline
-#endif
-#ifndef atomic_add
-#      define atomic_add                       atomic_add_inline
-#endif
-#define atomic_get                             atomic_get_inline
-
-
 #endif // _KERNEL_ARCH_PPC_ATOMIC_H
 

############################################################################

Commit:      0da81fed5406294d9564f549c699563b06c2bd96
URL:         https://git.haiku-os.org/haiku/commit/?id=0da81fed5406
Author:      PulkoMandy <pulkomandy@xxxxxxxxxxxxx>
Date:        Fri Jan  1 20:46:49 2021 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Fri Jan  1 22:04:13 2021 UTC

sparc: fix interrupt enable/disable code

The manually written code was all wrong (missing branch delay slots,
wrong type of return instruction used, probably more bugs). Use the same
approach as x86 to have inline functions instead, which is much better
for performance and simpler to write.

Change-Id: Iac0fc814c15311658f983da58ac7f9d3edd75b81
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3595
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

----------------------------------------------------------------------------

diff --git a/headers/private/kernel/arch/sparc/arch_int.h 
b/headers/private/kernel/arch/sparc/arch_int.h
index d59e0eb684..661a784603 100644
--- a/headers/private/kernel/arch/sparc/arch_int.h
+++ b/headers/private/kernel/arch/sparc/arch_int.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2019, Haiku Inc. All rights reserved.
+ * Copyright 2005-2021, Haiku Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -14,5 +14,62 @@
 
 #define NUM_IO_VECTORS 256
 
+static inline void
+arch_int_enable_interrupts_inline(void)
+{
+       int tmp;
+       asm volatile(
+               "rdpr %%pstate, %0\n"
+               "or %0, 2, %0\n"
+               "wrpr %0, %%pstate\n"
+               : "=r" (tmp)
+       );
+}
+
+
+static inline int
+arch_int_disable_interrupts_inline(void)
+{
+       int flags;
+       int tmp;
+       asm volatile(
+               "rdpr %%pstate, %0\n"
+               "andn %0, 2, %1\n"
+               "wrpr %1, %%pstate\n"
+               : "=r" (flags), "=r" (tmp)
+       );
+       return flags & 2;
+}
+
+
+static inline void
+arch_int_restore_interrupts_inline(int oldState)
+{
+       if (oldState)
+               arch_int_enable_interrupts_inline();
+}
+
+
+static inline bool
+arch_int_are_interrupts_enabled_inline(void)
+{
+       int flags;
+       asm volatile(
+               "rdpr %%pstate, %0\n"
+               : "=r" (flags)
+       );
+
+       return flags & 2;
+}
+
+
+// map the functions to the inline versions
+#define arch_int_enable_interrupts()   arch_int_enable_interrupts_inline()
+#define arch_int_disable_interrupts()  arch_int_disable_interrupts_inline()
+#define arch_int_restore_interrupts(status)    \
+       arch_int_restore_interrupts_inline(status)
+#define arch_int_are_interrupts_enabled()      \
+       arch_int_are_interrupts_enabled_inline()
+
 
 #endif /* _KERNEL_ARCH_SPARC_INT_H */
diff --git a/src/system/kernel/arch/sparc/arch_asm.S 
b/src/system/kernel/arch/sparc/arch_asm.S
index 25eef0aafc..33fe89becf 100644
--- a/src/system/kernel/arch/sparc/arch_asm.S
+++ b/src/system/kernel/arch/sparc/arch_asm.S
@@ -10,66 +10,25 @@
 .text
 
 
-/* void arch_int_enable_interrupts(void) */
-FUNCTION(arch_int_enable_interrupts):
-       rdpr %pstate, %o0
-       or   %o0, 2, %o0
-       wrpr %o0, 0, %pstate
-       ret
-FUNCTION_END(arch_int_enable_interrupts)
-
-
-/* int arch_int_disable_interrupts(void)
- */
-FUNCTION(arch_int_disable_interrupts):
-       rdpr %pstate, %o1
-       // Set output register to previous state
-       and %o1, 2, %o0
-       // Clear interrupt bit
-       andn %o1, 2, %o1
-
-       wrpr %o1, 0, %pstate
-       ret
-FUNCTION_END(arch_int_disable_interrupts)
-
-
-/* void arch_int_restore_interrupts(int oldState)
- */
-FUNCTION(arch_int_restore_interrupts):
-       rdpr %pstate, %o1
-       // Clear interrupt bit
-       andn %o1, 2, %o1
-       // Restore previous interript bit state
-       or %o1, %o0, %o1
-       wrpr %o1, 0, %pstate
-       ret
-FUNCTION_END(arch_int_restore_interrupts)
-
-
-/* bool arch_int_are_interrupts_enabled(void) */
-FUNCTION(arch_int_are_interrupts_enabled):
-       rdpr %pstate, %o0
-       andn %o0, 2, %o0
-       ret
-FUNCTION_END(arch_int_are_interrupts_enabled)
-
-
 /* status_t arch_cpu_user_memcpy(void *to, const void *from, size_t size, 
addr_t *faultHandler) */
 FUNCTION(_arch_cpu_user_memcpy):
        // TODO
-       ret
+       retl
+       nop
 FUNCTION_END(_arch_cpu_user_memcpy)
 
 
 /* status_t arch_cpu_user_memset(void *to, char c, size_t count, addr_t 
*faultHandler) */
 FUNCTION(_arch_cpu_user_memset):
        // TODO
-       ret
+       retl
+       nop
 FUNCTION_END(_arch_cpu_user_memset)
 
 
 /* ssize_t arch_cpu_user_strlcpy(void *to, const void *from, size_t size, 
addr_t *faultHandler) */
 FUNCTION(_arch_cpu_user_strlcpy):
        // TODO
-       ret
+       retl
+       nop
 FUNCTION_END(_arch_cpu_user_strlcpy)

############################################################################

Revision:    hrev54836
Commit:      a27d19ee57280e104d8db6d59b5fcc075a668c70
URL:         https://git.haiku-os.org/haiku/commit/?id=a27d19ee5728
Author:      PulkoMandy <pulkomandy@xxxxxxxxxxxxx>
Date:        Fri Jan  1 21:48:04 2021 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Fri Jan  1 22:04:13 2021 UTC

openfirmware: move text cursor to top of screen before showing splashscreen

If we need to display some text during boot, it's nicer to have it on
top of the splashscreen, rather than scroll the display down.

Change-Id: I897073d31120ec3eebd2edc4632960db7eb7977d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3596
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

----------------------------------------------------------------------------

diff --git a/src/system/boot/platform/openfirmware/video.cpp 
b/src/system/boot/platform/openfirmware/video.cpp
index 41cbd4f935..1bd241fdba 100644
--- a/src/system/boot/platform/openfirmware/video.cpp
+++ b/src/system/boot/platform/openfirmware/video.cpp
@@ -7,6 +7,7 @@
 
 #include <boot/platform.h>
 #include <boot/stage2.h>
+#include <boot/platform/generic/text_console.h>
 #include <boot/platform/generic/video.h>
 #include <edid.h>
 #include <platform/openfirmware/openfirmware.h>
@@ -87,6 +88,10 @@ platform_switch_to_logo(void)
        gKernelArgs.frame_buffer.depth = depth;
        gKernelArgs.frame_buffer.bytes_per_row = lineBytes;
 
+       // Move text to top of display so we don't scroll the boot logo out as 
soon
+       // as we display some text
+       console_set_cursor(0, 0);
+
        dprintf("video mode: %ux%ux%u\n", gKernelArgs.frame_buffer.width,
                gKernelArgs.frame_buffer.height, 
gKernelArgs.frame_buffer.depth);
 


Other related posts:

  • » [haiku-commits] haiku: hrev54836 - headers/private/kernel/arch/sparc src/system/kernel/arch/sparc src/system/boot/platform/openfirmware - waddlesplash