Import backup from 2004-01-20

This commit is contained in:
Josh Holtrop 2004-01-20 22:00:00 -05:00
parent 10fd7102ca
commit 21e3943b5e
6 changed files with 32 additions and 18 deletions

View File

@ -45,6 +45,16 @@ _write_cr3:
pop ebp pop ebp
ret ret
;returns the value in the CR2 register
;extern dword read_cr2();
[global _read_cr2]
_read_cr2:
mov eax, cr2;
ret
;returns the value in the CR3 register ;returns the value in the CR3 register
;extern dword read_cr3(); ;extern dword read_cr3();
[global _read_cr3] [global _read_cr3]

View File

@ -5,7 +5,7 @@
idtr: idtr:
dw 50*8-1 ;size of idt dw 50*8-1 ;size of idt
dd IDT_P ;address of idt dd IDT_V ;address of idt
%macro isr_label 1 %macro isr_label 1
@ -96,6 +96,7 @@ isr_syscall:
push ebx push ebx
call _putc call _putc
add esp, 4
pop es pop es
pop ds pop ds

View File

@ -16,6 +16,7 @@
[global start] [global start]
[extern _isr] [extern _isr]
[extern _k_init] [extern _k_init]
[extern _putc]
bits 32 bits 32

View File

@ -27,6 +27,7 @@ void k_init();
extern dword write_cr0(dword cr0); extern dword write_cr0(dword cr0);
extern dword read_cr0(); extern dword read_cr0();
extern dword write_cr3(dword cr3); extern dword write_cr3(dword cr3);
extern dword read_cr2();
extern dword read_cr3(); extern dword read_cr3();
extern void writeCursorPosition(dword pos); extern void writeCursorPosition(dword pos);
extern dword getCursorPosition(); extern dword getCursorPosition();
@ -83,20 +84,19 @@ void k_init()
printf("Free memory: %u bytes (%u pages)\n", mm_freemem(), mm_freemem()>>12); printf("Free memory: %u bytes (%u pages)\n", mm_freemem(), mm_freemem()>>12);
printf("Root Directory: %s/\n", rootDevice->id); printf("Root Directory: %s/\n", rootDevice->id);
int a;
byte *addr = 0;
for (a = 0; a < 5; a++)
{
byte *app = mm_palloc();
vmm_map1((dword)addr, (dword)app);
addr += 4096;
}
// int a; addr = vfs_readFile("/bin/hash.hos");
// byte *addr = 0; memcpy(0, addr, 4192);
// for (a = 0; a < 2; a++) asm("call 0");
// { free(addr);
// byte *app = mm_palloc();
// vmm_map1((dword)addr, (dword)app);
// addr += 4096;
// }
// addr = vfs_readFile("/bin/hash.hos");
// memcpy(0, addr, 8192);
// asm("call 0");
dword key = 0; dword key = 0;
for (;;) for (;;)
@ -112,6 +112,10 @@ void isr(dword num)
{ {
switch(num) switch(num)
{ {
case 14:
printf("Page fault, CR2 = 0x%x\n", read_cr2());
halt();
break;
case 0x20: // IRQ0 - timer interrupt case 0x20: // IRQ0 - timer interrupt
timer++; timer++;
(*(byte *)(0xc00b8000))++; (*(byte *)(0xc00b8000))++;
@ -126,6 +130,7 @@ void isr(dword num)
break; break;
default: default:
printf("Interrupt %d (0x%x) Unhandled!!\n", num, num); printf("Interrupt %d (0x%x) Unhandled!!\n", num, num);
halt();
break; break;
} }
} }

View File

@ -9,10 +9,7 @@ void video_init()
videoMode = *(word *)0xC0090002; videoMode = *(word *)0xC0090002;
if (!videoMode) //we are in console mode if (!videoMode) //we are in console mode
{
video_psetp = &video_psetpnull;
return; return;
}
video_mode = *(ModeInfoBlock *) 0xC0090306; video_mode = *(ModeInfoBlock *) 0xC0090306;

View File

@ -63,7 +63,7 @@ word *vid_ptr16 = (word *)0xF0000000;
byte *vid_ptr24 = (byte *)0xF0000000; byte *vid_ptr24 = (byte *)0xF0000000;
dword *vid_ptr32 = (dword *)0xF0000000; dword *vid_ptr32 = (dword *)0xF0000000;
word console_memory[2000]; //holds a copy of the console's memory word console_memory[2000]; //holds a copy of the console's memory
void (*video_psetp)(int, dword); //function pointer to set a pixel void (*video_psetp)(int, dword) = video_psetpnull; //function pointer to set a pixel