[NSWI004] Assignment 5: Bitmap shrinks unexpectedly

Vojtech Horky horky at d3s.mff.cuni.cz
Mon Jan 6 16:58:55 CET 2020


Hello.

Dne 06. 01. 20 v 16:47 Péťa Emmerová napsal(a):
> Hello,
> we decided to use a bitmap for frame allocator. Firstly, we initialize 
> bitmap in frame_init, and then print out the length of it, which seems 
> to be fine. We then try to allocate the frames after the bitmap. But 
> then, when we take a look at bitmap's length during a frame allocation, 
> it's length unexpectedly drops to 16. Moreover, although all frames in 
> bitmap should be set to zero, they aren't, they contain random values.
> We would appreciate any help or hint how to work with the heap.
> Sincerely, Team Datel

This sounds like a memory corruption. Have you shifted start of the 
frames by the size of the storage for the bitmap?

Looking at your code (f41f9d8a0), I think you do not account for the 
fact that kernel occupies the first few frames of the physical memory.

BTW, you have unreachable code in frame_free() and you do not restore 
interrupts properly.

Hope this helps,
- VH


More information about the NSWI004 mailing list