Import backup from 2004-03-15

This commit is contained in:
Josh Holtrop 2004-03-15 22:00:00 -05:00
parent ab576bf18f
commit 7110307896
4 changed files with 160 additions and 163 deletions

233
Makefile
View File

@ -1,116 +1,117 @@
#####################################################################
# 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: #
##############
# Information for creating a floppy image
# Note: FLOPPY_FS and FLOPPY_FAT_SIZE are related fields.
# FLOPPY_FAT_SIZE should be either 12 or 16,
# depending on if FLOPPY_FS is FAT12 or FAT16, respectively.
MKDOSFS_PROG=/sbin/mkdosfs
FLOPPY_IMAGE=floppy.img
FLOPPY_BLOCK_COUNT=1440
FLOPPY_FS=FAT12
FLOPPY_FAT_SIZE=12
FLOPPY_MOUNT=./floppy_image
# Floppy images are good for programs like VMware and Bochs Pentium Emulator. ;-)
# Program for copying
COPY_BIN=cp
##########################################
# Build the IPL (Boot Loader) and Kernel #
##########################################
all:
# A word of warning to users :-> And a little helpful information ;-)
@echo "Installation must be done as root."
@echo "Type 'make install' to install to a floppy in drive '/dev/fd0'"
@echo "Type 'make install_img' to create a floppy image and install to it."
cd boot; make
cd kernel; make
#################################################
# Clean up the source directory of any binaries #
#################################################
clean:
cd boot; make clean
cd kernel; make clean
###########################################
# The following is for the floppy drive #
# Note: This must be done on *nix as root #
###########################################
##########################
# Make install to floppy #
##########################
install: Install_IPL File_Copy
############################################
# Write the Stage 1 IPL to the boot sector #
############################################
Install_IPL:
$(MKDOSFS_PROG) /dev/fd0
dd if=boot/stage1.bin of=/dev/fd0
#################################
# Copy the files onto the drive #
#################################
File_Copy:
mkdir floppy_mount
@echo "Mounting floppy to ./floppy_mount..."
mount /dev/fd0 ./floppy_mount
@echo "Copying stage 2 bootloader to the floppy..."
$(COPY_BIN) boot/stage2.bin ./floppy_mount
@echo "Copying kernel to the floppy..."
$(COPY_BIN) kernel/kernel.bin ./floppy_mount
@echo "Unmounting floppy..."
umount ./floppy_mount
rm -rf floppy_mount
############################################
# The following is for the floppy image. #
# Note: This must be done on *nix as root. #
############################################
######################################
# Create and Format the floppy image #
######################################
install_img:
$(MKDOSFS_PROG) -C -F $(FLOPPY_FAT_SIZE) -r 112 $(FLOPPY_IMAGE) $(FLOPPY_BLOCK_COUNT)
############################################
# Write the Stage 1 IPL to the boot sector #
############################################
@echo "Writing boot sector to image..."
dd if=stage1.bin of=$(FLOPPY_IMAGE) seek=0
#################################
# 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..."
$(COPY_BIN) kernel.bin $(FLOPPY_MOUNT)
@echo "Unmounting floppy image..."
mount $(FLOPPY_IMAGE) $(FLOPPY_MOUNT) -o loop
#####################################################################
# 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: #
##############
# Information for creating a floppy image
# Note: FLOPPY_FS and FLOPPY_FAT_SIZE are related fields.
# FLOPPY_FAT_SIZE should be either 12 or 16,
# depending on if FLOPPY_FS is FAT12 or FAT16, respectively.
MKDOSFS_PROG=/sbin/mkdosfs
FLOPPY_IMAGE=floppy.img
FLOPPY_BLOCK_COUNT=1440
FLOPPY_FS=FAT12
FLOPPY_FAT_SIZE=12
FLOPPY_MOUNT=./floppy_image
# Floppy images are good for programs like VMware and Bochs Pentium Emulator. ;-)
# Program for copying
COPY_BIN=cp
##########################################
# Build the IPL (Boot Loader) and Kernel #
##########################################
all:
# A word of warning to users :-> And a little helpful information ;-)
@echo "Installation must be done as root."
@echo "Type 'make install' to install to a floppy in drive '/dev/fd0'"
@echo "Type 'make install_img' to create a floppy image and install to it."
cd boot; make
cd kernel; make
#################################################
# Clean up the source directory of any binaries #
#################################################
clean:
cd boot; make clean
cd kernel; make clean
###########################################
# The following is for the floppy drive #
# Note: This must be done on *nix as root #
###########################################
##########################
# Make install to floppy #
##########################
install: Install_IPL File_Copy
############################################
# Write the Stage 1 IPL to the boot sector #
############################################
Install_IPL:
$(MKDOSFS_PROG) /dev/fd0
dd if=boot/stage1.bin of=/dev/fd0
#################################
# Copy the files onto the drive #
#################################
File_Copy:
- mkdir floppy_mount
@echo "Mounting floppy to ./floppy_mount..."
mount /dev/fd0 ./floppy_mount
@echo "Copying stage 2 bootloader to the floppy..."
$(COPY_BIN) boot/stage2.bin ./floppy_mount
@echo "Copying kernel to the floppy..."
$(COPY_BIN) kernel/kernel.bin ./floppy_mount
@echo "Unmounting floppy..."
umount ./floppy_mount
- rm -rf floppy_mount
############################################
# The following is for the floppy image. #
# Note: This must be done on *nix as root. #
############################################
######################################
# Create and Format the floppy image #
######################################
install_img:
$(MKDOSFS_PROG) -C -F $(FLOPPY_FAT_SIZE) -r 112 $(FLOPPY_IMAGE) $(FLOPPY_BLOCK_COUNT)
############################################
# Write the Stage 1 IPL to the boot sector #
############################################
@echo "Writing boot sector to image..."
dd if=stage1.bin of=$(FLOPPY_IMAGE) seek=0
#################################
# Copy the files onto the image #
#################################
- mkdir $(FLOPPY_MOUNT)
@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..."
$(COPY_BIN) kernel.bin $(FLOPPY_MOUNT)
@echo "Unmounting floppy image..."
mount $(FLOPPY_IMAGE) $(FLOPPY_MOUNT) -o loop

