Changeset 758

Show
Ignore:
Timestamp:
07/09/08 15:24:41 (5 months ago)
Author:
mwhitworth
Message:

Add support for passing arguments to kernel threads.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/fs/arch/i386/kernel/process.c

    r587 r758  
    9595                *--currP=(DWORD)argument; 
    9696 
     97        /* The thread returns to the exit code page upon finishing. */ 
    9798        *--currP=exitCode; 
    9899        ret->esp3=(DWORD)currP; 
     
    108109        int i; 
    109110 
    110         /* Allocate the stacks needed */ 
     111        /* Allocate the kernel stack. */ 
    111112        ret->currStack=(DWORD)MemAlloc(ARCH_STACK_SIZE); 
    112         ret->currStack+=ARCH_STACK_SIZE; /* Needs to be shared, can't be in it's own process */ 
     113        ret->currStack+=ARCH_STACK_SIZE; 
    113114        ret->entry=entry; /* eip */ 
    114115 
     
    117118 
    118119        currP=(DWORD*)(ret->currStack); 
     120 
     121        /* Push the given argument on the kernel stack if this is not a user thread. */ 
     122        if (!user) 
     123                if (argument != ((void*)-1)) 
     124                { 
     125                        *--currP=(DWORD)argument; 
     126                        *--currP=0; 
     127                } 
    119128 
    120129        /* Is a kernel thread? */