Import backup from 2004-03-10

This commit is contained in:
Josh Holtrop 2004-03-10 22:00:00 -05:00
parent 7f886e44e1
commit 302538b8ff
24 changed files with 799 additions and 694 deletions

View File

@ -99,12 +99,12 @@ install_img: $(FLOPPY_IMAGE)
@echo "Writing boot sector to image..."
dd if=stage1.bin of=$(FLOPPY_IMAGE) seek=0
@echo "Mounting floppy image..."
mount $(FLOPPY_IMAGE) $(FLOPPY_MOUNT) -o loop
#################################
# Copy the files onto the image #
#################################
@echo "Mounting floppy image..."
mount $(FLOPPY_IMAGE) $(FLOPPY_MOUNT) -o loop
@echo "Copying stage 2 bootloader to the floppy image..."
$(COPY_BIN) stage2.bin $(FLOPPY_MOUNT)
@echo "Copying kernel to the floppy image..."

View File

@ -1,26 +1,26 @@
%define VERSION "0.13" ;HOS version
%define BOOT_FAT_SEG 0x07E0 ;right after boot sector
%define BOOT_ROOT_SEG 0x0900 ;right after FAT
%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 0x106000 ;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
%define BOOT_HASRD 0x0000 ;1
%define BOOT_VESA 0x0002 ;2 - 0 for console, otherwise VESA mode
%define BOOT_VESA_OEM 0x0004 ;258 - null-terminated OEM identification string
%define BOOT_VESA_VBE 0x0106 ;512 - copy of VESA VBEInfoBlock
%define BOOT_VESA_INFO 0x0306 ;256 - copy of VESA ModeInfoBlock for selected mode
%define BOOT_MEMENTRIES 0x040A ;4 - dword = number of memmap entries
%define BOOT_MEMMAP 0x2000 ;? - memory map information
%define BOOT_DRIVE 0x7C24 ;1 - boot drive
%define VERSION "0.14" ;HOS version
%define BOOT_FAT_SEG 0x07E0 ;right after boot sector
%define BOOT_ROOT_SEG 0x0900 ;right after FAT
%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 0x106000 ;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
%define BOOT_HASRD 0x0000 ;1
%define BOOT_VESA 0x0002 ;2 - 0 for console, otherwise VESA mode
%define BOOT_VESA_OEM 0x0004 ;258 - null-terminated OEM identification string
%define BOOT_VESA_VBE 0x0106 ;512 - copy of VESA VBEInfoBlock
%define BOOT_VESA_INFO 0x0306 ;256 - copy of VESA ModeInfoBlock for selected mode
%define BOOT_MEMENTRIES 0x040A ;4 - dword = number of memmap entries
%define BOOT_MEMMAP 0x2000 ;? - memory map information
%define BOOT_DRIVE 0x7C24 ;1 - boot drive

View File

@ -1,71 +1,71 @@
#####################################################################
# Author: Benjamen R. Meyer #
# Date: 2004-2-15 #
# Purpose: To build Josh Holtrop's OS (HOS) using GNU make #
# Note: This makefile is for use on Linux & other Unix-like systems #
#####################################################################
##############
# Variables: #
##############
# Format of kernel object files:
# Do not change unless you know what you are doing
KERNEL_FORMAT=aout
# Assembler information:
NASM_BIN=nasm
NASM_FLAGS=-f $(KERNEL_FORMAT)
# C Compile Information:
CC=gcc
CC_FLAGS=-ffreestanding -fno-builtin -nostdlib -nodefaultlibs -I.
# Linker Information:
LD=ld
LD_FLAGS=-nodefaultlibs -nostdlib -T link.ld
###############################
# Linking the kernel together #
###############################
all: Asm_Kernel Asm_Functions C_Kernel
$(LD) $(LD_FLAGS) -o kernel.bin -Map ./lst/LDout.doc ks.o fdc.o functions.o kernel.o keyboard.o kio.o mm.o mouse.o stdfont.o video.o vmm.o asmfuncs.o
##########################
# Assembly Kernel Loader #
##########################
Asm_Kernel: kernel.asm
$(NASM_BIN) $(NASM_FLAGS) -o ks.o -l ./lst/kernel.lst kernel.asm
#################################
# Assembly Functions for Kernel #
#################################
Asm_Functions: asmfuncs.asm
$(NASM_BIN) $(NASM_FLAGS) -o asmfuncs.o -l ./lst/asmfuncs.lst asmfuncs.asm
############
# C Kernel #
############
C_Kernel:
$(CC) $(CC_FLAGS) -c kernel.c -o kernel.o
$(CC) $(CC_FLAGS) -c kio.c -o kio.o
$(CC) $(CC_FLAGS) -c functions.c -o functions.o
$(CC) $(CC_FLAGS) -c sys/rtc.c -o rtc.o
$(CC) $(CC_FLAGS) -c sys/pic.c -o pic.o
$(CC) $(CC_FLAGS) -c sys/io.c -o io.o
$(CC) $(CC_FLAGS) -c sys/cmos.c -o cmos.o
$(CC) $(CC_FLAGS) -c string/string.c -o string.o
$(CC) $(CC_FLAGS) -c video/stdfont.c -o stdfont.o
$(CC) $(CC_FLAGS) -c video/video.c -o video.o
$(CC) $(CC_FLAGS) -c block/fdc.c -o fdc.o
$(CC) $(CC_FLAGS) -c char/keyboard.c -o keyboard.o
$(CC) $(CC_FLAGS) -c char/mouse.c -o mouse.o
$(CC) $(CC_FLAGS) -c mm/mm.c -o mm.o
$(CC) $(CC_FLAGS) -c mm/vmm.c -o vmm.o
#################################################
# Clean up the source directory of any binaries #
#################################################
clean:
- rm *.o ./lst/*.lst ./lst/*.doc *.bin
#####################################################################
# Author: Benjamen R. Meyer #
# Date: 2004-2-15 #
# Purpose: To build Josh Holtrop's OS (HOS) using GNU make #
# Note: This makefile is for use on Linux & other Unix-like systems #
#####################################################################
##############
# Variables: #
##############
# Format of kernel object files:
# Do not change unless you know what you are doing
KERNEL_FORMAT=aout
# Assembler information:
NASM_BIN=nasm
NASM_FLAGS=-f $(KERNEL_FORMAT)
# C Compile Information:
CC=gcc
CC_FLAGS=-ffreestanding -fno-builtin -nostdlib -nodefaultlibs -I. -Wall
# Linker Information:
LD=ld
LD_FLAGS=-nodefaultlibs -nostdlib -T link.ld
###############################
# Linking the kernel together #
###############################
all: Asm_Kernel Asm_Functions C_Kernel
$(LD) $(LD_FLAGS) -o kernel.bin -Map ./lst/LDout.doc ks.o kernel.o asmfuncs.o fdc.o functions.o keyboard.o kio.o mm.o mouse.o stdfont.o video.o vmm.o rtc.o pic.o io.o string.o cmos.o
##########################
# Assembly Kernel Loader #
##########################
Asm_Kernel: kernel.asm
$(NASM_BIN) $(NASM_FLAGS) -o ks.o -l ./lst/kernel.lst kernel.asm
#################################
# Assembly Functions for Kernel #
#################################
Asm_Functions: asmfuncs.asm
$(NASM_BIN) $(NASM_FLAGS) -o asmfuncs.o -l ./lst/asmfuncs.lst asmfuncs.asm
############
# C Kernel #
############
C_Kernel:
$(CC) $(CC_FLAGS) -c kernel.c -o kernel.o
$(CC) $(CC_FLAGS) -c kio.c -o kio.o
$(CC) $(CC_FLAGS) -c functions.c -o functions.o
$(CC) $(CC_FLAGS) -c sys/rtc.c -o rtc.o
$(CC) $(CC_FLAGS) -c sys/pic.c -o pic.o
$(CC) $(CC_FLAGS) -c sys/io.c -o io.o
$(CC) $(CC_FLAGS) -c sys/cmos.c -o cmos.o
$(CC) $(CC_FLAGS) -c string/string.c -o string.o
$(CC) $(CC_FLAGS) -c video/stdfont.c -o stdfont.o
$(CC) $(CC_FLAGS) -c video/video.c -o video.o
$(CC) $(CC_FLAGS) -c block/fdc.c -o fdc.o
$(CC) $(CC_FLAGS) -c char/keyboard.c -o keyboard.o
$(CC) $(CC_FLAGS) -c char/mouse.c -o mouse.o
$(CC) $(CC_FLAGS) -c mm/mm.c -o mm.o
$(CC) $(CC_FLAGS) -c mm/vmm.c -o vmm.o
#################################################
# Clean up the source directory of any binaries #
#################################################
clean:
- rm *.o ./lst/*.lst ./lst/*.doc *.bin

71
kernel/Makefile.ms Normal file
View File

@ -0,0 +1,71 @@
#####################################################################
# Author: Benjamen R. Meyer #
# Date: 2004-2-15 #
# Purpose: To build Josh Holtrop's OS (HOS) using GNU make #
# Note: This makefile is for use on Linux & other Unix-like systems #
#####################################################################
##############
# Variables: #
##############
# Format of kernel object files:
# Do not change unless you know what you are doing
KERNEL_FORMAT=aout
# Assembler information:
NASM_BIN=nasm
NASM_FLAGS=-f $(KERNEL_FORMAT)
# C Compile Information:
CC=gcc
CC_FLAGS=-ffreestanding -fno-builtin -nostdlib -nodefaultlibs -I. -Wall
# Linker Information:
LD=ld
LD_FLAGS=-nodefaultlibs -nostdlib -T link.ld
###############################
# Linking the kernel together #
###############################
all: Asm_Kernel Asm_Functions C_Kernel
$(LD) $(LD_FLAGS) -o kernel.bin -Map ./lst/LDout.doc ks.o kernel.o asmfuncs.o fdc.o functions.o keyboard.o kio.o mm.o mouse.o stdfont.o video.o vmm.o
##########################
# Assembly Kernel Loader #
##########################
Asm_Kernel: kernel.asm
$(NASM_BIN) $(NASM_FLAGS) -o ks.o -l ./lst/kernel.lst kernel.asm
#################################
# Assembly Functions for Kernel #
#################################
Asm_Functions: asmfuncs.asm
$(NASM_BIN) $(NASM_FLAGS) -o asmfuncs.o -l ./lst/asmfuncs.lst asmfuncs.asm
############
# C Kernel #
############
C_Kernel:
$(CC) $(CC_FLAGS) -c kernel.c -o kernel.o
$(CC) $(CC_FLAGS) -c kio.c -o kio.o
$(CC) $(CC_FLAGS) -c functions.c -o functions.o
$(CC) $(CC_FLAGS) -c sys/rtc.c -o rtc.o
$(CC) $(CC_FLAGS) -c sys/pic.c -o pic.o
$(CC) $(CC_FLAGS) -c sys/io.c -o io.o
$(CC) $(CC_FLAGS) -c sys/cmos.c -o cmos.o
$(CC) $(CC_FLAGS) -c string/string.c -o string.o
$(CC) $(CC_FLAGS) -c video/stdfont.c -o stdfont.o
$(CC) $(CC_FLAGS) -c video/video.c -o video.o
$(CC) $(CC_FLAGS) -c block/fdc.c -o fdc.o
$(CC) $(CC_FLAGS) -c char/keyboard.c -o keyboard.o
$(CC) $(CC_FLAGS) -c char/mouse.c -o mouse.o
$(CC) $(CC_FLAGS) -c mm/mm.c -o mm.o
$(CC) $(CC_FLAGS) -c mm/vmm.c -o vmm.o
#################################################
# Clean up the source directory of any binaries #
#################################################
clean:
- rm *.o ./lst/*.lst ./lst/*.doc *.bin

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,8 @@
#ifndef __HOS_ASMFUNCS__
#define __HOS_ASMFUNCS__ __HOS_ASMFUNCS__
#include "hos_defines.h"
dword write_cr0(dword cr0);
dword read_cr0();
dword write_cr3(dword cr3);
@ -22,6 +24,7 @@ void *memset(void *buffer, int c, int num);
void *memsetw(void *buffer, int c, int num);
void *memsetd(void *buffer, int c, int num);
dword strlen(char *str);
void invlpg_(dword addr);
#endif

View File

@ -1,23 +1,23 @@
//fdc.h
//Author: Josh Holtrop
//Date: 10/30/03
//Modified: 02/26/04
#ifndef __HOS_FDC__
#define __HOS_FDC__ __HOS_FDC__
#include "sys/io.h"
#define FDC_DOR 0x3f2
#define FDC_MSR 0x3f4
inline void fdc_sendDOR(byte dor);
inline void fdc_sendDOR(byte dor)
{
outportb(FDC_DOR, dor);
}
#endif
//fdc.h
//Author: Josh Holtrop
//Date: 10/30/03
//Modified: 02/26/04
#ifndef __HOS_FDC__
#define __HOS_FDC__ __HOS_FDC__
#include "sys/io.h"
#define FDC_DOR 0x3f2
#define FDC_MSR 0x3f4
//inline void fdc_sendDOR(byte dor);
static inline void fdc_sendDOR(byte dor)
{
outportb(FDC_DOR, dor);
}
#endif

View File

@ -5,6 +5,10 @@
#include "hos_defines.h"
#include "keyboard.h"
#include "sys/io.h"
#include "sys/pic.h"
#include "functions.h"
#include "kio.h"
#define KBD_BUFFER_LENGTH 64
@ -49,13 +53,13 @@ void isr_keyboard()
if (kbdScan == 224) //extended key
{
kbdExt = 1;
eoi();
pic_eoi();
return;
}
if (kbdScan == 225) //2nd-set-extended key
{
kbdExt2 = 2;
eoi();
pic_eoi();
return;
}
@ -117,7 +121,7 @@ void isr_keyboard()
{
if (kbdExt > 0)
kbdExt--;
eoi();
pic_eoi();
return;
}
//====determine ASCII value of key::
@ -182,14 +186,14 @@ void isr_keyboard()
}
if (kbdAscii == 2) //unknown key / ignore key
{
eoi();
pic_eoi();
return;
}
if (kbdScan < KBD_SCAN_RELEASED) //a key was pressed, save it
{
if (kbdBufferLen >= KBD_BUFFER_LENGTH) //no key slots available
{
eoi();
pic_eoi();
return;
}
else
@ -199,7 +203,7 @@ void isr_keyboard()
}
}
eoi();
pic_eoi();
}

View File

@ -4,6 +4,8 @@
#include "mouse.h"
#include "hos_defines.h"
#include "video/video.h"
#include "sys/io.h"
#define MOUSE_BUFFER_LENGTH 16

View File

@ -13,6 +13,7 @@ extern dword _code;
extern dword _bss;
extern dword _end;
/*
inline void enable_ints();
inline void disable_ints();
inline void restart();
@ -21,21 +22,22 @@ inline dword kernel_size();
inline void timer_init();
inline byte bcd2byte(byte bcd);
inline byte byte2bcd(byte bite);
*/
//Enables (SeTs) Interrupt Flag on the processor
inline void enable_ints()
static inline void enable_ints()
{
asm("sti");
}
//Disables (CLears) Interrupt Flag on the processor
inline void disable_ints()
static inline void disable_ints()
{
asm("cli");
}
//Restarts the computer
inline void restart()
static inline void restart()
{
enable_ints();
byte temp;
@ -54,7 +56,7 @@ inline void restart()
}
//Halts (freezes) the computer
inline void halt()
static inline void halt()
{
asm("cli");
asm("hlt");
@ -63,7 +65,7 @@ inline void halt()
}
//Initializes 8253 Programmable Interrupt Timer
inline void timer_init()
static inline void timer_init()
{
//set timer : 2e9c = 100hz
outportb(0x43, 0x34);
@ -75,19 +77,19 @@ inline void timer_init()
// - this does not include the bss section
// - this should be 4kb aligned per the linker script
// - this should be the size of kernel.bin
inline dword kernel_size()
static inline dword kernel_size()
{
return (dword)(&_bss)-(dword)(&_code);
}
//converts a binary-coded-decimal byte to its decimal equivalent
inline byte bcd2byte(byte bcd)
static inline byte bcd2byte(byte bcd)
{
return (10* ((bcd & 0xF0) >> 4)) + (bcd & 0x0F);
}
//converts a binary-coded-decimal byte to its decimal equivalent
inline byte byte2bcd(byte bite)
static inline byte byte2bcd(byte bite)
{
return ((bite / 10) << 4) | (bite % 10);
}

View File

@ -76,7 +76,7 @@ isr_main:
push eax
call _isr
call isr
add esp, 4
@ -98,7 +98,7 @@ sc1:
cmp eax, 1 ;syscall 1 - putc
jnz sc2
push ebx
call _putc
call putc
add esp, 4
jmp scdone
sc2:

View File

@ -15,9 +15,9 @@
%define KERNEL_V KERNEL_P+0xC0000000 ;3gb+1mb+24kb, the virtual address of the kernel
[global start]
[extern _isr]
[extern _k_init]
[extern _putc]
[extern isr]
[extern k_init]
[extern putc]
bits 32
@ -91,7 +91,7 @@ newgdtcontinue:
mov esp, 0xc0200000 ;stack just under 3gb+2mb, moves downward
lidt [idtr] ;load idt
call _k_init
call k_init
haltit:
hlt ;halt processor when k_init is done
jmp haltit ;shouldn't get here...

View File

@ -32,29 +32,29 @@ void k_init()
{
// ===== Initialization
fdc_sendDOR(0x0C); //turn off floppy motor!!
console_cls();
kio_console_cls();
video_init();
mm_init();
vmm_init();
remap_pics(0x20, 0x28);
init_timer();
pic_remap(0x20, 0x28);
timer_init();
mouse_init();
pic1_mask(0); //unmask IRQ's 0-7
pic2_mask(0); //unmask IRQ's 8-15
pic_mask1(0); //unmask IRQ's 0-7
pic_mask2(0); //unmask IRQ's 8-15
enable_ints();
kbd_resetLEDs(); //after enabling interrupts!!
if (video_Mode())
{
int p = video_getWidth()*video_getHeight()-1;
for (; p >= 0; p--)
video_psetp(p, 0x00000077);
video_pseti(p, 0x00000066);
kio_drawConsole();
}
printf("HOS 0.13 - Kernel File Size: %u kb\tData Size: %u bytes\n", kernel_size()>>10, (dword)(&_end)-(dword)(&_code));
printf("HOS 0.14 - Kernel File Size: %u kb\tData Size: %u bytes\n", kernel_size()>>10, (dword)(&_end)-(dword)(&_code));
printf("Memory available to OS: %u MB (%u bytes)\n", mm_getTotalMegs(), mm_getTotalMem());
printf("Free memory: %u bytes (%u pages)\n", mm_freemem(), mm_freemem()>>12);
printf("%d/%d/%d\t%d:%d:%d\n", rtc_readMonth(), rtc_readDay(), rtc_readYear(), rtc_readHour(), rtc_readMinute(), rtc_readSecond());
printf("%b/%b/%b\t%b:%b:%b\n", rtc_readMonth(), rtc_readDay(), rtc_readYear(), rtc_readHour(), rtc_readMinute(), rtc_readSecond());
dword key = 0;
for (;;)
@ -77,14 +77,14 @@ void isr(dword num)
case 0x20: // IRQ0 - timer interrupt
timer++;
(*(byte *)(0xc00b8000))++;
eoi();
pic_eoi();
break;
case 0x21: // IRQ1 - keyboard interrupt
isr_keyboard(); //isr_keybard() takes care of calling eoi()
break;
case 0x2C: // IRQ12 - PS/2 mouse
isr_mouse();
eoi2();
pic_eoi2();
break;
default:
printf("Interrupt %d (0x%x) Unhandled!!\n", num, num);

View File

@ -5,6 +5,8 @@
#include "hos_defines.h"
#include "kio.h"
#include "asmfuncs.h"
#include "video/video.h"
dword cursorPosition = 0; //Caches the current cursor position
word console_memory[2000]; //holds a copy of the console's memory
@ -48,6 +50,10 @@ void printf(char *fmt, ...)
putHex(*params);
params++;
break;
case 'b': case 'B':
kio_putBCD(*params);
params++;
break;
}
}
else
@ -91,7 +97,7 @@ void putc(dword chr)
if (video_Mode())
{
console_memory[cursorPosition] = charac | 0x0700;
video_drawConsoleChar(cursorPosition);
kio_drawConsoleChar(cursorPosition);
}
else
{
@ -111,7 +117,7 @@ void putc(dword chr)
// This function displays a number in hexadecimal
int putHex(dword number)
void putHex(dword number)
{
int hitNum = 0;
int i;
@ -131,14 +137,21 @@ int putHex(dword number)
}
void kio_putBCD(dword bcd)
{
putDecu((bcd & 0xF) >> 4);
putDecu(bcd & 0xF);
}
void kio_console_scroll()
{
memcpyd(console_memory + 80, console_memory, 960);
memcpyd(console_memory, console_memory + 80, 960);
memsetw(console_memory + 1920, 0x0720, 80);
if (video_Mode())
kio_drawConsole();
else
memcpyd(console_memory, 0xC00B8000, 1000);
memcpyd((void *)0xC00B8000, console_memory, 1000);
}
@ -148,7 +161,7 @@ void kio_console_cls()
if (video_Mode())
kio_drawConsole();
else
memcpyd(console_memory, 0xC00B8000, 1000);
memcpyd((void *)0xC00B8000, console_memory, 1000);
writeCursorPosition(0);
}

