Changeset 1133 for Whitix

Show
Ignore:
Timestamp:
10/14/08 19:37:36 (1 month ago)
Author:
mwhitworth
Message:

Allocate a large stack (32MB, which most apps will never use) to user applications. Fill the top 128KB with arguments.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/keobject/fs/vfs/load.c

    r1079 r1133  
    3434 */ 
    3535 
     36#define NUM_ARG_PAGES           32 
     37#define STACK_SIZE                      32 /* megabytes */ 
     38#define LOAD_STACK_SIZE         STACK_SIZE*1024*1024 
     39 
    3640struct ExecArgs 
    3741{ 
     
    4549        DWORD entryPoint,stackPos; 
    4650        DWORD* stackP; 
    47         DWORD argPages[32]; 
     51        DWORD argPages[NUM_ARG_PAGES]; 
    4852}; 
    4953 
     
    261265 ***********************************************************************/ 
    262266 
    263 #define ARG_MAX_PAGES 32 /* Good number of arguments. */ 
    264  
    265267static int ExecCopyArgs(struct ExecArgs* args) 
    266268{ 
    267269        int argCount; 
    268270         
    269         argCount=ExecCountArgs(args->argv, PAGE_SIZE*ARG_MAX_PAGES); 
     271        argCount=ExecCountArgs(args->argv, PAGE_SIZE*NUM_ARG_PAGES); 
    270272        if (argCount < 0) 
    271273                return argCount; 
     
    336338        execArgs->argc=0; 
    337339 
    338         ZeroMemory(execArgs->argPages, sizeof(DWORD)*32); 
     340        ZeroMemory(execArgs->argPages, sizeof(DWORD)*NUM_ARG_PAGES); 
    339341        execArgs->stackPos=0; 
    340342} 
     
    427429SYMBOL_EXPORT(Exec); 
    428430 
    429 #define ARG_PAGES 30 /* 30 pages is a good enough size for a stack */ 
    430  
    431431static int ExecAllocateStack(struct ExecArgs* args) 
    432432{ 
    433         if (!MMapDo(args->process, NULL, ARCH_STACK_TOP-(ARG_PAGES*PAGE_SIZE), ARG_PAGES*PAGE_SIZE, PAGE_RW | PAGE_PRESENT | PAGE_USER, 0,  
     433        if (!MMapDo(args->process, NULL, ARCH_STACK_TOP - LOAD_STACK_SIZE, 
     434                LOAD_STACK_SIZE, PAGE_RW | PAGE_PRESENT | PAGE_USER, 0,  
    434435                        MMAP_PRIVATE | MMAP_FIXED, NULL)) 
    435436                return -EFAULT;