Changeset 8565a42 in mainline for kernel/genarch/src


Ignore:
Timestamp:
2018-03-02T20:34:50Z (8 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

Location:
kernel/genarch/src
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/acpi/acpi.c

    r3061bc1 r8565a42  
    6969        uint8_t sum = 0;
    7070        uint32_t i;
    71        
     71
    7272        for (i = 0; i < 20; i++)
    7373                sum = (uint8_t) (sum + _rsdp[i]);
    74        
     74
    7575        if (sum)
    7676                return 0; /* bad checksum */
    77        
     77
    7878        if (rsdp->revision == 0)
    7979                return 1; /* ACPI 1.0 */
    80        
     80
    8181        for (; i < rsdp->length; i++)
    8282                sum = (uint8_t) (sum + _rsdp[i]);
    83        
     83
    8484        return !sum;
    8585}
     
    9090        uint8_t sum = 0;
    9191        unsigned int i;
    92        
     92
    9393        for (i = 0; i < hdr->length; i++)
    9494                sum = (uint8_t) (sum + sdt[i]);
    95        
     95
    9696        return !sum;
    9797}
     
    109109        vsdt = (struct acpi_sdt_header *) km_map((uintptr_t) psdt,
    110110            vhdr->length, PAGE_WRITE | PAGE_NOT_CACHEABLE);
    111        
     111
    112112        // TODO: do not leak vtmp
    113113
     
    121121        size_t cnt = (acpi_rsdt->header.length - sizeof(struct acpi_sdt_header))
    122122            / sizeof(uint32_t);
    123        
     123
    124124        for (i = 0; i < cnt; i++) {
    125125                for (j = 0; j < sizeof(signature_map)
     
    127127                        struct acpi_sdt_header *hdr =
    128128                            (struct acpi_sdt_header *) (sysarg_t) acpi_rsdt->entry[i];
    129                        
     129
    130130                        struct acpi_sdt_header *vhdr = map_sdt(hdr);
    131131                        if (CMP_SIGNATURE(vhdr->signature, signature_map[j].signature)) {
    132132                                if (!acpi_sdt_check((uint8_t *) vhdr))
    133133                                        break;
    134                                
     134
    135135                                *signature_map[j].sdt_ptr = vhdr;
    136136                                LOG("%p: ACPI %s", *signature_map[j].sdt_ptr,
     
    147147        size_t cnt = (acpi_xsdt->header.length - sizeof(struct acpi_sdt_header))
    148148            / sizeof(uint64_t);
    149        
     149
    150150        for (i = 0; i < cnt; i++) {
    151151                for (j = 0; j < sizeof(signature_map)
     
    153153                        struct acpi_sdt_header *hdr =
    154154                            (struct acpi_sdt_header *) ((uintptr_t) acpi_xsdt->entry[i]);
    155                        
     155
    156156                        struct acpi_sdt_header *vhdr = map_sdt(hdr);
    157157                        if (CMP_SIGNATURE(vhdr->signature, signature_map[j].signature)) {
    158158                                if (!acpi_sdt_check((uint8_t *) vhdr))
    159159                                        break;
    160                                
     160
    161161                                *signature_map[j].sdt_ptr = vhdr;
    162162                                LOG("%p: ACPI %s", *signature_map[j].sdt_ptr,
     
    174174        unsigned int length[2] = { 1024, 128 * 1024 };
    175175        uint64_t *sig = (uint64_t *) RSDP_SIGNATURE;
    176        
     176
    177177        /*
    178178         * Find Root System Description Pointer
     
    180180         * 2. search 128K starting at 0xe0000
    181181         */
    182        
     182
    183183        addr[0] = (uint8_t *) PA2KA(ebda);
    184184        for (i = (ebda ? 0 : 1); i < 2; i++) {
     
    191191                }
    192192        }
    193        
     193
    194194        return;
    195        
     195
    196196rsdp_found:
    197197        LOG("%p: ACPI Root System Description Pointer", acpi_rsdp);
    198        
     198
    199199        uintptr_t acpi_rsdt_p = (uintptr_t) acpi_rsdp->rsdt_address;
    200200        uintptr_t acpi_xsdt_p = 0;
     
    202202        if (acpi_rsdp->revision)
    203203                acpi_xsdt_p = (uintptr_t) acpi_rsdp->xsdt_address;
    204        
     204
    205205        if (acpi_rsdt_p)
    206206                acpi_rsdt = (struct acpi_rsdt *) map_sdt(
    207207                    (struct acpi_sdt_header *) acpi_rsdt_p);
    208        
     208
    209209        if (acpi_xsdt_p)
    210210                acpi_xsdt = (struct acpi_xsdt *) map_sdt(
    211211                    (struct acpi_sdt_header *) acpi_xsdt_p);
    212        
     212
    213213        if ((acpi_rsdt) && (!acpi_sdt_check((uint8_t *) acpi_rsdt))) {
    214214                log(LF_ARCH, LVL_ERROR, "RSDT: bad checksum");
    215215                return;
    216216        }
    217        
     217
    218218        if ((acpi_xsdt) && (!acpi_sdt_check((uint8_t *) acpi_xsdt))) {
    219219                log(LF_ARCH, LVL_ERROR, "XSDT: bad checksum");
    220220                return;
    221221        }
    222        
     222
    223223        if (acpi_xsdt)
    224224                configure_via_xsdt();
  • kernel/genarch/src/acpi/madt.c

    r3061bc1 r8565a42  
    8383{
    8484        assert(i < madt_l_apic_entry_cnt);
    85        
     85
    8686        return ((struct madt_l_apic *)
    8787            madt_entries_index[madt_l_apic_entry_index + i])->apic_id;
     
    9191{
    9292        assert(i < madt_l_apic_entry_cnt);
    93        
     93
    9494        /*
    9595         * FIXME: The current local APIC driver limits usable
     
    9999        if (i > 7)
    100100                return false;
    101        
     101
    102102        return ((struct madt_l_apic *)
    103103            madt_entries_index[madt_l_apic_entry_index + i])->flags & 0x1;
     
    107107{
    108108        assert(i < madt_l_apic_entry_cnt);
    109        
     109
    110110        return ((struct madt_l_apic *)
    111111            madt_entries_index[madt_l_apic_entry_index + i])->apic_id ==
     
    117117        if (irq >= sizeof(isa_irq_map) / sizeof(int))
    118118                return (int) irq;
    119        
     119
    120120        return isa_irq_map[irq];
    121121}
     
    135135        uint8_t typea = (*((struct madt_apic_header **) a))->type;
    136136        uint8_t typeb = (*((struct madt_apic_header **) b))->type;
    137        
     137
    138138        if (typea > typeb)
    139139                return 1;
    140        
     140
    141141        if (typea < typeb)
    142142                return -1;
    143        
     143
    144144        return 0;
    145145}
     
    149149        if (madt_l_apic_entry_cnt == 0)
    150150                madt_l_apic_entry_index = i;
    151        
     151
    152152        madt_l_apic_entry_cnt++;
    153        
     153
    154154        if (!(la->flags & 0x1)) {
    155155                /* Processor is unusable, skip it. */
    156156                return;
    157157        }
    158        
     158
    159159        apic_id_mask |= 1 << la->apic_id;
    160160}
     
    169169                /* Currently not supported */
    170170        }
    171        
     171
    172172        madt_io_apic_entry_cnt++;
    173173}
     
    177177{
    178178        assert(override->source < sizeof(isa_irq_map) / sizeof(int));
    179        
     179
    180180        isa_irq_map[override->source] = override->global_int;
    181181}
     
    186186            (((uint8_t *) acpi_madt) + acpi_madt->header.length);
    187187        struct madt_apic_header *hdr;
    188        
     188
    189189        l_apic = (uint32_t *) (sysarg_t) acpi_madt->l_apic_address;
    190        
     190
    191191        /* Count MADT entries */
    192192        unsigned int madt_entries_index_cnt = 0;
     
    194194            hdr = (struct madt_apic_header *) (((uint8_t *) hdr) + hdr->length))
    195195                madt_entries_index_cnt++;
    196        
     196
    197197        /* Create MADT APIC entries index array */
    198198        madt_entries_index = (struct madt_apic_header **)
     
    201201        if (!madt_entries_index)
    202202                panic("Memory allocation error.");
    203        
     203
    204204        size_t i = 0;
    205        
     205
    206206        for (hdr = acpi_madt->apic_header; hdr < end;
    207207            hdr = (struct madt_apic_header *) (((uint8_t *) hdr) + hdr->length)) {
     
    209209                i++;
    210210        }
    211        
     211
    212212        /* Sort MADT index structure */
    213213        if (!gsort(madt_entries_index, madt_entries_index_cnt,
    214214            sizeof(struct madt_apic_header *), madt_cmp, NULL))
    215215                panic("Sorting error.");
    216        
     216
    217217        /* Parse MADT entries */
    218218        for (i = 0; i < madt_entries_index_cnt; i++) {
    219219                hdr = madt_entries_index[i];
    220                
     220
    221221                switch (hdr->type) {
    222222                case MADT_L_APIC:
     
    245245                                    "MADT: Skipping reserved entry (type=%" PRIu8 ")",
    246246                                    hdr->type);
    247                                
     247
    248248                        if (hdr->type >= MADT_RESERVED_OEM_BEGIN)
    249249                                log(LF_ARCH, LVL_NOTE,
    250250                                    "MADT: Skipping OEM entry (type=%" PRIu8 ")",
    251251                                    hdr->type);
    252                        
     252
    253253                        break;
    254254                }
    255255        }
    256        
     256
    257257        if (madt_l_apic_entry_cnt > 0)
    258258                config.cpu_count = madt_l_apic_entry_cnt;
  • kernel/genarch/src/ddi/ddi-bitmap.c

    r3061bc1 r8565a42  
    6262        if (elements > IO_PORTS)
    6363                return ENOENT;
    64        
     64
    6565        if (task->arch.iomap.elements < elements) {
    6666                /*
    6767                 * The I/O permission bitmap is too small and needs to be grown.
    6868                 */
    69                
     69
    7070                void *store = malloc(bitmap_size(elements), FRAME_ATOMIC);
    7171                if (!store)
    7272                        return ENOMEM;
    73                
     73
    7474                bitmap_t oldiomap;
    7575                bitmap_initialize(&oldiomap, task->arch.iomap.elements,
    7676                    task->arch.iomap.bits);
    77                
     77
    7878                bitmap_initialize(&task->arch.iomap, elements, store);
    79                
     79
    8080                /*
    8181                 * Mark the new range inaccessible.
     
    8383                bitmap_set_range(&task->arch.iomap, oldiomap.elements,
    8484                    elements - oldiomap.elements);
    85                
     85
    8686                /*
    8787                 * In case there really existed smaller iomap,
     
    9191                        bitmap_copy(&task->arch.iomap, &oldiomap,
    9292                            oldiomap.elements);
    93                        
     93
    9494                        free(oldiomap.bits);
    9595                }
    9696        }
    97        
     97
    9898        /*
    9999         * Enable the range and we are done.
    100100         */
    101101        bitmap_clear_range(&task->arch.iomap, (size_t) ioaddr, size);
    102        
     102
    103103        /*
    104104         * Increment I/O Permission bitmap generation counter.
    105105         */
    106106        task->arch.iomapver++;
    107        
     107
    108108        return EOK;
    109109}
     
    125125        if (elements > IO_PORTS)
    126126                return ENOENT;
    127        
     127
    128128        if (ioaddr >= task->arch.iomap.elements)
    129129                return EINVAL;
     
    136136         */
    137137        bitmap_set_range(&task->arch.iomap, (size_t) ioaddr, size);
    138        
     138
    139139        /*
    140140         * Increment I/O Permission bitmap generation counter.
    141141         */
    142142        task->arch.iomapver++;
    143        
     143
    144144        return 0;
    145145}
  • kernel/genarch/src/drivers/dsrln/dsrlnin.c

    r3061bc1 r8565a42  
    5050        dsrlnin_instance_t *instance = irq->instance;
    5151        dsrlnin_t *dev = instance->dsrlnin;
    52        
     52
    5353        indev_push_character(instance->srlnin, pio_read_8(&dev->data));
    5454}
     
    6161                instance->dsrlnin = dev;
    6262                instance->srlnin = NULL;
    63                
     63
    6464                irq_initialize(&instance->irq);
    6565                instance->irq.inr = inr;
     
    6868                instance->irq.instance = instance;
    6969        }
    70        
     70
    7171        return instance;
    7272}
     
    7676        assert(instance);
    7777        assert(srlnin);
    78        
     78
    7979        instance->srlnin = srlnin;
    8080        irq_register(&instance->irq);
  • kernel/genarch/src/drivers/dsrln/dsrlnout.c

    r3061bc1 r8565a42  
    5252{
    5353        dsrlnout_instance_t *instance = (dsrlnout_instance_t *) dev->data;
    54        
     54
    5555        if ((!instance->parea.mapped) || (console_override)) {
    5656                if (ascii_check(ch))
     
    7373        if (!dsrlndev)
    7474                return NULL;
    75        
     75
    7676        dsrlnout_instance_t *instance = malloc(sizeof(dsrlnout_instance_t),
    7777            FRAME_ATOMIC);
     
    8080                return NULL;
    8181        }
    82        
     82
    8383        outdev_initialize("dsrlndev", dsrlndev, &dsrlndev_ops);
    8484        dsrlndev->data = instance;
    85        
     85
    8686        instance->base = base;
    8787        link_initialize(&instance->parea.link);
     
    9191        instance->parea.mapped = false;
    9292        ddi_parea_register(&instance->parea);
    93        
     93
    9494        if (!fb_exported) {
    9595                /*
     
    101101                sysinfo_set_item_val("fb.kind", NULL, 3);
    102102                sysinfo_set_item_val("fb.address.physical", NULL, KA2PA(base));
    103                
     103
    104104                fb_exported = true;
    105105        }
    106        
     106
    107107        return dsrlndev;
    108108}
  • kernel/genarch/src/drivers/ega/ega.c

    r3061bc1 r8565a42  
    6363typedef struct {
    6464        IRQ_SPINLOCK_DECLARE(lock);
    65        
     65
    6666        parea_t parea;
    67        
     67
    6868        uint32_t cursor;
    6969        uint8_t *addr;
     
    8686        if ((ch >= 0x0000) && (ch <= 0x007f))
    8787                return ch;
    88        
     88
    8989        if (ch == 0x00a0)
    9090                return 255;
    91        
     91
    9292        if (ch == 0x00a1)
    9393                return 173;
    94        
     94
    9595        if ((ch >= 0x00a2) && (ch <= 0x00a3))
    9696                return (ch - 7);
    97        
     97
    9898        if (ch == 0x00a5)
    9999                return 157;
    100        
     100
    101101        if (ch == 0x00aa)
    102102                return 166;
    103        
     103
    104104        if (ch == 0x00ab)
    105105                return 174;
    106        
     106
    107107        if (ch == 0x00ac)
    108108                return 170;
    109        
     109
    110110        if (ch == 0x00b0)
    111111                return 248;
    112        
     112
    113113        if (ch == 0x00b1)
    114114                return 241;
    115        
     115
    116116        if (ch == 0x00b2)
    117117                return 253;
    118        
     118
    119119        if (ch == 0x00b5)
    120120                return 230;
    121        
     121
    122122        if (ch == 0x00b7)
    123123                return 250;
    124        
     124
    125125        if (ch == 0x00ba)
    126126                return 167;
    127        
     127
    128128        if (ch == 0x00bb)
    129129                return 175;
    130        
     130
    131131        if (ch == 0x00bc)
    132132                return 172;
    133        
     133
    134134        if (ch == 0x00bd)
    135135                return 171;
    136        
     136
    137137        if (ch == 0x00bf)
    138138                return 168;
    139        
     139
    140140        if ((ch >= 0x00c4) && (ch <= 0x00c5))
    141141                return (ch - 54);
    142        
     142
    143143        if (ch == 0x00c6)
    144144                return 146;
    145        
     145
    146146        if (ch == 0x00c7)
    147147                return 128;
    148        
     148
    149149        if (ch == 0x00c9)
    150150                return 144;
    151        
     151
    152152        if (ch == 0x00d1)
    153153                return 165;
    154        
     154
    155155        if (ch == 0x00d6)
    156156                return 153;
    157        
     157
    158158        if (ch == 0x00dc)
    159159                return 154;
    160        
     160
    161161        if (ch == 0x00df)
    162162                return 225;
    163        
     163
    164164        if (ch == 0x00e0)
    165165                return 133;
    166        
     166
    167167        if (ch == 0x00e1)
    168168                return 160;
    169        
     169
    170170        if (ch == 0x00e2)
    171171                return 131;
    172        
     172
    173173        if (ch == 0x00e4)
    174174                return 132;
    175        
     175
    176176        if (ch == 0x00e5)
    177177                return 134;
    178        
     178
    179179        if (ch == 0x00e6)
    180180                return 145;
    181        
     181
    182182        if (ch == 0x00e7)
    183183                return 135;
    184        
     184
    185185        if (ch == 0x00e8)
    186186                return 138;
    187        
     187
    188188        if (ch == 0x00e9)
    189189                return 130;
    190        
     190
    191191        if ((ch >= 0x00ea) && (ch <= 0x00eb))
    192192                return (ch - 98);
    193        
     193
    194194        if (ch == 0x00ec)
    195195                return 141;
    196        
     196
    197197        if (ch == 0x00ed)
    198198                return 161;
    199        
     199
    200200        if (ch == 0x00ee)
    201201                return 140;
    202        
     202
    203203        if (ch == 0x00ef)
    204204                return 139;
    205        
     205
    206206        if (ch == 0x00f1)
    207207                return 164;
    208        
     208
    209209        if (ch == 0x00f2)
    210210                return 149;
    211        
     211
    212212        if (ch == 0x00f3)
    213213                return 162;
    214        
     214
    215215        if (ch == 0x00f4)
    216216                return 147;
    217        
     217
    218218        if (ch == 0x00f6)
    219219                return 148;
    220        
     220
    221221        if (ch == 0x00f7)
    222222                return 246;
    223        
     223
    224224        if (ch == 0x00f9)
    225225                return 151;
    226        
     226
    227227        if (ch == 0x00fa)
    228228                return 163;
    229        
     229
    230230        if (ch == 0x00fb)
    231231                return 150;
    232        
     232
    233233        if (ch == 0x00fc)
    234234                return 129;
    235        
     235
    236236        if (ch == 0x00ff)
    237237                return 152;
    238        
     238
    239239        if (ch == 0x0192)
    240240                return 159;
    241        
     241
    242242        if (ch == 0x0393)
    243243                return 226;
    244        
     244
    245245        if (ch == 0x0398)
    246246                return 233;
    247        
     247
    248248        if (ch == 0x03a3)
    249249                return 228;
    250        
     250
    251251        if (ch == 0x03a6)
    252252                return 232;
    253        
     253
    254254        if (ch == 0x03a9)
    255255                return 234;
    256        
     256
    257257        if (ch == 0x03b1)
    258258                return 224;
    259        
     259
    260260        if (ch == 0x03b4)
    261261                return 235;
    262        
     262
    263263        if (ch == 0x03b5)
    264264                return 238;
    265        
     265
    266266        if (ch == 0x03c0)
    267267                return 227;
    268        
     268
    269269        if (ch == 0x03c3)
    270270                return 229;
    271        
     271
    272272        if (ch == 0x03c4)
    273273                return 231;
    274        
     274
    275275        if (ch == 0x03c6)
    276276                return 237;
    277        
     277
    278278        if (ch == 0x207f)
    279279                return 252;
    280        
     280
    281281        if (ch == 0x20a7)
    282282                return 158;
    283        
     283
    284284        if (ch == 0x2219)
    285285                return 249;
    286        
     286
    287287        if (ch == 0x221a)
    288288                return 251;
    289        
     289
    290290        if (ch == 0x221e)
    291291                return 236;
    292        
     292
    293293        if (ch == 0x2229)
    294294                return 239;
    295        
     295
    296296        if (ch == 0x2248)
    297297                return 247;
    298        
     298
    299299        if (ch == 0x2261)
    300300                return 240;
    301        
     301
    302302        if (ch == 0x2264)
    303303                return 243;
    304        
     304
    305305        if (ch == 0x2265)
    306306                return 242;
    307        
     307
    308308        if (ch == 0x2310)
    309309                return 169;
    310        
     310
    311311        if ((ch >= 0x2320) && (ch <= 0x2321))
    312312                return (ch - 8748);
    313        
     313
    314314        if (ch == 0x2500)
    315315                return 196;
    316        
     316
    317317        if (ch == 0x2502)
    318318                return 179;
    319        
     319
    320320        if (ch == 0x250c)
    321321                return 218;
    322        
     322
    323323        if (ch == 0x2510)
    324324                return 191;
    325        
     325
    326326        if (ch == 0x2514)
    327327                return 192;
    328        
     328
    329329        if (ch == 0x2518)
    330330                return 217;
    331        
     331
    332332        if (ch == 0x251c)
    333333                return 195;
    334        
     334
    335335        if (ch == 0x2524)
    336336                return 180;
    337        
     337
    338338        if (ch == 0x252c)
    339339                return 194;
    340        
     340
    341341        if (ch == 0x2534)
    342342                return 193;
    343        
     343
    344344        if (ch == 0x253c)
    345345                return 197;
    346        
     346
    347347        if (ch == 0x2550)
    348348                return 205;
    349        
     349
    350350        if (ch == 0x2551)
    351351                return 186;
    352        
     352
    353353        if ((ch >= 0x2552) && (ch <= 0x2553))
    354354                return (ch - 9341);
    355        
     355
    356356        if (ch == 0x2554)
    357357                return 201;
    358        
     358
    359359        if (ch == 0x2555)
    360360                return 184;
    361        
     361
    362362        if (ch == 0x2556)
    363363                return 183;
    364        
     364
    365365        if (ch == 0x2557)
    366366                return 187;
    367        
     367
    368368        if (ch == 0x2558)
    369369                return 212;
    370        
     370
    371371        if (ch == 0x2559)
    372372                return 211;
    373        
     373
    374374        if (ch == 0x255a)
    375375                return 200;
    376        
     376
    377377        if (ch == 0x255b)
    378378                return 190;
    379        
     379
    380380        if (ch == 0x255c)
    381381                return 189;
    382        
     382
    383383        if (ch == 0x255d)
    384384                return 188;
    385        
     385
    386386        if ((ch >= 0x255e) && (ch <= 0x255f))
    387387                return (ch - 9368);
    388        
     388
    389389        if (ch == 0x2560)
    390390                return 204;
    391        
     391
    392392        if ((ch >= 0x2561) && (ch <= 0x2562))
    393393                return (ch - 9388);
    394        
     394
    395395        if (ch == 0x2563)
    396396                return 185;
    397        
     397
    398398        if ((ch >= 0x2564) && (ch <= 0x2565))
    399399                return (ch - 9363);
    400        
     400
    401401        if (ch == 0x2566)
    402402                return 203;
    403        
     403
    404404        if ((ch >= 0x2567) && (ch <= 0x2568))
    405405                return (ch - 9368);
    406        
     406
    407407        if (ch == 0x2569)
    408408                return 202;
    409        
     409
    410410        if (ch == 0x256a)
    411411                return 216;
    412        
     412
    413413        if (ch == 0x256b)
    414414                return 215;
    415        
     415
    416416        if (ch == 0x256c)
    417417                return 206;
    418        
     418
    419419        if (ch == 0x2580)
    420420                return 223;
    421        
     421
    422422        if (ch == 0x2584)
    423423                return 220;
    424        
     424
    425425        if (ch == 0x2588)
    426426                return 219;
    427        
     427
    428428        if (ch == 0x258c)
    429429                return 221;
    430        
     430
    431431        if (ch == 0x2590)
    432432                return 222;
    433        
     433
    434434        if ((ch >= 0x2591) && (ch <= 0x2593))
    435435                return (ch - 9441);
    436        
     436
    437437        return 256;
    438438}
     
    445445        if (instance->cursor < EGA_SCREEN)
    446446                return;
    447        
     447
    448448        memmove((void *) instance->backbuf,
    449449            (void *) (instance->backbuf + EGA_COLS * 2),
     
    451451        memsetw(instance->backbuf + (EGA_SCREEN - EGA_COLS) * 2,
    452452            EGA_COLS, EMPTY_CHAR);
    453        
     453
    454454        if ((!instance->parea.mapped) || (console_override)) {
    455455                memmove((void *) instance->addr,
     
    459459                    EGA_COLS, EMPTY_CHAR);
    460460        }
    461        
     461
    462462        instance->cursor = instance->cursor - EGA_COLS;
    463463}
     
    492492                pio_write_8(instance->base + EGA_INDEX_REG, 0x0f);
    493493                uint8_t lo = pio_read_8(instance->base + EGA_DATA_REG);
    494                
     494
    495495                instance->cursor = (hi << 8) | lo;
    496496        } else
    497497                instance->cursor = 0;
    498        
     498
    499499        if (instance->cursor >= EGA_SCREEN)
    500500                instance->cursor = 0;
    501        
     501
    502502        if ((instance->cursor % EGA_COLS) != 0)
    503503                instance->cursor =
    504504                    (instance->cursor + EGA_COLS) - instance->cursor % EGA_COLS;
    505        
     505
    506506        memsetw(instance->backbuf + instance->cursor * 2,
    507507            EGA_SCREEN - instance->cursor, EMPTY_CHAR);
    508        
     508
    509509        if ((!instance->parea.mapped) || (console_override))
    510510                memsetw(instance->addr + instance->cursor * 2,
    511511                    EGA_SCREEN - instance->cursor, EMPTY_CHAR);
    512        
     512
    513513        ega_check_cursor(instance);
    514514        ega_move_cursor(instance);
     
    521521        uint8_t glyph;
    522522        uint8_t style;
    523        
     523
    524524        if ((index >> 8)) {
    525525                glyph = U_SPECIAL;
     
    529529                style = STYLE;
    530530        }
    531        
     531
    532532        instance->backbuf[instance->cursor * 2] = glyph;
    533533        instance->backbuf[instance->cursor * 2 + 1] = style;
    534        
     534
    535535        if ((!instance->parea.mapped) || (console_override)) {
    536536                instance->addr[instance->cursor * 2] = glyph;
     
    542542{
    543543        ega_instance_t *instance = (ega_instance_t *) dev->data;
    544        
     544
    545545        irq_spinlock_lock(&instance->lock, true);
    546        
     546
    547547        switch (ch) {
    548548        case '\n':
     
    565565        ega_check_cursor(instance);
    566566        ega_move_cursor(instance);
    567        
     567
    568568        irq_spinlock_unlock(&instance->lock, true);
    569569}
     
    572572{
    573573        ega_instance_t *instance = (ega_instance_t *) dev->data;
    574        
     574
    575575        irq_spinlock_lock(&instance->lock, true);
    576        
     576
    577577        memcpy(instance->addr, instance->backbuf, EGA_VRAM_SIZE);
    578578        ega_move_cursor(instance);
    579579        ega_show_cursor(instance);
    580        
     580
    581581        irq_spinlock_unlock(&instance->lock, true);
    582582}
     
    587587        if (!egadev)
    588588                return NULL;
    589        
     589
    590590        ega_instance_t *instance = malloc(sizeof(ega_instance_t), FRAME_ATOMIC);
    591591        if (!instance) {
     
    593593                return NULL;
    594594        }
    595        
     595
    596596        outdev_initialize("egadev", egadev, &egadev_ops);
    597597        egadev->data = instance;
    598        
     598
    599599        irq_spinlock_initialize(&instance->lock, "*ega.instance.lock");
    600        
     600
    601601        instance->base = base;
    602602        instance->addr = (uint8_t *) km_map(addr, EGA_VRAM_SIZE,
     
    608608                return NULL;
    609609        }
    610        
     610
    611611        instance->backbuf = (uint8_t *) malloc(EGA_VRAM_SIZE, 0);
    612612        if (!instance->backbuf) {
     
    616616                return NULL;
    617617        }
    618        
     618
    619619        link_initialize(&instance->parea.link);
    620620        instance->parea.pbase = addr;
     
    623623        instance->parea.mapped = false;
    624624        ddi_parea_register(&instance->parea);
    625        
     625
    626626        /* Synchronize the back buffer and cursor position. */
    627627        memcpy(instance->backbuf, instance->addr, EGA_VRAM_SIZE);
    628628        ega_sync_cursor(instance);
    629        
     629
    630630        if (!fb_exported) {
    631631                /*
     
    640640                sysinfo_set_item_val("fb.blinking", NULL, true);
    641641                sysinfo_set_item_val("fb.address.physical", NULL, addr);
    642                
     642
    643643                fb_exported = true;
    644644        }
    645        
     645
    646646        return egadev;
    647647}
  • kernel/genarch/src/drivers/i8042/i8042.c

    r3061bc1 r8565a42  
    5959        i8042_instance_t *i8042_instance = irq->instance;
    6060        i8042_t *dev = i8042_instance->i8042;
    61        
     61
    6262        if (pio_read_8(&dev->status) & i8042_BUFFER_FULL_MASK)
    6363                return IRQ_ACCEPT;
     
    7070        i8042_instance_t *instance = irq->instance;
    7171        i8042_t *dev = instance->i8042;
    72        
     72
    7373        if (pio_read_8(&dev->status) & i8042_BUFFER_FULL_MASK) {
    7474                uint8_t data = pio_read_8(&dev->data);
     
    8383                if ((pio_read_8(&dev->status) & i8042_BUFFER_FULL_MASK) == 0)
    8484                        break;
    85                
     85
    8686                (void) pio_read_8(&dev->data);
    8787                delay(50);  /* 50 us think time */
     
    9494                if ((pio_read_8(&dev->status) & i8042_WAIT_MASK) == 0)
    9595                        break;
    96                
     96
    9797                delay(50);  /* 50 us think time */
    9898        }
    99        
     99
    100100        pio_write_8(&dev->status, cmd);
    101101        delay(10000);  /* 10 ms think time */
     
    110110                instance->i8042 = dev;
    111111                instance->kbrdin = NULL;
    112                
     112
    113113                irq_initialize(&instance->irq);
    114114                instance->irq.inr = inr;
     
    117117                instance->irq.instance = instance;
    118118        }
    119        
     119
    120120        return instance;
    121121}
     
    125125        assert(instance);
    126126        assert(kbrdin);
    127        
     127
    128128        i8042_clear_buffer(instance->i8042);
    129        
     129
    130130        instance->kbrdin = kbrdin;
    131131        irq_register(&instance->irq);
  • kernel/genarch/src/drivers/ns16550/ns16550.c

    r3061bc1 r8565a42  
    7171{
    7272        ns16550_instance_t *instance = irq->instance;
    73        
     73
    7474        while (ns16550_reg_read(instance, NS16550_REG_LSR) & LSR_DATA_READY) {
    7575                uint8_t data = ns16550_reg_read(instance, NS16550_REG_RBR);
     
    9595{
    9696        ns16550_instance_t *instance = (ns16550_instance_t *) dev->data;
    97        
     97
    9898        if ((!instance->parea.mapped) || (console_override)) {
    9999                if (ascii_check(ch))
     
    135135                instance->input = NULL;
    136136                instance->output = NULL;
    137                
     137
    138138                if (output) {
    139139                        instance->output = malloc(sizeof(outdev_t),
     
    143143                                return NULL;
    144144                        }
    145                        
     145
    146146                        outdev_initialize("ns16550", instance->output,
    147147                            &ns16550_ops);
     
    149149                        *output = instance->output;
    150150                }
    151                
     151
    152152                irq_initialize(&instance->irq);
    153153                instance->irq.inr = inr;
     
    157157                instance->irq.cir = cir;
    158158                instance->irq.cir_arg = cir_arg;
    159                
     159
    160160                instance->parea.pbase = (uintptr_t) dev;
    161161                instance->parea.frames = 1;
     
    164164                ddi_parea_register(&instance->parea);
    165165        }
    166        
     166
    167167        return instance;
    168168}
     
    172172        assert(instance);
    173173        assert(input);
    174        
     174
    175175        instance->input = input;
    176176        irq_register(&instance->irq);
    177        
     177
    178178        ns16550_clear_buffer(instance);
    179        
     179
    180180        /* Enable interrupts */
    181181        ns16550_reg_write(instance, NS16550_REG_IER, IER_ERBFI);
  • kernel/genarch/src/drivers/pl050/pl050.c

    r3061bc1 r8565a42  
    6464        uint8_t status;
    6565        pl050_instance_t *instance = irq->instance;
    66        
     66
    6767        while ((status = pio_read_8(pl050->status)) & PL050_STAT_RXFULL) {
    6868                data = pio_read_8(pl050->data);
     
    9898{
    9999        uint8_t val;
    100        
     100
    101101        instance->kbrdin = kbrdin;
    102102        irq_register(&instance->irq);
     
    108108        /* reset the data buffer */
    109109        pio_read_8(pl050->data);
    110        
     110
    111111}
    112112
  • kernel/genarch/src/drivers/s3c24xx/uart.c

    r3061bc1 r8565a42  
    6565        s3c24xx_uart_t *uart =
    6666            (s3c24xx_uart_t *) dev->data;
    67        
     67
    6868        if ((!uart->parea.mapped) || (console_override)) {
    6969                if (!ascii_check(ch)) {
     
    134134        pio_write_32(&uart->io->ucon,
    135135            pio_read_32(&uart->io->ucon) & ~UCON_RX_INT_LEVEL);
    136        
     136
    137137        link_initialize(&uart->parea.link);
    138138        uart->parea.pbase = paddr;
     
    141141        uart->parea.mapped = false;
    142142        ddi_parea_register(&uart->parea);
    143        
     143
    144144        if (!fb_exported) {
    145145                /*
  • kernel/genarch/src/drivers/via-cuda/cuda.c

    r3061bc1 r8565a42  
    113113                instance->irq.preack = true;
    114114        }
    115        
     115
    116116        return instance;
    117117}
     
    239239        cuda_t *dev = instance->cuda;
    240240        uint8_t b;
    241        
     241
    242242        b = pio_read_8(&dev->b);
    243243        pio_read_8(&dev->sr);
    244        
     244
    245245        if ((b & TREQ) == 0) {
    246246                instance->xstate = cx_receive;
     
    250250                cuda_send_start(instance);
    251251        }
    252        
     252
    253253        memcpy(buf, instance->rcv_buf, instance->bidx);
    254254        *len = instance->bidx;
  • kernel/genarch/src/fb/bfb.c

    r3061bc1 r8565a42  
    6161            (bfb_bpp == 0) || (bfb_scanline == 0))
    6262                return false;
    63        
     63
    6464        fb_properties_t bfb_props = {
    6565                .addr = bfb_addr,
     
    6969                .scan = bfb_scanline
    7070        };
    71        
     71
    7272        switch (bfb_bpp) {
    7373        case 8:
     
    9292                return false;
    9393        }
    94        
     94
    9595        outdev_t *fbdev = fb_init(&bfb_props);
    9696        if (!fbdev)
    9797                return false;
    98        
     98
    9999        stdout_wire(fbdev);
    100100        return true;
  • kernel/genarch/src/fb/fb.c

    r3061bc1 r8565a42  
    8484typedef struct {
    8585        SPINLOCK_DECLARE(lock);
    86        
     86
    8787        parea_t parea;
    88        
     88
    8989        uint8_t *addr;
    9090        uint16_t *backbuf;
    9191        uint8_t *glyphs;
    9292        uint8_t *bgscan;
    93        
     93
    9494        rgb_conv_t rgb_conv;
    95        
     95
    9696        unsigned int xres;
    9797        unsigned int yres;
    98        
     98
    9999        /** Number of rows that fit on framebuffer */
    100100        unsigned int rowtrim;
    101        
     101
    102102        unsigned int scanline;
    103103        unsigned int glyphscanline;
    104        
     104
    105105        unsigned int pixelbytes;
    106106        unsigned int glyphbytes;
    107107        unsigned int bgscanbytes;
    108        
     108
    109109        /** Number of columns in the backbuffer */
    110110        unsigned int cols;
    111111        /** Number of rows in the backbuffer */
    112112        unsigned int rows;
    113        
     113
    114114        /** Starting row in the cyclic backbuffer */
    115115        unsigned int start_row;
    116        
     116
    117117        /** Top-most visible row (relative to start_row) */
    118118        unsigned int offset_row;
    119        
     119
    120120        /** Current backbuffer position */
    121121        unsigned int position;
     
    236236        if (!overlay)
    237237                instance->backbuf[BB_POS(instance, col, row)] = glyph;
    238        
     238
    239239        /* Do not output if the framebuffer is used by user space */
    240240        if ((instance->parea.mapped) && (!console_override))
    241241                return;
    242        
     242
    243243        /* Check whether the glyph should be visible */
    244244        if (row < instance->offset_row)
    245245                return;
    246        
     246
    247247        unsigned int rel_row = row - instance->offset_row;
    248248        if (rel_row >= instance->rowtrim)
    249249                return;
    250        
     250
    251251        unsigned int x = COL2X(col);
    252252        unsigned int y = ROW2Y(rel_row);
    253        
     253
    254254        for (unsigned int yd = 0; yd < FONT_SCANLINES; yd++)
    255255                memcpy(&instance->addr[FB_POS(instance, x, y + yd)],
     
    267267                        unsigned int y = ROW2Y(rel_row);
    268268                        unsigned int row = rel_row + instance->offset_row;
    269                        
     269
    270270                        for (unsigned int yd = 0; yd < FONT_SCANLINES; yd++) {
    271271                                unsigned int x;
    272272                                unsigned int col;
    273                                
     273
    274274                                for (col = 0, x = 0; col < instance->cols;
    275275                                    col++, x += FONT_WIDTH) {
    276276                                        uint16_t glyph;
    277                                        
     277
    278278                                        if (row < instance->rows - 1) {
    279279                                                if (instance->backbuf[BB_POS(instance, col, row)] ==
    280280                                                    instance->backbuf[BB_POS(instance, col, row + 1)])
    281281                                                        continue;
    282                                                
     282
    283283                                                glyph = instance->backbuf[BB_POS(instance, col, row + 1)];
    284284                                        } else
    285285                                                glyph = 0;
    286                                        
     286
    287287                                        memcpy(&instance->addr[FB_POS(instance, x, y + yd)],
    288288                                            &instance->glyphs[GLYPH_POS(instance, glyph, yd)],
     
    292292                }
    293293        }
    294        
     294
    295295        /*
    296296         * Implement backbuffer scrolling by wrapping around
    297297         * the cyclic buffer.
    298298         */
    299        
     299
    300300        instance->start_row++;
    301301        if (instance->start_row == instance->rows)
    302302                instance->start_row = 0;
    303        
     303
    304304        memsetw(&instance->backbuf[BB_POS(instance, 0, instance->rows - 1)],
    305305            instance->cols, 0);
     
    310310        unsigned int col = instance->position % instance->cols;
    311311        unsigned int row = instance->position / instance->cols;
    312        
     312
    313313        glyph_draw(instance, fb_font_glyph(U_CURSOR), col, row, true);
    314314}
     
    318318        unsigned int col = instance->position % instance->cols;
    319319        unsigned int row = instance->position / instance->cols;
    320        
     320
    321321        glyph_draw(instance, instance->backbuf[BB_POS(instance, col, row)],
    322322            col, row, true);
     
    333333        /* Prerender glyphs */
    334334        uint16_t glyph;
    335        
     335
    336336        for (glyph = 0; glyph < FONT_GLYPHS; glyph++) {
    337337                uint32_t fg_color;
    338                
     338
    339339                if (glyph == FONT_GLYPHS - 1)
    340340                        fg_color = INV_COLOR;
    341341                else
    342342                        fg_color = FG_COLOR;
    343                
     343
    344344                unsigned int y;
    345                
     345
    346346                for (y = 0; y < FONT_SCANLINES; y++) {
    347347                        unsigned int x;
    348                        
     348
    349349                        for (x = 0; x < FONT_WIDTH; x++) {
    350350                                void *dst =
     
    357357                }
    358358        }
    359        
     359
    360360        /* Prerender background scanline */
    361361        unsigned int x;
    362        
     362
    363363        for (x = 0; x < instance->xres; x++)
    364364                instance->rgb_conv(&instance->bgscan[x * instance->pixelbytes], BG_COLOR);
     
    370370                unsigned int y = ROW2Y(rel_row);
    371371                unsigned int row = rel_row + instance->offset_row;
    372                
     372
    373373                for (unsigned int yd = 0; yd < FONT_SCANLINES; yd++) {
    374374                        unsigned int x;
    375375                        unsigned int col;
    376                        
     376
    377377                        for (col = 0, x = 0; col < instance->cols;
    378378                            col++, x += FONT_WIDTH) {
     
    385385                }
    386386        }
    387        
     387
    388388        if (COL2X(instance->cols) < instance->xres) {
    389389                unsigned int y;
    390390                unsigned int size =
    391391                    (instance->xres - COL2X(instance->cols)) * instance->pixelbytes;
    392                
     392
    393393                for (y = 0; y < instance->yres; y++)
    394394                        memcpy(&instance->addr[FB_POS(instance, COL2X(instance->cols), y)],
    395395                            instance->bgscan, size);
    396396        }
    397        
     397
    398398        if (ROW2Y(instance->rowtrim) < instance->yres) {
    399399                unsigned int y;
    400                
     400
    401401                for (y = ROW2Y(instance->rowtrim); y < instance->yres; y++)
    402402                        memcpy(&instance->addr[FB_POS(instance, 0, y)],
     
    414414        fb_instance_t *instance = (fb_instance_t *) dev->data;
    415415        spinlock_lock(&instance->lock);
    416        
     416
    417417        switch (ch) {
    418418        case '\n':
     
    446446                instance->position++;
    447447        }
    448        
     448
    449449        if (instance->position >= instance->cols * instance->rows) {
    450450                instance->position -= instance->cols;
    451451                screen_scroll(instance);
    452452        }
    453        
     453
    454454        cursor_put(instance);
    455        
     455
    456456        spinlock_unlock(&instance->lock);
    457457}
     
    464464        fb_instance_t *instance = (fb_instance_t *) dev->data;
    465465        spinlock_lock(&instance->lock);
    466        
     466
    467467        if (instance->offset_row >= instance->rowtrim / 2)
    468468                instance->offset_row -= instance->rowtrim / 2;
    469469        else
    470470                instance->offset_row = 0;
    471        
     471
    472472        fb_redraw_internal(instance);
    473473        cursor_put(instance);
    474        
     474
    475475        spinlock_unlock(&instance->lock);
    476476}
     
    483483        fb_instance_t *instance = (fb_instance_t *) dev->data;
    484484        spinlock_lock(&instance->lock);
    485        
     485
    486486        if (instance->offset_row + instance->rowtrim / 2 <=
    487487            instance->rows - instance->rowtrim)
     
    489489        else
    490490                instance->offset_row = instance->rows - instance->rowtrim;
    491        
     491
    492492        fb_redraw_internal(instance);
    493493        cursor_put(instance);
    494        
     494
    495495        spinlock_unlock(&instance->lock);
    496496}
     
    502502{
    503503        fb_instance_t *instance = (fb_instance_t *) dev->data;
    504        
     504
    505505        spinlock_lock(&instance->lock);
    506506        fb_redraw_internal(instance);
     
    517517        assert(props->y > 0);
    518518        assert(props->scan > 0);
    519        
     519
    520520        rgb_conv_t rgb_conv;
    521521        unsigned int pixelbytes;
    522        
     522
    523523        switch (props->visual) {
    524524        case VISUAL_INDIRECT_8:
     
    570570                return NULL;
    571571        }
    572        
     572
    573573        outdev_t *fbdev = malloc(sizeof(outdev_t), FRAME_ATOMIC);
    574574        if (!fbdev)
    575575                return NULL;
    576        
     576
    577577        fb_instance_t *instance = malloc(sizeof(fb_instance_t), FRAME_ATOMIC);
    578578        if (!instance) {
     
    580580                return NULL;
    581581        }
    582        
     582
    583583        outdev_initialize("fbdev", fbdev, &fbdev_ops);
    584584        fbdev->data = instance;
    585        
     585
    586586        spinlock_initialize(&instance->lock, "*fb.instance.lock");
    587        
     587
    588588        instance->rgb_conv = rgb_conv;
    589589        instance->pixelbytes = pixelbytes;
     
    591591        instance->yres = props->y;
    592592        instance->scanline = props->scan;
    593        
     593
    594594        instance->rowtrim = Y2ROW(instance->yres);
    595        
     595
    596596        instance->cols = X2COL(instance->xres);
    597597        instance->rows = FB_PAGES * instance->rowtrim;
    598        
     598
    599599        instance->start_row = instance->rows - instance->rowtrim;
    600600        instance->offset_row = instance->start_row;
    601601        instance->position = instance->start_row * instance->cols;
    602        
     602
    603603        instance->glyphscanline = FONT_WIDTH * instance->pixelbytes;
    604604        instance->glyphbytes = ROW2Y(instance->glyphscanline);
    605605        instance->bgscanbytes = instance->xres * instance->pixelbytes;
    606        
     606
    607607        size_t fbsize = instance->scanline * instance->yres;
    608608        size_t bbsize = instance->cols * instance->rows * sizeof(uint16_t);
    609609        size_t glyphsize = FONT_GLYPHS * instance->glyphbytes;
    610        
     610
    611611        instance->addr = (uint8_t *) km_map((uintptr_t) props->addr, fbsize,
    612612            PAGE_WRITE | PAGE_NOT_CACHEABLE);
     
    617617                return NULL;
    618618        }
    619        
     619
    620620        instance->backbuf = (uint16_t *) malloc(bbsize, 0);
    621621        if (!instance->backbuf) {
     
    625625                return NULL;
    626626        }
    627        
     627
    628628        instance->glyphs = (uint8_t *) malloc(glyphsize, 0);
    629629        if (!instance->glyphs) {
     
    634634                return NULL;
    635635        }
    636        
     636
    637637        instance->bgscan = malloc(instance->bgscanbytes, 0);
    638638        if (!instance->bgscan) {
     
    644644                return NULL;
    645645        }
    646        
     646
    647647        memsetw(instance->backbuf, instance->cols * instance->rows, 0);
    648648        glyphs_render(instance);
    649        
     649
    650650        link_initialize(&instance->parea.link);
    651651        instance->parea.pbase = props->addr;
     
    654654        instance->parea.mapped = false;
    655655        ddi_parea_register(&instance->parea);
    656        
     656
    657657        if (!fb_exported) {
    658658                /*
     
    668668                sysinfo_set_item_val("fb.visual", NULL, props->visual);
    669669                sysinfo_set_item_val("fb.address.physical", NULL, props->addr);
    670                
     670
    671671                fb_exported = true;
    672672        }
    673        
     673
    674674        fb_redraw(fbdev);
    675675        return fbdev;
  • kernel/genarch/src/fb/font-8x16.c

    r3061bc1 r8565a42  
    4747        if (ch == 0x0000)
    4848                return 0;
    49        
     49
    5050        if ((ch >= 0x0020) && (ch <= 0x007f))
    5151                return (ch - 32);
    52        
     52
    5353        if ((ch >= 0x00a0) && (ch <= 0x021f))
    5454                return (ch - 64);
    55        
     55
    5656        if ((ch >= 0x0222) && (ch <= 0x0233))
    5757                return (ch - 66);
    58        
     58
    5959        if ((ch >= 0x0250) && (ch <= 0x02ad))
    6060                return (ch - 94);
    61        
     61
    6262        if ((ch >= 0x02b0) && (ch <= 0x02cf))
    6363                return (ch - 96);
    64        
     64
    6565        if ((ch >= 0x02d8) && (ch <= 0x02dd))
    6666                return (ch - 104);
    67        
     67
    6868        if (ch == 0x02ee)
    6969                return 630;
    70        
     70
    7171        if ((ch >= 0x0300) && (ch <= 0x0301))
    7272                return (ch - 137);
    73        
     73
    7474        if (ch == 0x0303)
    7575                return 633;
    76        
     76
    7777        if (ch == 0x0309)
    7878                return 634;
    79        
     79
    8080        if ((ch >= 0x0312) && (ch <= 0x0314))
    8181                return (ch - 151);
    82        
     82
    8383        if (ch == 0x0323)
    8484                return 638;
    85        
     85
    8686        if ((ch >= 0x0340) && (ch <= 0x0341))
    8787                return (ch - 193);
    88        
     88
    8989        if ((ch >= 0x0374) && (ch <= 0x0375))
    9090                return (ch - 243);
    91        
     91
    9292        if (ch == 0x037a)
    9393                return 643;
    94        
     94
    9595        if (ch == 0x037e)
    9696                return 644;
    97        
     97
    9898        if ((ch >= 0x0384) && (ch <= 0x038a))
    9999                return (ch - 255);
    100        
     100
    101101        if (ch == 0x038c)
    102102                return 652;
    103        
     103
    104104        if ((ch >= 0x038e) && (ch <= 0x03a1))
    105105                return (ch - 257);
    106        
     106
    107107        if ((ch >= 0x03a3) && (ch <= 0x03ce))
    108108                return (ch - 258);
    109        
     109
    110110        if ((ch >= 0x03d0) && (ch <= 0x03d7))
    111111                return (ch - 259);
    112        
     112
    113113        if ((ch >= 0x03da) && (ch <= 0x03f3))
    114114                return (ch - 261);
    115        
     115
    116116        if ((ch >= 0x0400) && (ch <= 0x0486))
    117117                return (ch - 273);
    118        
     118
    119119        if ((ch >= 0x0488) && (ch <= 0x04ce))
    120120                return (ch - 274);
    121        
     121
    122122        if ((ch >= 0x04d0) && (ch <= 0x04f5))
    123123                return (ch - 275);
    124        
     124
    125125        if ((ch >= 0x04f8) && (ch <= 0x04f9))
    126126                return (ch - 277);
    127        
     127
    128128        if ((ch >= 0x0500) && (ch <= 0x050f))
    129129                return (ch - 283);
    130        
     130
    131131        if ((ch >= 0x0530) && (ch <= 0x0556))
    132132                return (ch - 315);
    133        
     133
    134134        if ((ch >= 0x0559) && (ch <= 0x055f))
    135135                return (ch - 317);
    136        
     136
    137137        if ((ch >= 0x0561) && (ch <= 0x0587))
    138138                return (ch - 318);
    139        
     139
    140140        if ((ch >= 0x0589) && (ch <= 0x058a))
    141141                return (ch - 319);
    142        
     142
    143143        if ((ch >= 0x0591) && (ch <= 0x05a1))
    144144                return (ch - 325);
    145        
     145
    146146        if ((ch >= 0x05a3) && (ch <= 0x05b9))
    147147                return (ch - 326);
    148        
     148
    149149        if ((ch >= 0x05bb) && (ch <= 0x05c4))
    150150                return (ch - 327);
    151        
     151
    152152        if ((ch >= 0x05d0) && (ch <= 0x05ea))
    153153                return (ch - 338);
    154        
     154
    155155        if ((ch >= 0x05f0) && (ch <= 0x05f4))
    156156                return (ch - 343);
    157        
     157
    158158        if (ch == 0x060c)
    159159                return 1182;
    160        
     160
    161161        if (ch == 0x061b)
    162162                return 1183;
    163        
     163
    164164        if (ch == 0x061f)
    165165                return 1184;
    166        
     166
    167167        if ((ch >= 0x0621) && (ch <= 0x063a))
    168168                return (ch - 384);
    169        
     169
    170170        if ((ch >= 0x0640) && (ch <= 0x0655))
    171171                return (ch - 389);
    172        
     172
    173173        if ((ch >= 0x0660) && (ch <= 0x066d))
    174174                return (ch - 399);
    175        
     175
    176176        if ((ch >= 0x0670) && (ch <= 0x06ed))
    177177                return (ch - 401);
    178        
     178
    179179        if ((ch >= 0x06f0) && (ch <= 0x06fe))
    180180                return (ch - 403);
    181        
     181
    182182        if (ch == 0x10d3)
    183183                return 1388;
    184        
     184
    185185        if (ch == 0x10d7)
    186186                return 1389;
    187        
     187
    188188        if (ch == 0x10da)
    189189                return 1390;
    190        
     190
    191191        if (ch == 0x10dd)
    192192                return 1391;
    193        
     193
    194194        if (ch == 0x10e6)
    195195                return 1392;
    196        
     196
    197197        if ((ch >= 0x1e00) && (ch <= 0x1e9b))
    198198                return (ch - 6287);
    199        
     199
    200200        if ((ch >= 0x1ea0) && (ch <= 0x1ef9))
    201201                return (ch - 6291);
    202        
     202
    203203        if ((ch >= 0x1f00) && (ch <= 0x1f07))
    204204                return (ch - 6297);
    205        
     205
    206206        if ((ch >= 0x2000) && (ch <= 0x2027))
    207207                return (ch - 6545);
    208        
     208
    209209        if ((ch >= 0x2030) && (ch <= 0x2046))
    210210                return (ch - 6553);
    211        
     211
    212212        if ((ch >= 0x2048) && (ch <= 0x204d))
    213213                return (ch - 6554);
    214        
     214
    215215        if (ch == 0x2070)
    216216                return 1716;
    217        
     217
    218218        if ((ch >= 0x2074) && (ch <= 0x208f))
    219219                return (ch - 6591);
    220        
     220
    221221        if ((ch >= 0x20a0) && (ch <= 0x20af))
    222222                return (ch - 6607);
    223        
     223
    224224        if ((ch >= 0x2100) && (ch <= 0x213a))
    225225                return (ch - 6687);
    226        
     226
    227227        if ((ch >= 0x2153) && (ch <= 0x2183))
    228228                return (ch - 6711);
    229        
     229
    230230        if ((ch >= 0x2190) && (ch <= 0x21f3))
    231231                return (ch - 6723);
    232        
     232
    233233        if ((ch >= 0x2200) && (ch <= 0x22f1))
    234234                return (ch - 6735);
    235        
     235
    236236        if (ch == 0x2300)
    237237                return 2211;
    238        
     238
    239239        if (ch == 0x2302)
    240240                return 2212;
    241        
     241
    242242        if ((ch >= 0x2308) && (ch <= 0x230b))
    243243                return (ch - 6755);
    244        
     244
    245245        if (ch == 0x2310)
    246246                return 2217;
    247        
     247
    248248        if (ch == 0x2318)
    249249                return 2218;
    250        
     250
    251251        if ((ch >= 0x231a) && (ch <= 0x231b))
    252252                return (ch - 6767);
    253        
     253
    254254        if ((ch >= 0x2320) && (ch <= 0x2321))
    255255                return (ch - 6771);
    256        
     256
    257257        if ((ch >= 0x2329) && (ch <= 0x232a))
    258258                return (ch - 6778);
    259        
     259
    260260        if ((ch >= 0x239b) && (ch <= 0x23bd))
    261261                return (ch - 6890);
    262        
     262
    263263        if (ch == 0x23ce)
    264264                return 2260;
    265        
     265
    266266        if ((ch >= 0x2409) && (ch <= 0x240d))
    267267                return (ch - 6964);
    268        
     268
    269269        if ((ch >= 0x2423) && (ch <= 0x2424))
    270270                return (ch - 6985);
    271        
     271
    272272        if (ch == 0x2426)
    273273                return 2268;
    274        
     274
    275275        if ((ch >= 0x2500) && (ch <= 0x2595))
    276276                return (ch - 7203);
    277        
     277
    278278        if ((ch >= 0x25a0) && (ch <= 0x25f7))
    279279                return (ch - 7213);
    280        
     280
    281281        if ((ch >= 0x2600) && (ch <= 0x2602))
    282282                return (ch - 7221);
    283        
     283
    284284        if ((ch >= 0x2605) && (ch <= 0x260d))
    285285                return (ch - 7223);
    286        
     286
    287287        if ((ch >= 0x2610) && (ch <= 0x2613))
    288288                return (ch - 7225);
    289        
     289
    290290        if (ch == 0x2620)
    291291                return 2523;
    292        
     292
    293293        if (ch == 0x2622)
    294294                return 2524;
    295        
     295
    296296        if (ch == 0x2626)
    297297                return 2525;
    298        
     298
    299299        if ((ch >= 0x2628) && (ch <= 0x262b))
    300300                return (ch - 7242);
    301        
     301
    302302        if ((ch >= 0x262e) && (ch <= 0x2637))
    303303                return (ch - 7244);
    304        
     304
    305305        if ((ch >= 0x2639) && (ch <= 0x2653))
    306306                return (ch - 7245);
    307        
     307
    308308        if ((ch >= 0x2660) && (ch <= 0x2667))
    309309                return (ch - 7257);
    310        
     310
    311311        if ((ch >= 0x2669) && (ch <= 0x266f))
    312312                return (ch - 7258);
    313        
     313
    314314        if ((ch >= 0xfb00) && (ch <= 0xfb05))
    315315                return (ch - 61674);
    316        
     316
    317317        if ((ch >= 0xfb50) && (ch <= 0xfbb1))
    318318                return (ch - 61748);
    319        
     319
    320320        if ((ch >= 0xfbd3) && (ch <= 0xfbe9))
    321321                return (ch - 61781);
    322        
     322
    323323        if ((ch >= 0xfbfc) && (ch <= 0xfbff))
    324324                return (ch - 61799);
    325        
     325
    326326        if ((ch >= 0xfc5b) && (ch <= 0xfc63))
    327327                return (ch - 61890);
    328        
     328
    329329        if (ch == 0xfc90)
    330330                return 2722;
    331        
     331
    332332        if ((ch >= 0xfcf2) && (ch <= 0xfcf4))
    333333                return (ch - 62031);
    334        
     334
    335335        if ((ch >= 0xfd3c) && (ch <= 0xfd3f))
    336336                return (ch - 62102);
    337        
     337
    338338        if (ch == 0xfdf2)
    339339                return 2730;
    340        
     340
    341341        if ((ch >= 0xfe50) && (ch <= 0xfe52))
    342342                return (ch - 62373);
    343        
     343
    344344        if ((ch >= 0xfe54) && (ch <= 0xfe66))
    345345                return (ch - 62374);
    346        
     346
    347347        if ((ch >= 0xfe68) && (ch <= 0xfe6b))
    348348                return (ch - 62375);
    349        
     349
    350350        if ((ch >= 0xfe70) && (ch <= 0xfe72))
    351351                return (ch - 62379);
    352        
     352
    353353        if (ch == 0xfe74)
    354354                return 2760;
    355        
     355
    356356        if ((ch >= 0xfe76) && (ch <= 0xfefc))
    357357                return (ch - 62381);
    358        
     358
    359359        if (ch == 0xfeff)
    360360                return 2896;
    361        
     361
    362362        return 2898;
    363363}
     
    32623262        {0xf1, 0x35, 0x55, 0x8a, 0xe0, 0x06, 0x95, 0xd6, 0xb5, 0x97, 0x00, 0xee, 0x8a, 0xee, 0x28, 0xe8},
    32633263        {0x00, 0x38, 0x7c, 0x7c, 0xc6, 0x92, 0xf2, 0xe6, 0xfe, 0xe6, 0x7c, 0x7c, 0x38, 0x00, 0x00, 0x00},
    3264        
     3264
    32653265        /* Special glyph for unknown character */
    32663266        {0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00}
  • kernel/genarch/src/kbrd/kbrd.c

    r3061bc1 r8565a42  
    7878{
    7979        spinlock_lock(&instance->keylock);
    80        
     80
    8181        switch (sc) {
    8282        case SC_LSHIFT:
     
    9494                break;
    9595        }
    96        
     96
    9797        spinlock_unlock(&instance->keylock);
    9898}
     
    108108        bool capslock;
    109109        wchar_t ch;
    110        
     110
    111111        spinlock_lock(&instance->keylock);
    112        
     112
    113113        switch (sc) {
    114114        case SC_LSHIFT:
     
    126126                capslock = (instance->keyflags & PRESSED_CAPSLOCK) ||
    127127                    (instance->lockflags & LOCKED_CAPSLOCK);
    128                
     128
    129129                if ((letter) && (capslock))
    130130                        shift = !shift;
    131                
     131
    132132                if (shift)
    133133                        ch = sc_secondary_map[sc];
    134134                else
    135135                        ch = sc_primary_map[sc];
    136                
     136
    137137                switch (ch) {
    138138                case U_PAGE_UP:
     
    145145                        indev_push_character(instance->sink, ch);
    146146                }
    147                
    148                 break;
    149         }
    150        
     147
     148                break;
     149        }
     150
    151151        spinlock_unlock(&instance->keylock);
    152152}
     
    155155{
    156156        kbrd_instance_t *instance = (kbrd_instance_t *) arg;
    157        
     157
    158158        while (true) {
    159159                wchar_t sc = indev_pop_character(&instance->raw);
    160                
     160
    161161                if (sc == IGNORE_CODE)
    162162                        continue;
    163                
     163
    164164                if (sc & KEY_RELEASE)
    165165                        key_released(instance, (sc ^ KEY_RELEASE) & 0x7f);
     
    176176                instance->thread = thread_create(kkbrd, (void *) instance,
    177177                    TASK, THREAD_FLAG_NONE, "kkbrd");
    178                
     178
    179179                if (!instance->thread) {
    180180                        free(instance);
    181181                        return NULL;
    182182                }
    183                
     183
    184184                instance->sink = NULL;
    185185                indev_initialize("kbrd", &instance->raw, &kbrd_raw_ops);
    186                
     186
    187187                spinlock_initialize(&instance->keylock, "kbrd.instance.keylock");
    188188                instance->keyflags = 0;
    189189                instance->lockflags = 0;
    190190        }
    191        
     191
    192192        return instance;
    193193}
     
    197197        assert(instance);
    198198        assert(sink);
    199        
     199
    200200        instance->sink = sink;
    201201        thread_ready(instance->thread);
    202        
     202
    203203        return &instance->raw;
    204204}
  • kernel/genarch/src/kbrd/kbrd_at.c

    r3061bc1 r8565a42  
    7171{
    7272        spinlock_lock(&instance->keylock);
    73        
     73
    7474        switch (sc) {
    7575        case SC_LSHIFT:
     
    8787                break;
    8888        }
    89        
     89
    9090        spinlock_unlock(&instance->keylock);
    9191}
     
    100100        bool shift;
    101101        bool capslock;
    102        
     102
    103103        spinlock_lock(&instance->keylock);
    104        
     104
    105105        switch (sc) {
    106106        case SC_LSHIFT:
     
    118118                capslock = (instance->keyflags & PRESSED_CAPSLOCK) ||
    119119                    (instance->lockflags & LOCKED_CAPSLOCK);
    120                
     120
    121121                if ((letter) && (capslock))
    122122                        shift = !shift;
    123                
     123
    124124                if (shift)
    125125                        indev_push_character(instance->sink, sc_secondary_map[sc]);
     
    128128                break;
    129129        }
    130        
     130
    131131        spinlock_unlock(&instance->keylock);
    132132}
     
    137137        static int is_locked = 0;
    138138        kbrd_instance_t *instance = (kbrd_instance_t *) arg;
    139        
     139
    140140        while (true) {
    141141                wchar_t sc = indev_pop_character(&instance->raw);
     
    162162                        }
    163163                }
    164                
     164
    165165        }
    166166}
     
    174174                instance->thread = thread_create(kkbrd, (void *) instance, TASK, 0,
    175175                    "kkbrd");
    176                
     176
    177177                if (!instance->thread) {
    178178                        free(instance);
    179179                        return NULL;
    180180                }
    181                
     181
    182182                instance->sink = NULL;
    183183                indev_initialize("kbrd", &instance->raw, &kbrd_raw_ops);
    184                
     184
    185185                spinlock_initialize(&instance->keylock, "kbrd_at.instance.keylock");
    186186                instance->keyflags = 0;
    187187                instance->lockflags = 0;
    188188        }
    189        
     189
    190190        return instance;
    191191}
     
    195195        assert(instance);
    196196        assert(sink);
    197        
     197
    198198        instance->sink = sink;
    199199        thread_ready(instance->thread);
    200        
     200
    201201        return &instance->raw;
    202202}
  • kernel/genarch/src/kbrd/scanc_pc.c

    r3061bc1 r8565a42  
    158158        U_SPECIAL,      /* 0x45 - NumLock */
    159159        U_SPECIAL,      /* 0x46 - ScrollLock */
    160        
     160
    161161        U_HOME_ARROW,   /* 0x47 - Home */
    162162        U_UP_ARROW,     /* 0x48 - Up Arrow */
  • kernel/genarch/src/mm/as_ht.c

    r3061bc1 r8565a42  
    7979                    NULL, NULL, SLAB_CACHE_MAGDEFERRED);
    8080        }
    81        
     81
    8282        return NULL;
    8383}
  • kernel/genarch/src/mm/as_pt.c

    r3061bc1 r8565a42  
    7575        pte_t *dst_ptl0 = (pte_t *)
    7676            PA2KA(frame_alloc(PTL0_FRAMES, FRAME_LOWMEM, PTL0_SIZE - 1));
    77        
     77
    7878        if (flags & FLAG_AS_KERNEL)
    7979                memsetb(dst_ptl0, PTL0_SIZE, 0);
     
    8282                 * Copy the kernel address space portion to new PTL0.
    8383                 */
    84                
     84
    8585                mutex_lock(&AS_KERNEL->lock);
    86                
     86
    8787                pte_t *src_ptl0 =
    8888                    (pte_t *) PA2KA((uintptr_t) AS_KERNEL->genarch.page_table);
    89                
     89
    9090                uintptr_t src = (uintptr_t)
    9191                    &src_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)];
    9292                uintptr_t dst = (uintptr_t)
    9393                    &dst_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)];
    94                
     94
    9595                memsetb(dst_ptl0, PTL0_SIZE, 0);
    9696                memcpy((void *) dst, (void *) src,
    9797                    PTL0_SIZE - (src - (uintptr_t) src_ptl0));
    98                
     98
    9999                mutex_unlock(&AS_KERNEL->lock);
    100100        }
    101        
     101
    102102        return (pte_t *) KA2PA((uintptr_t) dst_ptl0);
    103103}
  • kernel/genarch/src/mm/asid.c

    r3061bc1 r8565a42  
    8484         * Check if there is an unallocated ASID.
    8585         */
    86        
     86
    8787        if (asids_allocated == ASIDS_ALLOCABLE) {
    8888
     
    9191                 * Resort to stealing.
    9292                 */
    93                
     93
    9494                /*
    9595                 * Remove the first item on the list.
     
    100100                assert(tmp != NULL);
    101101                list_remove(tmp);
    102                
     102
    103103                as = list_get_instance(tmp, as_t, inactive_as_with_asid_link);
    104104
     
    115115                 */
    116116                as->asid = ASID_INVALID;
    117                
     117
    118118                /*
    119119                 * If the architecture uses some software cache
     
    122122                 */
    123123                as_invalidate_translation_cache(as, 0, (size_t) -1);
    124                
     124
    125125                /*
    126126                 * Get the system rid of the stolen ASID.
     
    146146                tlb_shootdown_finalize(ipl);
    147147        }
    148        
     148
    149149        return asid;
    150150}
  • kernel/genarch/src/mm/asid_fifo.c

    r3061bc1 r8565a42  
    3030 * @{
    3131 */
    32  
     32
    3333/**
    3434 * @file
     
    6666        fifo_create(free_asids);
    6767#endif
    68                
     68
    6969        for (i = 0; i < ASIDS_ALLOCABLE; i++) {
    7070                fifo_push(free_asids, ASID_START + i);
  • kernel/genarch/src/mm/page_ht.c

    r3061bc1 r8565a42  
    135135{
    136136        assert(item);
    137        
     137
    138138        pte_t *pte = hash_table_get_inst(item, pte_t, link);
    139139        slab_free(pte_cache, pte);
     
    162162
    163163        irq_spinlock_lock(&page_ht_lock, true);
    164        
     164
    165165        if (!hash_table_find(&page_ht, key)) {
    166166                pte_t *pte = slab_alloc(pte_cache, FRAME_LOWMEM | FRAME_ATOMIC);
    167167                assert(pte != NULL);
    168                
     168
    169169                pte->g = (flags & PAGE_GLOBAL) != 0;
    170170                pte->x = (flags & PAGE_EXEC) != 0;
     
    175175                pte->a = false;
    176176                pte->d = false;
    177                
     177
    178178                pte->as = as;
    179179                pte->page = ALIGN_DOWN(page, PAGE_SIZE);
     
    185185                 */
    186186                write_barrier();
    187                
     187
    188188                hash_table_insert(&page_ht, &pte->link);
    189189        }
     
    210210
    211211        assert(page_table_locked(as));
    212        
     212
    213213        irq_spinlock_lock(&page_ht_lock, true);
    214214
     
    235235        if (cur)
    236236                return hash_table_get_inst(cur, pte_t, link);
    237        
     237
    238238        return NULL;
    239239}
     
    257257
    258258        irq_spinlock_unlock(&page_ht_lock, true);
    259        
     259
    260260        return t != NULL;
    261261}
     
    275275        if (!t)
    276276                panic("Updating non-existent PTE");
    277        
     277
    278278        assert(pte->as == t->as);
    279279        assert(pte->page == t->page);
  • kernel/genarch/src/mm/page_pt.c

    r3061bc1 r8565a42  
    8383
    8484        assert(page_table_locked(as));
    85        
     85
    8686        if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) {
    8787                pte_t *newpt = (pte_t *)
     
    100100                SET_PTL1_PRESENT(ptl0, PTL0_INDEX(page));
    101101        }
    102        
     102
    103103        pte_t *ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
    104        
     104
    105105        if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) {
    106106                pte_t *newpt = (pte_t *)
     
    117117                SET_PTL2_PRESENT(ptl1, PTL1_INDEX(page));
    118118        }
    119        
     119
    120120        pte_t *ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
    121        
     121
    122122        if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) {
    123123                pte_t *newpt = (pte_t *)
     
    134134                SET_PTL3_PRESENT(ptl2, PTL2_INDEX(page));
    135135        }
    136        
     136
    137137        pte_t *ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
    138        
     138
    139139        SET_FRAME_ADDRESS(ptl3, PTL3_INDEX(page), frame);
    140140        SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), flags | PAGE_NOT_PRESENT);
     
    165165         * First, remove the mapping, if it exists.
    166166         */
    167        
     167
    168168        pte_t *ptl0 = (pte_t *) PA2KA((uintptr_t) as->genarch.page_table);
    169169        if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT)
    170170                return;
    171        
     171
    172172        pte_t *ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
    173173        if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT)
    174174                return;
    175        
     175
    176176        pte_t *ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
    177177        if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT)
    178178                return;
    179        
     179
    180180        pte_t *ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
    181        
     181
    182182        /*
    183183         * Destroy the mapping.
     
    189189        SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), PAGE_NOT_PRESENT);
    190190        memsetb(&ptl3[PTL3_INDEX(page)], sizeof(pte_t), 0);
    191        
     191
    192192        /*
    193193         * Second, free all empty tables along the way from PTL3 down to PTL0
    194194         * except those needed for sharing the kernel non-identity mappings.
    195195         */
    196        
     196
    197197        /* Check PTL3 */
    198198        bool empty = true;
    199        
     199
    200200        unsigned int i;
    201201        for (i = 0; i < PTL3_ENTRIES; i++) {
     
    205205                }
    206206        }
    207        
     207
    208208        if (empty) {
    209209                /*
     
    232232                return;
    233233        }
    234        
     234
    235235        /* Check PTL2, empty is still true */
    236236#if (PTL2_ENTRIES != 0)
     
    241241                }
    242242        }
    243        
     243
    244244        if (empty) {
    245245                /*
     
    267267        }
    268268#endif /* PTL2_ENTRIES != 0 */
    269        
     269
    270270        /* check PTL1, empty is still true */
    271271#if (PTL1_ENTRIES != 0)
     
    276276                }
    277277        }
    278        
     278
    279279        if (empty) {
    280280                /*
     
    301301
    302302        read_barrier();
    303        
     303
    304304        pte_t *ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
    305305        if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT)
     
    312312        read_barrier();
    313313#endif
    314        
     314
    315315        pte_t *ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
    316316        if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT)
     
    323323        read_barrier();
    324324#endif
    325        
     325
    326326        pte_t *ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
    327        
     327
    328328        return &ptl3[PTL3_INDEX(page)];
    329329}
     
    400400{
    401401        assert(size > 0);
    402        
     402
    403403        uintptr_t ptl0 = PA2KA((uintptr_t) AS_KERNEL->genarch.page_table);
    404404        uintptr_t ptl0_step = ptl0_step_get();
    405405        size_t frames;
    406        
     406
    407407#if (PTL1_ENTRIES != 0)
    408408        frames = PTL1_FRAMES;
     
    412412        frames = PTL3_FRAMES;
    413413#endif
    414        
     414
    415415        for (uintptr_t addr = ALIGN_DOWN(base, ptl0_step);
    416416            addr - 1 < base + size - 1;
  • kernel/genarch/src/multiboot/multiboot.c

    r3061bc1 r8565a42  
    5252        if (end == NULL)
    5353                end = cmd_line + str_size(cmd_line);
    54        
     54
    5555        /*
    5656         * Find last occurence of '/' before 'end'. If found, place start at
     
    5959        const char *cp = end;
    6060        const char *start = buf;
    61        
     61
    6262        while (cp != start) {
    6363                if (*cp == '/') {
     
    6767                cp--;
    6868        }
    69        
     69
    7070        /* Copy the command. */
    7171        str_ncpy(buf, size, start, (size_t) (end - start));
     
    106106                if (init.cnt >= CONFIG_INIT_TASKS)
    107107                        break;
    108                
     108
    109109                init.tasks[init.cnt].paddr = mods[i].start;
    110110                init.tasks[init.cnt].size = mods[i].end - mods[i].start;
    111                
     111
    112112                /* Copy command line, if available. */
    113113                if (mods[i].string) {
     
    120120                        init.tasks[init.cnt].arguments[0] = 0;
    121121                }
    122                
     122
    123123                init.cnt++;
    124124        }
     
    128128{
    129129        uint32_t pos = 0;
    130        
     130
    131131        while ((pos < length) && (e820counter < MEMMAP_E820_MAX_RECORDS)) {
    132132                e820table[e820counter] = memmap->mm_info;
    133                
     133
    134134                /* Compute address of next structure. */
    135135                uint32_t size = sizeof(memmap->size) + memmap->size;
    136136                memmap = (multiboot_memmap_t *) ((uintptr_t) memmap + size);
    137137                pos += size;
    138                
     138
    139139                e820counter++;
    140140        }
     
    163163                multiboot_modules(info->mods_count,
    164164                    (multiboot_module_t *) MULTIBOOT_PTR(info->mods_addr));
    165        
     165
    166166        /* Copy memory map. */
    167167        if ((info->flags & MULTIBOOT_INFO_FLAGS_MMAP) != 0)
  • kernel/genarch/src/multiboot/multiboot2.c

    r3061bc1 r8565a42  
    5656                multiboot_extract_argument(init.tasks[init.cnt].arguments,
    5757                    CONFIG_TASK_ARGUMENTS_BUFLEN, module->string);
    58                
     58
    5959                init.cnt++;
    6060        }
     
    6666            ((uintptr_t) memmap + sizeof(*memmap));
    6767        uint32_t pos = sizeof(*memmap);
    68        
     68
    6969        while ((pos < length) && (e820counter < MEMMAP_E820_MAX_RECORDS)) {
    7070                e820table[e820counter].base_address = entry->base_address;
    7171                e820table[e820counter].size = entry->size;
    7272                e820table[e820counter].type = entry->type;
    73                
     73
    7474                /* Compute address of next entry. */
    7575                entry = (multiboot2_memmap_entry_t *)
    7676                    ((uintptr_t) entry + memmap->entry_size);
    7777                pos += memmap->entry_size;
    78                
     78
    7979                e820counter++;
    8080        }
     
    9090                bfb_bpp = fbinfo->bpp;
    9191                bfb_scanline = fbinfo->scanline;
    92                
     92
    9393                bfb_red_pos = fbinfo->rgb.red_pos;
    9494                bfb_red_size = fbinfo->rgb.red_size;
    95                
     95
    9696                bfb_green_pos = fbinfo->rgb.green_pos;
    9797                bfb_green_size = fbinfo->rgb.green_size;
    98                
     98
    9999                bfb_blue_pos = fbinfo->rgb.blue_pos;
    100100                bfb_blue_size = fbinfo->rgb.blue_size;
     
    116116        if (signature != MULTIBOOT2_LOADER_MAGIC)
    117117                return;
    118        
     118
    119119        const multiboot2_tag_t *tag = (const multiboot2_tag_t *)
    120120            ALIGN_UP((uintptr_t) info + sizeof(*info), MULTIBOOT2_TAG_ALIGN);
    121        
     121
    122122        while (tag->type != MULTIBOOT2_TAG_TERMINATOR) {
    123123                switch (tag->type) {
     
    135135                        break;
    136136                }
    137                
     137
    138138                tag = (const multiboot2_tag_t *)
    139139                    ALIGN_UP((uintptr_t) tag + tag->size, MULTIBOOT2_TAG_ALIGN);
  • kernel/genarch/src/ofw/ebus.c

    r3061bc1 r8565a42  
    5555        if (!prop)
    5656                return false;
    57                
     57
    5858        ranges = prop->size / sizeof(ofw_ebus_range_t);
    5959        range = prop->value;
    60        
     60
    6161        unsigned int i;
    62        
     62
    6363        for (i = 0; i < ranges; i++) {
    6464                if (reg->space != range[i].child_space)
     
    6767                    range[i].size)) {
    6868                        ofw_pci_reg_t pci_reg;
    69                        
     69
    7070                        pci_reg.space = range[i].parent_space;
    7171                        pci_reg.addr = range[i].parent_base +
    7272                            (reg->addr - range[i].child_base);
    7373                        pci_reg.size = reg->size;
    74                        
     74
    7575                        return ofw_pci_apply_ranges(node->parent, &pci_reg, pa);
    7676                }
     
    8686        ofw_tree_property_t *prop;
    8787        ofw_tree_node_t *controller;
    88        
     88
    8989        prop = ofw_tree_getprop(node, "interrupt-map");
    9090        if (!prop || !prop->value)
     
    9393        ofw_ebus_intr_map_t *intr_map = prop->value;
    9494        size_t count = prop->size / sizeof(ofw_ebus_intr_map_t);
    95        
     95
    9696        assert(count);
    97        
     97
    9898        prop = ofw_tree_getprop(node, "interrupt-map-mask");
    9999        if (!prop || !prop->value)
    100100                return false;
    101        
     101
    102102        ofw_ebus_intr_mask_t *intr_mask = prop->value;
    103        
     103
    104104        assert(prop->size == sizeof(ofw_ebus_intr_mask_t));
    105        
     105
    106106        uint32_t space = reg->space & intr_mask->space_mask;
    107107        uint32_t addr = reg->addr & intr_mask->addr_mask;
    108108        uint32_t intr = interrupt & intr_mask->intr_mask;
    109        
     109
    110110        unsigned int i;
    111111        for (i = 0; i < count; i++) {
     
    127127        if (!controller)
    128128                return false;
    129                
     129
    130130        if (str_cmp(ofw_tree_node_name(controller), "pci") != 0) {
    131131                /*
  • kernel/genarch/src/ofw/ofw_tree.c

    r3061bc1 r8565a42  
    7070                        return &node->property[i];
    7171        }
    72        
     72
    7373        return NULL;
    7474}
     
    8787        if ((!prop) || (prop->size < 2))
    8888                return NULL;
    89        
     89
    9090        return prop->value;
    9191}
     
    110110                        return cur;
    111111        }
    112        
     112
    113113        /*
    114114         * Disambigued name not found.
     
    122122                        return cur;
    123123        }
    124        
     124
    125125        return NULL;
    126126}
     
    141141                ofw_tree_property_t *prop =
    142142                    ofw_tree_getprop(cur, "device_type");
    143                
     143
    144144                if ((!prop) || (!prop->value))
    145145                        continue;
    146                
     146
    147147                if (str_cmp(prop->value, dtype) == 0)
    148148                        return cur;
    149149        }
    150        
     150
    151151        return NULL;
    152152}
     
    170170                if (cur->node_handle == handle)
    171171                        return cur;
    172                
     172
    173173                if (cur->child) {
    174174                        ofw_tree_node_t *node =
     
    178178                }
    179179        }
    180        
     180
    181181        return NULL;
    182182}
     
    197197                ofw_tree_property_t *prop =
    198198                    ofw_tree_getprop(cur, "device_type");
    199                
     199
    200200                if ((!prop) || (!prop->value))
    201201                        continue;
    202                
     202
    203203                if (str_cmp(prop->value, dtype) == 0)
    204204                        return cur;
    205205        }
    206        
     206
    207207        return NULL;
    208208}
     
    223223                ofw_tree_property_t *prop =
    224224                    ofw_tree_getprop(cur, "name");
    225                
     225
    226226                if ((!prop) || (!prop->value))
    227227                        continue;
    228                
     228
    229229                if (str_cmp(prop->value, name) == 0)
    230230                        return cur;
    231231        }
    232        
     232
    233233        return NULL;
    234234}
     
    246246        if (path[0] != '/')
    247247                return NULL;
    248        
     248
    249249        ofw_tree_node_t *node = ofw_root;
    250250        size_t j;
    251        
     251
    252252        for (size_t i = 1; (i < str_size(path)) && (node); i = j + 1) {
    253253                for (j = i; (j < str_size(path)) && (path[j] != '/'); j++);
    254                
     254
    255255                /* Skip extra slashes */
    256256                if (i == j)
    257257                        continue;
    258                
     258
    259259                char buf[NAME_BUF_LEN + 1];
    260260                memcpy(buf, &path[i], j - i);
     
    262262                node = ofw_tree_find_child(node, buf);
    263263        }
    264        
     264
    265265        return node;
    266266}
     
    285285                ofw_tree_property_t *prop =
    286286                    ofw_tree_getprop(cur, "device_type");
    287                
     287
    288288                if ((prop) && (prop->value) && (str_cmp(prop->value, dtype) == 0)) {
    289289                        bool ret = walker(cur, arg);
     
    291291                                return false;
    292292                }
    293                
     293
    294294                if (cur->child) {
    295295                        bool ret =
     
    299299                }
    300300        }
    301        
     301
    302302        return true;
    303303}
     
    336336{
    337337        ofw_tree_node_t *node = (ofw_tree_node_t *) data;
    338        
     338
    339339        /* Compute serialized data size */
    340340        *size = 0;
     
    342342                *size += str_size(node->property[i].name) + 1 +
    343343                    sizeof(node->property[i].size) + node->property[i].size;
    344        
     344
    345345        if (dry_run)
    346346                return NULL;
    347        
     347
    348348        void *dump = malloc(*size, FRAME_ATOMIC);
    349349        if (dump == NULL) {
     
    351351                return NULL;
    352352        }
    353        
     353
    354354        /* Serialize the data */
    355355        size_t pos = 0;
     
    358358                str_cpy(dump + pos, *size - pos, node->property[i].name);
    359359                pos += str_size(node->property[i].name) + 1;
    360                
     360
    361361                /* Value size */
    362362                memcpy(dump + pos, &node->property[i].size,
    363363                    sizeof(node->property[i].size));
    364364                pos += sizeof(node->property[i].size);
    365                
     365
    366366                /* Value */
    367367                memcpy(dump + pos, node->property[i].value,
     
    369369                pos += node->property[i].size;
    370370        }
    371        
     371
    372372        return ((void *) dump);
    373373}
     
    385385{
    386386        char *cur_path = (char *) malloc(PATH_MAX_LEN, 0);
    387        
     387
    388388        for (ofw_tree_node_t *cur = node; cur; cur = cur->peer) {
    389389                if ((cur->parent) && (path))
     
    391391                else
    392392                        snprintf(cur_path, PATH_MAX_LEN, "firmware.%s", cur->da_name);
    393                
     393
    394394                sysinfo_set_item_gen_data(cur_path, NULL, ofw_sysinfo_properties,
    395395                    (void *) cur);
    396                
     396
    397397                if (cur->child)
    398398                        ofw_tree_node_sysinfo(cur->child, cur_path);
    399399        }
    400        
     400
    401401        free(cur_path);
    402402}
  • kernel/genarch/src/ofw/pci.c

    r3061bc1 r8565a42  
    6363                return false;
    6464        }
    65                
     65
    6666        ranges = prop->size / sizeof(ofw_pci_range_t);
    6767        range = prop->value;
    68        
     68
    6969        unsigned int i;
    70        
     70
    7171        for (i = 0; i < ranges; i++) {
    7272                if ((reg->space & PCI_SPACE_MASK) !=
     
    9595                return true;
    9696        }
    97        
     97
    9898        ofw_tree_property_t *prop;
    9999        ofw_pci_reg_t *assigned_address;
    100100        size_t assigned_addresses;
    101        
     101
    102102        prop = ofw_tree_getprop(node, "assigned-addresses");
    103103        if (!prop)
    104104                panic("Cannot find 'assigned-addresses' property.");
    105        
     105
    106106        assigned_addresses = prop->size / sizeof(ofw_pci_reg_t);
    107107        assigned_address = prop->value;
    108        
     108
    109109        unsigned int i;
    110        
     110
    111111        for (i = 0; i < assigned_addresses; i++) {
    112112                if ((assigned_address[i].space & PCI_REG_MASK) ==
     
    118118                }
    119119        }
    120        
     120
    121121        return false;
    122122}
  • kernel/genarch/src/ofw/sbus.c

    r3061bc1 r8565a42  
    4646        ofw_sbus_range_t *range;
    4747        size_t ranges;
    48        
     48
    4949        /*
    5050         * The SBUS support is very rudimentary in that we simply assume
     
    5555        if (!node->parent || node->parent->parent)
    5656                return false;
    57        
     57
    5858        prop = ofw_tree_getprop(node, "ranges");
    5959        if (!prop)
    6060                return false;
    61                
     61
    6262        ranges = prop->size / sizeof(ofw_sbus_range_t);
    6363        range = prop->value;
    64        
     64
    6565        unsigned int i;
    66        
     66
    6767        for (i = 0; i < ranges; i++) {
    6868                if (overlaps(reg->addr, reg->size, range[i].child_base,
     
    7373                }
    7474        }
    75        
     75
    7676        return false;
    7777}
  • kernel/genarch/src/softint/division.c

    r3061bc1 r8565a42  
    4343        unsigned int result;
    4444        int steps = sizeof(unsigned int) * 8;
    45        
     45
    4646        *remainder = 0;
    4747        result = 0;
    48        
     48
    4949        if (b == 0) {
    5050                /* FIXME: division by zero */
    5151                return 0;
    5252        }
    53        
     53
    5454        if (a < b) {
    5555                *remainder = a;
    5656                return 0;
    5757        }
    58        
     58
    5959        for (; steps > 0; steps--) {
    6060                /* shift one bit to remainder */
    6161                *remainder = ((*remainder) << 1) | (( a >> 31) & 0x1);
    6262                result <<= 1;
    63                
     63
    6464                if (*remainder >= b) {
    6565                        *remainder -= b;
     
    6868                a <<= 1;
    6969        }
    70        
     70
    7171        return result;
    7272}
     
    7777        unsigned long long result;
    7878        int steps = sizeof(unsigned long long) * 8;
    79        
     79
    8080        *remainder = 0;
    8181        result = 0;
    82        
     82
    8383        if (b == 0) {
    8484                /* FIXME: division by zero */
    8585                return 0;
    8686        }
    87        
     87
    8888        if (a < b) {
    8989                *remainder = a;
    9090                return 0;
    9191        }
    92        
     92
    9393        for (; steps > 0; steps--) {
    9494                /* shift one bit to remainder */
    9595                *remainder = ((*remainder) << 1) | ((a >> 63) & 0x1);
    9696                result <<= 1;
    97                
     97
    9898                if (*remainder >= b) {
    9999                        *remainder -= b;
     
    102102                a <<= 1;
    103103        }
    104        
     104
    105105        return result;
    106106}
     
    111111        unsigned int rem;
    112112        int result = (int) divandmod32(ABSVAL(a), ABSVAL(b), &rem);
    113        
     113
    114114        if (SGN(a) == SGN(b))
    115115                return result;
    116        
     116
    117117        return -result;
    118118}
     
    123123        unsigned long long rem;
    124124        long long result = (long long) divandmod64(ABSVAL(a), ABSVAL(b), &rem);
    125        
     125
    126126        if (SGN(a) == SGN(b))
    127127                return result;
    128        
     128
    129129        return -result;
    130130}
     
    149149        unsigned int rem;
    150150        divandmod32(a, b, &rem);
    151        
     151
    152152        /* if divident is negative, remainder must be too */
    153153        if (!(SGN(a)))
    154154                return -((int) rem);
    155        
     155
    156156        return (int) rem;
    157157}
     
    162162        unsigned long long rem;
    163163        divandmod64(a, b, &rem);
    164        
     164
    165165        /* if divident is negative, remainder must be too */
    166166        if (!(SGN(a)))
    167167                return -((long long) rem);
    168        
     168
    169169        return (long long) rem;
    170170}
     
    190190        unsigned int rem;
    191191        int result = (int) divandmod32(ABSVAL(a), ABSVAL(b), &rem);
    192        
     192
    193193        if (SGN(a) == SGN(b)) {
    194194                *c = rem;
    195195                return result;
    196196        }
    197        
     197
    198198        *c = -rem;
    199199        return -result;
     
    210210        unsigned long long rem;
    211211        long long result = (int) divandmod64(ABSVAL(a), ABSVAL(b), &rem);
    212        
     212
    213213        if (SGN(a) == SGN(b)) {
    214214                *c = rem;
    215215                return result;
    216216        }
    217        
     217
    218218        *c = -rem;
    219219        return -result;
  • kernel/genarch/src/srln/srln.c

    r3061bc1 r8565a42  
    5353        bool cr = false;
    5454        uint32_t escape = 0;
    55        
     55
    5656        while (true) {
    5757                wchar_t ch = indev_pop_character(&instance->raw);
    58                
     58
    5959                /* ANSI escape sequence processing */
    6060                if (escape != 0) {
    6161                        escape <<= 8;
    6262                        escape |= ch & 0xff;
    63                        
     63
    6464                        if ((escape == 0x1b4f) || (escape == 0x1b5b) || (escape == 0x1b5b33))
    6565                                continue;
    66                        
     66
    6767                        switch (escape) {
    6868                        case 0x1b4f46:
     
    100100                        }
    101101                }
    102                
     102
    103103                if (ch == 0x1b) {
    104104                        escape = ch & 0xff;
    105105                        continue;
    106106                }
    107                
     107
    108108                /* Replace carriage return with line feed
    109109                   and suppress any following line feed */
     
    112112                        continue;
    113113                }
    114                
     114
    115115                if (ch == '\r') {
    116116                        ch = '\n';
     
    118118                } else
    119119                        cr = false;
    120                
     120
    121121                /* Backspace */
    122122                if (ch == 0x7f)
    123123                        ch = '\b';
    124                
     124
    125125                indev_push_character(instance->sink, ch);
    126126        }
     
    134134                instance->thread = thread_create(ksrln, (void *) instance,
    135135                    TASK, THREAD_FLAG_NONE, "ksrln");
    136                
     136
    137137                if (!instance->thread) {
    138138                        free(instance);
    139139                        return NULL;
    140140                }
    141                
     141
    142142                instance->sink = NULL;
    143143                indev_initialize("srln", &instance->raw, &srln_raw_ops);
    144144        }
    145        
     145
    146146        return instance;
    147147}
     
    151151        assert(instance);
    152152        assert(sink);
    153        
     153
    154154        instance->sink = sink;
    155155        thread_ready(instance->thread);
    156        
     156
    157157        return &instance->raw;
    158158}
Note: See TracChangeset for help on using the changeset viewer.