problems running hello in fiasco

Fabian Sturm f at rtfs.org
Mon Mar 31 01:02:32 CEST 2003


Hello!

On Sun, Mar 30, 2003 at 05:14:10PM +0200, Alexander Warg wrote:
> 
> I'm not sure which constructors are called after the Timer, but I'll
> look for it tomorrow.

It still would be interesting to see if the order of the 
constructors is different than what is defined in static_init?
Probably not.

What I mainly missed was the point that not all classes
were initialized because they were excluded with the configure
options. Mainly the UART_INIT_PRIO and KDB_INIT_PRIO are 
interchanged (if I got it right).

So your guess was definitv right! It was the non existing serial
port which gets configured by the built in kdb.

In kdb.c is a line with:

 if(strstr(cmdline, " -nokdb") || strstr(cmdline, " -noserial")

but this comes only after:

  Uart *com = Kernel_uart::uart();

So the -noserial has not the effect I would need.
Maybe it would make sense to interchange the two lines?
Or split the check up into 


  if(strstr(cmdline, " -noserial"))
    {
      disconnect();
      return;
    }

  Uart *com = Kernel_uart::uart();

  if(strstr(cmdline, " -nokdb"))
    {
      disconnect();
      return;
    }

if kdb can work without a serial port.


If I follow the uart call I can track it down to this
part of code in drivers/uart-16550.cpp:

  Proc::Status o = Proc::cli_save();
  ier( 0 );    /* disable all rs-232 interrupts */
  mcr( 0x0b ); /* out2, rts, and dtr enabled */
  fcr( 1 );    /* enable fifo */
  fcr( 0x07 ); /* clear rcv xmit fifo */
  fcr( 1 );    /* enable fifo */
  lcr( 0 );    /* clear line control register */

  /* clearall interrupts */
  /*read*/ msr(); /* IRQID 0*/
  /*read*/ iir(); /* IRQID 1*/
  /*read*/ trb(); /* IRQID 2*/
  /*read*/ lsr(); /* IRQID 3*/

  while(lsr() & 1/*DATA READY*/) /*read*/ trb();
  
  Proc::sti_restore(o);

It hangs somewhere in here, due to non existing port.
So if I disable kdb everything works fine and I end up in the jdb
prompt, and if continued with g I get the hello world output!


> > What is initialized next I can only guess.
> > It seems to be some kind of linker magic with the minilib/construction.c
> > which calls all the functions which are declared with
> > STATIC_INITIALIZER_P?
> 
> The "magic" in construction.c does simply run all C++ and C

Sorry my fault.
The problem why I called it magic was because I didn't saw the
additional "R". With that it makes sense, because it ends up in
two different macros.


> > STATIC_INITIALIZE_P(kdb, KDB_INIT_PRIO);
> > STATIC_INITIALIZER_P(uart_console_init ,UART_INIT_PRIO);


Thanks a lot, Fabian



More information about the l4-hackers mailing list