diff options
author | Bharat Bhushan <r65777@freescale.com> | 2013-07-04 02:15:46 -0400 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2013-10-18 19:44:49 -0400 |
commit | 51ae8d4a2b9e4aa9a502061b9c39168e08829b94 (patch) | |
tree | e6ff6805b3cd6c00483a087dccbca0e235e96644 /arch/powerpc/kernel/traps.c | |
parent | 660970fe97f86c0175576b4a942ebd29fb2ec64e (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>
Acked-by: Michael Neuling <mikey@neuling.org>
[scottwood@freescale.com: removed obvious debug_reg comment]
Signed-off-by: Scott Wood <scottwood@freescale.com>
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 36a1f95a2a36..f686686ca0aa 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 |
@@ -1489,7 +1489,7 @@ static void handle_debug(struct pt_regs *regs, unsigned long debug_status) | |||
1489 | if (debug_status & (DBSR_DAC1R | DBSR_DAC1W)) { | 1489 | if (debug_status & (DBSR_DAC1R | DBSR_DAC1W)) { |
1490 | dbcr_dac(current) &= ~(DBCR_DAC1R | DBCR_DAC1W); | 1490 | dbcr_dac(current) &= ~(DBCR_DAC1R | DBCR_DAC1W); |
1491 | #ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE | 1491 | #ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE |
1492 | current->thread.dbcr2 &= ~DBCR2_DAC12MODE; | 1492 | current->thread.debug.dbcr2 &= ~DBCR2_DAC12MODE; |
1493 | #endif | 1493 | #endif |
1494 | do_send_trap(regs, mfspr(SPRN_DAC1), debug_status, TRAP_HWBKPT, | 1494 | do_send_trap(regs, mfspr(SPRN_DAC1), debug_status, TRAP_HWBKPT, |
1495 | 5); | 1495 | 5); |
@@ -1500,24 +1500,24 @@ static void handle_debug(struct pt_regs *regs, unsigned long debug_status) | |||
1500 | 6); | 1500 | 6); |
1501 | changed |= 0x01; | 1501 | changed |= 0x01; |
1502 | } else if (debug_status & DBSR_IAC1) { | 1502 | } else if (debug_status & DBSR_IAC1) { |
1503 | current->thread.dbcr0 &= ~DBCR0_IAC1; | 1503 | current->thread.debug.dbcr0 &= ~DBCR0_IAC1; |
1504 | dbcr_iac_range(current) &= ~DBCR_IAC12MODE; | 1504 | dbcr_iac_range(current) &= ~DBCR_IAC12MODE; |
1505 | do_send_trap(regs, mfspr(SPRN_IAC1), debug_status, TRAP_HWBKPT, | 1505 | do_send_trap(regs, mfspr(SPRN_IAC1), debug_status, TRAP_HWBKPT, |
1506 | 1); | 1506 | 1); |
1507 | changed |= 0x01; | 1507 | changed |= 0x01; |
1508 | } else if (debug_status & DBSR_IAC2) { | 1508 | } else if (debug_status & DBSR_IAC2) { |
1509 | current->thread.dbcr0 &= ~DBCR0_IAC2; | 1509 | current->thread.debug.dbcr0 &= ~DBCR0_IAC2; |
1510 | do_send_trap(regs, mfspr(SPRN_IAC2), debug_status, TRAP_HWBKPT, | 1510 | do_send_trap(regs, mfspr(SPRN_IAC2), debug_status, TRAP_HWBKPT, |
1511 | 2); | 1511 | 2); |
1512 | changed |= 0x01; | 1512 | changed |= 0x01; |
1513 | } else if (debug_status & DBSR_IAC3) { | 1513 | } else if (debug_status & DBSR_IAC3) { |
1514 | current->thread.dbcr0 &= ~DBCR0_IAC3; | 1514 | current->thread.debug.dbcr0 &= ~DBCR0_IAC3; |
1515 | dbcr_iac_range(current) &= ~DBCR_IAC34MODE; | 1515 | dbcr_iac_range(current) &= ~DBCR_IAC34MODE; |
1516 | do_send_trap(regs, mfspr(SPRN_IAC3), debug_status, TRAP_HWBKPT, | 1516 | do_send_trap(regs, mfspr(SPRN_IAC3), debug_status, TRAP_HWBKPT, |
1517 | 3); | 1517 | 3); |
1518 | changed |= 0x01; | 1518 | changed |= 0x01; |
1519 | } else if (debug_status & DBSR_IAC4) { | 1519 | } else if (debug_status & DBSR_IAC4) { |
1520 | current->thread.dbcr0 &= ~DBCR0_IAC4; | 1520 | current->thread.debug.dbcr0 &= ~DBCR0_IAC4; |
1521 | do_send_trap(regs, mfspr(SPRN_IAC4), debug_status, TRAP_HWBKPT, | 1521 | do_send_trap(regs, mfspr(SPRN_IAC4), debug_status, TRAP_HWBKPT, |
1522 | 4); | 1522 | 4); |
1523 | changed |= 0x01; | 1523 | changed |= 0x01; |
@@ -1527,19 +1527,20 @@ static void handle_debug(struct pt_regs *regs, unsigned long debug_status) | |||
1527 | * Check all other debug flags and see if that bit needs to be turned | 1527 | * Check all other debug flags and see if that bit needs to be turned |
1528 | * back on or not. | 1528 | * back on or not. |
1529 | */ | 1529 | */ |
1530 | if (DBCR_ACTIVE_EVENTS(current->thread.dbcr0, current->thread.dbcr1)) | 1530 | if (DBCR_ACTIVE_EVENTS(current->thread.debug.dbcr0, |
1531 | current->thread.debug.dbcr1)) | ||
1531 | regs->msr |= MSR_DE; | 1532 | regs->msr |= MSR_DE; |
1532 | else | 1533 | else |
1533 | /* Make sure the IDM flag is off */ | 1534 | /* Make sure the IDM flag is off */ |
1534 | current->thread.dbcr0 &= ~DBCR0_IDM; | 1535 | current->thread.debug.dbcr0 &= ~DBCR0_IDM; |
1535 | 1536 | ||
1536 | if (changed & 0x01) | 1537 | if (changed & 0x01) |
1537 | mtspr(SPRN_DBCR0, current->thread.dbcr0); | 1538 | mtspr(SPRN_DBCR0, current->thread.debug.dbcr0); |
1538 | } | 1539 | } |
1539 | 1540 | ||
1540 | void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status) | 1541 | void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status) |
1541 | { | 1542 | { |
1542 | current->thread.dbsr = debug_status; | 1543 | current->thread.debug.dbsr = debug_status; |
1543 | 1544 | ||
1544 | /* Hack alert: On BookE, Branch Taken stops on the branch itself, while | 1545 | /* Hack alert: On BookE, Branch Taken stops on the branch itself, while |
1545 | * on server, it stops on the target of the branch. In order to simulate | 1546 | * on server, it stops on the target of the branch. In order to simulate |
@@ -1556,8 +1557,8 @@ void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status) | |||
1556 | 1557 | ||
1557 | /* Do the single step trick only when coming from userspace */ | 1558 | /* Do the single step trick only when coming from userspace */ |
1558 | if (user_mode(regs)) { | 1559 | if (user_mode(regs)) { |
1559 | current->thread.dbcr0 &= ~DBCR0_BT; | 1560 | current->thread.debug.dbcr0 &= ~DBCR0_BT; |
1560 | current->thread.dbcr0 |= DBCR0_IDM | DBCR0_IC; | 1561 | current->thread.debug.dbcr0 |= DBCR0_IDM | DBCR0_IC; |
1561 | regs->msr |= MSR_DE; | 1562 | regs->msr |= MSR_DE; |
1562 | return; | 1563 | return; |
1563 | } | 1564 | } |
@@ -1585,13 +1586,13 @@ void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status) | |||
1585 | return; | 1586 | return; |
1586 | 1587 | ||
1587 | if (user_mode(regs)) { | 1588 | if (user_mode(regs)) { |
1588 | current->thread.dbcr0 &= ~DBCR0_IC; | 1589 | current->thread.debug.dbcr0 &= ~DBCR0_IC; |
1589 | if (DBCR_ACTIVE_EVENTS(current->thread.dbcr0, | 1590 | if (DBCR_ACTIVE_EVENTS(current->thread.debug.dbcr0, |
1590 | current->thread.dbcr1)) | 1591 | current->thread.debug.dbcr1)) |
1591 | regs->msr |= MSR_DE; | 1592 | regs->msr |= MSR_DE; |
1592 | else | 1593 | else |
1593 | /* Make sure the IDM bit is off */ | 1594 | /* Make sure the IDM bit is off */ |
1594 | current->thread.dbcr0 &= ~DBCR0_IDM; | 1595 | current->thread.debug.dbcr0 &= ~DBCR0_IDM; |
1595 | } | 1596 | } |
1596 | 1597 | ||
1597 | _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip); | 1598 | _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip); |