Fork me on GitHub

root/include/fiwix/kernel.h

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

INCLUDED FROM


   1 /*
   2  * fiwix/include/fiwix/kernel.h
   3  *
   4  * Copyright 2018-2021, Jordi Sanfeliu. All rights reserved.
   5  * Distributed under the terms of the Fiwix License.
   6  */
   7 
   8 #ifndef _FIWIX_KERNEL_H
   9 #define _FIWIX_KERNEL_H
  10 
  11 #include <fiwix/limits.h>
  12 #include <fiwix/i386elf.h>
  13 
  14 #define PANIC(format, args...)                                          \
  15 {                                                                       \
  16         printk("\nPANIC: in %s()", __FUNCTION__);                       \
  17         printk("\n");                                                   \
  18         printk(format, ## args);                                        \
  19         stop_kernel();                                                  \
  20 }
  21 
  22 #define CURRENT_TIME    (kstat.system_time)
  23 #define CURRENT_TICKS   (kstat.ticks)
  24 #define INIT_PROGRAM    "/sbin/init"
  25 
  26 extern char *init_argv[];
  27 extern char *init_envp[];
  28 extern char *init_args;
  29 
  30 extern Elf32_Shdr *symtab, *strtab;
  31 extern unsigned int _last_data_addr;
  32 
  33 extern int _memsize;
  34 extern int _extmemsize;
  35 extern int _rootdev;
  36 extern int _noramdisk;
  37 extern int _ramdisksize;
  38 extern char _rootfstype[10];
  39 extern char _rootdevname[DEVNAME_MAX + 1];
  40 extern char _initrd[DEVNAME_MAX + 1];
  41 extern int _syscondev;
  42 
  43 extern int _cputype;
  44 extern int _cpusignature;
  45 extern int _cpuflags;
  46 extern int _brandid;
  47 extern char _vendorid[12];
  48 extern char _brandstr[48];
  49 extern unsigned int _tlbinfo_eax;
  50 extern unsigned int _tlbinfo_ebx;
  51 extern unsigned int _tlbinfo_ecx;
  52 extern unsigned int _tlbinfo_edx;
  53 extern char _etext[], _edata[], _end[];
  54 
  55 extern char cmdline[NAME_MAX + 1];
  56 
  57 struct kernel_stat {
  58         unsigned int cpu_user;          /* ticks in user-mode */
  59         unsigned int cpu_nice;          /* ticks in user-mode (with priority) */
  60         unsigned int cpu_system;        /* ticks in kernel-mode */
  61         unsigned int irqs;              /* irq counter */
  62         unsigned int sirqs;             /* spurious irq counter */
  63         unsigned int ctxt;              /* context switches */
  64         unsigned int ticks;             /* ticks (1/HZths of sec) since boot */
  65         unsigned int system_time;       /* current system time (since the Epoch) */
  66         unsigned int boot_time;         /* boot time (since the Epoch) */
  67         int tz_minuteswest;             /* minutes west of GMT */
  68         int tz_dsttime;                 /* type of DST correction */
  69         unsigned int uptime;            /* seconds since boot */
  70         unsigned int processes;         /* number of forks since boot */
  71         int physical_pages;             /* physical memory (in pages) */
  72         int kernel_reserved;            /* kernel memory reserved (in KB) */
  73         int physical_reserved;          /* physical memory reserved (in KB) */
  74         int total_mem_pages;            /* total memory (in pages) */
  75         int free_pages;                 /* pages on free list */
  76         int free_inodes;                /* inodes on free list */
  77         int buffers;                    /* memory used by buffers (in KB) */
  78         int cached;                     /* memory used to cache file pages */
  79         int shared;                     /* pages with count > 1 */
  80         int dirty;                      /* dirty buffers (in KB) */
  81         unsigned long int random_seed;  /* next random seed */
  82 };
  83 extern struct kernel_stat kstat;
  84 
  85 unsigned int get_last_boot_addr(unsigned int);
  86 void multiboot(unsigned long, unsigned long);
  87 void start_kernel(unsigned long, unsigned long, unsigned int);
  88 void stop_kernel(void);
  89 void init_init(void);
  90 void cpu_idle(void);
  91 
  92 #endif /* _FIWIX_KERNEL_H */

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