Changeset 701


Ignore:
Timestamp:
Sep 12, 2003, 3:16:19 AM (22 years ago)
Author:
bird
Message:

635: Trimmed init a bit. Put private heap in high memory. Init environ and _org_environ in init_dll().

Location:
trunk/src/emx/src/lib
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/lib/dlllegacy.cmd

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r700 r701  
    143143do while (lines(sDefFile) > 0)
    144144    sLine = strip(linein(sDefFile));
     145    iPos = pos(';', sLine);
     146    if (iPos > 0) then
     147        sLine = strip(left(sLine, iPos - 1));
    145148
    146149    /* process the line */
  • trunk/src/emx/src/lib/libc.def

    • Property cvs2svn:cvs-rev changed from 1.15 to 1.16
    r700 r701  
    7272    "___locale_lconv" @52
    7373    "___locale_time" @53
     74    "__sys_virtual_address_limit" @54
    7475
    7576; code
     
    8485    "__init1_fdinit" @108
    8586    "__init1_tmp" @109
    86     "___init_os_version" @110
     87    "___init_environ" @110
    8788    "___init_ret" @111
    8889    "__init_streams" @112
  • trunk/src/emx/src/lib/startup/386/crt0.s

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r700 r701  
    1 /*
    2     Application entry point.
    3 
    4     Copyright (c) 1992-1998 by Eberhard Mattes
    5     Copyright (c) 2003 InnoTek Systemberatung GmbH
    6 
    7     This is the routine that gets control first.
    8     It should prepare argc/argv/envp and call the
    9     main function.
    10 */
     1/* $Id$ */
     2/** @file
     3 *
     4 * Application entry point.
     5 *
     6 * This is the routine that gets control first. It should prepare
     7 * argc/argv/envp and call the main function.
     8 *
     9 *
     10 * Copyright (c) 1992-1998 by Eberhard Mattes
     11 * Copyright (c) 2003 InnoTek Systemberatung GmbH
     12 *
     13 *
     14 * This file is part of Innotek LIBC.
     15 *
     16 * Innotek LIBC is free software; you can redistribute it and/or modify
     17 * it under the terms of the GNU Lesser General Public License as published
     18 * by the Free Software Foundation; either version 2 of the License, or
     19 * (at your option) any later version.
     20 *
     21 * Innotek LIBC is distributed in the hope that it will be useful,
     22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     24 * GNU Lesser General Public License for more details.
     25 *
     26 * You should have received a copy of the GNU Lesser General Public License
     27 * along with Innotek LIBC; if not, write to the Free Software
     28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     29 *
     30 */
    1131
    1232#include <emx/asm386.h>
     
    1939__text:
    2040        call    ___init_app
     41    /* esp points to main() call frame. */
    2142        cld
    22         leal    (%esp), %edi    /* argv[] */
    23         movl    %edi, _STD(environ)
    24         movl    %edi, __org_environ
    25         pushl   %edi            /* envp */
    26         call    L_ptr_tbl
    27         pushl   %edi            /* argv */
    28         call    L_ptr_tbl
    29         pushl   %ecx            /* argc */
    3043#if defined (MCRT0)
    3144        pushl   $__mcleanup
     
    43561:      jmp     1b              /* Just in case exit() returns :-) */
    4457
    45 L_ptr_tbl:
    46         xorl    %eax, %eax
    47         movl    $-1, %ecx
    48 2:      incl    %ecx
    49         scasl
    50         jne     2b
    51         ret
    5258
    5359        .data
  • trunk/src/emx/src/lib/startup/386/dll0.s

    • Property cvs2svn:cvs-rev changed from 1.7 to 1.8
    r700 r701  
    1 /*
    2     Standard entry point for dynamic libraries.
    3 
    4     Copyright (c) 1992-1998 by Eberhard Mattes
    5     Copyright (c) 2003 InnoTek Systemberatung GmbH
    6 
    7     This routine gets control right after dynamic library
    8     is loaded.
    9 */
     1/* $Id$ */
     2/** @file
     3 *
     4 * Standard entry point for dynamic libraries.
     5 * This routine gets control right after dynamic library is loaded.
     6 *
     7 *
     8 * Copyright (c) 1992-1998 by Eberhard Mattes
     9 * Copyright (c) 2003 InnoTek Systemberatung GmbH
     10 *
     11 *
     12 * This file is part of Innotek LIBC.
     13 *
     14 * Innotek LIBC is free software; you can redistribute it and/or modify
     15 * it under the terms of the GNU Lesser General Public License as published
     16 * by the Free Software Foundation; either version 2 of the License, or
     17 * (at your option) any later version.
     18 *
     19 * Innotek LIBC is distributed in the hope that it will be useful,
     20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     22 * GNU Lesser General Public License for more details.
     23 *
     24 * You should have received a copy of the GNU Lesser General Public License
     25 * along with Innotek LIBC; if not, write to the Free Software
     26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     27 *
     28 */
    1029
    1130#include <emx/asm386.h>
     
    1736
    1837__text:
     38/** @todo ___init_dll shouldn't be called, only _DLL_InitTerm. */
    1939        call    ___init_dll
    2040        cld
    2141    jmp     _DLL_InitTerm
    22 /*
    23         pushl   %ebp
    24         movl    %esp, %ebp
    25         pushl   12(%ebp)
    26         pushl   8(%ebp)
    27         call    _DLL_InitTerm
    28         addl    $8, %esp
    29         popl    %ebp
    30         ret
    31 */
    3242
    3343        .data
  • trunk/src/emx/src/lib/startup/startup.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r700 r701  
    1919
    2020static void init_files (void);
     21
    2122
    2223/* Initialize the C run-time library.  This function is called from
     
    111112 *      - dll0.s gets control and calls __init_dll in sys/__initdll.c
    112113 *          - __init_dll calls __init_os_version() to set _osminor,_osmajor globals.
     114 *          - __init_dll initiates _sys_pid and _sys_ppid globals.
    113115 *          - __init_dll creates _sys_heap_fmutex.
    114  *          - __init_dll initiates _sys_pid and _sys_ppid globals.
    115  *          - __init_dll allocates and initiatlized the _sys_private_heap heap, which is
     116 *          - __init_dll allocates and initialized the _sys_private_heap heap, which is
    116117 *            operated by DosSubSetMem() and it's friends.
    117118 *          - __init_dll then initializes _sys_thread_table and calls __newthread() in
    118119 *            sys/__newthread.c to create the thread 1 entry.
     120 *          - __init_dll calls __init_environ() which initializes environ and _org_environ.
    119121 *          - __init_dll then intializes _sys_clock0_ms with the current MS count.
    120122 *      - dll0.s calls _DLL_InitTerm in startup/dllinit.c.
     
    140142 *        the call to __init() in sys/__init.c.
    141143 *          - __init() calls __init_dll() which returns at once because of LIBCxy.DLL init.
    142  *          - __init() parse the environment and commandline to figure out how much stack
    143  *            to use for their arrays and the argument copy.
    144  *          - __init() the allocates the stack space space, adding an exception handler struct.
    145  *          - __init() parse the environment and create the array using allocated stack space.
    146  *          - __init() parse the commandline creating both array and a copy using allocated
    147  *            stack space.
     144 *          - __init() parse the commandline to figure out how much stack to use for array
     145 *            and the argument copy.
     146 *          - __init() the allocates the stack space space, adding an exception handler struct
     147 *            and main() callframe.
     148 *          - __init() parse the commandline creating argv and it's strings using the
     149 *            allocated stack space.
    148150 *          - __init() installs the exception handler.
    149151 *          - __init() set the signal focus.
    150152 *          - __init() then 'returns' thru the hack called ___init_ret in sys/386/appinit.s
    151  *      - crt0.s now get control back with esp pointing to the array of env vars.
    152  *      - crt0.s sets environ and _org_environ.
    153  *      - crt0.s sets up the call frame for main() by skipping it's way thru the env and
    154  *        arg arrays.
     153 *      - crt0.s now gets control back with esp pointing to a complete callframe for main().
    155154 *      - crt0.s calls _CRT_init() in startup/startup.c to initialize the CRT which returns
    156155 *        immediately since since already done during LIBCxy.DLL init.
    157  *      - crt0.s the calls main() with the three arguments setup earlier.
     156 *      - crt0.s the calls main().
    158157 *      - crt0.s then calls exit() with the return value of main().
    159158 *          - exit() will call all the registered at_exit functions.
  • trunk/src/emx/src/lib/sys/__init.c

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r700 r701  
    2525#include "syscalls.h"
    2626
    27 static int arg_size;
     27
     28extern int __init_dll(void);
     29extern void volatile __init_ret(void *stack);
     30static int parse_args(const char *src, char **argv, char *pool);
     31
     32/** argument count found by parse_args(). */
    2833static int argc;
    29 static int envc;
    30 static char **vec;
    31 static char *pool;
    32 
    33 extern void __init_os_version (void);
    34 extern void __init_dll ();
    35 extern void volatile __init_ret (void *stack);
    36 static void parse_args (const char *src);
    37 static void parse_env (char *src);
    38 
     34
     35/** Helper macros for parse args
     36 * @{ */
    3937#define PUTC(c) BEGIN ++arg_size; if (pool != NULL) *pool++ = (c); END
    40 #define PUTV    BEGIN ++argc; if (vec != NULL) *vec++ = pool; END
    41 
     38#define PUTV    BEGIN ++argc; if (argv != NULL) *argv++ = pool; END
    4239#define WHITE(c) ((c) == ' ' || (c) == '\t')
    43 
    44 static void parse_args (const char *src)
    45 {
    46   int bs, quote;
    47   char *flag_ptr;
    48 
    49   argc = 0; arg_size = 0;
    50   /* argv[0] */
    51   PUTC (_ARG_NONZERO);
    52   PUTV;
    53   for (;;)
    54     {
    55       PUTC (*src);
    56       if (*src == 0)
    57         break;
    58       ++src;
    59     }
    60   ++src;
    61   for (;;)
    62     {
    63       while (WHITE (*src))
     40/** @} */
     41
     42
     43/**
     44 * Parses the argument string passed in as src.
     45 *
     46 * @returns size of the processed arguments.
     47 * @param   src     Pointer two sequent zero terminated string containing
     48 *                  the arguments to be parsed.
     49 * @param   pool    Pointer to memory pool to put the arguments into.
     50 *                  NULL allowed.
     51 * @param   argv    Pointer to argument vector to put argument pointers in.
     52 *                  NULL allowed.
     53 * @ingroup startup
     54 */
     55static int parse_args(const char *src, char **argv, char *pool)
     56{
     57    int bs, quote;
     58    char *flag_ptr;
     59    int   arg_size;
     60
     61    argc = 0; arg_size = 0;
     62    /* argv[0] */
     63    PUTC(_ARG_NONZERO);
     64    PUTV;
     65    for (;;)
     66    {
     67        PUTC(*src);
     68        if (*src == 0)
     69            break;
    6470        ++src;
    65       if (*src == 0)
    66         break;
    67       flag_ptr = pool;
    68       PUTC (_ARG_NONZERO);
    69       PUTV;
    70       bs = 0; quote = 0;
    71       for (;;)
    72         {
    73           if (*src == '"')
     71    }
     72    ++src;
     73    for (;;)
     74    {
     75        while (WHITE(*src))
     76            ++src;
     77        if (*src == 0)
     78            break;
     79        flag_ptr = pool;
     80        PUTC(_ARG_NONZERO);
     81        PUTV;
     82        bs = 0; quote = 0;
     83        for (;;)
     84        {
     85            if (*src == '"')
    7486            {
    75               while (bs >= 2)
     87                while (bs >= 2)
    7688                {
    77                   PUTC ('\\');
    78                   bs -= 2;
     89                    PUTC('\\');
     90                    bs -= 2;
    7991                }
    80               if (bs & 1)
    81                 PUTC ('"');
    82               else
     92                if (bs & 1)
     93                    PUTC('"');
     94                else
    8395                {
    84                   quote = !quote;
    85                   if (flag_ptr != NULL)
    86                     *flag_ptr |= _ARG_DQUOTE;
     96                    quote = !quote;
     97                    if (flag_ptr != NULL)
     98                        *flag_ptr |= _ARG_DQUOTE;
    8799                }
    88               bs = 0;
     100                bs = 0;
    89101            }
    90           else if (*src == '\\')
    91             ++bs;
    92           else
     102            else if (*src == '\\')
     103                ++bs;
     104            else
    93105            {
    94               while (bs != 0)
     106                while (bs != 0)
    95107                {
    96                   PUTC ('\\');
    97                   --bs;
     108                    PUTC('\\');
     109                    --bs;
    98110                }
    99               if (*src == 0 || (WHITE (*src) && !quote))
    100                 break;
    101               PUTC (*src);
     111                if (*src == 0 || (WHITE(*src) && !quote))
     112                    break;
     113                PUTC(*src);
    102114            }
    103           ++src;
    104         }
    105       PUTC (0);
    106     }
    107 }
    108 
    109 
    110 static void parse_env (char *src)
    111 {
    112   envc = 0;
    113   while (*src != 0)
    114     {
    115       ++envc;
    116       if (vec != NULL)
    117         *vec++ = src;
    118       while (*src != 0)
    119         ++src;
    120       ++src;
    121     }
    122 }
    123 
    124 
    125 void __init (int is_dll)
    126 {
    127   ULONG rc;
    128   PTIB ptib;
    129   PPIB ppib;
    130   void *stack;
    131   int n;
    132   ULONG times;
    133   static int initialized = 0;
    134 
    135   if (initialized)
    136     return;
    137   initialized = 1;
    138 
    139   /* Do the initialization common for executables and DLLs. */
    140   __init_dll ();
    141 
    142   /* Get ptib and ppib again, in case __init() has already been called
    143      for a DLL. */
    144   rc = DosGetInfoBlocks (&ptib, &ppib);
    145   if (rc != 0)
    146     DosExit (EXIT_PROCESS, 255);
    147 
    148   /* Copy command line arguments and environment. */
    149   vec = NULL; pool = NULL;
    150   parse_env (ppib->pib_pchenv);
    151   parse_args (ppib->pib_pchcmd);
    152   n = arg_size + (argc+1+envc+1) * sizeof (char *);
    153   if (n & 3)
    154     n = (n | 3) + 1;            /* alignment for EXCEPTIONREGISTRATIONRECORD */
    155   stack = alloca (n + sizeof (EXCEPTIONREGISTRATIONRECORD));
    156   _sys_xreg = stack + n;
    157   vec = stack;
    158   pool = (char *)(vec + argc+1+envc+1);
    159   parse_env (ppib->pib_pchenv);
    160   *vec++ = NULL;               /* empty environment */
    161   parse_args (ppib->pib_pchcmd);
    162   *vec++ = NULL;
    163 
    164   /* Initialize exception handling. */
    165   _sys_xreg->prev_structure = (void *)0xffffffff;
    166   _sys_xreg->ExceptionHandler = _sys_exception;
    167   rc = DosSetExceptionHandler (_sys_xreg);
    168   if (rc != 0)
    169     DosExit (EXIT_PROCESS, 255);
    170   /* DosSetSignalExceptionFocus fails for PM programs, error code 303 */
    171   DosSetSignalExceptionFocus (SIG_SETFOCUS, &times);
    172 
    173   /* Return to the program. */
    174   __init_ret (stack);
     115            ++src;
     116        }
     117        PUTC(0);
     118    }
     119    return arg_size;
     120}
     121
     122
     123/**
     124 * Does initialization for thread 1 before main() is called.
     125 *
     126 * This function doesn't return, but leaves it stack frame on the stack by some
     127 * magic done in sys/386/appinit.s. The top of the returned stack have a layout
     128 * as seen in struct stackframe below - start of struct is main() callframe.
     129 * @ingroup startup
     130 */
     131void __init(void)
     132{
     133    /** top of stack unpon 'return' from this function. */
     134    struct stackframe
     135    {
     136        /** Argument count. */
     137        int                           argc;
     138        /** Pointer to argument vector. */
     139        char **                       argv;
     140        /** Pointer to environmet vector. */
     141        char **                       envp;
     142        /** Exception handler registration record (*_sys_xreg). */
     143        EXCEPTIONREGISTRATIONRECORD   ExcpRegReg;
     144        /** Argument vector. */
     145        char *                        apszArg[1];
     146        /** somewhere after this comes the string. */
     147    } * pStackFrame;
     148    ULONG     rc;
     149    PTIB      ptib;
     150    PPIB      ppib;
     151    int       cb;
     152    ULONG     times;
     153
     154    /*
     155     * Do the common initialization in case we're linked statically.
     156     */
     157    if (__init_dll())
     158        goto failure;
     159
     160    /*
     161     * Get ptib and ppib again, in case __init() has already been called for a DLL.
     162     */
     163    /** @todo replace by fast info block code. */
     164    rc = DosGetInfoBlocks(&ptib, &ppib);
     165    if (rc != 0)
     166        goto failure;
     167
     168    /*
     169     * Copy command line arguments.
     170     *    Parse it to figure out the size.
     171     *    Allocate stack frame for args and more.
     172     *    Redo the parsing, but setup argv now.
     173     */
     174    cb = parse_args(ppib->pib_pchcmd, NULL, NULL);
     175    cb += (argc + 1) * sizeof (char *) + sizeof (struct stackframe);
     176    cb = (cb + 15) & ~15;
     177    pStackFrame = alloca(cb);
     178    if (!pStackFrame)
     179        goto failure;
     180
     181    pStackFrame->envp = _org_environ;
     182    pStackFrame->argc = argc;
     183    pStackFrame->argv = &pStackFrame->apszArg[0];
     184    parse_args(ppib->pib_pchcmd, pStackFrame->argv, (char*)&pStackFrame->argv[argc + 1]);
     185    pStackFrame->argv[argc] = NULL;
     186
     187    /*
     188     * Install exception handler.
     189     */
     190    _sys_xreg = &pStackFrame->ExcpRegReg;
     191    _sys_xreg->prev_structure = (void *)0xffffffff;
     192    _sys_xreg->ExceptionHandler = _sys_exception;
     193    rc = DosSetExceptionHandler(_sys_xreg);
     194    if (rc != 0)
     195        goto failure;
     196
     197    /* DosSetSignalExceptionFocus fails for PM programs, error code 303 */
     198    DosSetSignalExceptionFocus(SIG_SETFOCUS, &times);
     199
     200    /* Return to the program. */
     201    __init_ret(pStackFrame);
     202
     203failure:
     204    DosExit(EXIT_PROCESS, 255);
    175205}
    176206
  • trunk/src/emx/src/lib/sys/__initdll.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r700 r701  
    2323#define SYS_PRIVATE_HEAP_SIZE 0x100000
    2424
    25 extern void __init_os_version (void);
     25extern int __init_environ(const char *pszEnv);
     26extern unsigned char _osminor;
     27extern unsigned char _osmajor;
    2628
    27 void __init_dll ()
     29/**
     30 * Common init code for crt0 and dll0.
     31 * This should perhaps be a part of _CRT_init.
     32 */
     33int __init_dll(void)
    2834{
    29   ULONG rc;
    30   PTIB ptib;
    31   PPIB ppib;
    32   int n;
    33   static int initialized = 0;
     35    ULONG   aul[2];
     36    ULONG   rc;
     37    PTIB    ptib;
     38    PPIB    ppib;
     39    int     n;
     40    static int initialized = 0;
    3441
    35   if (initialized)
    36     return;
    37   initialized = 1;
     42    /*
     43     * Only called once.
     44     */
     45    if (initialized)
     46        return 0;
     47    initialized = 1;
    3848
    39   /* Initialize _osmajor and _osminor. */
    40   __init_os_version ();
     49    /*
     50     * Initialize _osmajor and _osminor.
     51     */
     52    DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR, &aul[0], sizeof(aul));
     53    _osminor = (unsigned char)aul[1];
     54    _osmajor = (unsigned char)aul[0];
    4155
    42   /* Initialize the heap.  Here, we only create the semaphore
    43      (while having only one thread).  The heap will be created by
    44      __sbrk(). */
    45   if (_fmutex_create (&_sys_heap_fmutex, 0) != 0)
    46     DosExit (EXIT_PROCESS, 255);
     56    /*
     57     * Check for high memory (>512MB) support.
     58     */
     59    _sys_virtual_address_limit = 0;
     60    if (    !DosQuerySysInfo(QSV_VIRTUALADDRESSLIMIT, QSV_VIRTUALADDRESSLIMIT, &aul[0], sizeof(aul[0]))
     61        &&  aul[0] > 512)
     62        _sys_virtual_address_limit = aul[0] * 1024*1024;
    4763
    48   /* Get the process ID and parent process ID.  This is also
    49      required for (stand-alone) DLLs.  At least, we need ptib and
    50      ppib. */
    51   rc = DosGetInfoBlocks (&ptib, &ppib);
    52   if (rc != 0)
    53     DosExit (EXIT_PROCESS, 255);
    54   _sys_pid = ppib->pib_ulpid;
    55   _sys_ppid = ppib->pib_ulppid;
     64    /*
     65     * Get the process ID and parent process ID.
     66     * This is also required for (stand-alone) DLLs. At least, we need ptib
     67     * and ppib.
     68     */
     69    /** @todo This must be replaced by the fast info block code from Odin/kLib. */
     70    rc = DosGetInfoBlocks(&ptib, &ppib);
     71    if (rc != 0)
     72        return -1;
     73    _sys_pid = ppib->pib_ulpid;
     74    _sys_ppid = ppib->pib_ulppid;
    5675
    57   /* Initialize threads.  This is also required for (stand-alone)
    58      DLLs as these may call _beginthread(). */
    59   rc = DosAllocMem (&_sys_private_heap, SYS_PRIVATE_HEAP_SIZE,
    60                     PAG_READ | PAG_WRITE);
    61   if (rc != 0)
    62     DosExit (EXIT_PROCESS, 255);
    63   rc = DosSubSetMem (_sys_private_heap,
    64                      DOSSUB_INIT | DOSSUB_SPARSE_OBJ | DOSSUB_SERIALIZE,
    65                      SYS_PRIVATE_HEAP_SIZE);
    66   if (rc != 0)
    67     DosExit (EXIT_PROCESS, 255);
    68   for (n = 0; n < MAX_THREADS; ++n)
    69     _sys_thread_table[n] = NULL;
    70   __newthread (ptib->tib_ptib2->tib2_ultid);
     76    /*
     77     * Initialize the heap.  Here, we only create the semaphore
     78     * (while having only one thread).  The heap will be created by __sbrk().
     79     */
     80    if (_fmutex_create(&_sys_heap_fmutex, 0) != 0)
     81        return -1;
    7182
    72   /* Get current time for clock().  We do this also for DLLs. */
    73   _sys_get_clock (&_sys_clock0_ms);
     83    /*
     84     * LIBC Private heap, used for org_environ and per thread data.
     85     * Let's try put it in high memory...
     86     */
     87    rc = DosAllocMem(&_sys_private_heap, SYS_PRIVATE_HEAP_SIZE,
     88                     _sys_virtual_address_limit
     89                        ? PAG_READ | PAG_WRITE | OBJ_ANY
     90                        : PAG_READ | PAG_WRITE);
     91    if (rc != 0)
     92        return -1;
     93    rc = DosSubSetMem(_sys_private_heap,
     94                      DOSSUB_INIT | DOSSUB_SPARSE_OBJ | DOSSUB_SERIALIZE,
     95                      SYS_PRIVATE_HEAP_SIZE);
     96    if (rc != 0)
     97        return -1;
     98
     99    /*
     100     * Initialize thread table and entry for this thread.
     101     */
     102    /** @todo Remove this table, replace it with a pointer backed by TLS memory. */
     103    for (n = 0; n < MAX_THREADS; ++n)
     104        _sys_thread_table[n] = NULL;
     105    __newthread(ptib->tib_ptib2->tib2_ultid);
     106
     107    /*
     108     * Setup environment (org_environ and _STD(environ))
     109     */
     110    rc = __init_environ(ppib->pib_pchenv);
     111    if (rc)
     112        return -1;
     113
     114    /*
     115     * Get current time for clock() for use as process startup time.
     116     */
     117    _sys_get_clock(&_sys_clock0_ms);
     118    return 0;
    74119}
  • trunk/src/emx/src/lib/sys/__os_version.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r700 r701  
    11/* sys/os_ver.c (emx+gcc) -- Copyright (c) 1992-1995 by Eberhard Mattes */
    22
    3 #include "libc-alias.h"
    4 #define INCL_DOSMISC
    5 #include <os2emx.h>
     3unsigned char _osmajor = 0;
     4unsigned char _osminor = 0;
    65
    7 unsigned char _osmajor;
    8 unsigned char _osminor;
    9 
    10 void __init_os_version (void)
    11 {
    12   _osmajor = _osminor = 0;    /* In case DosQuerySysInfo fails... */
    13   DosQuerySysInfo (QSV_VERSION_MAJOR, QSV_VERSION_MAJOR, &_osmajor, sizeof (_osmajor));
    14   DosQuerySysInfo (QSV_VERSION_MINOR, QSV_VERSION_MINOR, &_osminor, sizeof (_osminor));
    15 }
  • trunk/src/emx/src/lib/sys/syscalls.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r700 r701  
    4949EXTERN int _sys_pid;
    5050EXTERN int _sys_ppid;
     51
     52/** Virtual address limit and high memory indicator.
     53 *
     54 * Zero means limit is 512MB.
     55 * Non zero means more that 512MB. The value is then the size of then the user
     56 * address space size in bytes.
     57 *
     58 * Initiated by __init_dll(). */
     59EXTERN unsigned long _sys_virtual_address_limit;
    5160
    5261/* The top heap object.  This points into _sys_heap_objs[] or is NULL.
Note: See TracChangeset for help on using the changeset viewer.