Patchwork linux-user: KD/VT/FB ioctls

login
register
mail settings
Submitter Ulrich Hecht
Date Oct. 16, 2009, 3 p.m.
Message ID <1255705244-28375-1-git-send-email-uli@suse.de>
Download mbox | patch
Permalink /patch/36235/
State New
Headers show

Comments

Ulrich Hecht - Oct. 16, 2009, 3 p.m.
everything needed to run SDL on a framebuffer device in the userspace emulator

Signed-off-by: Ulrich Hecht <uli@suse.de>
---
 linux-user/ioctls.h        |   14 ++++++++++++
 linux-user/syscall.c       |    2 +
 linux-user/syscall_defs.h  |   16 +++++++++++++
 linux-user/syscall_types.h |   51 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 83 insertions(+), 0 deletions(-)

Patch

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 685cc71..769e1bc 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -53,7 +53,10 @@ 
 
      IOCTL(KIOCSOUND, 0, TYPE_INT)
      IOCTL(KDMKTONE, 0, TYPE_INT)
+     IOCTL(KDSETMODE, 0, TYPE_INT)
      IOCTL(KDGKBTYPE, IOC_R, MK_PTR(TYPE_CHAR))
+     IOCTL(KDGKBMODE, IOC_R, MK_PTR(TYPE_INT))
+     IOCTL(KDSKBMODE, 0, TYPE_INT)
      IOCTL(KDGKBENT, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_kbentry)))
      IOCTL(KDGKBSENT, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_kbsentry)))
 
@@ -314,3 +317,14 @@ 
   IOCTL(MTIOCTOP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_mtop)))
   IOCTL(MTIOCGET, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtget)))
   IOCTL(MTIOCPOS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtpos)))
+
+  IOCTL(FBIOGET_FSCREENINFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_fb_fix_screeninfo)))
+  IOCTL(FBIOGET_VSCREENINFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_fb_var_screeninfo)))
+  IOCTL(FBIOPUT_VSCREENINFO, IOC_W, MK_PTR(MK_STRUCT(STRUCT_fb_var_screeninfo)))
+
+  IOCTL(VT_OPENQRY, IOC_R, MK_PTR(TYPE_INT))
+  IOCTL(VT_GETSTATE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_vt_stat)))
+  IOCTL(VT_ACTIVATE, 0, TYPE_INT)
+  IOCTL(VT_WAITACTIVE, 0, TYPE_INT)
+  IOCTL(VT_LOCKSWITCH, 0, TYPE_INT)
+  IOCTL(VT_UNLOCKSWITCH, 0, TYPE_INT)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index bf06d14..dcbdcac 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -79,6 +79,8 @@ 
 #include <linux/kd.h>
 #include <linux/mtio.h>
 #include <linux/fs.h>
+#include <linux/fb.h>
+#include <linux/vt.h>
 #include "linux_loop.h"
 
 #include "qemu.h"
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index c018165..15dbfb2 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -660,6 +660,9 @@  struct target_pollfd {
 #define TARGET_KIOCSOUND       0x4B2F	/* start sound generation (0 for off) */
 #define TARGET_KDMKTONE	       0x4B30	/* generate tone */
 #define TARGET_KDGKBTYPE       0x4b33
+#define TARGET_KDSETMODE       0x4b3a
+#define TARGET_KDGKBMODE       0x4b44
+#define TARGET_KDSKBMODE       0x4b45
 #define TARGET_KDGKBENT	       0x4B46	/* gets one entry in translation table */
 #define TARGET_KDGKBSENT       0x4B48	/* gets one function key string entry */
 
@@ -874,6 +877,19 @@  struct target_pollfd {
 #define TARGET_LOOP_GET_STATUS64      0x4C05
 #define TARGET_LOOP_CHANGE_FD         0x4C06
 
+/* fb ioctls */
+#define TARGET_FBIOGET_VSCREENINFO    0x4600
+#define TARGET_FBIOPUT_VSCREENINFO    0x4601
+#define TARGET_FBIOGET_FSCREENINFO    0x4602
+
+/* vt ioctls */
+#define TARGET_VT_OPENQRY             0x5600
+#define TARGET_VT_GETSTATE            0x5603
+#define TARGET_VT_ACTIVATE            0x5606
+#define TARGET_VT_WAITACTIVE          0x5607
+#define TARGET_VT_LOCKSWITCH          0x560b
+#define TARGET_VT_UNLOCKSWITCH        0x560c
+
 /* from asm/termbits.h */
 
 #define TARGET_NCC 8
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index d3f3df9..340dbd3 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -114,3 +114,54 @@  STRUCT(mtop, TYPE_SHORT, TYPE_INT)
 STRUCT(mtget, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG,
        TYPE_INT, TYPE_INT)
 STRUCT(mtpos, TYPE_LONG)
+
+STRUCT(fb_fix_screeninfo,
+       MK_ARRAY(TYPE_CHAR, 16), /* id */
+       TYPE_ULONG, /* smem_start */
+       TYPE_INT, /* smem_len */
+       TYPE_INT, /* type */
+       TYPE_INT, /* type_aux */
+       TYPE_INT, /* visual */
+       TYPE_SHORT, /* xpanstep */
+       TYPE_SHORT, /* ypanstep */
+       TYPE_SHORT, /* ywrapstep */
+       TYPE_INT, /* line_length */
+       TYPE_ULONG, /* mmio_start */
+       TYPE_INT, /* mmio_len */
+       TYPE_INT, /* accel */
+       MK_ARRAY(TYPE_CHAR, 3)) /* reserved */
+
+STRUCT(fb_var_screeninfo,
+       TYPE_INT, /* xres */
+       TYPE_INT, /* yres */
+       TYPE_INT, /* xres_virtual */
+       TYPE_INT, /* yres_virtual */
+       TYPE_INT, /* xoffset */
+       TYPE_INT, /* yoffset */
+       TYPE_INT, /* bits_per_pixel */
+       TYPE_INT, /* grayscale */
+       MK_ARRAY(TYPE_INT, 3), /* red */
+       MK_ARRAY(TYPE_INT, 3), /* green */
+       MK_ARRAY(TYPE_INT, 3), /* blue */
+       MK_ARRAY(TYPE_INT, 3), /* transp */
+       TYPE_INT, /* nonstd */
+       TYPE_INT, /* activate */
+       TYPE_INT, /* height */
+       TYPE_INT, /* width */
+       TYPE_INT, /* accel_flags */
+       TYPE_INT, /* pixclock */
+       TYPE_INT, /* left_margin */
+       TYPE_INT, /* right_margin */
+       TYPE_INT, /* upper_margin */
+       TYPE_INT, /* lower_margin */
+       TYPE_INT, /* hsync_len */
+       TYPE_INT, /* vsync_len */
+       TYPE_INT, /* sync */
+       TYPE_INT, /* vmode */
+       TYPE_INT, /* rotate */
+       MK_ARRAY(TYPE_INT, 5)) /* reserved */
+
+STRUCT(vt_stat,
+       TYPE_SHORT, /* v_active */
+       TYPE_SHORT, /* v_signal */
+       TYPE_SHORT) /* v_state */