Import backup from 2003-10-16

This commit is contained in:
josh committed 2017-07-25 22:23:45 -04:00
1 parent 5da602b162
commit 8bf6e65a95
7 files changed
+38 -3

No files matched your search

+8
View File
@@ -71,6 +71,14 @@ inline void restart()
}
}
inline void halt()
{
asm("cli");
asm("hlt");
while (1)
;
}
inline void eoi()
{
outportb(0x20, 0x20); //EOI
+1
View File
@@ -10,6 +10,7 @@ inline byte inportb(unsigned short port);
void enable_ints();
void disable_ints();
inline void restart();
inline void halt();
void remap_pics(int pic1, int pic2);
inline void pic1_mask(byte mask);
inline void pic2_mask(byte mask);
+4 -1
View File
@@ -29,8 +29,11 @@
#define BRWHITE_TXT 0x0F
#define FREERAM_START 0x268000
#define MAX_RAM 0x40000000 //1gb maximum RAM supported
#define KERNEL_PID 0x02
#define PID_KERNEL 0x02
#define PID_VMM 0x03
#define PID_USER 0x10000
typedef unsigned char byte;
typedef unsigned short word;
+3
View File
@@ -13,6 +13,7 @@
#include "functions.h"
#include "video.h"
#include "mm.h"
#include "vmm.h"
#include "keyboard.h"
#include "mouse.h"
@@ -22,6 +23,7 @@ void k_init();
#include "mouse.c"
#include "keyboard.c"
#include "mm.c"
#include "vmm.c"
#include "functions.c"
#include "video.c"
@@ -68,6 +70,7 @@ void k_init()
}
mm_init();
vmm_init();
mouse_init();
enable_ints();
printf("Memory available to OS: %d MB (Bytes: %d)\n", mm_totalmem/0x100000, mm_totalmem);
+4 -1
View File
@@ -6,6 +6,7 @@
pageblock *first_pageblock = (pageblock *) 0;
dword mm_totalmem = 0x100000; //start counting from 1mb
dword mm_highestAddress = 0;
void mm_init()
{
@@ -17,6 +18,8 @@ void mm_init()
if (maps[a].attributes == 1) // (1) mem free to OS
{
mm_totalmem += maps[a].limit.lowdword;
if (mm_highestAddress < (maps[a].base.lowdword + maps[a].limit.lowdword))
mm_highestAddress = maps[a].base.lowdword + maps[a].limit.lowdword;
if ((maps[a].base.lowdword + maps[a].limit.lowdword) > (FREERAM_START+8192)) //goes past where we start freeram
{
if (maps[a].base.lowdword < FREERAM_START)
@@ -82,7 +85,7 @@ void mm_init_pageblockpage(pageblock *pbp)
void *mm_palloc(dword numpages, dword proc_pid)
{
if (proc_pid < KERNEL_PID)
if (proc_pid < PID_KERNEL)
return 0;
pageblock *pb = first_pageblock;
if (mm_freeentries() < 2)
+16 -1
View File
@@ -3,6 +3,21 @@
// Author: Josh Holtrop
// Date: 09/30/03
void *vmm_PDBR;
void vmm_init()
{
if(!(vmm_PDBR = mm_palloc(1, PID_KERNEL)))
{
printf("ERROR! COULD NOT ALLOCATE PAGE FOR INITIAL PAGE DIRECTORY!!");
halt();
}
}
void *malloc(dword bytes)
{
@@ -12,7 +27,7 @@ void *malloc(dword bytes)
int free(void *ptr);
int free(void *ptr)
{
+2
View File
@@ -4,6 +4,7 @@
// Date: 09/30/03
void vmm_init();
void *malloc(dword bytes);
int free(void *ptr);
@@ -11,3 +12,4 @@ int free(void *ptr);