* vm.h no longer includes vm_types.h - only those that actually need access

to the private VM types are including vm_types.h now.
* Removed vm_page, vm_area, vm_cache, and vm_address_space typedefs; it's
  cleaner this way, and the actual types are only used in C++ files now,
  anyway.
* And that caused changes in many files...
* Made commpage.h self-containing.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22329 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-09-27 12:21:33 +00:00
parent f98d60ae04
commit e6dc7903e4
28 changed files with 216 additions and 169 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@ -9,9 +9,15 @@
#define KERNEL_ARCH_VM_H
#include <vm.h>
#include <arch_vm.h>
#include <SupportDefs.h>
struct kernel_args;
struct vm_area;
struct vm_address_space;
#ifdef __cplusplus
extern "C" {
@ -20,12 +26,13 @@ extern "C" {
status_t arch_vm_init(struct kernel_args *args);
status_t arch_vm_init_post_area(struct kernel_args *args);
status_t arch_vm_init_end(struct kernel_args *args);
status_t arch_vm_init_post_modules(kernel_args *args);
void arch_vm_aspace_swap(vm_address_space *aspace);
status_t arch_vm_init_post_modules(struct kernel_args *args);
void arch_vm_aspace_swap(struct vm_address_space *aspace);
bool arch_vm_supports_protection(uint32 protection);
status_t arch_vm_set_memory_type(vm_area *area, addr_t physicalBase, uint32 type);
void arch_vm_unset_memory_type(vm_area *area);
status_t arch_vm_set_memory_type(struct vm_area *area, addr_t physicalBase,
uint32 type);
void arch_vm_unset_memory_type(struct vm_area *area);
#ifdef __cplusplus
}

View File

@ -5,7 +5,12 @@
#ifndef _KERNEL_ARCH_x86_COMMPAGE_H
#define _KERNEL_ARCH_x86_COMMPAGE_H
/* some systemwide commpage constants, used in the kernel and libroot */
/*! Some systemwide commpage constants, used in the kernel and libroot */
#ifndef _ASSEMBLER
# include <SupportDefs.h>
#endif
/* be careful what you put here, this file is included from assembly */
#define COMMPAGE_ENTRY_MAGIC 0
@ -23,5 +28,4 @@
status_t commpage_init(void);
#endif
#endif
#endif /* _KERNEL_ARCH_x86_COMMPAGE_H */

View File

@ -3,8 +3,8 @@
#ifndef _SYSCALL_ARGS_H
#define _SYSCALL_ARGS_H
#include <KernelExport.h>
#include <vm.h>
#include <kernel.h>
//#include <vm.h>
// Hack to be able to use the IS_USER_ADDRESS macro when compiling for R5.
#ifdef R5_MEMORY_LAYOUT

View File

@ -9,12 +9,17 @@
#define _KERNEL_VM_H
#include <vm_types.h>
#include <arch/vm.h>
#include <arch/vm_translation_map.h>
#include <OS.h>
struct kernel_args;
struct team;
struct vm_page;
struct vm_cache;
struct vm_area;
struct vm_address_space;
struct vnode;
@ -23,13 +28,13 @@ extern "C" {
#endif
// startup only
status_t vm_init(kernel_args *args);
status_t vm_init(struct kernel_args *args);
status_t vm_init_post_sem(struct kernel_args *args);
status_t vm_init_post_thread(struct kernel_args *args);
status_t vm_init_post_modules(struct kernel_args *args);
void vm_free_kernel_args(kernel_args *args);
void vm_free_kernel_args(struct kernel_args *args);
void vm_free_unused_boot_loader_range(addr_t start, addr_t end);
addr_t vm_allocate_early(kernel_args *args, size_t virtualSize,
addr_t vm_allocate_early(struct kernel_args *args, size_t virtualSize,
size_t physicalSize, uint32 attributes);
@ -56,8 +61,8 @@ area_id vm_map_physical_memory(team_id team, const char *name, void **address,
area_id vm_map_file(team_id aid, const char *name, void **address,
uint32 addressSpec, addr_t size, uint32 protection, uint32 mapping,
const char *path, off_t offset);
vm_cache *vm_area_get_locked_cache(vm_area *area);
void vm_area_put_locked_cache(vm_cache *cache);
struct vm_cache *vm_area_get_locked_cache(struct vm_area *area);
void vm_area_put_locked_cache(struct vm_cache *cache);
area_id vm_create_null_area(team_id team, const char *name, void **address,
uint32 addressSpec, addr_t size);
area_id vm_copy_area(team_id team, const char *name, void **_address,
@ -65,16 +70,17 @@ area_id vm_copy_area(team_id team, const char *name, void **_address,
area_id vm_clone_area(team_id team, const char *name, void **address,
uint32 addressSpec, uint32 protection, uint32 mapping,
area_id sourceArea);
status_t vm_delete_area(team_id aid, area_id id);
status_t vm_create_vnode_cache(struct vnode *vnode, vm_cache **_cache);
vm_area *vm_area_lookup(vm_address_space *addressSpace, addr_t address);
status_t vm_delete_area(team_id teamID, area_id areaID);
status_t vm_create_vnode_cache(struct vnode *vnode, struct vm_cache **_cache);
struct vm_area *vm_area_lookup(struct vm_address_space *addressSpace,
addr_t address);
status_t vm_set_area_memory_type(area_id id, addr_t physicalBase, uint32 type);
status_t vm_get_page_mapping(team_id team, addr_t vaddr, addr_t *paddr);
int32 vm_test_map_activation(vm_page *page, bool *_modified);
void vm_clear_map_activation(vm_page *page);
void vm_remove_all_page_mappings(vm_page *page);
status_t vm_unmap_pages(vm_area *area, addr_t base, size_t length);
status_t vm_map_page(vm_area *area, vm_page *page, addr_t address,
int32 vm_test_map_activation(struct vm_page *page, bool *_modified);
void vm_clear_map_activation(struct vm_page *page);
void vm_remove_all_page_mappings(struct vm_page *page);
status_t vm_unmap_pages(struct vm_area *area, addr_t base, size_t length);
status_t vm_map_page(struct vm_area *area, struct vm_page *page, addr_t address,
uint32 protection);
status_t vm_get_physical_page(addr_t paddr, addr_t *vaddr, uint32 flags);
status_t vm_put_physical_page(addr_t vaddr);

View File

@ -9,10 +9,11 @@
#define _KERNEL_VM_ADDRESS_SPACE_H
#include <vm_types.h>
#include <arch/vm.h>
#include <OS.h>
struct kernel_args;
struct vm_address_space;
#ifdef __cplusplus
@ -22,17 +23,17 @@ extern "C" {
status_t vm_address_space_init(void);
status_t vm_address_space_init_post_sem(void);
void vm_delete_address_space(vm_address_space *aspace);
void vm_delete_address_space(struct vm_address_space *aspace);
status_t vm_create_address_space(team_id id, addr_t base, addr_t size,
bool kernel, vm_address_space **_aspace);
bool kernel, struct vm_address_space **_aspace);
status_t vm_delete_areas(struct vm_address_space *aspace);
vm_address_space *vm_get_kernel_address_space(void);
vm_address_space *vm_kernel_address_space(void);
struct vm_address_space *vm_get_kernel_address_space(void);
struct vm_address_space *vm_kernel_address_space(void);
team_id vm_kernel_address_space_id(void);
vm_address_space *vm_get_current_user_address_space(void);
struct vm_address_space *vm_get_current_user_address_space(void);
team_id vm_current_user_address_space_id(void);
vm_address_space *vm_get_address_space_by_id(team_id aid);
void vm_put_address_space(vm_address_space *aspace);
struct vm_address_space *vm_get_address_space_by_id(team_id aid);
void vm_put_address_space(struct vm_address_space *aspace);
#define vm_swap_address_space(aspace) arch_vm_aspace_swap(aspace)
#ifdef __cplusplus

View File

@ -12,28 +12,34 @@
#include <kernel.h>
#include <vm.h>
struct kernel_args;
//typedef struct vm_store vm_store;
#ifdef __cplusplus
extern "C" {
#endif
status_t vm_cache_init(struct kernel_args *args);
vm_cache *vm_cache_create(vm_store *store);
void vm_cache_acquire_ref(vm_cache *cache);
void vm_cache_release_ref(vm_cache *cache);
vm_cache *vm_cache_acquire_page_cache_ref(vm_page *page);
vm_page *vm_cache_lookup_page(vm_cache *cache, off_t page);
void vm_cache_insert_page(vm_cache *cache, vm_page *page, off_t offset);
void vm_cache_remove_page(vm_cache *cache, vm_page *page);
void vm_cache_remove_consumer(vm_cache *cache, vm_cache *consumer);
void vm_cache_add_consumer_locked(vm_cache *cache, vm_cache *consumer);
status_t vm_cache_write_modified(vm_cache *cache, bool fsReenter);
status_t vm_cache_set_minimal_commitment_locked(vm_cache *cache, off_t commitment);
status_t vm_cache_resize(vm_cache *cache, off_t newSize);
status_t vm_cache_insert_area_locked(vm_cache *cache, vm_area *area);
status_t vm_cache_remove_area(vm_cache *cache, vm_area *area);
struct vm_cache *vm_cache_create(struct vm_store *store);
void vm_cache_acquire_ref(struct vm_cache *cache);
void vm_cache_release_ref(struct vm_cache *cache);
struct vm_cache *vm_cache_acquire_page_cache_ref(struct vm_page *page);
struct vm_page *vm_cache_lookup_page(struct vm_cache *cache, off_t page);
void vm_cache_insert_page(struct vm_cache *cache, struct vm_page *page,
off_t offset);
void vm_cache_remove_page(struct vm_cache *cache, struct vm_page *page);
void vm_cache_remove_consumer(struct vm_cache *cache, struct vm_cache *consumer);
void vm_cache_add_consumer_locked(struct vm_cache *cache,
struct vm_cache *consumer);
status_t vm_cache_write_modified(struct vm_cache *cache, bool fsReenter);
status_t vm_cache_set_minimal_commitment_locked(struct vm_cache *cache,
off_t commitment);
status_t vm_cache_resize(struct vm_cache *cache, off_t newSize);
status_t vm_cache_insert_area_locked(struct vm_cache *cache, vm_area *area);
status_t vm_cache_remove_area(struct vm_cache *cache, struct vm_area *area);
#ifdef __cplusplus
}

View File

@ -19,31 +19,32 @@ struct kernel_args;
extern "C" {
#endif
void vm_page_init_num_pages(kernel_args *args);
void vm_page_init_num_pages(struct kernel_args *args);
status_t vm_page_init(struct kernel_args *args);
status_t vm_page_init_post_area(struct kernel_args *args);
status_t vm_page_init_post_thread(struct kernel_args *args);
status_t vm_mark_page_inuse(addr_t page);
status_t vm_mark_page_range_inuse(addr_t startPage, addr_t length);
status_t vm_page_set_state(vm_page *page, int state);
status_t vm_page_set_state(struct vm_page *page, int state);
// get some data about the number of pages in the system
size_t vm_page_num_pages(void);
size_t vm_page_num_free_pages(void);
status_t vm_page_write_modified_page(vm_cache *cache, struct vm_page *page,
bool fsReenter);
status_t vm_page_write_modified_pages(vm_cache *cache, bool fsReenter);
status_t vm_page_write_modified_page(struct vm_cache *cache,
struct vm_page *page, bool fsReenter);
status_t vm_page_write_modified_pages(struct vm_cache *cache, bool fsReenter);
void vm_page_unreserve_pages(uint32 count);
void vm_page_reserve_pages(uint32 count);
vm_page *vm_page_allocate_page(int pageState, bool reserved);
status_t vm_page_allocate_pages(int pageState, vm_page **pages, uint32 numPages);
vm_page *vm_page_allocate_page_run(int state, addr_t length);
vm_page *vm_page_at_index(int32 index);
vm_page *vm_lookup_page(addr_t pageNumber);
struct vm_page *vm_page_allocate_page(int pageState, bool reserved);
status_t vm_page_allocate_pages(int pageState, struct vm_page **pages,
uint32 numPages);
struct vm_page *vm_page_allocate_page_run(int state, addr_t length);
struct vm_page *vm_page_at_index(int32 index);
struct vm_page *vm_lookup_page(addr_t pageNumber);
#ifdef __cplusplus
}

View File

@ -8,8 +8,9 @@
#ifndef _KERNEL_VM_PRIV_H
#define _KERNEL_VM_PRIV_H
#include <vm.h>
#include <util/khash.h>
#include <vm_types.h>
/* should make these scale with the system */
#define DEFAULT_KERNEL_WORKING_SET 1024

View File

@ -69,8 +69,7 @@ class DoublyLinkedAreaLink {
typedef class DoublyLinkedQueue<vm_page_mapping, DoublyLinkedPageLink> vm_page_mappings;
typedef class DoublyLinkedQueue<vm_page_mapping, DoublyLinkedAreaLink> vm_area_mappings;
// vm page
typedef struct vm_page {
struct vm_page {
struct vm_page *queue_prev;
struct vm_page *queue_next;
@ -104,7 +103,7 @@ typedef struct vm_page {
uint16 wired_count;
int8 usage_count;
} vm_page;
};
enum {
PAGE_TYPE_PHYSICAL = 0,
@ -134,8 +133,7 @@ struct vm_dummy_page : vm_page {
ConditionVariable<vm_page> busy_condition;
};
// vm_cache
typedef struct vm_cache {
struct vm_cache {
mutex lock;
struct vm_area *areas;
vint32 ref_count;
@ -158,15 +156,14 @@ typedef struct vm_cache {
struct vm_cache* debug_previous;
struct vm_cache* debug_next;
#endif
} vm_cache;
};
#if DEBUG_CACHE_LIST
extern vm_cache* gDebugCacheList;
#endif
// vm area
typedef struct vm_area {
struct vm_area {
char *name;
area_id id;
addr_t base;
@ -186,24 +183,18 @@ typedef struct vm_area {
struct vm_area *cache_next;
struct vm_area *cache_prev;
struct vm_area *hash_next;
} vm_area;
};
#else // !__cplusplus
// these are just opaque types in C
typedef struct vm_page vm_page;
typedef struct vm_cache vm_cache;
typedef struct vm_area vm_area;
#endif
#endif // __cplusplus
enum {
VM_ASPACE_STATE_NORMAL = 0,
VM_ASPACE_STATE_DELETION
};
// address space
typedef struct vm_address_space {
vm_area *areas;
vm_area *area_hint;
struct vm_address_space {
struct vm_area *areas;
struct vm_area *area_hint;
sem_id sem;
addr_t base;
addr_t size;
@ -219,26 +210,24 @@ typedef struct vm_address_space {
addr_t min_working_set;
bigtime_t last_working_set_adjust;
struct vm_address_space *hash_next;
} vm_address_space;
};
// vm_store
typedef struct vm_store {
struct vm_store {
struct vm_store_ops *ops;
struct vm_cache *cache;
off_t committed_size;
} vm_store;
};
// vm_store_ops
typedef struct vm_store_ops {
void (*destroy)(struct vm_store *backing_store);
status_t (*commit)(struct vm_store *backing_store, off_t size);
bool (*has_page)(struct vm_store *backing_store, off_t offset);
status_t (*read)(struct vm_store *backing_store, off_t offset, const iovec *vecs,
size_t count, size_t *_numBytes, bool fsReenter);
status_t (*write)(struct vm_store *backing_store, off_t offset, const iovec *vecs,
size_t count, size_t *_numBytes, bool fsReenter);
status_t (*fault)(struct vm_store *backing_store, struct vm_address_space *aspace,
off_t offset);
status_t (*read)(struct vm_store *backing_store, off_t offset,
const iovec *vecs, size_t count, size_t *_numBytes, bool fsReenter);
status_t (*write)(struct vm_store *backing_store, off_t offset,
const iovec *vecs, size_t count, size_t *_numBytes, bool fsReenter);
status_t (*fault)(struct vm_store *backing_store,
struct vm_address_space *aspace, off_t offset);
void (*acquire_ref)(struct vm_store *backing_store);
void (*release_ref)(struct vm_store *backing_store);
} vm_store_ops;
@ -291,6 +280,7 @@ enum {
// flags region in the protection field.
#define B_USER_AREA_FLAGS (B_USER_PROTECTION)
#define B_KERNEL_AREA_FLAGS (B_KERNEL_PROTECTION | B_USER_CLONEABLE_AREA | B_OVERCOMMITTING_AREA)
#define B_KERNEL_AREA_FLAGS \
(B_KERNEL_PROTECTION | B_USER_CLONEABLE_AREA | B_OVERCOMMITTING_AREA)
#endif /* _KERNEL_VM_TYPES_H */

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@ -7,24 +7,24 @@
*/
#include <cpu.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <boot_device.h>
#include <smp.h>
#include <tls.h>
#include <vm.h>
#include <vm_types.h>
#include <arch_system_info.h>
#include <cpu.h>
#include <arch/cpu.h>
#include <arch/x86/selector.h>
#include <boot/kernel_args.h>
#include <arch/x86/commpage.h>
#include "interrupts.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
/* cpu vendor info */
struct cpu_vendor_info {

View File

@ -7,18 +7,20 @@
*/
#include <arch/debug.h>
#include <stdlib.h>
#include <debug.h>
#include <elf.h>
#include <kernel.h>
#include <kimage.h>
#include <thread.h>
#include <vm.h>
#include <vm_types.h>
#include <arch/debug.h>
#include <arch_cpu.h>
#include <stdlib.h>
struct stack_frame {
struct stack_frame *previous;

View File

@ -7,15 +7,17 @@
*/
#include <thread.h>
#include <arch/thread.h>
#include <arch/user_debugger.h>
#include <arch_cpu.h>
#include <kernel.h>
#include <debug.h>
#include <kernel.h>
#include <int.h>
#include <vm_address_space.h>
#include <thread.h>
#include <tls.h>
#include <vm_address_space.h>
#include <vm_types.h>
#include <string.h>

View File

@ -2,12 +2,18 @@
* Copyright 2007, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include <vm.h>
#include <arch/x86/commpage.h>
#include <KernelExport.h>
#include <string.h>
#include <KernelExport.h>
#include <vm.h>
#include <vm_types.h>
static area_id comm_area;
static area_id user_comm_area;
static unsigned long *comm_ptr;
@ -18,14 +24,16 @@ static void *next_comm_addr;
extern void _user_syscall_int(void);
extern unsigned int _user_syscall_int_end;
static inline
addr_t commpage_ptr_to_user_ptr(const void *ptr)
static inline addr_t
commpage_ptr_to_user_ptr(const void *ptr)
{
return ((addr_t)ptr) + ((addr_t)user_comm_ptr - (addr_t)comm_ptr);
}
static
status_t initialize_commpage_syscall(void)
static status_t
initialize_commpage_syscall(void)
{
size_t len;
@ -40,19 +48,20 @@ status_t initialize_commpage_syscall(void)
return B_OK;
}
status_t
commpage_init(void)
{
int i;
// create a read/write kernel area
comm_area = create_area("commpage", (void **)&comm_ptr, B_ANY_ADDRESS, COMMPAGE_SIZE, B_FULL_LOCK,
B_KERNEL_WRITE_AREA | B_KERNEL_READ_AREA);
comm_area = create_area("commpage", (void **)&comm_ptr, B_ANY_ADDRESS,
COMMPAGE_SIZE, B_FULL_LOCK, B_KERNEL_WRITE_AREA | B_KERNEL_READ_AREA);
// clone it at a fixed address with user read/only permissions
user_comm_ptr = (void *)USER_COMMPAGE_ADDR;
user_comm_area = clone_area("user_commpage", (void **)&user_comm_ptr, B_EXACT_ADDRESS,
B_READ_AREA | B_EXECUTE_AREA, comm_area);
user_comm_area = clone_area("user_commpage", (void **)&user_comm_ptr,
B_EXACT_ADDRESS, B_READ_AREA | B_EXECUTE_AREA, comm_area);
// zero it out
memset(comm_ptr, 0, COMMPAGE_SIZE);

View File

@ -10,6 +10,7 @@
#include <vm_address_space.h>
#include <vm_page.h>
#include <vm_types.h>
#include <util/AutoLock.h>
#include <util/khash.h>

View File

@ -6,7 +6,7 @@
#define VNODE_STORE_H
#include <vm.h>
#include <vm_types.h>
struct vnode_store {

View File

@ -15,6 +15,7 @@
#include <driver_settings.h>
#include <frame_buffer_console.h>
#include <int.h>
#include <kernel.h>
#include <smp.h>
#include <thread.h>
#include <vm.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2005-2007, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*
* Copyright 2002, Manuel J. Petit. All rights reserved.
@ -13,10 +13,13 @@
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <vm.h>
#include <smp.h>
#include <debug.h>
#include <ByteOrder.h>
#include <arch/debug_console.h>
#include <debug.h>
#include <smp.h>
#include <vm.h>
enum { INIT = 0, CMDREAD, CKSUM1, CKSUM2, WAITACK, QUIT, GDBSTATES };

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
@ -8,22 +8,9 @@
/* Contains the ELF loader */
#include <OS.h>
#include <elf.h>
#include <vfs.h>
#include <vm.h>
#include <vm_address_space.h>
#include <thread.h>
#include <team.h>
#include <debug.h>
#include <kimage.h>
#include <util/khash.h>
#include <syscalls.h>
#include <arch/cpu.h>
#include <arch/elf.h>
#include <elf_priv.h>
#include <boot/elf.h>
#include <OS.h>
#include <unistd.h>
#include <stdlib.h>
@ -31,6 +18,22 @@
#include <stdio.h>
#include <ctype.h>
#include <debug.h>
#include <kimage.h>
#include <syscalls.h>
#include <team.h>
#include <thread.h>
#include <util/khash.h>
#include <vfs.h>
#include <vm.h>
#include <vm_address_space.h>
#include <vm_types.h>
#include <arch/cpu.h>
#include <arch/elf.h>
#include <elf_priv.h>
#include <boot/elf.h>
//#define TRACE_ELF
#ifdef TRACE_ELF
# define TRACE(x) dprintf x

View File

@ -10,21 +10,21 @@
#include "slab_private.h"
#include <algorithm>
#include <new>
#include <stdlib.h>
#include <string.h>
#include <KernelExport.h>
#include <smp.h>
#include <util/AutoLock.h>
#include <util/DoublyLinkedList.h>
#include <util/OpenHashTable.h>
#include <smp.h>
#include <vm.h>
#include <vm_types.h>
#include <vm_low_memory.h>
#include <algorithm> // swap
#include <new>
// TODO kMagazineCapacity should be dynamically tuned per cache.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004-2006, Haiku, Inc.
* Copyright (c) 2004-2007, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Authors:
@ -8,14 +8,14 @@
*/
#include <system_info.h>
#include <OS.h>
#include <KernelExport.h>
#include <system_info.h>
#include <arch/system_info.h>
#include <cpu.h>
#include <debug.h>
#include <kernel.h>
#include <port.h>
#include <real_time_clock.h>
#include <sem.h>
@ -25,6 +25,8 @@
#include <vm.h>
#include <vm_page.h>
#include <arch/system_info.h>
#include <string.h>

View File

@ -24,7 +24,9 @@
#include <tls.h>
#include <user_runtime.h>
#include <vfs.h>
#include <vm.h>
#include <vm_address_space.h>
#include <vm_types.h>
#include <boot/kernel_args.h>
#include <util/khash.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@ -12,13 +12,15 @@
*/
#include <OS.h>
#include <KernelExport.h>
#include <cbuf.h>
#include <vm.h>
#include <string.h>
#include <KernelExport.h>
#include <lock.h>
#include <kernel.h>
#define CBUF_LENGTH 2048

View File

@ -35,6 +35,7 @@
#include <thread.h>
#include <team.h>
#include <util/AutoLock.h>
#include <util/khash.h>
#include <boot/stage2.h>
#include <boot/elf.h>

View File

@ -11,9 +11,6 @@
#include <stddef.h>
#include <stdlib.h>
#include <util/khash.h>
#include <util/AutoLock.h>
#include <arch/cpu.h>
#include <condition_variable.h>
#include <debug.h>
@ -21,9 +18,12 @@
#include <kernel.h>
#include <lock.h>
#include <smp.h>
#include <util/khash.h>
#include <util/AutoLock.h>
#include <vm.h>
#include <vm_page.h>
#include <vm_priv.h>
#include <vm_types.h>
//#define TRACE_VM_CACHE

View File

@ -16,8 +16,8 @@
struct device_store {
vm_store vm;
addr_t base_address;
struct vm_store vm;
addr_t base_address;
};
@ -63,7 +63,8 @@ device_write(struct vm_store *store, off_t offset, const iovec *vecs, size_t cou
static status_t
device_fault(struct vm_store *_store, struct vm_address_space *aspace, off_t offset)
device_fault(struct vm_store *_store, struct vm_address_space *aspace,
off_t offset)
{
// devices are mapped in completely, so we shouldn't experience faults
return B_BAD_ADDRESS;
@ -82,7 +83,7 @@ static vm_store_ops device_ops = {
};
vm_store *
struct vm_store *
vm_store_create_device(addr_t baseAddress)
{
struct device_store *store = malloc(sizeof(struct device_store));

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2005-2007, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@ -15,6 +15,6 @@
#ifdef __cplusplus
extern "C"
#endif
vm_store *vm_store_create_device(addr_t base_addr);
struct vm_store *vm_store_create_device(addr_t base_addr);
#endif /* _KERNEL_VM_STORE_DEVICE_H */

View File

@ -35,25 +35,27 @@ null_has_page(struct vm_store *store, off_t offset)
static status_t
null_read(struct vm_store *store, off_t offset, const iovec *vecs, size_t count,
size_t *_numBytes, bool fsReenter)
null_read(struct vm_store *store, off_t offset, const iovec *vecs,
size_t count, size_t *_numBytes, bool fsReenter)
{
return -1;
}
static status_t
null_write(struct vm_store *store, off_t offset, const iovec *vecs, size_t count,
size_t *_numBytes, bool fsReenter)
null_write(struct vm_store *store, off_t offset, const iovec *vecs,
size_t count, size_t *_numBytes, bool fsReenter)
{
return -1;
}
static status_t
null_fault(struct vm_store *store, struct vm_address_space *aspace, off_t offset)
null_fault(struct vm_store *store, struct vm_address_space *aspace,
off_t offset)
{
/* we can't fault on this region, that's pretty much the point of the null store object */
/* we can't fault on this region, that's pretty much the point of the
null store object */
return B_BAD_ADDRESS;
}
@ -70,12 +72,12 @@ static vm_store_ops null_ops = {
};
vm_store *
struct vm_store *
vm_store_create_null(void)
{
vm_store *store;
struct vm_store *store;
store = malloc(sizeof(vm_store));
store = malloc(sizeof(struct vm_store));
if (store == NULL)
return NULL;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2005-2007, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@ -15,6 +15,6 @@
#ifdef __cplusplus
extern "C"
#endif
vm_store *vm_store_create_null(void);
struct vm_store *vm_store_create_null(void);
#endif /* _KERNEL_VM_STORE_NULL_H */