2019-08-06 05:09:51 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2019 Atmosphère-NX
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2020-01-14 00:58:31 +00:00
|
|
|
#include "asm_macros.s"
|
2019-08-06 05:09:51 +01:00
|
|
|
|
2020-01-31 18:42:16 +00:00
|
|
|
.altmacro
|
|
|
|
|
|
|
|
.macro LOAD_DBG_REG_PAIRS what, id
|
2020-02-02 23:47:05 +00:00
|
|
|
ldp x2, x3, [x0, #-0x10]!
|
2020-01-31 18:42:16 +00:00
|
|
|
msr dbg\what\()cr\id\()_el1, x2
|
|
|
|
msr dbg\what\()vr\id\()_el1, x3
|
|
|
|
.if \id != 0
|
|
|
|
LOAD_DBG_REG_PAIRS \what, %(\id - 1)
|
|
|
|
.endif
|
|
|
|
.endm
|
|
|
|
|
2019-08-06 05:09:51 +01:00
|
|
|
// Precondition: x1 <= 16
|
2020-01-14 00:58:31 +00:00
|
|
|
FUNCTION loadBreakpointRegs
|
2019-08-06 05:09:51 +01:00
|
|
|
// x1 = number
|
2020-01-19 18:18:48 +00:00
|
|
|
dmb ish
|
2020-01-09 22:47:22 +00:00
|
|
|
|
2019-08-06 05:09:51 +01:00
|
|
|
adr x16, 1f
|
2020-01-31 18:42:16 +00:00
|
|
|
add x0, x0, #(MAX_BCR * 8)
|
|
|
|
mov x4, #(MAX_BCR * 12)
|
2019-08-06 05:09:51 +01:00
|
|
|
sub x4, x4, x1,lsl #3
|
|
|
|
sub x4, x4, x1,lsl #2
|
|
|
|
add x16, x16, x4
|
|
|
|
br x16
|
|
|
|
|
|
|
|
1:
|
2020-01-31 23:04:22 +00:00
|
|
|
LOAD_DBG_REG_PAIRS b, %(MAX_BCR - 1)
|
2020-01-31 18:42:16 +00:00
|
|
|
|
2020-01-19 18:18:48 +00:00
|
|
|
dsb ish
|
2019-08-06 05:09:51 +01:00
|
|
|
isb
|
|
|
|
ret
|
2020-01-14 00:58:31 +00:00
|
|
|
END_FUNCTION
|
2019-08-06 05:09:51 +01:00
|
|
|
|
|
|
|
// Precondition: x1 <= 16
|
2020-01-14 00:58:31 +00:00
|
|
|
FUNCTION loadWatchpointRegs
|
2019-08-06 05:09:51 +01:00
|
|
|
// x1 = number
|
2020-01-19 18:18:48 +00:00
|
|
|
dmb ish
|
2020-01-09 22:47:22 +00:00
|
|
|
|
2019-08-06 05:09:51 +01:00
|
|
|
adr x16, 1f
|
2020-01-31 18:42:16 +00:00
|
|
|
add x0, x0, #(MAX_WCR * 8)
|
|
|
|
mov x4, #(MAX_WCR * 12)
|
2019-08-06 05:09:51 +01:00
|
|
|
sub x4, x4, x1,lsl #3
|
|
|
|
sub x4, x4, x1,lsl #2
|
|
|
|
add x16, x16, x4
|
|
|
|
br x16
|
|
|
|
|
|
|
|
1:
|
2020-01-31 23:04:22 +00:00
|
|
|
LOAD_DBG_REG_PAIRS w, %(MAX_WCR - 1)
|
2020-01-31 18:42:16 +00:00
|
|
|
|
2020-01-19 18:18:48 +00:00
|
|
|
dsb ish
|
2019-08-06 05:09:51 +01:00
|
|
|
isb
|
|
|
|
ret
|
2020-01-14 00:58:31 +00:00
|
|
|
END_FUNCTION
|