示例#1
0
//----------------------------------------------------------------
//  QuerySetPointersToOffsets()
//
//----------------------------------------------------------------
void QuerySetPointersToOffsets( WSAQUERYSETW *pqs )
    {
    if (pqs->lpszServiceInstanceName)
       {
       pqs->lpszServiceInstanceName = TO_OFFSET(pqs->lpszServiceInstanceName,pqs,LPWSTR);
       }

    if (pqs->lpServiceClassId)
       {
       pqs->lpServiceClassId = TO_OFFSET(pqs->lpServiceClassId,pqs,LPGUID);
       }

    if (pqs->lpVersion)
       {
       pqs->lpVersion = TO_OFFSET(pqs->lpVersion,pqs,LPWSAVERSION);
       }

    if (pqs->lpszComment)
       {
       pqs->lpszComment = TO_OFFSET(pqs->lpszComment,pqs,LPWSTR);
       }

    if (pqs->lpNSProviderId)
       {
       pqs->lpNSProviderId = TO_OFFSET(pqs->lpNSProviderId,pqs,LPGUID);
       }

    if (pqs->lpszContext)
       {
       pqs->lpszContext = TO_OFFSET(pqs->lpszContext,pqs,LPWSTR);
       }

    if (pqs->lpafpProtocols)
       {
       pqs->lpafpProtocols = TO_OFFSET(pqs->lpafpProtocols,pqs,LPAFPROTOCOLS);
       }

    if (pqs->lpszQueryString)
       {
       pqs->lpszQueryString = TO_OFFSET(pqs->lpszQueryString,pqs,LPWSTR);
       }

    if (pqs->lpcsaBuffer)
       {
       pqs->lpcsaBuffer = TO_OFFSET(pqs->lpcsaBuffer,pqs,LPCSADDR_INFO);
       }

    if (pqs->lpBlob)
       {
       pqs->lpBlob->pBlobData = TO_OFFSET(pqs->lpBlob->pBlobData,pqs,BYTE*);
       pqs->lpBlob = TO_OFFSET(pqs->lpBlob,pqs,LPBLOB);
       }
示例#2
0
int main(int argc, char* argv[])
{
	try
	{
		//Parameters
		if(argc!=3 && argc!=4)
		{
			std::cout<<"XFS <path> <disk> [<disk size>]"<<std::endl;
			return 0;
		}

		std::string windows_path=argv[1];
		std::string xfs_disk=argv[2];
		u32 xfs_disk_size=(argc==4?ToNumber(argv[3]):FLOPPY_SIZE);

		//Instanciamos el disco
		Disk* disk=Disk::GetDisk(xfs_disk, xfs_disk_size);
		
		//Variables del disco
		OFFSET xft_entry=TO_OFFSET(XFT_LBA);
		LBA writing_sector=XFT_LBA+XFT_SECTORS;

		//Escribimos el sector de arranque
		MappedFile boot_file(windows_path + "\\BOOT\\" BOOT_NAME);
		disk->Write(0, boot_file.GetBasePointer(), SECTOR_SIZE);

		//Escribimos el loader 
		//MappedFile loader_file(windows_path + "\\BOOT\\" LOADER_NAME);
		writing_sector+=XFS_FileWriter::Write(disk, windows_path + "\\BOOT", LOADER_NAME, xft_entry, writing_sector);
		xft_entry+=XFS_ENTRY_SIZE;

		//Escribimos el kernel
		writing_sector+=XFS_DirectoryWriter::Write(disk, windows_path, "KRNL", true, xft_entry, writing_sector, XFT_LBA);
		xft_entry+=XFS_ENTRY_SIZE;
		
		//Escribimos XFS
		writing_sector+=XFS_DirectoryWriter::Write(disk, windows_path, "XFS", false, xft_entry, writing_sector, XFT_LBA);
		xft_entry+=XFS_ENTRY_SIZE;

		delete disk;
	}
	catch(char* error)
	{
		std::cout<<error<<std::endl;
	}
	catch(std::string error)
	{
		std::cout<<error.c_str()<<std::endl;
	}
	catch(...)
	{
		std::cout<<"Unexpected error!"<<std::endl;
	}
	return 0;
}
示例#3
0
文件: hp3000_mem.c 项目: agn453/simh
t_bool mem_write (DEVICE *dptr, ACCESS_CLASS classification, uint32 offset, HP_WORD value)
{
uint32 bank, address;

if (mem_access [classification].bank_ptr == NULL) {     /* if this is an absolute or DMA access */
    address = offset;                                   /*   then "offset" is already a physical address */
    bank = TO_BANK (offset);                            /* separate the bank and offset */
    offset = TO_OFFSET (offset);                        /*   in case tracing is active */
    }

else {                                                  /* otherwise the bank register is implied */
    bank = *mem_access [classification].bank_ptr;       /*    by the access classification */
    address = bank << LA_WIDTH | offset;                /* form the physical address with the supplied offset */
    }

if (address >= MEMSIZE) {                               /* if this access is beyond the memory size */
    if (dptr == &cpu_dev)                               /*   then if an interrupt is requested */
        CPX1 |= cpx1_ILLADDR;                           /*     then set the Illegal Address interrupt */

    return FALSE;                                       /* indicate failure to the caller */
    }

else {                                                  /* otherwise the access is within the memory range */
    switch (classification) {                           /*   so dispatch on the access classification */

        case dma:
        case absolute:
        case data:
            M [address] = (MEMORY_WORD) value;          /* write the value to memory */
            break;


        case absolute_mapped:
        case data_mapped:
        case stack:
            if (offset > SM && offset <= SM + SR && bank == SBANK)  /* if the offset is within the TOS */
                TR [SM + SR - offset] = value;                      /*   then write the value to a TOS register */
            else                                                    /* otherwise */
                M [address] = (MEMORY_WORD) value;                  /*   write the value to memory */
            break;


        case data_mapped_checked:
        case stack_checked:
            if (offset > SM && offset <= SM + SR && bank == SBANK)  /* if the offset is within the TOS */
                TR [SM + SR - offset] = value;                      /*   then write the value to a TOS register */

        /* fall into checked cases */

        case data_checked:
            if (DL <= offset && offset <= SM + SR || PRIV)          /* if the offset is within bounds or is privileged */
                M [address] = (MEMORY_WORD) value;                  /*   then write the value to memory */
            else                                                    /* otherwise */
                MICRO_ABORT (trap_Bounds_Violation);                /*   trap for a bounds violation */
            break;


        case fetch:
        case fetch_checked:
        case program:
        case program_checked:                           /* these classes cannot be used for writing */
            CPX1 |= cpx1_ADDRPAR;                       /*   so set an Address Parity Error interrupt */
            return FALSE;                               /*     and indicate failure to the caller */

        }                                               /* all cases are handled */

    dpprintf (dptr, mem_access [classification].debug_flag,
              BOV_FORMAT "  %s write\n", bank, offset, value,
              mem_access [classification].name);

    return TRUE;                                        /* indicate success with the value written */
    }
}
示例#4
0
文件: hp3000_mem.c 项目: agn453/simh
t_bool mem_read (DEVICE *dptr, ACCESS_CLASS classification, uint32 offset, HP_WORD *value)
{
uint32 bank, address;

if (mem_access [classification].bank_ptr == NULL) {     /* if this is an absolute or DMA access */
    address = offset;                                   /*   then the "offset" is already a physical address */
    bank = TO_BANK (offset);                            /* separate the bank and offset */
    offset = TO_OFFSET (offset);                        /*   in case tracing is active */
    }

else {                                                  /* otherwise the bank register is implied */
    bank = *mem_access [classification].bank_ptr;       /*   by the access classification */
    address = bank << LA_WIDTH | offset;                /* form the physical address with the supplied offset */
    }

if (address >= MEMSIZE) {                               /* if this access is beyond the memory size */
    if (dptr == &cpu_dev)                               /*   then if an interrupt is requested */
        CPX1 |= cpx1_ILLADDR;                           /*     then set the Illegal Address interrupt */

    *value = 0;                                         /* return a zero value */
    return FALSE;                                       /*   and indicate failure to the caller */
    }

else {                                                  /* otherwise the access is within the memory range */
    switch (classification) {                           /*   so dispatch on the access classification */

        case dma:
        case absolute:
        case fetch:
        case program:
        case data:
            *value = (HP_WORD) M [address];             /* unchecked access values come from memory */
            break;


        case absolute_mapped:
        case data_mapped:
        case stack:
            if (offset > SM && offset <= SM + SR && bank == SBANK)  /* if the offset is within the TOS */
                *value = TR [SM + SR - offset];                     /*   then the value comes from a TOS register */
            else                                                    /* otherwise */
                *value = (HP_WORD) M [address];                     /*   the value comes from memory */
            break;


        case fetch_checked:
            if (PB <= offset && offset <= PL)           /* if the offset is within the program segment bounds */
                *value = (HP_WORD) M [address];         /*   then the value comes from memory */
            else                                        /* otherwise */
                MICRO_ABORT (trap_Bounds_Violation);    /*   trap for a bounds violation */
            break;


        case program_checked:
            if (PB <= offset && offset <= PL || PRIV)   /* if the offset is within bounds or is privileged */
                *value = (HP_WORD) M [address];         /*   then the value comes from memory */
            else                                        /* otherwise */
                MICRO_ABORT (trap_Bounds_Violation);    /*   trap for a bounds violation */
            break;


        case data_checked:
            if (DL <= offset && offset <= SM + SR || PRIV)  /* if the offset is within bounds or is privileged */
                *value = (HP_WORD) M [address];             /*   then the value comes from memory */
            else                                            /* otherwise */
                MICRO_ABORT (trap_Bounds_Violation);        /*   trap for a bounds violation */
            break;


        case data_mapped_checked:
        case stack_checked:
            if (offset > SM && offset <= SM + SR && bank == SBANK)  /* if the offset is within the TOS */
                *value = TR [SM + SR - offset];                     /*   then the value comes from a TOS register */
            else if (DL <= offset && offset <= SM + SR || PRIV)     /* if the offset is within bounds or is privileged */
                *value = (HP_WORD) M [address];                     /*   then the value comes from memory */
            else                                                    /* otherwise */
                MICRO_ABORT (trap_Bounds_Violation);                /*   trap for a bounds violation */
            break;
        }                                               /* all cases are handled */

    dpprintf (dptr, mem_access [classification].debug_flag,
              BOV_FORMAT "  %s%s\n", bank, offset, *value,
              mem_access [classification].name,
              mem_access [classification].debug_flag == DEB_MDATA ? " read" : "");

    return TRUE;                                        /* indicate success with the returned value stored */
    }
}