Merge branch 'main' of git.chauvet.pro:starnakin/42_KFS

This commit is contained in:
0x35c 2024-10-19 23:20:39 +02:00
commit 8c936f6323
2 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ static uint32_t remaining_frames = MAX_FRAMES;
static int32_t find_next_block(size_t nb_frames) static int32_t find_next_block(size_t nb_frames)
{ {
for (uint32_t i = 1; i < MAX_FRAMES; i++) { for (uint32_t i = 1; i + nb_frames < MAX_FRAMES - 1; i++) {
uint32_t j; uint32_t j;
for (j = 0; frame_table[i + j] == 0 && j < nb_frames; j++) for (j = 0; frame_table[i + j] == 0 && j < nb_frames; j++)
; ;

View File

@ -14,7 +14,7 @@ extern uint32_t page_table1[PT_SIZE];
static int16_t find_next_block(size_t nb_pages) static int16_t find_next_block(size_t nb_pages)
{ {
for (uint16_t i = 1; i < PT_SIZE - 1; i++) { for (uint16_t i = 1; i + nb_pages < PT_SIZE - 1; i++) {
uint16_t j; uint16_t j;
for (j = 0; page_table1[i + j] >> 12 == i + j && j < nb_pages; for (j = 0; page_table1[i + j] >> 12 == i + j && j < nb_pages;
j++) j++)