I am following James Molloy's tutorial. The fault occurs when I am initializing paging. The problem seems to be when the function create_heap makes a call to orderedArray_place:
Code: Select all
heap_t *create_heap ( u32int start, u32int end, u32int max, u8int supervisor, u8int readonly )
{
//
heap_t *heap = ( heap_t * ) kmalloc( sizeof( heap_t ) );
...
// Initialize the index
heap -> index = orderedArray_place( ( void * ) start, HEAP_INDEX_SIZE, &header_t_less_than ); // <---
...
Code: Select all
// Initialise the kernel heap.
kheap = create_heap( KHEAP_START, KHEAP_START + KHEAP_INITIAL_SIZE, 0xCFFFF000, 0, 0 );
Code: Select all
#define KHEAP_START 0xC0000000 // arbitrary
#define KHEAP_INITIAL_SIZE 0x100000 // arbitrary
#define HEAP_INDEX_SIZE 0x20000 // arbitrary
Code: Select all
// Create an ordered array (uses given start location)
ordered_array_t orderedArray_place ( void *address, u32int max_size, lessthan_predicate_t less_than )
{
ordered_array_t a;
a.array = ( type_t * ) address;
memset( ( u32int * ) address, 0, max_size * sizeof( type_t ) ); // fill with zeros <---
...
My full code is here. The relevant files (I think) are kernelHeap, orderedArray, and paging.
By the way, type_t is declared as follows:
Code: Select all
typedef void* type_t;