void Make_Zone (void) { extern LIB$CREATE_USER_VM_ZONE(), LIB$CREATE_VM_ZONE(), LIB$DELETE_VM_ZONE; signed long Real_Zone, User_Zone, Status; Status = LIB$CREATE_VM_ZONE(&Real_Zone) ; XLOG$FAO(LOG$MEM,"!%T MAKE_ZONE: Status: !SL, Zone: !SL!/", 0, Status, Real_Zone) ; if (! Status) { Signal (Status); }; Status = LIB$CREATE_USER_VM_ZONE(&User_Zone, &Real_Zone, Get_Mem, Free_Mem, Reset_Mem, LIB$DELETE_VM_ZONE) ; XLOG$FAO(LOG$MEM,"!%T MAKE_ZONE: Status: !SL, Zone: !SL UZone: !SL!/", 0, Status, Real_Zone, User_Zone) ; if (! Status) { Signal (Status); }; Mem_Stat(); return (User_Zone); }
Get_Mem (Size, Block_A, Zone) { signed long Status; XLOG$FAO(LOG$MEM,"!%T GET_MEM: Size: !SL, Addr: !SL, Zone: !SL!/", 0, Size, Block_A, Zone) ; Status = LIB$GET_VM(Size, &Block_A, Zone) ; XLOG$FAO(LOG$MEM,"!%T GET_MEM: Status: !SL, Size: !SL, Addr: !SL, Zone: !SL!/", 0, Status, Size, Block_A, Zone) ; Mem_Stat(); return (Status); }
Reset_Mem (Size, Block_A, Zone) { signed long Status; Status = LIB$RESET_VM_ZONE(Zone) ; XLOG$FAO(LOG$MEM,"!%T RESET_MEM: Status: !SL Size: !SL, Addr: !SL, Zone: !SL!/", 0, Status, Size, Block_A, Zone) ; Mem_Stat() ; return (Status); }
VTCB_Insert ( struct tcb_structure * TCB ) { extern MOVBYT(); signed long J, Indx, Old; NOINT; Indx = 0; for (J=1; J<=vtcb_size; J++) if (vtcb_ptr[J] == 0) { Indx = J; break; } if (Indx == 0) { OPR$FAO("MMgr: Growing Valid TCB table to !SW entries...!/", vtcb_size*2); // This should be called at AST level to assure that we aren't // pulling the rug out from anyone Indx = vtcb_size; vtcb_size = vtcb_size * 2; Old = vtcb_ptr; mm$get_mem( &vtcb_ptr , (vtcb_size+1) * sizeof(long) ); MOVBYT ( (Indx+1) * sizeof(long) , Old , vtcb_ptr ); mm$free_mem( Old , (Indx+1) * sizeof(long) ); Indx = Indx + 1; }; // Maintain pointer to last TCB in table if (Indx > max_tcb) max_tcb = Indx; //OPR$FAO("!%T max_tcb = !UW",0,max_tcb); // Link the new TCB into the Valid TCB table. vtcb_ptr[Indx] = TCB; // set TCB's address tcb_count = tcb_count + 1; // Keep track of active TCB's. TCB->vtcb_index = Indx; // Remember index into Valid TCB Table OKINT; // Carry on... return SS$_NORMAL; }
void Mem_Stat (void) { signed long ngets, nfrees, nbytes, Status; Status = LIB$STAT_VM(/*%REF*/(1), &ngets) ; if (! Status) Signal (Status); Status = LIB$STAT_VM(/*%REF*/(2), &nfrees) ; if (! Status) Signal (Status); Status = LIB$STAT_VM(/*%REF*/(3), &nbytes) ; XLOG$FAO(LOG$MEM,"!%T MEM_STAT: Gets: !SL, Frees: !SL, Bytes: !SL!/", 0,ngets, nfrees, nbytes); if (! Status) Signal (Status); }