Changeset ebb3538 in mainline


Ignore:
Timestamp:
2021-09-15T15:01:03Z (3 years ago)
Author:
Martin Decky <martin@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5ecac7e
Parents:
8ce56a6
Message:

Improve early kernel debugging prints

Since the early kernel debugging prints are useful only in a few
debugging scenarios, define a configuration option that disables them by
default (if enabled, it produces duplicate output which might be
confusing).

Implement early kernel debugging prints for the HiKey960.

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    r8ce56a6 rebb3538  
    396396! CONFIG_DEBUG (y/n)
    397397
     398% Early debugging print
     399! [CONFIG_DEBUG=y] CONFIG_DEBUG_EARLY_PRINT (n/y)
     400
    398401% Sanitize undefined behavior (userspace)
    399402! CONFIG_UBSAN (n/y)
  • kernel/arch/amd64/src/asm.S

    r8ce56a6 rebb3538  
    411411FUNCTION_BEGIN(early_putuchar)
    412412
     413#if (defined(CONFIG_DEBUG_EARLY_PRINT))
     414
    413415#if (defined(CONFIG_L4RE_UVMM_EARLY_PRINT))
    414416        xorl %eax, %eax  /* RAX==0: uvmm's print hypercall */
     
    543545#endif
    544546
     547#endif
     548
    545549        ret
    546550FUNCTION_END(early_putuchar)
  • kernel/arch/arm64/include/arch/machine_func.h

    r8ce56a6 rebb3538  
    5050        size_t (*machine_get_irq_count)(void);
    5151        const char *(*machine_get_platform_name)(void);
     52        void (*machine_early_uart_output)(char32_t);
    5253};
    5354
     
    6061extern size_t machine_get_irq_count(void);
    6162extern const char *machine_get_platform_name(void);
     63extern void machine_early_uart_output(char32_t);
    6264
    6365#endif
  • kernel/arch/arm64/src/arm64.c

    r8ce56a6 rebb3538  
    4040#include <arch/exception.h>
    4141#include <arch/machine_func.h>
     42#include <console/console.h>
    4243#include <interrupt.h>
    4344#include <proc/scheduler.h>
     
    256257}
    257258
     259void early_putuchar(char32_t c)
     260{
     261#ifdef CONFIG_DEBUG_EARLY_PRINT
     262        if (c == '\n')
     263                machine_early_uart_output('\r');
     264
     265        machine_early_uart_output(c);
     266#endif
     267}
     268
    258269/** @}
    259270 */
  • kernel/arch/arm64/src/asm.S

    r8ce56a6 rebb3538  
    5555FUNCTION_END(memcpy_from_uspace_failover_address)
    5656FUNCTION_END(memcpy_to_uspace_failover_address)
    57 
    58 FUNCTION_BEGIN(early_putuchar)
    59         ret
    60 FUNCTION_END(early_putuchar)
    6157
    6258/** Flush instruction caches
  • kernel/arch/arm64/src/mach/hikey960/hikey960.c

    r8ce56a6 rebb3538  
    122122}
    123123
     124static void hikey960_early_uart_output(char32_t c)
     125{
     126        volatile uint32_t *uartdr = (volatile uint32_t *)
     127            PA2KA(HIKEY960_UART_ADDRESS);
     128        volatile uint32_t *uartfr = (volatile uint32_t *)
     129            PA2KA(HIKEY960_UART_ADDRESS + 24);
     130
     131        while (*uartfr & 0x20U) {
     132        }
     133
     134        *uartdr = c;
     135}
     136
    124137struct arm_machine_ops hikey960_machine_ops = {
    125138        hikey960_init,
     
    129142        hikey960_enable_vtimer_irq,
    130143        hikey960_get_irq_count,
    131         hikey960_get_platform_name
     144        hikey960_get_platform_name,
     145        hikey960_early_uart_output
    132146};
    133147
  • kernel/arch/arm64/src/machine_func.c

    r8ce56a6 rebb3538  
    101101}
    102102
     103/** Early debugging output. */
     104void machine_early_uart_output(char32_t c)
     105{
     106        if (machine_ops->machine_early_uart_output != NULL)
     107                machine_ops->machine_early_uart_output(c);
     108}
     109
    103110/** @}
    104111 */
  • kernel/arch/ia32/src/asm.S

    r8ce56a6 rebb3538  
    453453FUNCTION_BEGIN(early_putuchar)
    454454
    455 #if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
     455#if ((defined(CONFIG_DEBUG_EARLY_PRINT)) && (defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
    456456
    457457        /* Prologue, save preserved registers */
  • kernel/generic/src/console/console.c

    r8ce56a6 rebb3538  
    379379                 * The early_putuchar() function is used to output
    380380                 * the character for low-level debugging purposes.
    381                  * Note that the early_putc() function might be
     381                 * Note that the early_putuchar() function might be
    382382                 * a no-op on certain hardware configurations.
    383383                 */
Note: See TracChangeset for help on using the changeset viewer.