Merge branch 'x86-paravirt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / arch / x86 / kernel / alternative.c
index c3468b5242fdeec3edb0f81704049ed1bc658fc7..99ef8b6f9a1a5abf2e89c37a79da906d2103b66c 100644 (file)
@@ -278,7 +278,7 @@ static inline bool is_jmp(const u8 opcode)
 }
 
 static void __init_or_module
-recompute_jump(struct alt_instr *a, u8 *orig_insn, u8 *repl_insn, u8 *insnbuf)
+recompute_jump(struct alt_instr *a, u8 *orig_insn, u8 *repl_insn, u8 *insn_buff)
 {
        u8 *next_rip, *tgt_rip;
        s32 n_dspl, o_dspl;
@@ -287,7 +287,7 @@ recompute_jump(struct alt_instr *a, u8 *orig_insn, u8 *repl_insn, u8 *insnbuf)
        if (a->replacementlen != 5)
                return;
 
-       o_dspl = *(s32 *)(insnbuf + 1);
+       o_dspl = *(s32 *)(insn_buff + 1);
 
        /* next_rip of the replacement JMP */
        next_rip = repl_insn + a->replacementlen;
@@ -313,9 +313,9 @@ recompute_jump(struct alt_instr *a, u8 *orig_insn, u8 *repl_insn, u8 *insnbuf)
 two_byte_jmp:
        n_dspl -= 2;
 
-       insnbuf[0] = 0xeb;
-       insnbuf[1] = (s8)n_dspl;
-       add_nops(insnbuf + 2, 3);
+       insn_buff[0] = 0xeb;
+       insn_buff[1] = (s8)n_dspl;
+       add_nops(insn_buff + 2, 3);
 
        repl_len = 2;
        goto done;
@@ -323,8 +323,8 @@ two_byte_jmp:
 five_byte_jmp:
        n_dspl -= 5;
 
-       insnbuf[0] = 0xe9;
-       *(s32 *)&insnbuf[1] = n_dspl;
+       insn_buff[0] = 0xe9;
+       *(s32 *)&insn_buff[1] = n_dspl;
 
        repl_len = 5;
 
@@ -371,7 +371,7 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
 {
        struct alt_instr *a;
        u8 *instr, *replacement;
-       u8 insnbuf[MAX_PATCH_LEN];
+       u8 insn_buff[MAX_PATCH_LEN];
 
        DPRINTK("alt table %px, -> %px", start, end);
        /*
@@ -384,11 +384,11 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
         * order.
         */
        for (a = start; a < end; a++) {
-               int insnbuf_sz = 0;
+               int insn_buff_sz = 0;
 
                instr = (u8 *)&a->instr_offset + a->instr_offset;
                replacement = (u8 *)&a->repl_offset + a->repl_offset;
-               BUG_ON(a->instrlen > sizeof(insnbuf));
+               BUG_ON(a->instrlen > sizeof(insn_buff));
                BUG_ON(a->cpuid >= (NCAPINTS + NBUGINTS) * 32);
                if (!boot_cpu_has(a->cpuid)) {
                        if (a->padlen > 1)
@@ -406,8 +406,8 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
                DUMP_BYTES(instr, a->instrlen, "%px: old_insn: ", instr);
                DUMP_BYTES(replacement, a->replacementlen, "%px: rpl_insn: ", replacement);
 
-               memcpy(insnbuf, replacement, a->replacementlen);
-               insnbuf_sz = a->replacementlen;
+               memcpy(insn_buff, replacement, a->replacementlen);
+               insn_buff_sz = a->replacementlen;
 
                /*
                 * 0xe8 is a relative jump; fix the offset.
@@ -415,24 +415,24 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
                 * Instruction length is checked before the opcode to avoid
                 * accessing uninitialized bytes for zero-length replacements.
                 */
-               if (a->replacementlen == 5 && *insnbuf == 0xe8) {
-                       *(s32 *)(insnbuf + 1) += replacement - instr;
+               if (a->replacementlen == 5 && *insn_buff == 0xe8) {
+                       *(s32 *)(insn_buff + 1) += replacement - instr;
                        DPRINTK("Fix CALL offset: 0x%x, CALL 0x%lx",
-                               *(s32 *)(insnbuf + 1),
-                               (unsigned long)instr + *(s32 *)(insnbuf + 1) + 5);
+                               *(s32 *)(insn_buff + 1),
+                               (unsigned long)instr + *(s32 *)(insn_buff + 1) + 5);
                }
 
                if (a->replacementlen && is_jmp(replacement[0]))
-                       recompute_jump(a, instr, replacement, insnbuf);
+                       recompute_jump(a, instr, replacement, insn_buff);
 
                if (a->instrlen > a->replacementlen) {
-                       add_nops(insnbuf + a->replacementlen,
+                       add_nops(insn_buff + a->replacementlen,
                                 a->instrlen - a->replacementlen);
-                       insnbuf_sz += a->instrlen - a->replacementlen;
+                       insn_buff_sz += a->instrlen - a->replacementlen;
                }
-               DUMP_BYTES(insnbuf, insnbuf_sz, "%px: final_insn: ", instr);
+               DUMP_BYTES(insn_buff, insn_buff_sz, "%px: final_insn: ", instr);
 
-               text_poke_early(instr, insnbuf, insnbuf_sz);
+               text_poke_early(instr, insn_buff, insn_buff_sz);
        }
 }
 
@@ -594,22 +594,21 @@ void __init_or_module apply_paravirt(struct paravirt_patch_site *start,
                                     struct paravirt_patch_site *end)
 {
        struct paravirt_patch_site *p;
-       char insnbuf[MAX_PATCH_LEN];
+       char insn_buff[MAX_PATCH_LEN];
 
        for (p = start; p < end; p++) {
                unsigned int used;
 
                BUG_ON(p->len > MAX_PATCH_LEN);
                /* prep the buffer with the original instructions */
-               memcpy(insnbuf, p->instr, p->len);
-               used = pv_ops.init.patch(p->instrtype, insnbuf,
-                                        (unsigned long)p->instr, p->len);
+               memcpy(insn_buff, p->instr, p->len);
+               used = pv_ops.init.patch(p->type, insn_buff, (unsigned long)p->instr, p->len);
 
                BUG_ON(used > p->len);
 
                /* Pad the rest with nops */
-               add_nops(insnbuf + used, p->len - used);
-               text_poke_early(p->instr, insnbuf, p->len);
+               add_nops(insn_buff + used, p->len - used);
+               text_poke_early(p->instr, insn_buff, p->len);
        }
 }
 extern struct paravirt_patch_site __start_parainstructions[],