From e45975b8798f64fe45038d07c7d8a4a435e0dec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 28 Oct 2003 21:10:00 +0000 Subject: [PATCH] Definitions were doubled in vm_translation_map.h and arch/vm_translation_map.h. The former now only contains the structure definitions, while the other one contains the arch-specific function prototypes (which do not have the arch_ prefix). Added a ToDo comment to remember cleaning this up one day. Made all headers C++ safe, simplified where possible. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5197 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/arch/vm.h | 9 +++- .../private/kernel/arch/vm_translation_map.h | 43 +++++-------------- headers/private/kernel/vm_translation_map.h | 17 +++----- 3 files changed, 26 insertions(+), 43 deletions(-) diff --git a/headers/private/kernel/arch/vm.h b/headers/private/kernel/arch/vm.h index 7c127d9e3f..b7919b6c63 100644 --- a/headers/private/kernel/arch/vm.h +++ b/headers/private/kernel/arch/vm.h @@ -5,14 +5,21 @@ #ifndef KERNEL_ARCH_VM_H #define KERNEL_ARCH_VM_H + #include -struct kernel_args; +#ifdef __cplusplus +extern "C" { +#endif int arch_vm_init(struct kernel_args *ka); int arch_vm_init2(struct kernel_args *ka); int arch_vm_init_endvm(struct kernel_args *ka); void arch_vm_aspace_swap(vm_address_space *aspace); +#ifdef __cplusplus +} +#endif + #endif /* KERNEL_ARCH_VM_H */ diff --git a/headers/private/kernel/arch/vm_translation_map.h b/headers/private/kernel/arch/vm_translation_map.h index 147ed76ec8..28351caa22 100644 --- a/headers/private/kernel/arch/vm_translation_map.h +++ b/headers/private/kernel/arch/vm_translation_map.h @@ -6,37 +6,12 @@ #define KERNEL_ARCH_VM_TRANSLATION_MAP_H -#include -#include +#include -struct kernel_args; - - -typedef struct vm_translation_map_struct { - struct vm_translation_map_struct *next; - struct vm_translation_map_ops_struct *ops; - recursive_lock lock; - int map_count; - struct vm_translation_map_arch_info_struct *arch_data; -} vm_translation_map; - - -// table of operations the vm may want to do to this mapping -typedef struct vm_translation_map_ops_struct { - void (*destroy)(vm_translation_map *); - int (*lock)(vm_translation_map*); - int (*unlock)(vm_translation_map*); - int (*map)(vm_translation_map *map, addr va, addr pa, unsigned int attributes); - int (*unmap)(vm_translation_map *map, addr start, addr end); - int (*query)(vm_translation_map *map, addr va, addr *out_physical, unsigned int *out_flags); - addr (*get_mapped_size)(vm_translation_map*); - int (*protect)(vm_translation_map *map, addr base, addr top, unsigned int attributes); - int (*clear_flags)(vm_translation_map *map, addr va, unsigned int flags); - void (*flush)(vm_translation_map *map); - int (*get_physical_page)(addr physical_address, addr *out_virtual_address, int flags); - int (*put_physical_page)(addr virtual_address); -} vm_translation_map_ops; +#ifdef __cplusplus +extern "C" { +#endif int vm_translation_map_create(vm_translation_map *new_map, bool kernel); int vm_translation_map_module_init(struct kernel_args *ka); @@ -44,10 +19,14 @@ int vm_translation_map_module_init2(struct kernel_args *ka); void vm_translation_map_module_init_post_sem(struct kernel_args *ka); // quick function to map a page in regardless of map context. Used in VM initialization, // before most vm data structures exist -int vm_translation_map_quick_map(struct kernel_args *ka, addr va, addr pa, - unsigned int attributes, addr (*get_free_page)(kernel_args *)); +status_t vm_translation_map_quick_map(struct kernel_args *ka, addr_t va, addr_t pa, + uint8 attributes, addr_t (*get_free_page)(struct kernel_args *)); + +#ifdef __cplusplus +} +#endif #include -#endif /* KERNEL_VM_TRANSLATION_MAP_H */ +#endif /* KERNEL_ARCH_VM_TRANSLATION_MAP_H */ diff --git a/headers/private/kernel/vm_translation_map.h b/headers/private/kernel/vm_translation_map.h index 7128870d12..294abd973c 100755 --- a/headers/private/kernel/vm_translation_map.h +++ b/headers/private/kernel/vm_translation_map.h @@ -9,6 +9,7 @@ #include #include + struct kernel_args; @@ -20,6 +21,7 @@ typedef struct vm_translation_map_struct { struct vm_translation_map_arch_info_struct *arch_data; } vm_translation_map; + // table of operations the vm may want to do to this mapping typedef struct vm_translation_map_ops_struct { void (*destroy)(vm_translation_map *); @@ -36,15 +38,10 @@ typedef struct vm_translation_map_ops_struct { int (*put_physical_page)(addr virtual_address); } vm_translation_map_ops; -int vm_translation_map_create(vm_translation_map *new_map, bool kernel); -int vm_translation_map_module_init(struct kernel_args *ka); -int vm_translation_map_module_init2(struct kernel_args *ka); -void vm_translation_map_module_init_post_sem(struct kernel_args *ka); -// quick function to map a page in regardless of map context. Used in VM initialization, -// before most vm data structures exist -int vm_translation_map_quick_map(struct kernel_args *ka, addr va, addr pa, unsigned int attributes, addr (*get_free_page)(kernel_args *)); - -// quick function to return the physical pgdir of a mapping, needed for a context switch -addr vm_translation_map_get_pgdir(vm_translation_map *map); +// ToDo: fix this +// unlike the usual habit, the VM translation map functions are +// arch-specific but do not have the arch_ prefix. +#include #endif /* KERNEL_VM_TRANSLATION_MAP_H */ +