Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
virtual_game_machine
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
adrian.spycher
virtual_game_machine
Commits
79eaf395
Commit
79eaf395
authored
6 months ago
by
adrian.spycher
Browse files
Options
Downloads
Patches
Plain Diff
feat: modfiy guest to test until gfx init emulated
parent
7b85ba6c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
guest/guest_main.c
+42
-3
42 additions, 3 deletions
guest/guest_main.c
with
42 additions
and
3 deletions
guest/guest_main.c
+
42
−
3
View file @
79eaf395
#include
<stdint.h>
#include
"idt.h"
#include
"utils.h"
#include
"x86.h"
#include
"pmio.h"
#include
"shared/hypercall_params.h"
// If PV == 1 => uses paravirtualized drivers (when available)
// If PV == 0 => uses physical (hardware) drivers (when available)
...
...
@@ -12,12 +15,48 @@
#endif
// Dummy examples
void
timer_sleep_pv
(
int
usec
)
{}
void
timer_sleep_phys
(
int
usec
)
{}
//
void timer_sleep_pv(int usec) {}
//
void timer_sleep_phys(int usec) {}
void
guest_main
()
{
idt_init
();
// Initialize interrupt subsystem
sti
();
// Enable hardware interrupts
timer_sleep
(
100000
);
// paravirtualized console
char
*
str
=
"abcdefgh"
;
hyper_virtual_console_params_t
param_console
;
param_console
.
msg
=
(
uint64_t
)
str
;
memcpy
((
void
*
)
HYPERCALL_SHARED_ADDR
,
(
void
*
)
&
param_console
,
sizeof
(
param_console
));
outb
(
HYPERCALL_PMIO_ADDR
,
HYPERCALL_CODE_CONSOLE
);
// paravirtualized timer
hyper_timer_sleep_params_t
param_timer
;
param_timer
.
us
=
1e6
;
memcpy
((
void
*
)
HYPERCALL_SHARED_ADDR
,
(
void
*
)
&
param_timer
,
sizeof
(
param_timer
));
outb
(
HYPERCALL_PMIO_ADDR
,
HYPERCALL_CODE_TIMER
);
// emulated timer
outw
(
REG_TIMER_CMD
,
20
);
outd
(
REG_TIMER_DATA
,
1e6
);
// paravirtualized gfx init
hyper_init_gfx_params_t
param_gfx
;
param_gfx
.
width
=
1920
;
param_gfx
.
height
=
1080
;
memcpy
((
void
*
)
HYPERCALL_SHARED_ADDR
,
(
void
*
)
&
param_gfx
,
sizeof
(
param_gfx
));
outb
(
HYPERCALL_PMIO_ADDR
,
HYPERCALL_CODE_GFX_INIT
);
// emulated gfx init
// TODO:
// timer_sleep(100000);
}
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