Il 07/05/2014 06:21, Bandan Das ha scritto:
> +          if (rc != X86EMUL_CONTINNUE)
> +                  goto done;
> +  }
> +
>    while (size--) {
> -          if (unlikely(ctxt->_eip == fc->end)) {
> -                  rc = do_insn_fetch_bytes(ctxt);
> -                  if (rc != X86EMUL_CONTINUE)
> -                          return rc;
> -          }
>            *dest++ = *src++;
>            ctxt->_eip++;
>            continue;
> @@ -4273,7 +4282,7 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void 
*insn, int insn_len)
>    if (insn_len > 0)
>            memcpy(ctxt->fetch.data, insn, insn_len);
>    else {
> -          rc = do_insn_fetch_bytes(ctxt);
> +          rc = do_insn_fetch_bytes(ctxt, 1);
Is this saying that if the cache is full, then we fetch one more byte ?


No, it is saying that if the instruction is being executed for the first time (we can execute it multiple times if we reenter a repeated instruction after a userspace exit) we try to get at least one byte from RIP. Most of the time, do_insn_fetch_bytes will fetch 15 bytes which are the maximum length of an instruction.

Passing op_size == 1 matches this change in do_insn_fetch_bytes:

-       if (unlikely(size == 0))
+       if (unlikely(size < op_size))

Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to