2 ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
5 #ifndef _KERNEL_VM_PRIV_H
6 #define _KERNEL_VM_PRIV_H
9 #include <kernel/khash.h>
11 /* should make these scale with the system */
12 #define DEFAULT_KERNEL_WORKING_SET 1024
13 #define DEFAULT_WORKING_SET 256
14 #define DEFAULT_MAX_WORKING_SET 65536
15 #define DEFAULT_MIN_WORKING_SET 64
17 #define WORKING_SET_INCREMENT 32
18 #define WORKING_SET_DECREMENT 32
20 #define PAGE_DAEMON_INTERVAL 500000
21 #define PAGE_SCAN_QUANTUM 500
22 #define WORKING_SET_ADJUST_INTERVAL 5000000
23 #define MAX_FAULTS_PER_SECOND 100
24 #define MIN_FAULTS_PER_SECOND 10
26 #define WRITE_COUNT 1024
30 #define PAGE_MODIFIED 0x04
31 #define PAGE_ACCESSED 0x08
32 #define PAGE_PRESENT 0x10
34 // Should only be used by vm internals
35 int vm_page_fault(addr address
, addr fault_address
, bool is_write
, bool is_user
, addr
*newip
);
36 void vm_increase_max_commit(addr delta
);
37 int vm_daemon_init(void);
39 // used by the page daemon to walk the list of address spaces
40 int vm_aspace_walk_start(struct hash_iterator
*i
);
41 vm_address_space
*vm_aspace_walk_next(struct hash_iterator
*i
);
43 // get some data about the number of pages in the system
44 addr
vm_page_num_pages(void);
45 addr
vm_page_num_free_pages(void);
47 // allocates memory from the ka structure
48 addr
vm_alloc_from_ka_struct(kernel_args
*ka
, unsigned int size
, int lock
);