Changeset 8565a42 in mainline for kernel/arch/mips32/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/arch/mips32/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/src/asm.S

    r3061bc1 r8565a42  
    6262FUNCTION_BEGIN(memcpy_to_uspace)
    6363        move $t2, $a0  /* save dst */
    64        
     64
    6565        addiu $v0, $a1, 3
    6666        li $v1, -4  /* 0xfffffffffffffffc */
     
    6868        beq $a1, $v0, 3f
    6969        move $t0, $a0
    70        
     70
    7171        0:
    7272                beq $a2, $zero, 2f
    7373                move $a3, $zero
    74        
     74
    7575        1:
    7676                addu $v0, $a1, $a3
     
    8080                bne $a3, $a2, 1b
    8181                sb $a0, 0($v1)
    82        
     82
    8383        2:
    8484                jr $ra
    8585                move $v0, $t2
    86        
     86
    8787        3:
    8888                addiu $v0, $a0, 3
     
    9090                bne $a0, $v0, 0b
    9191                srl $t1, $a2, 2
    92                
     92
    9393                beq $t1, $zero, 5f
    9494                move $a3, $zero
    95                
     95
    9696                move $a3, $zero
    9797                move $a0, $zero
    98        
     98
    9999        4:
    100100                addu $v0, $a1, $a0
     
    105105                bne $a3, $t1, 4b
    106106                addiu $a0, $a0, 4
    107        
     107
    108108        5:
    109109                andi $a2, $a2, 0x3
    110110                beq $a2, $zero, 2b
    111111                nop
    112                
     112
    113113                sll $v0, $a3, 2
    114114                addu $t1, $v0, $t0
    115115                move $a3, $zero
    116116                addu $t0, $v0, $a1
    117        
     117
    118118        6:
    119119                addu $v0, $t0, $a3
     
    123123                bne $a3, $a2, 6b
    124124                sb $a0, 0($v1)
    125                
     125
    126126                jr $ra
    127127                move $v0, $t2
     
    188188        fpu_gp_save 30, $a0
    189189        fpu_gp_save 31, $a0
    190        
     190
    191191        fpu_ct_save 1, $a0
    192192        fpu_ct_save 2, $a0
     
    259259        fpu_gp_restore 30, $a0
    260260        fpu_gp_restore 31, $a0
    261        
     261
    262262        fpu_ct_restore 1, $a0
    263263        fpu_ct_restore 2, $a0
  • kernel/arch/mips32/src/context.S

    r3061bc1 r8565a42  
    4747        sw $s8, CONTEXT_OFFSET_S8($a0)
    4848        sw $gp, CONTEXT_OFFSET_GP($a0)
    49        
     49
    5050        sw $ra, CONTEXT_OFFSET_PC($a0)
    5151        sw $sp, CONTEXT_OFFSET_SP($a0)
    52        
     52
    5353        # context_save returns 1
    5454        j $31
     
    6767        lw $s8, CONTEXT_OFFSET_S8($a0)
    6868        lw $gp, CONTEXT_OFFSET_GP($a0)
    69        
     69
    7070        lw $ra, CONTEXT_OFFSET_PC($a0)
    7171        lw $sp, CONTEXT_OFFSET_SP($a0)
    72        
     72
    7373        # context_restore returns 0
    7474        j $31
  • kernel/arch/mips32/src/debug/stacktrace.c

    r3061bc1 r8565a42  
    157157                         * We have a candidate for frame pointer.
    158158                         */
    159                        
     159
    160160                        /* Seek to the end of this function. */
    161161                        for (cur = inst + 1; !IS_JR_RA(*cur); cur++)
     
    170170                        continue;
    171171                }
    172                
     172
    173173                if (IS_JR_RA(*inst)) {
    174174                        if (!ctx->istate)
     
    189189        } while ((!IS_ADDIU_SP_SP_IMM(*inst) && !IS_ADDI_SP_SP_IMM(*inst)) ||
    190190            (IMM_GET(*inst) >= 0));
    191        
     191
    192192        /*
    193193         * We are at the instruction which allocates the space for the current
     
    210210                        if (base == SP || (has_fp && base == fp)) {
    211211                                uint32_t *addr = (void *) (ctx->fp + offset);
    212                                
     212
    213213                                if (offset % 4 != 0)
    214214                                        return false;
  • kernel/arch/mips32/src/debugger.c

    r3061bc1 r8565a42  
    138138{
    139139        unsigned int i;
    140        
     140
    141141        for (i = 0; jmpinstr[i].andmask; i++) {
    142142                if ((instr & jmpinstr[i].andmask) == jmpinstr[i].value)
    143143                        return true;
    144144        }
    145        
     145
    146146        return false;
    147147}
     
    158158                return 1;
    159159        }
    160        
     160
    161161        irq_spinlock_lock(&bkpoint_lock, true);
    162        
     162
    163163        /* Check, that the breakpoints do not conflict */
    164164        unsigned int i;
     
    176176                        return 0;
    177177                }
    178                
    179         }
    180        
     178
     179        }
     180
    181181        bpinfo_t *cur = NULL;
    182        
     182
    183183        for (i = 0; i < BKPOINTS_MAX; i++) {
    184184                if (!breakpoints[i].address) {
     
    187187                }
    188188        }
    189        
     189
    190190        if (!cur) {
    191191                printf("Too many breakpoints.\n");
     
    193193                return 0;
    194194        }
    195        
     195
    196196        printf("Adding breakpoint on address %p\n", (void *) argv->intval);
    197        
     197
    198198        cur->address = (uintptr_t) argv->intval;
    199199        cur->instruction = ((sysarg_t *) cur->address)[0];
     
    205205                cur->bkfunc = (void (*)(void *, istate_t *)) argv[1].intval;
    206206        }
    207        
     207
    208208        if (is_jump(cur->instruction))
    209209                cur->flags |= BKPOINT_ONESHOT;
    210        
     210
    211211        cur->counter = 0;
    212        
     212
    213213        /* Set breakpoint */
    214214        *((sysarg_t *) cur->address) = 0x0d;
    215215        smc_coherence(cur->address);
    216        
     216
    217217        irq_spinlock_unlock(&bkpoint_lock, true);
    218        
     218
    219219        return 1;
    220220}
     
    229229                return 0;
    230230        }
    231        
     231
    232232        irq_spinlock_lock(&bkpoint_lock, true);
    233        
     233
    234234        bpinfo_t *cur = &breakpoints[argv->intval];
    235235        if (!cur->address) {
     
    238238                return 0;
    239239        }
    240        
     240
    241241        if ((cur->flags & BKPOINT_INPROG) && (cur->flags & BKPOINT_ONESHOT)) {
    242242                printf("Cannot remove one-shot breakpoint in-progress\n");
     
    244244                return 0;
    245245        }
    246        
     246
    247247        ((uint32_t *) cur->address)[0] = cur->instruction;
    248248        smc_coherence(((uint32_t *) cur->address)[0]);
    249249        ((uint32_t *) cur->address)[1] = cur->nextinstruction;
    250250        smc_coherence(((uint32_t *) cur->address)[1]);
    251        
     251
    252252        cur->address = (uintptr_t) NULL;
    253        
     253
    254254        irq_spinlock_unlock(&bkpoint_lock, true);
    255255        return 1;
     
    262262{
    263263        unsigned int i;
    264        
     264
    265265        printf("[nr] [count] [address ] [inprog] [oneshot] [funccall] [in symbol\n");
    266        
     266
    267267        for (i = 0; i < BKPOINTS_MAX; i++) {
    268268                if (breakpoints[i].address) {
    269269                        const char *symbol = symtab_fmt_name_lookup(
    270270                            breakpoints[i].address);
    271                        
     271
    272272                        printf("%-4u %7zu %p %-8s %-9s %-10s %s\n", i,
    273273                            breakpoints[i].counter, (void *) breakpoints[i].address,
     
    278278                }
    279279        }
    280        
     280
    281281        return 1;
    282282}
     
    290290{
    291291        unsigned int i;
    292        
     292
    293293        for (i = 0; i < BKPOINTS_MAX; i++)
    294294                breakpoints[i].address = (uintptr_t) NULL;
    295        
     295
    296296#ifdef CONFIG_KCONSOLE
    297297        cmd_initialize(&bkpts_info);
     
    299299                log(LF_OTHER, LVL_WARN, "Cannot register command %s",
    300300                    bkpts_info.name);
    301        
     301
    302302        cmd_initialize(&delbkpt_info);
    303303        if (!cmd_register(&delbkpt_info))
    304304                log(LF_OTHER, LVL_WARN, "Cannot register command %s",
    305305                    delbkpt_info.name);
    306        
     306
    307307        cmd_initialize(&addbkpt_info);
    308308        if (!cmd_register(&addbkpt_info))
    309309                log(LF_OTHER, LVL_WARN, "Cannot register command %s",
    310310                    addbkpt_info.name);
    311        
     311
    312312        cmd_initialize(&addbkpte_info);
    313313        if (!cmd_register(&addbkpte_info))
     
    331331        if (cp0_cause_read() & 0x80000000)
    332332                panic("Breakpoint in branch delay slot not supported.");
    333        
     333
    334334        irq_spinlock_lock(&bkpoint_lock, false);
    335        
     335
    336336        bpinfo_t *cur = NULL;
    337337        uintptr_t fireaddr = istate->epc;
    338338        unsigned int i;
    339        
     339
    340340        for (i = 0; i < BKPOINTS_MAX; i++) {
    341341                /* Normal breakpoint */
     
    345345                        break;
    346346                }
    347                
     347
    348348                /* Reinst only breakpoint */
    349349                if ((breakpoints[i].flags & BKPOINT_REINST) &&
     
    353353                }
    354354        }
    355        
     355
    356356        if (cur) {
    357357                if (cur->flags & BKPOINT_REINST) {
     
    359359                        ((uint32_t *) cur->address)[0] = 0x0d;
    360360                        smc_coherence(((uint32_t *)cur->address)[0]);
    361                        
     361
    362362                        /* Return back the second */
    363363                        ((uint32_t *) cur->address)[1] = cur->nextinstruction;
    364364                        smc_coherence(((uint32_t *) cur->address)[1]);
    365                        
     365
    366366                        cur->flags &= ~BKPOINT_REINST;
    367367                        irq_spinlock_unlock(&bkpoint_lock, false);
    368368                        return;
    369369                }
    370                
     370
    371371                if (cur->flags & BKPOINT_INPROG)
    372372                        printf("Warning: breakpoint recursion\n");
    373                
     373
    374374                if (!(cur->flags & BKPOINT_FUNCCALL)) {
    375375                        printf("***Breakpoint %u: %p in %s.\n", i,
     
    377377                            symtab_fmt_name_lookup(fireaddr));
    378378                }
    379                
     379
    380380                /* Return first instruction back */
    381381                ((uint32_t *)cur->address)[0] = cur->instruction;
     
    392392                    (void *) fireaddr,
    393393                    symtab_fmt_name_lookup(fireaddr));
    394                
     394
    395395                /* Move on to next instruction */
    396396                istate->epc += 4;
    397397        }
    398        
     398
    399399        if (cur)
    400400                cur->counter++;
    401        
     401
    402402        if (cur && (cur->flags & BKPOINT_FUNCCALL)) {
    403403                /* Allow zero bkfunc, just for counting */
     
    414414                atomic_set(&haltstate, 1);
    415415                irq_spinlock_unlock(&bkpoint_lock, false);
    416                
     416
    417417                kconsole("debug", "Debug console ready.\n", false);
    418                
     418
    419419                irq_spinlock_lock(&bkpoint_lock, false);
    420420                atomic_set(&haltstate, 0);
    421421#endif
    422422        }
    423        
     423
    424424        if ((cur) && (cur->address == fireaddr)
    425425            && ((cur->flags & BKPOINT_INPROG))) {
     
    427427                if ((cur->flags & BKPOINT_ONESHOT))
    428428                        cur->address = (uintptr_t) NULL;
    429                
     429
    430430                /* Remove in-progress flag */
    431431                cur->flags &= ~BKPOINT_INPROG;
    432432        }
    433        
     433
    434434        irq_spinlock_unlock(&bkpoint_lock, false);
    435435}
  • kernel/arch/mips32/src/exception.c

    r3061bc1 r8565a42  
    7777            "lo =%#010" PRIx32 "\thi =%#010" PRIx32 "\n",
    7878            istate->epc, istate->status, istate->lo, istate->hi);
    79        
     79
    8080        log_printf("a0 =%#010" PRIx32 "\ta1 =%#010" PRIx32 "\t"
    8181            "a2 =%#010" PRIx32 "\ta3 =%#010" PRIx32 "\n",
    8282            istate->a0, istate->a1, istate->a2, istate->a3);
    83        
     83
    8484        log_printf("t0 =%#010" PRIx32 "\tt1 =%#010" PRIx32 "\t"
    8585            "t2 =%#010" PRIx32 "\tt3 =%#010" PRIx32 "\n",
    8686            istate->t0, istate->t1, istate->t2, istate->t3);
    87        
     87
    8888        log_printf("t4 =%#010" PRIx32 "\tt5 =%#010" PRIx32 "\t"
    8989            "t6 =%#010" PRIx32 "\tt7 =%#010" PRIx32 "\n",
    9090            istate->t4, istate->t5, istate->t6, istate->t7);
    91        
     91
    9292        log_printf("t8 =%#010" PRIx32 "\tt9 =%#010" PRIx32 "\t"
    9393            "v0 =%#010" PRIx32 "\tv1 =%#010" PRIx32 "\n",
    9494            istate->t8, istate->t9, istate->v0, istate->v1);
    95        
     95
    9696        log_printf("s0 =%#010" PRIx32 "\ts1 =%#010" PRIx32 "\t"
    9797            "s2 =%#010" PRIx32 "\ts3 =%#010" PRIx32 "\n",
    9898            istate->s0, istate->s1, istate->s2, istate->s3);
    99        
     99
    100100        log_printf("s4 =%#010" PRIx32 "\ts5 =%#010" PRIx32 "\t"
    101101            "s6 =%#010" PRIx32 "\ts7 =%#010" PRIx32 "\n",
    102102            istate->s4, istate->s5, istate->s6, istate->s7);
    103        
     103
    104104        log_printf("s8 =%#010" PRIx32 "\tat =%#010" PRIx32 "\t"
    105105            "kt0=%#010" PRIx32 "\tkt1=%#010" PRIx32 "\n",
    106106            istate->s8, istate->at, istate->kt0, istate->kt1);
    107        
     107
    108108        log_printf("sp =%#010" PRIx32 "\tra =%#010" PRIx32 "\t"
    109109            "gp =%#010" PRIx32 "\n",
     
    171171        ip = (cp0_cause_read() & cp0_cause_ip_mask) >> cp0_cause_ip_shift;
    172172        im = (cp0_status_read() & cp0_status_im_mask) >> cp0_status_im_shift;
    173        
     173
    174174        unsigned int i;
    175175        for (i = 0; i < 8; i++) {
     
    212212{
    213213        unsigned int i;
    214        
     214
    215215        /* Clear exception table */
    216216        for (i = 0; i < IVT_ITEMS; i++)
    217217                exc_register(i, "undef", false,
    218218                    (iroutine_t) unhandled_exception);
    219        
     219
    220220        exc_register(EXC_Bp, "bkpoint", true,
    221221            (iroutine_t) breakpoint_exception);
     
    230230        exc_register(EXC_Int, "interrupt", true,
    231231            (iroutine_t) interrupt_exception);
    232        
     232
    233233#ifdef CONFIG_FPU_LAZY
    234234        exc_register(EXC_CpU, "cpunus", true,
    235235            (iroutine_t) cpuns_exception);
    236236#endif
    237        
     237
    238238        exc_register(EXC_Sys, "syscall", true,
    239239            (iroutine_t) syscall_exception);
  • kernel/arch/mips32/src/interrupt.c

    r3061bc1 r8565a42  
    132132                /* Count overflow detected */
    133133                count_hi++;
    134        
     134
    135135        lastcount = cp0_count_read();
    136        
     136
    137137        unsigned long drift = cp0_count_read() - nextcount;
    138138        while (drift > cp0_compare_value) {
     
    140140                CPU->missed_clock_ticks++;
    141141        }
    142        
     142
    143143        nextcount = cp0_count_read() + cp0_compare_value - drift;
    144144        cp0_compare_write(nextcount);
    145        
     145
    146146        /*
    147147         * We are holding a lock which prevents preemption.
     
    151151        clock();
    152152        irq_spinlock_lock(&irq->lock, false);
    153        
     153
    154154        if (virtual_timer_fnc != NULL)
    155155                virtual_timer_fnc();
     
    172172{
    173173        irq_init(IRQ_COUNT, IRQ_COUNT);
    174        
     174
    175175        irq_initialize(&timer_irq);
    176176        timer_irq.inr = TIMER_IRQ;
     
    178178        timer_irq.handler = timer_irq_handler;
    179179        irq_register(&timer_irq);
    180        
     180
    181181        timer_start();
    182182        cp0_unmask_int(TIMER_IRQ);
    183        
     183
    184184#ifdef MACHINE_msim
    185185        irq_initialize(&dorder_irq);
     
    188188        dorder_irq.handler = dorder_irq_handler;
    189189        irq_register(&dorder_irq);
    190        
     190
    191191        cp0_unmask_int(DORDER_IRQ);
    192192#endif
  • kernel/arch/mips32/src/mips32.c

    r3061bc1 r8565a42  
    8686{
    8787        init.cnt = min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
    88        
     88
    8989        size_t i;
    9090        for (i = 0; i < init.cnt; i++) {
     
    9494                    bootinfo->tasks[i].name);
    9595        }
    96        
     96
    9797        for (i = 0; i < CPUMAP_MAX_RECORDS; i++) {
    9898                if ((bootinfo->cpumap & (1 << i)) != 0)
     
    112112        /* It is not assumed by default */
    113113        interrupts_disable();
    114        
     114
    115115        /* Initialize dispatch table */
    116116        exception_init();
     
    123123        memcpy(CACHE_EXC, (char *) cache_error_entry, EXCEPTION_JUMP_SIZE);
    124124        smc_coherence_block(CACHE_EXC, EXCEPTION_JUMP_SIZE);
    125        
     125
    126126        /*
    127127         * Switch to BEV normal level so that exception vectors point to the
     
    130130        cp0_status_write(cp0_status_read() &
    131131            ~(cp0_status_bev_bootstrap_bit | cp0_status_erl_error_bit));
    132        
     132
    133133        /*
    134134         * Mask all interrupts
    135135         */
    136136        cp0_mask_all_int();
    137        
     137
    138138        debugger_init();
    139139}
     
    171171            (uintptr_t) kernel_uarg->uspace_uarg,
    172172            (uintptr_t) kernel_uarg->uspace_entry);
    173        
     173
    174174        while (1);
    175175}
  • kernel/arch/mips32/src/mm/frame.c

    r3061bc1 r8565a42  
    8282        if (frame == (KA2PA(MSIM_VIDEORAM) >> ZERO_PAGE_WIDTH))
    8383                return false;
    84        
     84
    8585        /* MSIM device (dkeyboard) */
    8686        if (frame == (KA2PA(MSIM_KBD_ADDRESS) >> ZERO_PAGE_WIDTH))
     
    9292                return false;
    9393#endif
    94        
     94
    9595        return true;
    9696}
     
    108108        if ((frame << ZERO_PAGE_WIDTH) < KA2PA(config.base))
    109109                return false;
    110        
     110
    111111        /* Kernel */
    112112        if (overlaps(frame << ZERO_PAGE_WIDTH, ZERO_PAGE_SIZE,
    113113            KA2PA(config.base), config.kernel_size))
    114114                return false;
    115        
     115
    116116        /* Kernel stack */
    117117        if (overlaps(frame << ZERO_PAGE_WIDTH, ZERO_PAGE_SIZE,
    118118            KA2PA(config.stack_base), config.stack_size))
    119119                return false;
    120        
     120
    121121        /* Init tasks */
    122122        bool safe = true;
     
    128128                        break;
    129129                }
    130        
     130
    131131        return safe;
    132132}
     
    161161                            ZONE_AVAILABLE | ZONE_HIGHMEM);
    162162        }
    163        
     163
    164164        if (phys_regions_count < MAX_REGIONS) {
    165165                phys_regions[phys_regions_count].start = first;
     
    182182{
    183183        ipl_t ipl = interrupts_disable();
    184        
     184
    185185        /* Clear and initialize TLB */
    186186        cp0_pagemask_write(ZERO_PAGE_MASK);
     
    194194                tlbwi();
    195195        }
    196                
     196
    197197        pfn_t start_frame = 0;
    198198        pfn_t frame;
    199199        bool avail = true;
    200        
     200
    201201        /* Walk through all 1 MB frames */
    202202        for (frame = 0; frame < ZERO_FRAMES; frame++) {
     
    211211                                tlb_prepare_entry_lo(&lo1, false, false, false, false, 0);
    212212                                tlb_prepare_entry_hi(&hi, ZERO_PAGE_ASID, ZERO_PAGE_ADDR);
    213                                
     213
    214214                                cp0_pagemask_write(ZERO_PAGE_MASK);
    215215                                cp0_entry_lo0_write(lo0.value);
     
    218218                                cp0_index_write(ZERO_PAGE_TLBI);
    219219                                tlbwi();
    220                                
     220
    221221                                ZERO_PAGE_VALUE = 0;
    222222                                if (ZERO_PAGE_VALUE != 0)
     
    229229                        }
    230230                }
    231                
     231
    232232                if (!avail) {
    233233                        frame_add_region(start_frame, frame, true);
     
    236236                }
    237237        }
    238        
     238
    239239        frame_add_region(start_frame, frame, true);
    240        
     240
    241241        /* Blacklist interrupt vector frame */
    242242        frame_mark_unavailable(0, 1);
     
    267267        frame_mark_unavailable(0, 1024 * 1024 / FRAME_SIZE);
    268268#endif
    269        
     269
    270270        /* Cleanup */
    271271        cp0_pagemask_write(ZERO_PAGE_MASK);
     
    275275        cp0_index_write(ZERO_PAGE_TLBI);
    276276        tlbwi();
    277        
     277
    278278        interrupts_restore(ipl);
    279279}
     
    286286{
    287287        printf("[base    ] [size    ]\n");
    288        
     288
    289289        size_t i;
    290290        for (i = 0; i < phys_regions_count; i++) {
  • kernel/arch/mips32/src/mm/tlb.c

    r3061bc1 r8565a42  
    7676
    7777        /* Clear and initialize TLB. */
    78        
     78
    7979        for (i = 0; i < TLB_ENTRY_COUNT; i++) {
    8080                cp0_index_write(i);
    8181                tlbwi();
    8282        }
    83        
     83
    8484        /*
    8585         * The kernel is going to make use of some wired
     
    9898        uintptr_t badvaddr;
    9999        pte_t pte;
    100        
     100
    101101        badvaddr = cp0_badvaddr_read();
    102102
     
    291291        lo1_save.value = cp0_entry_lo1_read();
    292292        mask_save.value = cp0_pagemask_read();
    293        
     293
    294294        printf("[nr] [asid] [vpn2    ] [mask] [gvdc] [pfn     ]\n");
    295        
     295
    296296        for (i = 0; i < TLB_ENTRY_COUNT; i++) {
    297297                cp0_index_write(i);
    298298                tlbr();
    299                
     299
    300300                mask.value = cp0_pagemask_read();
    301301                hi.value = cp0_entry_hi_read();
    302302                lo0.value = cp0_entry_lo0_read();
    303303                lo1.value = cp0_entry_lo1_read();
    304                
     304
    305305                printf("%-4u %-6u %0#10x %-#6x  %1u%1u%1u%1u  %0#10x\n",
    306306                    i, hi.asid, HI_VPN22ADDR(hi.vpn2), mask.mask,
     
    309309                    lo1.g, lo1.v, lo1.d, lo1.c, LO_PFN2ADDR(lo1.pfn));
    310310        }
    311        
     311
    312312        cp0_entry_hi_write(hi_save.value);
    313313        cp0_entry_lo0_write(lo0_save.value);
     
    339339                cp0_entry_lo0_write(lo0.value);
    340340                cp0_entry_lo1_write(lo1.value);
    341                                
     341
    342342                tlbwi();
    343343        }
    344        
     344
    345345        cp0_entry_hi_write(hi_save.value);
    346346}
     
    360360
    361361        hi_save.value = cp0_entry_hi_read();
    362        
     362
    363363        for (i = 0; i < TLB_ENTRY_COUNT; i++) {
    364364                cp0_index_write(i);
    365365                tlbr();
    366                
     366
    367367                hi.value = cp0_entry_hi_read();
    368                
     368
    369369                if (hi.asid == asid) {
    370370                        lo0.value = cp0_entry_lo0_read();
     
    380380                }
    381381        }
    382        
     382
    383383        cp0_entry_hi_write(hi_save.value);
    384384}
     
    399399
    400400        assert(interrupts_disabled());
    401        
     401
    402402        if (asid == ASID_INVALID)
    403403                return;
     
    431431                }
    432432        }
    433        
     433
    434434        cp0_entry_hi_write(hi_save.value);
    435435}
  • kernel/arch/mips32/src/start.S

    r3061bc1 r8565a42  
    8989        sw $s7, ISTATE_OFFSET_S7(\r)
    9090        sw $s8, ISTATE_OFFSET_S8(\r)
    91        
     91
    9292        mflo $at
    9393        sw $at, ISTATE_OFFSET_LO(\r)
    9494        mfhi $at
    9595        sw $at, ISTATE_OFFSET_HI(\r)
    96        
     96
    9797        sw $gp, ISTATE_OFFSET_GP(\r)
    9898        sw $ra, ISTATE_OFFSET_RA(\r)
    9999        sw $k0, ISTATE_OFFSET_KT0(\r)
    100100        sw $k1, ISTATE_OFFSET_KT1(\r)
    101        
     101
    102102        mfc0 $t0, $status
    103103        mfc0 $t1, $epc
    104        
     104
    105105        /* save only KSU, EXL, ERL, IE */
    106106        and $t2, $t0, REG_SAVE_MASK
    107        
     107
    108108        /* clear KSU, EXL, ERL, IE */
    109109        li $t3, ~(REG_SAVE_MASK)
    110110        and $t0, $t0, $t3
    111        
     111
    112112        sw $t2, ISTATE_OFFSET_STATUS(\r)
    113113        sw $t1, ISTATE_OFFSET_EPC(\r)
     
    122122        mfc0 $t0, $status
    123123        lw $t1, ISTATE_OFFSET_STATUS(\r)
    124        
     124
    125125        /* mask UM, EXL, ERL, IE */
    126126        li $t2, ~REG_SAVE_MASK
    127127        and $t0, $t0, $t2
    128        
     128
    129129        /* copy UM, EXL, ERL, IE from saved status */
    130130        or $t0, $t0, $t1
    131131        mtc0 $t0, $status
    132        
     132
    133133        lw $v0, ISTATE_OFFSET_V0(\r)
    134134        lw $v1, ISTATE_OFFSET_V1(\r)
     
    147147        lw $t8, ISTATE_OFFSET_T8(\r)
    148148        lw $t9, ISTATE_OFFSET_T9(\r)
    149        
     149
    150150        lw $gp, ISTATE_OFFSET_GP(\r)
    151151        lw $ra, ISTATE_OFFSET_RA(\r)
    152152        lw $k1, ISTATE_OFFSET_KT1(\r)
    153        
     153
    154154        lw $at, ISTATE_OFFSET_LO(\r)
    155155        mtlo $at
    156156        lw $at, ISTATE_OFFSET_HI(\r)
    157157        mthi $at
    158        
     158
    159159        lw $at, ISTATE_OFFSET_EPC(\r)
    160160        mtc0 $at, $epc
    161        
     161
    162162        lw $at, ISTATE_OFFSET_AT(\r)
    163163        lw $sp, ISTATE_OFFSET_SP(\r)
     
    172172        mfc0 $k0, $status
    173173        andi $k0, 0x10
    174        
     174
    175175        beq $k0, $0, 1f
    176176        move $k0, $sp
    177        
     177
    178178        /* move $k0 pointer to kernel stack */
    179179        la $k0, supervisor_sp
    180        
     180
    181181        /* move $k0 (supervisor_sp) */
    182182        lw $k0, ($k0)
    183        
     183
    184184        1:
    185185.endm
     
    190190        lui $sp, %hi(end_stack)
    191191        ori $sp, $sp, %lo(end_stack)
    192        
     192
    193193        /* not sure about this, but might be needed for PIC code */
    194194        lui $gp, 0x8000
    195        
     195
    196196        /* $a1 contains physical address of bootinfo_t */
    197197        jal mips32_pre_main
    198198        addiu $sp, -ABI_STACK_FRAME
    199        
     199
    200200        j main_bsp
    201201        nop
     
    219219exception_handler:
    220220        KERNEL_STACK_TO_K0
    221        
     221
    222222        sub $k0, ISTATE_SIZE
    223223        sw $sp, ISTATE_OFFSET_SP($k0)
    224224        move $sp, $k0
    225        
     225
    226226        mfc0 $k0, $cause
    227        
     227
    228228        sra $k0, $k0, 0x2    /* cp0_exc_cause() part 1 */
    229229        andi $k0, $k0, 0x1f  /* cp0_exc_cause() part 2 */
    230230        sub $k0, 8           /* 8 = SYSCALL */
    231        
     231
    232232        beqz $k0, syscall_shortcut
    233233        add $k0, 8           /* revert $k0 back to correct exc number */
    234        
     234
    235235        REGISTERS_STORE_AND_EXC_RESET $sp
    236        
     236
    237237        move $a1, $sp
    238238        move $a0, $k0
     
    240240        addiu $sp, -ABI_STACK_FRAME
    241241        addiu $sp, ABI_STACK_FRAME
    242        
     242
    243243        REGISTERS_LOAD $sp
    244244        /* the $sp is automatically restored to former value */
     
    265265        sw $t3, ISTATE_OFFSET_EPC($sp)  /* save EPC */
    266266        sw $k1, ISTATE_OFFSET_KT1($sp)  /* save $k1 not saved on context switch */
    267        
     267
    268268        and $t4, $t2, REG_SAVE_MASK  /* save only KSU, EXL, ERL, IE */
    269269        li $t5, ~(0x1f)
    270270        and $t2, $t2, $t5  /* clear KSU, EXL, ERL */
    271271        ori $t2, $t2, 0x1  /* set IE */
    272        
     272
    273273        sw $t4, ISTATE_OFFSET_STATUS($sp)
    274274        mtc0 $t2, $status
    275        
     275
    276276        /*
    277277         * Call the higher level system call handler.
     
    280280        sw $t0, ISTATE_OFFSET_T0($sp)  /* save the 5th argument on the stack */
    281281        sw $t1, ISTATE_OFFSET_T1($sp)  /* save the 6th argument on the stack */
    282        
     282
    283283        jal syscall_handler
    284284        sw $v0, ISTATE_OFFSET_V0($sp)  /* save the syscall number on the stack */
    285        
     285
    286286        /* restore status */
    287287        mfc0 $t2, $status
    288288        lw $t3, ISTATE_OFFSET_STATUS($sp)
    289        
     289
    290290        /*
    291291         * Change back to EXL = 1 (from last exception), otherwise
     
    297297        or $t2, $t2, $t3  /* copy saved UM, EXL, ERL, IE */
    298298        mtc0 $t2, $status
    299        
     299
    300300        /* restore epc + 4 */
    301301        lw $t2, ISTATE_OFFSET_EPC($sp)
     
    303303        addi $t2, $t2, 4
    304304        mtc0 $t2, $epc
    305        
     305
    306306        lw $sp, ISTATE_OFFSET_SP($sp)  /* restore $sp */
    307307        eret
     
    314314        sw $sp, ISTATE_OFFSET_SP($k0)
    315315        move $sp, $k0
    316        
     316
    317317        move $a0, $sp
    318318        jal tlb_refill
    319319        addiu $sp, -ABI_STACK_FRAME
    320320        addiu $sp, ABI_STACK_FRAME
    321        
     321
    322322        REGISTERS_LOAD $sp
    323323        eret
     
    330330        sw $sp, ISTATE_OFFSET_SP($k0)
    331331        move $sp, $k0
    332        
     332
    333333        move $a0, $sp
    334334        jal cache_error
    335335        addiu $sp, -ABI_STACK_FRAME
    336336        addiu $sp, ABI_STACK_FRAME
    337        
     337
    338338        REGISTERS_LOAD $sp
    339339        eret
Note: See TracChangeset for help on using the changeset viewer.