Working on gdt and autoscroll

This commit is contained in:
Adrien Bourmault 2019-05-20 20:28:18 +02:00
parent 6ccc6157bc
commit 8716e896da
7 changed files with 54 additions and 11 deletions

View File

@ -28,6 +28,7 @@ extern kernelEnd
extern _bss
global newKernelEnd
global newStackEnd
global GDT64
[section .text]
KERNEL_STACK equ 16 * 1024 ; 16KB of stack

View File

@ -65,6 +65,8 @@ void IoChangeTermColor(int, int);
error_t IoInitVGABuffer(void);
uint IoGetScroll(void);
//----------------------------------------------------------------------------//
#endif

View File

@ -114,7 +114,7 @@ struct Tss_t
// The gdt pointer
struct GdtPtr_t
{
uchar limit; // upper 16 bits
ushort limit; // upper 16 bits
ulong base; // address of the first entry
} __attribute__((__packed__));

View File

@ -54,8 +54,8 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
BtDoSanityChecks(mbMagic);
// Memory
//MmInitGdt();
MmInitMemoryMap();
MmInitGdt();
MmInitPaging();
MmInitHeap();

View File

@ -108,6 +108,11 @@ error_t bvgaflusher(Buffer_t *buf)
return EOK;
}
uint IoGetScroll(void)
{
return bscroll;
}
void IoScrollDown(void)
{
BLockBuf(BStdOut);

View File

@ -24,13 +24,6 @@
#include <mm/mm.h>
ulong gdtEntries[2] =
{
(0L), // NULL descriptor
((1L<<43) | (1L<<44) | (1L<<47) | (1L<<53)) // KERNEL CS 0x8
};
//Tss_t tssEntry = { 0 };
GdtPtr_t gdtPtr;
@ -71,8 +64,46 @@ GdtPtr_t gdtPtr;
void MmInitGdt(void)
{
gdtPtr.limit = sizeof(gdtEntries) - 1;
gdtPtr.base = (ulong)&gdtEntries;
MmStoreGdt();
GdtEntry_t *gdt = (GdtEntry_t *)(gdtPtr.base);
extern ulong GDT64;
DebugLog("GDT ADDR: %p\n",
gdt
);
gdt++;
DebugLog("GDT : \n"
"lowLimit : %#016hx\n"
"lowBase : %#016hx\n"
"middleBase: %#016hx\n"
"access : %#016hx\n"
"flags : %#016hx\n"
"highBase : %#016hx\n",
gdt->lowLimit,
gdt->lowBase,
gdt->middleBase,
gdt->access,
gdt->flags,
gdt->highBase
);
/* DebugLog("GDT : \n" */
/* "lowLimit : %#016hx\n" */
/* "lowBase : %#016hx\n" */
/* "middleBase: %#016hx\n" */
/* "access : %#016hx\n" */
/* "flags : %#016hx\n" */
/* "highBase : %#016hx\n", */
/* gdt->lowLimit, */
/* gdt->lowBase, */
/* gdt->middleBase, */
/* gdt->access, */
/* gdt->flags, */
/* gdt->highBase */
/* ); */
MmLoadGdt();
}

View File

@ -134,6 +134,10 @@ void KeStartShell(void)
bufptr = cmdbuf;
ExecuteCommand(cmdbuf);
while (IoGetScroll() > 0) {
IoScrollDown();
}
memzero(cmdbuf, CMDBUFSIZE);
KernLog("%Cshell> %C", VGA_COLOR_WHITE, shcol);
BFlushBuf(BStdIn);