Custom-OS-Kernel / h / pandos_types.h
pandos_types.h
Raw
#ifndef PANDOS_TYPES_H_INCLUDED
#define PANDOS_TYPES_H_INCLUDED

/****************************************************************************
 *
 * This header file contains utility types definitions.
 *
 ****************************************************************************/

#include <umps3/umps/types.h>
#include "pandos_const.h"

typedef signed int   cpu_t;
typedef unsigned int memaddr;

// it computes the current time based on values in certain registers
#define CURRENT_TOD ((*((memaddr *)TODLOADDR)) / (*((cpu_t *)TIMESCALEADDR)))


/* Types added by Mikeyg */

typedef struct pteEntry_t {
    unsigned int pte_entryHI;
    unsigned int pte_entryLO;
} pteEntry_t;


typedef struct context_t {
    unsigned int stackPtr;
    unsigned int status;
    unsigned int pc;
} context_t;


typedef struct support_t {
    int        sup_asid;                        /* process ID					*/
    state_t    sup_exceptState[2];              /* old state exceptions			*/
    context_t  sup_exceptContext[2];            /* new contexts for passing up	*/
    pteEntry_t sup_privatePgTbl[USERPGTBLSIZE]; /* user page table				*/
    int        sup_stackTLB[500];               /* 2kb stack dedicated to TLB exception handler */
    int        sup_stackGen[500];               /* 2kb stack dedicated to General exception handling*/
} support_t;


/* process control block */
typedef struct pcb_t {

    struct pcb_t *p_next; 
    struct pcb_t *p_prev; 

  
    struct pcb_t *p_prnt, 
        *p_child,         
        *p_next_sib,     
        *p_prev_sib;     


    state_t p_s;    
    cpu_t   p_time; 


    int *      p_semAdd;
    support_t *p_supportStruct;

} pcb_t, *pcb_PTR;

typedef struct semd_t {

    struct semd_t *s_next;

    int *s_semAdd;  
    pcb_PTR s_procQ;

} semd_t, *semd_PTR;

/* Page swap pool information structure type */
typedef struct swap_t {
    int         sw_asid;   
    int         sw_pageNo; 
    pteEntry_t *sw_pte;    
} swap_t;

#endif