File tree Expand file tree Collapse file tree 4 files changed +13
-14
lines changed
Expand file tree Collapse file tree 4 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,12 @@ init_timer_phys:
2626 cmp rax , 0
2727 jz init_timer_error
2828 call init_timer_hpet
29+ mov qword [ sys_timer ], hpet_delay
2930 jmp init_timer_done
3031
3132init_timer_virt:
3233 call init_timer_kvm
34+ mov qword [ sys_timer ], kvm_delay
3335
3436init_timer_error:
3537
@@ -239,6 +241,10 @@ kvm_get_usec_shift_done:
239241 pop rcx ; Restore tsc_to_system_mul
240242
241243 ; Calculate nanoseconds as (delta * mul) >> 32
244+ mul rcx ; RDX:RAX = RAX * RCX
245+ shl rdx , 32
246+ shr rax , 32
247+ or rax , rdx
242248
243249 ; Add system time to nanoseconds
244250 add rax , rbx
@@ -297,15 +303,9 @@ kvm_delay_wait:
297303; There are 1,000 milliseconds in a second
298304timer_delay:
299305 push rax
300- push rbx
301306
302- ; Detect which timer is to be used
307+ call [ sys_timer ]
303308
304-
305- call hpet_delay
306- ; call kvm_delay
307-
308- pop rbx
309309 pop rax
310310 ret
311311; -----------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ interrupt_gate: ; handler for all other interrupts
2626; -----------------------------------------------------------------------------
2727; Floppy drive interrupt. IRQ 0x06, INT 0x26
2828; This IRQ runs when floppy drive reads from or writes to whole disk
29- %ifdef BIOS
29+ %ifdef FLOPPY
3030align 16
3131floppy_irq:
3232 push rdi
Original file line number Diff line number Diff line change @@ -946,7 +946,7 @@ lfb_wc_end:
946946 mov rsi , msg_kernel
947947 call debug_msg
948948
949- %ifdef BIOS
949+ %ifdef FLOPPY
950950 cmp byte [ p_BootDisk ], 'F' ; Check if sys is booted from floppy?
951951 jnz clear_regs
952952 call read_floppy ; Then load whole floppy at memory
@@ -977,7 +977,7 @@ clear_regs:
977977%include "init/serial.asm"
978978%include "init/smp.asm"
979979%include "init/timer.asm"
980- %ifdef BIOS
980+ %ifdef FLOPPY
981981%include "fdc/dma.asm"
982982%include "fdc/fdc_64.asm"
983983%endif
@@ -1044,7 +1044,7 @@ nextline:
10441044; -----------------------------------------------------------------------------
10451045%endif
10461046
1047- %ifdef BIOS
1047+ %ifdef FLOPPY
10481048; -----------------------------------------------------------------------------
10491049; debug_progressbar
10501050; IN: EBX = Index #
Original file line number Diff line number Diff line change @@ -37,9 +37,8 @@ VBEModeInfoBlock: equ 0x0000000000005F00 ; 256 bytes
3737; DQ - Starting at offset 0, increments by 0x8
3838p_ACPITableAddress: equ SystemVariables + 0x00
3939p_LocalAPICAddress: equ SystemVariables + 0x10
40- p_Counter_Timer: equ SystemVariables + 0x18
41- p_Counter_RTC: equ SystemVariables + 0x20
4240p_HPET_Address: equ SystemVariables + 0x28
41+ sys_timer: equ SystemVariables + 0x30
4342
4443; DD - Starting at offset 0x80, increments by 4
4544p_BSP: equ SystemVariables + 0x80
@@ -63,7 +62,7 @@ p_HPET_Timers: equ SystemVariables + 0x184
6362p_BootDisk: equ SystemVariables + 0x185 ; 'F' for Floppy drive
6463p_1GPages: equ SystemVariables + 0x186 ; 1 if 1GB pages are supported
6564
66- p_timer: equ SystemVariables + 0x1000
65+ p_timer: equ SystemVariables + 0x1000 ; This overwrites the memory details from firmware
6766
6867align 16
6968GDTR32: ; Global Descriptors Table Register
You can’t perform that action at this time.
0 commit comments