Changes in / [94abc30c:6b03a3c] in mainline


Ignore:
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia64/src/drivers/ski.c

    r94abc30c r6b03a3c  
    6060};
    6161
    62 static void ski_putuchar(outdev_t *, const char32_t);
     62static void ski_write(outdev_t *, const char *, size_t);
    6363
    6464static outdev_operations_t skidev_ops = {
    65         .write = ski_putuchar,
     65        .write = ski_write,
    6666        .redraw = NULL,
    6767        .scroll_up = NULL,
     
    182182}
    183183
    184 static void ski_do_putchar(char ch)
     184static void ski_do_putchar(uint8_t ch)
    185185{
    186186        asm volatile (
     
    203203 *
    204204 */
    205 static void ski_putuchar(outdev_t *dev, char32_t ch)
    206 {
     205static void ski_write(outdev_t *dev, const char *s, size_t n)
     206{
     207        /* If the userspace owns the console, do not output anything. */
    207208        if (ski_parea.mapped && !console_override)
    208209                return;
    209210
    210         if (ascii_check(ch)) {
    211                 if (ch == '\n')
     211        const char *top = s + n;
     212        assert(top >= s);
     213
     214        for (; s < top; s++) {
     215                if (*s == '\n')
    212216                        ski_do_putchar('\r');
    213217
    214                 ski_do_putchar(ch);
    215         } else {
    216                 ski_do_putchar('?');
     218                ski_do_putchar((uint8_t) *s);
    217219        }
    218220}
  • kernel/arch/riscv64/src/drivers/ucb.c

    r94abc30c r6b03a3c  
    4141static volatile uint64_t *fromhost;
    4242
    43 static outdev_operations_t htifdev_ops = {
    44         .write = htif_putuchar,
    45         .redraw = NULL,
    46         .scroll_up = NULL,
    47         .scroll_down = NULL
    48 };
    49 
    5043static void poll_fromhost()
    5144{
     
    5649        *fromhost = 0;
    5750}
     51
     52static void htif_cmd(uint8_t device, uint8_t cmd, uint64_t payload)
     53{
     54        uint64_t val = (((uint64_t) device) << 56) |
     55            (((uint64_t) cmd) << 48) |
     56            (payload & UINT64_C(0xffffffffffff));
     57
     58        while (*tohost)
     59                poll_fromhost();
     60
     61        *tohost = val;
     62}
     63
     64static void htif_write(outdev_t *dev, const char *s, size_t n)
     65{
     66        const char *top = s + n;
     67        assert(top >= s);
     68
     69        for (; s < top; s++) {
     70                if (*s == '\n')
     71                        htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, '\r');
     72
     73                htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, (uint8_t) *s);
     74        }
     75}
     76
     77static outdev_operations_t htifdev_ops = {
     78        .write = htif_write,
     79        .redraw = NULL,
     80        .scroll_up = NULL,
     81        .scroll_down = NULL
     82};
    5883
    5984void htif_init(volatile uint64_t *tohost_addr, volatile uint64_t *fromhost_addr)
     
    7297        return htifdev;
    7398}
    74 
    75 static void htif_cmd(uint8_t device, uint8_t cmd, uint64_t payload)
    76 {
    77         uint64_t val = (((uint64_t) device) << 56) |
    78             (((uint64_t) cmd) << 48) |
    79             (payload & UINT64_C(0xffffffffffff));
    80 
    81         while (*tohost)
    82                 poll_fromhost();
    83 
    84         *tohost = val;
    85 }
    86 
    87 void htif_putuchar(outdev_t *dev, const char32_t ch)
    88 {
    89         if (ascii_check(ch))
    90                 htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, ch);
    91         else
    92                 htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, U_SPECIAL);
    93 }
  • kernel/arch/sparc64/src/drivers/niagara.c

    r94abc30c r6b03a3c  
    5757static niagara_instance_t *instance = NULL;
    5858
    59 static void niagara_putuchar(outdev_t *, const char32_t);
     59static void niagara_write(outdev_t *, const char *, size_t);
    6060
    6161/** Character device operations */
    6262static outdev_operations_t niagara_ops = {
    63         .write = niagara_putuchar,
     63        .write = niagara_write,
    6464        .redraw = NULL,
    6565        .scroll_up = NULL,
     
    9595
    9696/** Write a single character to the standard output. */
    97 static inline void do_putchar(char c)
     97static inline void do_putchar(uint8_t c)
    9898{
    9999        /* Repeat until the buffer is non-full */
     
    102102}
    103103
    104 /** Write a single character to the standard output. */
    105 static void niagara_putuchar(outdev_t *dev, char32_t ch)
    106 {
    107         if ((!outbuf_parea.mapped) || (console_override)) {
    108                 if (ascii_check(ch)) {
    109                         do_putchar(ch);
    110                         if (ch == '\n')
    111                                 do_putchar('\r');
    112                 } else {
    113                         do_putchar('?');
    114                 }
     104static void niagara_write(outdev_t *dev, const char *s, size_t n)
     105{
     106        /* If the userspace owns the console, do not output anything. */
     107        if (outbuf_parea.mapped && !console_override)
     108                return;
     109
     110        const char *top = s + n;
     111        assert(top >= s);
     112
     113        for (; s < top; s++) {
     114                if (*s == '\n')
     115                        do_putchar('\r');
     116
     117                do_putchar((uint8_t) *s);
    115118        }
    116119}
  • kernel/genarch/src/drivers/dsrln/dsrlnout.c

    r94abc30c r6b03a3c  
    4949} dsrlnout_instance_t;
    5050
    51 static void dsrlnout_putuchar(outdev_t *dev, const char32_t ch)
     51static void dsrlnout_write(outdev_t *dev, const char *s, size_t n)
    5252{
    5353        dsrlnout_instance_t *instance = (dsrlnout_instance_t *) dev->data;
    5454
    55         if ((!instance->parea.mapped) || (console_override)) {
    56                 if (ascii_check(ch))
    57                         pio_write_8(instance->base, ch);
    58                 else
    59                         pio_write_8(instance->base, U_SPECIAL);
     55        if (instance->parea.mapped && !console_override)
     56                return;
     57
     58        const char *top = s + n;
     59        assert(top >= s);
     60
     61        for (; s < top; s++) {
     62                if (*s == '\n')
     63                        pio_write_8(instance->base, '\r');
     64
     65                pio_write_8(instance->base, (uint8_t) *s);
    6066        }
    6167}
    6268
    6369static outdev_operations_t dsrlndev_ops = {
    64         .write = dsrlnout_putuchar,
     70        .write = dsrlnout_write,
    6571        .redraw = NULL,
    6672        .scroll_up = NULL,
  • kernel/genarch/src/drivers/omap/uart.c

    r94abc30c r6b03a3c  
    4949}
    5050
    51 static void omap_uart_putuchar(outdev_t *dev, char32_t ch)
     51static void omap_uart_write(outdev_t *dev, const char *s, size_t n)
    5252{
    5353        omap_uart_t *uart = dev->data;
    54         if (!ascii_check(ch)) {
    55                 omap_uart_txb(uart, U_SPECIAL);
    56         } else {
    57                 if (ch == '\n')
     54
     55        const char *top = s + n;
     56        assert(top >= s);
     57
     58        for (; s < top; s++) {
     59                if (*s == '\n')
    5860                        omap_uart_txb(uart, '\r');
    59                 omap_uart_txb(uart, ch);
     61
     62                omap_uart_txb(uart, (uint8_t) *s);
    6063        }
    6164}
    6265
    6366static outdev_operations_t omap_uart_ops = {
    64         .write = omap_uart_putuchar,
     67        .write = omap_uart_write,
    6568        .redraw = NULL,
    6669        .scroll_up = NULL,
  • kernel/genarch/src/drivers/s3c24xx/uart.c

    r94abc30c r6b03a3c  
    4949#include <str.h>
    5050
    51 static void s3c24xx_uart_sendb(outdev_t *dev, uint8_t byte)
     51static void s3c24xx_uart_sendb(s3c24xx_uart_t *uart, uint8_t byte)
    5252{
    53         s3c24xx_uart_t *uart =
    54             (s3c24xx_uart_t *) dev->data;
    55 
    5653        /* Wait for space becoming available in Tx FIFO. */
    5754        while ((pio_read_32(&uart->io->ufstat) & S3C24XX_UFSTAT_TX_FULL) != 0)
     
    6158}
    6259
    63 static void s3c24xx_uart_putuchar(outdev_t *dev, char32_t ch)
     60static void s3c24xx_uart_write(outdev_t *dev, const char *s, size_t n)
    6461{
    65         s3c24xx_uart_t *uart =
    66             (s3c24xx_uart_t *) dev->data;
     62        s3c24xx_uart_t *uart = dev->data;
    6763
    68         if ((!uart->parea.mapped) || (console_override)) {
    69                 if (!ascii_check(ch)) {
    70                         s3c24xx_uart_sendb(dev, U_SPECIAL);
    71                 } else {
    72                         if (ch == '\n')
    73                                 s3c24xx_uart_sendb(dev, (uint8_t) '\r');
    74                         s3c24xx_uart_sendb(dev, (uint8_t) ch);
    75                 }
     64        /* If the userspace owns the console, do not output anything. */
     65        if (uart->parea.mapped && !console_override)
     66                return;
     67
     68        const char *top = s + n;
     69        assert(top >= s);
     70
     71        for (; s < top; s++) {
     72                if (*s == '\n')
     73                        s3c24xx_uart_sendb(uart, '\r');
     74
     75                s3c24xx_uart_sendb(uart, (uint8_t) *s);
    7676        }
    7777}
     
    9494
    9595static outdev_operations_t s3c24xx_uart_ops = {
    96         .write = s3c24xx_uart_putuchar,
     96        .write = s3c24xx_uart_write,
    9797        .redraw = NULL,
    9898        .scroll_up = NULL,
  • uspace/lib/c/arch/arm32/src/atomic.c

    r94abc30c r6b03a3c  
    4040unsigned long long __atomic_load_8(const volatile void *mem0, int model)
    4141{
    42         const volatile unsigned long long *mem = mem0;
    43 
    44         (void) model;
    45 
    46         unsigned long long ret;
    47 
    48         /*
    49          * The following instructions between labels 1 and 2 constitute a
    50          * Restartable Atomic Seqeunce. Should the sequence be non-atomic,
    51          * the kernel will restart it.
    52          */
    53         asm volatile (
    54             "1:\n"
    55             "   adr %[ret], 1b\n"
    56             "   str %[ret], %[rp0]\n"
    57             "   adr %[ret], 2f\n"
    58             "   str %[ret], %[rp1]\n"
    59 
    60             "   ldrd %[ret], %[addr]\n"
    61             "2:\n"
    62             : [ret] "=&r" (ret),
     42        const volatile unsigned *mem = mem0;
     43
     44        (void) model;
     45
     46        union {
     47                unsigned long long a;
     48                unsigned b[2];
     49        } ret;
     50
     51        /*
     52         * The following instructions between labels 1 and 2 constitute a
     53         * Restartable Atomic Seqeunce. Should the sequence be non-atomic,
     54         * the kernel will restart it.
     55         */
     56        asm volatile (
     57            "1:\n"
     58            "   adr %[ret0], 1b\n"
     59            "   str %[ret0], %[rp0]\n"
     60            "   adr %[ret0], 2f\n"
     61            "   str %[ret0], %[rp1]\n"
     62
     63            "   ldr %[ret0], %[addr0]\n"
     64            "   ldr %[ret1], %[addr1]\n"
     65            "2:\n"
     66            : [ret0] "=&r" (ret.b[0]),
     67              [ret1] "=&r" (ret.b[1]),
    6368              [rp0] "=m" (ras_page[0]),
    6469              [rp1] "=m" (ras_page[1])
    65             : [addr] "m" (*mem)
    66         );
    67 
    68         ras_page[0] = 0;
    69         ras_page[1] = 0xffffffff;
    70 
    71         return ret;
     70            : [addr0] "m" (mem[0]),
     71              [addr1] "m" (mem[1])
     72        );
     73
     74        ras_page[0] = 0;
     75        ras_page[1] = 0xffffffff;
     76
     77        return ret.a;
    7278}
    7379
    7480void __atomic_store_8(volatile void *mem0, unsigned long long val, int model)
    7581{
    76         volatile unsigned long long *mem = mem0;
    77 
    78         (void) model;
     82        volatile unsigned *mem = mem0;
     83
     84        (void) model;
     85
     86        union {
     87                unsigned long long a;
     88                unsigned b[2];
     89        } v;
     90
     91        v.a = val;
    7992
    8093        /* scratch register */
     
    93106            "   str %[tmp], %[rp1]\n"
    94107
    95             "   strd %[imm], %[addr]\n"
     108            "   str %[val0], %[addr0]\n"
     109            "   str %[val1], %[addr1]\n"
    96110            "2:\n"
    97111            : [tmp] "=&r" (tmp),
    98112              [rp0] "=m" (ras_page[0]),
    99113              [rp1] "=m" (ras_page[1]),
    100               [addr] "=m" (*mem)
    101             : [imm] "r" (val)
     114              [addr0] "=m" (mem[0]),
     115              [addr1] "=m" (mem[1])
     116            : [val0] "r" (v.b[0]),
     117              [val1] "r" (v.b[1])
    102118        );
    103119
Note: See TracChangeset for help on using the changeset viewer.