diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 1dc654203599..25bf83153510 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -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 diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h index 38c5ae4dfae8..578a71e0b222 100644 --- a/sys/dev/syscons/syscons.h +++ b/sys/dev/syscons/syscons.h @@ -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 */ diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c index 1dc654203599..25bf83153510 100644 --- a/sys/i386/isa/syscons.c +++ b/sys/i386/isa/syscons.c @@ -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 diff --git a/sys/i386/isa/syscons.h b/sys/i386/isa/syscons.h index 38c5ae4dfae8..578a71e0b222 100644 --- a/sys/i386/isa/syscons.h +++ b/sys/i386/isa/syscons.h @@ -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 */ diff --git a/sys/isa/syscons.c b/sys/isa/syscons.c index 1dc654203599..25bf83153510 100644 --- a/sys/isa/syscons.c +++ b/sys/isa/syscons.c @@ -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 diff --git a/sys/isa/syscons.h b/sys/isa/syscons.h index 38c5ae4dfae8..578a71e0b222 100644 --- a/sys/isa/syscons.h +++ b/sys/isa/syscons.h @@ -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 */