Merge branch 'master' into ohligs
This commit is contained in:
commit
5af1ae0386
2 changed files with 37 additions and 22 deletions
|
@ -327,18 +327,23 @@ void smp_start(uint32_t id)
|
|||
}
|
||||
#endif
|
||||
|
||||
static unsigned int* search_apic(unsigned int base, unsigned int limit) {
|
||||
uint32_t* ptr;
|
||||
#if 1
|
||||
static apic_mp_t* search_apic(size_t base, size_t limit) {
|
||||
size_t ptr;
|
||||
apic_mp_t* tmp;
|
||||
|
||||
for (ptr = (uint32_t*) base; (uint32_t) ptr < limit; ptr++) {
|
||||
if (*ptr == MP_FLT_SIGNATURE) {
|
||||
if (!(((apic_mp_t*)ptr)->version > 4) && ((apic_mp_t*)ptr)->features[0])
|
||||
return ptr;
|
||||
}
|
||||
for (ptr=base; ptr<=limit-sizeof(uint32_t); ptr++) {
|
||||
tmp = (apic_mp_t*) ptr;
|
||||
|
||||
if (tmp->signature == MP_FLT_SIGNATURE) {
|
||||
if (!((tmp->version > 4) || tmp->features[0]))
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MAX_CORES > 1
|
||||
int smp_init(void)
|
||||
|
@ -362,7 +367,7 @@ int smp_init(void)
|
|||
*/
|
||||
bootaddr = (char*) SMP_SETUP_ADDR;
|
||||
memcpy(bootaddr, boot_code, sizeof(boot_code));
|
||||
for(j=0; j<sizeof(boot_code)-sizeof(uint32_t); j++)
|
||||
for(j=0; j<=sizeof(boot_code)-sizeof(uint32_t); j++)
|
||||
{
|
||||
// replace 0xDEADC0DE with the address of the smp entry code
|
||||
if (*((uint32_t*) (bootaddr+j)) == 0xDEADC0DE) {
|
||||
|
@ -559,15 +564,15 @@ static int apic_probe(void)
|
|||
uint32_t i, count;
|
||||
int isa_bus = -1;
|
||||
|
||||
apic_mp = (apic_mp_t*) search_apic(0xF0000, 0x100000);
|
||||
#if 1
|
||||
apic_mp = search_apic(0xF0000, 0x100000);
|
||||
if (apic_mp)
|
||||
goto found_mp;
|
||||
apic_mp = (apic_mp_t*) search_apic(0x9F000, 0xA0000);
|
||||
apic_mp = search_apic(0x9F000, 0xA0000);
|
||||
if (apic_mp)
|
||||
goto found_mp;
|
||||
|
||||
#else
|
||||
// searching MP signature in the reserved memory areas
|
||||
#ifdef CONFIG_MULTIBOOT
|
||||
if (mb_info && (mb_info->flags & MULTIBOOT_INFO_MEM_MAP)) {
|
||||
multiboot_memory_map_t* mmap = (multiboot_memory_map_t*) mb_info->mmap_addr;
|
||||
multiboot_memory_map_t* mmap_end = (void*) ((size_t) mb_info->mmap_addr + mb_info->mmap_length);
|
||||
|
@ -576,10 +581,19 @@ static int apic_probe(void)
|
|||
if (mmap->type == MULTIBOOT_MEMORY_RESERVED) {
|
||||
addr = mmap->addr;
|
||||
|
||||
for(i=0; i<mmap->len-sizeof(uint32_t); i++, addr++) {
|
||||
/*
|
||||
* MultiProcessor Specification 1.4:
|
||||
* =================================
|
||||
* The following is a list of the suggested memory spaces for the MP configuration table:
|
||||
* a. In the first kilobyte of Extended BIOS Data Area (EBDA), or
|
||||
* b. Within the last kilobyte of system base memory if the EBDA segment is undefined, or
|
||||
* c. At the top of system physical memory, or
|
||||
* d. In the BIOS read-only memory space between 0E0000h and 0FFFFFh.
|
||||
*/
|
||||
for(i=0; (i<mmap->len-sizeof(uint32_t)) && (addr < 0x0FFFFF); i++, addr++) {
|
||||
if (*((uint32_t*) addr) == MP_FLT_SIGNATURE) {
|
||||
apic_mp = (apic_mp_t*) addr;
|
||||
if (!(apic_mp->version > 4) && apic_mp->features[0])
|
||||
if (!((apic_mp->version > 4) || apic_mp->features[0]))
|
||||
goto found_mp;
|
||||
}
|
||||
}
|
||||
|
@ -593,6 +607,7 @@ found_mp:
|
|||
if (!apic_mp)
|
||||
goto no_mp;
|
||||
|
||||
kprintf("Found MP config table at 0x%x\n", apic_mp);
|
||||
kprintf("System uses Multiprocessing Specification 1.%u\n", apic_mp->version);
|
||||
kprintf("MP features 1: %u\n", apic_mp->features[0]);
|
||||
|
||||
|
|
|
@ -440,10 +440,10 @@ extern syscall_handler
|
|||
|
||||
; used to realize system calls
|
||||
isrsyscall:
|
||||
;push ds
|
||||
;push fs
|
||||
;push gs
|
||||
;push es
|
||||
push ds
|
||||
push fs
|
||||
push gs
|
||||
push es
|
||||
push ebp
|
||||
push edi
|
||||
push esi
|
||||
|
@ -460,10 +460,10 @@ isrsyscall:
|
|||
pop esi
|
||||
pop edi
|
||||
pop ebp
|
||||
;pop es
|
||||
;pop gs
|
||||
;pop fs
|
||||
;pop ds
|
||||
pop es
|
||||
pop gs
|
||||
pop fs
|
||||
pop ds
|
||||
iret
|
||||
|
||||
global irq0
|
||||
|
|
Loading…
Add table
Reference in a new issue