| Age | Commit message (Collapse) | Author |
|
after hd_init() failed (on a system without a disk), would hang. Now,
hd_read_block() will fail if no hard disk is present on the system (as
indicated by the nblocks count being equal to zero). The same fix also
applies to the hd_write_block() function.
The hd_init() function now returns a status indicating either successful
drive detection and initialization, or failure. This return status won't
likely be needed due to the above bug-fix, but may prove useful in the
future.
Added framework for a block buffer subsystem. This subsystem uses
pre-allocated memory to cache blocks that are requested from the block
device subsystem. Cached blocks are stored on a linked list sorted in
order of usage frequency.
Modified the block read/write functions so that they no longer accept a
length parameter. The block I/O functions will only read or write a
single block at a time. If multiple blocks are required, multiple calls
will have to be made. This is to reduce complexity of block device
drivers and make integration with the new buffer subsystem easier.
Removed all calls to the ATA hard-disk driver. For now, it seems that
floppy media will be best as it allows for real-world hardware testing.
Furthermore, large portions of the hard-disk driver will need to be
re-written anyway once the block buffer subsystem is complete as it only
supports PIO transfers, whilst a buffer system will require DMA
transfers. As the hard-disk was previously the only supported block
device, the block device read/write functions will now always fail,
returning -1.
|
|
inode in memory.
Added a jump instruction in front of the multiboot header so that the
kernel may be run as a binary image. The jump instruction will skip over
the multiboot header to the beginning of the kernel's startup procedure
in kboot.
Moved the call to initialize the timer to earlier in the boot sequence.
This is to allow for some drivers that may require it's functionality
during the startup to function properly.
Added functionality for the 'fast-gate' to the enable_a20 subroutine.
Now, if the keyboard controller method fails when enabling the gate, an
attempt is made to enable the A20 gate using the PS/2's fast-gate
interface. If this also fails, the kernel will panic.
Implemented TTY output for the console. The console is now TTY device 0
(the default for new userspace programs).
|
|
to make management/maintenance easier.
Defined the structures super_block and m_inode in kernel/fs.h for super
blocks and inodes respectively.
Added the new header file sys/stat.h which contains basic definitions
for inode types and permissions. These definitions will be required by
any functions handling m_inode structures.
Moved the sys_read and sys_write system calls to the filesystem's main
source file at kernel/fs/fs.c.
Added the file kernel/fs/mount.c which will contain the super-blocks
table as well as the function mount_root() which will attempt to mount
the root filesystem during boot. Eventually, this file will be expanded
to include a general-purpose mount function to mount any filesystem as
well as the system call handler for sys_mount.
Seperated block I/O functions into their own subsystem under
kernel/fs/block.c which currently supports two functions; block_read()
and block_write() to read and write blocks from block devices.
Currently, no device can be specified since the primary ATA master drive
is the only possible target. This will change in the future however.
Modified the hard disk driver's read and write functions to use
filesystem blocks rather than sectors as the units of transfer. This is
intended to keep the block I/O subsystem simple by ensuring a uniform
transfer unit is used across all block devices and drivers.
The hard disk driver is no longer initialized during the main boot
procedure. Instead, a call is made to the new function fs_init() which
will setup filesystem tables and structures, call hd_init() to
initialize the disk and finally, attempt to load the super-block for the
root filesystem.
The hard disk driver now stores the disk's size and sanity checks
addresses and sizes in read and write calls against this value.
|
|
Added the _syscall2 macro to unistd.h to facilitate system calls that
require two arguments to be passed.
Modified the ATA driver to simply abort initialisation if a drive is not
found, or cannot be configured. This will allow the kernel to function
on a diskless system without invoking panic() unnecessarily.
Added the functions irq_enable() and irq_disable() to asm/interrupt.h to
make it easier for C code to mask and unmask IRQ's on each PIC.
Moved the declaration for rsputs() from kernel/con.h to the new
kernel/serial.h file since this is a function provided by the serial
driver.
Implemented a basic I/O input framework. This involves the new system
call sys_read, which takes an I/O read request and directs it to the
appropriate kernel handler function depending on the calling process'
ctty value. This mechanism is identical to the sys_puts system call.
Added the rsread() function to service sys_read calls from processes
whose ctty value is equal to 1. This function will continually copy data
from the serial buffer to the location specified. If there is not a
sufficient amount of new data in the buffer to satisfy the request, the
process is put into the TSTATE_UNINTERRUPTIBLE state and the scheduler
is called to switch tasks. Prior to calling the scheduler, the function
will set the waiting_task pointer to the calling process. This pointer
will later be used by the interrupt handler to wake the process when new
data arrives.
Added an interrupt handler to service the IRQ4 (UART) interrupt. This
subroutine is a stub which will save the machine's state then transfer
control to rs_handler() in serial.c which will read bytes from the
serial port and place them in a buffer. Before returning, rs_handler()
checks the waiting_task pointer to see if a task is waiting for the
newly received data and if so, it sets the task's state to
TSTATE_RUNNING before resetting the pointer to NULL and returning.
Ideally, the scheduler should be invoked at this point to select another
task but since our basic round-robin scheduler currently has no concept
of task priorities (and for the sake of simplicity), we will avoid
invoking the scheduler in response to interrupts for now.
|
|
be used freely throughout the kernel.
|