Changeset 7328ff4 in mainline for kernel/arch/mips32/src/debugger.c


Ignore:
Timestamp:
2018-09-06T18:18:52Z (7 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ffa73c6
Parents:
d51cca8
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-13 01:29:17)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-09-06 18:18:52)
Message:

Use builtin memory fences for kernel barriers, and convert smp_coherence() into a regular function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/src/debugger.c

    rd51cca8 r7328ff4  
    147147}
    148148
     149static inline void write_inst(uintptr_t addr, uint32_t inst)
     150{
     151        *((uint32_t *) addr) = inst;
     152        smc_coherence((uint32_t *) addr, 4);
     153}
     154
    149155#ifdef CONFIG_KCONSOLE
    150156
     
    212218
    213219        /* Set breakpoint */
    214         *((sysarg_t *) cur->address) = 0x0d;
    215         smc_coherence(cur->address, 4);
     220        write_inst(cur->address, 0x0d);
    216221
    217222        irq_spinlock_unlock(&bkpoint_lock, true);
     
    245250        }
    246251
    247         ((uint32_t *) cur->address)[0] = cur->instruction;
    248         smc_coherence(((uint32_t *) cur->address)[0], 4);
    249         ((uint32_t *) cur->address)[1] = cur->nextinstruction;
    250         smc_coherence(((uint32_t *) cur->address)[1], 4);
     252        write_inst(cur->address, cur->instruction);
     253        write_inst(cur->address + 4, cur->nextinstruction);
    251254
    252255        cur->address = (uintptr_t) NULL;
     
    357360                if (cur->flags & BKPOINT_REINST) {
    358361                        /* Set breakpoint on first instruction */
    359                         ((uint32_t *) cur->address)[0] = 0x0d;
    360                         smc_coherence(((uint32_t *)cur->address)[0], 4);
     362                        write_inst(cur->address, 0x0d);
    361363
    362364                        /* Return back the second */
    363                         ((uint32_t *) cur->address)[1] = cur->nextinstruction;
    364                         smc_coherence(((uint32_t *) cur->address)[1], 4);
     365                        write_inst(cur->address + 4, cur->nextinstruction);
    365366
    366367                        cur->flags &= ~BKPOINT_REINST;
     
    379380
    380381                /* Return first instruction back */
    381                 ((uint32_t *)cur->address)[0] = cur->instruction;
    382                 smc_coherence(cur->address, 4);
     382                write_inst(cur->address, cur->instruction);
    383383
    384384                if (!(cur->flags & BKPOINT_ONESHOT)) {
    385385                        /* Set Breakpoint on next instruction */
    386                         ((uint32_t *)cur->address)[1] = 0x0d;
     386                        write_inst(cur->address + 4, 0x0d);
    387387                        cur->flags |= BKPOINT_REINST;
    388388                }
Note: See TracChangeset for help on using the changeset viewer.