Skip to content
Snippets Groups Projects
Commit 0ef22830 authored by adrian.spycher's avatar adrian.spycher
Browse files

feat: handle run_pv and run_phys

parent 084c5f96
Branches
No related tags found
No related merge requests found
......@@ -7,6 +7,6 @@
// --- FUNCTION ---
void console_send_pv(char *str);
void console_pv_send(char *str);
#endif // _CONSOLE_H_
......@@ -10,7 +10,7 @@
// --- FUNCTION ---
void console_send_pv(char *str) {
void console_pv_send(char *str) {
hyper_virtual_console_params_t param_console;
param_console.msg = (uint64_t)str;
......
#include <stdint.h>
#include "idt.h"
#include "utils.h"
#include "x86.h"
#include "pmio.h"
#include "shared/hypercall_params.h"
#include "ide/ide.h"
#include "gfx/gfx.h"
#include "timer/timer.h"
#include "console/console.h"
......@@ -14,36 +10,30 @@
// If PV == 1 => uses paravirtualized drivers (when available)
// If PV == 0 => uses physical (hardware) drivers (when available)
#if PV == 1
#define timer_sleep timer_sleep_pv
#define timer_wait timer_pv_wait
#define console_send console_pv_send
#define gfx_init gfx_pv_init
#else
#define timer_sleep timer_sleep_phys
#define timer_wait timer_phys_wait
#define console_send console_pv_send
#define gfx_init gfx_phys_init
#endif
// Dummy examples
// void timer_sleep_pv(int usec) {}
// void timer_sleep_phys(int usec) {}
void guest_main() {
idt_init(); // Initialize interrupt subsystem
sti(); // Enable hardware interrupts
// - pv console -
// - console -
char *str = "Hi from the guest !";
console_send_pv(str);
// - pv timer -
timer_pv_wait(1e6);
console_send(str);
// - phys timer -
timer_phys_wait(1e6);
// - timer -
timer_wait(1e6);
// - pv gfx init -
// - gfx init -
gfx_pv_init(1920, 1080);
// - phys gfx init -
/* gfx_phys_init(1920, 1080); */
// timer_sleep(100000);
timer_wait(1e7);
}
......@@ -44,7 +44,7 @@ void op_callback_console_conclude(void *addr) {
hyper_virtual_console_params_t *p_consol = (hyper_virtual_console_params_t *)addr;
printf("hypercall : sending a message...\n");
printf("action : sending a message...\n");
printf("%s\n", (char *)p_consol->msg);
}
......@@ -57,7 +57,7 @@ void op_callback_timer_conclude(void *addr) {
hyper_timer_sleep_params_t *p_timer = (addr == NULL) ? &param_timer : (hyper_timer_sleep_params_t *)addr;
printf("hypercall : setting up a %dus timer...\n", p_timer->us);
printf("action : setting up a %dus timer...\n", p_timer->us);
usleep(p_timer->us);
}
......@@ -75,7 +75,7 @@ void op_callback_gfx_init_conclude(void *addr) {
hyper_init_gfx_params_t *p_gfx_init = (addr == NULL) ? &param_gfx_init : (hyper_init_gfx_params_t *)addr;
printf("hypercall : initializing gfx %dx%d...\n", p_gfx_init->width, p_gfx_init->height);
printf("action : initializing gfx %dx%d...\n", p_gfx_init->width, p_gfx_init->height);
width_gfx = p_gfx_init->width;
height_gfx = p_gfx_init->height;
sem_post(&sem_gfx);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment