1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-30 00:00:15 +01:00

remove obsolete VGA support

This commit is contained in:
Stefan Lankes 2017-03-04 10:52:18 +01:00
parent 1130232b58
commit 815937216f
13 changed files with 5 additions and 613 deletions

View file

@ -1,61 +0,0 @@
/*
* Copyright (c) 2010, Stefan Lankes, RWTH Aachen University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __VGA_H__
#define __VGA_H__
#include <hermit/stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/** @brief Initialize VGA output and clear the screen */
void vga_init(void);
/** @brief Simple string output on screen.
*
* If you want a new line you will have to "\\n".
*
* @return Length of output in bytes
*/
int vga_puts(const char *text);
/** @brief Simple character output on screen.
*
* @return The original input character casted to int
*/
int vga_putchar(unsigned char c);
/** @brief Clear the screen */
void vga_cls(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,4 +1,4 @@
C_source := irq.c idt.c isrs.c gdt.c processor.c timer.c tasks.c apic.c pci.c vga.c uart.c syscall.c
C_source := irq.c idt.c isrs.c gdt.c processor.c timer.c tasks.c apic.c pci.c uart.c syscall.c
ASM_source := entry.asm string.asm
MODULE := arch_x86_kernel

View file

@ -174,16 +174,6 @@ start64:
add rax, [base]
mov QWORD [rdi+511*8], rax
%ifdef CONFIG_VGA
; map vga 1:1
mov rax, VIDEO_MEM_ADDR ; map vga
and rax, ~0xFFF ; page align lower half
mov rdi, rax
shr rdi, 9 ; (edi >> 12) * 8 (index for boot_pgt)
add rdi, boot_pgt
or rax, 0x113 ; set present, global, writable and cache disable bits
mov QWORD [rdi], rax
%endif
; map multiboot info
mov rax, QWORD [mb_info]
and rax, ~0xFFF ; page align lower half

View file

@ -41,8 +41,6 @@
#include <asm/pci.h>
#endif
#ifndef CONFIG_VGA
/*
* This implementation based on following tutorial:
* http://en.wikibooks.org/wiki/Serial_Programming/8250_UART_Programming
@ -330,5 +328,3 @@ Lsuccess:
return uart_config();
#endif
}
#endif

View file

@ -1,240 +0,0 @@
/*
* Copyright (c) 2010, Stefan Lankes, RWTH Aachen University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <hermit/string.h>
#include <asm/io.h>
#include <asm/vga.h>
#ifdef CONFIG_VGA
/*
* These define our textpointer, our background and foreground
* colors (attributes), and x and y cursor coordinates
*/
static unsigned short *textmemptr;
static int attrib = 0x0F;
static int csr_x = 0, csr_y = 0;
inline static unsigned short *memsetw(unsigned short *dest, unsigned short val, size_t count)
{
size_t i;
if (BUILTIN_EXPECT(!dest, 0))
return dest;
for (i = 0; i < count; i++)
dest[i] = val;
return dest;
}
/* Scrolls the screen */
static void scroll(void)
{
unsigned blank, temp;
/*
* A blank is defined as a space... we need to give it
* backcolor too
*/
blank = 0x20 | (attrib << 8);
/* Row 25 is the end, this means we need to scroll up */
if (csr_y >= 25) {
/*
* Move the current text chunk that makes up the screen
*
* back in the buffer by one line
*/
temp = csr_y - 25 + 1;
memcpy(textmemptr, textmemptr + temp * 80,
(25 - temp) * 80 * 2);
/*
* Finally, we set the chunk of memory that occupies
* the last line of text to our 'blank' character
*/
memsetw(textmemptr + (25 - temp) * 80, blank, 80);
csr_y = 25 - 1;
}
}
/*
* Updates the hardware cursor: the little blinking line
* on the screen under the last character pressed!
*/
static void move_csr(void)
{
unsigned temp;
/*
* The equation for finding the index in a linear
* chunk of memory can be represented by:
* Index = [(y * width) + x] */
temp = csr_y * 80 + csr_x;
/*
* This sends a command to indicies 14 and 15 in the
* CRT Control Register of the VGA controller. These
* are the high and low bytes of the index that show
* where the hardware cursor is to be 'blinking'. To
* learn more, you should look up some VGA specific
* programming documents. A great start to graphics:
* http://www.brackeen.com/home/vga
*/
outportb(0x3D4, 14);
outportb(0x3D5, temp >> 8);
outportb(0x3D4, 15);
outportb(0x3D5, temp);
}
/* Clears the screen */
void vga_clear(void)
{
unsigned blank;
int i;
/*
* Again, we need the 'short' that will be used to
* represent a space with color
*/
blank = 0x20 | (attrib << 8);
/*
* Fills the entire screen with spaces in our current
* color
**/
for (i = 0; i < 25; i++)
memsetw(textmemptr + i * 80, blank, 80);
/*
* Update out virtual cursor, and then move the
* hardware cursor
*/
csr_x = 0;
csr_y = 0;
move_csr();
}
/* Puts a single character on the screen */
int vga_putchar(unsigned char c)
{
unsigned short *where;
unsigned att = attrib << 8;
/* Handle a backspace by moving the cursor back one space */
if (c == 0x08) {
if (csr_x != 0)
csr_x--;
}
/*
* Handles a tab by incrementing the cursor's x, but only
* to a point that will make it divisible by 8
*/
else if (c == 0x09) {
csr_x = (csr_x + 8) & ~(8 - 1);
}
/*
* Handles a 'Carriage Return', which simply brings the
* cursor back to the margin
*/
else if (c == '\r') {
csr_x = 0;
}
/*
* We handle our newlines the way DOS and BIOS do: we
* treat it as if a 'CR' was there also, so we bring the
* cursor to the margin and increment the 'y' value
*/
else if (c == '\n') {
csr_x = 0;
csr_y++;
}
/*
* Any character greater than and including the space is a
* printable character. The equation for finding the index
* in a linear chunk of memory can be represented by:
* Index = [(y * width) + x]
*/
else if (c >= ' ') {
where = textmemptr + (csr_y * 80 + csr_x);
*where = c | att; /* Character AND attributes: color */
csr_x++;
}
/*
* If the cursor has reached the edge of the screen's width, we
* insert a new line in there
*/
if (csr_x >= 80) {
csr_x = 0;
csr_y++;
}
/* Scroll the screen if needed, and finally move the cursor */
scroll();
move_csr();
return (int) c;
}
/* Uses the routine above to output a string... */
int vga_puts(const char *text)
{
size_t i;
for (i = 0; i < strlen(text); i++)
vga_putchar(text[i]);
return i-1;
}
/* Sets the forecolor and backcolor we will use */
//void settextcolor(unsigned char forecolor, unsigned char backcolor)
//{
/*
* Top 4 bytes are the background, bottom 4 bytes
* are the foreground color
*/
// attrib = (backcolor << 4) | (forecolor & 0x0F);
//}
/* Sets our text-mode VGA pointer, then clears the screen for us */
void vga_init(void)
{
textmemptr = (unsigned short *)VIDEO_MEM_ADDR;
// our bootloader already cleared the screen
vga_clear();
}
#endif

View file

@ -14,7 +14,7 @@ OUTPUT_FORMAT = -O elf32-i386
NAME = ldhermit
TTY := $(shell tty)
C_source := main.c printf.c string.c stdio.c vga.c uart.c page.c
C_source := main.c printf.c string.c stdio.c uart.c page.c
ASM_source := entry.asm
OBJS := $(C_source:.c=.o)

View file

@ -27,27 +27,18 @@
#include <string.h>
#include <multiboot.h>
#include <vga.h>
#include <uart.h>
int koutput_init(void)
{
#ifdef CONFIG_VGA
vga_init();
#else
uart_early_init((char*) mb_info->cmdline);
#endif
return 0;
}
int kputchar(int c)
{
#ifdef CONFIG_VGA
vga_putchar(c);
#else
uart_putchar(c);
#endif
return 1;
}

View file

@ -1,241 +0,0 @@
/*
* Copyright (c) 2010, Stefan Lankes, RWTH Aachen University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <string.h>
#include <io.h>
#include <vga.h>
#ifdef CONFIG_UART
#define VIDEO_MEM_ADDR 0xB8000 /* the video memory address */
/*
* These define our textpointer, our background and foreground
* colors (attributes), and x and y cursor coordinates
*/
static unsigned short *textmemptr;
static int attrib = 0x0F;
static int csr_x = 0, csr_y = 0;
inline static unsigned short *memsetw(unsigned short *dest, unsigned short val, size_t count)
{
size_t i;
if (BUILTIN_EXPECT(!dest, 0))
return dest;
for (i = 0; i < count; i++)
dest[i] = val;
return dest;
}
/* Scrolls the screen */
static void scroll(void)
{
unsigned blank, temp;
/*
* A blank is defined as a space... we need to give it
* backcolor too
*/
blank = 0x20 | (attrib << 8);
/* Row 25 is the end, this means we need to scroll up */
if (csr_y >= 25) {
/*
* Move the current text chunk that makes up the screen
*
* back in the buffer by one line
*/
temp = csr_y - 25 + 1;
memcpy(textmemptr, textmemptr + temp * 80,
(25 - temp) * 80 * 2);
/*
* Finally, we set the chunk of memory that occupies
* the last line of text to our 'blank' character
*/
memsetw(textmemptr + (25 - temp) * 80, blank, 80);
csr_y = 25 - 1;
}
}
/*
* Updates the hardware cursor: the little blinking line
* on the screen under the last character pressed!
*/
static void move_csr(void)
{
unsigned temp;
/*
* The equation for finding the index in a linear
* chunk of memory can be represented by:
* Index = [(y * width) + x] */
temp = csr_y * 80 + csr_x;
/*
* This sends a command to indicies 14 and 15 in the
* CRT Control Register of the VGA controller. These
* are the high and low bytes of the index that show
* where the hardware cursor is to be 'blinking'. To
* learn more, you should look up some VGA specific
* programming documents. A great start to graphics:
* http://www.brackeen.com/home/vga
*/
outportb(0x3D4, 14);
outportb(0x3D5, temp >> 8);
outportb(0x3D4, 15);
outportb(0x3D5, temp);
}
/* Clears the screen */
void vga_clear(void)
{
unsigned blank;
int i;
/*
* Again, we need the 'short' that will be used to
* represent a space with color
*/
blank = 0x20 | (attrib << 8);
/*
* Fills the entire screen with spaces in our current
* color
**/
for (i = 0; i < 25; i++)
memsetw(textmemptr + i * 80, blank, 80);
/*
* Update out virtual cursor, and then move the
* hardware cursor
*/
csr_x = 0;
csr_y = 0;
move_csr();
}
/* Puts a single character on the screen */
int vga_putchar(unsigned char c)
{
unsigned short *where;
unsigned att = attrib << 8;
/* Handle a backspace by moving the cursor back one space */
if (c == 0x08) {
if (csr_x != 0)
csr_x--;
}
/*
* Handles a tab by incrementing the cursor's x, but only
* to a point that will make it divisible by 8
*/
else if (c == 0x09) {
csr_x = (csr_x + 8) & ~(8 - 1);
}
/*
* Handles a 'Carriage Return', which simply brings the
* cursor back to the margin
*/
else if (c == '\r') {
csr_x = 0;
}
/*
* We handle our newlines the way DOS and BIOS do: we
* treat it as if a 'CR' was there also, so we bring the
* cursor to the margin and increment the 'y' value
*/
else if (c == '\n') {
csr_x = 0;
csr_y++;
}
/*
* Any character greater than and including the space is a
* printable character. The equation for finding the index
* in a linear chunk of memory can be represented by:
* Index = [(y * width) + x]
*/
else if (c >= ' ') {
where = textmemptr + (csr_y * 80 + csr_x);
*where = c | att; /* Character AND attributes: color */
csr_x++;
}
/*
* If the cursor has reached the edge of the screen's width, we
* insert a new line in there
*/
if (csr_x >= 80) {
csr_x = 0;
csr_y++;
}
/* Scroll the screen if needed, and finally move the cursor */
scroll();
move_csr();
return (int) c;
}
/* Uses the routine above to output a string... */
int vga_puts(const char *text)
{
size_t i;
for (i = 0; i < strlen(text); i++)
vga_putchar(text[i]);
return i-1;
}
/* Sets the forecolor and backcolor we will use */
//void settextcolor(unsigned char forecolor, unsigned char backcolor)
//{
/*
* Top 4 bytes are the background, bottom 4 bytes
* are the foreground color
*/
// attrib = (backcolor << 4) | (forecolor & 0x0F);
//}
/* Sets our text-mode VGA pointer, then clears the screen for us */
void vga_init(void)
{
textmemptr = (unsigned short *)VIDEO_MEM_ADDR;
vga_clear();
}
#endif

15
configure vendored
View file

@ -619,7 +619,6 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
@ -695,7 +694,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@ -948,15 +946,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@ -1094,7 +1083,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@ -1247,7 +1236,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@ -2756,7 +2744,6 @@ $as_echo "#define MAX_FNAME 128" >>confdefs.h
$as_echo "#define VIDEO_MEM_ADDR 0xB8000" >>confdefs.h
#AC_DEFINE(CONFIG_VGA, 1, Use the VGA interface as output device)
$as_echo "#define DYNAMIC_TICKS 1" >>confdefs.h

View file

@ -28,7 +28,6 @@ AC_DEFINE(HAVE_ARCH_STRNCPY, 1, Define to use machine specific version of strncp
AC_DEFINE(MAX_ISLE, 8, Define the maximum number of isles / numa nodes)
AC_DEFINE(MAX_FNAME, 128, Define the maximum length of a file name)
AC_DEFINE(VIDEO_MEM_ADDR, 0xB8000, Definition of the VGA address)
#AC_DEFINE(CONFIG_VGA, 1, Use the VGA interface as output device)
AC_DEFINE(DYNAMIC_TICKS, 1, Use a dynamic tick instead of a static)
#AC_DEFINE(SAVE_FPU, 1, Set task switched flag during a context switch);

View file

@ -132,10 +132,7 @@ static int hermit_init(void)
multitasking_init();
memory_init();
signal_init();
#ifndef CONFIG_VGA
uart_init();
#endif
return 0;
}

View file

@ -32,9 +32,6 @@
#include <hermit/spinlock.h>
#include <asm/atomic.h>
#include <asm/processor.h>
#ifdef CONFIG_VGA
#include <asm/vga.h>
#endif
#include <asm/uart.h>
static atomic_int32_t kmsg_counter = ATOMIC_INIT(-1);
@ -48,13 +45,7 @@ spinlock_irqsave_t stdio_lock = SPINLOCK_IRQSAVE_INIT;
int koutput_init(void)
{
if (is_single_kernel())
{
#ifdef CONFIG_VGA
vga_init();
#else
uart_early_init(NULL);
#endif
}
return 0;
}
@ -70,13 +61,8 @@ int kputchar(int c)
pos = atomic_int32_inc(&kmsg_counter);
kmessages[pos % KMSG_SIZE] = (unsigned char) c;
if (is_single_kernel()) {
#ifdef CONFIG_VGA
vga_putchar(c);
#else
if (is_single_kernel())
uart_putchar(c);
#endif
}
return 1;
}
@ -92,13 +78,8 @@ int kputs(const char *str)
kmessages[pos % KMSG_SIZE] = str[i];
}
if (is_single_kernel()) {
#ifdef CONFIG_VGA
vga_puts(str);
#else
if (is_single_kernel())
uart_puts(str);
#endif
}
spinlock_irqsave_unlock(&stdio_lock);

View file

@ -73,13 +73,6 @@ int vma_init(void)
if (BUILTIN_EXPECT(ret, 0))
goto out;
#ifdef CONFIG_VGA
// add VGA video memory
ret = vma_add(VIDEO_MEM_ADDR, VIDEO_MEM_ADDR + PAGE_SIZE, VMA_READ|VMA_WRITE);
if (BUILTIN_EXPECT(ret, 0))
goto out;
#endif
if (mb_info) {
ret = vma_add((size_t)mb_info & PAGE_MASK, ((size_t)mb_info & PAGE_MASK) + PAGE_SIZE, VMA_READ|VMA_WRITE);
if (BUILTIN_EXPECT(ret, 0))