Modified:
trunk/LICENSE
trunk/include/Affinity/gdt.h
trunk/include/Affinity/idt.h
trunk/include/Affinity/keyboard.h
trunk/include/Affinity/text_mode.h
trunk/include/Affinity/timer.h
trunk/include/Affinity/x86.h
trunk/kernel/Makefile
trunk/kernel/gdt.c
trunk/kernel/idt.c
trunk/kernel/main.c
trunk/kernel/start.asm
trunk/kernel/text_mode.c
Log:
Updated code.
Modified: trunk/LICENSE
==============================================================================
--- trunk/LICENSE (original)
+++ trunk/LICENSE Thu Aug 3 02:07:11 2006
@@ -1,4 +1,4 @@
-Copyright (c) 2006, Tom Bell (TomB)
+Copyright (c) 2006, Tom Bell
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -11,7 +11,7 @@
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- * Neither the name of the Tom Bell (TomB) nor the names of its contributors
+ * Neither the name of the Tom Bell nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
Modified: trunk/include/Affinity/gdt.h
==============================================================================
--- trunk/include/Affinity/gdt.h (original)
+++ trunk/include/Affinity/gdt.h Thu Aug 3 02:07:11 2006
@@ -15,7 +15,7 @@
/*
Defines a GDT entry.
*/
-typedef struct
+typedef struct gdt_entry
{
unsigned short nLimit_low;
unsigned short nBase_low;
@@ -28,11 +28,11 @@
/*
Special pointer which includes the limit: The max bytes taken up by the GDT, minus 1.
*/
-struct gdt_ptr
+typedef struct gdt_ptr
{
unsigned short nLimit;
unsigned int uiBase;
-} __attribute__ ((packed));
+} __attribute__ ((packed)) gdt_ptr_t;
/*
This will be a function inside the kernel loader: start.asm. This is used to properly
@@ -40,9 +40,6 @@
*/
extern void gdt_flush(void);
-/*
-Function prototypes.
-*/
void gdt_install_gate(int iNum, unsigned long ulBase, unsigned long ulLimit, unsigned char cAccess, unsigned char cGran);
void init_gdt(void);
Modified: trunk/include/Affinity/idt.h
==============================================================================
--- trunk/include/Affinity/idt.h (original)
+++ trunk/include/Affinity/idt.h Thu Aug 3 02:07:11 2006
@@ -85,11 +85,11 @@
/*
Special IDT pointer.
*/
-struct idt_ptr_t
+typedef struct idt_ptr
{
unsigned short nLimit;
unsigned int uiBase;
-} __attribute__ ((packed));
+} __attribute__ ((packed)) idt_ptr_t;
/*
This defines what the stack looks like after an ISR was running.
@@ -114,10 +114,7 @@
*/
typedef void (*handler_t)(regs_t* r);
-/*
-Function prototypes.
-*/
-void idt_install_gate(unsigned char cNum, unsigned long ulBase, unsigned short nSel, unsigned char cFlags);
+void idt_install_gate(int iNum, unsigned long ulBase, unsigned short nSel, unsigned char cFlags);
void init_idt(void);
void init_interrupts(void);
Modified: trunk/include/Affinity/keyboard.h
==============================================================================
--- trunk/include/Affinity/keyboard.h (original)
+++ trunk/include/Affinity/keyboard.h Thu Aug 3 02:07:11 2006
@@ -81,9 +81,6 @@
typedef unsigned char keydef_t;
-/*
-Function prototypes.
-*/
void init_keyboard(void);
void keyboard_handler(regs_t* r);
Modified: trunk/include/Affinity/text_mode.h
==============================================================================
--- trunk/include/Affinity/text_mode.h (original)
+++ trunk/include/Affinity/text_mode.h Thu Aug 3 02:07:11 2006
@@ -28,9 +28,6 @@
#define LIGHT_MAGENTA 0x0d
#define WHITE 0x0f
-/*
-Function prototypes.
-*/
void init_video(void);
void move_cursor(void);
Modified: trunk/include/Affinity/timer.h
==============================================================================
--- trunk/include/Affinity/timer.h (original)
+++ trunk/include/Affinity/timer.h Thu Aug 3 02:07:11 2006
@@ -14,9 +14,6 @@
#include <Affinity/idt.h>
-/*
-Function prototypes.
-*/
void init_timer(void);
void timer_handler(regs_t* r);
Modified: trunk/include/Affinity/x86.h
==============================================================================
--- trunk/include/Affinity/x86.h (original)
+++ trunk/include/Affinity/x86.h Thu Aug 3 02:07:11 2006
@@ -12,9 +12,6 @@
{
#endif
-/*
-Function prototypes.
-*/
inline void outportb(unsigned short nPort, unsigned char cData);
inline void outportw(unsigned short nPort, unsigned short nData);
inline void outportl(unsigned short nPort, unsigned long ulData);
Modified: trunk/kernel/Makefile
==============================================================================
--- trunk/kernel/Makefile (original)
+++ trunk/kernel/Makefile Thu Aug 3 02:07:11 2006
@@ -6,7 +6,7 @@
include ../Makefile.common
kernel.sys: $(OBJECTS)
- @echo " [$(LD)] Linking kernel with $(OBJECTS)."
+ @echo "Linking the kernel with $(OBJECTS)."
@$(LD) -T ../link.ld -o ../kernel.sys $(OBJECTS) $(DOTS)lib/libc.a
clean:
Modified: trunk/kernel/gdt.c
==============================================================================
--- trunk/kernel/gdt.c (original)
+++ trunk/kernel/gdt.c Thu Aug 3 02:07:11 2006
@@ -10,7 +10,7 @@
The GDT with 3 entries, and finally the special GDT pointer.
*/
gdt_entry_t gdt[3];
-struct gdt_ptr gdtp;
+gdt_ptr_t gdtp;
/*
Setup a descriptor in the Global Descriptor Table (GDT).
Modified: trunk/kernel/idt.c
==============================================================================
--- trunk/kernel/idt.c (original)
+++ trunk/kernel/idt.c Thu Aug 3 02:07:11 2006
@@ -15,8 +15,8 @@
normally will cause an "Unhandled interrupt" exception. Any descriptor for which
the 'presence' hit is cleared (0) will generate an "Unhandled interrupt" exception.
*/
-static idt_entry_t idt[256];
-struct idt_ptr_t idtp;
+idt_entry_t idt[256];
+idt_ptr_t idtp;
/*
Array of exception messages.
@@ -72,14 +72,14 @@
This function is used to set an entry in the IDT, this is much more simpler
than messing with the GDT.
*/
-void idt_install_gate(unsigned char cNum, unsigned long ulBase, unsigned short nSel, unsigned char cFlags)
+void idt_install_gate(int iNum, unsigned long ulBase, unsigned short nSel, unsigned char cFlags)
{
- idt[cNum].nBase_low = (ulBase & 0xffff);
- idt[cNum].nBase_high = (ulBase >> 16) & 0xffff;
+ idt[iNum].nBase_low = (ulBase & 0xffff);
+ idt[iNum].nBase_high = (ulBase >> 16) & 0xffff;
- idt[cNum].nSel = nSel;
- idt[cNum].cAlways0 = 0;
- idt[cNum].cFlags = cFlags;
+ idt[iNum].nSel = nSel;
+ idt[iNum].cAlways0 = 0;
+ idt[iNum].cFlags = cFlags;
}
/*
Modified: trunk/kernel/main.c
==============================================================================
--- trunk/kernel/main.c (original)
+++ trunk/kernel/main.c Thu Aug 3 02:07:11 2006
@@ -7,6 +7,7 @@
#include <Affinity/idt.h>
#include <Affinity/gdt.h>
#include <Affinity/keyboard.h>
+#include <Affinity/mm.h>
#include <Affinity/system.h>
#include <Affinity/text_mode.h>
#include <Affinity/timer.h>
Modified: trunk/kernel/start.asm
==============================================================================
--- trunk/kernel/start.asm (original)
+++ trunk/kernel/start.asm Thu Aug 3 02:07:11 2006
@@ -523,9 +523,9 @@
add esp, 8
iret
-; Here is the definition of the bss section. Right now, we'll use it just to store
-; the stack. Remember that a stack actually grows downwards, so we declare the
-; size of the data before declaring the identifier '_sys_stack'
+; Here is the definition of the bss section. Remember that a stack actually grows
+; downwards, so we declare the size of the data before declaring the identifier
+; '_sys_stack'
SECTION .bss
resb 0x4000
_sys_stack:
Modified: trunk/kernel/text_mode.c
==============================================================================
--- trunk/kernel/text_mode.c (original)
+++ trunk/kernel/text_mode.c Thu Aug 3 02:07:11 2006
@@ -29,10 +29,6 @@
{
unsigned short nTemp;
- /*
- The equation for finding the index in a linear chuck of memory can be represented by:
- index = [(y * width) + x]
- */
nTemp = g_iCursor_Y * 80 + g_iCursor_X;
/*
@@ -155,12 +151,8 @@
}
else if (cChar >= ' ')
{
- /*
- The equation for finding the index in a linear chuck of memory can be
- respresented by: index = [(y * width) + x]
- */
nWhere = g_nTextMem + (g_iCursor_Y * 80 + g_iCursor_X);
- *nWhere = cChar | nAttr; // Character AND uiAttr (i.e. Colour)
+ *nWhere = cChar | nAttr;
g_iCursor_X++;
}