Subversion Repositories HelenOS

Rev

Rev 3069 | Rev 4227 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3069 Rev 3104
Line 53... Line 53...
53
{
53
{
54
    int order, run, allocated, i;
54
    int order, run, allocated, i;
55
    uint8_t val = THREAD->tid % THREADS;
55
    uint8_t val = THREAD->tid % THREADS;
56
    index_t k;
56
    index_t k;
57
   
57
   
58
    uintptr_t * frames =  (uintptr_t *) malloc(MAX_FRAMES * sizeof(uintptr_t), FRAME_ATOMIC);
58
    void **frames =  (void **) malloc(MAX_FRAMES * sizeof(void *), FRAME_ATOMIC);
59
    if (frames == NULL) {
59
    if (frames == NULL) {
60
        if (!sh_quiet)
60
        if (!sh_quiet)
61
            printf("Thread #%" PRIu64 " (cpu%u): Unable to allocate frames\n", THREAD->tid, CPU->id);
61
            printf("Thread #%" PRIu64 " (cpu%u): Unable to allocate frames\n", THREAD->tid, CPU->id);
62
        atomic_inc(&thread_fail);
62
        atomic_inc(&thread_fail);
63
        atomic_dec(&thread_count);
63
        atomic_dec(&thread_count);
Line 71... Line 71...
71
            if (!sh_quiet)
71
            if (!sh_quiet)
72
                printf("Thread #%" PRIu64 " (cpu%u): Allocating %d frames blocks ... \n", THREAD->tid, CPU->id, 1 << order);
72
                printf("Thread #%" PRIu64 " (cpu%u): Allocating %d frames blocks ... \n", THREAD->tid, CPU->id, 1 << order);
73
           
73
           
74
            allocated = 0;
74
            allocated = 0;
75
            for (i = 0; i < (MAX_FRAMES >> order); i++) {
75
            for (i = 0; i < (MAX_FRAMES >> order); i++) {
76
                frames[allocated] = (uintptr_t)frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
76
                frames[allocated] = frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
77
                if (frames[allocated]) {
77
                if (frames[allocated]) {
78
                    memsetb(frames[allocated], FRAME_SIZE << order, val);
78
                    memsetb(frames[allocated], FRAME_SIZE << order, val);
79
                    allocated++;
79
                    allocated++;
80
                } else
80
                } else
81
                    break;
81
                    break;