root/arch/alpha/kernel/process.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. sys_idle
  2. hard_reset_now
  3. show_regs
  4. exit_thread
  5. flush_thread
  6. copy_thread
  7. dump_thread
  8. sys_execve
  9. sys_fork
  10. sys_clone

   1 /*
   2  *  linux/arch/alpha/kernel/process.c
   3  *
   4  *  Copyright (C) 1995  Linus Torvalds
   5  */
   6 
   7 /*
   8  * This file handles the architecture-dependent parts of process handling..
   9  */
  10 
  11 #include <linux/errno.h>
  12 #include <linux/sched.h>
  13 #include <linux/kernel.h>
  14 #include <linux/mm.h>
  15 #include <linux/stddef.h>
  16 #include <linux/unistd.h>
  17 #include <linux/ptrace.h>
  18 #include <linux/malloc.h>
  19 #include <linux/ldt.h>
  20 #include <linux/user.h>
  21 #include <linux/a.out.h>
  22 
  23 #include <asm/segment.h>
  24 #include <asm/system.h>
  25 #include <asm/io.h>
  26 
  27 asmlinkage int sys_idle(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  28 {
  29         if (current->pid != 0)
  30                 return -EPERM;
  31 
  32         /* endless idle loop with no priority at all */
  33         current->counter = -100;
  34         for (;;) {
  35                 schedule();
  36         }
  37 }
  38 
  39 void hard_reset_now(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  40 {
  41         halt();
  42 }
  43 
  44 void show_regs(struct pt_regs * regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  45 {
  46         printk("\nPS: %04lx PC: %016lx\n", regs->ps, regs->pc);
  47 }
  48 
  49 /*
  50  * Free current thread data structures etc..
  51  */
  52 void exit_thread(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  53 {
  54         halt();
  55 }
  56 
  57 void flush_thread(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  58 {
  59         halt();
  60 }
  61 
  62 /*
  63  * This needs some work still..
  64  */
  65 void copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
     /* [previous][next][first][last][top][bottom][index][help] */
  66         struct task_struct * p, struct pt_regs * regs)
  67 {
  68         struct pt_regs * childregs;
  69 
  70         p->tss.usp = usp;
  71         childregs = ((struct pt_regs *) (p->kernel_stack_page + PAGE_SIZE)) - 1;
  72         *childregs = *regs;
  73         p->tss.ksp = (unsigned long) childregs;
  74 /*      p->tss.pc = XXXX; */
  75         panic("copy_thread not implemented");
  76 }
  77 
  78 /*
  79  * fill in the user structure for a core dump..
  80  */
  81 void dump_thread(struct pt_regs * regs, struct user * dump)
     /* [previous][next][first][last][top][bottom][index][help] */
  82 {
  83 }
  84 
  85 /*
  86  * sys_execve() executes a new program.
  87  *
  88  * This works due to the alpha calling sequence: the first 6 args
  89  * are gotten from registers, while the rest is on the stack, so
  90  * we get a0-a5 for free, and then magically find "struct pt_regs"
  91  * on the stack for us..
  92  *
  93  * Don't do this at home.
  94  */
  95 asmlinkage int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
     /* [previous][next][first][last][top][bottom][index][help] */
  96         unsigned long a3, unsigned long a4, unsigned long a5,
  97         struct pt_regs regs)
  98 {
  99         int error;
 100         char * filename;
 101 
 102         error = getname((char *) a0, &filename);
 103         if (error)
 104                 return error;
 105         error = do_execve(filename, (char **) a1, (char **) a2, &regs);
 106         putname(filename);
 107         return error;
 108 }
 109 
 110 /*
 111  * sys_fork() does the obvious thing, but not the obvious way.
 112  * See sys_execve() above.
 113  */
 114 asmlinkage int sys_fork(unsigned long a0, unsigned long a1, unsigned long a2,
     /* [previous][next][first][last][top][bottom][index][help] */
 115         unsigned long a3, unsigned long a4, unsigned long a5,
 116         struct pt_regs regs)
 117 {
 118         return do_fork(COPYVM | SIGCHLD, rdusp(), &regs);
 119 }
 120 
 121 asmlinkage int sys_clone(unsigned long a0, unsigned long a1, unsigned long a2,
     /* [previous][next][first][last][top][bottom][index][help] */
 122         unsigned long a3, unsigned long a4, unsigned long a5,
 123         struct pt_regs regs)
 124 {
 125         unsigned long clone_flags = a0;
 126         unsigned long newsp;
 127 
 128         newsp = rdusp();
 129         if (newsp == a1 || !a1)
 130                 clone_flags |= COPYVM;
 131         else
 132                 newsp = a1;     
 133         return do_fork(clone_flags, newsp, &regs);
 134 }

/* [previous][next][first][last][top][bottom][index][help] */