Changeset f275cb3 in mainline
- Timestamp:
- 2006-01-08T16:35:41Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b2c92f33
- Parents:
- 677a6d5
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/mips32/src/mm/page.c
r677a6d5 rf275cb3 43 43 page_operations = &page_pt_operations; 44 44 45 ptl0 = frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME );45 ptl0 = frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME, NULL); 46 46 memsetb(ptl0, FRAME_SIZE, 0); 47 47 -
genarch/src/mm/page_pt.c
r677a6d5 rf275cb3 64 64 65 65 if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) { 66 newpt = frame_alloc(FRAME_KA, ONE_FRAME );66 newpt = frame_alloc(FRAME_KA, ONE_FRAME, NULL); 67 67 memsetb(newpt, PAGE_SIZE, 0); 68 68 SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page), KA2PA(newpt)); … … 73 73 74 74 if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) { 75 newpt = frame_alloc(FRAME_KA, ONE_FRAME );75 newpt = frame_alloc(FRAME_KA, ONE_FRAME, NULL); 76 76 memsetb(newpt, PAGE_SIZE, 0); 77 77 SET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page), KA2PA(newpt)); … … 82 82 83 83 if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) { 84 newpt = frame_alloc(FRAME_KA, ONE_FRAME );84 newpt = frame_alloc(FRAME_KA, ONE_FRAME, NULL); 85 85 memsetb(newpt, PAGE_SIZE, 0); 86 86 SET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page), KA2PA(newpt)); -
generic/include/mm/frame.h
r677a6d5 rf275cb3 39 39 #define ONE_FRAME 0 40 40 41 #define FRAME_KA 1 /* skip frames conflicting with user address space */ 42 #define FRAME_PANIC 2 /* panic on failure */ 41 #define FRAME_KA 1 /* skip frames conflicting with user address space */ 42 #define FRAME_PANIC 2 /* panic on failure */ 43 #define FRAME_NON_BLOCKING 4 /* do not panic and do not sleep on failure */ 44 45 #define FRAME_OK 0 /* frame_alloc return status */ 46 #define FRAME_NO_MEMORY 1 /* frame_alloc return status */ 47 #define FRAME_ERROR 2 /* frame_alloc return status */ 43 48 44 49 #define FRAME2ADDR(zone, frame) ((zone)->base + ((frame) - (zone)->frames) * FRAME_SIZE) … … 89 94 extern void frame_init(void); 90 95 extern void frame_initialize(frame_t *frame, zone_t *zone); 91 __address frame_alloc(int flags, __u8 order); 96 97 __address frame_alloc(int flags, __u8 order, int * status); 92 98 extern void frame_free(__address addr); 99 93 100 zone_t * get_zone_by_frame(frame_t * frame); 94 101 -
generic/src/cpu/cpu.c
r677a6d5 rf275cb3 62 62 63 63 for (i=0; i < config.cpu_count; i++) { 64 cpus[i].stack = (__u8 *) frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME );64 cpus[i].stack = (__u8 *) frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME, NULL); 65 65 66 66 cpus[i].id = i; -
generic/src/mm/frame.c
r677a6d5 rf275cb3 84 84 * @return Allocated frame. 85 85 */ 86 __address frame_alloc(int flags, __u8 order )86 __address frame_alloc(int flags, __u8 order, int * status) 87 87 { 88 88 ipl_t ipl; … … 118 118 panic("Can't allocate frame.\n"); 119 119 120 121 120 122 /* 121 123 * TODO: Sleep until frames are available again. … … 124 126 interrupts_restore(ipl); 125 127 128 if (flags & FRAME_NON_BLOCKING) { 129 ASSERT(status != NULL); 130 *status = FRAME_NO_MEMORY; 131 return NULL; 132 } 133 126 134 panic("Sleep not implemented.\n"); 127 135 goto loop; … … 151 159 if (flags & FRAME_KA) 152 160 v = PA2KA(v); 161 162 if (flags & FRAME_NON_BLOCKING) { 163 ASSERT(status != NULL); 164 *status = FRAME_OK; 165 } 153 166 154 167 return v; -
generic/src/mm/vm.c
r677a6d5 rf275cb3 71 71 72 72 src_ptl0 = (pte_t *) PA2KA((__address) GET_PTL0_ADDRESS()); 73 dst_ptl0 = (pte_t *) frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME );73 dst_ptl0 = (pte_t *) frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME, NULL); 74 74 75 75 // memsetb((__address) dst_ptl0, PAGE_SIZE, 0); … … 117 117 118 118 for (i=0; i<size; i++) 119 a->mapping[i] = frame_alloc(0, ONE_FRAME );119 a->mapping[i] = frame_alloc(0, ONE_FRAME, NULL); 120 120 121 121 spinlock_initialize(&a->lock, "vm_area_lock"); -
generic/src/proc/thread.c
r677a6d5 rf275cb3 174 174 spinlock_initialize(&t->lock, "thread_t_lock"); 175 175 176 frame_ks = frame_alloc(FRAME_KA, ONE_FRAME );176 frame_ks = frame_alloc(FRAME_KA, ONE_FRAME, NULL); 177 177 if (THREAD_USER_STACK & flags) { 178 frame_us = frame_alloc(FRAME_KA, ONE_FRAME );178 frame_us = frame_alloc(FRAME_KA, ONE_FRAME, NULL); 179 179 } 180 180 -
kernel.config
r677a6d5 rf275cb3 82 82 @ "thread/thread1" Thread test 1 83 83 @ "mm/mapping1" Mapping test 1 84 @ "mm/falloc1" Frame Allocation test 1 84 85 @ [ARCH=mips32] "debug/mips1" Mips breakpoint-debug test 85 86 ! CONFIG_TEST (choice) -
test/mm/mapping1/test.c
r677a6d5 rf275cb3 48 48 printf("Memory management test mapping #1\n"); 49 49 50 frame0 = frame_alloc(FRAME_KA, ONE_FRAME );51 frame1 = frame_alloc(FRAME_KA, ONE_FRAME );50 frame0 = frame_alloc(FRAME_KA, ONE_FRAME, NULL); 51 frame1 = frame_alloc(FRAME_KA, ONE_FRAME, NULL); 52 52 53 53 printf("Writing %L to physical address %P.\n", VALUE0, KA2PA(frame0));
Note:
See TracChangeset
for help on using the changeset viewer.