Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/vt/vt_buf.c
Show All 40 Lines | |||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/reboot.h> | #include <sys/reboot.h> | ||||
#include <dev/vt/vt.h> | #include <dev/vt/vt.h> | ||||
static MALLOC_DEFINE(M_VTBUF, "vtbuf", "vt buffer"); | static MALLOC_DEFINE(M_VTBUF, "vtbuf", "vt buffer"); | ||||
#define VTBUF_LOCK(vb) mtx_lock_spin(&(vb)->vb_lock) | #define VTBUF_LOCK(vb) mtx_lock(&(vb)->vb_lock) | ||||
#define VTBUF_UNLOCK(vb) mtx_unlock_spin(&(vb)->vb_lock) | #define VTBUF_UNLOCK(vb) mtx_unlock(&(vb)->vb_lock) | ||||
#define POS_INDEX(c, r) (((r) << 12) + (c)) | #define POS_INDEX(c, r) (((r) << 12) + (c)) | ||||
#define POS_COPY(d, s) do { \ | #define POS_COPY(d, s) do { \ | ||||
(d).tp_col = (s).tp_col; \ | (d).tp_col = (s).tp_col; \ | ||||
(d).tp_row = (s).tp_row; \ | (d).tp_row = (s).tp_row; \ | ||||
} while (0) | } while (0) | ||||
#ifndef SC_NO_CUTPASTE | #ifndef SC_NO_CUTPASTE | ||||
▲ Show 20 Lines • Show All 388 Lines • ▼ Show 20 Lines | |||||
vtbuf_init_early(struct vt_buf *vb) | vtbuf_init_early(struct vt_buf *vb) | ||||
{ | { | ||||
vb->vb_flags |= VBF_CURSOR; | vb->vb_flags |= VBF_CURSOR; | ||||
vtbuf_reset_scrollback(vb); | vtbuf_reset_scrollback(vb); | ||||
vtbuf_init_rows(vb); | vtbuf_init_rows(vb); | ||||
vtbuf_do_clearhistory(vb); | vtbuf_do_clearhistory(vb); | ||||
vtbuf_make_undirty(vb); | vtbuf_make_undirty(vb); | ||||
if ((vb->vb_flags & VBF_MTX_INIT) == 0) { | if ((vb->vb_flags & VBF_MTX_INIT) == 0) { | ||||
mtx_init(&vb->vb_lock, "vtbuf", NULL, MTX_SPIN); | mtx_init(&vb->vb_lock, "vtbuf", NULL, MTX_DEF); | ||||
vb->vb_flags |= VBF_MTX_INIT; | vb->vb_flags |= VBF_MTX_INIT; | ||||
} | } | ||||
} | } | ||||
void | void | ||||
vtbuf_init(struct vt_buf *vb, const term_pos_t *p) | vtbuf_init(struct vt_buf *vb, const term_pos_t *p) | ||||
{ | { | ||||
int sz; | int sz; | ||||
▲ Show 20 Lines • Show All 462 Lines • Show Last 20 Lines |