openblt

a hobby OS from the late 90s
git clone http://frotz.net/git/openblt.git
Log | Files | Refs | LICENSE

os.h (2691B)


      1 /* Copyright 1999 Sidney Cammeresi.  All rights reserved.
      2 ** Distributed under the terms of the OpenBLT License.
      3 */
      4 
      5 #ifndef __BLT_OS_H__
      6 #define __BLT_OS_H__
      7 
      8 /*
      9  * this is generic stuff that is used both in userspace and in the kernel
     10  * that doesn't really fit elsewhere.
     11  *
     12  * this file is included in both apps and the kernel, so don't include
     13  * silly userland files here!
     14  */
     15 
     16 #define BLT_MAX_NAME_LENGTH          32
     17 #define BLT_MAX_CPUS                 8
     18 
     19 #define PORT_OPT_NOWAIT        1
     20 #define PORT_OPT_SETRESTRICT   2
     21 #define PORT_OPT_SETDEFAULT    3
     22 #define PORT_OPT_SLAVE         4
     23 
     24 #define RIGHT_PERM_READ      0x0001  /* allow 'read' access to something     */
     25 #define RIGHT_PERM_WRITE     0x0002  /* allow 'write' access to something    */
     26 #define RIGHT_PERM_DESTROY   0x0004  /* allow the something to be destroyed  */
     27 #define RIGHT_PERM_ATTACH    0x0008  /* allows other rights to be attached   */
     28 #define RIGHT_PERM_GRANT     0x0010  /* this right may be granted to another */
     29                                      /* thread by a thread that is not the   */
     30                                      /* owner                                */
     31 #define RIGHT_MODE_INHERIT   0x0020  /* automatically granted to child       */
     32 #define RIGHT_MODE_DISSOLVE  0x0040  /* When the owner thread terminates,    */
     33                                      /* the right is destroyed               */
     34 
     35 #define AREA_PHYSMAP         0x00000001
     36 #define AREA_UNMAPPED        0x00000002
     37 #define AREA_COPY_ON_WRITE   0x00000004
     38 #define PAGE_PRESENT         0x00000001
     39 #define PAGE_WRITABLE        0x00000002
     40 #define PAGE_USER            0x00000004
     41 #define PAGE_NORMAL_KERNEL   0x00000003
     42 #define PAGE_NORMAL_USER     0x00000007
     43 
     44 #define JOIN_NO_HANG        0x00000001
     45 
     46 #ifndef __ASM__
     47 
     48 typedef enum
     49 {
     50 	CPU_INTEL_386,
     51 	CPU_INTEL_486,
     52 	CPU_INTEL_PENTIUM,
     53 	CPU_INTEL_PENTIUM_PRO,
     54 	CPU_INTEL_PENTIUM_II,
     55 	CPU_INTEL_PENTIUM_III,
     56 	CPU_MOT_PPC_601,
     57 	CPU_MOT_PPC_603,
     58 	CPU_MOT_PPC_603e,
     59 	CPU_MOT_PPC_604,
     60 	CPU_MOT_PPC_604e
     61 } cpu_type;
     62 
     63 typedef struct
     64 {
     65 	cpu_type c_type;
     66 	char c_revision, c_active;
     67 } cpu_info;
     68 
     69 typedef struct
     70 {
     71 	char *name;
     72 } thread_info;
     73 
     74 typedef struct
     75 {
     76 	int num_cpus;
     77 	cpu_info c_info[BLT_MAX_CPUS];
     78 	char kernel_name[BLT_MAX_NAME_LENGTH];
     79 	char kernel_version[BLT_MAX_NAME_LENGTH];
     80 	char kernel_build_date[BLT_MAX_NAME_LENGTH];
     81 	char kernel_build_time[BLT_MAX_NAME_LENGTH];
     82 } sys_info;
     83 
     84 typedef struct
     85 {
     86 	int rid;
     87 	union
     88 	{
     89 		thread_info t_info;
     90 		sys_info s_info;
     91 	} r_un;
     92 } rsrc_info;
     93 		
     94 typedef struct 
     95 {
     96 	void (*func)(void);
     97 	int priority;
     98 } init_info;
     99 
    100 #define META_NULL_REQUEST    0
    101 #define META_MIN_RESERVED    0xf0000000
    102 #define META_MAX_RESERVED    0xffffffff
    103 
    104 #endif
    105 
    106 #endif
    107