Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1547165

Re: [v2 5/7] x86: Add emulation code for UMIP instructions

From Masami Hiramatsu <mhiramat@kernel.org>
Newsgroups linux.kernel
Subject Re: [v2 5/7] x86: Add emulation code for UMIP instructions
Date 2016-12-25 17:00 +0100
Message-ID <sSjnj-7db-5@gated-at.bofh.it> (permalink)
References <sRJtv-6WG-7@gated-at.bofh.it> <sRJtw-6WG-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 23 Dec 2016 17:37:43 -0800
Ricardo Neri <ricardo.neri-calderon@linux.intel.com> wrote:

> +static int __identify_insn(struct insn *insn)
> +{
> +	/* by getting modrm we also get the opcode */
> +	insn_get_modrm(insn);
> +	if (insn->opcode.bytes[0] != 0xf)
> +		return -EINVAL;
> +
> +	if (insn->opcode.bytes[1] == 0x1) {
> +		switch (X86_MODRM_REG(insn->modrm.value)) {
> +		case 0:
> +			return UMIP_SGDT;
> +		case 1:
> +			return UMIP_SIDT;
> +		case 4:
> +			return UMIP_SMSW;
> +		default:
> +			return -EINVAL;
> +		}
> +	} else if (insn->opcode.bytes[1] == 0x0) {
> +		if (X86_MODRM_REG(insn->modrm.value) == 0)
> +			return UMIP_SLDT;
> +		else if (X86_MODRM_REG(insn->modrm.value) == 1)
> +			return UMIP_STR;
> +		else
> +			return -EINVAL;
> +	}

gcc detected an error here, you may need return "-EINVAL".

Thanks,



-- 
Masami Hiramatsu <mhiramat@kernel.org>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[v2 0/7] x86: enable User-Mode Instruction Prevention Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2016-12-24 02:40 +0100
  [v2 5/7] x86: Add emulation code for UMIP instructions Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2016-12-24 02:40 +0100
    Re: [v2 5/7] x86: Add emulation code for UMIP instructions Andy Lutomirski <luto@amacapital.net> - 2016-12-24 03:20 +0100
      Re: [v2 5/7] x86: Add emulation code for UMIP instructions Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2016-12-28 01:40 +0100
        Re: [v2 5/7] x86: Add emulation code for UMIP instructions Andy Lutomirski <luto@amacapital.net> - 2016-12-28 01:50 +0100
          Re: [v2 5/7] x86: Add emulation code for UMIP instructions Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2016-12-30 06:30 +0100
            Re: [v2 5/7] x86: Add emulation code for UMIP instructions Andy Lutomirski <luto@amacapital.net> - 2016-12-31 03:10 +0100
    Re: [v2 5/7] x86: Add emulation code for UMIP instructions Masami Hiramatsu <mhiramat@kernel.org> - 2016-12-25 17:00 +0100
      Re: [v2 5/7] x86: Add emulation code for UMIP instructions Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2016-12-28 01:50 +0100
  [v2 3/7] x86/mpx, x86/insn: Relocate insn util functions to a new insn-utils Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2016-12-24 02:40 +0100
    Re: [v2 3/7] x86/mpx, x86/insn: Relocate insn util functions to a  new insn-utils kbuild test robot <lkp@intel.com> - 2016-12-24 03:40 +0100
    Re: [v2 3/7] x86/mpx, x86/insn: Relocate insn util functions to a  new insn-utils Masami Hiramatsu <mhiramat@kernel.org> - 2016-12-25 07:20 +0100
      Re: [v2 3/7] x86/mpx, x86/insn: Relocate insn util functions to a  new insn-utils Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2016-12-27 23:40 +0100
    Re: [v2 3/7] x86/mpx, x86/insn: Relocate insn util functions to a new  insn-utils Dave Hansen <dave.hansen@linux.intel.com> - 2017-01-03 17:50 +0100
  [v2 2/7] x86/mpx: Fail when implicit zero-displacement is used along with R/EBP Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2016-12-24 02:50 +0100
    Re: [v2 2/7] x86/mpx: Fail when implicit zero-displacement is used  along with R/EBP Andy Lutomirski <luto@amacapital.net> - 2016-12-24 03:00 +0100
      Re: [v2 2/7] x86/mpx: Fail when implicit zero-displacement is used  along with R/EBP Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2016-12-27 23:40 +0100
        Re: [v2 2/7] x86/mpx: Fail when implicit zero-displacement is used  along with R/EBP Dave Hansen <dave.hansen@linux.intel.com> - 2017-01-03 17:50 +0100

csiph-web