summaryrefslogtreecommitdiff
path: root/sys/dev/syscons
diff options
context:
space:
mode:
authorKazutaka YOKOTA <yokota@FreeBSD.org>2001-07-16 05:21:24 +0000
committerKazutaka YOKOTA <yokota@FreeBSD.org>2001-07-16 05:21:24 +0000
commit8a3b34897083fc28742a10e9900a7511beaccd8e (patch)
tree38c1e5b70de601aac8ae9f48cdc104d04dae5038 /sys/dev/syscons
parent728c5aefc637eb51a944fd633829c5529e4212a8 (diff)
Notes
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r--sys/dev/syscons/scmouse.c2
-rw-r--r--sys/dev/syscons/scvtb.c8
-rw-r--r--sys/dev/syscons/syscons.c8
-rw-r--r--sys/dev/syscons/syscons.h1
-rw-r--r--sys/dev/syscons/sysmouse.c2
5 files changed, 15 insertions, 6 deletions
diff --git a/sys/dev/syscons/scmouse.c b/sys/dev/syscons/scmouse.c
index b94980e2d024..8b231ef4b0f9 100644
--- a/sys/dev/syscons/scmouse.c
+++ b/sys/dev/syscons/scmouse.c
@@ -641,7 +641,7 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
old_mouse->u.data.x = scp->mouse_xpos;
old_mouse->u.data.y = scp->mouse_ypos;
old_mouse->u.data.buttons = swapb[scp->mouse_buttons & 0x7];
- break;
+ return 0;
default:
return EINVAL;
}
diff --git a/sys/dev/syscons/scvtb.c b/sys/dev/syscons/scvtb.c
index dc5155b113c8..292eb727f72c 100644
--- a/sys/dev/syscons/scvtb.c
+++ b/sys/dev/syscons/scvtb.c
@@ -60,9 +60,11 @@ sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait)
(vm_offset_t)malloc(cols*rows*sizeof(u_int16_t),
M_DEVBUF,
(wait) ? M_WAITOK : M_NOWAIT);
- if (vtb->vtb_buffer != NULL)
+ if (vtb->vtb_buffer != NULL) {
bzero((void *)sc_vtb_pointer(vtb, 0),
cols*rows*sizeof(u_int16_t));
+ vtb->vtb_flags |= VTB_ALLOCED;
+ }
} else {
vtb->vtb_buffer = (vm_offset_t)buf;
}
@@ -82,7 +84,6 @@ sc_vtb_destroy(sc_vtb_t *vtb)
{
vm_offset_t p;
- vtb->vtb_flags = 0;
vtb->vtb_cols = 0;
vtb->vtb_rows = 0;
vtb->vtb_size = 0;
@@ -93,12 +94,13 @@ sc_vtb_destroy(sc_vtb_t *vtb)
switch (vtb->vtb_type) {
case VTB_MEMORY:
case VTB_RINGBUFFER:
- if (p != NULL)
+ if ((vtb->vtb_flags & VTB_ALLOCED) && (p != NULL))
free((void *)p, M_DEVBUF);
break;
default:
break;
}
+ vtb->vtb_flags = 0;
vtb->vtb_type = VTB_INVALID;
}
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 7fda42fd3b6d..5b964e6a0b0e 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -474,7 +474,7 @@ scopen(dev_t dev, int flag, int mode, struct proc *p)
ttychars(tp);
/* Use the current setting of the <-- key as default VERASE. */
/* If the Delete key is preferable, an stty is necessary */
- if (sc != NULL) {
+ if (sc->kbd != NULL) {
key.keynum = KEYCODE_BS;
kbd_ioctl(sc->kbd, GIO_KEYMAPENT, (caddr_t)&key);
tp->t_cc[VERASE] = key.key.map[0];
@@ -2217,6 +2217,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr)
/*
* Is the wanted vty open? Don't allow switching to a closed vty.
+ * If we are in DDB, don't switch to a vty in the VT_PROCESS mode.
* Note that we always allow the user to switch to the kernel
* console even if it is closed.
*/
@@ -2228,6 +2229,11 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr)
DPRINTF(5, ("error 2, requested vty isn't open!\n"));
return EINVAL;
}
+ if ((debugger > 0) && (SC_STAT(tp->t_dev)->smode.mode == VT_PROCESS)) {
+ splx(s);
+ DPRINTF(5, ("error 3, requested vty is in the VT_PROCESS mode\n"));
+ return EINVAL;
+ }
}
/* this is the start of vty switching process... */
diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h
index a93ce33ecdb4..66fb1705a5a1 100644
--- a/sys/dev/syscons/syscons.h
+++ b/sys/dev/syscons/syscons.h
@@ -128,6 +128,7 @@
typedef struct sc_vtb {
int vtb_flags;
#define VTB_VALID (1 << 0)
+#define VTB_ALLOCED (1 << 1)
int vtb_type;
#define VTB_INVALID 0
#define VTB_MEMORY 1
diff --git a/sys/dev/syscons/sysmouse.c b/sys/dev/syscons/sysmouse.c
index e97be1ac6602..bf9ae183b268 100644
--- a/sys/dev/syscons/sysmouse.c
+++ b/sys/dev/syscons/sysmouse.c
@@ -89,6 +89,7 @@ smopen(dev_t dev, int flag, int mode, struct proc *p)
tp = dev->si_tty = ttymalloc(dev->si_tty);
if (!(tp->t_state & TS_ISOPEN)) {
+ sysmouse_tty = tp;
tp->t_oproc = smstart;
tp->t_param = smparam;
tp->t_stop = nottystop;
@@ -257,7 +258,6 @@ sm_attach_mouse(void *unused)
dev = make_dev(&sm_cdevsw, SC_MOUSE, UID_ROOT, GID_WHEEL, 0600,
"sysmouse");
- dev->si_tty = sysmouse_tty = ttymalloc(sysmouse_tty);
/* sysmouse doesn't have scr_stat */
}