Skip to content

Commit

Permalink
Some corrections. #48
Browse files Browse the repository at this point in the history
  • Loading branch information
fijiol committed May 8, 2010
1 parent 492b2a9 commit 65d039b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/include/lib/page_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pmark_t *page_alloc(void);
void page_free(pmark_t *paddr);

#ifdef EXTENDED_TEST

#define PAGE_QUANTITY 0x10
#define PAGE_SIZE 0x100

Expand Down
20 changes: 12 additions & 8 deletions src/lib/page_alloc/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,26 @@
#include <errno.h>
#include <lib/page_alloc.h>

#ifndef PAGE_QUANTITY
# define PAGE_QUANTITY 0x10
#ifndef EXTENDED_TEST
extern char _heap_start;
extern char _heap_end;
#endif
#ifndef PAGE_SIZE
# define PAGE_SIZE 0x100

// CONFIG_PAGE_SIZE

#ifndef PAGE_QUANTITY
# define PAGE_QUANTITY ( ((size_t) (&_heap_end - &_heap_start) ) / CONFIG_PAGE_SIZE )
#endif

int page_alloc_hasinit = 0;

#ifdef EXTENDED_TEST

static uint8_t page_pool[PAGE_QUANTITY][PAGE_SIZE];
static uint8_t page_pool[PAGE_QUANTITY][CONFIG_PAGE_SIZE];
static pmark_t *cmark_p = (pmark_t *) page_pool;
#else
#define START_MEMORY_ADDR 0x40000000
static pmark_t *cmark_p = (pmark_t *)START_MEMORY_ADDR;
//#define START_MEMORY_ADDR 0x40000000
static pmark_t *cmark_p = (pmark_t *) &_heap_start;
#endif

#ifdef EXTENDED_TEST
Expand Down Expand Up @@ -86,7 +90,7 @@ pmark_t *page_alloc(void) {

/* change list and return value */
if (pcur->psize > 1 ) { /* 1 := psize */
tt = (unsigned long) pcur + (unsigned long) PAGE_SIZE *
tt = (unsigned long) pcur + (unsigned long) CONFIG_PAGE_SIZE *
(unsigned long) 1; /* 1:= psize */
pcur->psize -= 1; /* 1 := psize */
tmp = cmark_p->pnext;
Expand Down
2 changes: 2 additions & 0 deletions templates/microblaze/compiler_tests/options-kernel.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ option(TIMER)
option(PRINTK)

option(MOD_DIAG, embox.driver.serial.xuartlite)
option(PAGE_SIZE, 0x1000)

2 changes: 2 additions & 0 deletions templates/microblaze/release/options-kernel.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ option(TIMER)
option(PRINTK)

option(MOD_DIAG, embox.driver.serial.xuartlite)
option(PAGE_SIZE, 0x1000)

2 changes: 2 additions & 0 deletions templates/sparc/release/options-kernel.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ option(TIMER)
option(PRINTK)

option(MOD_DIAG, embox.driver.diag_apbuart)
option(PAGE_SIZE, 0x1000)

2 changes: 2 additions & 0 deletions templates/sparc/simulation/options-kernel.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ option(IRQ)
option(PRINTK)

option(MOD_DIAG, embox.driver.diag_apbuart)
option(PAGE_SIZE, 0x1000)

0 comments on commit 65d039b

Please sign in to comment.