summaryrefslogtreecommitdiff
path: root/kernel/kernel.h
blob: e5c75f88064a9eeb2098907ec998765ad2eef234 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
 *  @file
 *  F00l 0S

REFERENCES
==========

    http://www.brokenthorn.com/Resources/OSDev17.html
    http://www.jamesmolloy.co.uk/tutorial_html/9.-Multitasking.html
    http://pdos.csail.mit.edu/6.828/2011/labs/lab6/
    http://pdos.csail.mit.edu/6.828/2011/xv6.html
    http://www.nongnu.org/ext2-doc/
    http://www.osdever.net/tutorials/view/multiprocessing-support-for-hobby-oses-explained
    http://forum.osdev.org/viewtopic.php?f=1&t=10944
    http://wiki.osdev.org/Virtual_8086_Mode
    http://wiki.xomb.org/index.php?title=ACPI_Tables
    http://wiki.osdev.org/Hosted_GCC_Cross-Compiler
    https://sourceware.org/newlib/
    and many many more...
*/
#include "log.h"

#ifndef FOOLOS_CONFIG_H
#define FOOLOS_CONFIG_H

#define BIN_INIT "/bin/init"
//#define FOOLOS_LOG_OFF
#define FOOLOS_LOG_COLOR true

#define FIFO_MAX_RINGBUFFERS 20
#define MAX_FIFOS 20
#define MAX_FD 20
#define MAX_TASKS 10
#define MEM_PRINT_MEMORYMAP

#define KMALLOC_MEM_SIZE  1024*1024*8  // 8MB for in kernel-memory
#define NUMBER_SPINLOCKS 16
#define SPINLOCK_LOG 0
#define SPINLOCK_ALLOC 1

#define S1(x) #x
#define S2(x) S1(x)

#define SMP_MAX_PROC 16 // 16 (together with bsp) We can currently only address a maximum of 16 cpus via ipis! 

// Virtual Memory Locations //
// NOTE THAT THE STACKS GROWN DOWNWARDS //
#define VMEM_KERNEL          0x00000000 // 8192 pages (32megs) / identity mapped

#define VMEM_USER_ENV        0x07000000 // 4    pages          / per user process 
#define VMEM_USER_PROG       0x08000000 // ?    pages          / per user process (usual entry: 0x8048080)
#define VMEM_USER_STACK_TOP  0xE0000000 // ?    pages          / per thread 

#define VMEM_LAPIC           0xE0000000 // 1    pages          / identity mapped
#define VMEM_IOAPIC          0xE0001000 // 1    pages          / identity mapped
#define VMEM_CPU_PRIVATE     0xE0002000 // 4    pages          / per cpu
#define VMEM_CPU_STACK_TOP   0xE000A000 // 4    pages          / per cpu 
#define VMEM_FRAMEBUFFER     0xF0000000 // 8192 pages (32megs) / identity mapped 
#define VMEM_EXT2_RAMIMAGE   0xF2000000 // 8192 pages (32megs) / identity mapped

// __FUNCTION__ ?
#ifndef FOOLOS_LOG_OFF
#define kpanic(...) {log(FOOLOS_LOG_COLOR,__FILE__,0," \033[41;37m [KERNEL PANIC] \033[37;40m " __VA_ARGS__ ); while(1);}
#define klog(...) log(FOOLOS_LOG_COLOR,__FILE__ ":" S2(__LINE__), 10,  __VA_ARGS__)
#define fixme(...) log(FOOLOS_LOG_COLOR,__FILE__ ":" S2(__LINE__) "[FIXME/TODO]:" , 10, __VA_ARGS__)
#endif

#ifdef FOOLOS_LOG_OFF
#define kpanic(...) {while(1);}
#define klog(...) {}
#define fixme(...) {}
#endif

#endif