Show
Ignore:
Timestamp:
09/23/08 14:30:48 (4 months ago)
Author:
mwhitworth
Message:

Call SlabInit in VirtInit, add locking, remove imports.h

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/trunk/arch/i386/mm/virt.c

    r741 r895  
    1010 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1111 *  GNU General Public License for more details. 
    12  * 
    13  *  You should have received a copy of the GNU General Public License 
    14  *  along with Whitix; if not, write to the Free Software 
    15  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
    1612 * 
    1713 */ 
     
    2723#include <malloc.h> 
    2824#include <slab.h> 
    29 #include <imports.h> 
    3025#include <print.h> 
    3126 
     
    6661int VirtMemManagerSetup(struct Process* process) 
    6762{ 
    68         process->memManager=(struct MemManager*)memCacheAlloc(managerCache); 
     63        process->memManager=(struct MemManager*)MemCacheAlloc(managerCache); 
    6964        if (!process->memManager) 
    7065                return -EFAULT; 
     
    172167        } 
    173168 
    174         ListAdd(&manager->list,&managerList); 
     169        if (currThread) 
     170                PreemptDisable(); 
     171 
     172        ListAddTail(&manager->list,&managerList); 
     173 
     174        if (currThread) 
     175                PreemptEnable(); 
    175176 
    176177        IrqRestoreFlags(flags); 
     
    211212         * one for safety, as this one will be freed. */ 
    212213 
     214        PreemptDisable(); 
     215 
    213216        if (manager == current->memManager) 
    214217                VirtSetCurrent(&kernelMem); 
     
    227230        VirtUnmapPhysPage((DWORD)vPageDir); 
    228231        ListRemove(&manager->list); 
    229         memCacheFree(managerCache,manager); 
     232 
     233        PreemptEnable(); 
     234 
     235        MemCacheFree(managerCache,manager); 
    230236 
    231237        return 0; 
     
    242248int VirtInit() 
    243249{ 
    244         managerCache=memCacheCreate("Manager Cache",sizeof(struct MemManager),NULL,NULL,0); 
     250        managerCache=MemCacheCreate("Manager Cache",sizeof(struct MemManager),NULL,NULL,0); 
    245251        if (!managerCache) 
    246252                return -ENOMEM; 
     253         
     254        extern int SlabInit();   
     255        SlabInit(); 
    247256 
    248257        return 0;