Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 819 → Rev 820

/kernel/trunk/generic/include/config.h
36,7 → 36,6
#define STACK_SIZE PAGE_SIZE
 
#define CONFIG_MEMORY_SIZE (8*1024*1024)
#define CONFIG_HEAP_SIZE (300*1024)
#define CONFIG_STACK_SIZE STACK_SIZE
 
struct config {
49,11 → 48,7
__address init_addr;
size_t init_size;
__address heap_addr;
size_t heap_size;
size_t heap_delta; /**< Extra space between heap and stack (enforced by alignment requirements) */
size_t kernel_size; /**< Size of memory in bytes taken by kernel, heap and stack */
size_t kernel_size; /**< Size of memory in bytes taken by kernel and stack */
};
 
extern config_t config;
/kernel/trunk/generic/include/mm/frame.h
74,11 → 74,11
return (pfn_t)(addr >> FRAME_WIDTH);
}
 
static inline pfn_t SIZE2PFN(__address size)
static inline count_t SIZE2FRAMES(size_t size)
{
if (!size)
return 0;
return (pfn_t)((size-1) >> FRAME_WIDTH)+1;
return (count_t)((size-1) >> FRAME_WIDTH)+1;
}
 
#define IS_BUDDY_ORDER_OK(index, order) ((~(((__native) -1) << (order)) & (index)) == 0)
95,12 → 95,12
__address frame_alloc_generic(__u8 order, int flags, int * status, int *pzone);
extern void frame_free(__address addr);
 
extern void zone_create(pfn_t start, pfn_t count, pfn_t confframe, int flags);
extern void zone_create(pfn_t start, count_t count, pfn_t confframe, int flags);
 
void * frame_get_parent(pfn_t frame, int hint);
void frame_set_parent(pfn_t frame, void *data, int hint);
void frame_mark_unavailable(pfn_t start, pfn_t count);
__address zone_conf_size(pfn_t start, pfn_t count);
void frame_mark_unavailable(pfn_t start, count_t count);
__address zone_conf_size(pfn_t start, count_t count);
 
/*
* Console functions
/kernel/trunk/generic/include/typedefs.h
34,9 → 34,9
 
typedef short bool;
 
typedef unsigned int size_t;
typedef unsigned int count_t;
typedef unsigned int index_t;
typedef unsigned long size_t;
typedef unsigned long count_t;
typedef unsigned long index_t;
 
typedef struct config config_t;
typedef struct cpu_info cpu_info_t;
/kernel/trunk/generic/src/main/kinit.c
72,7 → 72,7
as_t *as;
as_area_t *a;
__address frame;
pfn_t frames;
count_t frames;
int i;
task_t *u;
 
165,7 → 165,7
if (IS_KA(frame))
frame = KA2PA(frame);
 
frames = SIZE2PFN(config.init_size);
frames = SIZE2FRAMES(config.init_size);
a = as_area_create(as, AS_AREA_TEXT, frames, UTEXT_ADDRESS);
if (!a)
/kernel/trunk/generic/src/mm/frame.c
61,7 → 61,7
typedef struct {
SPINLOCK_DECLARE(lock); /**< this lock protects everything below */
pfn_t base; /**< frame_no of the first frame in the frames array */
pfn_t count; /**< Size of zone */
count_t count; /**< Size of zone */
 
frame_t *frames; /**< array of frame_t structures in this zone */
count_t free_count; /**< number of free frame_t structures */
99,7 → 99,7
}
 
/** Compute pfn_t from frame_t pointer & zone pointer */
static pfn_t make_frame_index(zone_t *zone, frame_t *frame)
static index_t make_frame_index(zone_t *zone, frame_t *frame)
{
return frame - zone->frames;
}
423,7 → 423,7
*
* Assume zone is locked
*/
static void zone_frame_free(zone_t *zone, pfn_t frame_idx)
static void zone_frame_free(zone_t *zone, index_t frame_idx)
{
frame_t *frame;
__u8 order;
445,7 → 445,7
}
 
/** Return frame from zone */
static frame_t * zone_get_frame(zone_t *zone, pfn_t frame_idx)
static frame_t * zone_get_frame(zone_t *zone, index_t frame_idx)
{
ASSERT(frame_idx < zone->count);
return &zone->frames[frame_idx];
452,7 → 452,7
}
 
/** Mark frame in zone unavailable to allocation */
static void zone_mark_unavailable(zone_t *zone, pfn_t frame_idx)
static void zone_mark_unavailable(zone_t *zone, index_t frame_idx)
{
frame_t *frame;
link_t *link;
475,7 → 475,7
*
* @return Initialized zone.
*/
static zone_t * zone_construct(pfn_t start, pfn_t count,
static zone_t * zone_construct(pfn_t start, count_t count,
zone_t *z, int flags)
{
int i;
516,7 → 516,7
 
 
/** Compute configuration data size for zone */
__address zone_conf_size(pfn_t start, pfn_t count)
__address zone_conf_size(pfn_t start, count_t count)
{
int size = sizeof(zone_t) + count*sizeof(frame_t);
int max_order;
530,17 → 530,16
/** Create and add zone to system
*
* @param confframe Where configuration frame is supposed to be.
* Always check, that we will not disturb kernel pages
* the kernel and possibly init.
* Always check, that we will not disturb the kernel and possibly init.
* If confframe is given _outside_ this zone, it is expected,
* that the area is already marked BUSY and big enough
* to contain zone_conf_size() amount of data
*/
void zone_create(pfn_t start, pfn_t count, pfn_t confframe, int flags)
void zone_create(pfn_t start, count_t count, pfn_t confframe, int flags)
{
zone_t *z;
__address addr,endaddr;
pfn_t confcount;
count_t confcount;
int i;
 
/* Theoretically we could have here 0, practically make sure
551,7 → 550,7
/* If conframe is supposed to be inside our zone, then make sure
* it does not span kernel & init
*/
confcount = SIZE2PFN(zone_conf_size(start,count));
confcount = SIZE2FRAMES(zone_conf_size(start,count));
if (confframe >= start && confframe < start+count) {
for (;confframe < start+count;confframe++) {
addr = PFN2ADDR(confframe);
699,7 → 698,7
 
 
/** Mark given range unavailable in frame zones */
void frame_mark_unavailable(pfn_t start, pfn_t count)
void frame_mark_unavailable(pfn_t start, count_t count)
{
int i;
zone_t *zone;
729,10 → 728,10
frame_arch_init();
if (config.cpu_active == 1) {
frame_mark_unavailable(ADDR2PFN(KA2PA(config.base)),
SIZE2PFN(config.kernel_size));
SIZE2FRAMES(config.kernel_size));
if (config.init_size > 0)
frame_mark_unavailable(ADDR2PFN(KA2PA(config.init_addr)),
SIZE2PFN(config.init_size));
SIZE2FRAMES(config.init_size));
}
}