00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _OS_H
00012 #define _OS_H
00013
00014 #include <BeBuild.h>
00015 #include <be_prim.h>
00016 #include <fcntl.h>
00017 #include <sys/param.h>
00018
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022
00023
00024
00025
00026
00027 #define B_OS_NAME_LENGTH 32
00028 #define B_PAGE_SIZE 4096
00029 #define B_INFINITE_TIMEOUT (9223372036854775807LL)
00030
00031
00032
00033
00034
00035 typedef int32 area_id;
00036 typedef int32 port_id;
00037 typedef int32 sem_id;
00038 typedef int32 thread_id;
00039 typedef int32 team_id;
00040
00041
00042
00043
00044
00045 #define B_NO_LOCK 0
00046 #define B_LAZY_LOCK 1
00047 #define B_FULL_LOCK 2
00048 #define B_CONTIGUOUS 3
00049 #define B_LOMEM 4
00050
00051 #define B_ANY_ADDRESS 0
00052 #define B_EXACT_ADDRESS 1
00053 #define B_BASE_ADDRESS 2
00054 #define B_CLONE_ADDRESS 3
00055 #define B_ANY_KERNEL_ADDRESS 4
00056
00057
00058
00059
00060
00061
00062
00063
00064 #define B_READ_AREA 1
00065 #define B_WRITE_AREA 2
00066
00067 typedef struct area_info {
00068 area_id area;
00069 char name[B_OS_NAME_LENGTH];
00070 size_t size;
00071 uint32 lock;
00072 uint32 protection;
00073 team_id team;
00074 uint32 ram_size;
00075 uint32 copy_count;
00076 uint32 in_count;
00077 uint32 out_count;
00078 void *address;
00079 } area_info;
00080
00081 extern area_id create_area(const char *name, void **start_addr,
00082 uint32 addr_spec, size_t size,
00083 uint32 lock, uint32 protection);
00084
00085 extern area_id clone_area(const char *name, void **dest_addr,
00086 uint32 addr_spec, uint32 protection,
00087 area_id source);
00088
00089 extern area_id find_area(const char *name);
00090 extern area_id area_for(void *addr);
00091 extern status_t delete_area(area_id id);
00092 extern status_t resize_area(area_id id, size_t new_size);
00093 extern status_t set_area_protection(area_id id,
00094 uint32 new_protection);
00095
00096 extern status_t _get_area_info(area_id id, area_info *ainfo,
00097 size_t size);
00098 extern status_t _get_next_area_info(team_id team, int32 *cookie,
00099 area_info *ainfo, size_t size);
00100
00101 #define get_area_info(id, ainfo) \
00102 _get_area_info((id), (ainfo),sizeof(*(ainfo)))
00103 #define get_next_area_info(team, cookie, ainfo) \
00104 _get_next_area_info((team), (cookie), (ainfo), sizeof(*(ainfo)))
00105
00106
00107
00108
00109
00110
00111 typedef struct port_info {
00112 port_id port;
00113 team_id team;
00114 char name[B_OS_NAME_LENGTH];
00115 int32 capacity;
00116 int32 queue_count;
00117 int32 total_count;
00118 } port_info;
00119
00120 extern port_id create_port(int32 capacity, const char *name);
00121 extern port_id find_port(const char *name);
00122
00123 extern status_t write_port(port_id port, int32 code,
00124 const void *buf,
00125 size_t buf_size);
00126
00127 extern status_t read_port(port_id port, int32 *code,
00128 void *buf, size_t buf_size);
00129
00130 extern status_t write_port_etc(port_id port, int32 code,
00131 const void *buf, size_t buf_size,
00132 uint32 flags, bigtime_t timeout);
00133
00134 extern status_t read_port_etc(port_id port, int32 *code,
00135 void *buf, size_t buf_size,
00136 uint32 flags, bigtime_t timeout);
00137
00138 extern ssize_t port_buffer_size(port_id port);
00139 extern ssize_t port_buffer_size_etc(port_id port,
00140 uint32 flags, bigtime_t timeout);
00141
00142 extern ssize_t port_count(port_id port);
00143 extern status_t set_port_owner(port_id port, team_id team);
00144
00145 extern status_t close_port(port_id port);
00146
00147 extern status_t delete_port(port_id port);
00148
00149 extern status_t _get_port_info(port_id port, port_info *info,
00150 size_t size);
00151 extern status_t _get_next_port_info(team_id team, int32 *cookie, port_info *info, size_t size);
00152
00153 #define get_port_info(port, info) \
00154 _get_port_info((port), (info), sizeof(*(info)))
00155
00156 #define get_next_port_info(team, cookie, info) \
00157 _get_next_port_info((team), (cookie), (info), sizeof(*(info)))
00158
00159
00160
00161
00162
00163 typedef struct sem_info {
00164 sem_id sem;
00165 team_id team;
00166 char name[B_OS_NAME_LENGTH];
00167 int32 count;
00168 thread_id latest_holder;
00169 } sem_info;
00170
00171 extern sem_id create_sem(int32 count, const char *name);
00172 extern status_t delete_sem(sem_id sem);
00173 extern status_t acquire_sem(sem_id sem);
00174 extern status_t acquire_sem_etc(sem_id sem, int32 count,
00175 uint32 flags, bigtime_t microsecond_timeout);
00176 extern status_t release_sem(sem_id sem);
00177 extern status_t release_sem_etc(sem_id sem, int32 count,
00178 uint32 flags);
00179 extern status_t get_sem_count(sem_id sem, int32 *count);
00180
00181 extern status_t set_sem_owner(sem_id sem, team_id team);
00182
00183 extern status_t _get_sem_info(sem_id sem, sem_info *info,
00184 size_t size);
00185 extern status_t _get_next_sem_info(team_id team, int32 *cookie,
00186 sem_info *info, size_t size);
00187
00188 #define get_sem_info(sem, info) \
00189 _get_sem_info((sem), (info), sizeof(*(info)))
00190
00191 #define get_next_sem_info(team, cookie, info) \
00192 _get_next_sem_info((team), (cookie), (info), sizeof(*(info)))
00193
00194
00195
00196
00197
00198
00199 enum {
00200 B_CAN_INTERRUPT = 1,
00201 B_DO_NOT_RESCHEDULE = 2,
00202 B_CHECK_PERMISSION = 4,
00203 B_TIMEOUT = 8,
00204 B_RELATIVE_TIMEOUT = 8,
00205 B_ABSOLUTE_TIMEOUT = 16,
00206 B_USE_REAL_TIME = 32,
00207 B_WAKE_ON_TIMEOUT = 64
00208 };
00209
00210
00211
00212
00213
00214 enum {
00215 B_ONE_SHOT_ABSOLUTE_ALARM = 1,
00216 B_ONE_SHOT_RELATIVE_ALARM = 2,
00217 B_PERIODIC_ALARM = 3
00218 };
00219
00220 extern bigtime_t set_alarm(bigtime_t when, uint32 flags);
00221
00222
00223
00224
00225
00226
00227 typedef enum {
00228 B_THREAD_RUNNING=1,
00229 B_THREAD_READY,
00230 B_THREAD_RECEIVING,
00231 B_THREAD_ASLEEP,
00232 B_THREAD_SUSPENDED,
00233 B_THREAD_WAITING
00234 } thread_state;
00235
00236 #define B_LOW_PRIORITY 5
00237 #define B_NORMAL_PRIORITY 10
00238 #define B_DISPLAY_PRIORITY 15
00239 #define B_URGENT_DISPLAY_PRIORITY 20
00240 #define B_REAL_TIME_DISPLAY_PRIORITY 100
00241 #define B_URGENT_PRIORITY 110
00242 #define B_REAL_TIME_PRIORITY 120
00243
00244 typedef struct {
00245 thread_id thread;
00246 team_id team;
00247 char name[B_OS_NAME_LENGTH];
00248 thread_state state;
00249 int32 priority;
00250 sem_id sem;
00251 bigtime_t user_time;
00252 bigtime_t kernel_time;
00253 void *stack_base;
00254 void *stack_end;
00255 } thread_info;
00256
00257 typedef struct {
00258 bigtime_t user_time;
00259 bigtime_t kernel_time;
00260 } team_usage_info;
00261
00262 typedef int32 (*thread_func) (void *);
00263
00264
00265
00266
00267 #define thread_entry thread_func
00268
00269 extern thread_id spawn_thread (
00270 thread_func function_name,
00271 const char *thread_name,
00272 int32 priority,
00273 void *arg
00274 );
00275
00276 extern status_t kill_thread(thread_id thread);
00277 extern status_t resume_thread(thread_id thread);
00278 extern status_t suspend_thread(thread_id thread);
00279 extern status_t rename_thread(thread_id thread, const char *new_name);
00280 extern status_t set_thread_priority (thread_id thread, int32 new_priority);
00281 extern void exit_thread(status_t status);
00282 extern status_t wait_for_thread (thread_id thread,
00283 status_t *thread_return_value);
00284 extern status_t on_exit_thread(void (*callback)(void *), void *data);
00285
00286 extern status_t _get_thread_info(thread_id thread, thread_info *info, size_t size);
00287 extern status_t _get_next_thread_info(team_id tmid, int32 *cookie, thread_info *info, size_t size);
00288 extern status_t _get_team_usage_info(team_id tmid, int32 who, team_usage_info *ti, size_t size);
00289
00290 #if __INTEL__ && !_KERNEL_MODE && !_NO_INLINE_ASM
00291
00292 static inline thread_id find_thread(const char *name) {
00293 thread_id ret;
00294 extern thread_id _kfind_thread_(const char *tname);
00295 if (!name) {
00296 __asm__ __volatile__ (
00297 "movl %%fs:4, %%eax \n\t"
00298 : "=a"(ret) );
00299 } else
00300 ret = _kfind_thread_(name);
00301 return ret;
00302 }
00303
00304 #else
00305
00306 extern thread_id find_thread(const char *name);
00307
00308 #endif
00309
00310 #define get_thread_info(thread, info) \
00311 _get_thread_info((thread), (info), sizeof(*(info)))
00312
00313 #define get_next_thread_info(tmid, cookie, info) \
00314 _get_next_thread_info((tmid), (cookie), (info), sizeof(*(info)))
00315
00316 #define get_team_usage_info(tmid, who, info) \
00317 _get_team_usage_info((tmid), (who), (info), sizeof(*(info)))
00318
00319
00320 extern status_t send_data(thread_id thread,
00321 int32 code,
00322 const void *buf,
00323 size_t buffer_size);
00324
00325 extern status_t receive_data(thread_id *sender,
00326 void *buf,
00327 size_t buffer_size);
00328
00329 extern bool has_data(thread_id thread);
00330
00331
00332 extern status_t snooze(bigtime_t microseconds);
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342 extern status_t snooze_until(bigtime_t when, int timebase);
00343 #define B_SYSTEM_TIMEBASE (0)
00344
00345
00346
00347
00348
00349 extern status_t snooze_etc(bigtime_t usecs, int timebase, uint32 flags);
00350
00351
00352
00353
00354
00355 #define B_SYSTEM_TEAM 2
00356
00357 typedef struct {
00358 team_id team;
00359 int32 image_count;
00360 int32 thread_count;
00361 int32 area_count;
00362 thread_id debugger_nub_thread;
00363 port_id debugger_nub_port;
00364
00365 int32 argc;
00366 char args[64];
00367 uid_t uid;
00368 gid_t gid;
00369 } team_info;
00370
00371 extern status_t kill_team(team_id team);
00372
00373 extern status_t _get_team_info(team_id team, team_info *info, size_t size);
00374 extern status_t _get_next_team_info(int32 *cookie, team_info *info, size_t size);
00375
00376 #define get_team_info(team, info) \
00377 _get_team_info((team), (info), sizeof(*(info)))
00378
00379 #define get_next_team_info(cookie, info) \
00380 _get_next_team_info((cookie), (info), sizeof(*(info)))
00381
00382
00383
00384
00385
00386 #if __INTEL__
00387 #define B_MAX_CPU_COUNT 8
00388 #endif
00389
00390 #if __POWERPC__
00391 #define B_MAX_CPU_COUNT 8
00392 #endif
00393
00394 #if __arm__
00395 #define B_MAX_CPU_COUNT 1
00396 #endif
00397
00398 typedef enum cpu_vendors {
00399 B_CPU_VENDOR_UNKNOWN = 0,
00400 B_CPU_VENDOR_INTEL,
00401 B_CPU_VENDOR_AMD,
00402 B_CPU_VENDOR_UMC,
00403 B_CPU_VENDOR_CYRIX,
00404 B_CPU_VENDOR_NEXTGEN,
00405 B_CPU_VENDOR_CENTAUR,
00406 B_CPU_VENDOR_RISE,
00407 B_CPU_VENDOR_SIS,
00408 B_CPU_VENDOR_TRANSMETA,
00409 B_CPU_VENDOR_NATIONAL
00410 } cpu_vendor;
00411
00412 typedef enum cpu_types {
00413
00414
00415 B_CPU_PPC_601 = 1,
00416 B_CPU_PPC_603 = 2,
00417 B_CPU_PPC_603e = 3,
00418 B_CPU_PPC_604 = 4,
00419 B_CPU_PPC_604e = 5,
00420 B_CPU_PPC_750 = 6,
00421 B_CPU_PPC_686 = 13,
00422 B_CPU_AMD_29K,
00423 B_CPU_X86,
00424 B_CPU_MC6502,
00425 B_CPU_Z80,
00426 B_CPU_ALPHA,
00427 B_CPU_MIPS,
00428 B_CPU_HPPA,
00429 B_CPU_M68K,
00430 B_CPU_ARM,
00431 B_CPU_SH,
00432 B_CPU_SPARC,
00433
00434
00435 B_CPU_INTEL_X86 = 0x1000,
00436 B_CPU_INTEL_486_DX25 = 0x1040,
00437 B_CPU_INTEL_486_DX50,
00438 B_CPU_INTEL_486_SX,
00439 B_CPU_INTEL_486_DX2,
00440 B_CPU_INTEL_486_SL,
00441 B_CPU_INTEL_486_SX2,
00442 B_CPU_INTEL_486_DX2_WB = 0x1047,
00443 B_CPU_INTEL_486_DX4,
00444 B_CPU_INTEL_486_DX4_WB,
00445 B_CPU_INTEL_PENTIUM_ASTEP = 0x1050,
00446 B_CPU_INTEL_PENTIUM,
00447 B_CPU_INTEL_PENTIUM75,
00448 B_CPU_INTEL_PENTIUM_486_OVERDRIVE,
00449 B_CPU_INTEL_PENTIUM_MMX,
00450 B_CPU_INTEL_PENTIUM_MMX_MODEL_4 = B_CPU_INTEL_PENTIUM_MMX,
00451 B_CPU_INTEL_PENTIUM_M75 = 0x1057,
00452 B_CPU_INTEL_PENTIUM_MMX_MOBILE,
00453 B_CPU_INTEL_PENTIUM_MMX_MODEL_8 = B_CPU_INTEL_PENTIUM_MMX_MOBILE,
00454 B_CPU_INTEL_PENTIUM75_486_OVERDRIVE,
00455 B_CPU_INTEL_PENTIUM_PRO_ASTEP = 0x1060,
00456 B_CPU_INTEL_PENTIUM_PRO = 0x1061,
00457 B_CPU_INTEL_PENTIUM_II = 0x1063,
00458 B_CPU_INTEL_PENTIUM_II_MODEL_3 = 0x1063,
00459 B_CPU_INTEL_PENTIUM_II_MODEL_5 = 0x1065,
00460 B_CPU_INTEL_CELERON,
00461 B_CPU_INTEL_PENTIUM_III,
00462 B_CPU_INTEL_PENTIUM_III_MODEL_8,
00463 B_CPU_INTEL_PENTIUM_III_MOBILE,
00464 B_CPU_INTEL_PENTIUM_CENTRINO_A = B_CPU_INTEL_PENTIUM_III_MOBILE,
00465 B_CPU_INTEL_PENTIUM_III_XEON,
00466 B_CPU_INTEL_PENTIUM_III_MODEL_11,
00467 B_CPU_INTEL_PENTIUM_III_MODEL_B = B_CPU_INTEL_PENTIUM_III_MODEL_11,
00468 B_CPU_INTEL_PENTIUM_CENTRINO_B = 0x106d,
00469 B_CPU_INTEL_PENTIUM_IA64 = 0x1070,
00470 B_CPU_INTEL_PENTIUM_IV = 0x10f0,
00471 B_CPU_INTEL_PENTIUM_IV_MODEL1,
00472 B_CPU_INTEL_PENTIUM_IV_MODEL2,
00473 B_CPU_INTEL_PENTIUM_IV_MODEL3,
00474 B_CPU_INTEL_PENTIUM_IV_XEON = 0x0F27,
00475
00476
00477 B_CPU_AMD_X86 = 0x1100,
00478 B_CPU_AMD_486_DX2 = 0x1143,
00479 B_CPU_AMD_486_DX2_WB = 0x1147,
00480 B_CPU_AMD_486_DX4 = 0x1148,
00481 B_CPU_AMD_486_DX4_WB = 0x1149,
00482 B_CPU_AMD_586_WT = 0x114e,
00483 B_CPU_AMD_586_WB = 0x114f,
00484 B_CPU_AMD_K5 = 0x1150,
00485 B_CPU_AMD_K5_MODEL0 = 0x1150,
00486 B_CPU_AMD_K5_MODEL1,
00487 B_CPU_AMD_K5_MODEL2,
00488 B_CPU_AMD_K5_MODEL3,
00489 B_CPU_AMD_K6 = 0x1156,
00490 B_CPU_AMD_K6_MODEL6 = 0x1156,
00491 B_CPU_AMD_K6_MODEL7 = 0x1157,
00492 B_CPU_AMD_K6_MODEL8 = 0x1158,
00493 B_CPU_AMD_K6_2 = 0x1158,
00494 B_CPU_AMD_K6_MODEL9 = 0x1159,
00495 B_CPU_AMD_K6_III = 0x1159,
00496 B_CPU_AMD_K6_III_MODEL2 = 0x115D,
00497 B_CPU_AMD_ATHLON_MODEL0 = 0x1160,
00498 B_CPU_AMD_ATHLON_MODEL1 = 0x1161,
00499 B_CPU_AMD_ATHLON_MODEL2 = 0x1162,
00500 B_CPU_AMD_DURON = 0x1163,
00501 B_CPU_AMD_ATHLON_THUNDERBIRD = 0x1164,
00502 B_CPU_AMD_ATHLON_XP = 0x1166,
00503 B_CPU_AMD_ATHLON_XP_MODEL2,
00504 B_CPU_AMD_ATHLON_XP_MODEL3,
00505 B_CPU_AMD_ATHLON_XP_MODEL_BARTON = 0x116A,
00506 B_CPU_AMD_ATHLON_XP64 = 0x11F4,
00507 B_CPU_AMD_ATHLON_XP64_FX = 0x11F5,
00508 B_CPU_AMD_ATHLON_64 = 0x0F48,
00509 B_CPU_AMD_ATHLON_64_OPTERON = 0x0F51,
00510 B_CPU_AMD_ATHLON_64_FX = 0x0F58,
00511 B_CPU_AMD_ATHLON_64_754 = 0x0F4A,
00512 B_CPU_AMD_ATHLON_64_FX939 = 0x0F7A,
00513 B_CPU_AMD_ATHLON_64_FX940 = 0x0F5A,
00514 B_CPU_AMD_ATHLON_64_754_2 = 0x0FC0,
00515 B_CPU_AMD_ATHLON_64_754_3 = 0x0FE0,
00516 B_CPU_AMD_ATHLON_64_939 = 0x0FF0,
00517 B_CPU_AMD_ATHLON_64_754_4 = 0x0F82,
00518 B_CPU_AMD_ATHLON_64_939_2 = 0x0FB2,
00519 B_CPU_AMD_ATHLON_64_939_3 = 0x11FF,
00520 B_CPU_AMD_ATHLON_64_939_4 = 0x11FC,
00521
00522
00523
00524 B_CPU_CYRIX_X86 = 0x1200,
00525 B_CPU_CYRIX_MediaGX = 0x1244,
00526 B_CPU_CYRIX_6x86 = 0x1252,
00527 B_CPU_CYRIX_GXm = 0x1254,
00528 B_CPU_CYRIX_6x86MX = 0x1260,
00529 B_CPU_CYRIX_VIA_M2 = 0x1265,
00530 B_CPU_CYRIX_WINCHIP_C5A,
00531 B_CPU_CYRIX_WINCHIP_C5B,
00532 B_CPU_CYRIX_WINCHIP_C5N,
00533 B_CPU_CYRIX_WINCHIP_C5XL,
00534 B_CPU_VIA_ANTAUR = 0x1369,
00535
00536
00537 B_CPU_IDT_X86 = 0x1300,
00538 B_CPU_IDT_WINCHIP_C6 = 0x1354,
00539 B_CPU_IDT_WINCHIP_2 = 0x1358,
00540 B_CPU_IDT_WINCHIP_3 = 0x1359,
00541
00542
00543 B_CPU_RISE_X86 = 0x1400,
00544 B_CPU_RISE_mP6 = 0x1450,
00545
00546
00547 B_CPU_NATIONAL_X86 = 0x1500,
00548 B_CPU_NATIONAL_GEODE_GX1 = 0x1554,
00549 B_CPU_NATIONAL_GEODE_GX2 = 0x1555,
00550
00551
00552 B_CPU_NEXGEN_X86 = 0x1600,
00553 B_CPU_NEXGEN_Nx586 = 0x1650,
00554
00555
00556 B_CPU_SIS_X86 = 0x1700,
00557 B_CPU_SIS_55x = 0x1750,
00558
00559
00560 B_CPU_TRANSMETA_X86 = 0x1800,
00561 B_CPU_TRANSMETA_CRUSOE = 0x1854,
00562
00563
00564 B_CPU_UMC_X86 = 0x1900,
00565 B_CPU_UMC_U5D = 0x1941,
00566 B_CPU_UMC_U5S = 0x1942
00567
00568 } cpu_type;
00569
00570 #define B_CPU_X86_VENDOR_MASK 0x1F00
00571
00572
00573 #ifdef __INTEL__
00574 typedef union {
00575 struct {
00576 uint32 max_eax;
00577 char vendorid[12];
00578 } eax_0;
00579
00580 struct {
00581 uint32 stepping : 4;
00582 uint32 model : 4;
00583 uint32 family : 4;
00584 uint32 type : 4;
00585 uint32 ext_model : 4;
00586 uint32 ext_family : 8;
00587 uint32 reserved_0 : 4;
00588
00589 uint32 brand_id : 8;
00590 uint32 cflush : 8;
00591 uint32 logical_cpu_count : 8;
00592 uint32 apic_id : 8;
00593
00594 uint32 features;
00595 uint32 ext_features;
00596 } eax_1;
00597
00598 struct {
00599 uint8 call_num;
00600 uint8 cache_descriptors[15];
00601 } eax_2;
00602
00603 struct {
00604 uint32 reserved[1];
00605 uint32 serial_number_transmeta;
00606 uint32 serial_number_high;
00607 uint32 serial_number_low;
00608 } eax_3;
00609
00610 struct {
00611 uint32 cache_type : 5;
00612 uint32 cache_level : 3;
00613 uint32 self_initializing : 1;
00614 uint32 fully_associative : 1;
00615 uint32 reserved : 4;
00616 uint32 cpu_threads : 12;
00617 uint32 cpu_cores : 6;
00618
00619 uint32 coherency_line_size : 12;
00620 uint32 phys_line_partition : 10;
00621 uint32 associativities : 10;
00622
00623 uint32 sets : 32;
00624
00625 uint32 reserved_1 : 32;
00626 } eax_4;
00627
00628 char as_chars[16];
00629
00630 struct {
00631 uint32 physical_adress_bits: 8;
00632 uint32 virtual_adress_bits : 8;
00633 uint32 reserved_0 : 16;
00634 uint32 reserved[3];
00635 } eax_8000_0008;
00636
00637 struct {
00638 uint32 eax;
00639 uint32 ebx;
00640 uint32 edx;
00641 uint32 ecx;
00642 } regs;
00643 } cpuid_info;
00644
00645 extern status_t get_cpuid(cpuid_info* info, uint32 eax_register, uint32 cpu_num);
00646 #endif
00647
00648
00649 typedef enum platform_types {
00650 B_BEBOX_PLATFORM = 0,
00651 B_MAC_PLATFORM,
00652 B_AT_CLONE_PLATFORM,
00653 B_ENIAC_PLATFORM,
00654 B_APPLE_II_PLATFORM,
00655 B_CRAY_PLATFORM,
00656 B_LISA_PLATFORM,
00657 B_TI_994A_PLATFORM,
00658 B_TIMEX_SINCLAIR_PLATFORM,
00659 B_ORAC_1_PLATFORM,
00660 B_HAL_PLATFORM,
00661 B_BESM_6_PLATFORM,
00662 B_MK_61_PLATFORM,
00663 B_NINTENDO_64_PLATFORM,
00664 B_ARM_PLATFORM
00665 } platform_type;
00666
00667 typedef struct {
00668 bigtime_t active_time;
00669 } cpu_info;
00670
00671
00672 typedef int32 machine_id[2];
00673
00674 typedef struct {
00675 machine_id id;
00676 bigtime_t boot_time;
00677
00678 int32 cpu_count;
00679 enum cpu_types cpu_type;
00680 int32 cpu_revision;
00681 cpu_info cpu_infos[B_MAX_CPU_COUNT];
00682 int64 cpu_clock_speed;
00683 int64 bus_clock_speed;
00684 enum platform_types platform_type;
00685
00686 int32 max_pages;
00687 int32 used_pages;
00688 int32 page_faults;
00689 int32 max_sems;
00690 int32 used_sems;
00691 int32 max_ports;
00692 int32 used_ports;
00693 int32 max_threads;
00694 int32 used_threads;
00695 int32 max_teams;
00696 int32 used_teams;
00697
00698 char kernel_name [B_FILE_NAME_LENGTH];
00699 char kernel_build_date[B_OS_NAME_LENGTH];
00700 char kernel_build_time[B_OS_NAME_LENGTH];
00701 int64 kernel_version;
00702
00703 bigtime_t _busy_wait_time;
00704 int32 pad[4];
00705 } system_info;
00706
00707 extern status_t _get_system_info (system_info *returned_info, size_t size);
00708 #define get_system_info(info) _get_system_info((info), sizeof(*(info)))
00709
00710 extern int32 is_computer_on(void);
00711 extern double is_computer_on_fire(void);
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722 extern uint32 real_time_clock (void);
00723 extern void set_real_time_clock (int32 secs_since_jan1_1970);
00724 extern bigtime_t real_time_clock_usecs (void);
00725 extern status_t set_timezone(char *str);
00726
00727 extern bigtime_t system_time (void);
00728 extern bigtime_t system_real_time (void);
00729
00730
00731
00732
00733 extern void debugger (const char *message);
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743 extern const int disable_debugger(int state);
00744
00745 #ifdef __cplusplus
00746 }
00747 #endif
00748
00749 #endif