Skip to content

Commit 5736b1b

Browse files
keesPeter Zijlstra
authored andcommitted
x86/paravirt: Remove clobber bitmask from .parainstructions
The u16 "clobber" value is not used in .parainstructions since commit 27876f3 ("x86/paravirt: Remove clobbers from struct paravirt_patch_site") Remove the u16 from the section macro, the argument from all macros, and all now-unused CLBR_* macros. Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0ce096d commit 5736b1b

File tree

1 file changed

+12
-49
lines changed

1 file changed

+12
-49
lines changed

arch/x86/include/asm/paravirt_types.h

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,6 @@ enum paravirt_lazy_mode {
2020

2121
#ifdef CONFIG_PARAVIRT
2222

23-
/* Bitmask of what can be clobbered: usually at least eax. */
24-
#define CLBR_EAX (1 << 0)
25-
#define CLBR_ECX (1 << 1)
26-
#define CLBR_EDX (1 << 2)
27-
#define CLBR_EDI (1 << 3)
28-
29-
#ifdef CONFIG_X86_32
30-
/* CLBR_ANY should match all regs platform has. For i386, that's just it */
31-
#define CLBR_ANY ((1 << 4) - 1)
32-
33-
#define CLBR_ARG_REGS (CLBR_EAX | CLBR_EDX | CLBR_ECX)
34-
#define CLBR_RET_REG (CLBR_EAX | CLBR_EDX)
35-
#else
36-
#define CLBR_RAX CLBR_EAX
37-
#define CLBR_RCX CLBR_ECX
38-
#define CLBR_RDX CLBR_EDX
39-
#define CLBR_RDI CLBR_EDI
40-
#define CLBR_RSI (1 << 4)
41-
#define CLBR_R8 (1 << 5)
42-
#define CLBR_R9 (1 << 6)
43-
#define CLBR_R10 (1 << 7)
44-
#define CLBR_R11 (1 << 8)
45-
46-
#define CLBR_ANY ((1 << 9) - 1)
47-
48-
#define CLBR_ARG_REGS (CLBR_RDI | CLBR_RSI | CLBR_RDX | \
49-
CLBR_RCX | CLBR_R8 | CLBR_R9)
50-
#define CLBR_RET_REG (CLBR_RAX)
51-
52-
#endif /* X86_64 */
53-
5423
#ifndef __ASSEMBLY__
5524

5625
#include <asm/desc_defs.h>
@@ -297,27 +266,23 @@ extern struct paravirt_patch_template pv_ops;
297266
#define paravirt_type(op) \
298267
[paravirt_typenum] "i" (PARAVIRT_PATCH(op)), \
299268
[paravirt_opptr] "m" (pv_ops.op)
300-
#define paravirt_clobber(clobber) \
301-
[paravirt_clobber] "i" (clobber)
302-
303269
/*
304270
* Generate some code, and mark it as patchable by the
305271
* apply_paravirt() alternate instruction patcher.
306272
*/
307-
#define _paravirt_alt(insn_string, type, clobber) \
273+
#define _paravirt_alt(insn_string, type) \
308274
"771:\n\t" insn_string "\n" "772:\n" \
309275
".pushsection .parainstructions,\"a\"\n" \
310276
_ASM_ALIGN "\n" \
311277
_ASM_PTR " 771b\n" \
312278
" .byte " type "\n" \
313279
" .byte 772b-771b\n" \
314-
" .short " clobber "\n" \
315280
_ASM_ALIGN "\n" \
316281
".popsection\n"
317282

318283
/* Generate patchable code, with the default asm parameters. */
319284
#define paravirt_alt(insn_string) \
320-
_paravirt_alt(insn_string, "%c[paravirt_typenum]", "%c[paravirt_clobber]")
285+
_paravirt_alt(insn_string, "%c[paravirt_typenum]")
321286

322287
/* Simple instruction patching code. */
323288
#define NATIVE_LABEL(a,x,b) "\n\t.globl " a #x "_" #b "\n" a #x "_" #b ":\n\t"
@@ -469,20 +434,19 @@ int paravirt_disable_iospace(void);
469434
})
470435

471436

