Changes in / [3500f75:7c8e1e1] in mainline


Ignore:
Location:
kernel/arch/sparc64
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/include/asm.h

    r3500f75 r7c8e1e1  
    446446extern void asm_delay_loop(const uint32_t usec);
    447447
     448extern uint64_t read_from_ag_g6(void);
    448449extern uint64_t read_from_ag_g7(void);
    449450extern void write_to_ag_g6(uint64_t val);
  • kernel/arch/sparc64/include/trap/trap_table.h

    r3500f75 r7c8e1e1  
    4242#define TRAP_TABLE_SIZE         (TRAP_TABLE_ENTRY_COUNT * TRAP_TABLE_ENTRY_SIZE)
    4343
     44/*
     45 * The following needs to be in sync with the definition of the istate
     46 * structure. The one STACK_ITEM_SIZE is counted for space holding the 7th
     47 * argument to syscall_handler (i.e. syscall number) and the other
     48 * STACK_ITEM_SIZE is counted because of the required alignment.
     49 */
     50#define PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE \
     51    (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE + \
     52    (2 * STACK_ITEM_SIZE) + (12 * 8))
     53#define SAVED_TSTATE    -(1 * 8)
     54#define SAVED_TPC       -(2 * 8)
     55#define SAVED_TNPC      -(3 * 8)        /* <-- istate_t begins here */
     56#define SAVED_Y         -(4 * 8)
     57#define SAVED_I0        -(5 * 8)
     58#define SAVED_I1        -(6 * 8)
     59#define SAVED_I2        -(7 * 8)
     60#define SAVED_I3        -(8 * 8)
     61#define SAVED_I4        -(9 * 8)
     62#define SAVED_I5        -(10 * 8)
     63#define SAVED_I6        -(11 * 8)
     64#define SAVED_I7        -(12 * 8)
     65
    4466#ifndef __ASM__
    4567
     
    7799.endm
    78100
    79 /*
    80  * The following needs to be in sync with the definition of the istate
    81  * structure. The one STACK_ITEM_SIZE is counted for space holding the 7th
    82  * argument to syscall_handler (i.e. syscall number) and the other
    83  * STACK_ITEM_SIZE is counted because of the required alignment.
    84  */
    85 #define PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE    \
    86     (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE + \
    87     (2 * STACK_ITEM_SIZE) + (12 * 8))
    88 #define SAVED_TSTATE    -(1 * 8)
    89 #define SAVED_TPC       -(2 * 8)
    90 #define SAVED_TNPC      -(3 * 8)        /* <-- istate_t begins here */
    91 #define SAVED_Y         -(4 * 8)
    92 #define SAVED_I0        -(5 * 8)
    93 #define SAVED_I1        -(6 * 8)
    94 #define SAVED_I2        -(7 * 8)
    95 #define SAVED_I3        -(8 * 8)
    96 #define SAVED_I4        -(9 * 8)
    97 #define SAVED_I5        -(10 * 8)
    98 #define SAVED_I6        -(11 * 8)
    99 #define SAVED_I7        -(12 * 8)
    100 
    101101.macro PREEMPTIBLE_HANDLER f
    102102        sethi %hi(\f), %g1
    103         b preemptible_handler
     103        ba %xcc, preemptible_handler
    104104        or %g1, %lo(\f), %g1
    105105.endm
  • kernel/arch/sparc64/src/debug/stacktrace.c

    r3500f75 r7c8e1e1  
    3737#include <typedefs.h>
    3838
     39#include <arch.h>
     40#include <arch/stack.h>
     41#include <arch/trap/trap_table.h>
     42
     43#if defined(SUN4V)
     44#include <arch/sun4v/arch.h>
     45#endif
     46
     47#define FRAME_OFFSET_FP_PREV    14
     48#define FRAME_OFFSET_RA         15
     49
     50extern void alloc_window_and_flush(void);
     51
    3952bool kernel_frame_pointer_validate(uintptr_t fp)
    4053{
    41         return false;
     54        uintptr_t kstack;
     55       
     56#if defined(SUN4U)
     57        kstack = read_from_ag_g6();
     58#elif defined(SUN4V)
     59        kstack = asi_u64_read(ASI_SCRATCHPAD, SCRATCHPAD_KSTACK);
     60#endif
     61
     62        kstack += STACK_BIAS;
     63        kstack -= PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE;
     64
     65        if (THREAD && (fp == kstack))
     66                return false;
     67        return fp != 0;
    4268}
    4369
    4470bool kernel_frame_pointer_prev(uintptr_t fp, uintptr_t *prev)
    4571{
    46         return false;
     72        uint64_t *stack = (void *) fp;
     73        alloc_window_and_flush();
     74        *prev = stack[FRAME_OFFSET_FP_PREV] + STACK_BIAS;
     75        return true;
    4776}
    4877
    4978bool kernel_return_address_get(uintptr_t fp, uintptr_t *ra)
    5079{
    51         return false;
     80        uint64_t *stack = (void *) fp;
     81        alloc_window_and_flush();
     82        *ra = stack[FRAME_OFFSET_RA];
     83        return true;
    5284}
    5385
  • kernel/arch/sparc64/src/debug/stacktrace_asm.S

    r3500f75 r7c8e1e1  
    2727#
    2828
     29#include <arch/stack.h>
     30
    2931.text
    3032
    3133.global frame_pointer_get
    3234.global program_counter_get
     35.global alloc_window_and_flush
    3336
    3437frame_pointer_get:
     38        # Add the stack bias to %sp to get the actual address.
    3539        retl
    36         nop
     40        add %sp, STACK_BIAS, %o0
    3741
    3842program_counter_get:
    3943        retl
    40         nop
     44        mov %o7, %o0
    4145
     46alloc_window_and_flush:
     47        save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE+STACK_ARG_SAVE_AREA_SIZE), %sp
     48        # Flush all other windows to memory so that we can read their contents.
     49        flushw
     50        ret
     51        restore
     52
  • kernel/arch/sparc64/src/sun4u/asm.S

    r3500f75 r7c8e1e1  
    6767        WRITE_ALTERNATE_REGISTER %g6, PSTATE_IG_BIT
    6868
     69.global read_from_ag_g6
     70read_from_ag_g6:
     71        READ_ALTERNATE_REGISTER %g6, PSTATE_AG_BIT
     72
    6973.global read_from_ag_g7
    7074read_from_ag_g7:
  • kernel/arch/sparc64/src/sun4v/start.S

    r3500f75 r7c8e1e1  
    219219        ! on APs skip executing the following code
    220220        cmp %l7, 0
    221         be 1f
     221        be %xcc, 1f
    222222        nop
    223223
     
    260260
    2612610:
    262         ba 0b
     262        ba %xcc, 0b
    263263        nop
    264264
     
    295295        /* Not reached. */
    2962960:
    297         ba 0b
     297        ba %xcc, 0b
    298298        nop
    299299
     
    314314before_ap_boots:
    315315        setx 0x80400000, %g0, %o0
    316         ba kernel_image_start
     316        ba %xcc, kernel_image_start
    317317        nop
    318318
  • kernel/arch/sparc64/src/trap/sun4v/trap_table.S

    r3500f75 r7c8e1e1  
    7171.org trap_table + TT_INSTRUCTION_ACCESS_MMU_MISS*ENTRY_SIZE
    7272.global instruction_access_mmu_miss_handler_tl0
    73         ba fast_instruction_access_mmu_miss_handler_tl0
     73        ba %xcc, fast_instruction_access_mmu_miss_handler_tl0
    7474        nop
    7575
     
    187187.global data_access_mmu_miss_tl0
    188188data_access_mmu_miss_tl0:
    189         ba fast_data_access_mmu_miss_handler_tl0
     189        ba %xcc, fast_data_access_mmu_miss_handler_tl0
    190190        nop
    191191
     
    394394.global trap_instruction_\cur\()_tl0
    395395trap_instruction_\cur\()_tl0:
    396         ba trap_instruction_handler
     396        ba %xcc, trap_instruction_handler
    397397        mov \cur, %g2
    398398.endr
     
    414414.global instruction_access_mmu_miss_handler_tl1
    415415        wrpr %g0, 1, %tl
    416         ba fast_instruction_access_mmu_miss_handler_tl0
     416        ba %xcc, fast_instruction_access_mmu_miss_handler_tl0
    417417        nop
    418418
     
    498498.global data_access_mmu_miss_tl1
    499499data_access_mmu_miss_tl1:
    500         ba fast_data_access_mmu_miss_handler_tl1
     500        ba %xcc, fast_data_access_mmu_miss_handler_tl1
    501501        nop
    502502
     
    787787        be 1f
    788788        nop
    789 0:      ba 0b                                   ! this is for debugging, if we ever get here
     7890:      ba %xcc, 0b                             ! this is for debugging, if we ever get here
    790790        nop                                     ! it will be easy to find
    791791
     
    982982        wrpr %g3, 0, %cwp                       ! switch to the preceeding window
    983983
    984         ba 5b
     984        ba %xcc, 5b
    985985        inc %g4
    986986
     
    10661066
    10671067        PREEMPTIBLE_HANDLER_KERNEL
    1068         ba 101f
     1068        ba %xcc, 101f
    10691069        nop
    10701070
Note: See TracChangeset for help on using the changeset viewer.