From a36a94da37d3061dbc3c086beba2ef3431066721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 17 Mar 2005 17:06:56 +0000 Subject: [PATCH] Added the missing clear_caches() function and syscall. Does not yet do anything (which is perfectly okay on x86 anyway, but should be moved into the arch stuff). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11869 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/cpu.h | 19 +++++++++++-------- headers/private/kernel/syscalls.h | 2 ++ src/kernel/core/cpu.c | 20 +++++++++++++++++++- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/headers/private/kernel/cpu.h b/headers/private/kernel/cpu.h index 415a17b888..040d859403 100644 --- a/headers/private/kernel/cpu.h +++ b/headers/private/kernel/cpu.h @@ -1,17 +1,18 @@ /* -** 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. -*/ + * Copyright 2002-2005, Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Copyright 2002, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ #ifndef _KERNEL_CPU_H #define _KERNEL_CPU_H #include #include -#include + +struct kernel_args; /* CPU local data structure */ @@ -24,6 +25,7 @@ typedef union cpu_ent { int preempted; timer quantum_timer; } info; + // ToDo: align manually on CPU cache lines if possible uint32 align[16]; } cpu_ent; @@ -42,9 +44,10 @@ status_t cpu_init(struct kernel_args *args); status_t cpu_init_post_vm(struct kernel_args *args); cpu_ent *get_cpu_struct(void); - extern inline cpu_ent *get_cpu_struct(void) { return &cpu[smp_get_current_cpu()]; } +void _user_clear_caches(void *address, size_t length, uint32 flags); + #ifdef __cplusplus } #endif diff --git a/headers/private/kernel/syscalls.h b/headers/private/kernel/syscalls.h index 577a49fe09..3c7fe18b7c 100644 --- a/headers/private/kernel/syscalls.h +++ b/headers/private/kernel/syscalls.h @@ -271,6 +271,8 @@ extern area_id _kern_register_messaging_service(sem_id lockingSem, sem_id counterSem); extern status_t _kern_unregister_messaging_service(); +extern void _kern_clear_caches(void *address, size_t length, uint32 flags); + #ifdef __INTEL__ // our only x86 only syscall extern status_t _kern_get_cpuid(cpuid_info *info, uint32 eax, uint32 cpu); diff --git a/src/kernel/core/cpu.c b/src/kernel/core/cpu.c index e49a28f5ca..04610e4a7e 100644 --- a/src/kernel/core/cpu.c +++ b/src/kernel/core/cpu.c @@ -1,5 +1,5 @@ /* - * Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2002, Travis Geiselbrecht. All rights reserved. @@ -47,3 +47,21 @@ cpu_preboot_init(kernel_args *args) { return arch_cpu_preboot_init(args); } + + +void +clear_caches(void *address, size_t length, uint32 flags) +{ + // ToDo: implement me! +} + + +// #pragma mark - + + +void +_user_clear_caches(void *address, size_t length, uint32 flags) +{ + clear_caches(address, length, flags); +} +