Changeset 482f968 in mainline
- Timestamp:
- 2018-10-31T16:48:51Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 91a8f83, bab75df6
- Parents:
- 37781819
- Location:
- kernel
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/vreg.c
r37781819 r482f968 62 62 frame = frame_alloc(1, FRAME_ATOMIC | FRAME_HIGHMEM, 0); 63 63 if (!frame) 64 frame = frame_alloc(1, FRAME_ATOMIC | FRAME_LOWMEM, 0);65 if (!frame)66 64 panic("Cannot allocate VREG frame."); 67 65 -
kernel/arch/arm32/src/mm/page.c
r37781819 r482f968 69 69 #ifdef HIGH_EXCEPTION_VECTORS 70 70 /* Create mapping for exception table at high offset */ 71 uintptr_t ev_frame = frame_alloc(1, FRAME_ NONE, 0);71 uintptr_t ev_frame = frame_alloc(1, FRAME_HIGHMEM, 0); 72 72 page_mapping_insert(AS_KERNEL, EXC_BASE_ADDRESS, ev_frame, flags); 73 73 #else -
kernel/arch/arm32/src/ras.c
r37781819 r482f968 51 51 void ras_init(void) 52 52 { 53 uintptr_t frame = 54 frame_alloc(1, FRAME_ATOMIC | FRAME_HIGHMEM, 0); 55 if (!frame) 56 frame = frame_alloc(1, FRAME_LOWMEM, 0); 53 uintptr_t frame = frame_alloc(1, FRAME_HIGHMEM, 0); 57 54 58 55 ras_page = (uintptr_t *) km_map(frame, PAGE_SIZE, PAGE_SIZE, -
kernel/arch/ia32/src/vreg.c
r37781819 r482f968 63 63 frame = frame_alloc(1, FRAME_ATOMIC | FRAME_HIGHMEM, 0); 64 64 if (!frame) 65 frame = frame_alloc(1, FRAME_ATOMIC | FRAME_LOWMEM, 0);66 if (!frame)67 65 panic("Cannot allocate VREG frame."); 68 66 -
kernel/arch/ia64/src/mm/vhpt.c
r37781819 r482f968 44 44 { 45 45 uintptr_t vhpt_frame = 46 frame_alloc(SIZE2FRAMES(VHPT_SIZE), FRAME_ ATOMIC, 0);46 frame_alloc(SIZE2FRAMES(VHPT_SIZE), FRAME_LOWMEM | FRAME_ATOMIC, 0); 47 47 if (!vhpt_frame) 48 48 panic("Kernel configured with VHPT but no memory for table."); -
kernel/arch/sparc64/src/mm/sun4u/as.c
r37781819 r482f968 63 63 { 64 64 #ifdef CONFIG_TSB 65 uintptr_t tsb_base = frame_alloc(TSB_FRAMES, flags, TSB_SIZE - 1); 65 uintptr_t tsb_base = frame_alloc(TSB_FRAMES, FRAME_LOWMEM | flags, 66 TSB_SIZE - 1); 66 67 if (!tsb_base) 67 68 return ENOMEM; -
kernel/arch/sparc64/src/mm/sun4v/as.c
r37781819 r482f968 66 66 { 67 67 #ifdef CONFIG_TSB 68 uintptr_t tsb_base = frame_alloc(TSB_FRAMES, flags, TSB_SIZE - 1); 68 uintptr_t tsb_base = frame_alloc(TSB_FRAMES, FRAME_LOWMEM | flags, 69 TSB_SIZE - 1); 69 70 if (!tsb_base) 70 71 return ENOMEM; -
kernel/generic/include/mm/frame.h
r37781819 r482f968 59 59 /** Allocate a frame which can be identity-mapped. */ 60 60 #define FRAME_LOWMEM 0x08 61 /** Allocate a frame which cannot be identity-mapped. */ 61 /** 62 * Allocate a frame outside the identity-mapped region if possible. 63 * Fall back to low memory if that fails. 64 */ 62 65 #define FRAME_HIGHMEM 0x10 66 67 // NOTE: If neither FRAME_LOWMEM nor FRAME_HIGHMEM is set, FRAME_LOWMEM is 68 // assumed as a safe default, and a runtime warning may be issued. 69 // If both are set, FRAME_LOWMEM takes priority. 63 70 64 71 typedef uint8_t zone_flags_t; … … 78 85 /** Mask of zone bits that must be matched exactly. */ 79 86 #define ZONE_EF_MASK 0x07 80 81 #define FRAME_TO_ZONE_FLAGS(ff) \82 ((((ff) & FRAME_LOWMEM) ? ZONE_LOWMEM : \83 (((ff) & FRAME_HIGHMEM) ? ZONE_HIGHMEM : \84 ZONE_LOWMEM /* | ZONE_HIGHMEM */)) | \85 ZONE_AVAILABLE)86 87 87 88 #define ZONE_FLAGS_MATCH(zf, f) \ -
kernel/generic/src/ddi/ddi.c
r37781819 r482f968 385 385 return EINVAL; 386 386 387 // FIXME: probably need to ensure that the memory is suitable for DMA 387 388 *phys = frame_alloc(frames, FRAME_ATOMIC, constraint); 388 389 if (*phys == 0) -
kernel/generic/src/mm/frame.c
r37781819 r482f968 815 815 } 816 816 817 static size_t try_find_zone(size_t count, bool lowmem, 818 pfn_t frame_constraint, size_t hint) 819 { 820 if (!lowmem) { 821 size_t znum = find_free_zone(count, 822 ZONE_HIGHMEM | ZONE_AVAILABLE, frame_constraint, hint); 823 if (znum != (size_t) -1) 824 return znum; 825 } 826 827 return find_free_zone(count, ZONE_LOWMEM | ZONE_AVAILABLE, 828 frame_constraint, hint); 829 } 830 817 831 /** Allocate frames of physical memory. 818 832 * … … 843 857 irq_spinlock_lock(&zones.lock, true); 844 858 859 // TODO: Print diagnostic if neither is explicitly specified. 860 bool lowmem = (flags & FRAME_LOWMEM) || !(flags & FRAME_HIGHMEM); 861 845 862 /* 846 863 * First, find suitable frame zone. 847 864 */ 848 size_t znum = find_free_zone(count, FRAME_TO_ZONE_FLAGS(flags), 849 frame_constraint, hint); 865 size_t znum = try_find_zone(count, lowmem, frame_constraint, hint); 850 866 851 867 /* … … 859 875 860 876 if (freed > 0) 861 znum = find_free_zone(count, FRAME_TO_ZONE_FLAGS(flags),877 znum = try_find_zone(count, lowmem, 862 878 frame_constraint, hint); 863 879 … … 868 884 869 885 if (freed > 0) 870 znum = find_free_zone(count, FRAME_TO_ZONE_FLAGS(flags),886 znum = try_find_zone(count, lowmem, 871 887 frame_constraint, hint); 872 888 } -
kernel/generic/src/mm/km.c
r37781819 r482f968 121 121 return base; 122 122 else 123 return (uintptr_t) NULL;123 panic("Kernel ran out of virtual address space."); 124 124 } 125 125 … … 256 256 uintptr_t frame; 257 257 258 frame = frame_alloc(1, FRAME_HIGHMEM | FRAME_ATOMIC |flags, 0);259 if (frame ) {258 frame = frame_alloc(1, FRAME_HIGHMEM | flags, 0); 259 if (frame >= config.identity_size) { 260 260 page = km_map(frame, PAGE_SIZE, PAGE_SIZE, 261 261 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE); 262 if (!page) {263 frame_free(frame, 1);264 goto lowmem;265 }266 262 } else { 267 lowmem:268 frame = frame_alloc(1, FRAME_LOWMEM | flags, 0);269 if (!frame)270 return (uintptr_t) NULL;271 272 263 page = PA2KA(frame); 273 264 } -
kernel/generic/src/mm/slab.c
r37781819 r482f968 188 188 189 189 uintptr_t data_phys = 190 frame_alloc_generic(cache->frames, flags, 0, &zone);190 frame_alloc_generic(cache->frames, FRAME_LOWMEM | flags, 0, &zone); 191 191 if (!data_phys) 192 192 return NULL; -
kernel/generic/src/time/clock.c
r37781819 r482f968 81 81 void clock_counter_init(void) 82 82 { 83 uintptr_t faddr = frame_alloc(1, FRAME_ ATOMIC, 0);83 uintptr_t faddr = frame_alloc(1, FRAME_LOWMEM | FRAME_ATOMIC, 0); 84 84 if (faddr == 0) 85 85 panic("Cannot allocate page for clock."); -
kernel/test/mm/mapping1.c
r37781819 r482f968 41 41 const char *test_mapping1(void) 42 42 { 43 uintptr_t frame = frame_alloc(1, FRAME_ NONE, 0);43 uintptr_t frame = frame_alloc(1, FRAME_HIGHMEM, 0); 44 44 45 45 uintptr_t page0 = km_map(frame, FRAME_SIZE, FRAME_SIZE,
Note:
See TracChangeset
for help on using the changeset viewer.