Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


(no commit message)
[palacios.git] / palacios / include / geekos / defs.h
1 /*
2  * Misc. kernel definitions
3  * Copyright (c) 2001,2004 David H. Hovemeyer <daveho@cs.umd.edu>
4  * $Revision: 1.1.1.1 $
5  * 
6  * This is free software.  You are permitted to use,
7  * redistribute, and modify it as specified in the file "COPYING".
8  */
9
10 #ifndef GEEKOS_DEFS_H
11 #define GEEKOS_DEFS_H
12
13
14
15
16 /*
17  * Kernel code and data segment selectors.
18  * Keep these up to date with defs.asm.
19  */
20 #define KERNEL_CS  (1<<3)
21 #define KERNEL_DS  (2<<3)
22
23
24 /*
25  * Address where kernel is loaded INITIALLY
26  * we move it up in memory soon
27  */
28 #define KERNEL_START_ADDR 0x10000
29
30 /*
31  * Kernel and user privilege levels
32  */
33 #define KERNEL_PRIVILEGE 0
34 #define USER_PRIVILEGE 3
35
36
37 /*
38  * Software interrupt for syscalls
39  */
40 #define SYSCALL_INT 0x90
41
42 /*
43  * The windows versions of gcc use slightly different
44  * names for the bss begin and end symbols than the Linux version.
45  */
46 #if defined(GNU_WIN32)
47 #  define BSS_START _bss_start__
48 #  define BSS_END _bss_end__
49 #else
50 #  define BSS_START __bss_start
51 #  define BSS_END end
52 #endif
53
54 /*
55  * x86 has 4096 byte pages
56  */
57 #define PAGE_POWER 12
58 #define PAGE_SIZE (1<<PAGE_POWER)
59 #define PAGE_MASK (~(0xffffffff << PAGE_POWER))
60
61
62
63 /* Ultimate Memory Layout
64
65 TOP_OF_MEM:    
66         GDT (one page)
67         TSS (one page)
68         IDT (one page)
69         KernelImage
70           VMBootPackage
71              rombios (2nd copy)
72              vmxassist
73              vgabios
74              rombios (1st copy)
75         PageList           (varies - must be an integral number of pages)
76         KernelHeap         (varies - KERNEL_HEAP_SIZE; must be integral number of pages)
77         KernelStack        (one page)
78         KernelThreadObject (one page)
79 0+VM_SIZE:
80         VM (including ISA hole)          
81         (KernelImage, GDT, and IDT start down here and are moved up)
82         (VMBoot Package is copied down to the first MB to start the VM boot)
83         (VMXAssist is used to provide real mode emulation for initial VM boot steps)
84 0:      
85 */
86
87 // This is for a 1 GB Machine
88 // The last address (+1) at which physical memory ends
89 #define TOP_OF_MEM (0x40000000)
90 // How much space to reserve for the VM
91 #define VM_SIZE    (0x20000000)
92 // Where the VM starts in physical memory
93 #define START_OF_VM (0x0)
94
95
96
97 #define GDT_SIZE PAGE_SIZE
98 #define TSS_SIZE PAGE_SIZE
99 #define IDT_SIZE PAGE_SIZE
100 #define KERNEL_HEAP_SIZE (256*PAGE_SIZE)
101 #define KERNEL_STACK_SIZE PAGE_SIZE
102 #define KERNEL_THREAD_OBJECT_SIZE PAGE_SIZE
103
104
105
106
107 /*
108  *  * Keep these up to date with defs.asm.
109  */
110 #define GDT_LOCATION          (TOP_OF_MEM-GDT_SIZE)
111 #define TSS_LOCATION          (GDT_LOCATION-TSS_SIZE)
112 #define IDT_LOCATION          (TSS_LOCATION-IDT_SIZE)
113
114
115 #define FINAL_KERNEL_START    (IDT_LOCATION-MAX_VMM)
116 #define FINAL_KERNEL_END      (FINAL_KERNEL_START+KERNEL_CORE_LENGTH-1)
117 #define FINAL_BIOS_START      (FINAL_KERNEL_START+KERNEL_CORE_LENGTH)
118 #define FINAL_BIOS_END        (FINAL_BIOS_START+BIOS_LENGTH-1)
119 #define FINAL_VGA_BIOS_START  (FINAL_BIOS_START+BIOS_LENGTH)
120 #define FINAL_VGA_BIOS_END    (FINAL_VGA_BIOS_START+VGA_BIOS_LENGTH-1)
121 #define FINAL_VMXASSIST_START (FINAL_VGA_BIOS_START+VGA_BIOS_LENGTH)
122 #define FINAL_VMXASSIST_END   (FINAL_VMXASSIST_START+VMXASSIST_LENGTH-1)
123 #define FINAL_BIOS2_START     (FINAL_VMXASSIST_START+VMXASSIST_LENGTH)
124 #define FINAL_BIOS2_END       (FINAL_BIOS2_START+BIOS_LENGTH-1)
125 #define FINAL_VMBOOTSTART     (FINAL_BIOS_START)
126 #define FINAL_VMBOOTEND       (FINAL_BIOS2_END)
127
128 #if (FINAL_VMBOOTEND>IDT_LOCATION)
129 #error VMM_MAX is too small!
130 #endif
131
132
133 #define KERNEL_THREAD_OBJECT  (START_OF_VM+VM_SIZE)
134 #define KERNEL_STACK          (KERNEL_THREAD_OBJECT+KERNEL_THREAD_OBJECT_SIZE)
135 #define KERNEL_HEAP           (KERNEL_STACK+KERNEL_STACK_SIZE)
136 #define KERNEL_PAGELIST       (KERNEL_HEAP+KERNEL_HEAP_SIZE)
137
138
139 /*
140  * PC memory map
141  */
142 #define ISA_HOLE_START 0x0A0000
143 #define ISA_HOLE_END   0x100000
144
145
146 #endif  /* GEEKOS_DEFS_H */