Skip to content

Implement physical memory allocator#89

Open
dawidpawliczek4 wants to merge 5 commits intoOperacja-System:mainfrom
dawidpawliczek4:pmem-allocator
Open

Implement physical memory allocator#89
dawidpawliczek4 wants to merge 5 commits intoOperacja-System:mainfrom
dawidpawliczek4:pmem-allocator

Conversation

@dawidpawliczek4
Copy link
Contributor

No description provided.

@dawidpawliczek4 dawidpawliczek4 marked this pull request as draft March 11, 2026 07:22
@Kamilosok Kamilosok added enhancement New feature or request good first issue Good for newcomers labels Mar 11, 2026
@frogrammer9 frogrammer9 removed good first issue Good for newcomers labels Mar 11, 2026
@dawidpawliczek4 dawidpawliczek4 changed the title Implement physical memory allocator using bitmap Implement physical memory allocator Mar 13, 2026
@dawidpawliczek4 dawidpawliczek4 marked this pull request as ready for review March 13, 2026 13:16
@dawidpawliczek4 dawidpawliczek4 requested review from frogrammer9 and qbojj and removed request for frogrammer9 March 13, 2026 13:17
*addrOUT = *addrOUT;
(void)header;
return ERR_NOT_IMPLEMENTED;
error_t pmallocator_allocate(frame_order_t frame_order, memory_region_t header_region, phys_addr_t* addrOUT) {
Copy link
Collaborator

@qbojj qbojj Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be wrapped in a critical section (both signals and for other harts).
For now you can add a blank implementation on hal_critical_section_{begin/end} to the hal and just call them here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when hal is merged, just do hal_enable_irq/hal_disable_irq and add a FIXME: use a real critical section

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was decided there will be no parallelism, so no need for critical section (but interrupt disablement is still required)

(void)addr;
(void)header;
return ERR_NOT_IMPLEMENTED;
error_t pmallocator_free(frame_order_t frame_order, phys_addr_t addr, memory_region_t header_region) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

memory_region_t header_region = phys_mem_reg_to_reg(header_pmr);
phys_addr_t frame_data = nullptr;
error_t err = pmallocator_allocate(frame_size + 12, header_region, &frame_data);
error_t err = pmallocator_allocate(frame_size, header_region, &frame_data);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know why the +12 was removed?

Copy link
Collaborator

@Kamilosok Kamilosok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything wrong, if @qbojj's requests are addressed and @frogrammer9 accepts we can merge.

@frogrammer9
Copy link
Contributor

There will be a change made to the palloc interface shortly and i would prefer to wait with merging this PR until it up to date with those changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants