home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.2 / LINUX-1.2 / LINUX-1 / linux / arch / mips / kernel / setup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-18  |  2.5 KB  |  115 lines

  1. /*
  2.  *  linux/arch/mips/kernel/setup.c
  3.  *
  4.  *  Copyright (C) 1995  Linus Torvalds
  5.  */
  6.  
  7. #include <linux/errno.h>
  8. #include <linux/sched.h>
  9. #include <linux/kernel.h>
  10. #include <linux/mm.h>
  11. #include <linux/stddef.h>
  12. #include <linux/unistd.h>
  13. #include <linux/ptrace.h>
  14. #include <linux/malloc.h>
  15. #include <linux/ldt.h>
  16. #include <linux/user.h>
  17. #include <linux/a.out.h>
  18. #include <linux/tty.h>
  19.  
  20. #include <asm/bootinfo.h>
  21. #include <asm/segment.h>
  22. #include <asm/system.h>
  23.  
  24. /*
  25.  * Tell us the machine setup..
  26.  */
  27. char wait_available;        /* set if the "wait" instruction available */
  28.  
  29. /*
  30.  * Bus types ..
  31.  */
  32. int EISA_bus = 0;
  33.  
  34. /*
  35.  * Setup options
  36.  */
  37. struct drive_info_struct drive_info;
  38. struct screen_info screen_info;
  39.  
  40. unsigned char aux_device_present;
  41. extern int ramdisk_size;
  42. extern int root_mountflags;
  43. extern int end;
  44.  
  45. extern char empty_zero_page[PAGE_SIZE];
  46.  
  47. /*
  48.  * Initialise this structure so that it will be placed in the
  49.  * .data section of the object file
  50.  */
  51. struct bootinfo boot_info = BOOT_INFO;
  52.  
  53. /*
  54.  * This is set up by the setup-routine at boot-time
  55.  */
  56. #define PARAM    empty_zero_page
  57. #define EXT_MEM (boot_info.memupper)
  58. #define DRIVE_INFO (boot_info.drive_info)
  59. #define SCREEN_INFO (screen_info)
  60. #define MOUNT_ROOT_RDONLY (boot_info.mount_root_rdonly)
  61. #define RAMDISK_SIZE (boot_info.ramdisk_size)
  62. #if 0
  63. #define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC))
  64. #define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF))
  65. #endif
  66. #define COMMAND_LINE (boot_info.command_line)
  67.  
  68. static char command_line[CL_SIZE] = { 0, };
  69.  
  70. void setup_arch(char **cmdline_p,
  71.     unsigned long * memory_start_p, unsigned long * memory_end_p)
  72. {
  73.     unsigned long memory_start, memory_end;
  74.     char c = ' ', *to = command_line, *from = COMMAND_LINE;
  75.     int len = 0;
  76.  
  77. #if 0
  78.      ROOT_DEV = ORIG_ROOT_DEV;
  79. #endif
  80.      drive_info = DRIVE_INFO;
  81.      screen_info = SCREEN_INFO;
  82. #if 0
  83.     aux_device_present = AUX_DEVICE_INFO;
  84. #endif
  85.     memory_end = EXT_MEM;
  86.     memory_end &= PAGE_MASK;
  87.     ramdisk_size = RAMDISK_SIZE;
  88.     if (MOUNT_ROOT_RDONLY)
  89.         root_mountflags |= MS_RDONLY;
  90.     memory_start = (unsigned long) &end - KERNELBASE;
  91.  
  92.     for (;;) {
  93.         if (c == ' ' && *(unsigned long *)from == *(unsigned long *)"mem=") {
  94.             memory_end = simple_strtoul(from+4, &from, 0);
  95.             if ( *from == 'K' || *from == 'k' ) {
  96.                 memory_end = memory_end << 10;
  97.                 from++;
  98.             } else if ( *from == 'M' || *from == 'm' ) {
  99.                 memory_end = memory_end << 20;
  100.                 from++;
  101.             }
  102.         }
  103.         c = *(from++);
  104.         if (!c)
  105.             break;
  106.         if (CL_SIZE <= ++len)
  107.             break;
  108.         *(to++) = c;
  109.     }
  110.     *to = '\0';
  111.     *cmdline_p = command_line;
  112.     *memory_start_p = memory_start;
  113.     *memory_end_p = memory_end;
  114. }
  115.