Ignore:
Timestamp:
Jun 19, 1999, 3:57:51 PM (26 years ago)
Author:
sandervl
Message:

Changes for Win32 TIB allocation (not activated)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/os2util.cpp

    r120 r123  
    1 /* $Id: os2util.cpp,v 1.3 1999-06-19 10:54:42 sandervl Exp $ */
     1/* $Id: os2util.cpp,v 1.4 1999-06-19 13:57:51 sandervl Exp $ */
    22
    33/*
     
    1414#define INCL_BASE
    1515#define INCL_DOSPROCESS
     16#define INCL_DOSSEL
    1617#include <os2wrap.h>    //Odin32 OS/2 api wrappers
    1718#include <string.h>
     
    207208}
    208209
    209 
    210 
    211 
    212210void  OS2Wait(ULONG msec)
    213211{
    214212   DosSleep(msec);
    215213}
     214
     215//******************************************************************************
     216//Wrapper for Dos16AllocSeg
     217//******************************************************************************
     218BOOL OS2AllocSel(ULONG size, USHORT *selector)
     219{
     220   return (Dos16AllocSeg(size, selector, SEG_NONSHARED) == 0);
     221}
     222//******************************************************************************
     223//Wrapper for Dos16FreeSeg
     224//******************************************************************************
     225BOOL OS2FreeSel(USHORT selector)
     226{
     227   return (Dos16FreeSeg(selector) == 0);
     228}
     229//******************************************************************************
     230//Wrapper for Dos32SelToFlat
     231//******************************************************************************
     232PVOID OS2SelToFlat(USHORT selector)
     233{
     234   return (PVOID)DosSelToFlat(selector << 16);
     235}
     236//******************************************************************************
     237//Get TIB data
     238//******************************************************************************
     239ULONG OS2GetTIB(int tiboff)
     240{
     241 PTIB   ptib;
     242 PPIB   ppib;
     243 APIRET rc;
     244
     245   rc = DosGetInfoBlocks(&ptib, &ppib);
     246   if(rc) {
     247        return 0;
     248   }
     249   switch(tiboff)
     250   {
     251        case TIB_STACKTOP:
     252                return (ULONG)ptib->tib_pstack;
     253        case TIB_STACKLOW:
     254                return (ULONG)ptib->tib_pstacklimit;
     255        default:
     256                return 0;
     257   }
     258}
     259//******************************************************************************
     260//Get PIB data
     261//******************************************************************************
     262ULONG OS2GetPIB(int piboff)
     263{
     264 PTIB   ptib;
     265 PPIB   ppib;
     266 APIRET rc;
     267
     268   rc = DosGetInfoBlocks(&ptib, &ppib);
     269   if(rc) {
     270        return 0;
     271   }
     272   switch(piboff)
     273   {
     274        case PIB_TASKHNDL:
     275                return ppib->pib_hmte;
     276        case PIB_TASKTYPE:
     277                if(ppib->pib_ultype == 3) {
     278                        return TASKTYPE_PM;
     279                }
     280                else    return TASKTYPE_VIO;
     281        default:
     282                return 0;
     283   }
     284}
     285//******************************************************************************
     286//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.