[Inconsistent] Work on Cpu

This commit is contained in:
Adrien Bourmault 2019-11-14 21:20:06 +01:00
parent 21b15dcffe
commit b016271c24
3 changed files with 7 additions and 5 deletions

View File

@ -265,7 +265,7 @@ OS/K: $(dep) ./ProjectTree $(BINDIR)/kaleid
## QEMU/DEBUG RELATED
test: all install
@qemu-system-x86_64 -vga std -cpu core2duo -soundhw pcspk -s \
@qemu-system-x86_64 -vga std -cpu core2duo -enable-kvm -soundhw pcspk -s \
-rtc base=localtime -m $(ram) -hda $(installdisk) \
-d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &

View File

@ -68,12 +68,14 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
// Interrupts launching
KeSetupIDT();
KeEnableIRQs();
KeGetCpuInfos();
MmInitGdt();
// Start drivers
// Clocks
KeEnableRTC();
KeEnablePIT();
// Start drivers
KeGetCpuInfos();
IoEnableKeyb();
MmActivatePageHandler();

View File

@ -121,10 +121,10 @@ static void UpdateCurTime(void)
uchar minRemain, hourRemain, dayRemain;
CurTime.sec =
(uchar)(((ulong)KeGetOriginTime()->sec + (Ticks / frequency)) % 60);
(uchar)(((ulong)KeGetOriginTime()->sec * frequency + Ticks) / frequency % 60);
minRemain =
(uchar)(((ulong)KeGetOriginTime()->sec + (Ticks / frequency)) / 60);
(uchar)(((ulong)KeGetOriginTime()->sec * frequency + Ticks) / (60 * frequency));
CurTime.min =
(uchar)(((ulong)KeGetOriginTime()->min + minRemain) % 60);