Changeset e45f81a in mainline


Ignore:
Timestamp:
2006-06-26T10:07:05Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7ee0e2f
Parents:
430f12c
Message:

Changed frame_alloc call, cleaned a lot of stuff, fixed some not-perfectly-correct error handling.

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/src/smp/smp.c

    r430f12c re45f81a  
    6262void smp_init(void)
    6363{
    64         int status;
    6564        __address l_apic_address, io_apic_address;
    6665
     
    7473        }
    7574
    76         l_apic_address = (__address) frame_alloc_rc(ONE_FRAME, FRAME_ATOMIC | FRAME_KA, &status);
    77         if (status != FRAME_OK)
     75        l_apic_address = (__address) frame_alloc(ONE_FRAME, FRAME_ATOMIC | FRAME_KA);
     76        if (!l_apic_address)
    7877                panic("cannot allocate address for l_apic\n");
    7978
    80         io_apic_address = (__address) frame_alloc_rc(ONE_FRAME, FRAME_ATOMIC | FRAME_KA, &status);
    81         if (status != FRAME_OK)
     79        io_apic_address = (__address) frame_alloc(ONE_FRAME, FRAME_ATOMIC | FRAME_KA);
     80        if (!io_apic_address)
    8281                panic("cannot allocate address for io_apic\n");
    8382
  • genarch/src/fb/fb.c

    r430f12c re45f81a  
    389389        int pages = SIZE2FRAMES(totsize);
    390390        int order;
    391         int rc;
    392391        if (pages == 1)
    393392                order = 0;
     
    395394                order = fnzb(pages-1)+1;
    396395
    397         dbbuffer = frame_alloc_rc(order,FRAME_ATOMIC | FRAME_KA, &rc);
     396        dbbuffer = frame_alloc(order,FRAME_ATOMIC | FRAME_KA);
    398397        if (!dbbuffer)
    399398                printf("Failed to allocate scroll buffer.\n");
     
    402401        /* Initialized blank line */
    403402        blankline = (__u8 *) malloc(ROW_BYTES, FRAME_ATOMIC);
    404         ASSERT(blankline);
     403        if (!blankline)
     404                panic("Failed to allocate blank line for framebuffer.");
    405405        for (y=0; y < FONT_SCANLINES; y++)
    406406                for (x=0; x < xres; x++)
  • generic/include/mm/frame.h

    r430f12c re45f81a  
    9090#define IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame)   (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1)
    9191
    92 #define frame_alloc(order, flags)                               frame_alloc_generic(order, flags, NULL, NULL)
    93 #define frame_alloc_rc(order, flags, status)                    frame_alloc_generic(order, flags, status, NULL)
    94 #define frame_alloc_rc_zone(order, flags, status, zone)         frame_alloc_generic(order, flags, status, zone)
     92#define frame_alloc(order, flags)                               frame_alloc_generic(order, flags, NULL)
    9593
    9694extern void frame_init(void);
    97 extern void * frame_alloc_generic(__u8 order, int flags, int * status, int *pzone);
     95extern void * frame_alloc_generic(__u8 order, int flags, int *pzone);
    9896extern void frame_free(__address frame);
    9997extern void frame_reference_add(pfn_t pfn);
  • generic/src/mm/frame.c

    r430f12c re45f81a  
    932932 *
    933933 */
    934 void * frame_alloc_generic(__u8 order, int flags, int *status, int *pzone)
     934void * frame_alloc_generic(__u8 order, int flags, int *pzone)
    935935{
    936936        ipl_t ipl;
     
    968968                interrupts_restore(ipl);
    969969
    970                 if (flags & FRAME_ATOMIC) {
    971                         ASSERT(status != NULL);
    972                         if (status)
    973                                 *status = FRAME_NO_MEMORY;
     970                if (flags & FRAME_ATOMIC)
    974971                        return 0;
    975                 }
    976972               
    977973                panic("Sleep not implemented.\n");
     
    984980        spinlock_unlock(&zone->lock);
    985981        interrupts_restore(ipl);
    986 
    987         if (status)
    988                 *status = FRAME_OK;
    989982
    990983        if (flags & FRAME_KA)
  • generic/src/mm/slab.c

    r430f12c re45f81a  
    162162        size_t fsize;
    163163        int i;
    164         int status;
    165164        int zone=0;
    166165       
    167         data = frame_alloc_rc_zone(cache->order, FRAME_KA | flags, &status, &zone);
    168         if (status != FRAME_OK) {
     166        data = frame_alloc_generic(cache->order, FRAME_KA | flags, &zone);
     167        if (!data) {
    169168                return NULL;
    170169        }
  • generic/src/proc/thread.c

    r430f12c re45f81a  
    125125{
    126126        thread_t *t = (thread_t *)obj;
    127         int status;
    128127
    129128        spinlock_initialize(&t->lock, "thread_t_lock");
     
    142141#endif 
    143142
    144         t->kstack = frame_alloc_rc(STACK_FRAMES, FRAME_KA | kmflags,&status);
    145         if (status) {
     143        t->kstack = frame_alloc(STACK_FRAMES, FRAME_KA | kmflags);
     144        if (! t->kstack) {
    146145#ifdef ARCH_HAS_FPU
    147146                if (t->saved_fpu_context)
  • test/mm/falloc1/test.c

    r430f12c re45f81a  
    4646        int i, order, run;
    4747        int allocated;
    48         int status;
    4948
    5049        ASSERT(TEST_RUNS > 1);
     
    5655                        allocated = 0;
    5756                        for (i = 0; i < MAX_FRAMES >> order; i++) {
    58                                 frames[allocated] = frame_alloc_rc(order, FRAME_ATOMIC | FRAME_KA, &status);
     57                                frames[allocated] = frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
    5958                               
    6059                                if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) {
Note: See TracChangeset for help on using the changeset viewer.