home *** CD-ROM | disk | FTP | other *** search
- #ifndef QUARK_TASK_H
- #define QUARK_TASK_H
-
- #include <public/quark/types.h>
-
- /*
- * Corrected by the sed makefile subroutine
- */
- typedef unsigned long long q_pid_t;
- typedef unsigned long long q_tid_t;
- typedef unsigned long q_signalmask_t;
-
- #define THREADCOUNT 128
-
- #define THREADTAG_DUMMY (0x1000)
-
-
- /* Sequence: THREADTAG_CHIEFTID, q_tid_t*
- * Function: Create
- * TID of the Clan Chief of the new task.
- * This tag is only useful for CreateTask.
- * If it`s not specified the parent`s ChiefTID
- * is used.
- * You`ve automaticly added to the VillageList of
- * your ChiefThread`s VillageList.
- * ChiefThread`s are used when you send message to
- * a msgport which isn`t part of your CLAN.
- * Nice for security gateway..or gateways to other
- * computers.
- */
- #define THREADTAG_CHIEFTID (THREADTAG_DUMMY + 0x1)
-
- /* Sequence: THREADTAG_NAME, char*
- * Function: Create
- * Name of the new Task.
- */
- #define THREADTAG_NAME (THREADTAG_DUMMY + 0x2)
-
- /* Sequence: THREADTAG_ARG1, u_int32_t
- * Function: Create
- * 1st Argument..gpr3
- */
- #define THREADTAG_ARG1 (THREADTAG_DUMMY + 0x3)
-
- /* Sequence: THREADTAG_ARG2, u_int32_t
- * Function: Create
- * 2nd Argument..gpr4
- */
- #define THREADTAG_ARG2 (THREADTAG_DUMMY + 0x4)
-
- /* Sequence: THREADTAG_ARG3, u_int32_t
- * Function: Create
- * 3rd Argument..gpr5
- */
- #define THREADTAG_ARG3 (THREADTAG_DUMMY + 0x5)
-
- /* Sequence: THREADTAG_ARG4, u_int32_t
- * Function: Create
- * 4th Argument..gpr6
- */
- #define THREADTAG_ARG4 (THREADTAG_DUMMY + 0x6)
-
- /* Sequence: THREADTAG_ARG5, u_int32_t
- * Function: Create
- * 5th Argument..gpr7
- */
- #define THREADTAG_ARG5 (THREADTAG_DUMMY + 0x7)
-
- /* Sequence: THREADTAG_ARG6, u_int32_t
- * Function: Create
- * 6th Argument..gpr8
- */
- #define THREADTAG_ARG6 (THREADTAG_DUMMY + 0x8)
-
- /* Sequence: THREADTAG_ARG7, u_int32_t
- * Function: Create
- * 7th Argument..gpr9
- */
- #define THREADTAG_ARG7 (THREADTAG_DUMMY + 0x9)
-
- /* Sequence: THREADTAG_ARG8, u_int32_t
- * Function: Create
- * 8th Argument..gpr10
- */
- #define THREADTAG_ARG8 (THREADTAG_DUMMY + 0xa)
-
- /* Sequence: THREADTAG_CLASS, u_int32_t
- * Function: Create
- * define Scheduler Class
- */
- #define THREADTAG_CLASS (THREADTAG_DUMMY + 0xb)
-
- /* Sequence: THREADTAG_CLASSPRI, int32_t
- * Function: Create
- * define Scheduler Class Priority
- */
- #define THREADTAG_CLASSPRI (THREADTAG_DUMMY + 0xc)
-
- /* Sequence: THREADTAG_CPUHINT, u_int32_t
- * Function: Create
- * The CPU number the task should start on.
- * This is only a hint and no gurantee.
- */
- #define THREADTAG_CPUHINT (THREADTAG_DUMMY + 0xd)
-
- /* Sequence: THREADTAG_STARTPC, u_int32_t
- * Function: Create
- * defines the start for this thread
- */
- #define THREADTAG_STARTPC (THREADTAG_DUMMY + 0xe)
-
- /* Sequence: THREADTAG_STACK, void*
- * Function: Create
- * defines the virtuell stack ptr for a thread
- * Only useful if you create a virtual process space
- */
- #define THREADTAG_STACK (THREADTAG_DUMMY + 0xf)
-
- /* Sequence: THREADTAG_STACKSIZE, u_int32_t
- * Function: Create
- * defines the thread`s stacksize
- */
- #define THREADTAG_STACKSIZE (THREADTAG_DUMMY + 0x10)
-
- /* Sequence: THREADTAG_WAIT, q_signalmask_t
- * Function: Create
- * The Thread is started blocked(WaitMask==0)
- * You can activate it with a QSignal(TID,0)
- * !!ATTENTION!!
- * this tag will probably changed.
- */
- #define THREADTAG_WAIT (THREADTAG_DUMMY + 0x11)
-
- #define THREADTAG_USERTAG0 (THREADTAG_DUMMY + 0x12)
-
- /* Sequence: THREADTAG_ERROR, u_int32_t*
- * Function: Create
- * defines the ptr for a more precise return
- * error result
- */
- #define THREADTAG_ERROR (THREADTAG_DUMMY + 0x13)
-
- /* Sequence: THREADTAG_EXCEPTIONTID,(q_tid_t*)
- * Function: Create
- * defines the ptr to the special exception
- * handler tid.
- */
- #define THREADTAG_EXCEPTIONTID (THREADTAG_DUMMY + 0x14)
-
- /* Sequence: THREADTAG_TASKEXCEPTIONTID,(q_tid_t*)
- * Function: Create
- * defines the ptr to the task default exception handler
- * tid for all threads which are created in it.
- * Can be overruled with THREADTAG_EXCEPTIONTID
- */
- #define THREADTAG_TASKEXCEPTIONTID (THREADTAG_DUMMY + 0x15)
-
- /*
- * Error Types
- */
-
- #define THREADERROR_OK 0
- #define THREADERROR_NOMEMORY 1
- #define THREADERROR_NOPORT 2
- #define THREADERROR_NOTID 3
- #define THREADERROR_NOPID 4
-
- /*
- * Can`t obtain the physical address for your
- * supplied virtual stack address.
- * Then the last return function handling
- * fails as it can`t make the necessary
- * stack modification.
- */
- #define THREADERROR_NOPHYSICALSTACK 5
-
-
-
- /* Scheduler Classes
- */
-
- #define THREADCLASS_INTSERVER 0
- #define THREADCLASS_REALTIME 1
- #define THREADCLASS_NORMAL 2
-
-
-
- /* GetThreadAttr()
- * SetThreadAttr()
- */
-
- #define THREADATTRTAG_DUMMY (0x1500)
-
- /* Sequence: THREADATTRTAG_GETSIZE
- * Function: Get
- * Get the size of an operation
- */
- #define THREADATTRTAG_GETSIZE (THREADATTRTAG_DUMMY + 0x1)
-
- /* Sequence: THREADATTRTAG_QUERY
- * Function: Get
- * Get all tag types
- */
- #define THREADATTRTAG_QUERY (THREADATTRTAG_DUMMY + 0x2)
-
- /* Sequence: THREADATTRTAG_NAME
- * MyData: char*
- * Function: Get
- * Get name of thread
- */
- #define THREADATTRTAG_NAME (THREADATTRTAG_DUMMY + 0x3)
-
- /* Sequence: THREADATTRTAG_NAMESIZE
- * MyData: u_int32_t*
- * Function: Get
- * Get the size of the thread name
- */
- #define THREADATTRTAG_NAMESIZE (THREADATTRTAG_DUMMY + 0x4)
-
- /* Sequence: THREADATTRTAG_CLASS
- * MyData: u_int32_t
- * Function: Get/Set
- * get/set the scheduling class of the Thread
- */
- #define THREADATTRTAG_CLASS (THREADATTRTAG_DUMMY + 0x5)
-
- /* Sequence: THREADATTRTAG_CLASSPRI
- * MyData: int32_t
- * Function: Get/Set
- * get/set the scheduling priority in the Thread`s
- * class queue
- */
- #define THREADATTRTAG_CLASSPRI (THREADATTRTAG_DUMMY + 0x6)
-
- /* Sequence: THREADATTRTAG_CPU
- * MyData: u_int32_t
- * Function: Get/Set
- * get/set the thread`s cpu.
- */
- #define THREADATTRTAG_CPU (THREADATTRTAG_DUMMY + 0x7)
-
- /* Sequence: THREADATTRTAG_SIGALLOC
- * MyData: q_signalmask_t*
- * Function: Get
- * get the thread`s allocated signalmask.
- */
- #define THREADATTRTAG_SIGALLOC (THREADATTRTAG_DUMMY + 0x8)
-
- /* Sequence: THREADATTRTAG_SIGWAIT
- * MyData: q_signalmask_t*
- * Function: Get
- * get the thread`s wait signalmask.
- */
- #define THREADATTRTAG_SIGWAIT (THREADATTRTAG_DUMMY + 0x9)
-
- /* Sequence: THREADATTRTAG_SIGRECVD
- * MyData: q_signalmask_t*
- * Function: Get
- * get the thread`s received signalmask.
- */
- #define THREADATTRTAG_SIGRECVD (THREADATTRTAG_DUMMY + 0xa)
-
- /* Sequence: THREADATTRTAG_USERDATA
- * MyData: void*
- * Function: Get/Set
- * get/set the thread`s userdata
- */
- #define THREADATTRTAG_USERDATA (THREADATTRTAG_DUMMY + 0xb)
-
- /* Sequence: THREADATTRTAG_USERDATASIZE
- * MyData: u_int32_t
- * Function: Get
- * get the thread`s userdata size
- */
- #define THREADATTRTAG_USERDATASIZE (THREADATTRTAG_DUMMY + 0xc)
-
- /* Sequence: THREADATTRTAG_TID
- * MyData: q_tid_t
- * Function: Get
- * get the thread`s tid
- */
- #define THREADATTRTAG_TID (THREADATTRTAG_DUMMY + 0xd)
-
- /* Sequence: THREADATTRTAG_CHIEFTID
- * MyData: q_tid_t
- * Function: Get
- * get the thread`s chief tid
- */
- #define THREADATTRTAG_CHIEFTID (THREADATTRTAG_DUMMY + 0xe)
-
- /* Sequence: THREADATTRTAG_USERTAG0
- * MyData: u_int32_t
- * Function: Get/Set
- * some private usertag field
- */
- #define THREADATTRTAG_USERTAG0 (THREADATTRTAG_DUMMY + 0xf)
-
- /* Sequence: THREADATTRTAG_START
- * MyData: u_int32_t
- * Function: Get/Set
- * some private usertag field
- */
- //#define THREADATTRTAG_START (THREADATTRTAG_DUMMY + 0x10)
-
- /* Sequence: THREADATTRTAG_EXCEPTIONTYPE.
- * MyData: u_int32_t
- * Function: Get
- * get the type of an exception.
- * Only useful if the thread causes an
- * exception. The value remains valid
- * until the next exception happens.
- */
- #define THREADATTRTAG_EXCEPTIONTYPE (THREADATTRTAG_DUMMY + 0x11)
-
- /* Sequence: THREADATTRTAG_EXCEPTIONTID.
- * MyData: q_tid_t*
- * Function: Get/set
- * get/set the thread`s private exception tid.
- * This TID is send an OS message to signal
- * an exception.
- */
- #define THREADATTRTAG_EXCEPTIONTID (THREADATTRTAG_DUMMY + 0x12)
-
-
- /*
- * PPC register fields of the thread
- */
-
- /* Sequence: THREADATTRTAG_PPC_SRR0
- * MyData: size_t*
- * Function: Get/set
- * get/set the thread`s SRR0 register
- */
- #define THREADATTRTAG_PPC_SRR0 (THREADATTRTAG_DUMMY + 0x50)
-
- /* Sequence: THREADATTRTAG_PPC_SRR1
- * MyData: size_t*
- * Function: Get/set
- * get/set the thread`s SRR1 register
- */
- #define THREADATTRTAG_PPC_SRR1 (THREADATTRTAG_DUMMY + 0x51)
-
- /* Sequence: THREADATTRTAG_PPC_LR
- * MyData: size_t*
- * Function: Get/set
- * get/set the thread`s LR register
- */
- #define THREADATTRTAG_PPC_LR (THREADATTRTAG_DUMMY + 0x52)
-
- /* Sequence: THREADATTRTAG_PPC_CTR
- * MyData: size_t*
- * Function: Get/set
- * get/set the thread`s CTR register
- */
-
- #define THREADATTRTAG_PPC_CTR (THREADATTRTAG_DUMMY + 0x53)
-
- /* Sequence: THREADATTRTAG_PPC_CR
- * MyData: size_t*
- * Function: Get/set
- * get/set the thread`s CR register
- */
- #define THREADATTRTAG_PPC_CR (THREADATTRTAG_DUMMY + 0x54)
-
- /* Sequence: THREADATTRTAG_PPC_XER
- * MyData: size_t*
- * Function: Get/set
- * get/set the thread`s SRR1 register
- */
-
- #define THREADATTRTAG_PPC_XER (THREADATTRTAG_DUMMY + 0x55)
-
- /* Sequence: THREADATTRTAG_PPC_FPSCR
- * MyData: float64_t*
- * Function: Get/set
- * get/set the thread`s FPSCR register
- */
-
- #define THREADATTRTAG_PPC_FPSCR (THREADATTRTAG_DUMMY + 0x56)
-
-
- /* Sequence: THREADATTRTAG_PPC_GPR, u_int32_t Offset, u_int32_t Number
- * MyData: u_int32_t*
- * Function: Get/set
- * get/set the thread`s GPR registers
- */
- #define THREADATTRTAG_PPC_GPR (THREADATTRTAG_DUMMY + 0x57)
-
- /* Sequence: THREADATTRTAG_PPC_FPR, u_int32_t Offset, u_int32_t Number
- * MyData: float64_t*
- * Function: Get/set
- * get/set the thread`s FPR registers
- */
- #define THREADATTRTAG_PPC_FPR (THREADATTRTAG_DUMMY + 0x58)
-
- /* Sequence: THREADATTRTAG_PPC_VMX, u_int32_t Offset, u_int32_t Number
- * MyData: vector128_t*
- * Function: Get/set
- * get/set the thread`s VMX registers
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_VMX (THREADATTRTAG_DUMMY + 0x59)
-
- /* Sequence: THREADATTRTAG_PPC_VSAVE
- * MyData: u_int32_t
- * Function: Get/set
- * get/set the thread`s VSAVE register
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_VSAVE (THREADATTRTAG_DUMMY + 0x60)
-
- /* Sequence: THREADATTRTAG_PPC_VSCR
- * MyData: vector128_t
- * Function: Get/set
- * get/set the thread`s VSCR register
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_VSCR (THREADATTRTAG_DUMMY + 0x61)
-
-
- /* Sequence: THREADATTRTAG_PPC_IABR
- * MyData: size_t*
- * Function: Get/Set
- * get/set the thread`s IABR register
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_IABR (THREADATTRTAG_DUMMY + 0x62)
-
- /* Sequence: THREADATTRTAG_PPC_DABR
- * MyData: size_t*
- * Function: Get/Set
- * get/set the thread`s DABR register
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_DABR (THREADATTRTAG_DUMMY + 0x63)
-
- /* Sequence: THREADATTRTAG_PPC_MMCR0
- * MyData: size_t*
- * Function: Get/Set
- * get/set the thread`s MMCR0 register
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_MMCR0 (THREADATTRTAG_DUMMY + 0x64)
-
- /* Sequence: THREADATTRTAG_PPC_MMCR1
- * MyData: size_t*
- * Function: Get/Set
- * get/set the thread`s MMCR1 register
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_MMCR1 (THREADATTRTAG_DUMMY + 0x65)
-
- /* Sequence: THREADATTRTAG_PPC_MMCR2
- * MyData: size_t*
- * Function: Get/Set
- * get/set the thread`s MMCR2 register
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_MMCR2 (THREADATTRTAG_DUMMY + 0x66)
-
- /* Sequence: THREADATTRTAG_PPC_PMC1
- * MyData: size_t*
- * Function: Get/Set
- * get/set the thread`s PMC1 register
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_PMC1 (THREADATTRTAG_DUMMY + 0x67)
-
- /* Sequence: THREADATTRTAG_PPC_PMC2
- * MyData: size_t*
- * Function: Get/Set
- * get/set the thread`s PMC2 register
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_PMC2 (THREADATTRTAG_DUMMY + 0x68)
-
- /* Sequence: THREADATTRTAG_PPC_PMC3
- * MyData: size_t*
- * Function: Get/Set
- * get/set the thread`s PMC3 register
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_PMC3 (THREADATTRTAG_DUMMY + 0x69)
-
- /* Sequence: THREADATTRTAG_PPC_PMC4
- * MyData: size_t*
- * Function: Get/Set
- * get/set the thread`s PMC4 register
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_PMC4 (THREADATTRTAG_DUMMY + 0x6a)
-
- /* Sequence: THREADATTRTAG_PPC_SIA
- * MyData: size_t*
- * Function: Get/Set
- * get/set the thread`s SIA register
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_SIA (THREADATTRTAG_DUMMY + 0x6b)
-
- /* Sequence: THREADATTRTAG_PPC_SDA
- * MyData: size_t*
- * Function: Get/Set
- * get/set the thread`s SDA register
- * (optional PPC register)
- */
- #define THREADATTRTAG_PPC_SDA (THREADATTRTAG_DUMMY + 0x6c)
-
-
- /* Sequence: THREADATTRTAG_PPC_DSISR
- * MyData: size_t*
- * Function: Get
- * get the thread`s DSISR register.
- * Only useful if the thread causes an
- * exception. The value remains valid
- * until the next exception happens.
- */
- #define THREADATTRTAG_PPC_DSISR (THREADATTRTAG_DUMMY + 0x6d)
-
- /* Sequence: THREADATTRTAG_PPC_DAR
- * MyData: size_t*
- * Function: Get
- * get the thread`s DAR register.
- * Only useful if the thread causes an
- * exception. The value remains valid
- * until the next exception happens.
- */
- #define THREADATTRTAG_PPC_DAR (THREADATTRTAG_DUMMY + 0x6e)
-
- /* Sequence: THREADATTRTAG_PPC_FPECR
- * MyData: size_t*
- * Function: Get
- * get the thread`s FPECR register.
- * Only useful if the thread causes an
- * exception. The value remains valid
- * until the next exception happens.
- */
- #define THREADATTRTAG_PPC_FPECR (THREADATTRTAG_DUMMY + 0x6f)
-
-
-
-
-
- /* Sequence: THREADATTRTAG_PPC_REGFRAME
- * MyData: struct PPCRegFrame *
- * Function: Get/Set
- * get/set a full regframe
- */
- #define THREADATTRTAG_PPC_REGFRAME (THREADATTRTAG_DUMMY + 0x100)
-
-
- /*
- * Thread states
- */
-
- #define THREADSTATE_INVALID 0
- #define THREADSTATE_RUN 1
- #define THREADSTATE_READY 2
- #define THREADSTATE_WAIT 3
- #define THREADSTATE_WAITINT 4 /* Interrupt Task */
- #define THREADSTATE_DEADSOON 5 /* when it waits for village threads to die */
- #define THREADSTATE_DEAD 6 /* when it`s dead */
- #define THREADSTATE_INACTIVE 7 /* when it`s still alive but inactive */
- #define THREADSTATE_INIT 8 /* when it`s in the init state...internal usage */
- #define THREADSTATE_REMOVED 9 /* when it`s in the remove state...internal usage */
- #define THREADSTATE_EXCEPTION 10 /* when it`s in the exception state...internal usage */
-
-
-
- /* Signals
- */
-
- /* As an input Signal it means..get any signal
- * which is free
- * As a Result it means there`s no free signal
- * anymore
- */
-
- #define SIGNAL_NONE (-1)
-
-
- /* !!!!!!!Attention!!!!!!!!!!!!
- * If you change something here you better also
- * fix emulmodules/exec68k/tasks.c
- */
- struct PPCRegFrame
- {
- u_int32_t StackGap[4]; /* StackFrame Gap..so a function working
- * with the PPCRegFrame as the GPR1 doesn`t
- * overwrite any contents with a LR store at 4(1)
- */
-
- u_int32_t Version; /* Version of the structure */
- u_int32_t Type; /* Type of the regframe */
- u_int32_t Flags; /* The filled up registers */
- u_int32_t State; /* State of the Thread(only used for Get) */
-
- u_int32_t SRR0;
- u_int32_t SRR1;
- u_int32_t LR;
- u_int32_t CTR;
-
- u_int32_t CR;
- u_int32_t XER;
-
- u_int32_t GPR[32];
-
- float64_t FPR[32];
- float64_t FPSCR;
-
- u_int32_t VSAVE;
- u_int32_t AlignPad0;
- u_int32_t AlignPad1;
- u_int32_t AlignPad2;
- vector128_t VSCR;
- vector128_t VMX[32];
- /* no size
- */
- };
-
- #define REGFRAMEFLAGF_FPU 0x1
- #define REGFRAMEFLAGF_VMX 0x2
-
-
- #endif
-