<div dir="ltr"><div>Thank you very much for the reply.</div><div><br></div><div>We treated frame allocator similarly as kmalloc, so we tried to start right next to the kernel end, and reserve our first frame for the bitmap and its data. (The frame starts right after kernel_end.) Then we try to split memory for heap and frame allocator. <br></div><div>Do we have a bug in our approach?<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">po 6. 1. 2020 v 17:12 odesílatel Vojtech Horky <<a href="mailto:horky@d3s.mff.cuni.cz">horky@d3s.mff.cuni.cz</a>> napsal:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello.<br>
<br>
Dne 06. 01. 20 v 16:47 Péťa Emmerová napsal(a):<br>
> Hello,<br>
> we decided to use a bitmap for frame allocator. Firstly, we initialize <br>
> bitmap in frame_init, and then print out the length of it, which seems <br>
> to be fine. We then try to allocate the frames after the bitmap. But <br>
> then, when we take a look at bitmap's length during a frame allocation, <br>
> it's length unexpectedly drops to 16. Moreover, although all frames in <br>
> bitmap should be set to zero, they aren't, they contain random values.<br>
> We would appreciate any help or hint how to work with the heap.<br>
> Sincerely, Team Datel<br>
<br>
This sounds like a memory corruption. Have you shifted start of the <br>
frames by the size of the storage for the bitmap?<br>
<br>
Looking at your code (f41f9d8a0), I think you do not account for the <br>
fact that kernel occupies the first few frames of the physical memory.<br>
<br>
BTW, you have unreachable code in frame_free() and you do not restore <br>
interrupts properly.<br>
<br>
Hope this helps,<br>
- VH<br>
_______________________________________________<br>
NSWI004 mailing list<br>
<a href="mailto:NSWI004@d3s.mff.cuni.cz" target="_blank">NSWI004@d3s.mff.cuni.cz</a><br>
<a href="https://d3s.mff.cuni.cz/mailman/listinfo/nswi004" rel="noreferrer" target="_blank">https://d3s.mff.cuni.cz/mailman/listinfo/nswi004</a><br>
</blockquote></div>