Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 5460
b: refs/heads/master
c: 36c4fd2
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman authored and Linus Torvalds committed Jul 29, 2005
1 parent 3f72131 commit 49dfe89
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e7b47ccaf655cbaf336745a9b65cf7b22a536fca
refs/heads/master: 36c4fd23cc06f81d68ee968c4c1bf1cebb3dcea5
34 changes: 16 additions & 18 deletions trunk/arch/x86_64/kernel/machine_kexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,45 +122,43 @@ static int init_pgtable(struct kimage *image, unsigned long start_pgtable)

static void set_idt(void *newidt, u16 limit)
{
unsigned char curidt[10];
struct desc_ptr curidt;

/* x86-64 supports unaliged loads & stores */
(*(u16 *)(curidt)) = limit;
(*(u64 *)(curidt +2)) = (unsigned long)(newidt);
curidt.size = limit;
curidt.address = (unsigned long)newidt;

__asm__ __volatile__ (
"lidt %0\n"
: "=m" (curidt)
"lidtq %0\n"
: : "m" (curidt)
);
};


static void set_gdt(void *newgdt, u16 limit)
{
unsigned char curgdt[10];
struct desc_ptr curgdt;

/* x86-64 supports unaligned loads & stores */
(*(u16 *)(curgdt)) = limit;
(*(u64 *)(curgdt +2)) = (unsigned long)(newgdt);
curgdt.size = limit;
curgdt.address = (unsigned long)newgdt;

__asm__ __volatile__ (
"lgdt %0\n"
: "=m" (curgdt)
"lgdtq %0\n"
: : "m" (curgdt)
);
};

static void load_segments(void)
{
__asm__ __volatile__ (
"\tmovl $"STR(__KERNEL_DS)",%eax\n"
"\tmovl %eax,%ds\n"
"\tmovl %eax,%es\n"
"\tmovl %eax,%ss\n"
"\tmovl %eax,%fs\n"
"\tmovl %eax,%gs\n"
"\tmovl %0,%%ds\n"
"\tmovl %0,%%es\n"
"\tmovl %0,%%ss\n"
"\tmovl %0,%%fs\n"
"\tmovl %0,%%gs\n"
: : "a" (__KERNEL_DS)
);
#undef STR
#undef __STR
}

typedef NORET_TYPE void (*relocate_new_kernel_t)(unsigned long indirection_page,
Expand Down

0 comments on commit 49dfe89

Please sign in to comment.