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


Groups > linux.kernel > #1669393

Re: [PATCH v7 10/26] x86/insn-eval: Add utility functions to get segment selector

From Borislav Petkov <bp@suse.de>
Newsgroups linux.kernel
Subject Re: [PATCH v7 10/26] x86/insn-eval: Add utility functions to get segment selector
Date 2017-06-19 18:00 +0200
Message-ID <tU7fR-4Bo-39@gated-at.bofh.it> (permalink)
References <tDPZD-5j6-3@gated-at.bofh.it> <tDPZE-5j6-15@gated-at.bofh.it> <tMMJc-6ag-9@gated-at.bofh.it> <tSHQu-5ZL-27@gated-at.bofh.it> <tSIjw-6s6-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jun 15, 2017 at 12:04:21PM -0700, Ricardo Neri wrote:
> On Thu, 2017-06-15 at 11:37 -0700, Ricardo Neri wrote:
> > > Yuck, didn't we talk about this already?
> > 
> > I am sorry Borislav. I thought you agreed that I could use the values
> > of
> > the segment override prefixes to identify the segment registers [1].

Yes, I agreed with that but...

> This time with the reference:
> [1]. https://lkml.org/lkml/2017/5/5/377

... this says it already: "... but you should call them what they are:
"enum seg_override_pfxs" or "enum seg_ovr_pfx" or..." IOW, those are
segment *override* prefixes and should be called such and not "enum
segment_register" as this way is misleading.

IOW, here's what I think you should do:

/* Segment override prefixes: */
#define	SEG_CS_OVERRIDE		0x23
#define SEG_SS_OVERRIDE		0x36
#define SEG_DS_OVERRIDE		0x3e

... and so on...

and use the defines directly. The enum is fine and dandy but then you
need to return an error value too so you can just as well have the
function return an int simply and make sure you check the retval.

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

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


Thread

Re: [PATCH v7 10/26] x86/insn-eval: Add utility functions to get  segment selector Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2017-06-15 20:40 +0200
  Re: [PATCH v7 10/26] x86/insn-eval: Add utility functions to get  segment selector Ricardo Neri <ricardo.neri-calderon@linux.intel.com> - 2017-06-15 21:10 +0200
    Re: [PATCH v7 10/26] x86/insn-eval: Add utility functions to get  segment selector Borislav Petkov <bp@suse.de> - 2017-06-19 18:00 +0200
  Re: [PATCH v7 10/26] x86/insn-eval: Add utility functions to get  segment selector Borislav Petkov <bp@suse.de> - 2017-06-19 17:40 +0200

csiph-web