mirror of
https://github.com/freebsd/freebsd-src
synced 2024-11-05 18:22:52 +00:00
Add a new compile option SC_HISTORY_SIZE to specify the history buffer
size in terms of lines (instead of bytes). When changing video mode in ioctl SW_XXX commands, syscons checks scp->history_size and allocate a history buffer at least as large as the new screen size. (This was unnecessary before, because HISTORY_SIZE was as large as 100 lines and this is bigger than the maximum screen size: 60 lines). Similar adjustment is done in ioctl CONS_HISTORY command too. PR: kern/4169 Reviewed by: sos
This commit is contained in:
parent
326df44ead
commit
9d6218d088
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29121
6 changed files with 57 additions and 42 deletions
|
@ -25,7 +25,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.c,v 1.229 1997/08/08 22:52:30 sos Exp $
|
||||
* $Id: syscons.c,v 1.230 1997/08/09 19:24:03 sos Exp $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
|
@ -961,16 +961,11 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|||
return EBUSY;
|
||||
if (scp->history != NULL)
|
||||
free(scp->history, M_DEVBUF);
|
||||
scp->history_size = *(int*)data;
|
||||
if (scp->history_size < scp->ysize)
|
||||
scp->history = NULL;
|
||||
else {
|
||||
scp->history_size *= scp->xsize;
|
||||
scp->history_head = scp->history_pos = scp->history =
|
||||
(u_short *)malloc(scp->history_size*sizeof(u_short),
|
||||
M_DEVBUF, M_WAITOK);
|
||||
bzero(scp->history_head, scp->history_size*sizeof(u_short));
|
||||
}
|
||||
scp->history_size = max(scp->ysize, *(int *)data)*scp->xsize;
|
||||
scp->history_head = scp->history_pos = scp->history =
|
||||
(u_short *)malloc(scp->history_size*sizeof(u_short),
|
||||
M_DEVBUF, M_WAITOK);
|
||||
bzero(scp->history_head, scp->history_size*sizeof(u_short));
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@ -1183,6 +1178,13 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|||
free(cut_buffer, M_DEVBUF);
|
||||
cut_buffer = (char *)malloc(scp->xsize*scp->ysize, M_DEVBUF, M_NOWAIT);
|
||||
cut_buffer[0] = 0x00;
|
||||
if (scp->history != NULL)
|
||||
free(scp->history, M_DEVBUF);
|
||||
scp->history_size = max(HISTORY_SIZE, scp->xsize*scp->ysize);
|
||||
scp->history_head = scp->history_pos = scp->history = (u_short *)
|
||||
malloc(scp->history_size*sizeof(u_short), M_DEVBUF, M_NOWAIT);
|
||||
if (scp->history != NULL)
|
||||
bzero(scp->history, scp->history_size*sizeof(u_short));
|
||||
if (scp == cur_console)
|
||||
set_mode(scp);
|
||||
scp->status &= ~UNKNOWN_MODE;
|
||||
|
@ -2812,7 +2814,7 @@ init_scp(scr_stat *scp)
|
|||
scp->proc = NULL;
|
||||
scp->smode.mode = VT_AUTO;
|
||||
scp->history_head = scp->history_pos = scp->history = NULL;
|
||||
scp->history_size = HISTORY_SIZE;
|
||||
scp->history_size = max(HISTORY_SIZE, scp->xsize*scp->ysize);
|
||||
}
|
||||
|
||||
static u_char
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.h,v 1.31 1997/07/15 14:43:27 yokota Exp $
|
||||
* $Id: syscons.h,v 1.32 1997/08/25 23:21:55 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_ISA_SYSCONS_H_
|
||||
|
@ -101,7 +101,10 @@
|
|||
#define FONT_8 2
|
||||
#define FONT_14 4
|
||||
#define FONT_16 8
|
||||
#define HISTORY_SIZE (COL * ROW * 4)
|
||||
#if !defined(SC_HISTORY_SIZE)
|
||||
#define SC_HISTORY_SIZE (ROW * 4)
|
||||
#endif /* SC_HISTORY_SIZE */
|
||||
#define HISTORY_SIZE (COL * (SC_HISTORY_SIZE))
|
||||
|
||||
/* defines related to hardware addresses */
|
||||
#define MONO_BASE 0x3B4 /* crt controller base mono */
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.c,v 1.229 1997/08/08 22:52:30 sos Exp $
|
||||
* $Id: syscons.c,v 1.230 1997/08/09 19:24:03 sos Exp $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
|
@ -961,16 +961,11 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|||
return EBUSY;
|
||||
if (scp->history != NULL)
|
||||
free(scp->history, M_DEVBUF);
|
||||
scp->history_size = *(int*)data;
|
||||
if (scp->history_size < scp->ysize)
|
||||
scp->history = NULL;
|
||||
else {
|
||||
scp->history_size *= scp->xsize;
|
||||
scp->history_head = scp->history_pos = scp->history =
|
||||
(u_short *)malloc(scp->history_size*sizeof(u_short),
|
||||
M_DEVBUF, M_WAITOK);
|
||||
bzero(scp->history_head, scp->history_size*sizeof(u_short));
|
||||
}
|
||||
scp->history_size = max(scp->ysize, *(int *)data)*scp->xsize;
|
||||
scp->history_head = scp->history_pos = scp->history =
|
||||
(u_short *)malloc(scp->history_size*sizeof(u_short),
|
||||
M_DEVBUF, M_WAITOK);
|
||||
bzero(scp->history_head, scp->history_size*sizeof(u_short));
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@ -1183,6 +1178,13 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|||
free(cut_buffer, M_DEVBUF);
|
||||
cut_buffer = (char *)malloc(scp->xsize*scp->ysize, M_DEVBUF, M_NOWAIT);
|
||||
cut_buffer[0] = 0x00;
|
||||
if (scp->history != NULL)
|
||||
free(scp->history, M_DEVBUF);
|
||||
scp->history_size = max(HISTORY_SIZE, scp->xsize*scp->ysize);
|
||||
scp->history_head = scp->history_pos = scp->history = (u_short *)
|
||||
malloc(scp->history_size*sizeof(u_short), M_DEVBUF, M_NOWAIT);
|
||||
if (scp->history != NULL)
|
||||
bzero(scp->history, scp->history_size*sizeof(u_short));
|
||||
if (scp == cur_console)
|
||||
set_mode(scp);
|
||||
scp->status &= ~UNKNOWN_MODE;
|
||||
|
@ -2812,7 +2814,7 @@ init_scp(scr_stat *scp)
|
|||
scp->proc = NULL;
|
||||
scp->smode.mode = VT_AUTO;
|
||||
scp->history_head = scp->history_pos = scp->history = NULL;
|
||||
scp->history_size = HISTORY_SIZE;
|
||||
scp->history_size = max(HISTORY_SIZE, scp->xsize*scp->ysize);
|
||||
}
|
||||
|
||||
static u_char
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.h,v 1.31 1997/07/15 14:43:27 yokota Exp $
|
||||
* $Id: syscons.h,v 1.32 1997/08/25 23:21:55 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_ISA_SYSCONS_H_
|
||||
|
@ -101,7 +101,10 @@
|
|||
#define FONT_8 2
|
||||
#define FONT_14 4
|
||||
#define FONT_16 8
|
||||
#define HISTORY_SIZE (COL * ROW * 4)
|
||||
#if !defined(SC_HISTORY_SIZE)
|
||||
#define SC_HISTORY_SIZE (ROW * 4)
|
||||
#endif /* SC_HISTORY_SIZE */
|
||||
#define HISTORY_SIZE (COL * (SC_HISTORY_SIZE))
|
||||
|
||||
/* defines related to hardware addresses */
|
||||
#define MONO_BASE 0x3B4 /* crt controller base mono */
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.c,v 1.229 1997/08/08 22:52:30 sos Exp $
|
||||
* $Id: syscons.c,v 1.230 1997/08/09 19:24:03 sos Exp $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
|
@ -961,16 +961,11 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|||
return EBUSY;
|
||||
if (scp->history != NULL)
|
||||
free(scp->history, M_DEVBUF);
|
||||
scp->history_size = *(int*)data;
|
||||
if (scp->history_size < scp->ysize)
|
||||
scp->history = NULL;
|
||||
else {
|
||||
scp->history_size *= scp->xsize;
|
||||
scp->history_head = scp->history_pos = scp->history =
|
||||
(u_short *)malloc(scp->history_size*sizeof(u_short),
|
||||
M_DEVBUF, M_WAITOK);
|
||||
bzero(scp->history_head, scp->history_size*sizeof(u_short));
|
||||
}
|
||||
scp->history_size = max(scp->ysize, *(int *)data)*scp->xsize;
|
||||
scp->history_head = scp->history_pos = scp->history =
|
||||
(u_short *)malloc(scp->history_size*sizeof(u_short),
|
||||
M_DEVBUF, M_WAITOK);
|
||||
bzero(scp->history_head, scp->history_size*sizeof(u_short));
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@ -1183,6 +1178,13 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|||
free(cut_buffer, M_DEVBUF);
|
||||
cut_buffer = (char *)malloc(scp->xsize*scp->ysize, M_DEVBUF, M_NOWAIT);
|
||||
cut_buffer[0] = 0x00;
|
||||
if (scp->history != NULL)
|
||||
free(scp->history, M_DEVBUF);
|
||||
scp->history_size = max(HISTORY_SIZE, scp->xsize*scp->ysize);
|
||||
scp->history_head = scp->history_pos = scp->history = (u_short *)
|
||||
malloc(scp->history_size*sizeof(u_short), M_DEVBUF, M_NOWAIT);
|
||||
if (scp->history != NULL)
|
||||
bzero(scp->history, scp->history_size*sizeof(u_short));
|
||||
if (scp == cur_console)
|
||||
set_mode(scp);
|
||||
scp->status &= ~UNKNOWN_MODE;
|
||||
|
@ -2812,7 +2814,7 @@ init_scp(scr_stat *scp)
|
|||
scp->proc = NULL;
|
||||
scp->smode.mode = VT_AUTO;
|
||||
scp->history_head = scp->history_pos = scp->history = NULL;
|
||||
scp->history_size = HISTORY_SIZE;
|
||||
scp->history_size = max(HISTORY_SIZE, scp->xsize*scp->ysize);
|
||||
}
|
||||
|
||||
static u_char
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.h,v 1.31 1997/07/15 14:43:27 yokota Exp $
|
||||
* $Id: syscons.h,v 1.32 1997/08/25 23:21:55 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_ISA_SYSCONS_H_
|
||||
|
@ -101,7 +101,10 @@
|
|||
#define FONT_8 2
|
||||
#define FONT_14 4
|
||||
#define FONT_16 8
|
||||
#define HISTORY_SIZE (COL * ROW * 4)
|
||||
#if !defined(SC_HISTORY_SIZE)
|
||||
#define SC_HISTORY_SIZE (ROW * 4)
|
||||
#endif /* SC_HISTORY_SIZE */
|
||||
#define HISTORY_SIZE (COL * (SC_HISTORY_SIZE))
|
||||
|
||||
/* defines related to hardware addresses */
|
||||
#define MONO_BASE 0x3B4 /* crt controller base mono */
|
||||
|
|
Loading…
Reference in a new issue