Show
Ignore:
Timestamp:
08/06/08 14:35:32 (4 years ago)
Author:
mwhitworth
Message:

Fix locking in module loading.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/trunk/kernel/module.c

    r730 r824  
    121121#endif 
    122122 
     123SYMBOL_EXPORT(ModuleSymbolPrint); 
     124 
    123125DWORD ModuleResolveKernel(char* name) 
    124126{ 
     
    136138        struct Module* curr; 
    137139 
     140        PreemptDisable(); 
     141 
    138142        /* Look through the kernel symbol table of different modules. */ 
    139143        ListForEachEntry(curr, &moduleList, next) 
     
    148152                { 
    149153                        if (!strcmp(currSym->name, name)) 
     154                        { 
     155                                PreemptEnable(); 
    150156                                return currSym->addr; 
     157                        } 
    151158 
    152159                        currSym++; 
     
    155162        } 
    156163 
    157         KePrint("Could not resolve %s\n", name); 
     164        PreemptEnable(); 
    158165 
    159166        return 0; 
     
    198205                                        break; 
    199206 
    200                                 KePrint("Could not resolve %s\n", symName); 
     207                                KePrint(KERN_ERROR "Could not resolve %s\n", symName); 
     208 
    201209                                return -ENOENT; 
    202210 
     
    373381        module->keSymTab=ModuleSectionFind(module, (char*)file+sectionHeaders[elfHeader->strTabSectionIndex].shOffset, ".symtable", elfHeader->shEntries, &module->keSymTabSize); 
    374382 
    375         ListAdd(&module->next, &moduleList); 
     383        PreemptDisable(); 
     384        ListAddTail(&module->next, &moduleList); 
     385        PreemptEnable(); 
    376386 
    377387        return ret; 
     
    411421                strcat(buf, ".sys"); 
    412422 
    413                 KePrint("length = %#X: ", *length); 
    414  
    415423                if (ModuleAdd(data, kData, *length, 0)) 
    416424                        KernelPanic("Could not initialize the kernel"); 
    417425 
    418                 KePrint("MODULES: Loaded %s, %dkb\n", buf, (*length)/1024); 
     426                KePrint(KERN_INFO "MODULES: Loaded %s, %dkb\n", buf, (*length)/1024); 
    419427 
    420428                names+=strlen(names)+1; 
     
    434442        int ret; 
    435443 
    436         SpinLock(&moduleListLock); 
    437  
    438444        /* Check data is ok to access. */ 
    439445        kData=(void*)VirtMapPhysRange(MODULE_START, MODULE_END, PAGE_ALIGN_UP(length) >> PAGE_SHIFT, 3); 
    440446 
    441447        ret=ModuleAdd(data, kData, length, 0); 
    442         SpinUnlock(&moduleListLock); 
    443448 
    444449        return ret;