main.c:(.text+0x1c): undefined reference to `init_paging'
Posted: Tue Feb 01, 2011 5:08 pm
Ive been working through JamesM's kernel dev tutorials, and am now on step 6. The goal at the end of this chapter is to force a page fault to test if the handler works. I am, however, receiving the error specified in the subject of this post. Here it is again:
main.c:
paging.h (where init_paging() is defined):
Could someone please help me understand and fix this error? Thanks in advance.
Code: Select all
main.c:(.text+0x1c): undefined reference to `init_paging'
Code: Select all
//main.c - C code kernel entry point
#include "monitor.h"
#include "descriptor_tables.h"
#include "timer.h"
#include "paging.h"
int main(struct multiboot *mboot_ptr)
{
//init calls go here
init_descriptor_tables();
monitor_clear();
init_paging();
monitor_write("Hello World!\n");
uint32 *ptr = (uint32*)0xA0000000;
uint32 do_page_fault = *ptr;
//asm volatile ("int $0x3");
//asm volatile ("int $0x4");
//asm volatile ("sti");
//init_timer(50);
return 0;
}
Code: Select all
#ifndef PAGING_H
#define PAGING_H
#include "common.h"
#include "isr.h"
typedef struct page
{
uint32 present: 1; //page present in memory
uint32 rw: 1; //read only if clear, read/write if set
uint32 user: 1; //supervisor level only if clear
uint32 accessed: 1; //has the page been accessed since last refresh
uint32 dirty: 1; //has the page been written to since last refresh
uint32 unused: 7; //amalgation of unused and reserved bits
uint32 frame: 20; //frame address (shifted right 12 bits)
} page_t;
typedef struct page_table
{
page_t pages[1024];
} page_table_t;
typedef struct page_directory
{
page_table_t *tables[1024];
uint32 tablesPhysical[1024];
uint32 physicalAddr;
} page_directory_t;
//sets up environment and enables paging
void init_paging();
//causes the specified page directory to be loaded into the CR3 register
void switch_page_directory(page_directory_t *new);
//retrieves a pointer to the page required
page_t *get_page(uint32 address, int make, page_directory_t *dir);
//handler for page faults
void page_fault(registers_t regs);
#endif