mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zachary Amsden <zach@vmware.com>
To: Andrew Morton <akpm@osdl.org>, Chris Wright <chrisw@osdl.org>,
	Linus Torvalds <torvalds@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Virtualization Mailing List <virtualization@lists.osdl.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	Martin Bligh <mbligh@mbligh.org>,
	Pratap Subrahmanyam <pratap@vmware.com>,
	Christopher Li <chrisl@vmware.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Ingo Molnar <mingo@elte.hu>, Zachary Amsden <zach@vmware.com>,
	Zachary Amsden <zach@vmware.com>
Subject: [PATCH 18/21] i386 Ldt cleanups 2
Date: Mon, 7 Nov 2005 20:38:34 -0800	[thread overview]
Message-ID: <200511080438.jA84cY0X009945@zach-dev.vmware.com> (raw)

Add an acessor function to get a pointer to an LDT descriptor.  Add one for
the GDT too, while we are here, and a function to tell the difference.

Turns out on some GCC versions, converting to char * and back gives better
code output than gdt[seg >> 3].  Lets keep that trick in the header file
so the C-code can be clean.

Not used yet, but soon.

Signed-off-by: Zachary Amsden <zach@vmware.com>
Index: linux-2.6.14-zach-work/include/asm-i386/desc.h
===================================================================
--- linux-2.6.14-zach-work.orig/include/asm-i386/desc.h	2005-11-04 18:10:53.000000000 -0800
+++ linux-2.6.14-zach-work/include/asm-i386/desc.h	2005-11-05 00:28:03.000000000 -0800
@@ -30,7 +30,24 @@ static inline struct desc_struct *get_cp
 {
 	return ((struct desc_struct *)cpu_gdt_descr[cpu].address);
 }
-  
+
+static inline int segment_from_ldt(unsigned int segment)
+{
+	return segment & LDT_SEGMENT;
+}
+
+static inline struct desc_struct *get_gdt_desc(int cpu, unsigned int segment)
+{
+	char *gdt = (char *)get_cpu_gdt_table(cpu);
+	return (struct desc_struct *)&gdt[segment & ~7];
+}
+
+static inline struct desc_struct *get_ldt_desc(mm_context_t *ctx, unsigned int segment)
+{
+	char *ldt = (char *)ctx->ldt;
+	return (struct desc_struct *)&ldt[segment & ~7];
+}
+
 #define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8))
 #define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8))
 

                 reply	other threads:[~2005-11-08  4:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200511080438.jA84cY0X009945@zach-dev.vmware.com \
    --to=zach@vmware.com \
    --cc=akpm@osdl.org \
    --cc=chrisl@vmware.com \
    --cc=chrisw@osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@mbligh.org \
    --cc=mingo@elte.hu \
    --cc=pratap@vmware.com \
    --cc=torvalds@osdl.org \
    --cc=virtualization@lists.osdl.org \
    --cc=zwane@arm.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®