↑ Back to main site.

EPOS

Experimental Protected-mode Operating System

process.h
/*
EPOS
http://www.atanaslaskov.com/epos/

FILE:          specmem.c
DESCRIPTION:   Services for accessing special memory areas
 
NOTE: This should not be used directly any more.
Client processes should use "kernel\service\mem\mem.c" instead.
 
BSD LICENSE
Copyright (c) 2006, Atanas Laskov
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
   1. Redistributions of source code must retain the above copyright notice,
   this list of conditions and the following disclaimer.
   2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL ATANAS LASKOV BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef PROCESS_H_SRV
#define PROCESS_H_SRV

// Defaults
//
#define P_ADDRESS_PID  0
#define P_ADDRESS_NAME 1

#define ADDRESS_PID    P_ADDRESS_PID
#define ADDRESS_NAME   P_ADDRESS_NAME

#define PRCSTATE  unsigned char

#define P_S_OK                 0
#define P_S_INVALID_PROCESS    1
#define P_S_INVALID_NAME       2
#define P_S_NAME_OCCUPIED      3
#define P_S_NAME_FREE          4
#define P_S_OUTOFPROCESSMEMORY 5
#define P_S_INVALIDPID         6

// Data structures
//
struct PAddress{
    unsigned char bType;
    PID           dwAddress;
};

struct PAllocName{
    PID      dwName;
    PRCSTATE st;
};

struct PCreate{
    PID dwPID;
    unsigned long dwSize;
    char          strModule[41];
    PRCSTATE st;
};

struct PTransferByte{
    PID dwPID;
    unsigned char bByte;
    unsigned long dwOfs;
    PRCSTATE st;
};

struct PPID{
    PID dwPID;
    PRCSTATE st;
};

struct PHLine{
    unsigned long hLine;
    PRCSTATE st;
};

struct PInfo{
    PID dwPID;
    unsigned long  dwMemBase;
    unsigned long  dwMemSize;
    unsigned short wState;
    unsigned long  dwParent;
    unsigned long  hKernelLine;
    char           strModule[41];
    PRCSTATE st;
};

// Kernel internals
//
void    k_pInit();
PRCSTATE k_pGetPID(struct PAddress* p, PID *pPID);

// User services
//
void pCreate(struct PCreate *p);
void pPut(struct PTransferByte *p);
void pRun(struct PPID *p);
void pSelfKill();
void pKill(struct PPID *p);

void pAllocateName(struct PAllocName* p);
void pFreeName(struct PAllocName *p);
void pGetProcessID(struct PPID *p);

void pGetKernelLine(struct PHLine *p);
void pInfo(struct PInfo *p);

#endif //#ifndef PROCESS_H_SRV