Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 689 → Rev 688

/kernel/trunk/test/mm/falloc1/test.c
File deleted
/kernel/trunk/test/mm/mapping1/test.c
47,8 → 47,8
 
printf("Memory management test mapping #1\n");
 
frame0 = frame_alloc(FRAME_KA, ONE_FRAME, NULL);
frame1 = frame_alloc(FRAME_KA, ONE_FRAME, NULL);
frame0 = frame_alloc(FRAME_KA, ONE_FRAME);
frame1 = frame_alloc(FRAME_KA, ONE_FRAME);
 
printf("Writing %L to physical address %P.\n", VALUE0, KA2PA(frame0));
*((__u32 *) frame0) = VALUE0;
/kernel/trunk/genarch/src/mm/page_pt.c
63,7 → 63,7
ptl0 = (pte_t *) PA2KA(root ? root : (__address) GET_PTL0_ADDRESS());
 
if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) {
newpt = frame_alloc(FRAME_KA, ONE_FRAME, NULL);
newpt = frame_alloc(FRAME_KA, ONE_FRAME);
memsetb(newpt, PAGE_SIZE, 0);
SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page), KA2PA(newpt));
SET_PTL1_FLAGS(ptl0, PTL0_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE);
72,7 → 72,7
ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
 
if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) {
newpt = frame_alloc(FRAME_KA, ONE_FRAME, NULL);
newpt = frame_alloc(FRAME_KA, ONE_FRAME);
memsetb(newpt, PAGE_SIZE, 0);
SET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page), KA2PA(newpt));
SET_PTL2_FLAGS(ptl1, PTL1_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE);
81,7 → 81,7
ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
 
if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) {
newpt = frame_alloc(FRAME_KA, ONE_FRAME, NULL);
newpt = frame_alloc(FRAME_KA, ONE_FRAME);
memsetb(newpt, PAGE_SIZE, 0);
SET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page), KA2PA(newpt));
SET_PTL3_FLAGS(ptl2, PTL2_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE);
/kernel/trunk/generic/include/mm/frame.h
38,14 → 38,9
 
#define ONE_FRAME 0
 
#define FRAME_KA 1 /* skip frames conflicting with user address space */
#define FRAME_PANIC 2 /* panic on failure */
#define FRAME_NON_BLOCKING 4 /* do not panic and do not sleep on failure */
#define FRAME_KA 1 /* skip frames conflicting with user address space */
#define FRAME_PANIC 2 /* panic on failure */
 
#define FRAME_OK 0 /* frame_alloc return status */
#define FRAME_NO_MEMORY 1 /* frame_alloc return status */
#define FRAME_ERROR 2 /* frame_alloc return status */
 
#define FRAME2ADDR(zone, frame) ((zone)->base + ((frame) - (zone)->frames) * FRAME_SIZE)
#define ADDR2FRAME(zone, addr) (&((zone)->frames[((addr) - (zone)->base) / FRAME_SIZE]))
#define FRAME_INDEX(zone, frame) ((index_t)((frame) - (zone)->frames))
93,10 → 88,8
 
extern void frame_init(void);
extern void frame_initialize(frame_t *frame, zone_t *zone);
 
__address frame_alloc(int flags, __u8 order, int * status);
__address frame_alloc(int flags, __u8 order);
extern void frame_free(__address addr);
 
zone_t * get_zone_by_frame(frame_t * frame);
 
/*
/kernel/trunk/generic/src/mm/vm.c
70,7 → 70,7
pte_t *src_ptl0, *dst_ptl0;
src_ptl0 = (pte_t *) PA2KA((__address) GET_PTL0_ADDRESS());
dst_ptl0 = (pte_t *) frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME, NULL);
dst_ptl0 = (pte_t *) frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME);
 
// memsetb((__address) dst_ptl0, PAGE_SIZE, 0);
// memcpy((void *) &dst_ptl0[KAS_START_INDEX], (void *) &src_ptl0[KAS_START_INDEX], KAS_INDICES);
116,7 → 116,7
}
for (i=0; i<size; i++)
a->mapping[i] = frame_alloc(0, ONE_FRAME, NULL);
a->mapping[i] = frame_alloc(0, ONE_FRAME);
spinlock_initialize(&a->lock, "vm_area_lock");
/kernel/trunk/generic/src/mm/frame.c
83,7 → 83,7
*
* @return Allocated frame.
*/
__address frame_alloc(int flags, __u8 order, int * status)
__address frame_alloc(int flags, __u8 order)
{
ipl_t ipl;
link_t *cur, *tmp;
117,8 → 117,6
if (flags & FRAME_PANIC)
panic("Can't allocate frame.\n");
/*
* TODO: Sleep until frames are available again.
*/
125,12 → 123,6
spinlock_unlock(&zone_head_lock);
interrupts_restore(ipl);
 
if (flags & FRAME_NON_BLOCKING) {
ASSERT(status != NULL);
*status = FRAME_NO_MEMORY;
return NULL;
}
panic("Sleep not implemented.\n");
goto loop;
}
159,11 → 151,6
if (flags & FRAME_KA)
v = PA2KA(v);
if (flags & FRAME_NON_BLOCKING) {
ASSERT(status != NULL);
*status = FRAME_OK;
}
return v;
}
 
/kernel/trunk/generic/src/proc/thread.c
173,9 → 173,9
spinlock_initialize(&t->lock, "thread_t_lock");
frame_ks = frame_alloc(FRAME_KA, ONE_FRAME, NULL);
frame_ks = frame_alloc(FRAME_KA, ONE_FRAME);
if (THREAD_USER_STACK & flags) {
frame_us = frame_alloc(FRAME_KA, ONE_FRAME, NULL);
frame_us = frame_alloc(FRAME_KA, ONE_FRAME);
}
 
ipl = interrupts_disable();
/kernel/trunk/generic/src/cpu/cpu.c
61,7 → 61,7
memsetb((__address) cpus, sizeof(cpu_t) * config.cpu_count, 0);
 
for (i=0; i < config.cpu_count; i++) {
cpus[i].stack = (__u8 *) frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME, NULL);
cpus[i].stack = (__u8 *) frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME);
cpus[i].id = i;
/kernel/trunk/arch/mips32/src/mm/page.c
42,7 → 42,7
 
page_operations = &page_pt_operations;
ptl0 = frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME, NULL);
ptl0 = frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME);
memsetb(ptl0, FRAME_SIZE, 0);
SET_PTL0_ADDRESS(KA2PA(ptl0));
/kernel/trunk/kernel.config
81,6 → 81,5
@ "print/print1" Printf test 1
@ "thread/thread1" Thread test 1
@ "mm/mapping1" Mapping test 1
@ "mm/falloc1" Frame Allocation test 1
@ [ARCH=mips32] "debug/mips1" Mips breakpoint-debug test
! CONFIG_TEST (choice)