45 lines
925 B
C
45 lines
925 B
C
#include <stdio.h>
|
|
#include <process.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "config.h"
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
first_busy_page = NULL;
|
|
|
|
struct PhysPage *first_free_page = malloc(sizeof(struct PhysPage));
|
|
first_free_page->ppn = 0;
|
|
first_free_page->busy_flag = 0;
|
|
first_free_page->prev = first_free_page;
|
|
first_free_page->next = first_free_page;
|
|
|
|
for (int i = 1; i <= PHYSICAL_PAGE_AMOUNT; i++) {
|
|
struct PhysPage *pp = malloc(sizeof(struct PhysPage));
|
|
pp->ppn = i;
|
|
pp->busy_flag = 0;
|
|
|
|
/*
|
|
* insert into here
|
|
* |
|
|
* v
|
|
* [ ] [ ] [ ]
|
|
* ^
|
|
* |
|
|
* *first_free_page
|
|
*/
|
|
pp->prev = first_free_page->prev;
|
|
pp->next = first_free_page;
|
|
pp->next->prev = pp;
|
|
pp->prev->next = pp;
|
|
}
|
|
|
|
runq = RunQ(10);
|
|
RUNQ_add_process(10000, 50);
|
|
RUNQ_add_process(10000, 50);
|
|
RUNQ_add_process(10000, 50);
|
|
}
|