Let HAL handle its own mapping of the video frame buffer

svn path=/trunk/; revision=11917
This commit is contained in:
Gé van Geldorp 2004-12-04 17:22:47 +00:00
parent 0291044900
commit 529f4da133
6 changed files with 61 additions and 16 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: display.c,v 1.1 2004/12/03 20:10:43 gvg Exp $
/* $Id: display.c,v 1.2 2004/12/04 17:22:46 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -126,6 +126,10 @@
#define SCREEN_SYNCHRONIZATION
#define VGA_GRAPH_MEM 0xa0000
#define VGA_CHAR_MEM 0xb8000
#define VGA_END_MEM 0xbffff
#define VGA_AC_INDEX 0x3c0
#define VGA_AC_READ 0x3c1
#define VGA_AC_WRITE 0x3c0
@ -577,8 +581,8 @@ HalInitializeDisplay (PLOADER_PARAMETER_BLOCK LoaderBlock)
ULONG ScanLines;
ULONG Data;
VideoBuffer = (PUSHORT)(0xff3b8000);
GraphVideoBuffer = (PUCHAR)(0xff3a0000);
GraphVideoBuffer = (PUCHAR) HalpMapPhysMemory(VGA_GRAPH_MEM, VGA_END_MEM - VGA_GRAPH_MEM + 1);
VideoBuffer = (PUSHORT) (GraphVideoBuffer + (VGA_CHAR_MEM - VGA_GRAPH_MEM));
/* Set cursor position */
// CursorX = LoaderBlock->cursorx;

View file

@ -0,0 +1,42 @@
/* $Id: mem.c,v 1.1 2004/12/04 17:22:46 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: hal/halx86/generic/mem.c
* PURPOSE: Memory mapping functions
* PROGRAMMER: Ge van Geldorp (gvg@reactos.com)
* UPDATE HISTORY:
* Created 2004/12/03
*/
#include <ddk/ntddk.h>
#define PAGETABLE_MAP (0xf0000000)
#define ADDR_TO_PTE(v) (PULONG)(PAGETABLE_MAP + ((((ULONG)(v) / 1024))&(~0x3)))
#define VIRT_ADDR 0xff400000
PVOID
HalpMapPhysMemory(ULONG PhysAddr, ULONG Size)
{
PULONG PageTable;
unsigned i;
PageTable = (PULONG)PAGE_ROUND_DOWN((PVOID)ADDR_TO_PTE(VIRT_ADDR));
for (i = 0; i < PAGE_ROUND_UP(Size) / PAGE_SIZE; i++)
{
PageTable[i] = (PhysAddr | 0x3);
PhysAddr += PAGE_SIZE;
}
/* Flush TLB */
__asm__ __volatile__(
"movl %%cr3,%%eax\n\t"
"movl %%eax,%%cr3\n\t"
: : : "eax" );
return (PVOID) VIRT_ADDR;
}
/* EOF */

View file

@ -33,6 +33,9 @@ VOID HalpStartEnumerator (VOID);
/* dma.c */
VOID HalpInitDma (VOID);
/* mem.c */
PVOID HalpMapPhysMemory(ULONG PhysAddr, ULONG Size);
/* Non-generic initialization */
VOID HalpInitPhase0 (VOID);

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.1 2004/12/03 20:10:44 gvg Exp $
# $Id: Makefile,v 1.2 2004/12/04 17:22:47 gvg Exp $
PATH_TO_TOP = ../../..
@ -48,6 +48,7 @@ GENERIC_OBJECTS = \
isa.o \
kdbg.o \
mca.o \
mem.o \
misc.o \
pci.o \
portio.o \

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.1 2004/12/03 20:10:45 gvg Exp $
# $Id: Makefile,v 1.2 2004/12/04 17:22:47 gvg Exp $
PATH_TO_TOP = ../../..
@ -52,6 +52,7 @@ GENERIC_OBJECTS = \
isa.o \
kdbg.o \
mca.o \
mem.o \
misc.o \
pci.o \
portio.o \

View file

@ -119,6 +119,7 @@ _multiboot_entry:
movl $(V2P(apic_pagetable) + 0x3), 0xFEC(%esi)
#endif /* MP */
movl $(V2P(kpcr_pagetable) + 0x3), 0xFF0(%esi)
movl $(V2P(hal_pagetable) + 0x3), 0xFF4(%esi)
/*
* Initialize the page table that maps low memory
@ -174,17 +175,6 @@ _multiboot_entry:
movl $0x1003, %eax
movl %eax, (%esi, %edi)
/*
* Initialize a part of the same pagetable to map the vga frame buffer (at FF3A0000).
*/
movl $0xa0003, %eax
movl $0x20, %ecx
movl $0xE80, %edi
.l9:
movl %eax, (%esi, %edi)
add $4, %edi
add $0x1000, %eax
loop .l9
#ifdef MP
@ -373,6 +363,10 @@ apic_pagetable:
kpcr_pagetable:
.fill 4096, 1, 0
/* Reserve a pagetable for HAL to play around with during early boot */
hal_pagetable:
.fill 4096, 1, 0
_pagetable_end:
_unmap_me:
.fill 4096, 1, 0