Subversion Repositories HelenOS

Rev

Rev 2089 | Rev 2233 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2089 Rev 2227
Line 119... Line 119...
119
 * This function takes care of proper setup of IDT and IDTR.
119
 * This function takes care of proper setup of IDT and IDTR.
120
 */
120
 */
121
void idt_init(void)
121
void idt_init(void)
122
{
122
{
123
    idescriptor_t *d;
123
    idescriptor_t *d;
124
    int i;
124
    unsigned int i;
125
 
125
 
126
    for (i = 0; i < IDT_ITEMS; i++) {
126
    for (i = 0; i < IDT_ITEMS; i++) {
127
        d = &idt[i];
127
        d = &idt[i];
128
 
128
 
129
        d->unused = 0;
129
        d->unused = 0;
Line 228... Line 228...
228
    gdt_setbase(&gdt_p[TLS_DES], tls);
228
    gdt_setbase(&gdt_p[TLS_DES], tls);
229
    /* Reload gdt register to update GS in CPU */
229
    /* Reload gdt register to update GS in CPU */
230
    gdtr_load(&cpugdtr);
230
    gdtr_load(&cpugdtr);
231
}
231
}
232
 
232
 
-
 
233
/* Reboot the machine by initiating
-
 
234
 * a triple fault
-
 
235
 */
-
 
236
void arch_reboot(void)
-
 
237
{
-
 
238
    preemption_disable();
-
 
239
    ipl_t ipl = interrupts_disable();
-
 
240
   
-
 
241
    memsetb((uintptr_t) idt, sizeof(idt), 0);
-
 
242
   
-
 
243
    ptr_16_32_t idtr;
-
 
244
    idtr.limit = sizeof(idt);
-
 
245
    idtr.base = (uintptr_t) idt;
-
 
246
    idtr_load(&idtr);
-
 
247
   
-
 
248
    interrupts_restore(ipl);
-
 
249
    asm volatile (
-
 
250
        "int $0x03\n"
-
 
251
        "hlt\n"
-
 
252
    );
-
 
253
}
-
 
254
 
233
/** @}
255
/** @}
234
 */
256
 */