VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/module/vboxmod.h@ 5821

Last change on this file since 5821 was 5817, checked in by vboxsync, 17 years ago

Additions (Linux): added support for waiting for host events from guest R3 and cleaned up the coding style in the kernel module slightly (to Linux kernel coding style)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/** @file
2 *
3 * vboxadd -- VirtualBox Guest Additions for Linux
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef VBOXMOD_H
19#define VBOXMOD_H
20
21#include <VBox/VBoxGuest.h>
22#include <VBox/VBoxGuestLib.h>
23#include <iprt/asm.h>
24
25typedef struct VBoxDevice VBoxDevice;
26struct VBoxDevice
27{
28 /** the device name */
29 char name[128];
30 /** file node minor code */
31 unsigned minor;
32 /** IRQ number */
33 unsigned irq;
34 /** first IO port */
35 unsigned short io_port;
36 /** physical address of device memory */
37 uint32_t vmmdevmem;
38 /** size of adapter memory */
39 size_t vmmdevmem_size;
40
41 /** kernel space mapping of the adapter memory */
42 VMMDevMemory *pVMMDevMemory;
43 /** current pending events mask */
44 uint32_t u32Events;
45 /** request structure to acknowledge events in ISR */
46 VMMDevEvents *irqAckRequest;
47 /** start of the hypervisor window */
48 void *hypervisorStart;
49 /** size of the hypervisor window in bytes */
50 uint32_t hypervisorSize;
51 /** event synchronization */
52 wait_queue_head_t eventq;
53 /** number of times the guest has interrupted the event loop -
54 implemented as a counter to prevent one waiter swallowing the
55 event. */
56 uint32_t u32GuestInterruptions;
57};
58
59extern int vboxadd_verbosity;
60
61#define wlog(...) printk (KERN_WARNING "vboxadd: " __VA_ARGS__)
62#define ilog(...) printk (KERN_INFO "vboxadd: " __VA_ARGS__)
63#define dlog(...) printk (KERN_DEBUG "vboxadd: " __VA_ARGS__)
64#define elog(...) printk (KERN_ERR "vboxadd: " __VA_ARGS__)
65
66#define vlog(n, ...) \
67if (n >= vboxadd_verbosity) printk (KERN_DEBUG "vboxadd: " __VA_ARGS__)
68
69#define compiler_assert(val) \
70do { \
71switch(0) { \
72case 0: \
73case (val): \
74default: \
75break; \
76} \
77} while(0);
78
79extern int vboxadd_cmc_init (void);
80extern void vboxadd_cmc_fini (void);
81DECLVBGL (int) vboxadd_cmc_call (void *opaque, uint32_t func, void *data);
82
83/**
84 * This IOCTL wrapper allows the guest to make an HGCM call from user space. The
85 * OS-independant part of the Guest Additions already contain code for making an
86 * HGCM call from the guest, but this code assumes that the call is made from the
87 * kernel's address space. So before calling it, we have to copy all parameters
88 * to the HGCM call from user space to kernel space and reconstruct the structures
89 * passed to the call (which include pointers to other memory) inside the kernel's
90 * address space.
91 *
92 * @returns 0 on success or Linux error code on failure
93 * @param arg User space pointer to the call data structure
94 */
95extern int vbox_ioctl_hgcm_call(unsigned long arg, VBoxDevice *vboxDev);
96
97#endif /* !VBOXMOD_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette