Since wscons can support VT_xxx ioctl()s, enable them if NWSDISPLAY > 0.
Implement KDGKBTYPE and KDGKBENT, this will make X servers happy.
This commit is contained in:
parent
107df2472d
commit
81fd096b37
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_machdep.c,v 1.40 1998/05/08 16:55:15 kleink Exp $ */
|
||||
/* $NetBSD: linux_machdep.c,v 1.41 1998/06/11 22:26:13 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Frank van der Linden
|
||||
@ -85,6 +85,13 @@
|
||||
#include <arch/i386/isa/pcvt/pcvt_ioctl.h>
|
||||
#endif
|
||||
|
||||
#include "wsdisplay.h"
|
||||
#if (NWSDISPLAY > 0)
|
||||
#include <sys/ioctl.h>
|
||||
#include <dev/wscons/wsdisplay_usl_io.h>
|
||||
#include "opt_xserver.h"
|
||||
#endif
|
||||
|
||||
#ifdef USER_LDT
|
||||
#include <machine/cpu.h>
|
||||
int linux_read_ldt __P((struct proc *, struct linux_sys_modify_ldt_args *,
|
||||
@ -430,12 +437,97 @@ dev_t
|
||||
linux_fakedev(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
|
||||
if (major(dev) == NETBSD_CONS_MAJOR)
|
||||
#if (NVT > 0)
|
||||
if (major(dev) == NETBSD_PCCONS_MAJOR)
|
||||
return makedev(LINUX_CONS_MAJOR, (minor(dev) + 1));
|
||||
#endif
|
||||
#if (NWSDISPLAY > 0)
|
||||
if (major(dev) == NETBSD_WSCONS_MAJOR)
|
||||
return makedev(LINUX_CONS_MAJOR, (minor(dev) + 1));
|
||||
#endif
|
||||
return dev;
|
||||
}
|
||||
|
||||
#if (NWSDISPLAY > 0) && defined(XSERVER)
|
||||
/*
|
||||
* That's not complete, but enough to get an X server running.
|
||||
*/
|
||||
#define NR_KEYS 128
|
||||
static u_short plain_map[NR_KEYS] = {
|
||||
0x0200, 0x001b, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036,
|
||||
0x0037, 0x0038, 0x0039, 0x0030, 0x002d, 0x003d, 0x007f, 0x0009,
|
||||
0x0b71, 0x0b77, 0x0b65, 0x0b72, 0x0b74, 0x0b79, 0x0b75, 0x0b69,
|
||||
0x0b6f, 0x0b70, 0x005b, 0x005d, 0x0201, 0x0702, 0x0b61, 0x0b73,
|
||||
0x0b64, 0x0b66, 0x0b67, 0x0b68, 0x0b6a, 0x0b6b, 0x0b6c, 0x003b,
|
||||
0x0027, 0x0060, 0x0700, 0x005c, 0x0b7a, 0x0b78, 0x0b63, 0x0b76,
|
||||
0x0b62, 0x0b6e, 0x0b6d, 0x002c, 0x002e, 0x002f, 0x0700, 0x030c,
|
||||
0x0703, 0x0020, 0x0207, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104,
|
||||
0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x0208, 0x0209, 0x0307,
|
||||
0x0308, 0x0309, 0x030b, 0x0304, 0x0305, 0x0306, 0x030a, 0x0301,
|
||||
0x0302, 0x0303, 0x0300, 0x0310, 0x0206, 0x0200, 0x003c, 0x010a,
|
||||
0x010b, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
0x030e, 0x0702, 0x030d, 0x001c, 0x0701, 0x0205, 0x0114, 0x0603,
|
||||
0x0118, 0x0601, 0x0602, 0x0117, 0x0600, 0x0119, 0x0115, 0x0116,
|
||||
0x011a, 0x010c, 0x010d, 0x011b, 0x011c, 0x0110, 0x0311, 0x011d,
|
||||
0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
}, shift_map[NR_KEYS] = {
|
||||
0x0200, 0x001b, 0x0021, 0x0040, 0x0023, 0x0024, 0x0025, 0x005e,
|
||||
0x0026, 0x002a, 0x0028, 0x0029, 0x005f, 0x002b, 0x007f, 0x0009,
|
||||
0x0b51, 0x0b57, 0x0b45, 0x0b52, 0x0b54, 0x0b59, 0x0b55, 0x0b49,
|
||||
0x0b4f, 0x0b50, 0x007b, 0x007d, 0x0201, 0x0702, 0x0b41, 0x0b53,
|
||||
0x0b44, 0x0b46, 0x0b47, 0x0b48, 0x0b4a, 0x0b4b, 0x0b4c, 0x003a,
|
||||
0x0022, 0x007e, 0x0700, 0x007c, 0x0b5a, 0x0b58, 0x0b43, 0x0b56,
|
||||
0x0b42, 0x0b4e, 0x0b4d, 0x003c, 0x003e, 0x003f, 0x0700, 0x030c,
|
||||
0x0703, 0x0020, 0x0207, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e,
|
||||
0x010f, 0x0110, 0x0111, 0x0112, 0x0113, 0x0213, 0x0203, 0x0307,
|
||||
0x0308, 0x0309, 0x030b, 0x0304, 0x0305, 0x0306, 0x030a, 0x0301,
|
||||
0x0302, 0x0303, 0x0300, 0x0310, 0x0206, 0x0200, 0x003e, 0x010a,
|
||||
0x010b, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
0x030e, 0x0702, 0x030d, 0x0200, 0x0701, 0x0205, 0x0114, 0x0603,
|
||||
0x020b, 0x0601, 0x0602, 0x0117, 0x0600, 0x020a, 0x0115, 0x0116,
|
||||
0x011a, 0x010c, 0x010d, 0x011b, 0x011c, 0x0110, 0x0311, 0x011d,
|
||||
0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
}, altgr_map[NR_KEYS] = {
|
||||
0x0200, 0x0200, 0x0200, 0x0040, 0x0200, 0x0024, 0x0200, 0x0200,
|
||||
0x007b, 0x005b, 0x005d, 0x007d, 0x005c, 0x0200, 0x0200, 0x0200,
|
||||
0x0b71, 0x0b77, 0x0918, 0x0b72, 0x0b74, 0x0b79, 0x0b75, 0x0b69,
|
||||
0x0b6f, 0x0b70, 0x0200, 0x007e, 0x0201, 0x0702, 0x0914, 0x0b73,
|
||||
0x0917, 0x0919, 0x0b67, 0x0b68, 0x0b6a, 0x0b6b, 0x0b6c, 0x0200,
|
||||
0x0200, 0x0200, 0x0700, 0x0200, 0x0b7a, 0x0b78, 0x0916, 0x0b76,
|
||||
0x0915, 0x0b6e, 0x0b6d, 0x0200, 0x0200, 0x0200, 0x0700, 0x030c,
|
||||
0x0703, 0x0200, 0x0207, 0x050c, 0x050d, 0x050e, 0x050f, 0x0510,
|
||||
0x0511, 0x0512, 0x0513, 0x0514, 0x0515, 0x0208, 0x0202, 0x0911,
|
||||
0x0912, 0x0913, 0x030b, 0x090e, 0x090f, 0x0910, 0x030a, 0x090b,
|
||||
0x090c, 0x090d, 0x090a, 0x0310, 0x0206, 0x0200, 0x007c, 0x0516,
|
||||
0x0517, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
0x030e, 0x0702, 0x030d, 0x0200, 0x0701, 0x0205, 0x0114, 0x0603,
|
||||
0x0118, 0x0601, 0x0602, 0x0117, 0x0600, 0x0119, 0x0115, 0x0116,
|
||||
0x011a, 0x010c, 0x010d, 0x011b, 0x011c, 0x0110, 0x0311, 0x011d,
|
||||
0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
}, ctrl_map[NR_KEYS] = {
|
||||
0x0200, 0x0200, 0x0200, 0x0000, 0x001b, 0x001c, 0x001d, 0x001e,
|
||||
0x001f, 0x007f, 0x0200, 0x0200, 0x001f, 0x0200, 0x0008, 0x0200,
|
||||
0x0011, 0x0017, 0x0005, 0x0012, 0x0014, 0x0019, 0x0015, 0x0009,
|
||||
0x000f, 0x0010, 0x001b, 0x001d, 0x0201, 0x0702, 0x0001, 0x0013,
|
||||
0x0004, 0x0006, 0x0007, 0x0008, 0x000a, 0x000b, 0x000c, 0x0200,
|
||||
0x0007, 0x0000, 0x0700, 0x001c, 0x001a, 0x0018, 0x0003, 0x0016,
|
||||
0x0002, 0x000e, 0x000d, 0x0200, 0x020e, 0x007f, 0x0700, 0x030c,
|
||||
0x0703, 0x0000, 0x0207, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104,
|
||||
0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x0208, 0x0204, 0x0307,
|
||||
0x0308, 0x0309, 0x030b, 0x0304, 0x0305, 0x0306, 0x030a, 0x0301,
|
||||
0x0302, 0x0303, 0x0300, 0x0310, 0x0206, 0x0200, 0x0200, 0x010a,
|
||||
0x010b, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
0x030e, 0x0702, 0x030d, 0x001c, 0x0701, 0x0205, 0x0114, 0x0603,
|
||||
0x0118, 0x0601, 0x0602, 0x0117, 0x0600, 0x0119, 0x0115, 0x0116,
|
||||
0x011a, 0x010c, 0x010d, 0x011b, 0x011c, 0x0110, 0x0311, 0x011d,
|
||||
0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
};
|
||||
|
||||
u_short *linux_keytabs[] = {
|
||||
plain_map, shift_map, altgr_map, altgr_map, ctrl_map
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We come here in a last attempt to satisfy a Linux ioctl() call
|
||||
*/
|
||||
@ -452,18 +544,21 @@ linux_machdepioctl(p, v, retval)
|
||||
} */ *uap = v;
|
||||
struct sys_ioctl_args bia;
|
||||
u_long com;
|
||||
#if NVT > 0
|
||||
#if (NVT > 0) || (NWSDISPLAY > 0)
|
||||
int error;
|
||||
struct vt_mode lvt;
|
||||
caddr_t bvtp, sg;
|
||||
#endif
|
||||
#if (NWSDISPLAY > 0) && defined(XSERVER)
|
||||
struct kbentry kbe;
|
||||
#endif
|
||||
|
||||
SCARG(&bia, fd) = SCARG(uap, fd);
|
||||
SCARG(&bia, data) = SCARG(uap, data);
|
||||
com = SCARG(uap, com);
|
||||
|
||||
switch (com) {
|
||||
#if NVT > 0
|
||||
#if (NVT > 0) || (NWSDISPLAY > 0)
|
||||
case LINUX_KDGKBMODE:
|
||||
com = KDGKBMODE;
|
||||
break;
|
||||
@ -528,6 +623,32 @@ linux_machdepioctl(p, v, retval)
|
||||
case LINUX_VT_WAITACTIVE:
|
||||
com = VT_WAITACTIVE;
|
||||
break;
|
||||
#endif
|
||||
#if (NWSDISPLAY > 0)
|
||||
case LINUX_VT_GETSTATE:
|
||||
com = VT_GETSTATE;
|
||||
break;
|
||||
#ifdef XSERVER
|
||||
case LINUX_KDGKBTYPE:
|
||||
/* This is what Linux does. */
|
||||
return (subyte(SCARG(uap, data), KB_101));
|
||||
case LINUX_KDGKBENT:
|
||||
/*
|
||||
* The Linux KDGKBENT ioctl is different from the
|
||||
* SYSV original. So we handle it in machdep code.
|
||||
* XXX We should use keyboard mapping information
|
||||
* from wsdisplay, but this would be expensive.
|
||||
*/
|
||||
if ((error = copyin(SCARG(uap, data), &kbe,
|
||||
sizeof(struct kbentry))))
|
||||
return (error);
|
||||
if (kbe.kb_table >= sizeof(linux_keytabs) / sizeof(u_short *)
|
||||
|| kbe.kb_index >= NR_KEYS)
|
||||
return (EINVAL);
|
||||
kbe.kb_value = linux_keytabs[kbe.kb_table][kbe.kb_index];
|
||||
return (copyout(&kbe, SCARG(uap, data),
|
||||
sizeof(struct kbentry)));
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
printf("linux_machdepioctl: invalid ioctl %08lx\n", com);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_machdep.h,v 1.5 1996/05/03 19:26:28 christos Exp $ */
|
||||
/* $NetBSD: linux_machdep.h,v 1.6 1998/06/11 22:26:13 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Frank van der Linden
|
||||
@ -84,7 +84,8 @@ dev_t linux_fakedev __P((dev_t));
|
||||
* ugly patch to fake device numbers.
|
||||
*/
|
||||
#define LINUX_CONS_MAJOR 4
|
||||
#define NETBSD_CONS_MAJOR 12
|
||||
#define NETBSD_PCCONS_MAJOR 12
|
||||
#define NETBSD_WSCONS_MAJOR 47
|
||||
|
||||
/*
|
||||
* Linux ioctl calls for the keyboard.
|
||||
@ -97,6 +98,9 @@ dev_t linux_fakedev __P((dev_t));
|
||||
#define LINUX_KDDISABIO 0x4b37
|
||||
#define LINUX_KDGETLED 0x4b31
|
||||
#define LINUX_KDSETLED 0x4b32
|
||||
#define LINUX_KDGKBTYPE 0x4B33
|
||||
#define LINUX_KDGKBENT 0x4B46
|
||||
|
||||
/*
|
||||
* Mode for KDSKBMODE which we don't have (we just use plain mode for this)
|
||||
*/
|
||||
@ -108,6 +112,7 @@ dev_t linux_fakedev __P((dev_t));
|
||||
#define LINUX_VT_OPENQRY 0x5600
|
||||
#define LINUX_VT_GETMODE 0x5601
|
||||
#define LINUX_VT_SETMODE 0x5602
|
||||
#define LINUX_VT_GETSTATE 0x5603
|
||||
#define LINUX_VT_RELDISP 0x5605
|
||||
#define LINUX_VT_ACTIVATE 0x5606
|
||||
#define LINUX_VT_WAITACTIVE 0x5607
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_machdep.c,v 1.40 1998/05/08 16:55:15 kleink Exp $ */
|
||||
/* $NetBSD: linux_machdep.c,v 1.41 1998/06/11 22:26:13 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Frank van der Linden
|
||||
@ -85,6 +85,13 @@
|
||||
#include <arch/i386/isa/pcvt/pcvt_ioctl.h>
|
||||
#endif
|
||||
|
||||
#include "wsdisplay.h"
|
||||
#if (NWSDISPLAY > 0)
|
||||
#include <sys/ioctl.h>
|
||||
#include <dev/wscons/wsdisplay_usl_io.h>
|
||||
#include "opt_xserver.h"
|
||||
#endif
|
||||
|
||||
#ifdef USER_LDT
|
||||
#include <machine/cpu.h>
|
||||
int linux_read_ldt __P((struct proc *, struct linux_sys_modify_ldt_args *,
|
||||
@ -430,12 +437,97 @@ dev_t
|
||||
linux_fakedev(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
|
||||
if (major(dev) == NETBSD_CONS_MAJOR)
|
||||
#if (NVT > 0)
|
||||
if (major(dev) == NETBSD_PCCONS_MAJOR)
|
||||
return makedev(LINUX_CONS_MAJOR, (minor(dev) + 1));
|
||||
#endif
|
||||
#if (NWSDISPLAY > 0)
|
||||
if (major(dev) == NETBSD_WSCONS_MAJOR)
|
||||
return makedev(LINUX_CONS_MAJOR, (minor(dev) + 1));
|
||||
#endif
|
||||
return dev;
|
||||
}
|
||||
|
||||
#if (NWSDISPLAY > 0) && defined(XSERVER)
|
||||
/*
|
||||
* That's not complete, but enough to get an X server running.
|
||||
*/
|
||||
#define NR_KEYS 128
|
||||
static u_short plain_map[NR_KEYS] = {
|
||||
0x0200, 0x001b, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036,
|
||||
0x0037, 0x0038, 0x0039, 0x0030, 0x002d, 0x003d, 0x007f, 0x0009,
|
||||
0x0b71, 0x0b77, 0x0b65, 0x0b72, 0x0b74, 0x0b79, 0x0b75, 0x0b69,
|
||||
0x0b6f, 0x0b70, 0x005b, 0x005d, 0x0201, 0x0702, 0x0b61, 0x0b73,
|
||||
0x0b64, 0x0b66, 0x0b67, 0x0b68, 0x0b6a, 0x0b6b, 0x0b6c, 0x003b,
|
||||
0x0027, 0x0060, 0x0700, 0x005c, 0x0b7a, 0x0b78, 0x0b63, 0x0b76,
|
||||
0x0b62, 0x0b6e, 0x0b6d, 0x002c, 0x002e, 0x002f, 0x0700, 0x030c,
|
||||
0x0703, 0x0020, 0x0207, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104,
|
||||
0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x0208, 0x0209, 0x0307,
|
||||
0x0308, 0x0309, 0x030b, 0x0304, 0x0305, 0x0306, 0x030a, 0x0301,
|
||||
0x0302, 0x0303, 0x0300, 0x0310, 0x0206, 0x0200, 0x003c, 0x010a,
|
||||
0x010b, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
0x030e, 0x0702, 0x030d, 0x001c, 0x0701, 0x0205, 0x0114, 0x0603,
|
||||
0x0118, 0x0601, 0x0602, 0x0117, 0x0600, 0x0119, 0x0115, 0x0116,
|
||||
0x011a, 0x010c, 0x010d, 0x011b, 0x011c, 0x0110, 0x0311, 0x011d,
|
||||
0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
}, shift_map[NR_KEYS] = {
|
||||
0x0200, 0x001b, 0x0021, 0x0040, 0x0023, 0x0024, 0x0025, 0x005e,
|
||||
0x0026, 0x002a, 0x0028, 0x0029, 0x005f, 0x002b, 0x007f, 0x0009,
|
||||
0x0b51, 0x0b57, 0x0b45, 0x0b52, 0x0b54, 0x0b59, 0x0b55, 0x0b49,
|
||||
0x0b4f, 0x0b50, 0x007b, 0x007d, 0x0201, 0x0702, 0x0b41, 0x0b53,
|
||||
0x0b44, 0x0b46, 0x0b47, 0x0b48, 0x0b4a, 0x0b4b, 0x0b4c, 0x003a,
|
||||
0x0022, 0x007e, 0x0700, 0x007c, 0x0b5a, 0x0b58, 0x0b43, 0x0b56,
|
||||
0x0b42, 0x0b4e, 0x0b4d, 0x003c, 0x003e, 0x003f, 0x0700, 0x030c,
|
||||
0x0703, 0x0020, 0x0207, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e,
|
||||
0x010f, 0x0110, 0x0111, 0x0112, 0x0113, 0x0213, 0x0203, 0x0307,
|
||||
0x0308, 0x0309, 0x030b, 0x0304, 0x0305, 0x0306, 0x030a, 0x0301,
|
||||
0x0302, 0x0303, 0x0300, 0x0310, 0x0206, 0x0200, 0x003e, 0x010a,
|
||||
0x010b, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
0x030e, 0x0702, 0x030d, 0x0200, 0x0701, 0x0205, 0x0114, 0x0603,
|
||||
0x020b, 0x0601, 0x0602, 0x0117, 0x0600, 0x020a, 0x0115, 0x0116,
|
||||
0x011a, 0x010c, 0x010d, 0x011b, 0x011c, 0x0110, 0x0311, 0x011d,
|
||||
0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
}, altgr_map[NR_KEYS] = {
|
||||
0x0200, 0x0200, 0x0200, 0x0040, 0x0200, 0x0024, 0x0200, 0x0200,
|
||||
0x007b, 0x005b, 0x005d, 0x007d, 0x005c, 0x0200, 0x0200, 0x0200,
|
||||
0x0b71, 0x0b77, 0x0918, 0x0b72, 0x0b74, 0x0b79, 0x0b75, 0x0b69,
|
||||
0x0b6f, 0x0b70, 0x0200, 0x007e, 0x0201, 0x0702, 0x0914, 0x0b73,
|
||||
0x0917, 0x0919, 0x0b67, 0x0b68, 0x0b6a, 0x0b6b, 0x0b6c, 0x0200,
|
||||
0x0200, 0x0200, 0x0700, 0x0200, 0x0b7a, 0x0b78, 0x0916, 0x0b76,
|
||||
0x0915, 0x0b6e, 0x0b6d, 0x0200, 0x0200, 0x0200, 0x0700, 0x030c,
|
||||
0x0703, 0x0200, 0x0207, 0x050c, 0x050d, 0x050e, 0x050f, 0x0510,
|
||||
0x0511, 0x0512, 0x0513, 0x0514, 0x0515, 0x0208, 0x0202, 0x0911,
|
||||
0x0912, 0x0913, 0x030b, 0x090e, 0x090f, 0x0910, 0x030a, 0x090b,
|
||||
0x090c, 0x090d, 0x090a, 0x0310, 0x0206, 0x0200, 0x007c, 0x0516,
|
||||
0x0517, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
0x030e, 0x0702, 0x030d, 0x0200, 0x0701, 0x0205, 0x0114, 0x0603,
|
||||
0x0118, 0x0601, 0x0602, 0x0117, 0x0600, 0x0119, 0x0115, 0x0116,
|
||||
0x011a, 0x010c, 0x010d, 0x011b, 0x011c, 0x0110, 0x0311, 0x011d,
|
||||
0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
}, ctrl_map[NR_KEYS] = {
|
||||
0x0200, 0x0200, 0x0200, 0x0000, 0x001b, 0x001c, 0x001d, 0x001e,
|
||||
0x001f, 0x007f, 0x0200, 0x0200, 0x001f, 0x0200, 0x0008, 0x0200,
|
||||
0x0011, 0x0017, 0x0005, 0x0012, 0x0014, 0x0019, 0x0015, 0x0009,
|
||||
0x000f, 0x0010, 0x001b, 0x001d, 0x0201, 0x0702, 0x0001, 0x0013,
|
||||
0x0004, 0x0006, 0x0007, 0x0008, 0x000a, 0x000b, 0x000c, 0x0200,
|
||||
0x0007, 0x0000, 0x0700, 0x001c, 0x001a, 0x0018, 0x0003, 0x0016,
|
||||
0x0002, 0x000e, 0x000d, 0x0200, 0x020e, 0x007f, 0x0700, 0x030c,
|
||||
0x0703, 0x0000, 0x0207, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104,
|
||||
0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x0208, 0x0204, 0x0307,
|
||||
0x0308, 0x0309, 0x030b, 0x0304, 0x0305, 0x0306, 0x030a, 0x0301,
|
||||
0x0302, 0x0303, 0x0300, 0x0310, 0x0206, 0x0200, 0x0200, 0x010a,
|
||||
0x010b, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
0x030e, 0x0702, 0x030d, 0x001c, 0x0701, 0x0205, 0x0114, 0x0603,
|
||||
0x0118, 0x0601, 0x0602, 0x0117, 0x0600, 0x0119, 0x0115, 0x0116,
|
||||
0x011a, 0x010c, 0x010d, 0x011b, 0x011c, 0x0110, 0x0311, 0x011d,
|
||||
0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
};
|
||||
|
||||
u_short *linux_keytabs[] = {
|
||||
plain_map, shift_map, altgr_map, altgr_map, ctrl_map
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We come here in a last attempt to satisfy a Linux ioctl() call
|
||||
*/
|
||||
@ -452,18 +544,21 @@ linux_machdepioctl(p, v, retval)
|
||||
} */ *uap = v;
|
||||
struct sys_ioctl_args bia;
|
||||
u_long com;
|
||||
#if NVT > 0
|
||||
#if (NVT > 0) || (NWSDISPLAY > 0)
|
||||
int error;
|
||||
struct vt_mode lvt;
|
||||
caddr_t bvtp, sg;
|
||||
#endif
|
||||
#if (NWSDISPLAY > 0) && defined(XSERVER)
|
||||
struct kbentry kbe;
|
||||
#endif
|
||||
|
||||
SCARG(&bia, fd) = SCARG(uap, fd);
|
||||
SCARG(&bia, data) = SCARG(uap, data);
|
||||
com = SCARG(uap, com);
|
||||
|
||||
switch (com) {
|
||||
#if NVT > 0
|
||||
#if (NVT > 0) || (NWSDISPLAY > 0)
|
||||
case LINUX_KDGKBMODE:
|
||||
com = KDGKBMODE;
|
||||
break;
|
||||
@ -528,6 +623,32 @@ linux_machdepioctl(p, v, retval)
|
||||
case LINUX_VT_WAITACTIVE:
|
||||
com = VT_WAITACTIVE;
|
||||
break;
|
||||
#endif
|
||||
#if (NWSDISPLAY > 0)
|
||||
case LINUX_VT_GETSTATE:
|
||||
com = VT_GETSTATE;
|
||||
break;
|
||||
#ifdef XSERVER
|
||||
case LINUX_KDGKBTYPE:
|
||||
/* This is what Linux does. */
|
||||
return (subyte(SCARG(uap, data), KB_101));
|
||||
case LINUX_KDGKBENT:
|
||||
/*
|
||||
* The Linux KDGKBENT ioctl is different from the
|
||||
* SYSV original. So we handle it in machdep code.
|
||||
* XXX We should use keyboard mapping information
|
||||
* from wsdisplay, but this would be expensive.
|
||||
*/
|
||||
if ((error = copyin(SCARG(uap, data), &kbe,
|
||||
sizeof(struct kbentry))))
|
||||
return (error);
|
||||
if (kbe.kb_table >= sizeof(linux_keytabs) / sizeof(u_short *)
|
||||
|| kbe.kb_index >= NR_KEYS)
|
||||
return (EINVAL);
|
||||
kbe.kb_value = linux_keytabs[kbe.kb_table][kbe.kb_index];
|
||||
return (copyout(&kbe, SCARG(uap, data),
|
||||
sizeof(struct kbentry)));
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
printf("linux_machdepioctl: invalid ioctl %08lx\n", com);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_machdep.h,v 1.5 1996/05/03 19:26:28 christos Exp $ */
|
||||
/* $NetBSD: linux_machdep.h,v 1.6 1998/06/11 22:26:13 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Frank van der Linden
|
||||
@ -84,7 +84,8 @@ dev_t linux_fakedev __P((dev_t));
|
||||
* ugly patch to fake device numbers.
|
||||
*/
|
||||
#define LINUX_CONS_MAJOR 4
|
||||
#define NETBSD_CONS_MAJOR 12
|
||||
#define NETBSD_PCCONS_MAJOR 12
|
||||
#define NETBSD_WSCONS_MAJOR 47
|
||||
|
||||
/*
|
||||
* Linux ioctl calls for the keyboard.
|
||||
@ -97,6 +98,9 @@ dev_t linux_fakedev __P((dev_t));
|
||||
#define LINUX_KDDISABIO 0x4b37
|
||||
#define LINUX_KDGETLED 0x4b31
|
||||
#define LINUX_KDSETLED 0x4b32
|
||||
#define LINUX_KDGKBTYPE 0x4B33
|
||||
#define LINUX_KDGKBENT 0x4B46
|
||||
|
||||
/*
|
||||
* Mode for KDSKBMODE which we don't have (we just use plain mode for this)
|
||||
*/
|
||||
@ -108,6 +112,7 @@ dev_t linux_fakedev __P((dev_t));
|
||||
#define LINUX_VT_OPENQRY 0x5600
|
||||
#define LINUX_VT_GETMODE 0x5601
|
||||
#define LINUX_VT_SETMODE 0x5602
|
||||
#define LINUX_VT_GETSTATE 0x5603
|
||||
#define LINUX_VT_RELDISP 0x5605
|
||||
#define LINUX_VT_ACTIVATE 0x5606
|
||||
#define LINUX_VT_WAITACTIVE 0x5607
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_machdep.c,v 1.40 1998/05/08 16:55:15 kleink Exp $ */
|
||||
/* $NetBSD: linux_machdep.c,v 1.41 1998/06/11 22:26:13 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Frank van der Linden
|
||||
@ -85,6 +85,13 @@
|
||||
#include <arch/i386/isa/pcvt/pcvt_ioctl.h>
|
||||
#endif
|
||||
|
||||
#include "wsdisplay.h"
|
||||
#if (NWSDISPLAY > 0)
|
||||
#include <sys/ioctl.h>
|
||||
#include <dev/wscons/wsdisplay_usl_io.h>
|
||||
#include "opt_xserver.h"
|
||||
#endif
|
||||
|
||||
#ifdef USER_LDT
|
||||
#include <machine/cpu.h>
|
||||
int linux_read_ldt __P((struct proc *, struct linux_sys_modify_ldt_args *,
|
||||
@ -430,12 +437,97 @@ dev_t
|
||||
linux_fakedev(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
|
||||
if (major(dev) == NETBSD_CONS_MAJOR)
|
||||
#if (NVT > 0)
|
||||
if (major(dev) == NETBSD_PCCONS_MAJOR)
|
||||
return makedev(LINUX_CONS_MAJOR, (minor(dev) + 1));
|
||||
#endif
|
||||
#if (NWSDISPLAY > 0)
|
||||
if (major(dev) == NETBSD_WSCONS_MAJOR)
|
||||
return makedev(LINUX_CONS_MAJOR, (minor(dev) + 1));
|
||||
#endif
|
||||
return dev;
|
||||
}
|
||||
|
||||
#if (NWSDISPLAY > 0) && defined(XSERVER)
|
||||
/*
|
||||
* That's not complete, but enough to get an X server running.
|
||||
*/
|
||||
#define NR_KEYS 128
|
||||
static u_short plain_map[NR_KEYS] = {
|
||||
0x0200, 0x001b, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036,
|
||||
0x0037, 0x0038, 0x0039, 0x0030, 0x002d, 0x003d, 0x007f, 0x0009,
|
||||
0x0b71, 0x0b77, 0x0b65, 0x0b72, 0x0b74, 0x0b79, 0x0b75, 0x0b69,
|
||||
0x0b6f, 0x0b70, 0x005b, 0x005d, 0x0201, 0x0702, 0x0b61, 0x0b73,
|
||||
0x0b64, 0x0b66, 0x0b67, 0x0b68, 0x0b6a, 0x0b6b, 0x0b6c, 0x003b,
|
||||
0x0027, 0x0060, 0x0700, 0x005c, 0x0b7a, 0x0b78, 0x0b63, 0x0b76,
|
||||
0x0b62, 0x0b6e, 0x0b6d, 0x002c, 0x002e, 0x002f, 0x0700, 0x030c,
|
||||
0x0703, 0x0020, 0x0207, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104,
|
||||
0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x0208, 0x0209, 0x0307,
|
||||
0x0308, 0x0309, 0x030b, 0x0304, 0x0305, 0x0306, 0x030a, 0x0301,
|
||||
0x0302, 0x0303, 0x0300, 0x0310, 0x0206, 0x0200, 0x003c, 0x010a,
|
||||
0x010b, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
0x030e, 0x0702, 0x030d, 0x001c, 0x0701, 0x0205, 0x0114, 0x0603,
|
||||
0x0118, 0x0601, 0x0602, 0x0117, 0x0600, 0x0119, 0x0115, 0x0116,
|
||||
0x011a, 0x010c, 0x010d, 0x011b, 0x011c, 0x0110, 0x0311, 0x011d,
|
||||
0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
}, shift_map[NR_KEYS] = {
|
||||
0x0200, 0x001b, 0x0021, 0x0040, 0x0023, 0x0024, 0x0025, 0x005e,
|
||||
0x0026, 0x002a, 0x0028, 0x0029, 0x005f, 0x002b, 0x007f, 0x0009,
|
||||
0x0b51, 0x0b57, 0x0b45, 0x0b52, 0x0b54, 0x0b59, 0x0b55, 0x0b49,
|
||||
0x0b4f, 0x0b50, 0x007b, 0x007d, 0x0201, 0x0702, 0x0b41, 0x0b53,
|
||||
0x0b44, 0x0b46, 0x0b47, 0x0b48, 0x0b4a, 0x0b4b, 0x0b4c, 0x003a,
|
||||
0x0022, 0x007e, 0x0700, 0x007c, 0x0b5a, 0x0b58, 0x0b43, 0x0b56,
|
||||
0x0b42, 0x0b4e, 0x0b4d, 0x003c, 0x003e, 0x003f, 0x0700, 0x030c,
|
||||
0x0703, 0x0020, 0x0207, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e,
|
||||
0x010f, 0x0110, 0x0111, 0x0112, 0x0113, 0x0213, 0x0203, 0x0307,
|
||||
0x0308, 0x0309, 0x030b, 0x0304, 0x0305, 0x0306, 0x030a, 0x0301,
|
||||
0x0302, 0x0303, 0x0300, 0x0310, 0x0206, 0x0200, 0x003e, 0x010a,
|
||||
0x010b, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
0x030e, 0x0702, 0x030d, 0x0200, 0x0701, 0x0205, 0x0114, 0x0603,
|
||||
0x020b, 0x0601, 0x0602, 0x0117, 0x0600, 0x020a, 0x0115, 0x0116,
|
||||
0x011a, 0x010c, 0x010d, 0x011b, 0x011c, 0x0110, 0x0311, 0x011d,
|
||||
0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
}, altgr_map[NR_KEYS] = {
|
||||
0x0200, 0x0200, 0x0200, 0x0040, 0x0200, 0x0024, 0x0200, 0x0200,
|
||||
0x007b, 0x005b, 0x005d, 0x007d, 0x005c, 0x0200, 0x0200, 0x0200,
|
||||
0x0b71, 0x0b77, 0x0918, 0x0b72, 0x0b74, 0x0b79, 0x0b75, 0x0b69,
|
||||
0x0b6f, 0x0b70, 0x0200, 0x007e, 0x0201, 0x0702, 0x0914, 0x0b73,
|
||||
0x0917, 0x0919, 0x0b67, 0x0b68, 0x0b6a, 0x0b6b, 0x0b6c, 0x0200,
|
||||
0x0200, 0x0200, 0x0700, 0x0200, 0x0b7a, 0x0b78, 0x0916, 0x0b76,
|
||||
0x0915, 0x0b6e, 0x0b6d, 0x0200, 0x0200, 0x0200, 0x0700, 0x030c,
|
||||
0x0703, 0x0200, 0x0207, 0x050c, 0x050d, 0x050e, 0x050f, 0x0510,
|
||||
0x0511, 0x0512, 0x0513, 0x0514, 0x0515, 0x0208, 0x0202, 0x0911,
|
||||
0x0912, 0x0913, 0x030b, 0x090e, 0x090f, 0x0910, 0x030a, 0x090b,
|
||||
0x090c, 0x090d, 0x090a, 0x0310, 0x0206, 0x0200, 0x007c, 0x0516,
|
||||
0x0517, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
0x030e, 0x0702, 0x030d, 0x0200, 0x0701, 0x0205, 0x0114, 0x0603,
|
||||
0x0118, 0x0601, 0x0602, 0x0117, 0x0600, 0x0119, 0x0115, 0x0116,
|
||||
0x011a, 0x010c, 0x010d, 0x011b, 0x011c, 0x0110, 0x0311, 0x011d,
|
||||
0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
}, ctrl_map[NR_KEYS] = {
|
||||
0x0200, 0x0200, 0x0200, 0x0000, 0x001b, 0x001c, 0x001d, 0x001e,
|
||||
0x001f, 0x007f, 0x0200, 0x0200, 0x001f, 0x0200, 0x0008, 0x0200,
|
||||
0x0011, 0x0017, 0x0005, 0x0012, 0x0014, 0x0019, 0x0015, 0x0009,
|
||||
0x000f, 0x0010, 0x001b, 0x001d, 0x0201, 0x0702, 0x0001, 0x0013,
|
||||
0x0004, 0x0006, 0x0007, 0x0008, 0x000a, 0x000b, 0x000c, 0x0200,
|
||||
0x0007, 0x0000, 0x0700, 0x001c, 0x001a, 0x0018, 0x0003, 0x0016,
|
||||
0x0002, 0x000e, 0x000d, 0x0200, 0x020e, 0x007f, 0x0700, 0x030c,
|
||||
0x0703, 0x0000, 0x0207, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104,
|
||||
0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x0208, 0x0204, 0x0307,
|
||||
0x0308, 0x0309, 0x030b, 0x0304, 0x0305, 0x0306, 0x030a, 0x0301,
|
||||
0x0302, 0x0303, 0x0300, 0x0310, 0x0206, 0x0200, 0x0200, 0x010a,
|
||||
0x010b, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
0x030e, 0x0702, 0x030d, 0x001c, 0x0701, 0x0205, 0x0114, 0x0603,
|
||||
0x0118, 0x0601, 0x0602, 0x0117, 0x0600, 0x0119, 0x0115, 0x0116,
|
||||
0x011a, 0x010c, 0x010d, 0x011b, 0x011c, 0x0110, 0x0311, 0x011d,
|
||||
0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200,
|
||||
};
|
||||
|
||||
u_short *linux_keytabs[] = {
|
||||
plain_map, shift_map, altgr_map, altgr_map, ctrl_map
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We come here in a last attempt to satisfy a Linux ioctl() call
|
||||
*/
|
||||
@ -452,18 +544,21 @@ linux_machdepioctl(p, v, retval)
|
||||
} */ *uap = v;
|
||||
struct sys_ioctl_args bia;
|
||||
u_long com;
|
||||
#if NVT > 0
|
||||
#if (NVT > 0) || (NWSDISPLAY > 0)
|
||||
int error;
|
||||
struct vt_mode lvt;
|
||||
caddr_t bvtp, sg;
|
||||
#endif
|
||||
#if (NWSDISPLAY > 0) && defined(XSERVER)
|
||||
struct kbentry kbe;
|
||||
#endif
|
||||
|
||||
SCARG(&bia, fd) = SCARG(uap, fd);
|
||||
SCARG(&bia, data) = SCARG(uap, data);
|
||||
com = SCARG(uap, com);
|
||||
|
||||
switch (com) {
|
||||
#if NVT > 0
|
||||
#if (NVT > 0) || (NWSDISPLAY > 0)
|
||||
case LINUX_KDGKBMODE:
|
||||
com = KDGKBMODE;
|
||||
break;
|
||||
@ -528,6 +623,32 @@ linux_machdepioctl(p, v, retval)
|
||||
case LINUX_VT_WAITACTIVE:
|
||||
com = VT_WAITACTIVE;
|
||||
break;
|
||||
#endif
|
||||
#if (NWSDISPLAY > 0)
|
||||
case LINUX_VT_GETSTATE:
|
||||
com = VT_GETSTATE;
|
||||
break;
|
||||
#ifdef XSERVER
|
||||
case LINUX_KDGKBTYPE:
|
||||
/* This is what Linux does. */
|
||||
return (subyte(SCARG(uap, data), KB_101));
|
||||
case LINUX_KDGKBENT:
|
||||
/*
|
||||
* The Linux KDGKBENT ioctl is different from the
|
||||
* SYSV original. So we handle it in machdep code.
|
||||
* XXX We should use keyboard mapping information
|
||||
* from wsdisplay, but this would be expensive.
|
||||
*/
|
||||
if ((error = copyin(SCARG(uap, data), &kbe,
|
||||
sizeof(struct kbentry))))
|
||||
return (error);
|
||||
if (kbe.kb_table >= sizeof(linux_keytabs) / sizeof(u_short *)
|
||||
|| kbe.kb_index >= NR_KEYS)
|
||||
return (EINVAL);
|
||||
kbe.kb_value = linux_keytabs[kbe.kb_table][kbe.kb_index];
|
||||
return (copyout(&kbe, SCARG(uap, data),
|
||||
sizeof(struct kbentry)));
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
printf("linux_machdepioctl: invalid ioctl %08lx\n", com);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_machdep.h,v 1.5 1996/05/03 19:26:28 christos Exp $ */
|
||||
/* $NetBSD: linux_machdep.h,v 1.6 1998/06/11 22:26:13 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Frank van der Linden
|
||||
@ -84,7 +84,8 @@ dev_t linux_fakedev __P((dev_t));
|
||||
* ugly patch to fake device numbers.
|
||||
*/
|
||||
#define LINUX_CONS_MAJOR 4
|
||||
#define NETBSD_CONS_MAJOR 12
|
||||
#define NETBSD_PCCONS_MAJOR 12
|
||||
#define NETBSD_WSCONS_MAJOR 47
|
||||
|
||||
/*
|
||||
* Linux ioctl calls for the keyboard.
|
||||
@ -97,6 +98,9 @@ dev_t linux_fakedev __P((dev_t));
|
||||
#define LINUX_KDDISABIO 0x4b37
|
||||
#define LINUX_KDGETLED 0x4b31
|
||||
#define LINUX_KDSETLED 0x4b32
|
||||
#define LINUX_KDGKBTYPE 0x4B33
|
||||
#define LINUX_KDGKBENT 0x4B46
|
||||
|
||||
/*
|
||||
* Mode for KDSKBMODE which we don't have (we just use plain mode for this)
|
||||
*/
|
||||
@ -108,6 +112,7 @@ dev_t linux_fakedev __P((dev_t));
|
||||
#define LINUX_VT_OPENQRY 0x5600
|
||||
#define LINUX_VT_GETMODE 0x5601
|
||||
#define LINUX_VT_SETMODE 0x5602
|
||||
#define LINUX_VT_GETSTATE 0x5603
|
||||
#define LINUX_VT_RELDISP 0x5605
|
||||
#define LINUX_VT_ACTIVATE 0x5606
|
||||
#define LINUX_VT_WAITACTIVE 0x5607
|
||||
|
Loading…
Reference in New Issue
Block a user