View File

@ -10,11 +10,12 @@
void printf(char *fmt, ...);
void putc(dword chr);
int putHex(dword number);
void putHex(dword number);
void kio_drawConsole();
void kio_drawConsoleChar(dword position);
void kio_console_scroll();
void kio_console_cls();
void kio_putBCD(dword bcd);
#endif

View File

@ -6,6 +6,10 @@
#include "hos_defines.h"
#include "vmm.h"
#include "video/video.h"
#include "asmfuncs.h"
#include "mm/mm.h"
#include "video/stdfont.h"
HeapEntry *firstHeapEntry = (HeapEntry *)0xD0000000; //this is where heap memory starts
@ -16,7 +20,7 @@ void vmm_init()
unsigned int *pageTables = (unsigned int *)0xC0104000; //this is the location of the page directory
pageTables[0x3FF] = 0x104000|0x03; //the last page directory entry points to the page directory itself
pageTables[0] = 0;
invlpg(0);
invlpg_(0);
if (video_Mode()) //we are in a graphical mode
{
unsigned int vidPages = video_getWidth() * video_getHeight() * (video_getBitsPerPixel() >> 3);
@ -35,7 +39,7 @@ void vmm_init()
heb->entry[0].attributes = VMM_HE_HEB; //this is a HeapEntryBlock
heb->entry[1].base = (unsigned int)firstHeapEntry+4096; //this is the start of the rest of the kernel's heap memory
heb->entry[1].size = 0x10000000-4096; //the rest of the kernel's heap memory: 256mb - 4kb
heb->entry[1].attributes = VMM_HE_HOLE; //this is a hold - an unmapped section of heap memory
heb->entry[1].attributes = VMM_HE_HOLE; //this is a hole - an unmapped section of heap memory
}
@ -64,7 +68,7 @@ void vmm_map1(unsigned int virt, unsigned int physical)
{
unsigned int *newpagetable = (dword *)mm_palloc();
pageTables[pde] = ((unsigned int)newpagetable) | 0x03;
invlpg(virt);
invlpg_(virt);
unsigned int *newpteptr = (unsigned int *)(0xFFC00000 | (pde << 12)); //points to first unsigned int of newly allocated page table
int a;
for (a = 0; a < 1024; a++)
@ -74,7 +78,7 @@ void vmm_map1(unsigned int virt, unsigned int physical)
}
unsigned int *pteptr = (unsigned int *)(0xFFC00000 | (pde << 12) | (pte << 2));
*pteptr = physical | 0x03;
invlpg(virt);
invlpg_(virt);
}
@ -95,7 +99,7 @@ void vmm_unmap1(unsigned int virt)
{
unsigned int *pteptr = (unsigned int *)(0xFFC00000 | ((virt & 0xFFC00000) >> 10) | ((virt & 0x003FF000) >> 10));
*pteptr = 0;
invlpg(virt);
invlpg_(virt);
}

