[PATCH] i386: inline assembler: cleanup and encapsulate descriptor and task register management
i386 inline assembler cleanup. This change encapsulates descriptor and task register management. Also, it is possible to improve assembler generation in two cases; savesegment may store the value in a register instead of a memory location, which allows GCC to optimize stack variables into registers, and MOV MEM, SEG is always a 16-bit write to memory, making the casting in math-emu unnecessary. Signed-off-by: Zachary Amsden <zach@vmware.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Este commit está contenido en:

cometido por
Linus Torvalds

padre
245067d167
commit
4d37e7e3fd
@@ -42,17 +42,17 @@ void __save_processor_state(struct saved_context *ctxt)
|
||||
/*
|
||||
* descriptor tables
|
||||
*/
|
||||
asm volatile ("sgdt %0" : "=m" (ctxt->gdt_limit));
|
||||
asm volatile ("sidt %0" : "=m" (ctxt->idt_limit));
|
||||
asm volatile ("str %0" : "=m" (ctxt->tr));
|
||||
store_gdt(&ctxt->gdt_limit);
|
||||
store_idt(&ctxt->idt_limit);
|
||||
store_tr(ctxt->tr);
|
||||
|
||||
/*
|
||||
* segment registers
|
||||
*/
|
||||
asm volatile ("movw %%es, %0" : "=m" (ctxt->es));
|
||||
asm volatile ("movw %%fs, %0" : "=m" (ctxt->fs));
|
||||
asm volatile ("movw %%gs, %0" : "=m" (ctxt->gs));
|
||||
asm volatile ("movw %%ss, %0" : "=m" (ctxt->ss));
|
||||
savesegment(es, ctxt->es);
|
||||
savesegment(fs, ctxt->fs);
|
||||
savesegment(gs, ctxt->gs);
|
||||
savesegment(ss, ctxt->ss);
|
||||
|
||||
/*
|
||||
* control registers
|
||||
@@ -118,16 +118,16 @@ void __restore_processor_state(struct saved_context *ctxt)
|
||||
* now restore the descriptor tables to their proper values
|
||||
* ltr is done i fix_processor_context().
|
||||
*/
|
||||
asm volatile ("lgdt %0" :: "m" (ctxt->gdt_limit));
|
||||
asm volatile ("lidt %0" :: "m" (ctxt->idt_limit));
|
||||
load_gdt(&ctxt->gdt_limit);
|
||||
load_idt(&ctxt->idt_limit);
|
||||
|
||||
/*
|
||||
* segment registers
|
||||
*/
|
||||
asm volatile ("movw %0, %%es" :: "r" (ctxt->es));
|
||||
asm volatile ("movw %0, %%fs" :: "r" (ctxt->fs));
|
||||
asm volatile ("movw %0, %%gs" :: "r" (ctxt->gs));
|
||||
asm volatile ("movw %0, %%ss" :: "r" (ctxt->ss));
|
||||
loadsegment(es, ctxt->es);
|
||||
loadsegment(fs, ctxt->fs);
|
||||
loadsegment(gs, ctxt->gs);
|
||||
loadsegment(ss, ctxt->ss);
|
||||
|
||||
/*
|
||||
* sysenter MSRs
|
||||
|
Referencia en una nueva incidencia
Block a user