2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Jack Lange <jarusl@cs.northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
21 #include <devices/os_debug.h>
22 #include <palacios/vmm.h>
25 #define DEBUG_PORT1 0xcc
30 static int handle_gen_write(ushort_t port, void * src, uint_t length, struct vm_device * dev) {
31 PrintError("OS_DEBUG Write\n");
35 PrintDebug("OS_DEBUG ->0x%.2x\n", *(uchar_t*)src);
38 PrintDebug("OS_DEBUG ->0x%.4x\n", *(ushort_t*)src);
41 PrintDebug("OS_DEBUG ->0x%.8x\n", *(uint_t*)src);
44 PrintError("OS_DEBUG -> Invalid length in handle_gen_write\n");
53 static int debug_init(struct vm_device * dev) {
55 v3_dev_hook_io(dev, DEBUG_PORT1, NULL, &handle_gen_write);
61 static int debug_deinit(struct vm_device * dev) {
62 v3_dev_unhook_io(dev, DEBUG_PORT1);
71 static struct vm_device_ops dev_ops = {
73 .deinit = debug_deinit,
80 struct vm_device * v3_create_os_debug() {
82 PrintDebug("Creating OS Debug Device\n");
83 struct vm_device * device = v3_create_device("OS Debug", &dev_ops, NULL);