Changes in / [234e39e:9245413] in mainline


Ignore:
Files:
16 deleted
36 edited

Legend:

Unmodified
Added
Removed
  • kernel/Makefile.build

    r234e39e r9245413  
    186186        generic/src/ddi/device.c \
    187187        generic/src/debug/symtab.c \
    188         generic/src/debug/stacktrace.c \
    189188        generic/src/interrupt/interrupt.c \
    190189        generic/src/main/main.c \
  • kernel/arch/amd64/Makefile.inc

    r234e39e r9245413  
    3838
    3939FPU_NO_CFLAGS = -mno-sse -mno-sse2
    40 CMN1 = -m64 -mcmodel=kernel -mno-red-zone -fno-unwind-tables -fno-omit-frame-pointer
     40CMN1 = -m64 -mcmodel=kernel -mno-red-zone -fno-unwind-tables
    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 \
    6462        arch/$(KARCH)/src/pm.c \
    6563        arch/$(KARCH)/src/context.S \
  • kernel/arch/amd64/include/context.h

    r234e39e r9245413  
    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 
    5548#endif /* KERNEL */
    5649
  • kernel/arch/amd64/include/interrupt.h

    r234e39e r9245413  
    7070
    7171/** This is passed to interrupt handlers */
    72 typedef struct istate {
     72typedef struct {
    7373        uint64_t rax;
    7474        uint64_t rcx;
     
    8080        uint64_t r10;
    8181        uint64_t r11;
    82         uint64_t rbp;
    8382        uint64_t error_word;
    8483        uint64_t rip;
     
    102101        return istate->rip;
    103102}
    104 static inline unative_t istate_get_fp(istate_t *istate)
    105 {
    106         return istate->rbp;
    107 }
    108103
    109104extern void (* disable_irqs_function)(uint16_t irqmask);
  • kernel/arch/amd64/src/asm_utils.S

    r234e39e r9245413  
    2727#
    2828
    29 #define IREGISTER_SPACE 80
     29#define IREGISTER_SPACE 72
    3030
    3131#define IOFFSET_RAX     0x0
     
    3838#define IOFFSET_R10     0x38
    3939#define IOFFSET_R11     0x40
    40 #define IOFFSET_RBP     0x48
    4140
    4241#  Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int has no error word
     
    180179        movq %r10, IOFFSET_R10(%rsp)
    181180        movq %r11, IOFFSET_R11(%rsp)
    182         movq %rbp, IOFFSET_RBP(%rsp)
    183181.endm
    184182
     
    193191        movq IOFFSET_R10(%rsp), %r10
    194192        movq IOFFSET_R11(%rsp), %r11
    195         movq IOFFSET_RBP(%rsp), %rbp
    196193.endm
    197194
     
    238235        cld
    239236
    240         # Stop stack traces here
    241         xorq %rbp, %rbp
    242 
    243237        movq $(\i), %rdi        # %rdi - first parameter
    244238        movq %rsp, %rsi         # %rsi - pointer to istate
  • kernel/arch/amd64/src/boot/boot.S

    r234e39e r9245413  
    174174        call arch_pre_main
    175175       
    176         # create the first stack frame
    177         pushq $0
    178         movq %rsp, %rbp
    179 
    180176        call main_bsp
    181177       
  • kernel/arch/amd64/src/interrupt.c

    r234e39e r9245413  
    5353#include <ddi/irq.h>
    5454#include <symtab.h>
    55 #include <stacktrace.h>
    5655
    5756/*
     
    8180            istate->r10, istate->r11);
    8281        printf("%%rsp=%#llx\n", &istate->stack[0]);
    83        
    84         stack_trace_istate(istate);
    8582}
    8683
  • kernel/arch/amd64/src/mm/page.c

    r234e39e r9245413  
    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,
    206                     size);
     205                panic("Unable to map physical memory %p (%d bytes).", physaddr, size)
    207206       
    208207        uintptr_t virtaddr = PA2KA(last_frame);
  • kernel/arch/amd64/src/smp/ap.S

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

    r234e39e r9245413  
    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 \
    6159        arch/$(KARCH)/src/mm/as.c \
    6260        arch/$(KARCH)/src/mm/frame.c \
  • kernel/arch/arm32/include/exception.h

    r234e39e r9245413  
    8686
    8787/** Struct representing CPU state saved when an exception occurs. */
    88 typedef struct istate {
     88typedef struct {
    8989        uint32_t spsr;
    9090        uint32_t sp;
     
    133133}
    134134
    135 static inline unative_t istate_get_fp(istate_t *istate)
    136 {
    137         return istate->r11;
    138 }
    139 
    140135
    141136extern void install_exception_handlers(void);
  • kernel/arch/arm32/src/mm/page.c

    r234e39e r9245413  
    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/ia32/Makefile.inc

    r234e39e r9245413  
    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 \
    8280        arch/$(KARCH)/src/delay.s \
    8381        arch/$(KARCH)/src/asm.S \
  • kernel/arch/ia32/include/context.h

    r234e39e r9245413  
    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 
    5851#endif /* KERNEL */
    5952
  • kernel/arch/ia32/include/interrupt.h

    r234e39e r9245413  
    6969#define VECTOR_DEBUG_IPI                (IVT_FREEBASE + 2)
    7070
    71 typedef struct istate {
     71typedef struct {
    7272        uint32_t eax;
    7373        uint32_t ecx;
    7474        uint32_t edx;
    75         uint32_t ebp;
    7675
    7776        uint32_t gs;
     
    103102}
    104103
    105 static inline unative_t istate_get_fp(istate_t *istate)
    106 {
    107         return istate->ebp;
    108 }
    109 
    110104extern void (* disable_irqs_function)(uint16_t irqmask);
    111105extern void (* enable_irqs_function)(uint16_t irqmask);
  • kernel/arch/ia32/src/asm.S

    r234e39e r9245413  
    269269        pushl %gs
    270270
    271         pushl %ebp
    272271        pushl %edx
    273272        pushl %ecx
     
    279278        movw %ax, %es
    280279
    281         # stop stack traces here
    282         xorl %ebp, %ebp
     280        cld
    283281
    284282        pushl %esp          # *istate
     
    292290        popl %ecx
    293291        popl %edx
    294         popl %ebp
    295292       
    296293        popl %gs
  • kernel/arch/ia32/src/boot/boot.S

    r234e39e r9245413  
    9494        pushl grub_eax
    9595        call arch_pre_main
    96 
    97         # Create the first stack frame
    98         pushl $0
    99         movl %esp, %ebp
    10096       
    10197        call main_bsp
  • kernel/arch/ia32/src/interrupt.c

    r234e39e r9245413  
    5353#include <ddi/irq.h>
    5454#include <symtab.h>
    55 #include <stacktrace.h>
    5655
    5756/*
     
    8079        printf("stack: %#lx, %#lx, %#lx, %#lx\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]);
    8180        printf("       %#lx, %#lx, %#lx, %#lx\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]);
    82 
    83         stack_trace_istate(istate);
    8481}
    8582
  • kernel/arch/ia32/src/mm/page.c

    r234e39e r9245413  
    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

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

    r234e39e r9245413  
    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 \
    5755        arch/$(KARCH)/src/ivt.S \
    5856        arch/$(KARCH)/src/interrupt.c \
  • kernel/arch/ia64/include/interrupt.h

    r234e39e r9245413  
    7272#define EOI  0  /**< The actual value doesn't matter. */
    7373
    74 typedef struct istate {
     74typedef struct {
    7575        uint128_t f2;
    7676        uint128_t f3;
     
    143143}
    144144
    145 static inline unative_t istate_get_fp(istate_t *istate)
    146 {
    147         return 0;       /* FIXME */
    148 }
    149 
    150145static inline int istate_from_uspace(istate_t *istate)
    151146{
  • kernel/arch/mips32/Makefile.inc

    r234e39e r9245413  
    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 \
    7472        arch/$(KARCH)/src/mm/frame.c \
    7573        arch/$(KARCH)/src/mm/page.c \
  • kernel/arch/mips32/include/exception.h

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

    r234e39e r9245413  
    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 \
    5048        arch/$(KARCH)/src/fpu_context.S \
    5149        arch/$(KARCH)/src/boot/boot.S \
  • kernel/arch/ppc32/include/exception.h

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

    r234e39e r9245413  
    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

    r234e39e r9245413  
    5454ARCH_SOURCES = \
    5555        arch/$(KARCH)/src/cpu/cpu.c \
    56         arch/$(KARCH)/src/debug/stacktrace.c \
    57         arch/$(KARCH)/src/debug/stacktrace_asm.S \
    5856        arch/$(KARCH)/src/asm.S \
    5957        arch/$(KARCH)/src/panic.S \
  • kernel/arch/sparc64/include/interrupt.h

    r234e39e r9245413  
    5050};             
    5151
    52 typedef struct istate {
     52typedef struct {
    5353        uint64_t        tnpc;
    5454        uint64_t        tpc;
     
    7171}
    7272
    73 static inline unative_t istate_get_fp(istate_t *istate)
    74 {
    75         return 0;       /* TODO */
    76 }
    77 
    7873#endif
    7974
  • kernel/generic/include/debug.h

    r234e39e r9245413  
    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

    r234e39e r9245413  
    4242#include <arch.h>
    4343#include <ddi/irq.h>
    44 #include <stacktrace.h>
    4544
    4645typedef void (* iroutine)(int n, istate_t *istate);
     
    5049        if (istate_from_uspace(istate)) { \
    5150                task_t *task = TASK; \
    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__); \
     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__); \
    5653                task_kill(task->taskid); \
    5754                thread_exit(); \
  • kernel/generic/include/panic.h

    r234e39e r9245413  
    3636#define KERN_PANIC_H_
    3737
    38 #include <stacktrace.h>
    39 #include <print.h>
    40 
    4138#ifdef CONFIG_DEBUG
    4239#       define panic(format, ...) \
    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)
     40                panic_printf("Kernel panic in %s() at %s:%u: " format "\n", \
     41                __func__, __FILE__, __LINE__, ##__VA_ARGS__);
    5042#else
    5143#       define panic(format, ...) \
  • kernel/generic/include/symtab.h

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

    r234e39e r9245413  
    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.
    50  * @param offset        Place to store offset from the symbol address.
     48 * @param addr Address.
     49 * @param name Place to store pointer to the symbol name.
    5150 *
    5251 * @return Zero on success or negative error code, ENOENT if not found,
     
    5453 *
    5554 */
    56 int symtab_name_lookup(uintptr_t addr, char **name, uintptr_t *offset)
     55int symtab_name_lookup(unative_t addr, char **name)
    5756{
    5857#ifdef CONFIG_SYMTAB
     
    6665        if (addr >= uint64_t_le2host(symbol_table[i - 1].address_le)) {
    6766                *name = symbol_table[i - 1].symbol_name;
    68                 if (offset)
    69                         *offset = addr -
    70                             uint64_t_le2host(symbol_table[i - 1].address_le);
    7167                return EOK;
    7268        }
     
    9288 *
    9389 */
    94 char *symtab_fmt_name_lookup(uintptr_t addr)
     90char *symtab_fmt_name_lookup(unative_t addr)
    9591{
    9692        char *name;
    97         int rc = symtab_name_lookup(addr, &name, NULL);
     93        int rc = symtab_name_lookup(addr, &name);
    9894       
    9995        switch (rc) {
  • uspace/lib/libc/generic/stacktrace.c

    r234e39e r9245413  
    3939void stack_trace_fp_pc(uintptr_t fp, uintptr_t pc)
    4040{
     41        printf("Printing stack trace:\n");
     42        printf("=====================\n");
    4143        while (frame_pointer_validate(fp)) {
    4244                printf("%p: %p()\n", fp, pc);
     
    4446                fp = frame_pointer_prev(fp);
    4547        }
     48        printf("=====================\n");
    4649}
    4750
  • uspace/lib/libc/include/assert.h

    r234e39e r9245413  
    5151
    5252#ifndef NDEBUG
    53 #       define assert(expr) \
    54                 do { \
    55                         if (!(expr)) { \
    56                                 printf("Assertion failed (%s) at file '%s', " \
    57                                     "line %d.\n", #expr, __FILE__, __LINE__); \
    58                                 abort(); \
    59                         } \
    60                 } while (0)
     53#       define assert(expr) if (!(expr)) { printf("Assertion failed (%s) at file '%s', line %d.\n", #expr, __FILE__, __LINE__); abort();}
    6154#else
    6255#       define assert(expr)
Note: See TracChangeset for help on using the changeset viewer.