From 00c5f4867ff49c2800d01d20991732f3db654991 Mon Sep 17 00:00:00 2001 From: 410 Date: Mon, 19 Jun 2017 20:34:01 -0500 Subject: [PATCH] Test completes. The source of my frustration was moving pools[nPools] = *this to the end of the constructor. --- .gitignore | 2 ++ MP2/MP2_Sources/cont_frame_pool.C | 29 +++-------------------------- MP2/MP2_Sources/kernel.C | 2 -- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index fa04242..88ad4b3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf DevEnv/ *.o *.bin +dev_kernel_grub.img +bochsout.txt diff --git a/MP2/MP2_Sources/cont_frame_pool.C b/MP2/MP2_Sources/cont_frame_pool.C index bbfde02..3c1af89 100644 --- a/MP2/MP2_Sources/cont_frame_pool.C +++ b/MP2/MP2_Sources/cont_frame_pool.C @@ -148,9 +148,6 @@ ContFramePool::ContFramePool(unsigned long _base_frame_no, nFreeFrames = _n_frames; info_frame_no = _info_frame_no; n_info_frames = _n_info_frames; - - pools[nPools] = *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 @@ -204,6 +201,9 @@ ContFramePool::ContFramePool(unsigned long _base_frame_no, } } + + pools[nPools] = *this; + nPools += 1; Console::puts("Frame Pool initialized\n"); } @@ -229,16 +229,10 @@ unsigned long ContFramePool::get_frames(unsigned int _n_frames) while (true) { - //Console::puts("Entered first loop"); unsigned char mask = 0x80 >> (j*2); // check every 2 bits for a free frame in the bitmap while((mask & bitmap[i]) == 0 || ((mask >> 1) & bitmap[i]) == 0) { - //Console::puti(i); - //Console::puts("\n"); - //Console::puti(j); - //Console::puts("\n"); - //Console::puts("Entered second loop"); if(mask != 0x02) { j++; @@ -256,7 +250,6 @@ unsigned long ContFramePool::get_frames(unsigned int _n_frames) c++; while(c < _n_frames) { - //Console::puts("Entered sequence check"); if(mask != 0x02) { mask = mask >> 2; @@ -294,7 +287,6 @@ unsigned long ContFramePool::get_frames(unsigned int _n_frames) unsigned int temp = i; while(c < _n_frames) { - //Console::puts("Entered bitmap update"); if(mask != 0x02) { mask = mask >> 2; @@ -362,19 +354,9 @@ void ContFramePool::release_frames_here(unsigned long _first_frame_no) { unsigned char * bitmap = this->bitmap; - Console::puti(_first_frame_no); - Console::puts("\n"); - Console::puti(base_frame_no); - unsigned int bitmap_index = (_first_frame_no - base_frame_no) / 4; unsigned char mask = 0x80 >> ((_first_frame_no - base_frame_no) % 4) * 2; - // - Console::puts("\n"); - Console::puti(bitmap[bitmap_index]); - Console::puts("\n"); - Console::puti(bitmap[bitmap_index + 1]); - // if(!((bitmap[bitmap_index] & mask) == 0 && (bitmap[bitmap_index] & (mask >> 1)) != 0)) { if((bitmap[bitmap_index] & mask) != 0 && (bitmap[bitmap_index] & (mask >> 1)) != 0) @@ -401,11 +383,6 @@ void ContFramePool::release_frames_here(unsigned long _first_frame_no) while(bitmap[bitmap_index] & mask == 0 && (bitmap[bitmap_index] & (mask >> 1)) == 0) { - Console::puts("\n"); - Console::puti(bitmap_index); - Console::puts("\n"); - Console::puti(mask); - Console::puts("\n"); bitmap[bitmap_index] ^= mask; bitmap[bitmap_index] ^= (mask >> 1); if(mask != 0x02) diff --git a/MP2/MP2_Sources/kernel.C b/MP2/MP2_Sources/kernel.C index 51117d2..4376f60 100755 --- a/MP2/MP2_Sources/kernel.C +++ b/MP2/MP2_Sources/kernel.C @@ -110,8 +110,6 @@ void test_memory(ContFramePool * _pool, unsigned int _allocs_to_go) { Console::puts("alloc_to_go = "); Console::puti(_allocs_to_go); Console::puts("\n"); if (_allocs_to_go > 0) { int n_frames = _allocs_to_go % 4 + 1; - Console::puti(n_frames); - Console::puts("\n"); unsigned long frame = _pool->get_frames(n_frames); int * value_array = (int*)(frame * (4 KB)); for (int i = 0; i < (1 KB) * n_frames; i++) {