Commit e7b47cca authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Linus Torvalds

[PATCH] i386 machine_kexec: Cleanup inline assembly

For some reason I was telling my inline assembly that the
input argument was an output argument.

Playing in the trampoline code I have seen a couple of
instances where lgdt get the wrong size (because the
trampolines run in 16bit mode) so use lgdtl and lidtl to
be explicit.

Additionally gcc-3.3 and gcc-3.4 want's an lvalue for a
memory argument and it doesn't think an array of characters
is an lvalue so use a packed structure instead.
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1108bae4
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/apic.h> #include <asm/apic.h>
#include <asm/cpufeature.h> #include <asm/cpufeature.h>
#include <asm/desc.h>
static inline unsigned long read_cr3(void) static inline unsigned long read_cr3(void)
{ {
...@@ -90,33 +91,32 @@ static void identity_map_page(unsigned long address) ...@@ -90,33 +91,32 @@ static void identity_map_page(unsigned long address)
} }
#endif #endif
static void set_idt(void *newidt, __u16 limit) static void set_idt(void *newidt, __u16 limit)
{ {
unsigned char curidt[6]; struct Xgt_desc_struct curidt;
/* ia32 supports unaliged loads & stores */ /* ia32 supports unaliged loads & stores */
(*(__u16 *)(curidt)) = limit; curidt.size = limit;
(*(__u32 *)(curidt +2)) = (unsigned long)(newidt); curidt.address = (unsigned long)newidt;
__asm__ __volatile__ ( __asm__ __volatile__ (
"lidt %0\n" "lidtl %0\n"
: "=m" (curidt) : : "m" (curidt)
); );
}; };
static void set_gdt(void *newgdt, __u16 limit) static void set_gdt(void *newgdt, __u16 limit)
{ {
unsigned char curgdt[6]; struct Xgt_desc_struct curgdt;
/* ia32 supports unaligned loads & stores */ /* ia32 supports unaligned loads & stores */
(*(__u16 *)(curgdt)) = limit; curgdt.size = limit;
(*(__u32 *)(curgdt +2)) = (unsigned long)(newgdt); curgdt.address = (unsigned long)newgdt;
__asm__ __volatile__ ( __asm__ __volatile__ (
"lgdt %0\n" "lgdtl %0\n"
: "=m" (curgdt) : : "m" (curgdt)
); );
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment