Changeset 2d43f3e in mainline


Ignore:
Timestamp:
2006-02-02T15:04:41Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bc504ef2
Parents:
a294ad0
Message:

Modify frame.h to use shifting instead of multiplication and division.
Define FRAME_WIDTH for all architectures.

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/include/mm/frame.h

    ra294ad0 r2d43f3e  
    3434#endif /* __ASM__ */
    3535
    36 #define FRAME_SIZE              4096
     36#define FRAME_WIDTH             12      /* 4K */
     37#define FRAME_SIZE              (1<<FRAME_WIDTH)
     38
    3739
    3840#ifndef __ASM__
  • arch/ia32/include/mm/frame.h

    ra294ad0 r2d43f3e  
    3232#include <arch/types.h>
    3333
    34 #define FRAME_SIZE      4096
     34#define FRAME_WIDTH     12      /* 4K */
     35#define FRAME_SIZE      (1<<FRAME_WIDTH)
    3536
    3637extern __address last_frame;
  • arch/ia64/include/mm/frame.h

    ra294ad0 r2d43f3e  
    3030#define __ia64_FRAME_H__
    3131
    32 #define FRAME_WIDTH   14
     32#define FRAME_WIDTH   14        /* 16K */
    3333#define FRAME_SIZE              (1<<FRAME_WIDTH)
    3434
  • arch/mips32/include/mm/frame.h

    ra294ad0 r2d43f3e  
    3030#define __mips32_FRAME_H__
    3131
    32 #define FRAME_SIZE              16384
     32#define FRAME_WIDTH             14      /* 16K */
     33#define FRAME_SIZE              (1<<FRAME_WIDTH)
    3334
    3435extern void frame_arch_init(void);
  • arch/ppc32/include/mm/frame.h

    ra294ad0 r2d43f3e  
    3030#define __ppc32_FRAME_H__
    3131
    32 #define FRAME_SIZE              4096
     32#define FRAME_WIDTH             12      /* 4K */
     33#define FRAME_SIZE              (1<<FRAME_WIDTH)
    3334
    3435extern void frame_arch_init(void);
  • arch/sparc64/include/mm/frame.h

    ra294ad0 r2d43f3e  
    3232#include <arch/types.h>
    3333
    34 #define FRAME_WIDTH             13
     34#define FRAME_WIDTH             13      /* 8K */
    3535#define FRAME_SIZE              (1<<FRAME_WIDTH)
    3636
  • generic/include/mm/frame.h

    ra294ad0 r2d43f3e  
    4949#define FRAME_ERROR             2       /* frame_alloc return status */
    5050
    51 #define FRAME2ADDR(zone, frame)                 ((zone)->base + ((frame) - (zone)->frames) * FRAME_SIZE)
    52 #define ADDR2FRAME(zone, addr)                  (&((zone)->frames[((addr) - (zone)->base) / FRAME_SIZE]))
     51#define FRAME2ADDR(zone, frame)                 ((zone)->base + (((frame) - (zone)->frames) << FRAME_WIDTH))
     52#define ADDR2FRAME(zone, addr)                  (&((zone)->frames[(((addr) - (zone)->base) >> FRAME_WIDTH)]))
    5353#define FRAME_INDEX(zone, frame)                ((index_t)((frame) - (zone)->frames))
    5454#define FRAME_INDEX_ABS(zone, frame)            (((index_t)((frame) - (zone)->frames)) + (zone)->base_index)
  • generic/src/mm/slab.c

    ra294ad0 r2d43f3e  
    8787
    8888        /* Fill in slab structures */
    89         /* TODO: some better way of accessing the frame, although
    90          * the optimizer might optimize the division out :-/ */
     89        /* TODO: some better way of accessing the frame */
    9190        for (i=0; i< (1<<cache->order); i++) {
    9291                ADDR2FRAME(zone, (__address)(data+i*PAGE_SIZE))->parent = slab;
     
    145144                slab = obj2slab(obj);
    146145
    147         spinlock_lock(cache->lock);
     146        spinlock_lock(&cache->lock);
    148147
    149148        *((int *)obj) = slab->nextavail;
     
    166165        }
    167166
    168         spinlock_unlock(cache->lock);
     167        spinlock_unlock(&cache->lock);
    169168
    170169        return frames;
Note: See TracChangeset for help on using the changeset viewer.