2
kernel/search.sh Normal file
View File

@ -0,0 +1,2 @@
#!/bin/sh
grep -R -n -i $1 *

View File

@ -4,10 +4,12 @@
// Implements string functions
#include "string.h"
#include "asmfuncs.h"
char *strcat(char *dest, char *src)
{
strcpy(dest+strlen(dest), src);
return dest;
}

View File

@ -5,6 +5,7 @@
#include "hos_defines.h"
#include "cmos.h"
#include "sys/io.h"
//Returns the cmos type of floppy disk drive 0 (0 = not present)
unsigned char cmos_getfd0()

View File

@ -8,24 +8,24 @@
#include "hos_defines.h"
inline void outportb(unsigned int port, unsigned char value);
inline void outportw(unsigned int port, unsigned int value);
inline unsigned char inportb(unsigned short port);
//void outportb(unsigned int port, unsigned char value);
//inline void outportw(unsigned int port, unsigned int value);
//inline unsigned char inportb(unsigned short port);
//Writes a byte out to a port
inline void outportb(unsigned int port, unsigned char value) // Output a byte to a port
static inline void outportb(unsigned int port, unsigned char value) // Output a byte to a port
{
asm volatile ("outb %%al,%%dx"::"d" (port), "a" (value));
}
//Writes a word out to a port
inline void outportw(unsigned int port, unsigned int value) // Output a word to a port
static inline void outportw(unsigned int port, unsigned int value) // Output a word to a port
{
asm volatile ("outw %%ax,%%dx"::"d" (port), "a" (value));
}
//Reads a byte from a port
inline unsigned char inportb(unsigned short port)
static inline unsigned char inportb(unsigned short port)
{
unsigned char ret_val;

View File

@ -4,6 +4,7 @@
#include "hos_defines.h"
#include "pic.h"
#include "sys/io.h"
//Re-maps the Programmable Interrupr Controllers so IRQ0->pic1 base address, IRG8->pic2 base address
void pic_remap(int pic1, int pic2)

View File

@ -2,11 +2,12 @@
// Author: Josh Holtrop
// Created: 02/26/04
#include "hos_defines.h"
#ifndef __HOS_PIC__
#define __HOS_PIC__ __HOS_PIC__
#include "hos_defines.h"
#include "sys/io.h"
#define PIC1 0x20
#define PIC2 0xA0
#define PIC1_COMMAND PIC1
@ -28,32 +29,32 @@
#define ICW4_SFNM 0x10 /* Special fully nested (not) */
void pic_remap(int pic1, int pic2);
inline void pic_mask1(byte mask);
inline void pic_mask2(byte mask);
inline void pic_eoi();
inline void pic_eoi2();
//inline void pic_mask1(byte mask);
//inline void pic_mask2(byte mask);
//inline void pic_eoi();
//inline void pic_eoi2();
//Masks interrupts on first Programmable Interrupt Controller
inline void pic_mask1(byte mask)
static inline void pic_mask1(byte mask)
{
outportb(PIC1_DATA, mask); //0x21, maskfield *OCW1*
}
//Masks interrupts on second Programmable Interrupt Controller
inline void pic_mask2(byte mask)
static inline void pic_mask2(byte mask)
{
outportb(PIC2_DATA, mask); //0xA1, maskfield *OCW1*
}
//Signals an End Of Interrupt signal to the first PIC
inline void pic_eoi()
static inline void pic_eoi()
{
outportb(0x20, 0x20);
}
//Signals an End Of Interrupt signal to both the second and first PIC unit
inline void pic_eoi2()
static inline void pic_eoi2()
{
outportb(0xA0, 0x20);
outportb(0x20, 0x20);

View File

@ -7,6 +7,7 @@
#include "hos_defines.h"
#include "rtc.h"
#include "sys/io.h"
unsigned char rtc_readDay()
{

View File

@ -4,6 +4,7 @@
#include "hos_defines.h"
#include "video.h"
#include "video/stdfont.h"
ModeInfoBlock video_mode;
dword videoMode = 0; //what video mode # we are in, 0 for console mode