1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/memory_utils.h Tue Jan 19 23:26:49 2021 +0100
1.3 @@ -0,0 +1,25 @@
1.4 +#pragma once
1.5 +
1.6 +#include "types.h"
1.7 +
1.8 +#define PAGE_SIZE 4096
1.9 +
1.10 +
1.11 +
1.12 +/* Address arithmetic. */
1.13 +
1.14 +offset_t page(unsigned int n);
1.15 +
1.16 +unsigned int page_order(offset_t size);
1.17 +
1.18 +offset_t round(offset_t value, offset_t increment);
1.19 +
1.20 +offset_t round_multiple(offset_t value, offset_t increment);
1.21 +
1.22 +offset_t trunc(offset_t value, offset_t increment);
1.23 +
1.24 +offset_t trunc_multiple(offset_t value, offset_t increment);
1.25 +
1.26 +offset_t max_multiple(offset_t start, offset_t end, offset_t increment);
1.27 +
1.28 +// vim: tabstop=4 expandtab shiftwidth=4