Skip to content

Commit 00e8f71

Browse files
keessuryasaimadhu
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]> Reviewed-by: Juergen Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9abf231 commit 00e8f71

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
@@ -2,37 +2,6 @@
22
#ifndef _ASM_X86_PARAVIRT_TYPES_H
33
#define _ASM_X86_PARAVIRT_TYPES_H
44

5-
/* Bitmask of what can be clobbered: usually at least eax. */
6-
#define CLBR_EAX (1 << 0)
7-
#define CLBR_ECX (1 << 1)
8-
#define CLBR_EDX (1 << 2)
9-
#define CLBR_EDI (1 << 3)
10-
11-
#ifdef CONFIG_X86_32
12-
/* CLBR_ANY should match all regs platform has. For i386, that's just it */
13-
#define CLBR_ANY ((1 << 4) - 1)
14-
15-
#define CLBR_ARG_REGS (CLBR_EAX | CLBR_EDX | CLBR_ECX)
16-
#define CLBR_RET_REG (CLBR_EAX | CLBR_EDX)
17-
#else
18-
#define CLBR_RAX CLBR_EAX
19-
#define CLBR_RCX CLBR_ECX
20-
#define CLBR_RDX CLBR_EDX
21-
#define CLBR_RDI CLBR_EDI
22-
#define CLBR_RSI (1 << 4)
23-
#define CLBR_R8 (1 << 5)
24-
#define CLBR_R9 (1 << 6)
25-
#define CLBR_R10 (1 << 7)
26-
#define CLBR_R11 (1 << 8)
27-
28-
#define CLBR_ANY ((1 << 9) - 1)
29-
30-
#define CLBR_ARG_REGS (CLBR_RDI | CLBR_RSI | CLBR_RDX | \
31-
CLBR_RCX | CLBR_R8 | CLBR_R9)
32-
#define CLBR_RET_REG (CLBR_RAX)
33-
34-
#endif /* X86_64 */
35-
365
#ifndef __ASSEMBLY__
376

387
#include <asm/desc_defs.h>
@@ -279,27 +248,23 @@ extern struct paravirt_patch_template pv_ops;
279248
#define paravirt_type(op) \
280249
[paravirt_typenum] "i" (PARAVIRT_PATCH(op)), \
281250
[paravirt_opptr] "m" (pv_ops.op)
282-
#define paravirt_clobber(clobber) \
283-
[paravirt_clobber] "i" (clobber)
284-
285251
/*
286252
* Generate some code, and mark it as patchable by the
287253
* apply_paravirt() alternate instruction patcher.
288254
*/
289-
#define _paravirt_alt(insn_string, type, clobber) \
255+
#define _paravirt_alt(insn_string, type) \
290256
"771:\n\t" insn_string "\n" "772:\n" \
291257
".pushsection .parainstructions,\"a\"\n" \
292258
_ASM_ALIGN "\n" \
293259
_ASM_PTR " 771b\n" \
294260
" .byte " type "\n" \
295261
" .byte 772b-771b\n" \
296-
" .short " clobber "\n" \
297262
_ASM_ALIGN "\n" \
298263
".popsection\n"
299264

300265
/* Generate patchable code, with the default asm parameters. */
301266
#define paravirt_alt(insn_string) \
302-
_paravirt_alt(insn_string, "%c[paravirt_typenum]", "%c[paravirt_clobber]")
267+
_paravirt_alt(insn_string, "%c[paravirt_typenum]")
303268

304269
/* Simple instruction patching code. */
305270
#define NATIVE_LABEL(a,x,b) "\n\t.globl " a #x "_" #b "\n" a #x "_" #b ":\n\t"
@@ -451,20 +416,19 @@ int paravirt_disable_iospace(void);
451416
})
452417

453418

454-
#define ____PVOP_CALL(ret, op, clbr, call_clbr, extra_clbr, ...) \
419+
#define ____PVOP_CALL(ret, op, call_clbr, extra_clbr, ...) \
455420
({ \
456421
PVOP_CALL_ARGS; \
457422
PVOP_TEST_NULL(op); \
458423
asm volatile(paravirt_alt(PARAVIRT_CALL) \
459424
: call_clbr, ASM_CALL_CONSTRAINT \
460425
: paravirt_type(op), \
461-
paravirt_clobber(clbr), \
462426
##__VA_ARGS__ \
463427
: "memory", "cc" extra_clbr); \
464428
ret; \
465429
})
466430

