Commit a541f297 authored by bellard's avatar bellard

PowerPC system emulation fixes (Jocelyn Mayer)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@722 c046a42c-6fe2-441c-8c8c-71466251a162
parent df475d18
......@@ -16,8 +16,12 @@ DYNGEN=../dyngen$(EXESUF)
QEMU_USER=qemu-$(TARGET_ARCH)
# system emulator name
ifdef CONFIG_SOFTMMU
ifeq ($(TARGET_ARCH), i386)
QEMU_SYSTEM=qemu$(EXESUF)
else
QEMU_SYSTEM=qemu-system-$(TARGET_ARCH)$(EXESUF)
endif
else
QEMU_SYSTEM=qemu-fast
endif
......@@ -222,14 +226,23 @@ ifeq ($(ARCH),alpha)
endif
# must use static linking to avoid leaving stuff in virtual address space
VL_OBJS=vl.o osdep.o block.o monitor.o \
ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o \
fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o
ifdef CONFIG_GDBSTUB
VL_OBJS+=gdbstub.o
VL_OBJS=vl.o osdep.o block.o monitor.o
ifeq ($(TARGET_ARCH), i386)
# Hardware support
VL_OBJS+= ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o
VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o
endif
ifeq ($(TARGET_ARCH), ppc)
VL_OBJS+= hw.o
# Generic PPC support
VL_OBJS+= ppc.o
# PREP hardware support
VL_OBJS+= ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o
VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o ppc_prep.o
#VL_OBJS+= hw.o of.o setup.o
endif
ifdef CONFIG_GDBSTUB
VL_OBJS+=gdbstub.o
endif
ifdef CONFIG_SDL
VL_OBJS+=sdl.o
......
......@@ -27,7 +27,7 @@ ar="ar"
make="make"
strip="strip"
cpu=`uname -m`
target_list="i386-user i386 i386-softmmu arm-user sparc-user ppc-user"
target_list="i386-user i386 i386-softmmu arm-user sparc-user ppc-user ppc-softmmu"
case "$cpu" in
i386|i486|i586|i686|i86pc|BePC)
cpu="i386"
......
......@@ -190,7 +190,7 @@ int cpu_exec(CPUState *env1)
(env->eflags & IF_MASK) &&
!(env->hflags & HF_INHIBIT_IRQ_MASK)) {
int intno;
intno = cpu_x86_get_pic_interrupt(env);
intno = cpu_get_pic_interrupt(env);
if (loglevel & CPU_LOG_TB_IN_ASM) {
fprintf(logfile, "Servicing hardware INT=0x%02x\n", intno);
}
......
......@@ -578,7 +578,13 @@ static inline target_ulong get_phys_addr_code(CPUState *env, target_ulong addr)
#endif
if (__builtin_expect(env->tlb_read[is_user][index].address !=
(addr & TARGET_PAGE_MASK), 0)) {
#if defined (TARGET_PPC)
env->access_type = ACCESS_CODE;
ldub_code((void *)addr);
env->access_type = ACCESS_INT;
#else
ldub_code((void *)addr);
#endif
}
return addr + env->tlb_read[is_user][index].addend - (unsigned long)phys_ram_base;
}
......
......@@ -914,7 +914,7 @@ static void tb_reset_jump_recursive(TranslationBlock *tb)
breakpoint is reached */
int cpu_breakpoint_insert(CPUState *env, uint32_t pc)
{
#if defined(TARGET_I386)
#if defined(TARGET_I386) || defined(TARGET_PPC)
int i;
for(i = 0; i < env->nb_breakpoints; i++) {
......@@ -935,7 +935,7 @@ int cpu_breakpoint_insert(CPUState *env, uint32_t pc)
/* remove a breakpoint */
int cpu_breakpoint_remove(CPUState *env, uint32_t pc)
{
#if defined(TARGET_I386)
#if defined(TARGET_I386) || defined(TARGET_PPC)
int i;
for(i = 0; i < env->nb_breakpoints; i++) {
if (env->breakpoints[i] == pc)
......@@ -957,7 +957,7 @@ int cpu_breakpoint_remove(CPUState *env, uint32_t pc)
CPU loop after each instruction */
void cpu_single_step(CPUState *env, int enabled)
{
#if defined(TARGET_I386)
#if defined(TARGET_I386) || defined(TARGET_PPC)
if (env->singlestep_enabled != enabled) {
env->singlestep_enabled = enabled;
/* must flush all the translated code to avoid inconsistancies */
......
......@@ -220,42 +220,49 @@ static void cpu_gdb_write_registers(CPUState *env, uint8_t *mem_buf, int size)
}
#elif defined (TARGET_PPC)
static void to_le32(uint8_t *p, int v)
static void to_le32(uint32_t *buf, uint32_t v)
{
uint8_t *p = (uint8_t *)buf;
p[3] = v;
p[2] = v >> 8;
p[1] = v >> 16;
p[0] = v >> 24;
}
static uint32_t from_le32 (uint32_t *buf)
{
uint8_t *p = (uint8_t *)buf;
return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
}
static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf)
{
uint32_t tmp;
uint32_t *registers = (uint32_t *)mem_buf, tmp;
int i;
/* fill in gprs */
for(i = 0; i < 8; i++) {
to_le32(mem_buf + i * 4, env->gpr[i]);
for(i = 0; i < 32; i++) {
to_le32(&registers[i], env->gpr[i]);
}
/* fill in fprs */
for (i = 0; i < 32; i++) {
to_le32(mem_buf + (i * 2) + 32, *((uint32_t *)&env->fpr[i]));
to_le32(mem_buf + (i * 2) + 33, *((uint32_t *)&env->fpr[i] + 1));
to_le32(&registers[(i * 2) + 32], *((uint32_t *)&env->fpr[i]));
to_le32(&registers[(i * 2) + 33], *((uint32_t *)&env->fpr[i] + 1));
}
/* nip, msr, ccr, lnk, ctr, xer, mq */
to_le32(mem_buf + 96, tswapl(env->nip));
to_le32(mem_buf + 97, tswapl(_load_msr()));
to_le32(mem_buf + 98, 0);
to_le32(&registers[96], (uint32_t)env->nip/* - 4*/);
to_le32(&registers[97], _load_msr(env));
tmp = 0;
for (i = 0; i < 8; i++)
tmp |= env->crf[i] << (32 - (i * 4));
to_le32(mem_buf + 98, tmp);
to_le32(mem_buf + 99, tswapl(env->lr));
to_le32(mem_buf + 100, tswapl(env->ctr));
to_le32(mem_buf + 101, tswapl(_load_xer()));
to_le32(mem_buf + 102, 0);
return 102;
tmp |= env->crf[i] << (32 - ((i + 1) * 4));
to_le32(&registers[98], tmp);
to_le32(&registers[99], env->lr);
to_le32(&registers[100], env->ctr);
to_le32(&registers[101], _load_xer(env));
to_le32(&registers[102], 0);
return 103 * 4;
}
static void cpu_gdb_write_registers(CPUState *env, uint8_t *mem_buf, int size)
......@@ -265,22 +272,22 @@ static void cpu_gdb_write_registers(CPUState *env, uint8_t *mem_buf, int size)
/* fill in gprs */
for (i = 0; i < 32; i++) {
env->gpr[i] = tswapl(registers[i]);
env->gpr[i] = from_le32(&registers[i]);
}
/* fill in fprs */
for (i = 0; i < 32; i++) {
*((uint32_t *)&env->fpr[i]) = tswapl(registers[(i * 2) + 32]);
*((uint32_t *)&env->fpr[i] + 1) = tswapl(registers[(i * 2) + 33]);
*((uint32_t *)&env->fpr[i]) = from_le32(&registers[(i * 2) + 32]);
*((uint32_t *)&env->fpr[i] + 1) = from_le32(&registers[(i * 2) + 33]);
}
/* nip, msr, ccr, lnk, ctr, xer, mq */
env->nip = tswapl(registers[96]);
_store_msr(tswapl(registers[97]));
registers[98] = tswapl(registers[98]);
env->nip = from_le32(&registers[96]);
_store_msr(env, from_le32(&registers[97]));
registers[98] = from_le32(&registers[98]);
for (i = 0; i < 8; i++)
env->crf[i] = (registers[98] >> (32 - (i * 4))) & 0xF;
env->lr = tswapl(registers[99]);
env->ctr = tswapl(registers[100]);
_store_xer(tswapl(registers[101]));
env->crf[i] = (registers[98] >> (32 - ((i + 1) * 4))) & 0xF;
env->lr = from_le32(&registers[99]);
env->ctr = from_le32(&registers[100]);
_store_xer(env, from_le32(&registers[101]));
}
#else
......
......@@ -83,7 +83,6 @@ typedef struct fdrive_t {
uint8_t dir; /* Direction */
uint8_t rw; /* Read/write */
/* Media */
fdisk_type_t disk; /* Disk type */
fdisk_flags_t flags;
uint8_t last_sect; /* Nb sector per track */
uint8_t max_track; /* Nb of tracks */
......@@ -102,7 +101,6 @@ static void fd_init (fdrive_t *drv, BlockDriverState *bs)
drv->drflags = 0;
drv->perpendicular = 0;
/* Disk */
drv->disk = FDRIVE_DISK_NONE;
drv->last_sect = 0;
drv->max_track = 0;
}
......@@ -171,26 +169,113 @@ static void fd_recalibrate (fdrive_t *drv)
drv->rw = 0;
}
/* Recognize floppy formats */
typedef struct fd_format_t {
fdrive_type_t drive;
fdisk_type_t disk;
uint8_t last_sect;
uint8_t max_track;
uint8_t max_head;
const unsigned char *str;
} fd_format_t;
static fd_format_t fd_formats[] = {
/* First entry is default format */
/* 1.44 MB 3"1/2 floppy disks */
{ FDRIVE_DRV_144, FDRIVE_DISK_144, 18, 80, 1, "1.44 MB 3\"1/2", },
{ FDRIVE_DRV_144, FDRIVE_DISK_144, 20, 80, 1, "1.6 MB 3\"1/2", },
{ FDRIVE_DRV_144, FDRIVE_DISK_144, 21, 80, 1, "1.68 MB 3\"1/2", },
{ FDRIVE_DRV_144, FDRIVE_DISK_144, 21, 82, 1, "1.72 MB 3\"1/2", },
{ FDRIVE_DRV_144, FDRIVE_DISK_144, 21, 83, 1, "1.74 MB 3\"1/2", },
{ FDRIVE_DRV_144, FDRIVE_DISK_144, 22, 80, 1, "1.76 MB 3\"1/2", },
{ FDRIVE_DRV_144, FDRIVE_DISK_144, 23, 80, 1, "1.84 MB 3\"1/2", },
{ FDRIVE_DRV_144, FDRIVE_DISK_144, 24, 80, 1, "1.92 MB 3\"1/2", },
/* 2.88 MB 3"1/2 floppy disks */
{ FDRIVE_DRV_288, FDRIVE_DISK_288, 36, 80, 1, "2.88 MB 3\"1/2", },
{ FDRIVE_DRV_288, FDRIVE_DISK_288, 39, 80, 1, "3.12 MB 3\"1/2", },
{ FDRIVE_DRV_288, FDRIVE_DISK_288, 40, 80, 1, "3.2 MB 3\"1/2", },
{ FDRIVE_DRV_288, FDRIVE_DISK_288, 44, 80, 1, "3.52 MB 3\"1/2", },
{ FDRIVE_DRV_288, FDRIVE_DISK_288, 48, 80, 1, "3.84 MB 3\"1/2", },
/* 720 kB 3"1/2 floppy disks */
{ FDRIVE_DRV_144, FDRIVE_DISK_720, 9, 80, 1, "720 kB 3\"1/2", },
{ FDRIVE_DRV_144, FDRIVE_DISK_720, 10, 80, 1, "800 kB 3\"1/2", },
{ FDRIVE_DRV_144, FDRIVE_DISK_720, 10, 82, 1, "820 kB 3\"1/2", },
{ FDRIVE_DRV_144, FDRIVE_DISK_720, 10, 83, 1, "830 kB 3\"1/2", },
{ FDRIVE_DRV_144, FDRIVE_DISK_720, 13, 80, 1, "1.04 MB 3\"1/2", },
{ FDRIVE_DRV_144, FDRIVE_DISK_720, 14, 80, 1, "1.12 MB 3\"1/2", },
/* 1.2 MB 5"1/4 floppy disks */
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 15, 80, 1, "1.2 kB 5\"1/4", },
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 18, 80, 1, "1.44 MB 5\"1/4", },
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 18, 82, 1, "1.48 MB 5\"1/4", },
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 18, 83, 1, "1.49 MB 5\"1/4", },
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 20, 80, 1, "1.6 MB 5\"1/4", },
/* 720 kB 5"1/4 floppy disks */
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 9, 80, 1, "720 kB 5\"1/4", },
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 11, 80, 1, "880 kB 5\"1/4", },
/* 360 kB 5"1/4 floppy disks */
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 9, 40, 1, "360 kB 5\"1/4", },
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 9, 40, 0, "180 kB 5\"1/4", },
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 10, 41, 1, "410 kB 5\"1/4", },
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 10, 42, 1, "420 kB 5\"1/4", },
/* 320 kB 5"1/4 floppy disks */
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 8, 40, 1, "320 kB 5\"1/4", },
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 8, 40, 0, "160 kB 5\"1/4", },
/* 360 kB must match 5"1/4 better than 3"1/2... */
{ FDRIVE_DRV_144, FDRIVE_DISK_720, 9, 80, 0, "360 kB 3\"1/2", },
/* end */
{ FDRIVE_DRV_NONE, FDRIVE_DISK_NONE, -1, -1, 0, NULL, },
};
/* Revalidate a disk drive after a disk change */
static void fd_revalidate (fdrive_t *drv)
{
int64_t nb_sectors;
fd_format_t *parse;
int64_t nb_sectors, size;
int i, first_match, match;
int nb_heads, max_track, last_sect, ro;
FLOPPY_DPRINTF("revalidate\n");
drv->drflags &= ~FDRIVE_REVALIDATE;
/* if no drive present, cannot do more */
if (!drv->bs)
return;
if (bdrv_is_inserted(drv->bs)) {
if (drv->bs != NULL && bdrv_is_inserted(drv->bs)) {
ro = bdrv_is_read_only(drv->bs);
bdrv_get_geometry_hint(drv->bs, &max_track, &nb_heads, &last_sect);
bdrv_get_geometry_hint(drv->bs, &nb_heads, &max_track, &last_sect);
if (nb_heads != 0 && max_track != 0 && last_sect != 0) {
drv->disk = FDRIVE_DISK_USER;
printf("User defined disk (%d %d %d)",
nb_heads - 1, max_track, last_sect);
} else {
bdrv_get_geometry(drv->bs, &nb_sectors);
match = -1;
first_match = -1;
for (i = 0;; i++) {
parse = &fd_formats[i];
if (parse->drive == FDRIVE_DRV_NONE)
break;
if (drv->drive == parse->drive ||
drv->drive == FDRIVE_DRV_NONE) {
size = (parse->max_head + 1) * parse->max_track *
parse->last_sect;
if (nb_sectors == size) {
match = i;
break;
}
if (first_match == -1)
first_match = i;
}
}
if (match == -1) {
if (first_match == -1)
match = 1;
else
match = first_match;
parse = &fd_formats[match];
}
nb_heads = parse->max_head + 1;
max_track = parse->max_track;
last_sect = parse->last_sect;
drv->drive = parse->drive;
printf("%s floppy disk (%d h %d t %d s) %s\n", parse->str,
nb_heads, max_track, last_sect, ro ? "ro" : "rw");
}
if (nb_heads == 1) {
drv->flags &= ~FDISK_DBL_SIDES;
} else {
......@@ -198,236 +283,9 @@ static void fd_revalidate (fdrive_t *drv)
}
drv->max_track = max_track;
drv->last_sect = last_sect;
} else {
bdrv_get_geometry(drv->bs, &nb_sectors);
switch (nb_sectors) {
/* 2.88 MB 3"1/2 drive disks */
case 7680:
printf("3.84 Mb 3\"1/2 disk (1 80 48)");
drv->drive = FDRIVE_DRV_288;
drv->disk = FDRIVE_DISK_288;
drv->last_sect = 48;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
case 7040:
printf("3.52 Mb 3\"1/2 disk (1 80 44)");
drv->drive = FDRIVE_DRV_288;
drv->disk = FDRIVE_DISK_288;
drv->last_sect = 44;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
case 6400:
printf("3.2 Mb 3\"1/2 disk (1 80 40)");
drv->drive = FDRIVE_DRV_288;
drv->disk = FDRIVE_DISK_288;
drv->last_sect = 40;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
case 6240:
printf("3.12 Mb 3\"1/2 disk (1 80 39)");
drv->drive = FDRIVE_DRV_288;
drv->disk = FDRIVE_DISK_288;
drv->last_sect = 39;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
case 5760:
printf("2.88 Mb 3\"1/2 disk (1 80 36)");
drv->drive = FDRIVE_DRV_288;
drv->disk = FDRIVE_DISK_288;
drv->last_sect = 36;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
/* 1.44 MB 3"1/2 drive disks */
case 3840:
printf("1.92 Mb 3\"1/2 disk (1 80 24)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_144;
drv->last_sect = 24;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
case 3680:
printf("1.84 Mb 3\"1/2 disk (1 80 23)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_144;
drv->last_sect = 23;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
case 3520:
printf("1.76 Mb 3\"1/2 disk (1 80 22)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_144;
drv->last_sect = 22;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
case 3486:
printf("1.74 Mb 3\"1/2 disk (1 83 21)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_144;
drv->last_sect = 21;
drv->max_track = 83;
drv->flags |= FDISK_DBL_SIDES;
break;
case 3444:
printf("1.72 Mb 3\"1/2 disk (1 82 21)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_144;
drv->last_sect = 21;
drv->max_track = 82;
drv->flags |= FDISK_DBL_SIDES;
break;
case 3360:
printf("1.68 Mb 3\"1/2 disk (1 80 21)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_144;
drv->last_sect = 21;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
case 3200:
printf("1.6 Mb 3\"1/2 disk (1 80 20)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_144;
drv->last_sect = 20;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
case 2880:
default:
printf("1.44 Mb 3\"1/2 disk (1 80 18)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_144;
drv->last_sect = 18;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
/* 720 kB 3"1/2 drive disks */
case 2240:
printf("1.12 Mb 3\"1/2 disk (1 80 14)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_720;
drv->last_sect = 14;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
case 2080:
printf("1.04 Mb 3\"1/2 disk (1 80 13)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_720;
drv->last_sect = 13;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
case 1660:
printf("830 kb 3\"1/2 disk (1 83 10)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_720;
drv->last_sect = 10;
drv->max_track = 83;
drv->flags |= FDISK_DBL_SIDES;
break;
case 1640:
printf("820 kb 3\"1/2 disk (1 82 10)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_720;
drv->last_sect = 10;
drv->max_track = 82;
drv->flags |= FDISK_DBL_SIDES;
break;
case 1600:
printf("800 kb 3\"1/2 disk (1 80 10)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_720;
drv->last_sect = 10;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
case 1440:
printf("720 kb 3\"1/2 disk (1 80 9)");
drv->drive = FDRIVE_DRV_144;
drv->disk = FDRIVE_DISK_720;
drv->last_sect = 9;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
/* 1.2 MB 5"1/4 drive disks */
case 2988:
printf("1.49 Mb 5\"1/4 disk (1 83 18)");
drv->drive = FDRIVE_DRV_120;
drv->disk = FDRIVE_DISK_144; /* ? */
drv->last_sect = 18;
drv->max_track = 83;
drv->flags |= FDISK_DBL_SIDES;
break;
case 2952:
printf("1.48 Mb 5\"1/4 disk (1 82 18)");
drv->drive = FDRIVE_DRV_120;
drv->disk = FDRIVE_DISK_144; /* ? */
drv->last_sect = 18;
drv->max_track = 82;
drv->flags |= FDISK_DBL_SIDES;
break;
case 2400:
printf("1.2 Mb 5\"1/4 disk (1 80 15)");
drv->drive = FDRIVE_DRV_120;
drv->disk = FDRIVE_DISK_144; /* ? */
drv->last_sect = 15;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
case 1760:
printf("880 kb 5\"1/4 disk (1 80 11)");
drv->drive = FDRIVE_DRV_120;
drv->disk = FDRIVE_DISK_144; /* ? */
drv->last_sect = 11;
drv->max_track = 80;
drv->flags |= FDISK_DBL_SIDES;
break;
/* 360 kB 5"1/4 drive disks */
case 840:
/* 420 kB 5"1/4 disk */
printf("420 kb 5\"1/4 disk (1 42 10)");
drv->drive = FDRIVE_DRV_120;
drv->disk = FDRIVE_DISK_144; /* ? */
drv->last_sect = 10;
drv->max_track = 42;
drv->flags |= FDISK_DBL_SIDES;
case 820:
/* 410 kB 5"1/4 disk */
printf("410 kb 5\"1/4 disk (1 41 10)");
drv->drive = FDRIVE_DRV_120;
drv->disk = FDRIVE_DISK_144; /* ? */
drv->last_sect = 10;
drv->max_track = 41;
drv->flags |= FDISK_DBL_SIDES;
case 720:
/* 360 kB 5"1/4 disk */
printf("360 kb 5\"1/4 disk (1 40 9)");
drv->drive = FDRIVE_DRV_120;
drv->disk = FDRIVE_DISK_144; /* ? */
drv->last_sect = 9;
drv->max_track = 40;
drv->flags |= FDISK_DBL_SIDES;
break;
}
printf(" %s\n", ro == 0 ? "rw" : "ro");
}
drv->ro = ro;
} else {
printf("No disk in drive\n");
drv->disk = FDRIVE_DISK_NONE;
drv->last_sect = 0;
drv->max_track = 0;
drv->flags &= ~FDISK_DBL_SIDES;
......@@ -544,20 +402,29 @@ static uint32_t fdctrl_read (void *opaque, uint32_t reg)
fdctrl_t *fdctrl = opaque;
uint32_t retval;
if (reg == fdctrl->io_base + 0x01)
switch (reg & 0x07) {
case 0x01:
retval = fdctrl_read_statusB(fdctrl);
else if (reg == fdctrl->io_base + 0x02)
break;
case 0x02:
retval = fdctrl_read_dor(fdctrl);
else if (reg == fdctrl->io_base + 0x03)
break;
case 0x03:
retval = fdctrl_read_tape(fdctrl);
else if (reg == fdctrl->io_base + 0x04)
break;
case 0x04:
retval = fdctrl_read_main_status(fdctrl);
else if (reg == fdctrl->io_base + 0x05)
break;
case 0x05:
retval = fdctrl_read_data(fdctrl);
else if (reg == fdctrl->io_base + 0x07)
break;
case 0x07: