Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

i386/kernel/process.c File Reference

#include <stdarg.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/ptrace.h>
#include <linux/malloc.h>
#include <linux/vmalloc.h>
#include <linux/user.h>
#include <linux/a.out.h>
#include <linux/interrupt.h>
#include <linux/config.h>
#include <linux/delay.h>
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/mc146818rtc.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/ldt.h>
#include <asm/processor.h>
#include <asm/desc.h>
#include "irq.h"

Include dependency graph for i386/kernel/process.c:

Go to the source code of this file.

Defines

#define __KERNEL_SYSCALLS__
#define HARD_IDLE_TIMEOUT   (HZ / 3)
#define EXTRA_TASK_STRUCT   16
#define savesegment(seg, value)   asm volatile("movl %%" #seg ",%0":"=m" (*(int *)&(value)))
#define loaddebug(tsk, register)

Functions

asmlinkage void ret_from_fork (void)
void enable_hlt (void)
static int cpu_idle (void *unused)
asmlinkage int sys_idle (void)
 __initfunc (void reboot_setup(char *str, int *ints))
static void kb_wait (void)
void machine_real_restart (unsigned char *code, int length)
void machine_restart (char *__unused)
void machine_halt (void)
void machine_power_off (void)
void show_regs (struct pt_regs *regs)
task_struct * alloc_task_struct (void)
void free_task_struct (struct task_struct *p)
void release_segments (struct mm_struct *mm)
void forget_segments (void)
int kernel_thread (int(*fn)(void *), void *arg, unsigned long flags)
void exit_thread (void)
void flush_thread (void)
void release_thread (struct task_struct *dead_task)
void copy_segments (int nr, struct task_struct *p, struct mm_struct *new_mm)
int copy_thread (int nr, unsigned long clone_flags, unsigned long esp, struct task_struct *p, struct pt_regs *regs)
int dump_fpu (struct pt_regs *regs, struct user_i387_struct *fpu)
void dump_thread (struct pt_regs *regs, struct user *dump)
void __switch_to (struct task_struct *prev, struct task_struct *next)
asmlinkage int sys_fork (struct pt_regs regs)
asmlinkage int sys_clone (struct pt_regs regs)
asmlinkage int sys_vfork (struct pt_regs regs)
asmlinkage int sys_execve (struct pt_regs regs)

Variables

spinlock_t semaphore_wake_lock = SPIN_LOCK_UNLOCKED
static long no_idt [2] = {0, 0}
static int reboot_mode = 0
static int reboot_thru_bios = 0
static unsigned long long real_mode_gdt_entries [3]
struct {
unsigned short size __attribute__ ((packed))
unsigned long long *base __attribute__ ((packed))
real_mode_gdt
struct {
unsigned short size __attribute__ ((packed))
unsigned long long *base __attribute__ ((packed))
real_mode_idt
static unsigned char real_mode_switch []
static unsigned char jump_to_bios []
static struct task_struct * task_struct_stack [EXTRA_TASK_STRUCT]
static int task_struct_stack_ptr = -1


Define Documentation

#define __KERNEL_SYSCALLS__
 

Definition at line 11 of file i386/kernel/process.c.

#define EXTRA_TASK_STRUCT   16
 

Definition at line 428 of file i386/kernel/process.c.

Referenced by alloc_task_struct(), and free_task_struct().

#define HARD_IDLE_TIMEOUT   (HZ / 3)
 

Referenced by cpu_idle().

#define loaddebug tsk,
register   ) 
 

Value:

__asm__("movl %0,%%db" #register  \
                        : /* no output */ \
                        :"r" (tsk->tss.debugreg[register]))

Definition at line 679 of file i386/kernel/process.c.

Referenced by __switch_to().

#define savesegment seg,
value   )     asm volatile("movl %%" #seg ",%0":"=m" (*(int *)&(value)))
 

Definition at line 580 of file i386/kernel/process.c.


Function Documentation

__initfunc void   reboot_setup(char *str, int *ints)  ) 
 

Definition at line 155 of file i386/kernel/process.c.

References NULL, and strchr.

void __switch_to struct task_struct *  prev,
struct task_struct *  next
 

Definition at line 708 of file i386/kernel/process.c.

References desc_struct::b, fs, gdt_table, gs, loaddebug, and unlazy_fpu.

struct task_struct* alloc_task_struct void   ) 
 

Definition at line 433 of file i386/kernel/process.c.

References __get_free_pages(), EXTRA_TASK_STRUCT, index, KERNEL_STACK_SIZE, ll_alloc_task_struct, memzero, p, and ret.

Here is the call graph for this function:

void copy_segments int  nr,
struct task_struct *  p,
struct mm_struct *  new_mm
 

Definition at line 554 of file i386/kernel/process.c.

References _LDT, current, KERN_WARNING, LDT_ENTRIES, LDT_ENTRY_SIZE, memcpy, printk, set_ldt_desc(), and vmalloc().

Here is the call graph for this function:

int copy_thread int  nr,
unsigned long  clone_flags,
unsigned long  esp,
struct task_struct *  p,
struct pt_regs regs
 

Definition at line 583 of file i386/kernel/process.c.

References __KERNEL_DS, _TSS, current, pt_regs::eax, pt_regs::esp, fs, gs, long, PAGE_SIZE, ret_from_fork, savesegment, set_tss_desc(), and unlazy_fpu.

Here is the call graph for this function:

static int cpu_idle void *  unused  )  [static]
 

Definition at line 82 of file i386/kernel/process.c.

References __asm__(), acpi_idle, boot_cpu_data, check_pgt_cache(), current, HARD_IDLE_TIMEOUT, cpuinfo_x86::hlt_works_ok, jiffies, and schedule().

Here is the call graph for this function:

int dump_fpu struct pt_regs regs,
struct user_i387_struct fpu
 

Definition at line 620 of file i386/kernel/process.c.

References current, memcpy, and unlazy_fpu.

void dump_thread struct pt_regs regs,
struct user dump
 

Definition at line 637 of file i386/kernel/process.c.

References CMAGIC, current, dump_fpu(), pt_regs::eax, pt_regs::ebp, pt_regs::ebx, pt_regs::ecx, pt_regs::edi, pt_regs::edx, pt_regs::eflags, pt_regs::eip, pt_regs::esi, pt_regs::esp, fs, gs, i, user::i387, long, user::magic, pt_regs::orig_eax, PAGE_SHIFT, PAGE_SIZE, user::regs, savesegment, user::start_code, user::start_stack, TASK_SIZE, user::u_debugreg, user::u_dsize, user::u_fpvalid, user::u_ssize, user::u_tsize, pt_regs::xcs, pt_regs::xds, pt_regs::xes, and pt_regs::xss.

Here is the call graph for this function:

void enable_hlt void   ) 
 

Definition at line 72 of file i386/kernel/process.c.

void exit_thread void   ) 
 

Definition at line 525 of file i386/kernel/process.c.

void flush_thread void   ) 
 

Definition at line 530 of file i386/kernel/process.c.

References clear_fpu, current, and i.

void forget_segments void   ) 
 

Definition at line 479 of file i386/kernel/process.c.

References __asm__(), _LDT, current, and load_ldt.

Here is the call graph for this function:

void free_task_struct struct task_struct *  p  ) 
 

Definition at line 457 of file i386/kernel/process.c.

References EXTRA_TASK_STRUCT, free_pages(), index, and ll_free_task_struct.

Here is the call graph for this function:

static void kb_wait void   )  [inline, static]
 

Definition at line 241 of file i386/kernel/process.c.

References i, inb_p, x02, x10000, and x64.

Referenced by handle_mouse_event(), jazz_machine_restart(), kbd_write_command_w(), kbd_write_output_w(), machine_restart(), send_data(), and sni_machine_restart().

int kernel_thread int(*)(void *)  fn,
void *  arg,
unsigned long  flags
 

Definition at line 496 of file i386/kernel/process.c.

References __asm__(), __NR_clone, __NR_exit, CLONE_VM, and d0.

Here is the call graph for this function:

void machine_halt void   ) 
 

Definition at line 374 of file i386/kernel/process.c.

void machine_power_off void   ) 
 

Definition at line 378 of file i386/kernel/process.c.

References acpi_power_off.

void machine_real_restart unsigned char *  code,
int  length
 

Definition at line 255 of file i386/kernel/process.c.

References __asm__(), _PAGE_PRESENT, _PAGE_RW, cli, CMOS_WRITE, current, KERNEL_PGD_PTRS, memcpy, pg0, real_mode_gdt, rtc_lock, SET_PAGE_DIR, spin_lock_irqsave, spin_unlock_irqrestore, swapper_pg_dir, USER_PGD_PTRS, x00, and x1000.

Referenced by apm_power_off(), and machine_restart().

Here is the call graph for this function:

void machine_restart char *  __unused  ) 
 

Definition at line 345 of file i386/kernel/process.c.

References __asm__(), __va, i, init_pic_mode(), kb_wait(), machine_real_restart(), outb, udelay, and x64.

Here is the call graph for this function:

void release_segments struct mm_struct *  mm  ) 
 

Definition at line 470 of file i386/kernel/process.c.

References NULL, and vfree().

Here is the call graph for this function:

void release_thread struct task_struct *  dead_task  ) 
 

Definition at line 545 of file i386/kernel/process.c.

References release_x86_irqs().

Here is the call graph for this function:

asmlinkage void ret_from_fork void   ) 
 

Definition at line 51 of file i386/kernel/process.c.

void show_regs struct pt_regs regs  ) 
 

Definition at line 385 of file i386/kernel/process.c.

References __asm__(), cr0, pt_regs::eax, pt_regs::ebp, pt_regs::ebx, pt_regs::ecx, pt_regs::edi, pt_regs::edx, pt_regs::eflags, pt_regs::eip, pt_regs::esi, pt_regs::esp, L, printk, pt_regs::xcs, pt_regs::xds, pt_regs::xes, xffff, and pt_regs::xss.

Here is the call graph for this function:

asmlinkage int sys_clone struct pt_regs  regs  ) 
 

Definition at line 770 of file i386/kernel/process.c.

References do_fork(), pt_regs::ebx, pt_regs::ecx, and pt_regs::esp.

Here is the call graph for this function:

asmlinkage int sys_execve struct pt_regs  regs  ) 
 

Definition at line 800 of file i386/kernel/process.c.

References current, do_execve(), pt_regs::ebx, pt_regs::ecx, pt_regs::edx, error, filename, getname(), lock_kernel, out, and unlock_kernel.

Here is the call graph for this function:

asmlinkage int sys_fork struct pt_regs  regs  ) 
 

Definition at line 765 of file i386/kernel/process.c.

References do_fork(), pt_regs::esp, and SIGCHLD.

Here is the call graph for this function:

asmlinkage int sys_idle void   ) 
 

Definition at line 137 of file i386/kernel/process.c.

References cpu_idle(), current, EPERM, and NULL.

Here is the call graph for this function:

asmlinkage int sys_vfork struct pt_regs  regs  ) 
 

Definition at line 792 of file i386/kernel/process.c.

References CLONE_VFORK, CLONE_VM, do_fork(), pt_regs::esp, and SIGCHLD.

Here is the call graph for this function:


Variable Documentation

unsigned char jump_to_bios[] [static]
 

Initial value:

{
        0xea, 0x00, 0x00, 0xff, 0xff            
}

Definition at line 236 of file i386/kernel/process.c.

long no_idt[2] = {0, 0} [static]
 

Definition at line 151 of file i386/kernel/process.c.

struct { ... } real_mode_gdt [static]
 

Referenced by machine_real_restart().

unsigned long long real_mode_gdt_entries[3] [static]
 

Initial value:

{
        0x0000000000000000ULL,  
        0x00009a000000ffffULL,  
        0x000092000100ffffULL   
}

Definition at line 188 of file i386/kernel/process.c.

struct { ... } real_mode_idt [static]
 

unsigned char real_mode_switch[] [static]
 

Initial value:

{
        0x66, 0x0f, 0x20, 0xc0,                 
        0x66, 0x83, 0xe0, 0x11,                 
        0x66, 0x0d, 0x00, 0x00, 0x00, 0x60,     
        0x66, 0x0f, 0x22, 0xc0,                 
        0x66, 0x0f, 0x22, 0xd8,                 
        0x66, 0x0f, 0x20, 0xc3,                 
        0x66, 0x81, 0xe3, 0x00, 0x00, 0x00, 0x60,       
        0x74, 0x02,                             
        0x0f, 0x08,                             
        0x24, 0x10,                             
        0x66, 0x0f, 0x22, 0xc0                  
}

Definition at line 222 of file i386/kernel/process.c.

int reboot_mode = 0 [static]
 

Definition at line 152 of file i386/kernel/process.c.

int reboot_thru_bios = 0 [static]
 

Definition at line 153 of file i386/kernel/process.c.

spinlock_t semaphore_wake_lock = SPIN_LOCK_UNLOCKED
 

Definition at line 49 of file i386/kernel/process.c.

Referenced by wake_one_more(), waking_non_zero(), waking_non_zero_interruptible(), and waking_non_zero_trylock().

struct task_struct* task_struct_stack[EXTRA_TASK_STRUCT] [static]
 

Definition at line 429 of file i386/kernel/process.c.

int task_struct_stack_ptr = -1 [static]
 

Definition at line 430 of file i386/kernel/process.c.