diff options
| author | Filip Strömbäck <fstromback@gmail.com> | 2021-03-16 13:01:32 +0100 |
|---|---|---|
| committer | Filip Strömbäck <fstromback@gmail.com> | 2021-03-16 13:01:32 +0100 |
| commit | b7002c53057d4ae049237786d26f00a762dbc2ea (patch) | |
| tree | f13985eaafedba1d64a6aa835bf93392186d0164 /src/standalone/lab14/pagedir.h | |
| parent | cda174afc8e1bf6b779726965f5eaa030d80b1dc (diff) | |
| download | pintos-rs-b7002c53057d4ae049237786d26f00a762dbc2ea.tar.gz | |
Updated names in standalone/ to match new lab numbering.
Diffstat (limited to 'src/standalone/lab14/pagedir.h')
| -rw-r--r-- | src/standalone/lab14/pagedir.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/standalone/lab14/pagedir.h b/src/standalone/lab14/pagedir.h new file mode 100644 index 0000000..2919d1a --- /dev/null +++ b/src/standalone/lab14/pagedir.h @@ -0,0 +1,42 @@ +#ifndef PAGEDIR_H +#define PAGEDIR_H + +typedef int bool; +#define false 0 +#define true 1 + +/* Returns true iff 'adr' contains a null-character ('\0'). */ +bool is_end_of_string(char* adr); + +/* Returns the start address of the page that contains 'adr'. */ +void* pg_round_down(const void* adr); + +/* Returns the page number of the page that contains 'adr'. + * Page numbers are counted with start at zero (0). + */ +unsigned pg_no(const void* adr); + +/* Uses the page table to translate from logic to physical + * address. Returns NULL if the translation fail. + * + * The first parameter specify the top level page table to + * use. Normally you will find it in the structure corresponding + * to your operating systems PCB (Process Control Block). + */ +void *pagedir_get_page (void *pagetable, const void *adr); + +/* Page size: The number of bytes in each page. */ +#define PGSIZE 100 + +/* Functions used to simulate a paging system and testing your + * solution. */ +void start_evaluate_algorithm(void* start, int size); +void evaluate(bool result); +void end_evaluate_algorithm(); + +/* Let us decide how costly a simulated page fault is in terms of + * time. Does not exist in Pintos. Set to zero (0) for faster + * testing. */ +void simulator_set_pagefault_time(unsigned i); + +#endif |
