Replaced all remaining PAGE_SIZE with B_PAGE_SIZE, addr with addr_t.

Removed the definition of PAGE_SIZE and addr.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9433 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-10-20 00:33:06 +00:00
parent 3cbdc52595
commit afad65ded7
10 changed files with 45 additions and 47 deletions

View File

@ -1,4 +1,7 @@
/*
** Copyright 2002-2004, The Haiku Team. All rights reserved.
** Distributed under the terms of the Haiku License.
**
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
@ -11,7 +14,7 @@
#include <boot/kernel_args.h>
#define PAGE_ALIGN(x) (((x) + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1))
#define PAGE_ALIGN(x) (((x) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1))
#ifdef __cplusplus
extern "C" {
@ -22,13 +25,13 @@ int arch_cpu_init(kernel_args *ka);
int arch_cpu_init2(kernel_args *ka);
void reboot(void);
void arch_cpu_invalidate_TLB_range(addr start, addr end);
void arch_cpu_invalidate_TLB_list(addr pages[], int num_pages);
void arch_cpu_invalidate_TLB_range(addr_t start, addr_t end);
void arch_cpu_invalidate_TLB_list(addr_t pages[], int num_pages);
void arch_cpu_global_TLB_invalidate(void);
int arch_cpu_user_memcpy(void *to, const void *from, size_t size, addr *faultHandler);
int arch_cpu_user_strlcpy(char *to, const char *from, size_t size, addr *faultHandler);
int arch_cpu_user_memset(void *s, char c, size_t count, addr *faultHandler);
int arch_cpu_user_memcpy(void *to, const void *from, size_t size, addr_t *faultHandler);
int arch_cpu_user_strlcpy(char *to, const char *from, size_t size, addr_t *faultHandler);
int arch_cpu_user_memset(void *s, char c, size_t count, addr_t *faultHandler);
void arch_cpu_idle(void);
void arch_cpu_sync_icache(void *address, size_t length);

View File

@ -20,8 +20,8 @@ void arch_thread_init_tls(struct thread *thread);
void arch_thread_context_switch(struct thread *t_from, struct thread *t_to);
int arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void), void (*entry_func)(void), void (*exit_func)(void));
void arch_thread_dump_info(void *info);
void arch_thread_enter_uspace(struct thread *t, addr entry, void *args1, void *args2);
void arch_thread_switch_kstack_and_call(struct thread *t, addr new_kstack, void (*func)(void *), void *arg);
void arch_thread_enter_uspace(struct thread *t, addr_t entry, void *args1, void *args2);
void arch_thread_switch_kstack_and_call(struct thread *t, addr_t new_kstack, void (*func)(void *), void *arg);
// ToDo: doing this this way is an ugly hack - please fix me!
// (those functions are "static inline" for x86 - since

View File

@ -8,8 +8,6 @@
#include <ktypes.h>
#include <arch/x86/descriptors.h>
#define PAGE_SIZE 4096
struct tss {
uint16 prev_task;
uint16 unused0;
@ -88,11 +86,11 @@ struct iframe {
struct arch_thread;
void setup_system_time(unsigned int cv_factor);
void i386_context_switch(struct arch_thread *old_state, struct arch_thread *new_state, addr new_pgdir);
void i386_enter_uspace(addr entry, void *args1, void *args2, addr ustack_top);
void i386_set_tss_and_kstack(addr kstack);
void i386_switch_stack_and_call(addr stack, void (*func)(void *), void *arg);
void i386_swap_pgdir(addr new_pgdir);
void i386_context_switch(struct arch_thread *old_state, struct arch_thread *new_state, addr_t new_pgdir);
void i386_enter_uspace(addr_t entry, void *args1, void *args2, addr_t ustack_top);
void i386_set_tss_and_kstack(addr_t kstack);
void i386_switch_stack_and_call(addr_t stack, void (*func)(void *), void *arg);
void i386_swap_pgdir(addr_t new_pgdir);
void i386_fsave(void *fpu_state);
void i386_fxsave(void *fpu_state);
void i386_frstor(void *fpu_state);

View File

@ -1,4 +1,7 @@
/*
** Copyright 2002-2004, The Haiku Team. All rights reserved.
** Distributed under the terms of the Haiku License.
**
** Copyright 2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/

View File

@ -70,22 +70,22 @@ clear_segment_descriptor(struct segment_descriptor *desc)
static inline void
set_segment_descriptor_base(struct segment_descriptor *desc, addr base)
set_segment_descriptor_base(struct segment_descriptor *desc, addr_t base)
{
desc->base_00_15 = (addr)base & 0xffff; // base is 32 bits long
desc->base_23_16 = ((addr)base >> 16) & 0xff;
desc->base_31_24 = ((addr)base >> 24) & 0xff;
desc->base_00_15 = (addr_t)base & 0xffff; // base is 32 bits long
desc->base_23_16 = ((addr_t)base >> 16) & 0xff;
desc->base_31_24 = ((addr_t)base >> 24) & 0xff;
}
static inline void
set_segment_descriptor(struct segment_descriptor *desc, addr base, uint32 limit,
set_segment_descriptor(struct segment_descriptor *desc, addr_t base, uint32 limit,
uint8 type, uint8 privilegeLevel)
{
set_segment_descriptor_base(desc, base);
desc->limit_00_15 = (addr)limit & 0x0ffff; // limit is 20 bits long
desc->limit_19_16 = ((addr)limit >> 16) & 0xf;
desc->limit_00_15 = (addr_t)limit & 0x0ffff; // limit is 20 bits long
desc->limit_19_16 = ((addr_t)limit >> 16) & 0xf;
desc->type = type;
desc->desc_type = DT_CODE_DATA_SEGMENT;
@ -101,12 +101,12 @@ set_segment_descriptor(struct segment_descriptor *desc, addr base, uint32 limit,
static inline void
set_tss_descriptor(struct segment_descriptor *desc, addr base, uint32 limit)
set_tss_descriptor(struct segment_descriptor *desc, addr_t base, uint32 limit)
{
// the TSS descriptor has a special layout different from the standard descriptor
set_segment_descriptor_base(desc, base);
desc->limit_00_15 = (addr)limit & 0x0ffff;
desc->limit_00_15 = (addr_t)limit & 0x0ffff;
desc->limit_19_16 = 0;
desc->type = DT_TSS;

View File

@ -28,8 +28,8 @@ typedef struct device {
uint32 device_id;
uint32 irq;
addr base[MAX_DEV_IO_RANGES];
addr size[MAX_DEV_IO_RANGES];
addr_t base[MAX_DEV_IO_RANGES];
addr_t size[MAX_DEV_IO_RANGES];
char dev_path[256];
} device;

View File

@ -16,16 +16,16 @@
((addr_t)(x) >= KERNEL_BASE && (addr_t)(x) <= KERNEL_TOP)
/** Size of the kernel stack */
#define KSTACK_SIZE (PAGE_SIZE * 2)
#define KSTACK_SIZE (B_PAGE_SIZE * 2)
/** Size of the stack given to teams in user space */
#define MAIN_THREAD_STACK_SIZE (16 * PAGE_SIZE) // 64 kB
#define MAIN_THREAD_STACK_SIZE (16 * B_PAGE_SIZE) // 64 kB
// BeOS: (16 * 1024 * 1024) // 16 MB
#define STACK_SIZE (16 * PAGE_SIZE)
#define STACK_SIZE (16 * B_PAGE_SIZE)
// BeOS: (256 * 1024) // 256 kB
/** Size of the environmental variables space for a process */
#define ENV_SIZE (PAGE_SIZE * 8)
#define ENV_SIZE (B_PAGE_SIZE * 8)
#define ROUNDUP(a, b) (((a) + ((b)-1)) & ~((b)-1))

