diff options
author | Bharat Bhushan <r65777@freescale.com> | 2013-06-26 01:42:22 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2013-10-17 08:49:38 -0400 |
commit | 95791988fec645d196e746fcc0e329e19f7b1347 (patch) | |
tree | 23c712c6c1ca4bf6aed52a26ebc85a016d9f9297 /arch/powerpc/kernel/traps.c | |
parent | 6b3e3b310a884958df030760e725d32a79c0c8b4 (diff) |
powerpc: move debug registers in a structure
This way we can use same data type struct with KVM and
also help in using other debug related function.
Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kernel/traps.c')
-rw-r--r-- | arch/powerpc/kernel/traps.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index f783c932faeb..4f5df4e7df12 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
@@ -351,8 +351,8 @@ static inline int check_io_access(struct pt_regs *regs) | |||
351 | #define REASON_TRAP ESR_PTR | 351 | #define REASON_TRAP ESR_PTR |
352 | 352 | ||
353 | /* single-step stuff */ | 353 | /* single-step stuff */ |
354 | #define single_stepping(regs) (current->thread.dbcr0 & DBCR0_IC) | 354 | #define single_stepping(regs) (current->thread.debug.dbcr0 & DBCR0_IC) |
355 | #define clear_single_step(regs) (current->thread.dbcr0 &= ~DBCR0_IC) | 355 | #define clear_single_step(regs) (current->thread.debug.dbcr0 &= ~DBCR0_IC) |
356 | 356 | ||
357 | #else | 357 | #else |
358 | /* On non-4xx, the reason for the machine check or program | 358 | /* On non-4xx, the reason for the machine check or program |
@@ -1486,7 +1486,7 @@ static void handle_debug(struct pt_regs *regs, unsigned long debug_status) | |||
1486 | if (debug_status & (DBSR_DAC1R | DBSR_DAC1W)) { | 1486 | if (debug_status & (DBSR_DAC1R | DBSR_DAC1W)) { |
1487 | dbcr_dac(current) &= ~(DBCR_DAC1R | DBCR_DAC1W); | 1487 | dbcr_dac(current) &= ~(DBCR_DAC1R | DBCR_DAC1W); |
1488 | #ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE | 1488 | #ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE |
1489 | current->thread.dbcr2 &= ~DBCR2_DAC12MODE; | 1489 | current->thread.debug.dbcr2 &= ~DBCR2_DAC12MODE; |
1490 | #endif | 1490 | #endif |
1491 | do_send_trap(regs, mfspr(SPRN_DAC1), debug_status, TRAP_HWBKPT, | 1491 | do_send_trap(regs, mfspr(SPRN_DAC1), debug_status, TRAP_HWBKPT, |
1492 | 5); | 1492 | 5); |
@@ -1497,24 +1497,24 @@ static void handle_debug(struct pt_regs *regs, unsigned long debug_status) | |||
1497 | 6); | 1497 | 6); |
1498 | changed |= 0x01; | 1498 | changed |= 0x01; |
1499 | } else if (debug_status & DBSR_IAC1) { | 1499 | } else if (debug_status & DBSR_IAC1) { |
1500 | current->thread.dbcr0 &= ~DBCR0_IAC1; | 1500 | current->thread.debug.dbcr0 &= ~DBCR0_IAC1; |
1501 | dbcr_iac_range(current) &= ~DBCR_IAC12MODE; | 1501 | dbcr_iac_range(current) &= ~DBCR_IAC12MODE; |
1502 | do_send_trap(regs, mfspr(SPRN_IAC1), debug_status, TRAP_HWBKPT, | 1502 | do_send_trap(regs, mfspr(SPRN_IAC1), debug_status, TRAP_HWBKPT, |
1503 | 1); | 1503 | 1); |
1504 | changed |= 0x01; | 1504 | changed |= 0x01; |
1505 | } else if (debug_status & DBSR_IAC2) { | 1505 | } else if (debug_status & DBSR_IAC2) { |
1506 | current->thread.dbcr0 &= ~DBCR0_IAC2; | 1506 | current->thread.debug.dbcr0 &= ~DBCR0_IAC2; |
1507 | do_send_trap(regs, mfspr(SPRN_IAC2), debug_status, TRAP_HWBKPT, | 1507 | do_send_trap(regs, mfspr(SPRN_IAC2), debug_status, TRAP_HWBKPT, |
1508 | 2); | 1508 | 2); |
1509 | changed |= 0x01; | 1509 | changed |= 0x01; |
1510 | } else if (debug_status & DBSR_IAC3) { | 1510 | } else if (debug_status & DBSR_IAC3) { |
1511 | current->thread.dbcr0 &= ~DBCR0_IAC3; | 1511 | current->thread.debug.dbcr0 &= ~DBCR0_IAC3; |
1512 | dbcr_iac_range(current) &= ~DBCR_IAC34MODE; | 1512 | dbcr_iac_range(current) &= ~DBCR_IAC34MODE; |
1513 | do_send_trap(regs, mfspr(SPRN_IAC3), debug_status, TRAP_HWBKPT, | 1513 | do_send_trap(regs, mfspr(SPRN_IAC3), debug_status, TRAP_HWBKPT, |
1514 | 3); | 1514 | 3); |
1515 | changed |= 0x01; | 1515 | changed |= 0x01; |
1516 | } else if (debug_status & DBSR_IAC4) { | 1516 | } else if (debug_status & DBSR_IAC4) { |
1517 | current->thread.dbcr0 &= ~DBCR0_IAC4; | 1517 | current->thread.debug.dbcr0 &= ~DBCR0_IAC4; |
1518 | do_send_trap(regs, mfspr(SPRN_IAC4), debug_status, TRAP_HWBKPT, | 1518 | do_send_trap(regs, mfspr(SPRN_IAC4), debug_status, TRAP_HWBKPT, |
1519 | 4); | 1519 | 4); |
1520 | changed |= 0x01; | 1520 | changed |= 0x01; |
@@ -1524,19 +1524,20 @@ static void handle_debug(struct pt_regs *regs, unsigned long debug_status) | |||
1524 | * Check all other debug flags and see if that bit needs to be turned | 1524 | * Check all other debug flags and see if that bit needs to be turned |
1525 | * back on or not. | 1525 | * back on or not. |
1526 | */ | 1526 | */ |
1527 | if (DBCR_ACTIVE_EVENTS(current->thread.dbcr0, current->thread.dbcr1)) | 1527 | if (DBCR_ACTIVE_EVENTS(current->thread.debug.dbcr0, |
1528 | current->thread.debug.dbcr1)) | ||
1528 | regs->msr |= MSR_DE; | 1529 | regs->msr |= MSR_DE; |
1529 | else | 1530 | else |
1530 | /* Make sure the IDM flag is off */ | 1531 | /* Make sure the IDM flag is off */ |
1531 | current->thread.dbcr0 &= ~DBCR0_IDM; | 1532 | current->thread.debug.dbcr0 &= ~DBCR0_IDM; |
1532 | 1533 | ||
1533 | if (changed & 0x01) | 1534 | if (changed & 0x01) |
1534 | mtspr(SPRN_DBCR0, current->thread.dbcr0); | 1535 | mtspr(SPRN_DBCR0, current->thread.debug.dbcr0); |
1535 | } | 1536 | } |
1536 | 1537 | ||
1537 | void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status) | 1538 | void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status) |
1538 | { | 1539 | { |
1539 | current->thread.dbsr = debug_status; | 1540 | current->thread.debug.dbsr = debug_status; |
1540 | 1541 | ||
1541 | /* Hack alert: On BookE, Branch Taken stops on the branch itself, while | 1542 | /* Hack alert: On BookE, Branch Taken stops on the branch itself, while |
1542 | * on server, it stops on the target of the branch. In order to simulate | 1543 | * on server, it stops on the target of the branch. In order to simulate |
@@ -1553,8 +1554,8 @@ void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status) | |||
1553 | 1554 | ||
1554 | /* Do the single step trick only when coming from userspace */ | 1555 | /* Do the single step trick only when coming from userspace */ |
1555 | if (user_mode(regs)) { | 1556 | if (user_mode(regs)) { |
1556 | current->thread.dbcr0 &= ~DBCR0_BT; | 1557 | current->thread.debug.dbcr0 &= ~DBCR0_BT; |
1557 | current->thread.dbcr0 |= DBCR0_IDM | DBCR0_IC; | 1558 | current->thread.debug.dbcr0 |= DBCR0_IDM | DBCR0_IC; |
1558 | regs->msr |= MSR_DE; | 1559 | regs->msr |= MSR_DE; |
1559 | return; | 1560 | return; |
1560 | } | 1561 | } |
@@ -1582,13 +1583,13 @@ void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status) | |||
1582 | return; | 1583 | return; |
1583 | 1584 | ||
1584 | if (user_mode(regs)) { | 1585 | if (user_mode(regs)) { |
1585 | current->thread.dbcr0 &= ~DBCR0_IC; | 1586 | current->thread.debug.dbcr0 &= ~DBCR0_IC; |
1586 | if (DBCR_ACTIVE_EVENTS(current->thread.dbcr0, | 1587 | if (DBCR_ACTIVE_EVENTS(current->thread.debug.dbcr0, |
1587 | current->thread.dbcr1)) | 1588 | current->thread.debug.dbcr1)) |
1588 | regs->msr |= MSR_DE; | 1589 | regs->msr |= MSR_DE; |
1589 | else | 1590 | else |
1590 | /* Make sure the IDM bit is off */ | 1591 | /* Make sure the IDM bit is off */ |
1591 | current->thread.dbcr0 &= ~DBCR0_IDM; | 1592 | current->thread.debug.dbcr0 &= ~DBCR0_IDM; |
1592 | } | 1593 | } |
1593 | 1594 | ||
1594 | _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip); | 1595 | _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip); |