All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	LKML <linux-kernel@vger.kernel.org>
Subject: processor flags
Date: Thu, 27 Mar 2008 22:47:49 +0300	[thread overview]
Message-ID: <20080327194749.GA7633@cvg> (raw)

Hi Peter, Ingo

could you spend a few minutes on me? ;)

You know, I'm almost complete changing the vm86 flags
with X86_EFLAGS_... but there is a hidden problem lays.
Look, in vm86.h we have the definition

#ifdef CONFIG_VM86
#define VM_MASK		0x00020000
#else
#define VM_MASK		0 /* ignored */
#endif

which has an indirect conditional compilation effect.
For example, if we take a look on include/asm-x86/ptrace.h

	static inline int v8086_mode(struct pt_regs *regs)
	{
	#ifdef CONFIG_X86_32
		return (regs->flags & VM_MASK);
	#else
		return 0;	/* No V86 mode support in long mode */
	#endif
	}

so if we don't have CONFIG_VM86 defined this function *always*
returning 0 so there I can't just change VM_MASK to X86_EFLAGS_VM.

Another piece of code from traps_32.c:do_general_protection

	if (regs->flags & VM_MASK)
		goto gp_in_vm86;

so if we didn't set CONFIG_VM86 i think this part is just thrown out
by gcc. So as we see, this VM_MASK original flag is not *just* a flag
but also says gcc which part of code to compile.

And now I'm in confusion - the way of changing this code I see is the
following:

- or use additional #ifdef CONFIG_VM86 in code where VM_MASK is used
  (that would be ugly IMHO)
- rename VM_MASK to say X86_EFLAGS_VM86 with that #ifdef remained
- rest VM_MASK as it is

How do you think?

		- Cyrill -

             reply	other threads:[~2008-03-27 19:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-27 19:47 Cyrill Gorcunov [this message]
2008-03-27 19:55 ` processor flags H. Peter Anvin
2008-03-27 19:56   ` Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080327194749.GA7633@cvg \
    --to=gorcunov@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.