ullong_t reload_val = (ullong_t)cpu_khz * 1000;
pit_state = (struct pit *)V3_Malloc(sizeof(struct pit));
+
V3_ASSERT(pit_state != NULL);
pit_state->speaker = 0;
+ pit_state->vm = vm;
dev = v3_add_device(vm, dev_id, &dev_ops, pit_state);
port, port);
return -1;
}
-
-
+
video_state->crtc_index_reg = *(uint8_t *)src;
// Only do the passthrough IO for the first byte
V3_ASSERT(offset < SCREEN_SIZE);
V3_ASSERT(length <= SCREEN_SIZE);
V3_ASSERT(offset + length <= SCREEN_SIZE);
+
memcpy(dst, state->framebuf + screen_byte_offset + offset, length);
return 0;
-static int free_device(struct video_internal * video_state) {
+static int free_cga(struct video_internal * video_state) {
if (video_state->framebuf_pa) {
+ PrintError("Freeing framebuffer PA %p\n", (void *)(video_state->framebuf_pa));
V3_FreePages((void *)(video_state->framebuf_pa), (FRAMEBUF_SIZE / 4096));
}
v3_unhook_mem(video_state->dev->vm, V3_MEM_CORE_ANY, START_ADDR);
-
V3_Free(video_state);
return 0;
static struct v3_device_ops dev_ops = {
- .free = (int (*)(void *))free_device,
+ .free = (int (*)(void *))free_cga,
};
static int cga_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {