Changeset 28a5ebd in mainline for kernel/arch


Ignore:
Timestamp:
2020-06-18T15:39:50Z (5 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ce52c333
Parents:
4f663f3e
Message:

Use char32_t instead of wchat_t to represent UTF-32 strings

The intention of the native HelenOS string API has been always to
support Unicode in the UTF-8 and UTF-32 encodings as the sole character
representations and ignore the obsolete mess of older single-byte and
multibyte character encodings. Before C11, the wchar_t type has been
slightly misused for the purpose of the UTF-32 strings. The newer
char32_t type is obviously a much more suitable option. The standard
defines char32_t as uint_least32_t, thus we can take the liberty to fix
it to uint32_t.

To maintain compatilibity with the C Standard, the putwchar(wchar_t)
functions has been replaced by our custom putuchar(char32_t) functions
where appropriate.

Location:
kernel/arch
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/abs32le/src/abs32le.c

    r4f663f3e r28a5ebd  
    136136}
    137137
    138 void early_putwchar(wchar_t ch)
     138void early_putuchar(char32_t ch)
    139139{
    140140}
  • kernel/arch/amd64/src/asm.S

    r4f663f3e r28a5ebd  
    409409 *
    410410 */
    411 FUNCTION_BEGIN(early_putwchar)
     411FUNCTION_BEGIN(early_putuchar)
    412412
    413413#if (defined(CONFIG_L4RE_UVMM_EARLY_PRINT))
     
    447447        /* Sanity check for the cursor on screen */
    448448        cmp $2000, %ax
    449         jb early_putwchar_cursor_ok
     449        jb early_putuchar_cursor_ok
    450450
    451451                movw $1998, %ax
    452452
    453         early_putwchar_cursor_ok:
     453        early_putuchar_cursor_ok:
    454454
    455455        movw %ax, %bx
     
    460460
    461461        cmp $0x0a, %al
    462         jne early_putwchar_backspace
     462        jne early_putuchar_backspace
    463463
    464464                /* Interpret newline */
     
    474474                subw %dx, %bx
    475475
    476                 jmp early_putwchar_skip
    477 
    478         early_putwchar_backspace:
     476                jmp early_putuchar_skip
     477
     478        early_putuchar_backspace:
    479479
    480480                cmp $0x08, %al
    481                 jne early_putwchar_print
     481                jne early_putuchar_print
    482482
    483483                /* Interpret backspace */
    484484
    485485                cmp $0x0000, %bx
    486                 je early_putwchar_skip
     486                je early_putuchar_skip
    487487
    488488                dec %bx
    489                 jmp early_putwchar_skip
    490 
    491         early_putwchar_print:
     489                jmp early_putuchar_skip
     490
     491        early_putuchar_print:
    492492
    493493                /* Print character */
     
    497497                inc %bx
    498498
    499         early_putwchar_skip:
     499        early_putuchar_skip:
    500500
    501501        /* Sanity check for the cursor on the last line */
    502502        cmp $2000, %bx
    503         jb early_putwchar_no_scroll
     503        jb early_putuchar_no_scroll
    504504
    505505                /* Scroll the screen (24 rows) */
     
    517517                movw $1920, %bx
    518518
    519         early_putwchar_no_scroll:
     519        early_putuchar_no_scroll:
    520520
    521521        /* Write bits 8 - 15 of the cursor address */
     
    544544
    545545        ret
    546 FUNCTION_END(early_putwchar)
     546FUNCTION_END(early_putuchar)
  • kernel/arch/arm32/src/asm.S

    r4f663f3e r28a5ebd  
    9898        ldmia sp!, {r4, r5, pc}
    9999
    100 FUNCTION_BEGIN(early_putwchar)
     100FUNCTION_BEGIN(early_putuchar)
    101101        mov pc, lr
    102 FUNCTION_END(early_putwchar)
     102FUNCTION_END(early_putuchar)
  • kernel/arch/arm64/src/asm.S

    r4f663f3e r28a5ebd  
    5656FUNCTION_END(memcpy_to_uspace_failover_address)
    5757
    58 FUNCTION_BEGIN(early_putwchar)
     58FUNCTION_BEGIN(early_putuchar)
    5959        ret
    60 FUNCTION_END(early_putwchar)
     60FUNCTION_END(early_putuchar)
    6161
    6262/* Static checks for the istate_t save/load. */
  • kernel/arch/ia32/src/asm.S

    r4f663f3e r28a5ebd  
    451451 *
    452452 */
    453 FUNCTION_BEGIN(early_putwchar)
     453FUNCTION_BEGIN(early_putuchar)
    454454
    455455#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
     
    484484        /* Sanity check for the cursor on screen */
    485485        cmp $2000, %ax
    486         jb early_putwchar_cursor_ok
     486        jb early_putuchar_cursor_ok
    487487
    488488                movw $1998, %ax
    489489
    490         early_putwchar_cursor_ok:
     490        early_putuchar_cursor_ok:
    491491
    492492        movw %ax, %bx
     
    497497
    498498        cmp $0x0a, %al
    499         jne early_putwchar_backspace
     499        jne early_putuchar_backspace
    500500
    501501                /* Interpret newline */
     
    511511                subw %dx, %bx
    512512
    513                 jmp early_putwchar_skip
    514 
    515         early_putwchar_backspace:
     513                jmp early_putuchar_skip
     514
     515        early_putuchar_backspace:
    516516
    517517                cmp $0x08, %al
    518                 jne early_putwchar_print
     518                jne early_putuchar_print
    519519
    520520                /* Interpret backspace */
    521521
    522522                cmp $0x0000, %bx
    523                 je early_putwchar_skip
     523                je early_putuchar_skip
    524524
    525525                dec %bx
    526                 jmp early_putwchar_skip
    527 
    528         early_putwchar_print:
     526                jmp early_putuchar_skip
     527
     528        early_putuchar_print:
    529529
    530530                /* Print character */
     
    534534                inc %bx
    535535
    536         early_putwchar_skip:
     536        early_putuchar_skip:
    537537
    538538        /* Sanity check for the cursor on the last line */
    539539        cmp $2000, %bx
    540         jb early_putwchar_no_scroll
     540        jb early_putuchar_no_scroll
    541541
    542542                /* Scroll the screen (24 rows) */
     
    554554                movw $1920, %bx
    555555
    556         early_putwchar_no_scroll:
     556        early_putuchar_no_scroll:
    557557
    558558        /* Write bits 8 - 15 of the cursor address */
     
    583583
    584584        ret
    585 FUNCTION_END(early_putwchar)
    586 
     585FUNCTION_END(early_putuchar)
     586
  • kernel/arch/ia64/src/asm.S

    r4f663f3e r28a5ebd  
    191191FUNCTION_END(switch_to_userspace)
    192192
    193 FUNCTION_BEGIN(early_putwchar)
     193FUNCTION_BEGIN(early_putuchar)
    194194        br.ret.sptk.many b0
    195 FUNCTION_END(early_putwchar)
     195FUNCTION_END(early_putuchar)
  • kernel/arch/ia64/src/drivers/ski.c

    r4f663f3e r28a5ebd  
    6060};
    6161
    62 static void ski_putwchar(outdev_t *, const wchar_t);
     62static void ski_putuchar(outdev_t *, const char32_t);
    6363
    6464static outdev_operations_t skidev_ops = {
    65         .write = ski_putwchar,
     65        .write = ski_putuchar,
    6666        .redraw = NULL,
    6767        .scroll_up = NULL,
     
    8282 *
    8383 */
    84 static wchar_t ski_getchar(void)
     84static char32_t ski_getchar(void)
    8585{
    8686        uint64_t ch;
     
    9696        );
    9797
    98         return (wchar_t) ch;
     98        return (char32_t) ch;
    9999}
    100100
     
    111111
    112112        while (count > 0) {
    113                 wchar_t ch = ski_getchar();
     113                char32_t ch = ski_getchar();
    114114
    115115                if (ch == '\0')
     
    203203 *
    204204 */
    205 static void ski_putwchar(outdev_t *dev, wchar_t ch)
     205static void ski_putuchar(outdev_t *dev, char32_t ch)
    206206{
    207207        if (ski_parea.mapped && !console_override)
  • kernel/arch/mips32/src/asm.S

    r4f663f3e r28a5ebd  
    296296FUNCTION_END(fpu_context_restore)
    297297
    298 FUNCTION_BEGIN(early_putwchar)
     298FUNCTION_BEGIN(early_putuchar)
    299299        j $ra
    300300        nop
    301 FUNCTION_END(early_putwchar)
     301FUNCTION_END(early_putuchar)
  • kernel/arch/ppc32/src/asm.S

    r4f663f3e r28a5ebd  
    265265        blr
    266266
    267 FUNCTION_BEGIN(early_putwchar)
     267FUNCTION_BEGIN(early_putuchar)
    268268        blr
    269 FUNCTION_END(early_putwchar)
     269FUNCTION_END(early_putuchar)
  • kernel/arch/riscv64/include/arch/drivers/ucb.h

    r4f663f3e r28a5ebd  
    4242extern void htif_init(volatile uint64_t *, volatile uint64_t *);
    4343extern outdev_t *htifout_init(void);
    44 extern void htif_putwchar(outdev_t *, const wchar_t);
     44extern void htif_putuchar(outdev_t *, const char32_t);
    4545
    4646#endif
  • kernel/arch/riscv64/src/asm.S

    r4f663f3e r28a5ebd  
    3535FUNCTION_END(asm_delay_loop)
    3636
    37 FUNCTION_BEGIN(early_putwchar)
     37FUNCTION_BEGIN(early_putuchar)
    3838        ret
    39 FUNCTION_END(early_putwchar)
     39FUNCTION_END(early_putuchar)
    4040
    4141FUNCTION_BEGIN(cpu_halt)
  • kernel/arch/riscv64/src/drivers/ucb.c

    r4f663f3e r28a5ebd  
    4242
    4343static outdev_operations_t htifdev_ops = {
    44         .write = htif_putwchar,
     44        .write = htif_putuchar,
    4545        .redraw = NULL,
    4646        .scroll_up = NULL,
     
    8585}
    8686
    87 void htif_putwchar(outdev_t *dev, const wchar_t ch)
     87void htif_putuchar(outdev_t *dev, const char32_t ch)
    8888{
    8989        if (ascii_check(ch))
  • kernel/arch/sparc64/src/asm.S

    r4f663f3e r28a5ebd  
    189189        mov %g0, %o0  /* return 0 on failure */
    190190
    191 FUNCTION_BEGIN(early_putwchar)
     191FUNCTION_BEGIN(early_putuchar)
    192192        retl
    193193        nop
    194 FUNCTION_END(early_putwchar)
     194FUNCTION_END(early_putuchar)
  • kernel/arch/sparc64/src/drivers/niagara.c

    r4f663f3e r28a5ebd  
    5757static niagara_instance_t *instance = NULL;
    5858
    59 static void niagara_putwchar(outdev_t *, const wchar_t);
     59static void niagara_putuchar(outdev_t *, const char32_t);
    6060
    6161/** Character device operations */
    6262static outdev_operations_t niagara_ops = {
    63         .write = niagara_putwchar,
     63        .write = niagara_putuchar,
    6464        .redraw = NULL,
    6565        .scroll_up = NULL,
     
    103103
    104104/** Write a single character to the standard output. */
    105 static void niagara_putwchar(outdev_t *dev, wchar_t ch)
     105static void niagara_putuchar(outdev_t *dev, char32_t ch)
    106106{
    107107        if ((!outbuf_parea.mapped) || (console_override)) {
Note: See TracChangeset for help on using the changeset viewer.