From: Chris Wright <chrisw-69jw2NvuJkxg9hUCZPvPmw@public.gmane.org>
To: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
Cc: Zachary Amsden <zach-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>,
Andi Kleen <ak-h9bWGtP8wOw@public.gmane.org>,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
lkml - Kernel Mailing List
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
kvm-devel
<kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [PATCH 2/3] i386: use x86_64's desc_def.h
Date: Fri, 20 Jul 2007 18:32:55 -0700 [thread overview]
Message-ID: <20070721013255.GA3673@sequoia.sous-sol.org> (raw)
In-Reply-To: <1184801383.10380.176.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
* Rusty Russell (rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org) wrote:
> On Thu, 2007-07-19 at 09:27 +1000, Rusty Russell wrote:
> > On Wed, 2007-07-18 at 09:19 -0700, Zachary Amsden wrote:
> > > > +#define GET_CONTENTS(desc) (((desc)->raw32.b >> 10) & 3)
> > > > +#define GET_WRITABLE(desc) (((desc)->raw32.b >> 9) & 1)
> > >
> > > You got rid of the duplicate definitions here, but then added new
> > > duplicates (GET_CONTENTS / WRITABLE). Can you stick them in desc.h?
> >
> > To be honest, I got sick of counting bits at this point, and didn't want
> > to introduce bugs.
> >
> > Here's the updated version of PATCH 1/3:
>
> And 2/3:
> ===
> i386: use x86_64's desc_def.h
plus this needed as well now
Index: linus-2.6/include/asm-i386/xen/hypercall.h
===================================================================
--- linus-2.6.orig/include/asm-i386/xen/hypercall.h
+++ linus-2.6/include/asm-i386/xen/hypercall.h
@@ -359,8 +359,8 @@ MULTI_update_descriptor(struct multicall
mcl->op = __HYPERVISOR_update_descriptor;
mcl->args[0] = maddr;
mcl->args[1] = maddr >> 32;
- mcl->args[2] = desc.a;
- mcl->args[3] = desc.b;
+ mcl->args[2] = desc.raw32.a;
+ mcl->args[3] = desc.raw32.b;
}
static inline void
Index: linus-2.6/drivers/lguest/interrupts_and_traps.c
===================================================================
--- linus-2.6.orig/drivers/lguest/interrupts_and_traps.c
+++ linus-2.6/drivers/lguest/interrupts_and_traps.c
@@ -103,9 +103,9 @@ void maybe_do_interrupt(struct lguest *l
}
idt = &lg->idt[FIRST_EXTERNAL_VECTOR+irq];
- if (idt_present(idt->a, idt->b)) {
+ if (idt_present(idt->raw32.a, idt->raw32.b)) {
clear_bit(irq, lg->irqs_pending);
- set_guest_interrupt(lg, idt->a, idt->b, 0);
+ set_guest_interrupt(lg, idt->raw32.a, idt->raw32.b, 0);
}
}
@@ -116,7 +116,7 @@ static int has_err(unsigned int trap)
int deliver_trap(struct lguest *lg, unsigned int num)
{
- u32 lo = lg->idt[num].a, hi = lg->idt[num].b;
+ u32 lo = lg->idt[num].raw32.a, hi = lg->idt[num].raw32.b;
if (!idt_present(lo, hi))
return 0;
@@ -139,7 +139,7 @@ static int direct_trap(const struct lgue
return 0;
/* Interrupt gates (0xE) or not present (0x0) can't go direct. */
- return idt_type(trap->a, trap->b) == 0xF;
+ return idt_type(trap->raw32.a, trap->raw32.b) == 0xF;
}
void pin_stack_pages(struct lguest *lg)
@@ -170,15 +170,15 @@ static void set_trap(struct lguest *lg,
u8 type = idt_type(lo, hi);
if (!idt_present(lo, hi)) {
- trap->a = trap->b = 0;
+ trap->raw32.a = trap->raw32.b = 0;
return;
}
if (type != 0xE && type != 0xF)
kill_guest(lg, "bad IDT type %i", type);
- trap->a = ((__KERNEL_CS|GUEST_PL)<<16) | (lo&0x0000FFFF);
- trap->b = (hi&0xFFFFEF00);
+ trap->raw32.a = ((__KERNEL_CS|GUEST_PL)<<16) | (lo&0x0000FFFF);
+ trap->raw32.b = (hi&0xFFFFEF00);
}
void load_guest_idt_entry(struct lguest *lg, unsigned int num, u32 lo, u32 hi)
@@ -204,8 +204,8 @@ static void default_idt_entry(struct des
if (trap == LGUEST_TRAP_ENTRY)
flags |= (GUEST_PL << 13);
- idt->a = (LGUEST_CS<<16) | (handler&0x0000FFFF);
- idt->b = (handler&0xFFFF0000) | flags;
+ idt->raw32.a = (LGUEST_CS<<16) | (handler&0x0000FFFF);
+ idt->raw32.b = (handler&0xFFFF0000) | flags;
}
void setup_default_idt_entries(struct lguest_ro_state *state,
Index: linus-2.6/drivers/lguest/lg.h
===================================================================
--- linus-2.6.orig/drivers/lguest/lg.h
+++ linus-2.6/drivers/lguest/lg.h
@@ -44,8 +44,8 @@ void free_pagetables(void);
int init_pagetables(struct page **switcher_page, unsigned int pages);
/* Full 4G segment descriptors, suitable for CS and DS. */
-#define FULL_EXEC_SEGMENT ((struct desc_struct){0x0000ffff, 0x00cf9b00})
-#define FULL_SEGMENT ((struct desc_struct){0x0000ffff, 0x00cf9300})
+#define FULL_EXEC_SEGMENT ((struct desc_struct){ {0x00cf9b000000ffffULL} })
+#define FULL_SEGMENT ((struct desc_struct){ {0x00cf93000000ffffULL} })
struct lguest_dma_info
{
Index: linus-2.6/drivers/lguest/lguest.c
===================================================================
--- linus-2.6.orig/drivers/lguest/lguest.c
+++ linus-2.6/drivers/lguest/lguest.c
@@ -173,7 +173,7 @@ static void lguest_load_idt(const struct
struct desc_struct *idt = (void *)desc->address;
for (i = 0; i < (desc->size+1)/8; i++)
- hcall(LHCALL_LOAD_IDT_ENTRY, i, idt[i].a, idt[i].b);
+ hcall(LHCALL_LOAD_IDT_ENTRY, i, idt[i].raw32.a, idt[i].raw32.b);
}
static void lguest_load_gdt(const struct Xgt_desc_struct *desc)
Index: linus-2.6/drivers/lguest/segments.c
===================================================================
--- linus-2.6.orig/drivers/lguest/segments.c
+++ linus-2.6/drivers/lguest/segments.c
@@ -3,12 +3,12 @@
static int desc_ok(const struct desc_struct *gdt)
{
/* MBZ=0, P=1, DT=1 */
- return ((gdt->b & 0x00209000) == 0x00009000);
+ return ((gdt->raw32.b & 0x00209000) == 0x00009000);
}
static int segment_present(const struct desc_struct *gdt)
{
- return gdt->b & 0x8000;
+ return gdt->raw32.b & 0x8000;
}
static int ignored_gdt(unsigned int num)
@@ -54,11 +54,11 @@ static void fixup_gdt_table(struct lgues
kill_guest(lg, "Bad GDT descriptor %i", i);
/* DPL 0 presumably means "for use by guest". */
- if ((lg->gdt[i].b & 0x00006000) == 0)
- lg->gdt[i].b |= (GUEST_PL << 13);
+ if ((lg->gdt[i].raw32.b & 0x00006000) == 0)
+ lg->gdt[i].raw32.b |= (GUEST_PL << 13);
/* Set accessed bit, since gdt isn't writable. */
- lg->gdt[i].b |= 0x00000100;
+ lg->gdt[i].raw32.b |= 0x00000100;
}
}
@@ -73,8 +73,8 @@ void setup_default_gdt_entries(struct lg
/* This is the one which we *cannot* copy from guest, since tss
is depended on this lguest_ro_state, ie. this cpu. */
- gdt[GDT_ENTRY_TSS].a = 0x00000067 | (tss << 16);
- gdt[GDT_ENTRY_TSS].b = 0x00008900 | (tss & 0xFF000000)
+ gdt[GDT_ENTRY_TSS].raw32.a = 0x00000067 | (tss << 16);
+ gdt[GDT_ENTRY_TSS].raw32.b = 0x00008900 | (tss & 0xFF000000)
| ((tss >> 16) & 0x000000FF);
}
@@ -82,8 +82,8 @@ void setup_guest_gdt(struct lguest *lg)
{
lg->gdt[GDT_ENTRY_KERNEL_CS] = FULL_EXEC_SEGMENT;
lg->gdt[GDT_ENTRY_KERNEL_DS] = FULL_SEGMENT;
- lg->gdt[GDT_ENTRY_KERNEL_CS].b |= (GUEST_PL << 13);
- lg->gdt[GDT_ENTRY_KERNEL_DS].b |= (GUEST_PL << 13);
+ lg->gdt[GDT_ENTRY_KERNEL_CS].raw32.b |= (GUEST_PL << 13);
+ lg->gdt[GDT_ENTRY_KERNEL_DS].raw32.b |= (GUEST_PL << 13);
}
/* This is a fast version for the common case where only the three TLS entries
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2007-07-21 1:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-18 7:22 [PATCH 1/3] Standardize x86_64's desc_defs.h in preparation for exposure to i386 Rusty Russell
[not found] ` <1184743355.10380.112.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-18 7:23 ` [PATCH 2/3] i386: use x86_64's desc_def.h Rusty Russell
[not found] ` <1184743422.10380.114.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-18 7:30 ` [PATCH 3/3] i386: Replace struct Xgt_desc_struct with struct desc_ptr Rusty Russell
[not found] ` <1184743812.10380.120.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-21 1:33 ` Chris Wright
2007-07-18 16:19 ` [PATCH 2/3] i386: use x86_64's desc_def.h Zachary Amsden
[not found] ` <469E3DA1.3010600-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
2007-07-18 23:27 ` Rusty Russell
[not found] ` <1184801261.10380.174.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-18 23:29 ` Rusty Russell
[not found] ` <1184801383.10380.176.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-07-21 1:32 ` Chris Wright [this message]
2007-07-19 0:00 ` Andi Kleen
2007-07-18 9:03 ` [PATCH 1/3] Standardize x86_64's desc_defs.h in preparation for exposure to i386 Andi Kleen
[not found] ` <20070718090302.GA67073-h9bWGtP8wOw@public.gmane.org>
2007-07-18 11:44 ` Rusty Russell
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=20070721013255.GA3673@sequoia.sous-sol.org \
--to=chrisw-69jw2nvujkxg9huczpvpmw@public.gmane.org \
--cc=ak-h9bWGtP8wOw@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org \
--cc=zach-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org \
/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