We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4112058 commit db85c88Copy full SHA for db85c88
src/kernel/mm/physical_alloc.c
@@ -208,3 +208,15 @@ bool mm_alloc_physical(paddr *out) {
208
*out = paddr_offset(head, link.length << 12);
209
return true;
210
}
211
+
212
+void mm_free_physical(paddr frame) {
213
+ // TODO: There should be a lock around essentially this whole function.
214
+ assert(bits_of_paddr(frame));
215
216
+ struct physical_free_list link = {
217
+ .next = free_list_head,
218
+ .length = 1,
219
+ };
220
+ copy_to_physical(frame, &link, sizeof(struct physical_free_list));
221
+ free_list_head = frame;
222
+}
0 commit comments