root/arch/i386/kernel/setup.c

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

DEFINITIONS

This source file includes following definitions.
  1. setup_arch

   1 /*
   2  *  linux/arch/i386/kernel/setup.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 #include <linux/tty.h>
  23 
  24 #include <asm/segment.h>
  25 #include <asm/system.h>
  26 
  27 /*
  28  * Tell us the machine setup..
  29  */
  30 char hard_math = 0;             /* set by boot/head.S */
  31 char x86 = 0;                   /* set by boot/head.S to 3 or 4 */
  32 char x86_model = 0;             /* set by boot/head.S */
  33 char x86_mask = 0;              /* set by boot/head.S */
  34 int x86_capability = 0;         /* set by boot/head.S */
  35 int fdiv_bug = 0;               /* set if Pentium(TM) with FP bug */
  36 
  37 char x86_vendor_id[13] = "Unknown";
  38 
  39 char ignore_irq13 = 0;          /* set if exception 16 works */
  40 char wp_works_ok = 0;           /* set if paging hardware honours WP */ 
  41 char hlt_works_ok = 1;          /* set if the "hlt" instruction works */
  42 
  43 /*
  44  * Bus types ..
  45  */
  46 int EISA_bus = 0;
  47 
  48 /*
  49  * Setup options
  50  */
  51 struct drive_info_struct { char dummy[32]; } drive_info;
  52 struct screen_info screen_info;
  53 
  54 unsigned char aux_device_present;
  55 extern int ramdisk_size;
  56 extern int root_mountflags;
  57 extern int etext, edata, end;
  58 
  59 extern char empty_zero_page[PAGE_SIZE];
  60 
  61 /*
  62  * This is set up by the setup-routine at boot-time
  63  */
  64 #define PARAM   empty_zero_page
  65 #define EXT_MEM_K (*(unsigned short *) (PARAM+2))
  66 #define DRIVE_INFO (*(struct drive_info_struct *) (PARAM+0x80))
  67 #define SCREEN_INFO (*(struct screen_info *) (PARAM+0))
  68 #define MOUNT_ROOT_RDONLY (*(unsigned short *) (PARAM+0x1F2))
  69 #define RAMDISK_SIZE (*(unsigned short *) (PARAM+0x1F8))
  70 #define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC))
  71 #define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF))
  72 #define COMMAND_LINE ((char *) (PARAM+2048))
  73 #define COMMAND_LINE_SIZE 256
  74 
  75 static char command_line[COMMAND_LINE_SIZE] = { 0, };
  76 
  77 void setup_arch(char **cmdline_p,
     /* [previous][next][first][last][top][bottom][index][help] */
  78         unsigned long * memory_start_p, unsigned long * memory_end_p)
  79 {
  80         unsigned long memory_start, memory_end;
  81         char c = ' ', *to = command_line, *from = COMMAND_LINE;
  82         int len = 0;
  83 
  84         ROOT_DEV = ORIG_ROOT_DEV;
  85         drive_info = DRIVE_INFO;
  86         screen_info = SCREEN_INFO;
  87         aux_device_present = AUX_DEVICE_INFO;
  88         memory_end = (1<<20) + (EXT_MEM_K<<10);
  89         memory_end &= PAGE_MASK;
  90         ramdisk_size = RAMDISK_SIZE;
  91 #ifdef CONFIG_MAX_16M
  92         if (memory_end > 16*1024*1024)
  93                 memory_end = 16*1024*1024;
  94 #endif
  95         if (MOUNT_ROOT_RDONLY)
  96                 root_mountflags |= MS_RDONLY;
  97         memory_start = (unsigned long) &end;
  98         init_task.mm->start_code = TASK_SIZE;
  99         init_task.mm->end_code = TASK_SIZE + (unsigned long) &etext;
 100         init_task.mm->end_data = TASK_SIZE + (unsigned long) &edata;
 101         init_task.mm->brk = TASK_SIZE + (unsigned long) &end;
 102 
 103         for (;;) {
 104                 if (c == ' ' && *(unsigned long *)from == *(unsigned long *)"mem=") {
 105                         memory_end = simple_strtoul(from+4, &from, 0);
 106                         if ( *from == 'K' || *from == 'k' ) {
 107                                 memory_end = memory_end << 10;
 108                                 from++;
 109                         } else if ( *from == 'M' || *from == 'm' ) {
 110                                 memory_end = memory_end << 20;
 111                                 from++;
 112                         }
 113                 }
 114                 c = *(from++);
 115                 if (!c)
 116                         break;
 117                 if (COMMAND_LINE_SIZE <= ++len)
 118                         break;
 119                 *(to++) = c;
 120         }
 121         *to = '\0';
 122         *cmdline_p = command_line;
 123         *memory_start_p = memory_start;
 124         *memory_end_p = memory_end;
 125 }

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