From b7002c53057d4ae049237786d26f00a762dbc2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Str=C3=B6mb=C3=A4ck?= Date: Tue, 16 Mar 2021 13:01:32 +0100 Subject: Updated names in standalone/ to match new lab numbering. --- src/standalone/lab14/pagedir.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/standalone/lab14/pagedir.h (limited to 'src/standalone/lab14/pagedir.h') 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 -- cgit v1.2.1