Import backup from 2004-08-06

This commit is contained in:
Josh Holtrop 2004-08-06 22:00:00 -04:00
parent cd02211b21
commit b9c77827bd
5 changed files with 26 additions and 17 deletions

View File

@ -21,9 +21,6 @@ int console_init(u32_t num, int width, int height)
{
activeConsole = 0;
dev_driver_t *console_driver = New(dev_driver_t);
console_driver->block_read = NULL;
console_driver->block_write = NULL;
console_driver->char_read = NULL;
console_driver->char_write = console_char_write;
devices_register_major('c', MAJOR_CONSOLE, console_driver);
kfree(console_driver);
@ -33,14 +30,9 @@ int console_init(u32_t num, int width, int height)
{
if (( consoles[num]->buffer = kmalloc(width * height) ))
{
consoles[num]->cursorPosition = 0;
consoles[num]->width = width;
consoles[num]->height = height;
consoles[num]->cursorStackPosition = 0;
consoles[num]->escapeLevel = 0;
consoles[num]->escapePosition = 0;
memsetd(consoles[num]->escapeValue, 0, 8);
consoles[num]->attribute = 0x07;
consoles[num]->attribute = consoles[num]->foreground = 0x07;
memsetw(consoles[num]->buffer, 0x0720, width * height);
}
else
@ -156,8 +148,12 @@ int console_char_write(minor_t id, u64_t position, int c)
consoles[id]->attribute = 0x07;
break;
case 1:
consoles[id]->attribute |= 0x08;
break;
case 5:
consoles[id]->attribute |= 0x80;
case 7:
case 30:
}

View File

@ -18,6 +18,12 @@ typedef struct
u16_t *buffer;
u16_t cursorStack[16];
u8_t attribute;
u8_t foreground;
u8_t background;
u8_t bold;
u8_t reverse;
u8_t blink;
u8_t concealed;
u8_t cursorStackPosition;
char escapeLevel;
char escapePosition;

View File

@ -16,7 +16,7 @@
#define NULL 0
#define New(x) kmalloc(sizeof(x))
#define New(x) kcalloc(1, sizeof(x))
typedef unsigned long long u64_t;
typedef unsigned int u32_t;

View File

@ -89,13 +89,20 @@ void k_init()
mm_init();
vmm_init();
devices_init();
console_init(6, 80, 25);
console_activate(1);
// console_init(6, 80, 25);
// console_activate(1);
if (real_mode_module)
{
kprintf("Real mode module present\n");
}
u16_t *vidMem = (u16_t *)CONSOLE_MEMORY;
u16_t i;
for (i = 0; i < 256; i++)
{
*vidMem++ = (i << 8) | '*';
if (((u32_t)vidMem % 32) == 0)
vidMem += 64;
}
criticalCounter--;
}

View File

@ -38,10 +38,10 @@ typedef struct {
void vmm_init();
void *kmalloc(u32_t size);
int kfree(void *addr);
void *vmm_palloc();
int vmm_pfree(void *addr);
void *kmalloc(u32_t size);
int kfree(void *addr);
void *vmm_palloc();
int vmm_pfree(void *addr);
void *kcalloc(unsigned int number, unsigned int size);
#endif