Ejemplo n.º 1
0
static dcache_entry_t *
read_cylinder (uint32 fd, uint32 offset, read_callback_funcp_t read_callback)
{
  uint32 nread;
  uint8 buf[SECTORS_PER_FLOPPY_CYLINDER * 512], *bufp;
  dcache_entry_t *retval;
  uint32 new_offset;
  
  new_offset = offset / sizeof buf * sizeof buf;
  nread = read_callback (fd, buf, new_offset, sizeof buf);
  if (nread != sizeof buf)
    retval = NULL;
  else
    {
      for (bufp = buf;
	   bufp + DCACHE_BLOCK_SIZE <= buf + sizeof buf;
	   bufp += DCACHE_BLOCK_SIZE, new_offset += DCACHE_BLOCK_SIZE)
	{
	  if (!dcache_entry_lookup (fd, new_offset))
	    {
	      uint32 n_written;

	      n_written = dcache_write (fd, bufp, new_offset,
					DCACHE_BLOCK_SIZE, NULL);
	      if (n_written != DCACHE_BLOCK_SIZE)
		warning_unexpected (NULL_STRING);
	    }
	}
      retval = dcache_entry_lookup (fd, offset);
    }
  return retval;
}
Ejemplo n.º 2
0
void dcache_write_b(int cpu, unsigned long addr,
                    int count)
{
    if(count == 1) {
        nb_dcache_write[cpu]++;
    }

    dcache_write(cpu, addr);
}
Ejemplo n.º 3
0
void dcache_write_w(int cpu, unsigned long addr,
                    int count)
{
    if(count == 1) {
        nb_dcache_write[cpu]++;
    }

    if (((addr & DCACHE_LINE_MASK) + 1) < DCACHE_LINE_SIZE) {
        dcache_write(cpu, addr);
    } else { /* Unaligned */
        dcache_write_b(cpu, addr + 0, 0);
        dcache_write_b(cpu, addr + 1, 0);
    }
}