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 extern _bss
global newKernelEnd global newKernelEnd
global newStackEnd global newStackEnd
global GDT64
[section .text] [section .text]
KERNEL_STACK equ 16 * 1024 ; 16KB of stack KERNEL_STACK equ 16 * 1024 ; 16KB of stack

View File

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

View File

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

View File

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

View File

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

View File

@ -24,13 +24,6 @@
#include <mm/mm.h> #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 }; //Tss_t tssEntry = { 0 };
GdtPtr_t gdtPtr; GdtPtr_t gdtPtr;
@ -71,8 +64,46 @@ GdtPtr_t gdtPtr;
void MmInitGdt(void) void MmInitGdt(void)
{ {
gdtPtr.limit = sizeof(gdtEntries) - 1; MmStoreGdt();
gdtPtr.base = (ulong)&gdtEntries;
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(); MmLoadGdt();
} }

View File

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