View File

@ -1,33 +1,42 @@
// vfs.c
// Author: Josh Holtrop
// Date: 03/11/04
#include "vfs.h"
#include "hos_defines.h"
Volume *firstVolume = 0;
void vfs_init()
{
dword initrdLoaded = *(byte *)BOOT_HASRD;
}
Volume *vfs_newVolume()
{
Volume *vol = malloc(sizeof(Volume));
vfs_getLastVolume()->link = vol;
return vol;
}
Volume *vfs_getLastVolume()
{
Volume *vol = firstVolume;
while (vol)
vol = vol->link;
return vol;
}
// vfs.c
// Author: Josh Holtrop
// Date: 03/11/04
#include "vfs.h"
#include "hos_defines.h"
Volume *firstVolume = 0;
Volume *rootVolume = 0;
void vfs_init()
{
if(*(byte *)BOOT_HASRD) //bootloader loaded an initial ram disk
{
Volume *initrd = vfs_newVolume();
RamDisk *rd = rd_newDisk(0xC0200000, 1440*1024);
initrd->diskDevice = rd;
initrd->deviceType = VFS_RD;
strcpy(initrd->label, "rd0");
initrd->link = 0;
rootVolume = initrd;
}
}
Volume *vfs_newVolume()
{
Volume *vol = malloc(sizeof(Volume));
vfs_getLastVolume()->link = vol;
return vol;
}
Volume *vfs_getLastVolume()
{
Volume *vol = firstVolume;
while (vol)
vol = vol->link;
return vol;
}

View File

@ -139,7 +139,7 @@ void putHex(dword number)
void kio_putBCD(dword bcd)
{
putc(((bcd & 0xF) >> 4) + '0');
putc(((bcd & 0xF0) >> 4) + '0');
putc((bcd & 0xF) + '0');
}

View File

@ -1,13 +0,0 @@
Exception: STATUS_ACCESS_VIOLATION at eip=00462A1A
eax=00000000 ebx=00001000 ecx=0A04865C edx=00000200 esi=0A04724C edi=FFFFFE00
ebp=0022EB88 esp=0022EB20 program=C:\cygwin\bin\ld.exe
cs=001B ds=0023 es=0023 fs=0038 gs=0000 ss=0023
Stack trace:
Frame Function Args
0022EB88 00462A1A (0A046CD8, 0022EC70, 0A04EF10, 610D3F69)
0022EE68 00448567 (0A046CD8, 30303030, 0022EE00, 0A04E758)
0022EEF8 0043FCA0 (0A046CD8, 0041BBDE, 77E88AC8, FFFFFFFF)
0022EF40 0041C322 (0000001B, 6167241C, 0A0400A8, 0022EF98)
0022EF80 61005DE0 (0022EF98, 00000000, 002304CC, 536CD652)
0022FF90 61005EE5 (00000000, 00000000, 00000000, 00000000)
End of stack trace