[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 ## QEMU/DEBUG RELATED
test: all install 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) \ -rtc base=localtime -m $(ram) -hda $(installdisk) \
-d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log & -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 // Interrupts launching
KeSetupIDT(); KeSetupIDT();
KeEnableIRQs(); KeEnableIRQs();
KeGetCpuInfos();
MmInitGdt(); MmInitGdt();
// Start drivers // Clocks
KeEnableRTC(); KeEnableRTC();
KeEnablePIT(); KeEnablePIT();
// Start drivers
KeGetCpuInfos();
IoEnableKeyb(); IoEnableKeyb();
MmActivatePageHandler(); MmActivatePageHandler();

View File

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