X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fdrv%2Fiocache.c;h=ba822df8bf31534b8601ac3a48c9c27f706f3a21;hb=65c21ebcac30ca3c5a1303149f2c795bde5f990f;hp=271fc8402680234a7e68054d5e7873eb6ce417c0;hpb=9143c184873d0b55444dc1c1084f3e9f3f2614bf;p=tpg%2Facess2.git diff --git a/Kernel/drv/iocache.c b/Kernel/drv/iocache.c index 271fc840..ba822df8 100644 --- a/Kernel/drv/iocache.c +++ b/Kernel/drv/iocache.c @@ -3,6 +3,8 @@ * - IO Cache * * By thePowersGang (John Hodge) + * + * TODO: Convert to use spare physical pages instead */ #define DEBUG 0 #include @@ -10,6 +12,7 @@ // === TYPES === typedef struct sIOCache_Ent tIOCache_Ent; +typedef struct sIOCache_PageInfo tIOCache_PageInfo; // === STRUCTURES === struct sIOCache_Ent @@ -21,6 +24,15 @@ struct sIOCache_Ent Uint8 Data[]; }; +struct sIOCache_PageInfo +{ + tIOCache_PageInfo *GlobalNext; + tIOCache_PageInfo *CacheNext; + tIOCache *Owner; + tPAddr BasePhys; + Uint64 BaseOffset; +}; + struct sIOCache { tIOCache *Next; @@ -38,6 +50,7 @@ struct sIOCache tShortSpinlock glIOCache_Caches; tIOCache *gIOCache_Caches = NULL; int giIOCache_NumCaches = 0; +tIOCache_PageInfo *gIOCache_GlobalPages; // === CODE === /** @@ -305,14 +318,14 @@ void IOCache_Destroy( tIOCache *Cache ) // Remove from list SHORTLOCK( &glIOCache_Caches ); { - tIOCache *ent; - tIOCache *prev = (tIOCache*)&gIOCache_Caches; - for(ent = gIOCache_Caches; - ent; - prev = ent, ent = ent->Next ) + tIOCache *cache; + tIOCache *prev_cache = (tIOCache*)&gIOCache_Caches; + for(cache = gIOCache_Caches; + cache; + prev_cache = cache, cache = cache->Next ) { - if(ent == Cache) { - prev->Next = ent->Next; + if(cache == Cache) { + prev_cache->Next = cache->Next; break; } }