errors with static linking on pool management members...
This commit is contained in:
parent
2d02f6f0fa
commit
99023dd1d3
2 changed files with 17 additions and 9 deletions
|
@ -127,6 +127,9 @@
|
|||
/* METHODS FOR CLASS C o n t F r a m e P o o l */
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
std::vector<ContFramePool> ContFramePool::pools; // List of frame pools, managed by the class
|
||||
unsigned int ContFramePool::nPools = 0; // Number of pools being managed
|
||||
|
||||
ContFramePool::ContFramePool(unsigned long _base_frame_no,
|
||||
unsigned long _n_frames,
|
||||
unsigned long _info_frame_no,
|
||||
|
@ -145,7 +148,10 @@ ContFramePool::ContFramePool(unsigned long _base_frame_no,
|
|||
nFreeFrames = _n_frames;
|
||||
info_frame_no = _info_frame_no;
|
||||
n_info_frames = _n_info_frames;
|
||||
|
||||
|
||||
pools.push_back(*this);
|
||||
nPools += 1;
|
||||
|
||||
// If _info_frame_no is zero then we keep management info in the first
|
||||
// frame(s), else we use the provided frame(s) to keep management info
|
||||
// NOTE: bitmap needs to be allocated with n_info_frames if specified.
|
||||
|
@ -338,7 +344,7 @@ void ContFramePool::mark_inaccessible(unsigned long _frame_no)
|
|||
void ContFramePool::release_frames(unsigned long _frame_no)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
while(i < pools.size())
|
||||
while(i < nPools)
|
||||
{
|
||||
if(_frame_no < pools[i].base_frame_no || _frame_no > (pools[i].base_frame_no + pools[i].nframes))
|
||||
{
|
||||
|
@ -350,8 +356,6 @@ void ContFramePool::release_frames(unsigned long _frame_no)
|
|||
return;
|
||||
}
|
||||
}
|
||||
// This is the case where we fail to find the frame in any of the pools.
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void ContFramePool::release_frames_here(unsigned long _first_frame_no)
|
||||
|
@ -390,5 +394,5 @@ void ContFramePool::release_frames_here(unsigned long _first_frame_no)
|
|||
|
||||
unsigned long ContFramePool::needed_info_frames(unsigned long _n_frames)
|
||||
{
|
||||
return _n_frames / (FRAME_SIZE * 4);
|
||||
return (_n_frames / (FRAME_SIZE * 4)) + (_n_frames % (FRAME_SIZE * 4) > 0 ? 1 : 0);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#include "machine.H"
|
||||
#include <vector>
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/* DATA STRUCTURES */
|
||||
|
@ -49,10 +50,13 @@ private:
|
|||
unsigned long nframes; // Size of the frame pool
|
||||
unsigned long info_frame_no; // Where do we store the management information?
|
||||
unsigned long n_info_frames; // Number of frames needed to store management info
|
||||
|
||||
static std::vector<ContFramePool> pools; // List of frame pools, managed by the class
|
||||
static unsigned int nPools; // Number of pools being managed
|
||||
|
||||
void mark_inaccessible(unsigned long _frame_no); // Should be a frame marked as
|
||||
// a head, otherwise fails
|
||||
|
||||
void release_frames_here(unsigned long _frame_no); // non-static member function
|
||||
|
||||
public:
|
||||
|
||||
// The frame size is the same as the page size, duh...
|
||||
|
@ -100,8 +104,8 @@ public:
|
|||
_base_frame_no: Number of first frame to mark as inaccessible.
|
||||
_n_frames: Number of contiguous frames to mark as inaccessible.
|
||||
*/
|
||||
|
||||
static void release_frames(unsigned long _first_frame_no);
|
||||
|
||||
static void release_frames(unsigned long _frame_no);
|
||||
/*
|
||||
Releases a previously allocated contiguous sequence of frames
|
||||
back to its frame pool.
|
||||
|
|
Reference in a new issue