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

Changeset 730ff63 in mainline


Ignore:
Timestamp:
2013-09-03T19:13:37Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
b3cf946
Parents:
1b34360
Message:

Do not create kernel identity over the entire address space on sun4v.

Location:
kernel/arch/sparc64
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/include/arch/mm/frame.h

    r1b34360 r730ff63  
    4646#endif
    4747
     48#ifndef __ASM__
     49
     50#include <typedefs.h>
     51
     52extern uintptr_t end_of_identity;
     53
     54extern void frame_low_arch_init(void);
     55extern void frame_high_arch_init(void);
     56#define physmem_print()
     57
     58#endif
     59
    4860#endif
    4961
  • kernel/arch/sparc64/include/arch/mm/sun4u/frame.h

    r1b34360 r730ff63  
    7272typedef union frame_address frame_address_t;
    7373
    74 extern uintptr_t end_of_identity;
    75 
    76 extern void frame_low_arch_init(void);
    77 extern void frame_high_arch_init(void);
    78 #define physmem_print()
    79 
    8074#endif
    8175
  • kernel/arch/sparc64/include/arch/mm/sun4v/frame.h

    r1b34360 r730ff63  
    4242#define FRAME_SIZE              (1 << FRAME_WIDTH)
    4343
    44 #ifndef __ASM__
    45 
    46 #include <typedefs.h>
    47 
    48 extern void frame_low_arch_init(void);
    49 extern void frame_high_arch_init(void);
    50 #define physmem_print()
    51 
    52 #endif
    53 
    5444#endif
    5545
  • kernel/arch/sparc64/include/arch/trap/sun4v/mmu.h

    r1b34360 r730ff63  
    102102        nop
    103103
     104        /* exclude pages beyond the end of memory from the identity mapping */
     105        sethi %hi(end_of_identity), %g4
     106        ldx [%g4 + %lo(end_of_identity)], %g4
     107        cmp %g1, %g4
     108        bgeu %xcc, 0f
     109        nop
     110
    104111        /*
    105112         * Installing the identity does not fit into 32 instructions, call
  • kernel/arch/sparc64/src/mm/sun4v/frame.c

    r1b34360 r730ff63  
    101101         */
    102102        frame_mark_unavailable(ADDR2PFN(KA2PA(PFN2ADDR(0))), 1);
     103
     104        /* PA2KA will work only on low-memory. */
     105        end_of_identity = PA2KA(config.physmem_end - FRAME_SIZE) + PAGE_SIZE;
    103106}
    104107
  • kernel/arch/sparc64/src/mm/sun4v/tlb.c

    r1b34360 r730ff63  
    251251        uintptr_t va = DMISS_ADDRESS(page_and_ctx);
    252252        uint16_t ctx = DMISS_CONTEXT(page_and_ctx);
     253        as_t *as = AS;
    253254
    254255        if (ctx == ASID_KERNEL) {
     
    256257                        /* NULL access in kernel */
    257258                        panic("NULL pointer dereference.");
     259                } else if (va >= end_of_identity) {
     260                        /* Kernel non-identity */
     261                        as = AS_KERNEL;
     262                } else {
     263                        panic("Unexpected kernel page fault.");
    258264                }
    259                 panic("Unexpected kernel page fault.");
    260         }
    261 
    262         t = page_mapping_find(AS, va, true);
     265        }
     266
     267        t = page_mapping_find(as, va, true);
    263268        if (t) {
    264269                /*
     
    295300        uintptr_t va = DMISS_ADDRESS(page_and_ctx);
    296301        uint16_t ctx = DMISS_CONTEXT(page_and_ctx);
    297 
    298         t = page_mapping_find(AS, va, true);
     302        as_t *as = AS;
     303
     304        if (ctx == ASID_KERNEL)
     305                as = AS_KERNEL;
     306
     307        t = page_mapping_find(as, va, true);
    299308        if (t && PTE_WRITABLE(t)) {
    300309                /*
  • kernel/arch/sparc64/src/sun4v/start.S

    r1b34360 r730ff63  
    345345        .quad 0
    346346
     347/*
     348 * This variable is used by the fast_data_access_MMU_miss trap handler.
     349 * In runtime, it is modified to contain the address of the end of physical
     350 * memory.
     351 */
     352.global end_of_identity
     353end_of_identity:
     354        .quad -1
     355
    347356.global kernel_8k_tlb_data_template
    348357kernel_8k_tlb_data_template:
Note: See TracChangeset for help on using the changeset viewer.