Import backup from 2004-01-20
This commit is contained in:
parent
10fd7102ca
commit
21e3943b5e
10
asmfuncs.asm
10
asmfuncs.asm
@ -45,6 +45,16 @@ _write_cr3:
|
||||
pop ebp
|
||||
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
|
||||
;extern dword read_cr3();
|
||||
[global _read_cr3]
|
||||
|
3
idt.inc
3
idt.inc
@ -5,7 +5,7 @@
|
||||
|
||||
idtr:
|
||||
dw 50*8-1 ;size of idt
|
||||
dd IDT_P ;address of idt
|
||||
dd IDT_V ;address of idt
|
||||
|
||||
|
||||
%macro isr_label 1
|
||||
@ -96,6 +96,7 @@ isr_syscall:
|
||||
|
||||
push ebx
|
||||
call _putc
|
||||
add esp, 4
|
||||
|
||||
pop es
|
||||
pop ds
|
||||
|
@ -16,6 +16,7 @@
|
||||
[global start]
|
||||
[extern _isr]
|
||||
[extern _k_init]
|
||||
[extern _putc]
|
||||
|
||||
bits 32
|
||||
|
||||
|
31
kernel.c
31
kernel.c
@ -27,6 +27,7 @@ void k_init();
|
||||
extern dword write_cr0(dword cr0);
|
||||
extern dword read_cr0();
|
||||
extern dword write_cr3(dword cr3);
|
||||
extern dword read_cr2();
|
||||
extern dword read_cr3();
|
||||
extern void writeCursorPosition(dword pos);
|
||||
extern dword getCursorPosition();
|
||||
@ -82,21 +83,20 @@ void k_init()
|
||||
printf("Memory available to OS: %u MB (%u bytes)\n", mm_megabytes, mm_totalmem);
|
||||
printf("Free memory: %u bytes (%u pages)\n", mm_freemem(), mm_freemem()>>12);
|
||||
printf("Root Directory: %s/\n", rootDevice->id);
|
||||
|
||||
|
||||
// int a;
|
||||
// byte *addr = 0;
|
||||
// for (a = 0; a < 2; a++)
|
||||
// {
|
||||
// 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");
|
||||
int a;
|
||||
byte *addr = 0;
|
||||
for (a = 0; a < 5; a++)
|
||||
{
|
||||
byte *app = mm_palloc();
|
||||
vmm_map1((dword)addr, (dword)app);
|
||||
addr += 4096;
|
||||
}
|
||||
|
||||
addr = vfs_readFile("/bin/hash.hos");
|
||||
memcpy(0, addr, 4192);
|
||||
asm("call 0");
|
||||
free(addr);
|
||||
|
||||
dword key = 0;
|
||||
for (;;)
|
||||
@ -112,6 +112,10 @@ void isr(dword num)
|
||||
{
|
||||
switch(num)
|
||||
{
|
||||
case 14:
|
||||
printf("Page fault, CR2 = 0x%x\n", read_cr2());
|
||||
halt();
|
||||
break;
|
||||
case 0x20: // IRQ0 - timer interrupt
|
||||
timer++;
|
||||
(*(byte *)(0xc00b8000))++;
|
||||
@ -126,6 +130,7 @@ void isr(dword num)
|
||||
break;
|
||||
default:
|
||||
printf("Interrupt %d (0x%x) Unhandled!!\n", num, num);
|
||||
halt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
3
video.c
3
video.c
@ -9,10 +9,7 @@ void video_init()
|
||||
videoMode = *(word *)0xC0090002;
|
||||
|
||||
if (!videoMode) //we are in console mode
|
||||
{
|
||||
video_psetp = &video_psetpnull;
|
||||
return;
|
||||
}
|
||||
|
||||
video_mode = *(ModeInfoBlock *) 0xC0090306;
|
||||
|
||||
|
2
video.h
2
video.h
@ -63,7 +63,7 @@ word *vid_ptr16 = (word *)0xF0000000;
|
||||
byte *vid_ptr24 = (byte *)0xF0000000;
|
||||
dword *vid_ptr32 = (dword *)0xF0000000;
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user