Skip to content

Commit 6ebc0cc

Browse files
authored
Merge pull request #101 from ReturnInfinity/timer
Add KVM timer support
2 parents b211cbe + 1fb8a39 commit 6ebc0cc

File tree

8 files changed

+378
-198
lines changed

8 files changed

+378
-198
lines changed

build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ mkdir -p bin
44

55
cd src
66

7-
nasm -dBIOS=1 -dNOVIDEO=1 pure64.asm -o ../bin/pure64-bios-novideo.sys -l ../bin/pure64-bios-novideo-debug.txt
8-
nasm -dBIOS=1 pure64.asm -o ../bin/pure64-bios.sys -l ../bin/pure64-bios-debug.txt
9-
nasm -dUEFI=1 pure64.asm -o ../bin/pure64-uefi.sys -l ../bin/pure64-uefi-debug.txt
7+
nasm -dBIOS -dNOVIDEO pure64.asm -o ../bin/pure64-bios-novideo.sys -l ../bin/pure64-bios-novideo-debug.txt
8+
nasm -dBIOS pure64.asm -o ../bin/pure64-bios.sys -l ../bin/pure64-bios-debug.txt
9+
nasm -dUEFI pure64.asm -o ../bin/pure64-uefi.sys -l ../bin/pure64-uefi-debug.txt
1010

1111
cd boot
1212

clean.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/usr/bin/env bash
22

33
rm -f bin/*.sys
4+
rm -f bin/*.txt

src/init/hpet.asm

Lines changed: 0 additions & 157 deletions
This file was deleted.

src/init/smp.asm

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88

99
init_smp:
10-
sti ; Enable interrupts in case PIT is needed
11-
1210
; Check if we want the AP's to be enabled.. if not then skip to end
1311
cmp byte [cfg_smpinit], 1 ; Check if SMP should be enabled
1412
jne noMP ; If not then skip SMP init
@@ -52,7 +50,7 @@ smp_send_INIT_done:
5250

5351
; Wait 500 microseconds
5452
mov eax, 500
55-
call delay
53+
call timer_delay
5654

5755
mov esi, IM_DetectedCoreIDs
5856
xor ecx, ecx
@@ -84,7 +82,7 @@ smp_send_SIPI_done:
8482

8583
; Wait 10000 microseconds for the AP's to finish
8684
mov eax, 10000
87-
call delay
85+
call timer_delay
8886

8987
noMP:
9088
; Gather and store the APIC ID of the BSP
@@ -102,7 +100,7 @@ noMP:
102100
rdtsc
103101
push rax
104102
mov rax, 1024
105-
call delay
103+
call timer_delay
106104
rdtsc
107105
pop rdx
108106
sub rax, rdx
@@ -111,28 +109,7 @@ noMP:
111109
div rcx
112110
mov [p_cpu_speed], ax
113111

114-
cli ; Disable interrupts in case PIT was needed
115-
116-
ret
117-
118-
119-
; -----------------------------------------------------------------------------
120-
; delay -- Delay by X microseconds
121-
; IN: RAX = Time microseconds
122-
; OUT: All registers preserved
123-
; Note: There are 1,000,000 microseconds in a second
124-
; There are 1,000 milliseconds in a second
125-
delay:
126-
push rax
127-
push rbx
128-
129-
call os_hpet_delay
130-
131-
delay_done:
132-
pop rbx
133-
pop rax
134112
ret
135-
; -----------------------------------------------------------------------------
136113

137114

138115
; =============================================================================

0 commit comments

Comments
 (0)