Import backup from 2003-12-21

This commit is contained in:
Josh Holtrop 2003-12-21 22:00:00 -05:00
parent 3bb1e5fffc
commit 282b856e24
8 changed files with 25 additions and 9 deletions

View File

@ -6,7 +6,7 @@
%define BOOT_KERNEL_SEG 0x0AC0 ;right after ROOT_DIR
%define BOOT_STAGE2_SEG 0x0B00 ;right after KERNEL_SEG
%define BOOT_STAGE2_ADD 0xB000 ;address of stage2 to jump to, org at
%define BOOT_KERNEL_ADD 0x100000 ;final pmode kernel destination - physical
%define BOOT_KERNEL_ADD 0x104000 ;final pmode kernel destination - physical
%define BOOT_RD_ADD 0x200000 ;2mb for ram disk
%define BOOT_DATA_SEG 0x9000 ;data gathered by stage2 loader goes here

BIN
k.bin Normal file

Binary file not shown.

View File

@ -4,8 +4,8 @@
%include "bootdef.inc"
%define GDT 0x140000
%define IDT 0x150000
%define GDT 0x100000
%define IDT 0x102000
[global start]
[extern _isr]
@ -65,4 +65,3 @@ haltit:
%include "idt.inc"

View File

@ -56,6 +56,22 @@ void k_init()
enable_ints();
kbd_resetLEDs(); //after enabling interrupts!!
char *bmpptr = (char *)0x108000+54;
int a = 0;
int x = 0;
int y = 479;
for (a=0; a < 640*480; a++)
{
video_pset(x, y, *(dword *)bmpptr);
bmpptr += 3;
x++;
if (x == 640)
{
x = 0;
y--;
}
}
printf("HOS 0.12 - Kernel Size: %d kb\n", kernel_size()/1024);
printf("Memory available to OS: %d MB (Bytes: %d)\n", mm_totalmem/0x100000, mm_totalmem);
printf("Free memory: %d bytes\n", mm_freemem());
@ -64,7 +80,7 @@ void k_init()
for (;;)
{
key = kbdWaitKey();
// if (((key & 0xFF00) >> 8) != 2) //key is not a control key
if ((key & 0xFF) > 2) //key is not a control key
putc(key);
}
}

View File

@ -171,6 +171,7 @@ void isr_keyboard()
}
//====do something with key::
// printf("kbdScan == %d\nkbdAscii == %d\nkbdFlags == %d\n", kbdScan, kbdAscii, kbdFlags);
if ((kbdScan == 83) && (kbdFlags & KBD_CTRL) && (kbdFlags & KBD_ALT))
{
printf("Initiating reboot.");

View File

@ -2,7 +2,7 @@ OUTPUT_FORMAT("binary")
ENTRY(start)
SECTIONS
{
.text 0x100000 : {
.text 0x104000 : {
code = .; _code = .; __code = .;
*(.text)
. = ALIGN(4096);

BIN
rivercity.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 KiB

6
vmm.c
View File

@ -29,7 +29,7 @@ void vmm_init()
//we also need to map in the video framebuffer memory:
if (video_mode.PhysBasePtr > 0 && video_mode.BitsPerPixel > 0)
{
if (vmm_mapn(video_mode.PhysBasePtr, video_mode.PhysBasePtr, 0x03, (video_mode.BitsPerPixel/8 * video_mode.XResolution * video_mode.YResolution)/4096+1))
if (vmm_mapn(video_mode.PhysBasePtr, video_mode.PhysBasePtr, 0x03, ((video_mode.BitsPerPixel>>3) * video_mode.XResolution * video_mode.YResolution)/4096+1))
{
printf("Could not page in video memory at 0x%x!\n", video_mode.PhysBasePtr);
halt();
@ -92,10 +92,10 @@ int vmm_mapn(dword virtual, dword physical, dword flags, dword n)
int vmm_unmap1(dword virtual)
{
int pde = (virtual & 0xFFC00000) >> 22;
int pte = (virtual & 0x003FF000) >> 12;
if (virtual & 0x00000FFF)
return 1; // ERROR 1: address not page-aligned
int pde = (virtual & 0xFFC00000) >> 22;
int pte = (virtual & 0x003FF000) >> 12;
if (!(vmm_PDBR->pageTables[pde] & 0x01))
return 2; // ERROR 2: page table not present
PageTable *ptp = (PageTable *)(vmm_PDBR->pageTables[pde] & 0xFFFFF000);