summaryrefslogtreecommitdiffstats
path: root/sys/isa
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>1997-09-04 23:01:06 +0000
committeryokota <yokota@FreeBSD.org>1997-09-04 23:01:06 +0000
commitec0b9f839dbbd355210672792d5b803856b38c75 (patch)
treeca8d2d6f2fac3265b5b0372df1b03bd0644b2173 /sys/isa
parent930fa4a4383c1260c42a0b5ae7981c9b1471552d (diff)
downloadFreeBSD-src-ec0b9f839dbbd355210672792d5b803856b38c75.zip
FreeBSD-src-ec0b9f839dbbd355210672792d5b803856b38c75.tar.gz
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
Diffstat (limited to 'sys/isa')
-rw-r--r--sys/isa/syscons.c26
-rw-r--r--sys/isa/syscons.h7
2 files changed, 19 insertions, 14 deletions
diff --git a/sys/isa/syscons.c b/sys/isa/syscons.c
index 1dc6542..25bf831 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 38c5ae4..578a71e 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 */
OpenPOWER on IntegriCloud