[Top] [All Lists]

Re: MIPS Assembler help

Subject: Re: MIPS Assembler help
From: Andreas Busse <>
Date: Thu, 7 Sep 1995 08:51:48 +0200
In-reply-to: <>
 > What follows is very detailed, but I hope that some of the
 > "old-timers" can take a look at it and let me know where I'm going
 > astray.
 > I'm having a crash in the floppy init code.  I'm starting to think
 > that gcc just might be generating bogus code, but I can't be sure
 > since I don't swim in MIPS R4x00 assembler just yet.
 > Before I start, my kernel is compiled -DPORT_BASE=0xB0000000 rather
 > than using the default address for that, since I don't have my maps
 > working quite right yet.
 > I guess I'm having trouble with delay slots.  R -> R operations take
 > place right away, right?

Yes, as long you don't use CP0 registers. But that's another case...

 > The 'C' code:
 >      for(i=0; i< N_FDC; i++){
 >              if(FDCS->address != -1){        
 >                      fdc = i;
 >                      reset_fdc_info(1);
 >                      fd_out(FDCS->dor, FD_DOR);      /* 
 > outb_p(fdc_state[fdc].dor, FD_DOR) */
 >              }
 >      }
 > [ Code deleted ]
 > At the three stared point in the code, $3 is 0x600003f2.  It really
 > should be 0xB00003f2.  I'm just not seeing where things are going
 > amiss.
 > address = 0xb000003f0
 > dor = 0x4.
 > FD_DOR = 0xb000003f2
 > FD_DOR is interesting, since it is BASE_PORT + FD_IOPORT + 2, but I
 > think it should really only be FD_IOPORT + 2 = 0x3f0.  That would make
 > the macro expand correctly, and 0xb0000000 + 0xb0000000 = 0x160000000
 > or 0x60000000, which is the virtual address in my crash.

That sounds familiar. Actually, it's the same problem I had with the
Magnum. The out## and in## macros add PORT_BASE by default. So if you
say FD_IOPORT is 0xb00003f0 and PORT_BASE is 0xb0000000 you finally
get 0x600003f0 as address. It might be my fault. Take a look at
floppy.c, somewhere at the top:

#define FDC1                    ((boot_info.machtype == MACH_ACER_PICA_61 || \
                                boot_info.machtype == MACH_MIPS_MAGNUM_4000 || \
                                boot_info.machtype == MACH_OLIVETTI_M700) ? \
                                0xe0003000 : PORT_BASE + 0x3f0)

Change that into 

                                boot_info.machtype == MACH_OLIVETTI_M700) ? \
                                0xe0003000 : 0x3f0)

and everything should be fine. I was thinking about changing the in## and out##
macros at all and might have left that in by accident or lazyness. Sorry.

 > So I'm confused.  Why is it defined like that?  I would guess that is
 > because that's the way it is on the ACER, MAGNUM and OLIVETTY boards
 > (fixed at location 0xe00030000), but on all others it is defined to be
 > PORT_BASE + 0x3f0.  Why not just 0x3f0?  On the Deskstation, that
 > seems to be the right thing to define it as, but I'm not keen on
 > breaking anybody else's ports.
 > Wo whats the right thing to do here?  When I change it to be just
 > 0xf30 I get farther in my boot (it hangs afer printing FDC 0 is a
 > 8272A, which is more progress).  Is this a valid change, or should I
 > be doing something different?

It's a valid change. See above. I'll correct that in my source tree too.
I must admit that my changes to the floppy driver are totally untested
for any other box than Jazz's. It might even break on Intel boxes...

Sorry again,

<Prev in Thread] Current Thread [Next in Thread>