From: Pavel Machek Subject: Re: [RFC PATCH 18/35] Support gdt/idt/ldt handling on Xen. Date: Tue, 9 May 2006 07:21:40 +0000 Message-ID: <20060509072139.GB4150@ucw.cz> References: <20060509084945.373541000@sous-sol.org> <20060509085155.177937000@sous-sol.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20060509085155.177937000@sous-sol.org> Sender: linux-kernel-owner@vger.kernel.org To: Chris Wright Cc: linux-kernel@vger.kernel.org, virtualization@lists.osdl.org, xen-devel@lists.xensource.com, Ian Pratt , Christian Limpach List-Id: xen-devel@lists.xenproject.org Hi! > +static inline void load_TLS(struct thread_struct *t, unsigned int cpu) > +{ > +#define C(i) get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i] > + C(0); C(1); C(2); > +#undef C > +} Why not use for loop here? gcc should be able to optimize it... > +#define load_TR_desc() do {} while (0)... > +#define load_gdt(dtr) do { \ ... > +} while (0) So you know the trick :-) > +#define load_idt(dtr) HYPERVISOR_set_trap_table(xen_trap_table) > +#define load_tr(tr) __asm__ __volatile("ltr %0"::"mr" (tr)) > +#define load_ldt(ldt) __asm__ __volatile("lldt %0"::"mr" (ldt)) __volatile (not __volatile__?). could you just use 'asm volatile' without __s instead? Pavel -- Thanks for all the (sleeping) penguins.