Subversion Repositories HelenOS

Rev

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

Rev 3209 Rev 3790
Line 73... Line 73...
73
    }
73
    }
74
 
74
 
75
    l_apic_address = (uintptr_t) frame_alloc(ONE_FRAME,
75
    l_apic_address = (uintptr_t) frame_alloc(ONE_FRAME,
76
        FRAME_ATOMIC | FRAME_KA);
76
        FRAME_ATOMIC | FRAME_KA);
77
    if (!l_apic_address)
77
    if (!l_apic_address)
78
        panic("cannot allocate address for l_apic\n");
78
        panic("Cannot allocate address for l_apic.");
79
 
79
 
80
    io_apic_address = (uintptr_t) frame_alloc(ONE_FRAME,
80
    io_apic_address = (uintptr_t) frame_alloc(ONE_FRAME,
81
        FRAME_ATOMIC | FRAME_KA);
81
        FRAME_ATOMIC | FRAME_KA);
82
    if (!io_apic_address)
82
    if (!io_apic_address)
83
        panic("cannot allocate address for io_apic\n");
83
        panic("Cannot allocate address for io_apic.");
84
 
84
 
85
    if (config.cpu_count > 1) {    
85
    if (config.cpu_count > 1) {    
86
        page_mapping_insert(AS_KERNEL, l_apic_address,
86
        page_mapping_insert(AS_KERNEL, l_apic_address,
87
            (uintptr_t) l_apic, PAGE_NOT_CACHEABLE | PAGE_WRITE);
87
            (uintptr_t) l_apic, PAGE_NOT_CACHEABLE | PAGE_WRITE);
88
        page_mapping_insert(AS_KERNEL, io_apic_address,
88
        page_mapping_insert(AS_KERNEL, io_apic_address,
Line 155... Line 155...
155
         * Prepare new GDT for CPU in question.
155
         * Prepare new GDT for CPU in question.
156
         */
156
         */
157
        gdt_new = (struct descriptor *) malloc(GDT_ITEMS *
157
        gdt_new = (struct descriptor *) malloc(GDT_ITEMS *
158
            sizeof(struct descriptor), FRAME_ATOMIC | FRAME_LOW_4_GiB);
158
            sizeof(struct descriptor), FRAME_ATOMIC | FRAME_LOW_4_GiB);
159
        if (!gdt_new)
159
        if (!gdt_new)
160
            panic("couldn't allocate memory for GDT\n");
160
            panic("Cannot allocate memory for GDT.");
161
 
161
 
162
        memcpy(gdt_new, gdt, GDT_ITEMS * sizeof(struct descriptor));
162
        memcpy(gdt_new, gdt, GDT_ITEMS * sizeof(struct descriptor));
163
        memsetb(&gdt_new[TSS_DES], sizeof(struct descriptor), 0);
163
        memsetb(&gdt_new[TSS_DES], sizeof(struct descriptor), 0);
164
        protected_ap_gdtr.limit = GDT_ITEMS * sizeof(struct descriptor);
164
        protected_ap_gdtr.limit = GDT_ITEMS * sizeof(struct descriptor);
165
        protected_ap_gdtr.base = KA2PA((uintptr_t) gdt_new);
165
        protected_ap_gdtr.base = KA2PA((uintptr_t) gdt_new);