Changeset 5f70118 in mainline for kernel/arch/amd64
- Timestamp:
- 2010-01-10T12:16:59Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c77a64f
- Parents:
- 309ede1 (diff), 1ac3a52 (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
- Files:
-
- 2 added
- 13 edited
-
Makefile.inc (modified) (2 diffs)
-
_link.ld.in (modified) (1 diff)
-
include/context.h (modified) (1 diff)
-
include/interrupt.h (modified) (3 diffs)
-
include/mm/page.h (modified) (1 diff)
-
include/types.h (modified) (1 diff)
-
src/amd64.c (modified) (3 diffs)
-
src/asm_utils.S (modified) (5 diffs)
-
src/boot/boot.S (modified) (2 diffs)
-
src/cpu/cpu.c (modified) (2 diffs)
-
src/debug/stacktrace.c (added)
-
src/debug/stacktrace_asm.S (added)
-
src/interrupt.c (modified) (4 diffs)
-
src/mm/page.c (modified) (1 diff)
-
src/smp/ap.S (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/Makefile.inc
r309ede1 r5f70118 34 34 BFD = binary 35 35 TARGET = amd64-linux-gnu 36 CLANG_ARCH = x86_64 36 37 TOOLCHAIN_DIR = $(CROSS_PREFIX)/amd64 37 38 38 39 FPU_NO_CFLAGS = -mno-sse -mno-sse2 39 CMN1 = -m64 -mcmodel=kernel -mno-red-zone -fno-unwind-tables 40 CMN1 = -m64 -mcmodel=kernel -mno-red-zone -fno-unwind-tables -fno-omit-frame-pointer 40 41 GCC_CFLAGS += $(CMN1) 41 42 ICC_CFLAGS += $(CMN1) … … 59 60 arch/$(KARCH)/src/boot/boot.S \ 60 61 arch/$(KARCH)/src/boot/memmap.c \ 62 arch/$(KARCH)/src/debug/stacktrace.c \ 63 arch/$(KARCH)/src/debug/stacktrace_asm.S \ 61 64 arch/$(KARCH)/src/pm.c \ 62 65 arch/$(KARCH)/src/context.S \ -
kernel/arch/amd64/_link.ld.in
r309ede1 r5f70118 44 44 *(COMMON); /* global variables */ 45 45 46 . = ALIGN(8); 46 47 symbol_table = .; 47 48 *(symtab.*); /* Symbol table, must be LAST symbol!*/ -
kernel/arch/amd64/include/context.h
r309ede1 r5f70118 46 46 #define SP_DELTA 16 47 47 48 #define context_set(c, _pc, stack, size) \ 49 do { \ 50 (c)->pc = (uintptr_t) (_pc); \ 51 (c)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \ 52 (c)->rbp = 0; \ 53 } while (0) 54 48 55 #endif /* KERNEL */ 49 56 -
kernel/arch/amd64/include/interrupt.h
r309ede1 r5f70118 70 70 71 71 /** This is passed to interrupt handlers */ 72 typedef struct {72 typedef struct istate { 73 73 uint64_t rax; 74 74 uint64_t rcx; … … 80 80 uint64_t r10; 81 81 uint64_t r11; 82 uint64_t rbp; 82 83 uint64_t error_word; 83 84 uint64_t rip; … … 101 102 return istate->rip; 102 103 } 104 static inline unative_t istate_get_fp(istate_t *istate) 105 { 106 return istate->rbp; 107 } 103 108 104 109 extern void (* disable_irqs_function)(uint16_t irqmask); -
kernel/arch/amd64/include/mm/page.h
r309ede1 r5f70118 177 177 #define PFERR_CODE_ID (1 << 4) 178 178 179 static inline int get_pt_flags(pte_t *pt, size_t i) 179 /** Page Table Entry. */ 180 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; 195 } __attribute__ ((packed)) pte_t; 196 197 static inline unsigned int get_pt_flags(pte_t *pt, size_t i) 180 198 { 181 199 pte_t *p = &pt[i]; -
kernel/arch/amd64/include/types.h
r309ede1 r5f70118 82 82 #define PRIxn "llx" 83 83 84 /** Page Table Entry. */85 typedef struct {86 unsigned present : 1;87 unsigned writeable : 1;88 unsigned uaccessible : 1;89 unsigned page_write_through : 1;90 unsigned page_cache_disable : 1;91 unsigned accessed : 1;92 unsigned dirty : 1;93 unsigned unused: 1;94 unsigned global : 1;95 unsigned soft_valid : 1; /**< Valid content even if present bit is cleared. */96 unsigned avl : 2;97 unsigned addr_12_31 : 30;98 unsigned addr_32_51 : 21;99 unsigned no_execute : 1;100 } __attribute__ ((packed)) pte_t;101 102 84 #endif 103 85 -
kernel/arch/amd64/src/amd64.c
r309ede1 r5f70118 67 67 #include <ddi/irq.h> 68 68 #include <sysinfo/sysinfo.h> 69 #include <memstr.h> 69 70 70 71 /** Disable I/O on non-privileged levels … … 211 212 i8042_wire(i8042_instance, kbrd); 212 213 trap_virtual_enable_irqs(1 << IRQ_KBD); 214 trap_virtual_enable_irqs(1 << IRQ_MOUSE); 213 215 } 214 216 } … … 218 220 * self-sufficient. 219 221 */ 220 sysinfo_set_item_val("kbd", NULL, true); 221 sysinfo_set_item_val("kbd.inr", NULL, IRQ_KBD); 222 sysinfo_set_item_val("kbd.address.physical", NULL, 222 sysinfo_set_item_val("i8042", NULL, true); 223 sysinfo_set_item_val("i8042.inr_a", NULL, IRQ_KBD); 224 sysinfo_set_item_val("i8042.inr_b", NULL, IRQ_MOUSE); 225 sysinfo_set_item_val("i8042.address.physical", NULL, 223 226 (uintptr_t) I8042_BASE); 224 sysinfo_set_item_val(" kbd.address.kernel", NULL,227 sysinfo_set_item_val("i8042.address.kernel", NULL, 225 228 (uintptr_t) I8042_BASE); 226 229 #endif -
kernel/arch/amd64/src/asm_utils.S
r309ede1 r5f70118 27 27 # 28 28 29 #define IREGISTER_SPACE 7229 #define IREGISTER_SPACE 80 30 30 31 31 #define IOFFSET_RAX 0x0 … … 38 38 #define IOFFSET_R10 0x38 39 39 #define IOFFSET_R11 0x40 40 #define IOFFSET_RBP 0x48 40 41 41 42 # Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int has no error word … … 179 180 movq %r10, IOFFSET_R10(%rsp) 180 181 movq %r11, IOFFSET_R11(%rsp) 182 movq %rbp, IOFFSET_RBP(%rsp) 181 183 .endm 182 184 … … 191 193 movq IOFFSET_R10(%rsp), %r10 192 194 movq IOFFSET_R11(%rsp), %r11 195 movq IOFFSET_RBP(%rsp), %rbp 193 196 .endm 194 197 … … 235 238 cld 236 239 240 # Stop stack traces here 241 xorq %rbp, %rbp 242 237 243 movq $(\i), %rdi # %rdi - first parameter 238 244 movq %rsp, %rsi # %rsi - pointer to istate -
kernel/arch/amd64/src/boot/boot.S
r309ede1 r5f70118 174 174 call arch_pre_main 175 175 176 # create the first stack frame 177 pushq $0 178 movq %rsp, %rbp 179 176 180 call main_bsp 177 181 … … 329 333 330 334 extended_cpuid_msg: 331 .asciz "E xtended CPUID not supported. System halted."335 .asciz "Error: Extended CPUID not supported -- CPU is not 64-bit. System halted." 332 336 long_mode_msg: 333 .asciz " 64bit long mode not supported. System halted."337 .asciz "Error: 64-bit long mode not supported. System halted." 334 338 noexecute_msg: 335 .asciz " No-execute pages not supported. System halted."339 .asciz "Error: No-execute pages not supported. System halted." 336 340 fx_msg: 337 .asciz " FXSAVE/FXRESTORE instructions not supported. System halted."341 .asciz "Error: FXSAVE/FXRESTORE instructions not supported. System halted." 338 342 sse2_msg: 339 .asciz " SSE2 instructions not supported. System halted."343 .asciz "Error: SSE2 instructions not supported. System halted." -
kernel/arch/amd64/src/cpu/cpu.c
r309ede1 r5f70118 130 130 CPU->arch.vendor = VendorUnknown; 131 131 if (has_cpuid()) { 132 cpuid( 0, &info);132 cpuid(INTEL_CPUID_LEVEL, &info); 133 133 134 134 /* … … 150 150 } 151 151 152 cpuid( 1, &info);152 cpuid(INTEL_CPUID_STANDARD, &info); 153 153 CPU->arch.family = (info.cpuid_eax >> 8) & 0xf; 154 154 CPU->arch.model = (info.cpuid_eax >> 4) & 0xf; -
kernel/arch/amd64/src/interrupt.c
r309ede1 r5f70118 53 53 #include <ddi/irq.h> 54 54 #include <symtab.h> 55 #include <stacktrace.h> 55 56 56 57 /* … … 80 81 istate->r10, istate->r11); 81 82 printf("%%rsp=%#llx\n", &istate->stack[0]); 83 84 stack_trace_istate(istate); 82 85 } 83 86 … … 96 99 decode_istate(n, istate); 97 100 panic("Unserviced interrupt."); 101 } 102 103 static void de_fault(int n, istate_t *istate) 104 { 105 fault_if_from_uspace(istate, "Divide error."); 106 decode_istate(n, istate); 107 panic("Divide error."); 98 108 } 99 109 … … 200 210 } 201 211 212 exc_register(0, "de_fault", (iroutine) de_fault); 202 213 exc_register(7, "nm_fault", (iroutine) nm_fault); 203 214 exc_register(12, "ss_fault", (iroutine) ss_fault); -
kernel/arch/amd64/src/mm/page.c
r309ede1 r5f70118 203 203 { 204 204 if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) 205 panic("Unable to map physical memory %p (%d bytes).", physaddr, size) 205 panic("Unable to map physical memory %p (%d bytes).", physaddr, 206 size); 206 207 207 208 uintptr_t virtaddr = PA2KA(last_frame); -
kernel/arch/amd64/src/smp/ap.S
r309ede1 r5f70118 99 99 start64: 100 100 movq (ctx), %rsp 101 pushq $0 102 movq %rsp, %rbp 101 103 call main_ap - AP_BOOT_OFFSET + BOOT_OFFSET # never returns 102 104
Note:
See TracChangeset
for help on using the changeset viewer.
