Changeset f56e897f in mainline for kernel/arch/amd64/include
- Timestamp:
- 2010-06-29T17:43:38Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6473d41
- Parents:
- e4a4b44 (diff), 793cf029 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- kernel/arch/amd64/include
- Files:
-
- 12 edited
-
arch.h (modified) (1 diff)
-
boot/boot.h (modified) (2 diffs)
-
context.h (modified) (1 diff)
-
elf.h (modified) (2 diffs)
-
faddr.h (modified) (2 diffs)
-
interrupt.h (modified) (1 diff)
-
mm/as.h (modified) (2 diffs)
-
mm/page.h (modified) (5 diffs)
-
mm/ptl.h (modified) (2 diffs)
-
mm/tlb.h (modified) (1 diff)
-
pm.h (modified) (1 diff)
-
proc/thread.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/arch.h
re4a4b44 rf56e897f 27 27 */ 28 28 29 /** @addtogroup amd64 29 /** @addtogroup amd64 30 30 * @{ 31 31 */ -
kernel/arch/amd64/include/boot/boot.h
re4a4b44 rf56e897f 27 27 */ 28 28 29 /** @addtogroup amd64 29 /** @addtogroup amd64 30 30 * @{ 31 31 */ … … 36 36 #define KERN_amd64_BOOT_H_ 37 37 38 #define BOOT_OFFSET 0x10800039 #define AP_BOOT_OFFSET 0x800040 #define BOOT_STACK_SIZE 0x40038 #define BOOT_OFFSET 0x108000 39 #define AP_BOOT_OFFSET 0x008000 40 #define BOOT_STACK_SIZE 0x000400 41 41 42 #define MULTIBOOT_HEADER_MAGIC 0x1BADB00243 #define MULTIBOOT_HEADER_FLAGS 0x0001000342 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 43 #define MULTIBOOT_HEADER_FLAGS 0x00010003 44 44 45 45 #ifndef __ASM__ -
kernel/arch/amd64/include/context.h
re4a4b44 rf56e897f 59 59 */ 60 60 typedef struct { 61 uintptr_t sp;62 uintptr_t pc;63 64 uint64_t rbx;65 uint64_t rbp;66 67 uint64_t r12;68 uint64_t r13;69 uint64_t r14;70 uint64_t r15;71 72 ipl_t ipl;61 uintptr_t sp; 62 uintptr_t pc; 63 64 uint64_t rbx; 65 uint64_t rbp; 66 67 uint64_t r12; 68 uint64_t r13; 69 uint64_t r14; 70 uint64_t r15; 71 72 ipl_t ipl; 73 73 } __attribute__ ((packed)) context_t; 74 74 -
kernel/arch/amd64/include/elf.h
re4a4b44 rf56e897f 27 27 */ 28 28 29 /** @addtogroup amd64 29 /** @addtogroup amd64 30 30 * @{ 31 31 */ … … 36 36 #define KERN_amd64_ELF_H_ 37 37 38 #define ELF_MACHINEEM_X86_6439 #define ELF_DATA_ENCODING ELFDATA2LSB40 #define ELF_CLASS ELFCLASS6438 #define ELF_MACHINE EM_X86_64 39 #define ELF_DATA_ENCODING ELFDATA2LSB 40 #define ELF_CLASS ELFCLASS64 41 41 42 42 #endif -
kernel/arch/amd64/include/faddr.h
re4a4b44 rf56e897f 27 27 */ 28 28 29 /** @addtogroup amd64 29 /** @addtogroup amd64 30 30 * @{ 31 31 */ … … 38 38 #include <typedefs.h> 39 39 40 #define FADDR(fptr) ((uintptr_t) (fptr))40 #define FADDR(fptr) ((uintptr_t) (fptr)) 41 41 42 42 #endif -
kernel/arch/amd64/include/interrupt.h
re4a4b44 rf56e897f 116 116 extern void trap_virtual_disable_irqs(uint16_t irqmask); 117 117 118 /* AMD64 - specific page handler */119 extern void ident_page_fault(unsigned int, istate_t *);120 121 118 #endif 122 119 -
kernel/arch/amd64/include/mm/as.h
re4a4b44 rf56e897f 27 27 */ 28 28 29 /** @addtogroup amd64mm 29 /** @addtogroup amd64mm 30 30 * @{ 31 31 */ … … 36 36 #define KERN_amd64_AS_H_ 37 37 38 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH 038 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH 0 39 39 40 #define KERNEL_ADDRESS_SPACE_START_ARCH (unsigned long) 0xffff800000000000 41 #define KERNEL_ADDRESS_SPACE_END_ARCH (unsigned long) 0xffffffff80000000 42 #define USER_ADDRESS_SPACE_START_ARCH (unsigned long) 0x0000000000000000 43 #define USER_ADDRESS_SPACE_END_ARCH (unsigned long) 0x00007fffffffffff 40 #define KERNEL_ADDRESS_SPACE_START_ARCH (unsigned long) 0xffff800000000000 41 #define KERNEL_ADDRESS_SPACE_END_ARCH (unsigned long) 0xffffffffffffffff 44 42 45 #define USTACK_ADDRESS_ARCH (USER_ADDRESS_SPACE_END_ARCH-(PAGE_SIZE-1)) 43 #define USER_ADDRESS_SPACE_START_ARCH (unsigned long) 0x0000000000000000 44 #define USER_ADDRESS_SPACE_END_ARCH (unsigned long) 0x00007fffffffffff 46 45 47 #define as_constructor_arch(as, flags) (as != as) 48 #define as_destructor_arch(as) (as != as) 49 #define as_create_arch(as, flags) (as != as) 46 #define USTACK_ADDRESS_ARCH (USER_ADDRESS_SPACE_END_ARCH - (PAGE_SIZE - 1)) 47 48 #define as_constructor_arch(as, flags) (as != as) 49 #define as_destructor_arch(as) (as != as) 50 #define as_create_arch(as, flags) (as != as) 51 50 52 #define as_install_arch(as) 51 53 #define as_deinstall_arch(as) -
kernel/arch/amd64/include/mm/page.h
re4a4b44 rf56e897f 35 35 /** Paging on AMD64 36 36 * 37 * The space is divided in positive numbers - userspace and 38 * negative numbers - kernel space. The 'negative' space starting 39 * with 0xffff800000000000 and ending with 0xffffffff80000000 40 * (-2GB) is identically mapped physical memory. The area 41 * (0xffffffff80000000 ... 0xffffffffffffffff is again identically 42 * mapped first 2GB. 43 * 44 * ATTENTION - PA2KA(KA2PA(x)) != x if 'x' is in kernel 37 * The space is divided in positive numbers (uspace) and 38 * negative numbers (kernel). The 'negative' space starting 39 * with 0xffff800000000000 and ending with 0xffffffffffffffff 40 * is identically mapped physical memory. 41 * 45 42 */ 46 43 … … 50 47 #include <arch/mm/frame.h> 51 48 52 #define PAGE_WIDTH FRAME_WIDTH53 #define PAGE_SIZE FRAME_SIZE49 #define PAGE_WIDTH FRAME_WIDTH 50 #define PAGE_SIZE FRAME_SIZE 54 51 55 52 #ifdef KERNEL 56 53 57 54 #ifndef __ASM__ 58 # include <mm/mm.h> 59 # include <typedefs.h> 60 # include <arch/interrupt.h> 61 62 static inline uintptr_t ka2pa(uintptr_t x) 63 { 64 if (x > 0xffffffff80000000) 65 return x - 0xffffffff80000000; 66 else 67 return x - 0xffff800000000000; 68 } 69 70 # define KA2PA(x) ka2pa((uintptr_t) x) 71 # define PA2KA_CODE(x) (((uintptr_t) (x)) + 0xffffffff80000000) 72 # define PA2KA(x) (((uintptr_t) (x)) + 0xffff800000000000) 73 #else 74 # define KA2PA(x) ((x) - 0xffffffff80000000) 75 # define PA2KA(x) ((x) + 0xffffffff80000000) 76 #endif 55 56 #define KA2PA(x) (((uintptr_t) (x)) - 0xffff800000000000) 57 #define PA2KA(x) (((uintptr_t) (x)) + 0xffff800000000000) 58 59 #else /* __ASM__ */ 60 61 #define KA2PA(x) ((x) - 0xffff800000000000) 62 #define PA2KA(x) ((x) + 0xffff800000000000) 63 64 #endif /* __ASM__ */ 77 65 78 66 /* Number of entries in each level. */ 79 #define PTL0_ENTRIES_ARCH 51280 #define PTL1_ENTRIES_ARCH 51281 #define PTL2_ENTRIES_ARCH 51282 #define PTL3_ENTRIES_ARCH 51267 #define PTL0_ENTRIES_ARCH 512 68 #define PTL1_ENTRIES_ARCH 512 69 #define PTL2_ENTRIES_ARCH 512 70 #define PTL3_ENTRIES_ARCH 512 83 71 84 72 /* Page table sizes for each level. */ 85 #define PTL0_SIZE_ARCH ONE_FRAME86 #define PTL1_SIZE_ARCH ONE_FRAME87 #define PTL2_SIZE_ARCH ONE_FRAME88 #define PTL3_SIZE_ARCH ONE_FRAME73 #define PTL0_SIZE_ARCH ONE_FRAME 74 #define PTL1_SIZE_ARCH ONE_FRAME 75 #define PTL2_SIZE_ARCH ONE_FRAME 76 #define PTL3_SIZE_ARCH ONE_FRAME 89 77 90 78 /* Macros calculating indices into page tables in each level. */ 91 #define PTL0_INDEX_ARCH(vaddr) (((vaddr) >> 39) & 0x1ff)92 #define PTL1_INDEX_ARCH(vaddr) (((vaddr) >> 30) & 0x1ff)93 #define PTL2_INDEX_ARCH(vaddr) (((vaddr) >> 21) & 0x1ff)94 #define PTL3_INDEX_ARCH(vaddr) (((vaddr) >> 12) & 0x1ff)79 #define PTL0_INDEX_ARCH(vaddr) (((vaddr) >> 39) & 0x1ff) 80 #define PTL1_INDEX_ARCH(vaddr) (((vaddr) >> 30) & 0x1ff) 81 #define PTL2_INDEX_ARCH(vaddr) (((vaddr) >> 21) & 0x1ff) 82 #define PTL3_INDEX_ARCH(vaddr) (((vaddr) >> 12) & 0x1ff) 95 83 96 84 /* Get PTE address accessors for each level. */ … … 156 144 #ifndef __ASM__ 157 145 146 #include <mm/mm.h> 147 #include <arch/interrupt.h> 148 #include <typedefs.h> 149 158 150 /* Page fault error codes. */ 159 151 … … 161 153 * page. 162 154 */ 163 #define PFERR_CODE_P (1 << 0)155 #define PFERR_CODE_P (1 << 0) 164 156 165 157 /** When bit on this position is 1, the page fault was caused by a write. */ 166 #define PFERR_CODE_RW (1 << 1)158 #define PFERR_CODE_RW (1 << 1) 167 159 168 160 /** When bit on this position is 1, the page fault was caused in user mode. */ 169 #define PFERR_CODE_US (1 << 2)161 #define PFERR_CODE_US (1 << 2) 170 162 171 163 /** When bit on this position is 1, a reserved bit was set in page directory. */ 172 #define PFERR_CODE_RSVD (1 << 3)164 #define PFERR_CODE_RSVD (1 << 3) 173 165 174 166 /** When bit on this position os 1, the page fault was caused during instruction 175 167 * fecth. 176 168 */ 177 #define PFERR_CODE_ID (1 << 4)169 #define PFERR_CODE_ID (1 << 4) 178 170 179 171 /** Page Table Entry. */ 180 172 typedef struct { 181 unsigned present : 1;182 unsigned writeable : 1;183 unsigned uaccessible : 1;184 unsigned page_write_through : 1;185 unsigned page_cache_disable : 1;186 unsigned accessed : 1;187 unsigned dirty : 1;188 unsigned unused: 1;189 unsigned global : 1;190 unsigned soft_valid : 1;/**< Valid content even if present bit is cleared. */191 unsigned avl : 2;192 unsigned addr_12_31 : 30;193 unsigned addr_32_51 : 21;194 unsigned no_execute : 1;173 unsigned int present : 1; 174 unsigned int writeable : 1; 175 unsigned int uaccessible : 1; 176 unsigned int page_write_through : 1; 177 unsigned int page_cache_disable : 1; 178 unsigned int accessed : 1; 179 unsigned int dirty : 1; 180 unsigned int unused: 1; 181 unsigned int global : 1; 182 unsigned int soft_valid : 1; /**< Valid content even if present bit is cleared. */ 183 unsigned int avl : 2; 184 unsigned int addr_12_31 : 30; 185 unsigned int addr_32_51 : 21; 186 unsigned int no_execute : 1; 195 187 } __attribute__ ((packed)) pte_t; 196 188 … … 211 203 { 212 204 pte_t *p = &pt[i]; 213 205 214 206 p->addr_12_31 = (a >> 12) & 0xfffff; 215 207 p->addr_32_51 = a >> 32; -
kernel/arch/amd64/include/mm/ptl.h
re4a4b44 rf56e897f 27 27 */ 28 28 29 /** @addtogroup amd64mm 29 /** @addtogroup amd64mm 30 30 * @{ 31 31 */ … … 36 36 #define KERN_amd64_PTL_H_ 37 37 38 #define PTL_NO_EXEC (1<<63)39 #define PTL_ACCESSED (1<<5)40 #define PTL_CACHE_DISABLE (1<<4)41 #define PTL_CACHE_THROUGH (1<<3)42 #define PTL_USER (1<<2)43 #define PTL_WRITABLE (1<<1)44 #define PTL_PRESENT 145 #define PTL_2MB_PAGE (1<<7)38 #define PTL_NO_EXEC (1 << 63) 39 #define PTL_ACCESSED (1 << 5) 40 #define PTL_CACHE_DISABLE (1 << 4) 41 #define PTL_CACHE_THROUGH (1 << 3) 42 #define PTL_USER (1 << 2) 43 #define PTL_WRITABLE (1 << 1) 44 #define PTL_PRESENT 1 45 #define PTL_2MB_PAGE (1 << 7) 46 46 47 47 -
kernel/arch/amd64/include/mm/tlb.h
re4a4b44 rf56e897f 27 27 */ 28 28 29 /** @addtogroup amd64mm 29 /** @addtogroup amd64mm 30 30 * @{ 31 31 */ -
kernel/arch/amd64/include/pm.h
re4a4b44 rf56e897f 71 71 #define PL_USER 3 72 72 73 #define AR_PRESENT (1 << 7)73 #define AR_PRESENT (1 << 7) 74 74 #define AR_DATA (2 << 3) 75 75 #define AR_CODE (3 << 3) -
kernel/arch/amd64/include/proc/thread.h
re4a4b44 rf56e897f 37 37 38 38 /* CAUTION: keep these in sync with low level assembly code in syscall_entry */ 39 #define SYSCALL_USTACK_RSP 040 #define SYSCALL_KSTACK_RSP 139 #define SYSCALL_USTACK_RSP 0 40 #define SYSCALL_KSTACK_RSP 1 41 41 42 42 typedef struct { 43 43 unative_t tls; 44 44 /** User and kernel RSP for syscalls. */ 45 uint64_t syscall_rsp[2]; 45 uint64_t syscall_rsp[2]; 46 46 } thread_arch_t; 47 47
Note:
See TracChangeset
for help on using the changeset viewer.
