Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 2277e03 in mainline


Ignore:
Timestamp:
2013-03-07T22:53:05Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
850235d, e4a1497
Parents:
31399f3
Message:

For all but ia64, make the actual istate_t location match istate_get().

  • Drop SP_DELTA from the calculation of the bottom of the kernel stack.
  • Make the kernel stack start at its last address (except for ia64).
  • Add alignment to istate_t where needed.
  • istate_get() on ia64 still returns a wrong address.
Location:
kernel/arch
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/src/arm32.c

    r31399f3 r2277e03  
    138138        uint8_t *stck;
    139139       
    140         stck = &THREAD->kstack[STACK_SIZE - SP_DELTA];
     140        stck = &THREAD->kstack[STACK_SIZE];
    141141        supervisor_sp = (uintptr_t) stck;
    142142}
  • kernel/arch/ia64/include/istate.h

    r31399f3 r2277e03  
    106106        uint64_t in5;
    107107        uint64_t in6;
     108
     109        uint64_t alignment;
    108110} istate_t;
    109111
  • kernel/arch/ia64/src/ivt.S

    r31399f3 r2277e03  
    3535#define FRS_TO_SAVE 30
    3636#define STACK_ITEMS             (21 + FRS_TO_SAVE * 2)
    37 #define STACK_FRAME_SIZE        ALIGN_UP((STACK_ITEMS*STACK_ITEM_SIZE) + STACK_SCRATCH_AREA_SIZE, STACK_ALIGNMENT)
     37#define STACK_FRAME_SIZE        ALIGN_UP((STACK_ITEMS * STACK_ITEM_SIZE) + STACK_SCRATCH_AREA_SIZE, STACK_ALIGNMENT)
    3838
    3939#if (STACK_ITEMS % 2 == 0)
  • kernel/arch/ia64/src/proc/scheduler.c

    r31399f3 r2277e03  
    9090                :
    9191                : "r" (&THREAD->kstack[STACK_SIZE / 2]),
    92                   "r" (&THREAD->kstack[STACK_SIZE / 2 - SP_DELTA])
     92                  "r" (&THREAD->kstack[STACK_SIZE / 2])
    9393                );
    9494}
  • kernel/arch/mips32/src/mips32.c

    r31399f3 r2277e03  
    228228{
    229229        supervisor_sp =
    230             (uintptr_t) &THREAD->kstack[STACK_SIZE - SP_DELTA];
     230            (uintptr_t) &THREAD->kstack[STACK_SIZE];
    231231}
    232232
  • kernel/arch/mips64/src/mips64.c

    r31399f3 r2277e03  
    205205{
    206206        supervisor_sp =
    207             (uintptr_t) &THREAD->kstack[STACK_SIZE - SP_DELTA];
     207            (uintptr_t) &THREAD->kstack[STACK_SIZE];
    208208}
    209209
  • kernel/arch/ppc32/src/proc/scheduler.c

    r31399f3 r2277e03  
    5555        asm volatile (
    5656                "mtsprg0 %[ksp]\n"
    57                 :: [ksp] "r" (KA2PA(&THREAD->kstack[STACK_SIZE - SP_DELTA]))
     57                :: [ksp] "r" (KA2PA(&THREAD->kstack[STACK_SIZE]))
    5858        );
    5959}
  • kernel/arch/sparc64/src/proc/sun4u/scheduler.c

    r31399f3 r2277e03  
    5252{
    5353        if (THREAD->uspace) {
     54                uint64_t sp;
     55
    5456                /*
    5557                 * Write kernel stack address to %g6 of the alternate and
     
    6365                 *   before it explicitly uses %g7.
    6466                 */
    65                 uint64_t sp = (uintptr_t) THREAD->kstack + STACK_SIZE -
    66                     (STACK_BIAS + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT));
     67                sp = (uintptr_t) THREAD->kstack + STACK_SIZE - STACK_BIAS;
    6768                write_to_ig_g6(sp);
    6869                write_to_ag_g6(sp);
     
    7677        if (THREAD->uspace) {
    7778                /* sample the state of the userspace window buffer */
    78                 THREAD->arch.uspace_window_buffer = (uint8_t *) read_from_ag_g7();
     79                THREAD->arch.uspace_window_buffer =
     80                    (uint8_t *) read_from_ag_g7();
    7981        }
    8082}
  • kernel/arch/sparc64/src/proc/sun4v/scheduler.c

    r31399f3 r2277e03  
    5555{
    5656        if (THREAD->uspace) {
    57                 uint64_t sp = (uintptr_t) THREAD->kstack + STACK_SIZE -
    58                     (STACK_BIAS + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT));
     57                uint64_t sp;
     58
     59                sp = (uintptr_t) THREAD->kstack + STACK_SIZE - STACK_BIAS;
    5960                asi_u64_write(ASI_SCRATCHPAD, SCRATCHPAD_KSTACK, sp);
    6061                asi_u64_write(ASI_SCRATCHPAD, SCRATCHPAD_WBUF,
Note: See TracChangeset for help on using the changeset viewer.