Import backup from 2004-02-13

This commit is contained in:
Josh Holtrop 2004-02-13 22:00:00 -05:00
parent 2cd08dee70
commit 48f4046e79
4 changed files with 32 additions and 7 deletions

View File

@ -137,6 +137,27 @@ _memcpy:
pop ebp
ret
;copies memory of n dwords (n*4 bytes) from src to destination
;extern void memcpyd(dword dest, dword src, dword n);
[global _memcpyd]
_memcpyd:
push ebp
mov ebp, esp
push esi
push edi
push ecx
mov edi, [ebp+8]
mov esi, [ebp+12]
mov ecx, [ebp+16]
rep movsd
pop ecx
pop edi
pop esi
pop ebp
ret
;returns the number of characters in a string
;extern dword strlen(char *str);
[global _strlen]

View File

@ -46,6 +46,10 @@ typedef struct {
} __attribute__((packed)) qword;
//these defines are the memory locations of values saved by the stage 2 bootloader
#define BOOT_MEMMAP_ENTRIES 0xC009040A
#define BOOT_FIRST_MEMMAP 0xC0092000
#define BOOT_VIDEO_MODE 0xC0090002
#define BOOT_VIDEO_MODE_INFO_BLOCK 0xC0090306

8
mm.c
View File

@ -3,19 +3,19 @@
// Created: 09/01/03
// Modified: 12/28/03
//The total amount of physical memory available (bytes)
//The total amount of physical memory available (bytes, 1 bit per page)
#define BITMAP_SIZE 0x20000
dword mm_totalmem = 0;
dword mm_megabytes;
byte page_bitmap[BITMAP_SIZE]; //used to store a bit for each page that is used, 0 if available
byte page_bitmap[BITMAP_SIZE]; //used to store a bit for each page that is used, 0 if available
//0x20000*(8 bits/byte)=0x100000 pages in 4gb total
//This function initializes the memory manager's linked list, filling it with the
// memory areas returned by bios interrupt 0x8E20
void mm_init()
{
dword memmap_entries = *(dword *)0xC009040A;
memmap_entry *maps = (memmap_entry *) 0xC0092000;
dword memmap_entries = *(dword *)BOOT_MEMMAP_ENTRIES;
memmap_entry *maps = (memmap_entry *) BOOT_FIRST_MEMMAP;
dword a;
for (a = 0; a < BITMAP_SIZE; a++)
{

View File

@ -6,12 +6,12 @@
//Initialized the video mode information block video_mode and allocated double-buffer memory for graphics display
void video_init()
{
videoMode = *(word *)0xC0090002;
videoMode = *(word *)BOOT_VIDEO_MODE;
if (!videoMode) //we are in console mode
return;
video_mode = *(ModeInfoBlock *) 0xC0090306;
video_mode = *(ModeInfoBlock *) BOOT_VIDEO_MODE_INFO_BLOCK;
switch(video_mode.BitsPerPixel)
{