Changeset 99de22b in mainline for kernel


Ignore:
Timestamp:
2010-01-15T18:30:25Z (16 years ago)
Author:
Pavel Rimsky <pavel@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
eeb643d
Parents:
387416b (diff), 563d6077 (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:

Merged latest trunk changes.

Location:
kernel
Files:
16 added
57 edited

Legend:

Unmodified
Added
Removed
  • kernel/Makefile

    r387416b r99de22b  
    3333all: ../version ../Makefile.config ../config.h ../config.defs
    3434        -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
    35         $(MAKE) -f Makefile.build EXTRA_TOOL=$(EXTRA_TOOL)
     35        $(MAKE) -f Makefile.build PRECHECK=$(PRECHECK)
    3636
    3737clean:
    3838        rm -f $(DEPEND) $(DEPEND_PREV) $(RAW) $(BIN) $(MAP) $(JOB) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* $(ARCH_INCLUDE) $(GENARCH_INCLUDE) arch/*/_link.ld
    3939        find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \;
    40         find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o.preproc' -follow -exec rm \{\} \;
  • kernel/Makefile.build

    r387416b r99de22b  
    186186        generic/src/ddi/device.c \
    187187        generic/src/debug/symtab.c \
     188        generic/src/debug/stacktrace.c \
    188189        generic/src/interrupt/interrupt.c \
    189190        generic/src/main/main.c \
     
    375376%.o: %.S $(DEPEND)
    376377        $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -c $< -o $@
     378ifeq ($(PRECHECK),y)
     379        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(GCC_CFLAGS) -D__ASM__
     380endif
    377381
    378382%.o: %.s $(DEPEND)
    379383        $(AS) $(AFLAGS) $< -o $@
     384ifeq ($(PRECHECK),y)
     385        $(JOBFILE) $(JOB) $< $@ as asm $(DEFS) $(CFLAGS) $(EXTRA_FLAGS)
     386endif
    380387
    381388#
     
    385392test/fpu/%.o: test/fpu/%.c $(DEPEND)
    386393        $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c $< -o $@
    387 ifeq ($(EXTRA_TOOL),stanse)
    388         ../tools/jobfile.py $(JOB) $< $@ $(DEFS) $(CFLAGS) $(EXTRA_FLAGS)
     394ifeq ($(PRECHECK),y)
     395        $(JOBFILE) $(JOB) $< $@ cc test $(DEFS) $(CFLAGS) $(EXTRA_FLAGS)
    389396endif
    390397
     
    394401%.o: %.c $(DEPEND)
    395402        $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) -c $< -o $@
    396 ifeq ($(EXTRA_TOOL),stanse)
    397         ../tools/jobfile.py $(JOB) $< $@ $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS)
     403ifeq ($(PRECHECK),y)
     404        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS)
    398405endif
    399406
     
    405412        $(LD) -T $(LINK) $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP) -o $@ -Map $(MAP_PREV)
    406413        $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
    407         tools/genmap.py $(MAP_PREV) $(DUMP) $@
     414        $(GENMAP) $(MAP_PREV) $(DUMP) $@
    408415       
    409416        # Do it once again, this time to get correct even the symbols
     
    413420        $(LD) -T $(LINK) $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP) -o $@ -Map $(MAP_PREV)
    414421        $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
    415         tools/genmap.py $(MAP_PREV) $(DUMP) $@
     422        $(GENMAP) $(MAP_PREV) $(DUMP) $@
    416423
    417424$(DEPEND): $(ARCH_INCLUDE) $(GENARCH_INCLUDE)
  • kernel/Makefile.common

    r387416b r99de22b  
    4444ARCH_INCLUDE = generic/include/arch
    4545GENARCH_INCLUDE = generic/include/genarch
     46
     47GENMAP = tools/genmap.py
     48JOBFILE = ../tools/jobfile.py
  • kernel/arch/amd64/Makefile.inc

    r387416b r99de22b  
    3838
    3939FPU_NO_CFLAGS = -mno-sse -mno-sse2
    40 CMN1 = -m64 -mcmodel=kernel -mno-red-zone -fno-unwind-tables
     40CMN1 = -m64 -mcmodel=kernel -mno-red-zone -fno-unwind-tables -fno-omit-frame-pointer
    4141GCC_CFLAGS += $(CMN1)
    4242ICC_CFLAGS += $(CMN1)
     
    6060        arch/$(KARCH)/src/boot/boot.S \
    6161        arch/$(KARCH)/src/boot/memmap.c \
     62        arch/$(KARCH)/src/debug/stacktrace.c \
     63        arch/$(KARCH)/src/debug/stacktrace_asm.S \
    6264        arch/$(KARCH)/src/pm.c \
    6365        arch/$(KARCH)/src/context.S \
  • kernel/arch/amd64/_link.ld.in

    r387416b r99de22b  
    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

    r387416b r99de22b  
    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

    r387416b r99de22b  
    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/src/amd64.c

    r387416b r99de22b  
    212212                        i8042_wire(i8042_instance, kbrd);
    213213                        trap_virtual_enable_irqs(1 << IRQ_KBD);
     214                        trap_virtual_enable_irqs(1 << IRQ_MOUSE);
    214215                }
    215216        }
     
    219220         * self-sufficient.
    220221         */
    221         sysinfo_set_item_val("kbd", NULL, true);
    222         sysinfo_set_item_val("kbd.inr", NULL, IRQ_KBD);
    223         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,
    224226            (uintptr_t) I8042_BASE);
    225         sysinfo_set_item_val("kbd.address.kernel", NULL,
     227        sysinfo_set_item_val("i8042.address.kernel", NULL,
    226228            (uintptr_t) I8042_BASE);
    227229#endif
  • kernel/arch/amd64/src/asm_utils.S

    r387416b r99de22b  
    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

    r387416b r99de22b  
    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/interrupt.c

    r387416b r99de22b  
    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

    r387416b r99de22b  
    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

    r387416b r99de22b  
    9999start64:
    100100        movq (ctx), %rsp
     101        pushq $0
     102        movq %rsp, %rbp
    101103        call main_ap - AP_BOOT_OFFSET + BOOT_OFFSET   # never returns
    102104
  • kernel/arch/arm32/Makefile.inc

    r387416b r99de22b  
    3838ATSIGN = %
    3939
    40 GCC_CFLAGS += -fno-zero-initialized-in-bss
     40GCC_CFLAGS += -fno-zero-initialized-in-bss -mapcs-frame
    4141
    4242BITS = 32
     
    5757        arch/$(KARCH)/src/exception.c \
    5858        arch/$(KARCH)/src/userspace.c \
     59        arch/$(KARCH)/src/debug/stacktrace.c \
     60        arch/$(KARCH)/src/debug/stacktrace_asm.S \
    5961        arch/$(KARCH)/src/mm/as.c \
    6062        arch/$(KARCH)/src/mm/frame.c \
  • kernel/arch/arm32/_link.ld.in

    r387416b r99de22b  
    3434                *(.sdata);
    3535                *(.reginfo);
     36                . = ALIGN(8);
    3637                symbol_table = .;
    3738                *(symtab.*);
  • kernel/arch/arm32/include/context.h

    r387416b r99de22b  
    4343#define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
    4444
     45#define context_set(c, _pc, stack, size) \
     46        do { \
     47                (c)->pc = (uintptr_t) (_pc); \
     48                (c)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \
     49                (c)->fp = 0; \
     50        } while (0)
     51
    4552#ifndef __ASM__
    4653
     
    6269        uint32_t r9;
    6370        uint32_t r10;
    64         uint32_t r11;
     71        uint32_t fp;    /* r11 */
    6572       
    6673        ipl_t ipl;
  • kernel/arch/arm32/include/exception.h

    r387416b r99de22b  
    8686
    8787/** Struct representing CPU state saved when an exception occurs. */
    88 typedef struct {
     88typedef struct istate {
    8989        uint32_t spsr;
    9090        uint32_t sp;
     
    102102        uint32_t r9;
    103103        uint32_t r10;
    104         uint32_t r11;
     104        uint32_t fp;
    105105        uint32_t r12;
    106106
     
    133133}
    134134
     135static inline unative_t istate_get_fp(istate_t *istate)
     136{
     137        return istate->fp;
     138}
     139
    135140
    136141extern void install_exception_handlers(void);
  • kernel/arch/arm32/src/exc_handler.S

    r387416b r99de22b  
    123123        stmfd r13!, {r2}
    1241242:
     125        # Stop stack traces here
     126        mov fp, #0
    125127.endm
    126128
  • kernel/arch/arm32/src/exception.c

    r387416b r99de22b  
    4242#include <print.h>
    4343#include <syscall/syscall.h>
     44#include <stacktrace.h>
    4445
    4546#ifdef MACHINE_testarm
     
    183184        printf(" r4: %x    r5: %x    r6: %x    r7: %x\n",
    184185            istate->r4, istate->r5, istate->r6, istate->r7);
    185         printf(" r8: %x    r8: %x   r10: %x   r11: %x\n",
    186             istate->r8, istate->r9, istate->r10, istate->r11);
     186        printf(" r8: %x    r8: %x   r10: %x    fp: %x\n",
     187            istate->r8, istate->r9, istate->r10, istate->fp);
    187188        printf(" r12: %x    sp: %x    lr: %x  spsr: %x\n",
    188189            istate->r12, istate->sp, istate->lr, istate->spsr);
    189190       
    190191        printf(" pc: %x\n", istate->pc);
     192
     193        stack_trace_istate(istate);
    191194}
    192195
  • kernel/arch/arm32/src/mm/page.c

    r387416b r99de22b  
    8888            KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) {
    8989                panic("Unable to map physical memory %p (%d bytes).",
    90                     physaddr, size)
     90                    physaddr, size);
    9191        }
    9292       
  • kernel/arch/arm32/src/mm/page_fault.c

    r387416b r99de22b  
    181181
    182182        if (ret == AS_PF_FAULT) {
     183                fault_if_from_uspace(istate, "Page fault: %#x.", badvaddr);
    183184                print_istate(istate);
    184185                printf("page fault - pc: %x, va: %x, status: %x(%x), "
     
    186187                    access);
    187188               
    188                 fault_if_from_uspace(istate, "Page fault: %#x.", badvaddr);
    189189                panic("Page fault.");
    190190        }
  • kernel/arch/arm32/src/start.S

    r387416b r99de22b  
    6969        bl arch_pre_main
    7070       
     71        #
     72        # Create the first stack frame.
     73        #
     74        mov fp, #0
     75        mov ip, sp
     76        push {fp, ip, lr, pc}
     77        sub fp, ip, #4
     78
    7179        bl main_bsp
    7280
  • kernel/arch/ia32/Makefile.inc

    r387416b r99de22b  
    7878        arch/$(KARCH)/src/context.S \
    7979        arch/$(KARCH)/src/debug/panic.s \
     80        arch/$(KARCH)/src/debug/stacktrace.c \
     81        arch/$(KARCH)/src/debug/stacktrace_asm.S \
    8082        arch/$(KARCH)/src/delay.s \
    8183        arch/$(KARCH)/src/asm.S \
  • kernel/arch/ia32/_link.ld.in

    r387416b r99de22b  
    4242                hardcoded_unmapped_kdata_size = .;
    4343                LONG(unmapped_kdata_end - unmapped_kdata_start);
     44                . = ALIGN(8);
    4445                symbol_table = .;
    4546                *(symtab.*);            /* Symbol table, must be LAST symbol! */
  • kernel/arch/ia32/include/context.h

    r387416b r99de22b  
    4949#define SP_DELTA        (8 + STACK_ITEM_SIZE)
    5050
     51#define context_set(c, _pc, stack, size) \
     52        do { \
     53                (c)->pc = (uintptr_t) (_pc); \
     54                (c)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \
     55                (c)->ebp = 0; \
     56        } while (0)
     57
    5158#endif /* KERNEL */
    5259
  • kernel/arch/ia32/include/interrupt.h

    r387416b r99de22b  
    6969#define VECTOR_DEBUG_IPI                (IVT_FREEBASE + 2)
    7070
    71 typedef struct {
     71typedef struct istate {
    7272        uint32_t eax;
    7373        uint32_t ecx;
    7474        uint32_t edx;
     75        uint32_t ebp;
    7576
    7677        uint32_t gs;
     
    102103}
    103104
     105static inline unative_t istate_get_fp(istate_t *istate)
     106{
     107        return istate->ebp;
     108}
     109
    104110extern void (* disable_irqs_function)(uint16_t irqmask);
    105111extern void (* enable_irqs_function)(uint16_t irqmask);
  • kernel/arch/ia32/src/asm.S

    r387416b r99de22b  
    269269        pushl %gs
    270270
     271        pushl %ebp
    271272        pushl %edx
    272273        pushl %ecx
     
    278279        movw %ax, %es
    279280
    280         cld
     281        # stop stack traces here
     282        xorl %ebp, %ebp
    281283
    282284        pushl %esp          # *istate
     
    290292        popl %ecx
    291293        popl %edx
     294        popl %ebp
    292295       
    293296        popl %gs
  • kernel/arch/ia32/src/boot/boot.S

    r387416b r99de22b  
    9494        pushl grub_eax
    9595        call arch_pre_main
     96
     97        # Create the first stack frame
     98        pushl $0
     99        movl %esp, %ebp
    96100       
    97101        call main_bsp
  • kernel/arch/ia32/src/ia32.c

    r387416b r99de22b  
    170170                        i8042_wire(i8042_instance, kbrd);
    171171                        trap_virtual_enable_irqs(1 << IRQ_KBD);
     172                        trap_virtual_enable_irqs(1 << IRQ_MOUSE);
    172173                }
    173174        }
     
    177178         * self-sufficient.
    178179         */
    179         sysinfo_set_item_val("kbd", NULL, true);
    180         sysinfo_set_item_val("kbd.inr", NULL, IRQ_KBD);
    181         sysinfo_set_item_val("kbd.address.physical", NULL,
     180        sysinfo_set_item_val("i8042", NULL, true);
     181        sysinfo_set_item_val("i8042.inr_a", NULL, IRQ_KBD);
     182        sysinfo_set_item_val("i8042.inr_b", NULL, IRQ_MOUSE);
     183        sysinfo_set_item_val("i8042.address.physical", NULL,
    182184            (uintptr_t) I8042_BASE);
    183         sysinfo_set_item_val("kbd.address.kernel", NULL,
     185        sysinfo_set_item_val("i8042.address.kernel", NULL,
    184186            (uintptr_t) I8042_BASE);
    185187#endif
  • kernel/arch/ia32/src/interrupt.c

    r387416b r99de22b  
    5353#include <ddi/irq.h>
    5454#include <symtab.h>
     55#include <stacktrace.h>
    5556
    5657/*
     
    7980        printf("stack: %#lx, %#lx, %#lx, %#lx\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]);
    8081        printf("       %#lx, %#lx, %#lx, %#lx\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]);
     82
     83        stack_trace_istate(istate);
    8184}
    8285
     
    9699        decode_istate(istate);
    97100        panic("Unserviced interrupt: %d.", n);
     101}
     102
     103static void de_fault(int n, istate_t *istate)
     104{
     105        fault_if_from_uspace(istate, "Divide error.");
     106
     107        decode_istate(istate);
     108        panic("Divide error.");
    98109}
    99110
     
    215226        }
    216227       
     228        exc_register(0, "de_fault", (iroutine) de_fault);
    217229        exc_register(7, "nm_fault", (iroutine) nm_fault);
    218230        exc_register(12, "ss_fault", (iroutine) ss_fault);
  • kernel/arch/ia32/src/mm/page.c

    r387416b r99de22b  
    8080{
    8181        if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
    82                 panic("Unable to map physical memory %p (%d bytes).", physaddr, size)
     82                panic("Unable to map physical memory %p (%d bytes).", physaddr, size);
    8383       
    8484        uintptr_t virtaddr = PA2KA(last_frame);
  • kernel/arch/ia32/src/smp/ap.S

    r387416b r99de22b  
    7878        addl $0x80000000, %esp                  # PA2KA(ctx.sp)
    7979       
     80        pushl $0                                # create the first stack frame
     81        movl %esp, %ebp
     82
    8083        jmpl $KTEXT, $main_ap
    8184
  • kernel/arch/ia64/Makefile.inc

    r387416b r99de22b  
    5353        arch/$(KARCH)/src/context.S \
    5454        arch/$(KARCH)/src/cpu/cpu.c \
     55        arch/$(KARCH)/src/debug/stacktrace.c \
     56        arch/$(KARCH)/src/debug/stacktrace_asm.S \
    5557        arch/$(KARCH)/src/ivt.S \
    5658        arch/$(KARCH)/src/interrupt.c \
  • kernel/arch/ia64/_link.ld.in

    r387416b r99de22b  
    3737                *(COMMON);
    3838
     39                . = ALIGN(8);
    3940                symbol_table = .;
    4041                *(symtab.*);            /* Symbol table, must be LAST symbol!*/
  • kernel/arch/ia64/include/interrupt.h

    r387416b r99de22b  
    7272#define EOI  0  /**< The actual value doesn't matter. */
    7373
    74 typedef struct {
     74typedef struct istate {
    7575        uint128_t f2;
    7676        uint128_t f3;
     
    143143}
    144144
     145static inline unative_t istate_get_fp(istate_t *istate)
     146{
     147        return 0;       /* FIXME */
     148}
     149
    145150static inline int istate_from_uspace(istate_t *istate)
    146151{
  • kernel/arch/ia64/include/mm/asid.h

    r387416b r99de22b  
    5050 * but those extra bits are not used by the kernel.
    5151 */
    52 #define RIDS_PER_ASID           7
     52#define RIDS_PER_ASID           8
    5353
    5454#define RID_MAX                 262143          /* 2^18 - 1 */
    55 #define RID_KERNEL              0
    56 #define RID_INVALID             1
     55#define RID_KERNEL7             7
    5756
    58 #define ASID2RID(asid, vrn)     (((asid)>RIDS_PER_ASID)?(((asid)*RIDS_PER_ASID)+(vrn)):(asid))
    59 #define RID2ASID(rid)           ((rid)/RIDS_PER_ASID)
     57#define ASID2RID(asid, vrn) \
     58        ((asid) * RIDS_PER_ASID + (vrn))
    6059
    61 #define ASID_MAX_ARCH           (RID_MAX/RIDS_PER_ASID)
     60#define RID2ASID(rid) \
     61        ((rid) / RIDS_PER_ASID)
     62
     63#define ASID_MAX_ARCH           (RID_MAX / RIDS_PER_ASID)
    6264
    6365#endif
  • kernel/arch/ia64/src/ia64.c

    r387416b r99de22b  
    203203        }
    204204       
    205         sysinfo_set_item_val("kbd", NULL, true);
    206         sysinfo_set_item_val("kbd.inr", NULL, IRQ_KBD);
    207         sysinfo_set_item_val("kbd.type", NULL, KBD_LEGACY);
    208         sysinfo_set_item_val("kbd.address.physical", NULL,
     205        sysinfo_set_item_val("i8042", NULL, true);
     206        sysinfo_set_item_val("i8042.inr_a", NULL, IRQ_KBD);
     207        sysinfo_set_item_val("i8042.inr_b", NULL, IRQ_MOUSE);
     208        sysinfo_set_item_val("i8042.address.physical", NULL,
    209209            (uintptr_t) I8042_BASE);
    210         sysinfo_set_item_val("kbd.address.kernel", NULL,
     210        sysinfo_set_item_val("i8042.address.kernel", NULL,
    211211            (uintptr_t) I8042_BASE);
    212212#endif
  • kernel/arch/ia64/src/mm/page.c

    r387416b r99de22b  
    7171
    7272        /*
    73          * First set up kernel region register.
    74          * This is redundant (see start.S) but we keep it here just for sure.
    75          */
    76         rr.word = rr_read(VRN_KERNEL);
    77         rr.map.ve = 0;                  /* disable VHPT walker */
    78         rr.map.ps = PAGE_WIDTH;
    79         rr.map.rid = ASID2RID(ASID_KERNEL, VRN_KERNEL);
    80         rr_write(VRN_KERNEL, rr.word);
    81         srlz_i();
    82         srlz_d();
    83 
    84         /*
    85          * And setup the rest of region register.
     73         * Set up kernel region registers.
     74         * VRN_KERNEL has already been set in start.S.
     75         * For paranoia reasons, we set it again.
    8676         */
    8777        for(i = 0; i < REGION_REGISTERS; i++) {
    88                 /* skip kernel rr */
    89                 if (i == VRN_KERNEL)
    90                         continue;
    91        
    9278                rr.word = rr_read(i);
    9379                rr.map.ve = 0;          /* disable VHPT walker */
    94                 rr.map.rid = RID_KERNEL;
     80                rr.map.rid = ASID2RID(ASID_KERNEL, i);
    9581                rr.map.ps = PAGE_WIDTH;
    9682                rr_write(i, rr.word);
  • kernel/arch/ia64/src/start.S

    r387416b r99de22b  
    7474        movl r10 = (RR_MASK)
    7575        and r9 = r10, r9
    76         movl r10 = ((RID_KERNEL << RID_SHIFT) | (KERNEL_PAGE_WIDTH << PS_SHIFT))
     76        movl r10 = (((RID_KERNEL7) << RID_SHIFT) | (KERNEL_PAGE_WIDTH << PS_SHIFT))
    7777        or r9 = r10, r9
    7878       
  • kernel/arch/mips32/Makefile.inc

    r387416b r99de22b  
    7070        arch/$(KARCH)/src/debugger.c \
    7171        arch/$(KARCH)/src/cpu/cpu.c \
     72        arch/$(KARCH)/src/debug/stacktrace.c \
     73        arch/$(KARCH)/src/debug/stacktrace_asm.S \
    7274        arch/$(KARCH)/src/mm/frame.c \
    7375        arch/$(KARCH)/src/mm/page.c \
  • kernel/arch/mips32/_link.ld.in

    r387416b r99de22b  
    3838                *(.bss);                        /* uninitialized static variables */
    3939                *(COMMON);                      /* global variables */
     40                . = ALIGN(8);
    4041                symbol_table = .;
    4142                *(symtab.*);
  • kernel/arch/mips32/include/exception.h

    r387416b r99de22b  
    5858#define EXC_VCED        31
    5959
    60 typedef struct {
     60typedef struct istate {
    6161        uint32_t at;
    6262        uint32_t v0;
     
    102102        return istate->epc;
    103103}
     104static inline unative_t istate_get_fp(istate_t *istate)
     105{
     106        return 0;       /* FIXME */
     107}
    104108
    105109extern void exception(istate_t *istate);
  • kernel/arch/ppc32/Makefile.inc

    r387416b r99de22b  
    4646        arch/$(KARCH)/src/context.S \
    4747        arch/$(KARCH)/src/debug/panic.s \
     48        arch/$(KARCH)/src/debug/stacktrace.c \
     49        arch/$(KARCH)/src/debug/stacktrace_asm.S \
    4850        arch/$(KARCH)/src/fpu_context.S \
    4951        arch/$(KARCH)/src/boot/boot.S \
  • kernel/arch/ppc32/_link.ld.in

    r387416b r99de22b  
    5151                *(COMMON);      /* global variables */
    5252               
     53                . = ALIGN(8);
    5354                symbol_table = .;
    5455                *(symtab.*);    /* Symbol table, must be LAST symbol!*/
  • kernel/arch/ppc32/include/exception.h

    r387416b r99de22b  
    3939#include <arch/regutils.h>
    4040
    41 typedef struct {
     41typedef struct istate {
    4242        uint32_t r0;
    4343        uint32_t r2;
     
    9898}
    9999
     100static inline unative_t istate_get_fp(istate_t *istate)
     101{
     102        return istate->sp;
     103}
     104
    100105#endif
    101106
  • kernel/arch/ppc32/src/mm/page.c

    r387416b r99de22b  
    5151            KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
    5252                panic("Unable to map physical memory %p (%" PRIs " bytes).",
    53                     physaddr, size)
     53                    physaddr, size);
    5454       
    5555        uintptr_t virtaddr = PA2KA(last_frame);
  • kernel/arch/sparc64/Makefile.inc

    r387416b r99de22b  
    6565ARCH_SOURCES = \
    6666        arch/$(KARCH)/src/cpu/$(USARCH)/cpu.c \
     67        arch/$(KARCH)/src/debug/stacktrace.c \
     68        arch/$(KARCH)/src/debug/stacktrace_asm.S \
    6769        arch/$(KARCH)/src/asm.S \
    6870        arch/$(KARCH)/src/$(USARCH)/asm.S \
  • kernel/arch/sparc64/_link.ld.in

    r387416b r99de22b  
    3636                *(COMMON);                  /* global variables */
    3737               
     38                . = ALIGN(8);
    3839                symbol_table = .;
    3940                *(symtab.*);                /* Symbol table, must be LAST symbol!*/
  • kernel/arch/sparc64/include/interrupt.h

    r387416b r99de22b  
    5050};             
    5151
    52 typedef struct {
     52typedef struct istate {
    5353        uint64_t        tnpc;
    5454        uint64_t        tpc;
     
    7171}
    7272
     73static inline unative_t istate_get_fp(istate_t *istate)
     74{
     75        return 0;       /* TODO */
     76}
     77
    7378#endif
    7479
  • kernel/arch/sparc64/src/context.S

    r387416b r99de22b  
    2828
    2929#include <arch/context_offset.h>
    30 
    31 /**
    32  * Both context_save_arch() and context_restore_arch() are
    33  * leaf-optimized procedures. This kind of optimization
    34  * is very important and prevents any implicit window
    35  * spill/fill/clean traps in these very core kernel
    36  * functions.
    37  */
    38        
    39 #include <arch/context_offset.h>
     30#include <arch/arch.h>
     31#include <arch/regdef.h>
    4032
    4133.text   
     
    4436.global context_restore_arch
    4537
     38/*
     39 * context_save_arch() is required not to create its own stack frame. See the
     40 * generic context.h for explanation.
     41 */
    4642context_save_arch:
     43        #
     44        # Force all our active register windows to memory so that we can find
     45        # them there even if e.g. the thread is migrated to another processor.
     46        #
     47        flushw
     48
    4749        CONTEXT_SAVE_ARCH_CORE %o0
    4850        retl
     
    5153context_restore_arch:
    5254        #
    53         # Flush all active windows.
    54         # This is essential, because CONTEXT_LOAD overwrites
    55         # %sp of CWP - 1 with the value written to %fp of CWP.
    56         # Flushing all active windows mitigates this problem
    57         # as CWP - 1 becomes the overlap window.
     55        # Forget all previous windows, they are not going to be needed again.
     56        # Enforce a window fill on the next RESTORE instruction by setting
     57        # CANRESTORE to zero and other window configuration registers
     58        # accordingly. Note that the same can be achieved by executing the
     59        # FLUSHW instruction, but since we don't need to remember the previous
     60        # windows, we do the former and save thus some unnecessary window
     61        # spills.
    5862        #
    59         flushw
    60        
     63        rdpr %pstate, %l0
     64        andn %l0, PSTATE_IE_BIT, %l1
     65        wrpr %l1, %pstate
     66        wrpr %g0, 0, %canrestore
     67        wrpr %g0, 0, %otherwin
     68        wrpr %g0, NWINDOWS - 2, %cansave
     69        wrpr %l0, %pstate
     70
    6171        CONTEXT_RESTORE_ARCH_CORE %o0
    6272        retl
  • kernel/arch/sparc64/src/trap/sun4u/trap_table.S

    r387416b r99de22b  
    652652         * spilled to kernel memory (i.e. register window buffer). Moreover,
    653653         * if the scheduler was called in the meantime, all valid windows
    654          * belonging to other threads were spilled by context_restore().
     654         * belonging to other threads were spilled by context_save().
    655655         * If OTHERWIN is non-zero, then some userspace windows are still
    656656         * valid. Others might have been spilled. However, the CWP pointer
  • kernel/generic/include/debug.h

    r387416b r99de22b  
    7575#       define LOG(format, ...) \
    7676                printf("%s() at %s:%u: " format "\n", __func__, __FILE__, \
    77                         __LINE__, ##__VA_ARGS__);
     77                    __LINE__, ##__VA_ARGS__);
    7878#else
    7979#       define LOG(format, ...)
     
    9292                { \
    9393                        printf("%s() at %s:%u: " #fnc "\n", __func__, __FILE__, \
    94                         __LINE__); \
     94                            __LINE__); \
    9595                        fnc; \
    9696                }
  • kernel/generic/include/interrupt.h

    r387416b r99de22b  
    4242#include <arch.h>
    4343#include <ddi/irq.h>
     44#include <stacktrace.h>
    4445
    4546typedef void (* iroutine)(int n, istate_t *istate);
     
    4950        if (istate_from_uspace(istate)) { \
    5051                task_t *task = TASK; \
    51                 printf("Task %s (%" PRIu64 ") killed due to an exception at %p: ", task->name, task->taskid, istate_get_pc(istate)); \
    52                 printf(fmt "\n", ##__VA_ARGS__); \
     52                printf("Task %s (%" PRIu64 ") killed due to an exception at " \
     53                    "program counter %p.\n", task->name, task->taskid, istate_get_pc(istate)); \
     54                stack_trace_istate(istate); \
     55                printf("Kill message: " fmt "\n", ##__VA_ARGS__); \
    5356                task_kill(task->taskid); \
    5457                thread_exit(); \
  • kernel/generic/include/panic.h

    r387416b r99de22b  
    3636#define KERN_PANIC_H_
    3737
     38#include <stacktrace.h>
     39#include <print.h>
     40
    3841#ifdef CONFIG_DEBUG
    3942#       define panic(format, ...) \
    40                 panic_printf("Kernel panic in %s() at %s:%u: " format "\n", \
    41                 __func__, __FILE__, __LINE__, ##__VA_ARGS__);
     43                do { \
     44                        printf("Kernel panic in %s() at %s:%u.\n", \
     45                            __func__, __FILE__, __LINE__); \
     46                        stack_trace(); \
     47                        panic_printf("Panic message: " format "\n", \
     48                            ##__VA_ARGS__);\
     49                } while (0)
    4250#else
    4351#       define panic(format, ...) \
  • kernel/generic/include/symtab.h

    r387416b r99de22b  
    4545};
    4646
    47 extern int symtab_name_lookup(unative_t addr, char **name);
    48 extern char *symtab_fmt_name_lookup(unative_t addr);
    49 extern int symtab_addr_lookup(const char *name, uintptr_t *addr);
    50 extern void symtab_print_search(const char *name);
    51 extern int symtab_compl(char *input, size_t size);
     47extern int symtab_name_lookup(uintptr_t, char **, uintptr_t *);
     48extern char *symtab_fmt_name_lookup(uintptr_t);
     49extern int symtab_addr_lookup(const char *, uintptr_t *);
     50extern void symtab_print_search(const char *);
     51extern int symtab_compl(char *, size_t);
    5252
    5353#ifdef CONFIG_SYMTAB
  • kernel/generic/src/console/kconsole.c

    r387416b r99de22b  
    543543                if (str_lcmp(hlp->name, cmdline + start,
    544544                    max(str_length(hlp->name),
    545                     str_nlength(cmdline + start, (size_t) (end - start) - 1))) == 0) {
     545                    str_nlength(cmdline + start, (size_t) (end - start)))) == 0) {
    546546                        cmd = hlp;
    547547                        break;
  • kernel/generic/src/debug/symtab.c

    r387416b r99de22b  
    4646/** Get name of a symbol that seems most likely to correspond to address.
    4747 *
    48  * @param addr Address.
    49  * @param name Place to store pointer to the symbol name.
     48 * @param addr          Address.
     49 * @param name          Place to store pointer to the symbol name.
     50 * @param offset        Place to store offset from the symbol address.
    5051 *
    5152 * @return Zero on success or negative error code, ENOENT if not found,
     
    5354 *
    5455 */
    55 int symtab_name_lookup(unative_t addr, char **name)
     56int symtab_name_lookup(uintptr_t addr, char **name, uintptr_t *offset)
    5657{
    5758#ifdef CONFIG_SYMTAB
     
    6566        if (addr >= uint64_t_le2host(symbol_table[i - 1].address_le)) {
    6667                *name = symbol_table[i - 1].symbol_name;
     68                if (offset)
     69                        *offset = addr -
     70                            uint64_t_le2host(symbol_table[i - 1].address_le);
    6771                return EOK;
    6872        }
     
    8892 *
    8993 */
    90 char *symtab_fmt_name_lookup(unative_t addr)
     94char *symtab_fmt_name_lookup(uintptr_t addr)
    9195{
    9296        char *name;
    93         int rc = symtab_name_lookup(addr, &name);
     97        int rc = symtab_name_lookup(addr, &name, NULL);
    9498       
    9599        switch (rc) {
Note: See TracChangeset for help on using the changeset viewer.