| Age | Commit message (Collapse) | Author |
|
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.
|
|
rather than in kmain() as some subsystems may now require early console
I/O.
Added 16-bit read/write I/O functions to asm/io.h. These functions are
inw() and outw() respectively.
Added the file kernel/fs.h which will contain definitions relating to
filesystem functions.
Defined the type off_t as a signed 32-bit value in sys/types.h. This
type will be required for filesystem functionality.
Added the directory 'kernel/fs' to the project's source tree. The
kernel's makefile has been updated accordingly. This directory will
contain any source files relating to filesystem functionality (both
assembly and C files).
Added the file 'fs/hd.c' to the kernel's source tree. This file
currently contains three main functions (which are defined in
kernel/hd.h). These functions are as follows; hd_init() to enumerate and
initialize the hard disks, hd_read() to read sectors from the disk and
hd_write() to write sectors to the disk. Currently, all transfers are
done in ATA PIO mode using polling, however this will change in future.
The function hd_init() is called during the kernel's boot sequence in
kboot().
Added the file hd.img to the project's root directory. This is a 20MB
raw image file that will be used by Qemu as a 20MB hard disk. The main
makefile has been updated to tell Qemu to use this file on launch.
|
|
is produced. This may change later.
Added the new directory 'lib' to the source tree which build lib.a, an
archive containing common library routines for both the kernel and
userspace code to use.
Added the file string.c to the lib directory (as well as the appropriate
headers in /include) which provides some basic functions from the
standard C string library.
Added a physical memory manager which is now located in memory.c. This
memory manager tracks free pages from 1MB-8MB with a simple table and
allocates memory in blocks of 4KB pages. Multiple pages can be allocated
in which they are returned as a linked list.
Added a 'page window' in memory.c which allows the temporary mapping of
a single page at a time into the current address space.
Moved all paging routines that were previously located in page.s over to
memory.c where they have been re-implemented as a mixture of C and
inline assembly.
Moved the primative userspace routines from usrspace.s over to the new
sched.c. The only remaining routine, usrcall is now located in asm.s as
'switch_to' which takes two arguments, pointers to the task structure
and task state structure of the new task which is being switched to.
Pages for userspace are now allocated dynamically. The user binary is
loaded in at 1GB upwards. The user stack is located at the end of the
4GB address space with the lower 1GB being reserved for the kernel.
Updated the link.ld file for the userspace binary to include the new
starting address 0x40000000 (1GB).
Renamed the symbols for the user binary blob to make them shorter.
|
|
assembly function register_isr making it usable within the C portions of
the source.
Added a new file panic.s with the function panic that will print a panic
message, disable interrupts and halt the system.
Created the skeleton framework for paging in the new file page.s. The
new function paging_init (called in kboot) will setup a simple page
directory with two tables covering all addresses 0-8MB. It will also
mark pages from 0-1MB as 'supervisor-only' to protect the kernel. NOTE:
The function paging_init must be called before initialising the IDT as
it does not disable interrupts!
Modified the page fault handler to print the offending linear address
along with the supplied error code. Following that, the handler will
initiate a kernel panic. This function (along with panic) assumes
console I/O to be operational.
Modified the userspace test code to deliberately intiate a page fault by
accessing an unmapped page.
|
|
Hopefully further separation will help to keep the code readable and
understandable.
|
|
invoking the tool recursively.
Disabled GCC's position-independent-code generation in makefiles.
Modified makefile for kernel/usrbin so that it now compiles and links C
code into the userspace test.
Created errno.h and populated it with standard error definitions.
Replaced the va_list based system call handlers with a system call table
defined in the header kernel/sys.h. NOTE: This header is included in
kmain.c and should ONLY be included there! Do NOT include this header in
sys.c.
Rather than fetching the user's stack pointer and using it to initialize
a va_list, parameters are now passed to the call handlers via the
general purpose registers EAX, EBX, ECX and EDX where EAX contains the
requested call number and conveys the return value.
Setup macros in unistd.h to aid to making system calls from userspace.
Implemented two basic system calls; sys_print and sys_dummy. The former
takes a single char* argument and displays it on screen whilst the
latter is used to populate otherwise empty entries of the system call
table. sys_dummy returns the error ENOSYS whenever it is called.
|
|
|