Import backup from 2004-08-17
This commit is contained in:
parent
c0dd3b529e
commit
1bf14ddefa
2
.bochsrc
2
.bochsrc
@ -25,7 +25,7 @@ text_snapshot_check: 0
|
|||||||
mouse: enabled=0
|
mouse: enabled=0
|
||||||
private_colormap: enabled=0
|
private_colormap: enabled=0
|
||||||
i440fxsupport: enabled=0
|
i440fxsupport: enabled=0
|
||||||
clock: sync=none, time0=local
|
clock: sync=realtime, time0=local
|
||||||
# no ne2k
|
# no ne2k
|
||||||
newharddrivesupport: enabled=1
|
newharddrivesupport: enabled=1
|
||||||
# no loader
|
# no loader
|
||||||
|
@ -9,7 +9,7 @@ NASM_FLAGS=-f aout
|
|||||||
|
|
||||||
# C Information:
|
# C Information:
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CC_FLAGS=-fleading-underscore -fno-builtin -nostdlib -nostartfiles -nodefaultlibs -I. -I../include -Wall
|
CC_FLAGS=-fleading-underscore -fno-builtin -nostdlib -nostartfiles -nodefaultlibs -I. -Wall
|
||||||
|
|
||||||
# Linker Information:
|
# Linker Information:
|
||||||
LD=ld
|
LD=ld
|
||||||
|
@ -157,7 +157,7 @@ newgdtcontinue:
|
|||||||
call _k_init ;C kernel initialization
|
call _k_init ;C kernel initialization
|
||||||
|
|
||||||
idle_loop:
|
idle_loop:
|
||||||
; sti
|
sti
|
||||||
hlt
|
hlt
|
||||||
jmp idle_loop
|
jmp idle_loop
|
||||||
|
|
||||||
|
@ -9,10 +9,13 @@
|
|||||||
#include "mm/vmm.h"
|
#include "mm/vmm.h"
|
||||||
#include "lang/asmfuncs.h"
|
#include "lang/asmfuncs.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
#include "functions.h"
|
||||||
|
|
||||||
vconsole_t *vconsoles[VCONSOLE_MAX]; // pointer to virtual console structs
|
vconsole_t *vconsoles[VCONSOLE_MAX]; // pointer to virtual console structs
|
||||||
extern int activeConsole; // console subsystem active virtual console number
|
extern int activeConsole; // console subsystem active virtual console number
|
||||||
|
|
||||||
|
char ansi2vgaAttr[8] = {0, 4, 2, 6, 1, 5, 3, 7};
|
||||||
|
|
||||||
void vconsole_put_char(minor_t id, int c);
|
void vconsole_put_char(minor_t id, int c);
|
||||||
void vconsole_update_cursor(minor_t id, u16_t position);
|
void vconsole_update_cursor(minor_t id, u16_t position);
|
||||||
void vconsole_update_attribute(minor_t id);
|
void vconsole_update_attribute(minor_t id);
|
||||||
@ -75,6 +78,7 @@ int vconsole_char_write(minor_t id, int c)
|
|||||||
return -1;
|
return -1;
|
||||||
int cursorY = vconsoles[id]->cursorPosition / vconsoles[id]->width;
|
int cursorY = vconsoles[id]->cursorPosition / vconsoles[id]->width;
|
||||||
int cursorX = vconsoles[id]->cursorPosition % vconsoles[id]->width;
|
int cursorX = vconsoles[id]->cursorPosition % vconsoles[id]->width;
|
||||||
|
int evalEscapePosition = 0;
|
||||||
switch (vconsoles[id]->escapeLevel)
|
switch (vconsoles[id]->escapeLevel)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
@ -96,29 +100,25 @@ int vconsole_char_write(minor_t id, int c)
|
|||||||
cursorY -= vconsoles[id]->escapeValue[0];
|
cursorY -= vconsoles[id]->escapeValue[0];
|
||||||
if (cursorY < 0)
|
if (cursorY < 0)
|
||||||
cursorY = 0;
|
cursorY = 0;
|
||||||
vconsole_update_cursor(id, cursorY * vconsoles[id]->width +
|
vconsole_update_cursor(id, cursorY * vconsoles[id]->width + cursorX);
|
||||||
cursorX);
|
|
||||||
break;
|
break;
|
||||||
case 'B': // move cursor down n rows
|
case 'B': // move cursor down n rows
|
||||||
cursorY += vconsoles[id]->escapeValue[0];
|
cursorY += vconsoles[id]->escapeValue[0];
|
||||||
if (cursorY >= vconsoles[id]->height)
|
if (cursorY >= vconsoles[id]->height)
|
||||||
cursorY = vconsoles[id]->height - 1;
|
cursorY = vconsoles[id]->height - 1;
|
||||||
vconsole_update_cursor(id, cursorY * vconsoles[id]->width +
|
vconsole_update_cursor(id, cursorY * vconsoles[id]->width + cursorX);
|
||||||
cursorX);
|
|
||||||
break;
|
break;
|
||||||
case 'C': // move cursor right n columns
|
case 'C': // move cursor right n columns
|
||||||
cursorX -= vconsoles[id]->escapeValue[0];
|
cursorX -= vconsoles[id]->escapeValue[0];
|
||||||
if (cursorX < 0)
|
if (cursorX < 0)
|
||||||
cursorX = 0;
|
cursorX = 0;
|
||||||
vconsole_update_cursor(id, cursorY * vconsoles[id]->width +
|
vconsole_update_cursor(id, cursorY * vconsoles[id]->width + cursorX);
|
||||||
cursorX);
|
|
||||||
break;
|
break;
|
||||||
case 'D': // move cursor left n columns
|
case 'D': // move cursor left n columns
|
||||||
cursorX += vconsoles[id]->escapeValue[0];
|
cursorX += vconsoles[id]->escapeValue[0];
|
||||||
if (cursorX >= vconsoles[id]->width)
|
if (cursorX >= vconsoles[id]->width)
|
||||||
cursorX = vconsoles[id]->width - 1;
|
cursorX = vconsoles[id]->width - 1;
|
||||||
vconsole_update_cursor(id, cursorY * vconsoles[id]->width +
|
vconsole_update_cursor(id, cursorY * vconsoles[id]->width + cursorX);
|
||||||
cursorX);
|
|
||||||
break;
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
case 'f': // move cursor to position (x,y) upper left is (1,1)
|
case 'f': // move cursor to position (x,y) upper left is (1,1)
|
||||||
@ -132,7 +132,7 @@ cursorX);
|
|||||||
cursorX = 0;
|
cursorX = 0;
|
||||||
if (cursorX >= vconsoles[id]->width)
|
if (cursorX >= vconsoles[id]->width)
|
||||||
cursorX = vconsoles[id]->width - 1;
|
cursorX = vconsoles[id]->width - 1;
|
||||||
vconsole_update_cursor(id, 0);
|
vconsole_update_cursor(id, cursorY * vconsoles[id]->width + cursorX);
|
||||||
break;
|
break;
|
||||||
case 'J': // clear screen, home cursor
|
case 'J': // clear screen, home cursor
|
||||||
memsetw(vconsoles[id]->buffer, 0x0720, vconsoles[id]->width * vconsoles[id]->height);
|
memsetw(vconsoles[id]->buffer, 0x0720, vconsoles[id]->width * vconsoles[id]->height);
|
||||||
@ -140,8 +140,7 @@ cursorX);
|
|||||||
vconsole_update_cursor(id, 0);
|
vconsole_update_cursor(id, 0);
|
||||||
break;
|
break;
|
||||||
case 'K': // erase line from cursor position (including char. under cursor) to end of line
|
case 'K': // erase line from cursor position (including char. under cursor) to end of line
|
||||||
memsetw(vconsoles[id]->buffer +
|
memsetw(vconsoles[id]->buffer + vconsoles[id]->cursorPosition, 0x0720, vconsoles[id]->width - cursorX);
|
||||||
vconsoles[id]->cursorPosition, 0x0720, vconsoles[id]->width - cursorX);
|
|
||||||
vconsole_draw(id);
|
vconsole_draw(id);
|
||||||
break;
|
break;
|
||||||
case 's': // push cursor position on an internal stack
|
case 's': // push cursor position on an internal stack
|
||||||
@ -156,9 +155,9 @@ vconsoles[id]->cursorPosition, 0x0720, vconsoles[id]->width - cursorX);
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'm': // set text attributes
|
case 'm': // set text attributes
|
||||||
for (; vconsoles[id]->escapePosition; vconsoles[id]->escapePosition--)
|
for (evalEscapePosition = 0; evalEscapePosition <= vconsoles[id]->escapePosition; evalEscapePosition++)
|
||||||
{
|
{
|
||||||
switch (vconsoles[id]->escapeValue[vconsoles[id]->escapePosition])
|
switch (vconsoles[id]->escapeValue[evalEscapePosition])
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
vconsoles[id]->foreground = 0x07;
|
vconsoles[id]->foreground = 0x07;
|
||||||
@ -189,7 +188,7 @@ vconsoles[id]->cursorPosition, 0x0720, vconsoles[id]->width - cursorX);
|
|||||||
case 35:
|
case 35:
|
||||||
case 36:
|
case 36:
|
||||||
case 37:
|
case 37:
|
||||||
vconsoles[id]->foreground = vconsoles[id]->escapeValue[vconsoles[id]->escapePosition] - 30;
|
vconsoles[id]->foreground = ansi2vgaAttr[vconsoles[id]->escapeValue[evalEscapePosition] - 30];
|
||||||
vconsole_update_attribute(id);
|
vconsole_update_attribute(id);
|
||||||
break;
|
break;
|
||||||
case 40:
|
case 40:
|
||||||
@ -200,11 +199,12 @@ vconsoles[id]->cursorPosition, 0x0720, vconsoles[id]->width - cursorX);
|
|||||||
case 45:
|
case 45:
|
||||||
case 46:
|
case 46:
|
||||||
case 47:
|
case 47:
|
||||||
vconsoles[id]->background = vconsoles[id]->escapeValue[vconsoles[id]->escapePosition] - 30;
|
vconsoles[id]->background = ansi2vgaAttr[vconsoles[id]->escapeValue[evalEscapePosition] - 40];
|
||||||
vconsole_update_attribute(id);
|
vconsole_update_attribute(id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
vconsoles[id]->escapePosition = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memsetd(vconsoles[id]->escapeValue, 0, 8);
|
memsetd(vconsoles[id]->escapeValue, 0, 8);
|
||||||
@ -238,27 +238,21 @@ void vconsole_put_char(minor_t id, int c)
|
|||||||
{
|
{
|
||||||
case '\t':
|
case '\t':
|
||||||
if (vconsoles[id]->cursorPosition % 8)
|
if (vconsoles[id]->cursorPosition % 8)
|
||||||
vconsoles[id]->cursorPosition += (8 - (vconsoles[id]->cursorPosition % 8));
|
vconsole_update_cursor(id, vconsoles[id]->cursorPosition + (8 - (vconsoles[id]->cursorPosition % 8)));
|
||||||
else
|
else
|
||||||
vconsoles[id]->cursorPosition += 8;
|
vconsole_update_cursor(id, vconsoles[id]->cursorPosition + 8);
|
||||||
if (id == activeConsole)
|
|
||||||
console_update_cursor(id, vconsoles[id]->cursorPosition);
|
|
||||||
break;
|
break;
|
||||||
case '\n':
|
case '\n':
|
||||||
if (vconsoles[id]->cursorPosition % (vconsoles[id]->width))
|
if (vconsoles[id]->cursorPosition % (vconsoles[id]->width))
|
||||||
vconsoles[id]->cursorPosition += (vconsoles[id]->width - (vconsoles[id]->cursorPosition % vconsoles[id]->width));
|
vconsole_update_cursor(id, vconsoles[id]->cursorPosition + (vconsoles[id]->width - (vconsoles[id]->cursorPosition % vconsoles[id]->width)));
|
||||||
else
|
else
|
||||||
vconsoles[id]->cursorPosition += vconsoles[id]->width;
|
vconsole_update_cursor(id, vconsoles[id]->cursorPosition + vconsoles[id]->width);
|
||||||
if (id == activeConsole)
|
|
||||||
console_update_cursor(id, vconsoles[id]->cursorPosition);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
vconsoles[id]->buffer[vconsoles[id]->cursorPosition << 1] = c | (vconsoles[id]->attribute << 8);
|
vconsoles[id]->buffer[vconsoles[id]->cursorPosition] = c | (vconsoles[id]->attribute << 8);
|
||||||
if (id == activeConsole)
|
if (id == activeConsole)
|
||||||
console_put_char(id, c | (vconsoles[id]->attribute << 8), vconsoles[id]->cursorPosition);
|
console_put_char(id, c | (vconsoles[id]->attribute << 8), vconsoles[id]->cursorPosition);
|
||||||
vconsoles[id]->cursorPosition++;
|
vconsole_update_cursor(id, vconsoles[id]->cursorPosition + 1);
|
||||||
if (id == activeConsole)
|
|
||||||
console_update_cursor(id, vconsoles[id]->cursorPosition);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,6 +260,17 @@ void vconsole_put_char(minor_t id, int c)
|
|||||||
void vconsole_update_cursor(minor_t id, u16_t position)
|
void vconsole_update_cursor(minor_t id, u16_t position)
|
||||||
{
|
{
|
||||||
vconsoles[id]->cursorPosition = position;
|
vconsoles[id]->cursorPosition = position;
|
||||||
|
if (position >= (vconsoles[id]->width * vconsoles[id]->height)) // time to scroll console
|
||||||
|
{
|
||||||
|
vconsoles[id]->cursorPosition -= vconsoles[id]->width;
|
||||||
|
memcpyw(vconsoles[id]->buffer, vconsoles[id]->buffer + vconsoles[id]->width, vconsoles[id]->width * (vconsoles[id]->height - 1));
|
||||||
|
memsetw(vconsoles[id]->buffer + (vconsoles[id]->width * (vconsoles[id]->height - 1)), 0x0720, vconsoles[id]->width);
|
||||||
|
if (activeConsole == id)
|
||||||
|
{
|
||||||
|
vconsole_draw(id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (activeConsole == id)
|
if (activeConsole == id)
|
||||||
console_update_cursor(id, position);
|
console_update_cursor(id, position);
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,8 @@ static inline void timer_init(u32_t freq)
|
|||||||
{
|
{
|
||||||
u32_t wait = 1193180 / freq; //how many ticks the PIT must wait before issuing an interrupt
|
u32_t wait = 1193180 / freq; //how many ticks the PIT must wait before issuing an interrupt
|
||||||
outportb(0x43, 0x34);
|
outportb(0x43, 0x34);
|
||||||
outportb(0x40, freq); //lsb
|
outportb(0x40, wait); //lsb
|
||||||
outportb(0x40, freq >> 8); //msb
|
outportb(0x40, wait >> 8); //msb
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returns the size of the kernel (code & data)
|
//Returns the size of the kernel (code & data)
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#define PARALLEL_DEBUG
|
#define PARALLEL_DEBUG
|
||||||
|
|
||||||
|
#define HOS_TIMER_FREQ 100
|
||||||
|
|
||||||
#define VIRT_OFFSET 0xC0000000
|
#define VIRT_OFFSET 0xC0000000
|
||||||
#define PHYS_LOAD 0x00108000
|
#define PHYS_LOAD 0x00108000
|
||||||
#define HEAP_START 0xD0000000
|
#define HEAP_START 0xD0000000
|
||||||
|
@ -26,7 +26,8 @@ mb_module_t mb_modules[MAX_MODULES];
|
|||||||
mb_apm_t mb_apm_table;
|
mb_apm_t mb_apm_table;
|
||||||
byte real_mode_module;
|
byte real_mode_module;
|
||||||
char mb_cmdline[256];
|
char mb_cmdline[256];
|
||||||
int criticalCounter;
|
int criticalCounter; // semaphore for if interrupts are disabled
|
||||||
|
u32_t timer;
|
||||||
|
|
||||||
extern u32_t mm_freepages;
|
extern u32_t mm_freepages;
|
||||||
|
|
||||||
@ -96,7 +97,7 @@ void k_init()
|
|||||||
pic_remap(0x20, 0x28);
|
pic_remap(0x20, 0x28);
|
||||||
pic_mask1(0); //unmask IRQ's 0-7
|
pic_mask1(0); //unmask IRQ's 0-7
|
||||||
pic_mask2(0); //unmask IRQ's 8-15
|
pic_mask2(0); //unmask IRQ's 8-15
|
||||||
timer_init(100);
|
timer_init(HOS_TIMER_FREQ);
|
||||||
mm_init();
|
mm_init();
|
||||||
vmm_init();
|
vmm_init();
|
||||||
// test the memory manager
|
// test the memory manager
|
||||||
@ -119,14 +120,8 @@ void k_init()
|
|||||||
devices_init();
|
devices_init();
|
||||||
console_init(6);
|
console_init(6);
|
||||||
console_activate(1);
|
console_activate(1);
|
||||||
kprintf("We can finally see text!\n");
|
kprintf(" \e[31mWe \e[1mcan \e[32mfinally \e[33;45msee\e[0;7m text\e[0m!\n");
|
||||||
while (1)
|
u16_t *vidMem = (u16_t *)(CONSOLE_MEMORY + 160);
|
||||||
(*(u16_t *)CONSOLE_MEMORY)++;
|
|
||||||
if (real_mode_module)
|
|
||||||
{
|
|
||||||
kprintf("Real mode module present\n");
|
|
||||||
}
|
|
||||||
u16_t *vidMem = (u16_t *)CONSOLE_MEMORY;
|
|
||||||
u16_t i;
|
u16_t i;
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
@ -134,17 +129,30 @@ void k_init()
|
|||||||
if (((u32_t)vidMem % 32) == 0)
|
if (((u32_t)vidMem % 32) == 0)
|
||||||
vidMem += 64;
|
vidMem += 64;
|
||||||
}
|
}
|
||||||
|
if (real_mode_module)
|
||||||
|
{
|
||||||
|
kprintf("Real mode module present\n");
|
||||||
|
}
|
||||||
criticalCounter--;
|
criticalCounter--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void isr(u32_t num)
|
void isr(u32_t num)
|
||||||
{
|
{
|
||||||
criticalCounter++;
|
criticalCounter++;
|
||||||
kprintf("Interrupt #%d, CR2 = 0x%x!\n", num, read_cr2());
|
|
||||||
halt();
|
|
||||||
switch (num)
|
switch (num)
|
||||||
{
|
{
|
||||||
|
case 0x20: // timer interrupt
|
||||||
|
(*(u16_t *)CONSOLE_MEMORY)++;
|
||||||
|
timer++;
|
||||||
|
if (!(timer % (HOS_TIMER_FREQ / 4)))
|
||||||
|
{
|
||||||
|
kprintf("Timer int ");
|
||||||
|
}
|
||||||
|
pic_eoi();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
kprintf("Unhandled interrupt #%d, CR2 = 0x%x!\n", num, read_cr2());
|
||||||
|
halt();
|
||||||
}
|
}
|
||||||
criticalCounter--;
|
criticalCounter--;
|
||||||
}
|
}
|
||||||
|
@ -14,14 +14,14 @@ Goals: (A = accomplished, P = in progress, T = todo)
|
|||||||
(A) PS/2 keyboard & mouse drivers
|
(A) PS/2 keyboard & mouse drivers
|
||||||
(A) Utilize x86's paging architecture for virtual memory management
|
(A) Utilize x86's paging architecture for virtual memory management
|
||||||
|
|
||||||
|
(P) Console Manager
|
||||||
(P) VFS abstraction layer for a single file system
|
(P) VFS abstraction layer for a single file system
|
||||||
(P) ram disk driver
|
(P) ram disk driver
|
||||||
(P) devfs file system driver
|
(P) devfs file system driver
|
||||||
|
(P) ext2 file system support
|
||||||
|
|
||||||
(T) ext2 file system support
|
|
||||||
(T) vfat file system support
|
(T) vfat file system support
|
||||||
(T) Multitasking support
|
(T) Multitasking support
|
||||||
(T) Console Manager
|
|
||||||
(T) HASH command shell
|
(T) HASH command shell
|
||||||
(T) Window Manager
|
(T) Window Manager
|
||||||
(T) Various other utilities/applications
|
(T) Various other utilities/applications
|
||||||
|
Loading…
x
Reference in New Issue
Block a user