Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redox-os
kernel
Commits
d3a2fe70
Commit
d3a2fe70
authored
1 year ago
by
Andrew Mackenzie
Committed by
Jeremy Soller
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Qemu hpet bug
parent
4bf307d8
No related branches found
No related tags found
1 merge request
!210
Qemu hpet bug
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/arch/x86_64/time.rs
+9
-1
9 additions, 1 deletion
src/arch/x86_64/time.rs
with
9 additions
and
1 deletion
src/arch/x86_64/time.rs
+
9
−
1
View file @
d3a2fe70
...
...
@@ -14,7 +14,15 @@ pub fn counter() -> u128 {
let
comparator
=
unsafe
{
hpet
.base_address
.read_u64
(
hpet
::
T0_COMPARATOR_OFFSET
)
};
// Get period in femtoseconds
let
capability
=
unsafe
{
hpet
.base_address
.read_u64
(
hpet
::
CAPABILITY_OFFSET
)
};
let
period_fs
=
capability
>>
32
;
// There seems to be a bug in qemu on macos that causes the calculation to produce 0 for
// period_fs and hence a divide by zero calculating the divisor - workaround it while we
// try and get a fix from qemu: https://gitlab.com/qemu-project/qemu/-/issues/1570
let
mut
period_fs
=
capability
>>
32
;
if
period_fs
==
0
{
period_fs
=
10_000_000
;
}
// Calculate divisor
let
divisor
=
(
pit
::
RATE
as
u64
*
1_000_000
)
/
period_fs
;
// Calculate last interrupt
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment