aboutsummaryrefslogtreecommitdiff
path: root/src/c
diff options
context:
space:
mode:
Diffstat (limited to 'src/c')
-rw-r--r--src/c/kernel.c2
-rw-r--r--src/c/paging.c24
-rw-r--r--src/c/shell/game.c8
-rw-r--r--src/c/vga.c3
4 files changed, 23 insertions, 14 deletions
diff --git a/src/c/kernel.c b/src/c/kernel.c
index a5dc31a..9692b32 100644
--- a/src/c/kernel.c
+++ b/src/c/kernel.c
@@ -14,7 +14,7 @@ void kernel_main(void)
init_timer(50);
init_keyboard();
kheapinit();
- kheapaddblock(0x00200000, 0x00100000, 16);
+ kheapaddblock(0xC0700000, 0x00100000, 16);
terminal_initialize();
prompt();
diff --git a/src/c/paging.c b/src/c/paging.c
index 4aba4af..0a4c01f 100644
--- a/src/c/paging.c
+++ b/src/c/paging.c
@@ -3,6 +3,7 @@
extern void loadPageDirectory(uint32_t*);
extern void enablePaging(void);
+extern void flushPaging(void);
uint32_t page_directory[1024] __attribute__((aligned(4096)));
@@ -23,11 +24,6 @@ uint32_t page_table[1024][1024] __attribute__((aligned(4096)));
void set_pt(size_t num,uint32_t address)
{
- // holds the physical address where we want to start mapping these pages
- // to.
- // in this case, we want to map these pages to the very beginning of
- // memory.
-
//we will fill all 1024 entries in the table, mapping 4 megabytes
for(size_t i=0;i<1024;i++)
{
@@ -37,14 +33,26 @@ void set_pt(size_t num,uint32_t address)
// attributes: supervisor level, read/write, present.
}
- page_directory[num] = ((uint32_t)page_table[num]) | 3;
+ page_directory[num] = ((uint32_t)page_table[num] - 0xC0000000) | 3;
// attributes: supervisor level, read/write, present
}
+void empty_pt(size_t num)
+{
+ for(size_t i=0;i<1024;i++)
+ {
+ page_table[num][i] = 0;
+ }
+
+ page_directory[num] = 0x00000002;
+}
+
void set_paging(void)
{
set_pd();
- for(size_t i=0;i<1024;i++) set_pt(i,0x00400000 * i); // all 4GB mapped
+ set_pt(768,0x00000000); // maps 0x00000000 to 0xC0000000
+ set_pt(769,0x00400000); // maps 0x00400000 to 0xC0400000
+ set_pt(832,0x000B8000); // maps 0x000B8000 to 0xD0000000
loadPageDirectory(page_directory);
- enablePaging();
+ flushPaging();
}
diff --git a/src/c/shell/game.c b/src/c/shell/game.c
index ce7793b..9e7323e 100644
--- a/src/c/shell/game.c
+++ b/src/c/shell/game.c
@@ -56,8 +56,8 @@ void game_keyboard_handler(uint16_t keycode)
void game_init(void)
{
- x=VGA_WIDTH/2;
- y=VGA_HEIGHT/2;
+ x=(uint16_t)VGA_WIDTH/2;
+ y=(uint16_t)VGA_HEIGHT/2;
game_time=0;
game_tick=0;
duzina=1;
@@ -80,7 +80,7 @@ void game_timer_handler()
{
case 1:
if(y>0) y--;
- else y=VGA_HEIGHT-1;
+ else y=(uint16_t)VGA_HEIGHT-1;
break;
case 2:
if(y<VGA_HEIGHT-1) y++;
@@ -88,7 +88,7 @@ void game_timer_handler()
break;
case 3:
if(x>0) x--;
- else x=VGA_WIDTH-1;
+ else x=(uint16_t)VGA_WIDTH-1;
break;
case 4:
if(x<VGA_WIDTH-1) x++;
diff --git a/src/c/vga.c b/src/c/vga.c
index 84eb538..4e20745 100644
--- a/src/c/vga.c
+++ b/src/c/vga.c
@@ -27,7 +27,8 @@ void terminal_initialize(void)
terminal_row=0;
terminal_column=0;
set_color(VGA_COLOR_LIGHT_GREY, VGA_COLOR_BLACK);
- terminal_buffer=(uint16_t*) 0xB8000;
+ //terminal_buffer=(uint16_t*) 0xC00B8000;
+ terminal_buffer=(uint16_t*) 0xD0000000;
for(size_t y=0;y<VGA_HEIGHT;y++)
{
for(size_t x=0;x<VGA_WIDTH;x++)