Changeset 7c5a8dd in mainline
- Timestamp:
- 2006-08-01T23:34:02Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- adf7f9c
- Parents:
- 5b23a82
- Location:
- kernel/arch/xen32
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/xen32/include/asm.h
r5b23a82 r7c5a8dd 42 42 #include <config.h> 43 43 44 extern uint32_t interrupt_handler_size;45 46 extern void interrupt_handlers(void);47 48 44 extern void enable_l_apic_in_msr(void); 49 45 -
kernel/arch/xen32/include/boot/boot.h
r5b23a82 r7c5a8dd 49 49 50 50 #define mp_map ((pfn_t *) XEN_VIRT_START) 51 52 #define SIF_PRIVILEGED (1 << 0) /**< Privileged domain */ 53 #define SIF_INITDOMAIN (1 << 1) /**< Iinitial control domain */ 51 54 52 55 #include <arch/types.h> … … 102 105 pfn_t store_mfn; /**< Shared page (machine page) */ 103 106 evtchn_t store_evtchn; /**< Event channel for store communication */ 104 void *console_mfn; /**< Console page (machine address) */107 pfn_t console_mfn; /**< Console page (machine page) */ 105 108 evtchn_t console_evtchn; /**< Event channel for console messages */ 106 109 pte_t *ptl0; /**< Boot PTL0 (kernel address) */ -
kernel/arch/xen32/include/hypercall.h
r5b23a82 r7c5a8dd 41 41 uint8_t flags; /**< 0-3: privilege level; 4: clear event enable */ 42 42 uint16_t cs; /**< Code selector */ 43 uintptr_t address;/**< Code offset */43 void *address; /**< Code offset */ 44 44 } trap_info_t; 45 46 47 typedef struct { 48 evtchn_t port; 49 } evtchn_send_t; 50 51 typedef struct { 52 uint32_t cmd; 53 union { 54 evtchn_send_t send; 55 }; 56 } evtchn_op_t; 45 57 46 58 … … 49 61 #define XEN_SET_CALLBACKS 4 50 62 #define XEN_UPDATE_VA_MAPPING 14 63 #define XEN_EVENT_CHANNEL_OP 16 51 64 #define XEN_VERSION 17 52 65 #define XEN_CONSOLE_IO 18 … … 79 92 80 93 94 #define EVTCHNOP_SEND 4 95 96 81 97 #define UVMF_NONE 0 /**< No flushing at all */ 82 98 #define UVMF_TLB_FLUSH 1 /**< Flush entire TLB(s) */ … … 227 243 } 228 244 245 static inline int xen_notify_remote(evtchn_t channel) 246 { 247 evtchn_op_t op; 248 249 op.cmd = EVTCHNOP_SEND; 250 op.send.port = channel; 251 return hypercall1(XEN_EVENT_CHANNEL_OP, &op); 252 } 253 229 254 #endif -
kernel/arch/xen32/src/asm.S
r5b23a82 r7c5a8dd 38 38 .global xen_failsafe_callback 39 39 .global enable_l_apic_in_msr 40 .global interrupt_handlers41 40 .global memcpy 42 41 .global memcpy_from_uspace … … 124 123 pop %eax 125 124 ret 126 127 # Clear nested flag128 # overwrites %ecx129 .macro CLEAR_NT_FLAG130 pushfl131 pop %ecx132 and $0xffffbfff,%ecx133 push %ecx134 popfl135 .endm136 137 ## Declare interrupt handlers138 #139 # Declare interrupt handlers for n interrupt140 # vectors starting at vector i.141 #142 # The handlers setup data segment registers143 # and call exc_dispatch().144 #145 #define INTERRUPT_ALIGN 64146 .macro handler i n147 148 .ifeq \i-0x30 # Syscall handler149 push %ds150 push %es151 push %fs152 push %gs153 154 # Push arguments on stack155 push %edi156 push %esi157 push %edx158 push %ecx159 push %eax160 161 # we must fill the data segment registers162 movw $16,%ax163 movw %ax,%ds164 movw %ax,%es165 166 sti167 168 call syscall_handler # syscall_handler(ax,cx,dx,si,di)169 cli170 addl $20, %esp # clean-up of parameters171 172 pop %gs173 pop %fs174 pop %es175 pop %ds176 177 CLEAR_NT_FLAG178 iret179 .else180 /*181 * This macro distinguishes between two versions of ia32 exceptions.182 * One version has error word and the other does not have it.183 * The latter version fakes the error word on the stack so that the184 * handlers and istate_t can be the same for both types.185 */186 .iflt \i-32187 .if (1 << \i) & ERROR_WORD_INTERRUPT_LIST188 /*189 * With error word, do nothing190 */191 .else192 /*193 * Version without error word,194 */195 subl $4, %esp196 .endif197 .else198 /*199 * Version without error word,200 */201 subl $4, %esp202 .endif203 204 push %ds205 push %es206 push %fs207 push %gs208 209 #ifdef CONFIG_DEBUG_ALLREGS210 push %ebx211 push %ebp212 push %edi213 push %esi214 #else215 sub $16, %esp216 #endif217 push %edx218 push %ecx219 push %eax220 221 # we must fill the data segment registers222 movw $16,%ax223 movw %ax,%ds224 movw %ax,%es225 226 pushl %esp # *istate227 pushl $(\i) # intnum228 call exc_dispatch # excdispatch(intnum, *istate)229 addl $8,%esp # Clear arguments from stack230 231 CLEAR_NT_FLAG # Modifies %ecx232 233 pop %eax234 pop %ecx235 pop %edx236 #ifdef CONFIG_DEBUG_ALLREGS237 pop %esi238 pop %edi239 pop %ebp240 pop %ebx241 #else242 add $16, %esp243 #endif244 245 pop %gs246 pop %fs247 pop %es248 pop %ds249 250 addl $4,%esp # Skip error word, no matter whether real or fake.251 iret252 .endif253 254 .align INTERRUPT_ALIGN255 .if (\n-\i)-1256 handler "(\i+1)",\n257 .endif258 .endm259 260 # keep in sync with pm.h !!!261 IDT_ITEMS=64262 .align INTERRUPT_ALIGN263 interrupt_handlers:264 h_start:265 handler 0 IDT_ITEMS266 h_end:267 268 .data269 .global interrupt_handler_size270 271 interrupt_handler_size: .long (h_end-h_start)/IDT_ITEMS -
kernel/arch/xen32/src/drivers/xconsole.c
r5b23a82 r7c5a8dd 40 40 #include <console/console.h> 41 41 #include <arch/hypercall.h> 42 #include <mm/frame.h> 42 43 44 #define MASK_INDEX(index, ring) ((index) & (sizeof(ring) - 1)) 45 46 typedef struct { 47 char in[1024]; 48 char out[2048]; 49 uint32_t in_cons; 50 uint32_t in_prod; 51 uint32_t out_cons; 52 uint32_t out_prod; 53 } xencons_t; 54 55 static bool asynchronous = false; 43 56 static void xen_putchar(chardev_t *d, const char ch); 44 57 … … 52 65 chardev_initialize("xen_out", &xen_console, &xen_ops); 53 66 stdout = &xen_console; 67 if (!(start_info.flags & SIF_INITDOMAIN)) 68 asynchronous = true; 54 69 } 55 70 56 71 void xen_putchar(chardev_t *d, const char ch) 57 72 { 58 xen_console_io(CONSOLE_IO_WRITE, 1, &ch); 73 if (asynchronous) { 74 xencons_t *console = (xencons_t *) PA2KA(MA2PA(PFN2ADDR(start_info.console_mfn))); 75 uint32_t cons = console->out_cons; 76 uint32_t prod = console->out_prod; 77 78 memory_barrier(); 79 80 if ((prod - cons) > sizeof(console->out)) 81 return; 82 83 if (ch == '\n') 84 console->out[MASK_INDEX(prod++, console->out)] = '\r'; 85 console->out[MASK_INDEX(prod++, console->out)] = ch; 86 87 write_barrier(); 88 89 console->out_prod = prod; 90 91 xen_notify_remote(start_info.console_evtchn); 92 } else 93 xen_console_io(CONSOLE_IO_WRITE, 1, &ch); 59 94 } 60 95 -
kernel/arch/xen32/src/pm.c
r5b23a82 r7c5a8dd 104 104 } 105 105 106 static void trap(void) 107 { 108 } 109 106 110 void traps_init(void) 107 111 { … … 117 121 118 122 traps[i].cs = XEN_CS; 119 traps[i].address = ((uintptr_t) interrupt_handlers) + i * interrupt_handler_size;123 traps[i].address = trap; 120 124 exc_register(i, "undef", (iroutine) null_interrupt); 121 125 }
Note:
See TracChangeset
for help on using the changeset viewer.