Re: Understanding Bare Bones
Posted: Mon Mar 02, 2009 6:47 pm
Ok so I finally got the following code to compile with errors. Basically, I want to clear the screen.
I get the errors when linking it:
My loader.s and linker script are the exact same as in the barebones tutorial. Sorry if these are all noob questions, but I simply don't have enough experience with OS programming to solve the errors on my own...
BTW, will this code work when it runs? Is it the correct code to clear the screen?
Code: Select all
#include "kernel.h"
#include <string.h>
// Screen dimensions (for default 80x25 console)
#define LINE_PITCH 160 // line width in bytes
#define LINE_COUNT 25
default_console::default_console()
{
videoram = (volatile unsigned char *) 0xb8000;
cursor = (volatile unsigned int *) 0xb903c;
clear();
}
void default_console::clear()
{
memset((void*)videoram, 0, LINE_PITCH*LINE_COUNT);
locate(0,0);
attr = 0x07;
}
void kmain( void* mbd, unsigned int magic )
{
default_console();
clear();
}
Code: Select all
Object Files/loader.o: In function `loader':
Source Files/loader.s:(.text+0x14): undefined reference to `kmain'
Object Files/kernel.o: In function `default_console::clear()':
kernel.cpp:(.text+0x25): undefined reference to `memset'
kernel.cpp:(.text+0x40): undefined reference to `default_console::locate(int, int)'
Object Files/kernel.o: In function `default_console::self()':
kernel.cpp:(.text+0xb4): undefined reference to `__cxa_guard_acquire'
kernel.cpp:(.text+0xdd): undefined reference to `__cxa_guard_release'
kernel.cpp:(.text+0x108): undefined reference to `__cxa_guard_abort'
kernel.cpp:(.text+0x11f): undefined reference to `_Unwind_Resume'
Object Files/kernel.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
BTW, will this code work when it runs? Is it the correct code to clear the screen?