Main Page | Directories | File List | Globals

thread.c File Reference

#include <agnix/agnix.h>
#include <asm/tss.h>
#include <agnix/tasks.h>
#include <agnix/list.h>
#include <agnix/console.h>
#include <agnix/spinlock.h>
#include <agnix/panic.h>
#include <agnix/errno.h>
#include <agnix/unistd.h>
#include <agnix/linkage.h>

Include dependency graph for thread.c:

Go to the source code of this file.

Defines

#define MOD_NAME   "THREAD: "

Functions

int create_kernel_thread (const char *name, void(*thread_proc)(void *), void *data)
int create_user_thread (const char *name, void(*thread_proc)(void *data), void *data)
int threads_init (void)


Define Documentation

#define MOD_NAME   "THREAD: "
 

Definition at line 30 of file thread.c.


Function Documentation

int create_kernel_thread const char *  name,
void(*)(void *)  thread_proc,
void *  data
 

Definition at line 32 of file thread.c.

References __asm__(), and kernel_panic().

Referenced by agnix_console_start(), apm_init(), and fastirq_init().

00033 {
00034     __asm__ __volatile__ (
00035         "movl %%esp, %%esi\n\t"
00036         "int $0x80\n\t"
00037         "cmpl %%esp, %%esi\n\t"
00038         "je 1f\n\t"
00039 
00040         "pushl %%edi\n\t"
00041         "call *%2\n\t"
00042         "1:"
00043     :
00044     :"a"(__NR_fork), "b"(name), "r"(thread_proc), "D"((u32)data)
00045     );
00046 
00047     if (current_task->t_pid)
00048         kernel_panic("Kernel thread terminated...\n");
00049 
00050     return 0;
00051 }

Here is the call graph for this function:

int create_user_thread const char *  name,
void(*)(void *data)  thread_proc,
void *  data
 

Definition at line 53 of file thread.c.

References kernel_panic(), and MOD_NAME.

00054 {
00055     fork();
00056     
00057     if (current_task->t_pid > 0) {
00058 //      task_set_user_mode(&(current_thread->tss_wrap->tss), 
00059         (*thread_proc)(data);
00060     } else 
00061     if (current_task->t_pid < 0) {
00062         kernel_panic(MOD_NAME "I can not create kernel thread\n");
00063     }
00064     
00065     return 0;
00066 }

Here is the call graph for this function:

int threads_init void   ) 
 

Definition at line 68 of file thread.c.

00069 {
00070     return 0;
00071 }

Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix