diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S index 43c94e7a2c1d08add180e9d257281cc44c26673d..de1ab9843c31b6fbd1fd28c97ceefd8374881ce9 100644 --- a/arch/arm64/kernel/hyp-stub.S +++ b/arch/arm64/kernel/hyp-stub.S @@ -17,17 +17,17 @@ #include // Warning, hardcoded register allocation -// This will clobber x1 and x2. -.macro check_override idreg, fld, pass, fail - mrs x1, \idreg\()_el1 - ubfx x1, x1, #\fld, #4 +// This will clobber x1 and x2, and expect x1 to contain +// the id register value as read from the HW +.macro __check_override idreg, fld, width, pass, fail + ubfx x1, x1, #\fld, #\width cbz x1, \fail adr_l x1, \idreg\()_override ldr x2, [x1, FTR_OVR_VAL_OFFSET] ldr x1, [x1, FTR_OVR_MASK_OFFSET] - ubfx x2, x2, #\fld, #4 - ubfx x1, x1, #\fld, #4 + ubfx x2, x2, #\fld, #\width + ubfx x1, x1, #\fld, #\width cmp x1, xzr and x2, x2, x1 csinv x2, x2, xzr, ne @@ -35,6 +35,11 @@ b \fail .endm +.macro check_override idreg, fld, pass, fail + mrs x1, \idreg\()_el1 + __check_override \idreg \fld 4 \pass \fail +.endm + .text .pushsection .hyp.text, "ax"