View File

@ -12,9 +12,8 @@ extern "C" {
#include <SupportDefs.h>
typedef int32 region_id;
typedef int32 aspace_id;
typedef uint32 addr;
// ToDo: to be faded out
typedef int32 aspace_id;
#ifdef __cplusplus
}

View File

@ -31,7 +31,7 @@ status_t vm_aspace_init_post_sem(void);
void vm_free_unused_boot_loader_range(addr_t start, addr_t end);
void vm_delete_aspace(vm_address_space *aspace);
status_t vm_create_aspace(const char *name, addr base, addr size, bool kernel, vm_address_space **_aspace);
status_t vm_create_aspace(const char *name, addr_t base, addr_t size, bool kernel, vm_address_space **_aspace);
status_t vm_delete_areas(struct vm_address_space *aspace);
vm_address_space *vm_get_kernel_aspace(void);
aspace_id vm_get_kernel_aspace_id(void);
@ -52,12 +52,12 @@ status_t delete_area_etc(struct team *team, area_id area);
status_t vm_unreserve_address_range(aspace_id aid, void *address, addr_t size);
status_t vm_reserve_address_range(aspace_id aid, void **_address, uint32 addressSpec, addr_t size);
region_id vm_create_anonymous_region(aspace_id aid, const char *name, void **address, int addr_type,
addr size, int wiring, int lock);
addr_t size, int wiring, int lock);
region_id vm_map_physical_memory(aspace_id aid, const char *name, void **address, int addr_type,
addr size, int lock, addr phys_addr);
addr_t size, int lock, addr_t phys_addr);
region_id vm_map_file(aspace_id aid, char *name, void **address, int addr_type,
addr size, int lock, int mapping, const char *path, off_t offset);
region_id vm_create_null_region(aspace_id aid, char *name, void **address, int addr_type, addr size);
addr_t size, int lock, int mapping, const char *path, off_t offset);
region_id vm_create_null_region(aspace_id aid, char *name, void **address, int addr_type, addr_t size);
area_id vm_copy_area(aspace_id addressSpaceID, const char *name, void **_address, uint32 addressSpec,
uint32 protection, area_id sourceID);
region_id vm_clone_region(aspace_id aid, char *name, void **address, int addr_type,
@ -66,15 +66,15 @@ status_t vm_delete_region(aspace_id aid, region_id id);
region_id vm_find_region_by_name(aspace_id aid, const char *name);
status_t vm_create_vnode_cache(void *vnode, void **_cache);
status_t vm_get_page_mapping(aspace_id aid, addr vaddr, addr *paddr);
status_t vm_get_physical_page(addr paddr, addr *vaddr, int flags);
status_t vm_put_physical_page(addr vaddr);
status_t vm_get_page_mapping(aspace_id aid, addr_t vaddr, addr_t *paddr);
status_t vm_get_physical_page(addr_t paddr, addr_t *vaddr, int flags);
status_t vm_put_physical_page(addr_t vaddr);
area_id _user_create_area(const char *name, void **address, uint32 addressSpec,
size_t size, uint32 lock, uint32 protection);
status_t _user_delete_area(area_id area);
region_id _user_vm_map_file(const char *uname, void **uaddress, int addr_type,
addr size, int lock, int mapping, const char *upath, off_t offset);
addr_t size, int lock, int mapping, const char *upath, off_t offset);
area_id _user_area_for(void *address);
area_id _user_find_area(const char *name);
status_t _user_get_area_info(area_id area, area_info *info);
@ -84,10 +84,6 @@ status_t _user_set_area_protection(area_id area, uint32 newProtection);
area_id _user_clone_area(const char *name, void **_address, uint32 addressSpec,
uint32 protection, area_id sourceArea);
region_id find_region_by_name(const char *);
region_id find_region_by_address (addr);
int vm_resize_region (aspace_id, region_id, size_t);
// to protect code regions with interrupts turned on
void permit_page_faults(void);
void forbid_page_faults(void);

View File

@ -8,7 +8,6 @@
#include <kernel.h>
#include <vm.h>
vm_store *vm_store_create_device(addr base_addr);
vm_store *vm_store_create_device(addr_t base_addr);
#endif