Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 858 → Rev 859

/kernel/branches/kolibri_pe/include/core.h
46,3 → 46,43
: : "r" (efl)
);
}
 
static inline count_t fnzb(u32_t arg)
{
count_t n;
asm volatile ("xor %0, %0 \n\t"
"bsr %0, %1"
:"=&r" (n)
:"r"(arg)
);
return n;
}
 
static inline count_t _bsf(u32_t arg)
{
count_t n;
asm volatile ("xor %0, %0 \n\t"
"bsf %0, %1"
:"=&r" (n)
:"r"(arg)
);
return n;
}
 
static inline void _bts(u32_t *data, count_t val)
{
asm volatile ("bts %0, %1 \n\t"
:
:"g"(data), "r"(val)
:"cc"
);
}
 
static inline void _btr(u32_t *data, count_t val)
{
asm volatile ("btr %0, %1 \n\t"
:
:"g"(data), "r"(val)
:"cc"
);
}
/kernel/branches/kolibri_pe/include/link.h
5,6 → 5,9
struct link *next;
}link_t;
 
#define LIST_INITIALIZE(name) \
link_t name = { .prev = &name, .next = &name }
 
#define list_get_instance(link, type, member) \
((type *)(((u8_t *)(link)) - ((u8_t *)&(((type *)NULL)->member))))
 
48,3 → 51,10
head->next = link;
}
 
static inline list_insert(link_t *old, link_t *new)
{
new->prev = old->prev;
new->next = old;
new->prev->next = new;
old->prev = new;
}
/kernel/branches/kolibri_pe/include/mm.h
22,10 → 22,16
int flags;
} zone_t;
 
typedef struct
{
count_t count;
addr_t frames[18];
}phismem_t;
 
# define PA2KA(x) (((u32_t) (x)) + OS_BASE)
# define KA2PA(x) (((u32_t) (x)) - OS_BASE)
 
# define PA2KA(x) (((addr_t) (x)) + OS_BASE)
# define KA2PA(x) (((addr_t) (x)) - OS_BASE)
 
#define PAGE_SIZE 4096
#define FRAME_WIDTH 12
 
50,10 → 56,13
 
void init_mm();
 
pfn_t core_alloc(u32_t order);
addr_t __fastcall core_alloc(u32_t order);
void __fastcall core_free(addr_t frame);
 
pfn_t alloc_page() __attribute__ ((deprecated));
pfn_t __stdcall alloc_pages(count_t count) __asm__ ("_alloc_pages") __attribute__ ((deprecated));
 
void core_free(pfn_t frame);
void frame_free(pfn_t frame);
 
void __fastcall frame_set_parent(pfn_t pfn, void *data);
void* __fastcall frame_get_parent(pfn_t pfn);
/kernel/branches/kolibri_pe/include/slab.h
0,0 → 1,80
 
typedef struct {
link_t link;
count_t busy; /**< Count of full slots in magazine */
count_t size; /**< Number of slots in magazine */
void *objs[]; /**< Slots in magazine */
} slab_magazine_t;
 
typedef struct {
slab_magazine_t *current;
slab_magazine_t *last;
SPINLOCK_DECLARE(lock);
} slab_mag_cache_t;
 
typedef struct {
 
link_t link;
 
/* Configuration */
/** Size of slab position - align_up(sizeof(obj)) */
size_t size;
 
// int (*constructor)(void *obj, int kmflag);
// int (*destructor)(void *obj);
 
/** Flags changing behaviour of cache */
int flags;
 
/* Computed values */
u32_t order; /**< Order of frames to be allocated */
unsigned int objects; /**< Number of objects that fit in */
 
/* Statistics */
atomic_t allocated_slabs;
atomic_t allocated_objs;
atomic_t cached_objs;
/** How many magazines in magazines list */
atomic_t magazine_counter;
 
/* Slabs */
link_t full_slabs; /**< List of full slabs */
link_t partial_slabs; /**< List of partial slabs */
SPINLOCK_DECLARE(slablock);
/* Magazines */
link_t magazines; /**< List o full magazines */
SPINLOCK_DECLARE(maglock);
 
/** CPU cache */
slab_mag_cache_t *mag_cache;
} slab_cache_t;
 
typedef struct {
link_t link; /**< List of full/partial slabs. */
slab_cache_t *cache; /**< Pointer to parent cache. */
count_t available; /**< Count of available items in this slab. */
void *start; /**< Start address of first item. */
void *nextavail; /**< The index of next available item. */
} slab_t;
 
#define SLAB_INSIDE_SIZE (4096 >> 3)
 
/** Maximum wasted space we allow for cache */
#define SLAB_MAX_BADNESS(cache) (((size_t) PAGE_SIZE << (cache)->order) >> 2)
 
/** Do not use per-cpu cache */
#define SLAB_CACHE_NOMAGAZINE 0x1
/** Have control structure inside SLAB */
#define SLAB_CACHE_SLINSIDE 0x2
/** We add magazine cache later, if we have this flag */
#define SLAB_CACHE_MAGDEFERRED (0x4 | SLAB_CACHE_NOMAGAZINE)
 
 
slab_cache_t * slab_cache_create(
size_t size,
size_t align,
int (*constructor)(void *obj, int kmflag),
int (*destructor)(void *obj),
int flags);
 
void* __fastcall slab_alloc(slab_cache_t *cache, int flags);
/kernel/branches/kolibri_pe/include/.
Property changes:
Added: svn:ignore
+*.mnt
+lang.inc
+*.bat
+out.txt
+scin*
+*.obj
+*.gz
+*.bak
+*.img