472-
#define ____PVOP_CALL(ret, op, clbr, call_clbr, extra_clbr, ...) \
437+
#define ____PVOP_CALL(ret, op, call_clbr, extra_clbr, ...) \
473438
({ \
474439
PVOP_CALL_ARGS; \
475440
PVOP_TEST_NULL(op); \
476441
asm volatile(paravirt_alt(PARAVIRT_CALL) \
477442
: call_clbr, ASM_CALL_CONSTRAINT \
478443
: paravirt_type(op), \
479-
paravirt_clobber(clbr), \
480444
##__VA_ARGS__ \
481445
: "memory", "cc" extra_clbr); \
482446
ret; \
483447
})
484448

485-
#define ____PVOP_ALT_CALL(ret, op, alt, cond, clbr, call_clbr, \
449+
#define ____PVOP_ALT_CALL(ret, op, alt, cond, call_clbr, \
486450
extra_clbr, ...) \
487451
({ \
488452
PVOP_CALL_ARGS; \
@@ -491,45 +455,44 @@ int paravirt_disable_iospace(void);
491455
alt, cond) \
492456
: call_clbr, ASM_CALL_CONSTRAINT \
493457
: paravirt_type(op), \
494-
paravirt_clobber(clbr), \
495458
##__VA_ARGS__ \
496459
: "memory", "cc" extra_clbr); \
497460
ret; \
498461
})
499462

500463
#define __PVOP_CALL(rettype, op, ...) \
501-
____PVOP_CALL(PVOP_RETVAL(rettype), op, CLBR_ANY, \
464+
____PVOP_CALL(PVOP_RETVAL(rettype), op, \
502465
PVOP_CALL_CLOBBERS, EXTRA_CLOBBERS, ##__VA_ARGS__)
503466

504467
#define __PVOP_ALT_CALL(rettype, op, alt, cond, ...) \
505-
____PVOP_ALT_CALL(PVOP_RETVAL(rettype), op, alt, cond, CLBR_ANY,\
468+
____PVOP_ALT_CALL(PVOP_RETVAL(rettype), op, alt, cond, \
506469
PVOP_CALL_CLOBBERS, EXTRA_CLOBBERS, \
507470
##__VA_ARGS__)
508471

509472
#define __PVOP_CALLEESAVE(rettype, op, ...) \
510-
____PVOP_CALL(PVOP_RETVAL(rettype), op.func, CLBR_RET_REG, \
473+
____PVOP_CALL(PVOP_RETVAL(rettype), op.func, \
511474
PVOP_CALLEE_CLOBBERS, , ##__VA_ARGS__)
512475

513476
#define __PVOP_ALT_CALLEESAVE(rettype, op, alt, cond, ...) \
514477
____PVOP_ALT_CALL(PVOP_RETVAL(rettype), op.func, alt, cond, \
515-
CLBR_RET_REG, PVOP_CALLEE_CLOBBERS, , ##__VA_ARGS__)
478+
PVOP_CALLEE_CLOBBERS, , ##__VA_ARGS__)
516479

517480

518481
#define __PVOP_VCALL(op, ...) \
519-
(void)____PVOP_CALL(, op, CLBR_ANY, PVOP_VCALL_CLOBBERS, \
482+
(void)____PVOP_CALL(, op, PVOP_VCALL_CLOBBERS, \
520483
VEXTRA_CLOBBERS, ##__VA_ARGS__)
521484

522485
#define __PVOP_ALT_VCALL(op, alt, cond, ...) \
523-
(void)____PVOP_ALT_CALL(, op, alt, cond, CLBR_ANY, \
486+
(void)____PVOP_ALT_CALL(, op, alt, cond, \
524487
PVOP_VCALL_CLOBBERS, VEXTRA_CLOBBERS, \
525488
##__VA_ARGS__)
526489

527490
#define __PVOP_VCALLEESAVE(op, ...) \
528-
(void)____PVOP_CALL(, op.func, CLBR_RET_REG, \
491+
(void)____PVOP_CALL(, op.func, \
529492
PVOP_VCALLEE_CLOBBERS, , ##__VA_ARGS__)
530493

531494
#define __PVOP_ALT_VCALLEESAVE(op, alt, cond, ...) \
532-
(void)____PVOP_ALT_CALL(, op.func, alt, cond, CLBR_RET_REG, \
495+
(void)____PVOP_ALT_CALL(, op.func, alt, cond, \
533496
PVOP_VCALLEE_CLOBBERS, , ##__VA_ARGS__)
534497

535498

0 commit comments

Comments
 (0)