diff options
Diffstat (limited to 'i386/i386')
-rw-r--r-- | i386/i386/gdt.c | 2 | ||||
-rw-r--r-- | i386/i386/idt.c | 2 | ||||
-rw-r--r-- | i386/i386/idt_inittab.S | 6 | ||||
-rw-r--r-- | i386/i386/ktss.c | 4 | ||||
-rw-r--r-- | i386/i386/locore.S | 32 |
5 files changed, 36 insertions, 10 deletions
diff --git a/i386/i386/gdt.c b/i386/i386/gdt.c index c895eb3a..e8b8bd0c 100644 --- a/i386/i386/gdt.c +++ b/i386/i386/gdt.c @@ -43,7 +43,7 @@ /* It is actually defined in xen_boothdr.S */ extern #endif /* MACH_PV_DESCRIPTORS */ -struct real_descriptor gdt[GDTSZ]; +struct real_descriptor gdt[GDTSZ] __section(".data.shared"); void gdt_init(void) diff --git a/i386/i386/idt.c b/i386/i386/idt.c index d304ec3e..021beb56 100644 --- a/i386/i386/idt.c +++ b/i386/i386/idt.c @@ -26,7 +26,7 @@ #include <i386at/idt.h> #include <i386/gdt.h> -struct real_gate idt[IDTSZ]; +struct real_gate idt[IDTSZ] __section(".data.shared"); struct idt_init_entry { diff --git a/i386/i386/idt_inittab.S b/i386/i386/idt_inittab.S index 8e92d805..6794400e 100644 --- a/i386/i386/idt_inittab.S +++ b/i386/i386/idt_inittab.S @@ -34,7 +34,7 @@ Here's the header that comes before everything else. */ .data 2 ENTRY(idt_inittab) - .text + .section .text.shared /* * Interrupt descriptor table and code vectors for it. @@ -46,14 +46,14 @@ ENTRY(idt_inittab) .byte (((type)&ACC_PL)>>5)|((((type)&(ACC_TYPE|ACC_A))==ACC_INTR_GATE)<<2) ;\ .word KERNEL_CS ;\ .long entry ;\ - .text + .section .text.shared #else /* MACH_PV_DESCRIPTORS */ #define IDT_ENTRY(n,entry,type) \ .data 2 ;\ .long entry ;\ .word n ;\ .word type ;\ - .text + .section .text.shared #endif /* MACH_PV_DESCRIPTORS */ /* diff --git a/i386/i386/ktss.c b/i386/i386/ktss.c index 21d00300..57bbfdfe 100644 --- a/i386/i386/ktss.c +++ b/i386/i386/ktss.c @@ -37,13 +37,13 @@ #include "ktss.h" /* A kernel TSS with a complete I/O bitmap. */ -struct task_tss ktss; +struct task_tss ktss __section(".data.shared"); void ktss_init(void) { /* XXX temporary exception stack */ - static int exception_stack[1024]; + static int exception_stack[1024] __section(".data.shared"); #ifdef MACH_RING1 /* Xen won't allow us to do any I/O by default anyway, just register diff --git a/i386/i386/locore.S b/i386/i386/locore.S index ddba2245..1d213c94 100644 --- a/i386/i386/locore.S +++ b/i386/i386/locore.S @@ -53,6 +53,13 @@ DATA(recover_table) ;\ .text ;\ 9: +#define RECOVERSHARED(addr) \ + .text 2 ;\ + .long 9f ;\ + .long addr ;\ + .section .text.shared ;\ +9: + #define RECOVER_TABLE_END \ .text 2 ;\ .globl EXT(recover_table_end) ;\ @@ -80,6 +87,19 @@ DATA(retry_table) ;\ LEXT(retry_table_end) ;\ .text +#ifdef MACH_HYP +#define SWITCH_TO_KERNEL_PT +#define SWITCH_TO_USER_PT +#else +#define SWITCH_TO_KERNEL_PT \ + movl EXT(kernel_pt),%edx; \ + movl %edx,%cr3 /* Switch to kernel pagetable */ + +#define SWITCH_TO_USER_PT \ + movl EXT(user_pt),%edx; \ + /*movl %edx,%cr3 /* Switch to user pagetable */ +#endif + /* * Allocate recovery and retry tables. */ @@ -611,7 +631,7 @@ ENTRY(call_continuation) #define INTERRUPT(n) \ .data 2 ;\ .long 0f ;\ - .text ;\ + .section .text.shared ;\ P2ALIGN(TEXT_ALIGN) ;\ 0: ;\ pushl %eax ;\ @@ -644,6 +664,7 @@ INTERRUPT(15) * All interrupts enter here. * old %eax on stack; interrupt number in %eax. */ +.section .text.shared ENTRY(all_intrs) pushl %ecx /* save registers */ pushl %edx @@ -663,6 +684,7 @@ ENTRY(all_intrs) mov %dx,%es mov %dx,%fs mov %dx,%gs + SWITCH_TO_KERNEL_PT CPU_NUMBER(%edx) @@ -701,6 +723,7 @@ LEXT(return_to_iret) /* ( label for kdb_kintr and hardclock) */ cmpl $0,CX(EXT(need_ast),%edx) jnz ast_from_interrupt /* take it if so */ 1: + SWITCH_TO_USER_PT pop %gs /* restore segment regs */ pop %fs pop %es @@ -722,6 +745,7 @@ _return_to_iret_i: /* ( label for kdb_kintr) */ stack_overflowed: ud2 +.text /* * Take an AST from an interrupt. @@ -993,6 +1017,7 @@ ttd_from_iret_i: /* on interrupt stack */ * * eax contains system call number. */ +.section .text.shared ENTRY(syscall) syscall_entry: pushf /* save flags as soon as possible */ @@ -1088,7 +1113,7 @@ syscall_native: movl %esp,%edx /* save kernel ESP for error recovery */ 0: subl $4,%esi - RECOVER(mach_call_addr_push) + RECOVERSHARED(mach_call_addr_push) pushl %fs:(%esi) /* push argument on stack */ loop 0b /* loop for all arguments */ @@ -1178,9 +1203,10 @@ syscall_addr: .data DATA(cpu_features) .long 0 - .text + .section .text.shared END(syscall) + .text /* Discover what kind of cpu we have; return the family number (3, 4, 5, 6, for 386, 486, 586, 686 respectively). */ |