VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/haiku/the-haiku-kernel.h@ 43366

最後變更 在這個檔案從43366是 43366,由 vboxsync 提交於 13 年 前

Haiku Additions: cleanup, missed file.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 4.9 KB
 
1/* $Id: the-haiku-kernel.h 43366 2012-09-20 12:31:54Z vboxsync $ */
2/** @file
3 * IPRT - Include all necessary headers for the Haiku kernel.
4 */
5
6/*
7 * Copyright (C) 2012 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27
28#ifndef ___the_haiku_kernel_h
29#define ___the_haiku_kernel_h
30
31#include <sys/types.h>
32#include <sys/mman.h>
33#include <sys/time.h>
34
35#include <stdlib.h>
36
37#include <OS.h>
38#include <KernelExport.h>
39
40#include <iprt/cdefs.h>
41#include <iprt/err.h>
42#include <iprt/types.h>
43
44RT_C_DECLS_BEGIN
45
46/* headers/private/kernel/smp.h */
47
48extern int32 smp_get_num_cpus(void);
49extern int32 smp_get_current_cpu(void);
50
51/* headers/private/kernel/vm/vm.h */
52extern status_t vm_unreserve_address_range(team_id team, void *address, addr_t size);
53extern status_t vm_reserve_address_range(team_id team, void **_address, uint32 addressSpec, addr_t size, uint32 flags);
54extern area_id vm_clone_area(team_id team, const char *name, void **address, uint32 addressSpec, uint32 protection,
55 uint32 mapping, area_id sourceArea, bool kernel);
56
57/* headers/private/kernel/thread_type.h */
58
59extern spinlock gThreadSpinlock;
60#define GRAB_THREAD_LOCK() acquire_spinlock(&gThreadSpinlock)
61#define RELEASE_THREAD_LOCK() release_spinlock(&gThreadSpinlock)
62typedef struct
63{
64 int32 flags; // summary of events relevant in interrupt
65 // handlers (signals pending, user debugging
66 // enabled, etc.)
67#if 0
68 Thread *all_next;
69 Thread *team_next;
70 Thread *queue_next; /* i.e. run queue, release queue, etc. */
71 timer alarm;
72 thread_id id;
73 char name[B_OS_NAME_LENGTH];
74 int32 priority;
75 int32 next_priority;
76 int32 io_priority;
77 int32 state;
78 int32 next_state;
79#endif
80 // and a lot more...
81} Thread;
82
83/* headers/private/kernel/thread.h */
84
85extern Thread* thread_get_thread_struct(thread_id id);
86extern Thread* thread_get_thread_struct_locked(thread_id id);
87
88extern void thread_yield(bool force);
89
90
91#if 0
92typedef callout_id_t (*PFNSOL_timeout_generic)(int type, void (*func)(void *),
93 void *arg, hrtime_t expiration,
94 hrtime_t resultion, int flags);
95typedef hrtime_t (*PFNSOL_untimeout_generic)(callout_id_t id, int nowait);
96typedef int (*PFNSOL_cyclic_reprogram)(cyclic_id_t id, hrtime_t expiration);
97
98
99/* IPRT globals. */
100extern bool g_frthaikuSplSetsEIF;
101extern struct ddi_dma_attr g_haikuX86PhysMemLimits;
102extern RTCPUSET g_rtMphaikuCpuSet;
103extern PFNSOL_timeout_generic g_pfnrtR0Sol_timeout_generic;
104extern PFNSOL_untimeout_generic g_pfnrtR0Sol_untimeout_generic;
105extern PFNSOL_cyclic_reprogram g_pfnrtR0Sol_cyclic_reprogram;
106
107/* Haiku globals. */
108extern uintptr_t kernelbase;
109
110/* Misc stuff from newer kernels. */
111#ifndef CALLOUT_FLAG_ABSOLUTE
112#define CALLOUT_FLAG_ABSOLUTE 2
113#endif
114#endif
115
116RT_C_DECLS_END
117
118/**
119 * Convert from Haiku kernel return code to IPRT status code.
120 * @todo put this where it belongs! (i.e. in a separate file and prototype in iprt/err.h)
121 * Or as generic call since it's not r0 specific.
122 */
123DECLINLINE(int) RTErrConvertFromHaikuKernReturn(status_t rc)
124{
125 switch (rc)
126 {
127 case B_OK: return VINF_SUCCESS;
128 case B_BAD_SEM_ID: return VERR_SEM_ERROR;
129 case B_NO_MORE_SEMS: return VERR_TOO_MANY_SEMAPHORES;
130 case B_BAD_THREAD_ID: return VERR_INVALID_PARAMETER;
131 case B_NO_MORE_THREADS: return VERR_MAX_THRDS_REACHED;
132 case B_BAD_TEAM_ID: return VERR_INVALID_PARAMETER;
133 case B_NO_MORE_TEAMS: return VERR_MAX_PROCS_REACHED;
134 //default: return VERR_GENERAL_FAILURE;
135 /** POSIX Errors are defined as a subset of system errors. */
136 default: return RTErrConvertFromErrno(rc);
137 }
138}
139
140#endif /* ___the_haiku_kernel_h */
141
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette