I have 2 drivers that are giving me problems, VFS and FAT12 (it could be DLL hell but I doubt it, VFS calls FAT12 and FAT12 calls the FDC but it never goes backwards)
Anyway, the VFS driver is loaded at 0x40000 and the FAT12 driver is loaded at 0x50000. Any driver loaded before that works fine.
But it appears a call to any function lying beyond 0x42000 throws an exception (I'm assuming a #GPF, #PF or invalid operands, though there's no way to tell until I set up the exceptions in the kernel (and I'm in the bootloader right now))
So here's the code I have for my drivers.lib (allows my bootloader and kernel to call drivers) and the actual driver:
Code: Select all
/*************************************************************
** fat12.h - Bootloader (drivers.lib)
** ~FAT12 Driver
** Programmer: Zach
** Date: 7/30/09
**************************************************************/
#ifndef __FAT12_H
#define __FAT12_H
#define _fat12_base 0x50000
extern bool fat12_initialize();
#endif
/*************************************************************
** fat12.cpp - Bootloader (drivers.lib)
** ~FAT12 Driver
** Programmer: Zach
** Date: 7/30/09
**************************************************************/
#include <loaddll.h>
#include <drivers/fat12.h>
bool fat12_initialize(){
bool (_cdecl *fat12_init)() = (bool(__cdecl*)())GetProcAddress(_fat12_base, "fat12_initialize");
if(!fat12_init)
return false;
fat12_init();
return true;//fat12_load();
}
/*************************************************************
** main.cpp - Driver
** ~VFS Driver
** Programmer: Zach
** Date: 7/30/09
**************************************************************/
#include <hal.h>
#include <drivers/tvga.h>
#include <drivers/fdc.h>
#include "dll.h"
struct globals{
};
struct bpbStruct{
uint8_t padding[3];
uint8_t OEMName[8];
uint16_t BytesPerSector;
uint8_t SectorsPerCluster;
uint16_t ReservedSectors;
uint8_t NumberOfFATs;
uint16_t RootEntries;
uint16_t TotalSectors;
uint8_t Media;
uint16_t SectorsPerFATs;
uint16_t SectorsPerTrack;
uint16_t HeadsPerCylinder;
uint32_t HiddenSectors;
uint32_t TotalSectors32;
uint8_t DriveNumber;
uint8_t Reserved;
uint8_t BootSig;
uint32_t SerialNumber;
uint8_t VolumeLabel[11];
uint8_t FileSystem[8];
};
globals global;
bpbStruct* bpb;
export bool fat12_initialize(){
hal_load();
tvga_load();
floppy_load();
bpb=(bpbStruct*)bpb;
return true;
}
So does anyone see any problems with that?
<drivername>_load() is NOT <drivername>_initialize(), the _load() defines function pointers but doesn't call any initialization functions unlike <drivername>_initialize().
So all I see is where it is in memory, so does anyone know of any issues with making calls to DLL's beyond 0x42000 or have any idea what's up?