VGA renaming
This commit is contained in:
parent
3f4fb9e952
commit
ede53ae4f9
@ -11,7 +11,7 @@
|
||||
ulong error_code) \
|
||||
{ \
|
||||
int intNbInt = int_nb; \
|
||||
VGAprintf(RED, BLACK, 0, VGA_HEIGHT - 1, "EXCEPTION %d %d", intNbInt, error_code); \
|
||||
VGAPrintf(RED, BLACK, 0, VGA_HEIGHT - 1, "EXCEPTION %d %d", intNbInt, error_code); \
|
||||
printf("Exception %d (Err %d) at 0x%x\n", int_nb, error_code, frame->eip); \
|
||||
asm("hlt"); \
|
||||
}
|
||||
@ -62,7 +62,7 @@ __attribute__((interrupt)) void pagefault_handler(struct interrupt_frame *frame,
|
||||
|
||||
struct kthread *current = getCurrentThread();
|
||||
printf("page fault while in thread %s\n", current->name);
|
||||
VGAprintf(RED, BLACK, 0, VGA_HEIGHT - 1, "PAGE FAULT %d", error_code);
|
||||
VGAPrintf(RED, BLACK, 0, VGA_HEIGHT - 1, "PAGE FAULT %d", error_code);
|
||||
(void)faulting_address;
|
||||
(void)frame;
|
||||
(void)error_code;
|
||||
|
@ -18,7 +18,7 @@ __attribute__((interrupt)) void timer_handler(struct interrupt_frame *frame)
|
||||
{
|
||||
static int timeCnt = 0;
|
||||
EOIIrq(IRQ_TIMER);
|
||||
VGAprintf(RED, BLACK, 20, VGA_HEIGHT - 1, "IRQ %d", timeCnt++);
|
||||
VGAPrintf(RED, BLACK, 20, VGA_HEIGHT - 1, "IRQ %d", timeCnt++);
|
||||
(void)frame;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ int allocSlab(struct slabDesc **desc, size_t size, size_t sizeSlab, int selfCont
|
||||
pr_devel("%s for size %d is self %d\n", __func__, size, selfContained);
|
||||
sizeSlab = MAX(sizeSlab, PAGE_SIZE);
|
||||
if (size > sizeSlab) {
|
||||
pr_devel("%s size of element %d are bigger than slab size %d\n", size, sizeSlab);
|
||||
pr_devel("size of element %d are bigger than slab size %d\n", size, sizeSlab);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ int allocSlabEntry(struct slabEntry **desc, size_t size, size_t sizeSlab, int se
|
||||
pr_devel("%s for size %d is self %d\n", __func__, size, selfContained);
|
||||
sizeSlab = MAX(sizeSlab, PAGE_SIZE);
|
||||
if (size > sizeSlab) {
|
||||
pr_devel("%s size of element %d are bigger than slab size %d\n", size, sizeSlab);
|
||||
pr_devel("size of element %d are bigger than slab size %d\n", size, sizeSlab);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ int puts(const char *str)
|
||||
|
||||
int putc(const char c)
|
||||
{
|
||||
VGAputc(c);
|
||||
VGAPutc(c);
|
||||
serialPutc(c);
|
||||
return (unsigned char)c;
|
||||
}
|
||||
@ -404,7 +404,6 @@ int vasprintf(char **strp, const char *fmt, va_list ap)
|
||||
/* Determine required size */
|
||||
|
||||
n = vsnprintf(p, size, fmt, ap);
|
||||
printf("Found length %d\n", n);
|
||||
|
||||
if (n < 0)
|
||||
return -1;
|
||||
|
11
core/main.c
11
core/main.c
@ -27,7 +27,7 @@ void idleThread(void *arg)
|
||||
{
|
||||
(void)arg;
|
||||
while (1) {
|
||||
VGAprintf(GREEN, BLACK, 0, VGA_HEIGHT - 1, "%d", (jiffies / HZ));
|
||||
VGAPrintf(GREEN, BLACK, 0, VGA_HEIGHT - 1, "%d", (jiffies / HZ));
|
||||
kthreadYield();
|
||||
}
|
||||
}
|
||||
@ -42,7 +42,6 @@ void kmain(unsigned long magic, unsigned long addr)
|
||||
paddr_t lastUsedByMem;
|
||||
|
||||
VGASetup(BLACK, GREEN);
|
||||
cursorEnable(14, 15);
|
||||
|
||||
printf("Setting up Interruptions\n");
|
||||
gdtSetup();
|
||||
@ -97,7 +96,9 @@ void kmain(unsigned long magic, unsigned long addr)
|
||||
multiboot_info_t *mbi = (multiboot_info_t *)addr;
|
||||
struct multiboot_mmap_entry *mmap = (struct multiboot_mmap_entry *)mbi->mmap_addr;
|
||||
uint size = mbi->mmap_length / sizeof(struct multiboot_mmap_entry);
|
||||
|
||||
pr_devel("mmap buffer at 0x%x with %d entries\n", mbi->mmap_addr, size);
|
||||
|
||||
for (uint i = 0; i < size; i++) {
|
||||
printf(" base_addr 0x%llx, length = 0x%llx, type = 0x%x\n", mmap[i].addr,
|
||||
mmap[i].len, (uint32_t)mmap[i].type);
|
||||
@ -109,6 +110,7 @@ void kmain(unsigned long magic, unsigned long addr)
|
||||
memAddBank(0, lastUsedByMem, 0);
|
||||
memAddBank(lastUsedByMem, upperMemKB * 1024, 1);
|
||||
}
|
||||
|
||||
#ifdef RUN_TEST
|
||||
testPhymem();
|
||||
#endif
|
||||
@ -125,9 +127,14 @@ void kmain(unsigned long magic, unsigned long addr)
|
||||
|
||||
printf("Setting up Serial link (115200)\n");
|
||||
serialSetup(115200);
|
||||
|
||||
printf("Setting up allocation system\n");
|
||||
allocSetup();
|
||||
|
||||
printf("Setting up thread system\n");
|
||||
kthreadSetup(_stack_bottom, (_stack_top - _stack_bottom + 1));
|
||||
kthreadCreate("idle ", idleThread, NULL);
|
||||
|
||||
irqSetRoutine(IRQ_TIMER, pit_handler);
|
||||
#ifdef RUN_TEST
|
||||
run_test();
|
||||
|
@ -9,6 +9,9 @@ static int line, col;
|
||||
|
||||
static volatile short *vga = (short *)VGA_ADDR;
|
||||
static void clearScreen(uint bgColor);
|
||||
static void cursorMove(int x, int y);
|
||||
static void cursorEnable(uint8_t cursor_start, uint8_t cursor_end);
|
||||
static void printCharDetails(char str, uint color, uint bgColor, int startX, int startY);
|
||||
|
||||
int VGASetup(uint bgColor, uint color)
|
||||
{
|
||||
@ -17,6 +20,7 @@ int VGASetup(uint bgColor, uint color)
|
||||
line = 0;
|
||||
col = 0;
|
||||
clearScreen(bgColor);
|
||||
cursorEnable(14, 15);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -32,7 +36,7 @@ static void clearScreen(uint bgColor)
|
||||
restore_IRQs(flags);
|
||||
}
|
||||
|
||||
void clearScreenLine(uint bgColor, uint line)
|
||||
void VGAclearLine(uint bgColor, uint line)
|
||||
{
|
||||
uint32_t flags;
|
||||
long int colorAttr = bgColor << 12;
|
||||
@ -47,7 +51,7 @@ void clearScreenLine(uint bgColor, uint line)
|
||||
restore_IRQs(flags);
|
||||
}
|
||||
|
||||
void VGAprintf(uint color, uint bgColor, int startX, int startY, const char *format, ...)
|
||||
void VGAPrintf(uint color, uint bgColor, int startX, int startY, const char *format, ...)
|
||||
{
|
||||
int flags;
|
||||
char tmp[VGA_WIDTH];
|
||||
@ -68,13 +72,13 @@ void VGAprintf(uint color, uint bgColor, int startX, int startY, const char *for
|
||||
restore_IRQs(flags);
|
||||
}
|
||||
|
||||
void printCharDetails(const char str, uint color, uint bgColor, int startX, int startY)
|
||||
static void printCharDetails(const char str, uint color, uint bgColor, int startX, int startY)
|
||||
{
|
||||
long int colorAttr = (bgColor << 4 | (color & 0x0f)) << 8;
|
||||
vga[VGA_WIDTH * startY + startX] = colorAttr | str;
|
||||
}
|
||||
|
||||
void vgaScrollUp(void)
|
||||
void VGAScrollUp(void)
|
||||
{
|
||||
long int colorAttr = vgaBgColor << 12;
|
||||
int flags;
|
||||
@ -90,7 +94,7 @@ void vgaScrollUp(void)
|
||||
restore_IRQs(flags);
|
||||
}
|
||||
|
||||
void VGAputc(const char str)
|
||||
void VGAPutc(const char str)
|
||||
{
|
||||
int flags;
|
||||
|
||||
@ -99,7 +103,7 @@ void VGAputc(const char str)
|
||||
line++;
|
||||
col = 0;
|
||||
if (line >= VGA_HEIGHT - 1) {
|
||||
vgaScrollUp();
|
||||
VGAScrollUp();
|
||||
line--;
|
||||
}
|
||||
} else if (str == '\r') {
|
||||
@ -118,7 +122,7 @@ void VGAputc(const char str)
|
||||
line++;
|
||||
}
|
||||
if (line >= VGA_HEIGHT - 1) {
|
||||
vgaScrollUp();
|
||||
VGAScrollUp();
|
||||
line--;
|
||||
}
|
||||
}
|
||||
@ -127,7 +131,7 @@ void VGAputc(const char str)
|
||||
restore_IRQs(flags);
|
||||
}
|
||||
|
||||
void cursorEnable(uint8_t cursor_start, uint8_t cursor_end)
|
||||
static void cursorEnable(uint8_t cursor_start, uint8_t cursor_end)
|
||||
{
|
||||
outb(0x3D4, 0x0A);
|
||||
outb(0x3D5, (inb(0x3D5) & 0xC0) | cursor_start);
|
||||
@ -142,7 +146,7 @@ void cursorDisable(void)
|
||||
outb(0x3D5, 0x20);
|
||||
}
|
||||
|
||||
void cursorMove(int x, int y)
|
||||
static void cursorMove(int x, int y)
|
||||
{
|
||||
long int colorAttr = (vgaBgColor << 4 | (vgaColor & 0x0f)) << 8;
|
||||
uint16_t pos = y * VGA_WIDTH + x;
|
||||
|
@ -18,11 +18,7 @@
|
||||
#define VGA_HEIGHT 25
|
||||
|
||||
int VGASetup(uint bgColor, uint color);
|
||||
void VGAputc(const char str);
|
||||
void VGAprintf(uint color, uint bgColor, int startX, int startY, const char *format, ...);
|
||||
void clearScreenLine(uint bgColor, uint line);
|
||||
void printCharDetails(char str, uint color, uint bgColor, int startX, int startY);
|
||||
void vgaScrollUp(void);
|
||||
void cursorEnable(uint8_t cursor_start, uint8_t cursor_end);
|
||||
void cursorDisable(void);
|
||||
void cursorMove(int x, int y);
|
||||
void VGAPutc(const char str);
|
||||
void VGAPrintf(uint color, uint bgColor, int startX, int startY, const char *format, ...);
|
||||
void VGAClearLine(uint bgColor, uint line);
|
||||
void VGAScrollUp(void);
|
||||
|
Loading…
Reference in New Issue
Block a user