Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 785 → Rev 786

/kernel/trunk/test/mm/falloc1/test.c
55,7 → 55,7
printf("Allocating %d frames blocks ... ", 1 << order);
allocated = 0;
for (i = 0; i < MAX_FRAMES >> order; i++) {
frames[allocated] = frame_alloc(FRAME_ATOMIC | FRAME_KA, order, &status, NULL);
frames[allocated] = frame_alloc_rc(order, FRAME_ATOMIC | FRAME_KA, &status);
if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) {
panic("Test failed. Block at address %X (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10);
/kernel/trunk/test/mm/falloc2/test.c
60,10 → 60,10
 
for (run = 0; run < THREAD_RUNS; run++) {
for (order = 0; order <= MAX_ORDER; order++) {
printf("Thread #%d: Allocating %d frames blocks ... \n", THREAD->tid, 1 << order);
printf("Thread #%d (cpu%d): Allocating %d frames blocks ... \n", THREAD->tid, CPU->id, 1 << order);
allocated = 0;
for (i = 0; i < (MAX_FRAMES >> order); i++) {
frames[allocated] = frame_alloc(FRAME_ATOMIC | FRAME_KA, order, &status, NULL);
frames[allocated] = frame_alloc_rc(order, FRAME_ATOMIC | FRAME_KA, &status);
if (status == 0) {
memsetb(frames[allocated], FRAME_SIZE << order, val);
allocated++;
71,24 → 71,24
break;
}
}
printf("Thread #%d: %d blocks allocated.\n", THREAD->tid, allocated);
printf("Thread #%d (cpu%d): %d blocks allocated.\n", THREAD->tid, CPU->id, allocated);
 
printf("Thread #%d: Deallocating ... \n", THREAD->tid);
printf("Thread #%d (cpu%d): Deallocating ... \n", THREAD->tid, CPU->id);
for (i = 0; i < allocated; i++) {
for (k = 0; k <= ((FRAME_SIZE << order) - 1); k++) {
if (((__u8 *) frames[i])[k] != val) {
printf("Thread #%d: Unexpected data (%d) in block %P offset %X\n", THREAD->tid, ((char *) frames[i])[k], frames[i], k);
printf("Thread #%d (cpu%d): Unexpected data (%d) in block %P offset %X\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k);
failed();
}
}
frame_free(frames[i]);
}
printf("Thread #%d: Finished run.\n", val);
printf("Thread #%d (cpu%d): Finished run.\n", THREAD->tid, CPU->id);
}
}
free(frames);
printf("Thread #%d (cpu%d): Exiting\n", THREAD->tid, CPU->id);
atomic_dec(&thread_count);
}
 
/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, NULL);
frame1 = frame_alloc(FRAME_KA, ONE_FRAME, NULL, NULL);
frame0 = frame_alloc(ONE_FRAME, FRAME_KA);
frame1 = frame_alloc(ONE_FRAME, FRAME_KA);
 
printf("Writing %L to physical address %P.\n", VALUE0, KA2PA(frame0));
*((__u32 *) frame0) = VALUE0;
/kernel/trunk/genarch/src/mm/as_ht.c
53,7 → 53,7
pte_t *ht_create(int flags)
{
if (!page_ht) {
page_ht = (pte_t *) frame_alloc(FRAME_KA | FRAME_PANIC, HT_WIDTH - FRAME_WIDTH, NULL, NULL);
page_ht = (pte_t *) frame_alloc(HT_WIDTH - FRAME_WIDTH, FRAME_KA | FRAME_PANIC);
memsetb((__address) page_ht, HT_SIZE, 0);
}
return page_ht;
/kernel/trunk/genarch/src/mm/page_pt.c
65,7 → 65,7
ptl0 = (pte_t *) PA2KA((__address) as->page_table);
 
if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) {
newpt = frame_alloc(FRAME_KA, ONE_FRAME, NULL, NULL);
newpt = frame_alloc(ONE_FRAME, FRAME_KA);
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);
74,7 → 74,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, NULL);
newpt = frame_alloc(ONE_FRAME, FRAME_KA);
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);
83,7 → 83,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, NULL);
newpt = frame_alloc(ONE_FRAME, FRAME_KA);
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/genarch/src/mm/as_pt.c
56,7 → 56,7
pte_t *src_ptl0, *dst_ptl0;
ipl_t ipl;
 