467-
#define ____PVOP_ALT_CALL(ret, op, alt, cond, clbr, call_clbr, \
431+
#define ____PVOP_ALT_CALL(ret, op, alt, cond, call_clbr, \
468432
extra_clbr, ...) \
469433
({ \
470434
PVOP_CALL_ARGS; \
@@ -473,45 +437,44 @@ int paravirt_disable_iospace(void);
473437
alt, cond) \
474438
: call_clbr, ASM_CALL_CONSTRAINT \
475439
: paravirt_type(op), \
476-
paravirt_clobber(clbr), \
477440
##__VA_ARGS__ \
478441
: "memory", "cc" extra_clbr); \
479442
ret; \
480443
})
481444

482445
#define __PVOP_CALL(rettype, op, ...) \
483-
____PVOP_CALL(PVOP_RETVAL(rettype), op, CLBR_ANY, \
446+
____PVOP_CALL(PVOP_RETVAL(rettype), op, \
484447
PVOP_CALL_CLOBBERS, EXTRA_CLOBBERS, ##__VA_ARGS__)
485448

486449
#define __PVOP_ALT_CALL(rettype, op, alt, cond, ...) \
487-
____PVOP_ALT_CALL(PVOP_RETVAL(rettype), op, alt, cond, CLBR_ANY,\
450+
____PVOP_ALT_CALL(PVOP_RETVAL(rettype), op, alt, cond, \
488451
PVOP_CALL_CLOBBERS, EXTRA_CLOBBERS, \
489452
##__VA_ARGS__)
490453

491454
#define __PVOP_CALLEESAVE(rettype, op, ...) \
492-
____PVOP_CALL(PVOP_RETVAL(rettype), op.func, CLBR_RET_REG, \
455+
____PVOP_CALL(PVOP_RETVAL(rettype), op.func, \
493456
PVOP_CALLEE_CLOBBERS, , ##__VA_ARGS__)
494457

495458
#define __PVOP_ALT_CALLEESAVE(rettype, op, alt, cond, ...) \
496459
____PVOP_ALT_CALL(PVOP_RETVAL(rettype), op.func, alt, cond, \
497-
CLBR_RET_REG, PVOP_CALLEE_CLOBBERS, , ##__VA_ARGS__)
460+
PVOP_CALLEE_CLOBBERS, , ##__VA_ARGS__)
498461

499462

500463
#define __PVOP_VCALL(op, ...) \
501-
(void)____PVOP_CALL(, op, CLBR_ANY, PVOP_VCALL_CLOBBERS, \
464+
(void)____PVOP_CALL(, op, PVOP_VCALL_CLOBBERS, \
502465
VEXTRA_CLOBBERS, ##__VA_ARGS__)
503466

504467
#define __PVOP_ALT_VCALL(op, alt, cond, ...) \
505-
(void)____PVOP_ALT_CALL(, op, alt, cond, CLBR_ANY, \
468+
(void)____PVOP_ALT_CALL(, op, alt, cond, \
506469
PVOP_VCALL_CLOBBERS, VEXTRA_CLOBBERS, \
507470
##__VA_ARGS__)
508471

509472
#define __PVOP_VCALLEESAVE(op, ...) \
510-
(void)____PVOP_CALL(, op.func, CLBR_RET_REG, \
473+
(void)____PVOP_CALL(, op.func, \
511474
PVOP_VCALLEE_CLOBBERS, , ##__VA_ARGS__)
512475

513476
#define __PVOP_ALT_VCALLEESAVE(op, alt, cond, ...) \
514-
(void)____PVOP_ALT_CALL(, op.func, alt, cond, CLBR_RET_REG, \
477+
(void)____PVOP_ALT_CALL(, op.func, alt, cond, \
515478
PVOP_VCALLEE_CLOBBERS, , ##__VA_ARGS__)
516479

517480

0 commit comments

Comments
 (0)