Changeset 5f70118 in mainline for kernel/arch/amd64


Ignore:
Timestamp:
2010-01-10T12:16:59Z (16 years ago)
Author:
Jiri Svoboda <jiri@…>
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.
Message:

Merge mainline changes.

Location:
kernel/arch/amd64
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/Makefile.inc

    r309ede1 r5f70118  
    3434BFD = binary
    3535TARGET = amd64-linux-gnu
     36CLANG_ARCH = x86_64
    3637TOOLCHAIN_DIR = $(CROSS_PREFIX)/amd64
    3738
    3839FPU_NO_CFLAGS = -mno-sse -mno-sse2
    39 CMN1 = -m64 -mcmodel=kernel -mno-red-zone -fno-unwind-tables
     40CMN1 = -m64 -mcmodel=kernel -mno-red-zone -fno-unwind-tables -fno-omit-frame-pointer
    4041GCC_CFLAGS += $(CMN1)
    4142ICC_CFLAGS += $(CMN1)
     
    5960        arch/$(KARCH)/src/boot/boot.S \
    6061        arch/$(KARCH)/src/boot/memmap.c \
     62        arch/$(KARCH)/src/debug/stacktrace.c \
     63        arch/$(KARCH)/src/debug/stacktrace_asm.S \
    6164        arch/$(KARCH)/src/pm.c \
    6265        arch/$(KARCH)/src/context.S \
  • kernel/arch/amd64/_link.ld.in

    r309ede1 r5f70118  
    4444                *(COMMON);              /* global variables */
    4545
     46                . = ALIGN(8);
    4647                symbol_table = .;
    4748                *(symtab.*);            /* Symbol table, must be LAST symbol!*/
  • kernel/arch/amd64/include/context.h

    r309ede1 r5f70118  
    4646#define SP_DELTA     16
    4747
     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
    4855#endif /* KERNEL */
    4956
  • kernel/arch/amd64/include/interrupt.h

    r309ede1 r5f70118  
    7070
    7171/** This is passed to interrupt handlers */
    72 typedef struct {
     72typedef struct istate {
    7373        uint64_t rax;
    7474        uint64_t rcx;
     
    8080        uint64_t r10;
    8181        uint64_t r11;
     82        uint64_t rbp;
    8283        uint64_t error_word;
    8384        uint64_t rip;
     
    101102        return istate->rip;
    102103}
     104static inline unative_t istate_get_fp(istate_t *istate)
     105{
     106        return istate->rbp;
     107}
    103108
    104109extern void (* disable_irqs_function)(uint16_t irqmask);
  • kernel/arch/amd64/include/mm/page.h

    r309ede1 r5f70118  
    177177#define PFERR_CODE_ID           (1 << 4)
    178178
    179 static inline int get_pt_flags(pte_t *pt, size_t i)
     179/** Page Table Entry. */
     180typedef 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
     197static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
    180198{
    181199        pte_t *p = &pt[i];
  • kernel/arch/amd64/include/types.h

    r309ede1 r5f70118  
    8282#define PRIxn "llx"
    8383
    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 
    10284#endif
    10385
  • kernel/arch/amd64/src/amd64.c

    r309ede1 r5f70118  
    6767#include <ddi/irq.h>
    6868#include <sysinfo/sysinfo.h>
     69#include <memstr.h>
    6970
    7071/** Disable I/O on non-privileged levels
     
    211212                        i8042_wire(i8042_instance, kbrd);
    212213                        trap_virtual_enable_irqs(1 << IRQ_KBD);
     214                        trap_virtual_enable_irqs(1 << IRQ_MOUSE);
    213215                }
    214216        }
     
    218220         * self-sufficient.
    219221         */
    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,
    223226            (uintptr_t) I8042_BASE);
    224         sysinfo_set_item_val("kbd.address.kernel", NULL,
     227        sysinfo_set_item_val("i8042.address.kernel", NULL,
    225228            (uintptr_t) I8042_BASE);
    226229#endif
  • kernel/arch/amd64/src/asm_utils.S

    r309ede1 r5f70118  
    2727#
    2828
    29 #define IREGISTER_SPACE 72
     29#define IREGISTER_SPACE 80
    3030
    3131#define IOFFSET_RAX     0x0
     
    3838#define IOFFSET_R10     0x38
    3939#define IOFFSET_R11     0x40
     40#define IOFFSET_RBP     0x48
    4041
    4142#  Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int has no error word
     
    179180        movq %r10, IOFFSET_R10(%rsp)
    180181        movq %r11, IOFFSET_R11(%rsp)
     182        movq %rbp, IOFFSET_RBP(%rsp)
    181183.endm
    182184
     
    191193        movq IOFFSET_R10(%rsp), %r10
    192194        movq IOFFSET_R11(%rsp), %r11
     195        movq IOFFSET_RBP(%rsp), %rbp
    193196.endm
    194197
     
    235238        cld
    236239
     240        # Stop stack traces here
     241        xorq %rbp, %rbp
     242
    237243        movq $(\i), %rdi        # %rdi - first parameter
    238244        movq %rsp, %rsi         # %rsi - pointer to istate
  • kernel/arch/amd64/src/boot/boot.S

    r309ede1 r5f70118  
    174174        call arch_pre_main
    175175       
     176        # create the first stack frame
     177        pushq $0
     178        movq %rsp, %rbp
     179
    176180        call main_bsp
    177181       
     
    329333
    330334extended_cpuid_msg:
    331         .asciz "Extended CPUID not supported. System halted."
     335        .asciz "Error: Extended CPUID not supported -- CPU is not 64-bit. System halted."
    332336long_mode_msg:
    333         .asciz "64 bit long mode not supported. System halted."
     337        .asciz "Error: 64-bit long mode not supported. System halted."
    334338noexecute_msg:
    335         .asciz "No-execute pages not supported. System halted."
     339        .asciz "Error: No-execute pages not supported. System halted."
    336340fx_msg:
    337         .asciz "FXSAVE/FXRESTORE instructions not supported. System halted."
     341        .asciz "Error: FXSAVE/FXRESTORE instructions not supported. System halted."
    338342sse2_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  
    130130        CPU->arch.vendor = VendorUnknown;
    131131        if (has_cpuid()) {
    132                 cpuid(0, &info);
     132                cpuid(INTEL_CPUID_LEVEL, &info);
    133133
    134134                /*
     
    150150                }
    151151                               
    152                 cpuid(1, &info);
     152                cpuid(INTEL_CPUID_STANDARD, &info);
    153153                CPU->arch.family = (info.cpuid_eax >> 8) & 0xf;
    154154                CPU->arch.model = (info.cpuid_eax >> 4) & 0xf;
  • kernel/arch/amd64/src/interrupt.c

    r309ede1 r5f70118  
    5353#include <ddi/irq.h>
    5454#include <symtab.h>
     55#include <stacktrace.h>
    5556
    5657/*
     
    8081            istate->r10, istate->r11);
    8182        printf("%%rsp=%#llx\n", &istate->stack[0]);
     83       
     84        stack_trace_istate(istate);
    8285}
    8386
     
    9699        decode_istate(n, istate);
    97100        panic("Unserviced interrupt.");
     101}
     102
     103static 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.");
    98108}
    99109
     
    200210        }
    201211       
     212        exc_register(0, "de_fault", (iroutine) de_fault);
    202213        exc_register(7, "nm_fault", (iroutine) nm_fault);
    203214        exc_register(12, "ss_fault", (iroutine) ss_fault);
  • kernel/arch/amd64/src/mm/page.c

    r309ede1 r5f70118  
    203203{
    204204        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);
    206207       
    207208        uintptr_t virtaddr = PA2KA(last_frame);
  • kernel/arch/amd64/src/smp/ap.S

    r309ede1 r5f70118  
    9999start64:
    100100        movq (ctx), %rsp
     101        pushq $0
     102        movq %rsp, %rbp
    101103        call main_ap - AP_BOOT_OFFSET + BOOT_OFFSET   # never returns
    102104
Note: See TracChangeset for help on using the changeset viewer.