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

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