mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 05:58:57 +00:00
boot2: need to expand tab output and mask getchar
The BIOS ouput char function does not expand tab. Mask getchar with 0xFF. Sponsored by: Netflix, Klara Inc.
This commit is contained in:
parent
e9de7669c3
commit
6469d2b422
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=362239
@ -53,12 +53,38 @@ xputc(int c)
|
||||
sio_putc(c);
|
||||
}
|
||||
|
||||
static void
|
||||
getcursor(int *row, int *col)
|
||||
{
|
||||
v86.ctl = V86_FLAGS;
|
||||
v86.addr = 0x10;
|
||||
v86.eax = 0x300;
|
||||
v86.ebx = 0x7;
|
||||
v86int();
|
||||
|
||||
if (row != NULL)
|
||||
*row = v86.edx >> 8;
|
||||
if (col != NULL)
|
||||
*col = v86.edx & 0xff;
|
||||
}
|
||||
|
||||
void
|
||||
putchar(int c)
|
||||
{
|
||||
int i, col;
|
||||
|
||||
if (c == '\n')
|
||||
switch (c) {
|
||||
case '\n':
|
||||
xputc('\r');
|
||||
break;
|
||||
case '\t':
|
||||
col = 0;
|
||||
getcursor(NULL, &col);
|
||||
col = 8 - (col % 8);
|
||||
for (i = 0; i < col; i++)
|
||||
xputc(' ');
|
||||
return;
|
||||
}
|
||||
xputc(c);
|
||||
}
|
||||
|
||||
@ -100,7 +126,7 @@ int
|
||||
getchar(void)
|
||||
{
|
||||
|
||||
return (xgetc(0));
|
||||
return (xgetc(0) & 0xff);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user