dst_ptl0 = (pte_t *) frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME, NULL, NULL);
dst_ptl0 = (pte_t *) frame_alloc(ONE_FRAME, FRAME_KA | FRAME_PANIC);
 
if (flags & FLAG_AS_KERNEL) {
memsetb((__address) dst_ptl0, PAGE_SIZE, 0);
/kernel/trunk/generic/include/mm/frame.h
61,6 → 61,10
 
#define ZONE_BLACKLIST_SIZE 8
 
#define frame_alloc(order, flags) frame_alloc_generic(order, flags, NULL, NULL)
#define frame_alloc_rc(order, flags, status) frame_alloc_generic(order, flags, status, NULL)
#define frame_alloc_rc_zone(order, flags, status, zone) frame_alloc_generic(order, flags, status, zone)
 
struct zone {
link_t link; /**< link to previous and next zone */
 
101,7 → 105,9
extern void frame_init(void);
extern void frame_initialize(frame_t *frame, zone_t *zone);
 
__address frame_alloc(int flags, __u8 order, int * status, zone_t **pzone);
__address frame_alloc_generic(__u8 order, int flags, int * status, zone_t **pzone);
 
 
extern void frame_free(__address addr);
 
zone_t * get_zone_by_frame(frame_t * frame);
/kernel/trunk/generic/src/proc/thread.c
166,9 → 166,9
spinlock_initialize(&t->lock, "thread_t_lock");
frame_ks = frame_alloc(FRAME_KA, ONE_FRAME, NULL, NULL);
frame_ks = frame_alloc(ONE_FRAME, FRAME_KA);
if (THREAD_USER_STACK & flags) {
frame_us = frame_alloc(FRAME_KA, ONE_FRAME, NULL,NULL);
frame_us = frame_alloc(ONE_FRAME, FRAME_KA);
}
 
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, NULL);
cpus[i].stack = (__u8 *) frame_alloc(ONE_FRAME, FRAME_KA | FRAME_PANIC);
cpus[i].id = i;
/kernel/trunk/generic/src/mm/slab.c
155,7 → 155,7
int status;
frame_t *frame;
 
data = (void *)frame_alloc(FRAME_KA | flags, cache->order, &status, &zone);
data = (void *)frame_alloc_rc_zone(cache->order, FRAME_KA | flags, &status, &zone);
if (status != FRAME_OK) {
return NULL;
}
/kernel/trunk/generic/src/mm/as.c
256,7 → 256,7
* do not forget to distinguish between
* the different causes
*/
frame = frame_alloc(0, ONE_FRAME, NULL, NULL);
frame = frame_alloc(ONE_FRAME, 0);
memsetb(PA2KA(frame), FRAME_SIZE, 0);
/*
/kernel/trunk/generic/src/mm/frame.c
109,7 → 109,7
*
* @return Allocated frame.
*/
__address frame_alloc(int flags, __u8 order, int * status, zone_t **pzone)
__address frame_alloc_generic(__u8 order, int flags, int * status, zone_t **pzone)
{
ipl_t ipl;
link_t *tmp;
/kernel/trunk/arch/ia64/src/mm/page.c
89,7 → 89,7
/*
* Allocate VHPT and invalidate all its entries.
*/
page_ht = (pte_t *) frame_alloc(FRAME_KA, VHPT_WIDTH - FRAME_WIDTH, NULL, NULL);
page_ht = (pte_t *) frame_alloc(VHPT_WIDTH - FRAME_WIDTH, FRAME_KA);
memsetb((__address) page_ht, VHPT_SIZE, 0);
ht_invalidate_all();