public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: How to debug kernel before there is no printk mechanism?
  2005-03-30 16:47 ` linux-os
@ 2005-03-30 14:54   ` Vicente Feito
  2005-03-30 18:09     ` linux-os
  2005-03-30 23:31   ` Randy.Dunlap
  1 sibling, 1 reply; 8+ messages in thread
From: Vicente Feito @ 2005-03-30 14:54 UTC (permalink / raw)
  To: linux-os; +Cc: krishna, Linux Kernel

Video memory is at b800:0000, for humans 0x0000b800, not at 0x000b8000


On Wednesday 30 March 2005 04:47 pm, linux-os wrote:
> On Wed, 30 Mar 2005, krishna wrote:
> > Hi all,
> >
> > How can one debug kernel before there is no printk mechanism in kernel.
> >
> > Regards,
> > Krishna Chaitanya
>
> Write directly to screen memory at 0x000b8000, or write to the
> RS-232C UART while polling the TX buf empty bit, or just write
> bits that mean something to you out the printer port.
>
> Screen - memory is 16-bit words with the high-word being
> an attibute byte. FYI 0x07 is a good B&W byte. You can
> initialize a pointer to it as:
>
> unsigned short *screen = 0xc00b8000; Since low memory
> is always mapped, the above cheat will work. The 0xc0000000
> is PAGE_OFFSET.
>
> An early '486 was brought up into a 32-bit protected-mode
> (non linux) operating system using these debugging methods.
> The first time I got to see some symbol written to the
> screen in protected-mode marked the start of a week-end-
> long party. Have fun!
>
> Cheers,
> Dick Johnson
> Penguin : Linux version 2.6.11 on an i686 machine (5537.79 BogoMips).
>   Notice : All mail here is now cached for review by Dictator Bush.
>                   98.36% of all statistics are fiction.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to debug kernel before there is no printk mechanism?
  2005-03-30 18:09     ` linux-os
@ 2005-03-30 16:16       ` Vicente Feito
  2005-03-30 20:11         ` linux-os
  0 siblings, 1 reply; 8+ messages in thread
From: Vicente Feito @ 2005-03-30 16:16 UTC (permalink / raw)
  To: linux-os; +Cc: krishna, Linux Kernel

On Wednesday 30 March 2005 06:09 pm, linux-os wrote:
> On Wed, 30 Mar 2005, Vicente Feito wrote:
> > Video memory is at b800:0000, for humans 0x0000b800, not at 0x000b8000
>
> Wrong. "real-mode" can use a segment address of b800, that doesn't
> work in protected mode. A segment address of b800:0000 is never
> under any conditions 0000b800.
I was referring to the basic conditions, haven't played under protected mode 
with that, only in real mode, I assumed the question was under that mode.
What you mean is this:
B800:0010 -> B8010H right?

>
> FYI, a real-mode segment is a 16-byte entity, therefore there are
> many segment:offset combinations that can get you to 0x000b8000.
I'm aware of that, it has nothing to do with my statement.

>
> > On Wednesday 30 March 2005 04:47 pm, linux-os wrote:
> >> On Wed, 30 Mar 2005, krishna wrote:
> >>> Hi all,
> >>>
> >>> How can one debug kernel before there is no printk mechanism in kernel.
> >>>
> >>> Regards,
> >>> Krishna Chaitanya
> >>
> >> Write directly to screen memory at 0x000b8000, or write to the
> >> RS-232C UART while polling the TX buf empty bit, or just write
> >> bits that mean something to you out the printer port.
> >>
> >> Screen - memory is 16-bit words with the high-word being
> >> an attibute byte. FYI 0x07 is a good B&W byte. You can
> >> initialize a pointer to it as:
> >>
> >> unsigned short *screen = 0xc00b8000; Since low memory
> >> is always mapped, the above cheat will work. The 0xc0000000
> >> is PAGE_OFFSET.
> >>
> >> An early '486 was brought up into a 32-bit protected-mode
> >> (non linux) operating system using these debugging methods.
> >> The first time I got to see some symbol written to the
> >> screen in protected-mode marked the start of a week-end-
> >> long party. Have fun!
> >>
> >> Cheers,
> >> Dick Johnson
> >> Penguin : Linux version 2.6.11 on an i686 machine (5537.79 BogoMips).
> >>   Notice : All mail here is now cached for review by Dictator Bush.
> >>                   98.36% of all statistics are fiction.
> >> -
> >> To unsubscribe from this list: send the line "unsubscribe linux-kernel"
> >> in the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >> Please read the FAQ at  http://www.tux.org/lkml/
>
> Cheers,
> Dick Johnson
> Penguin : Linux version 2.6.11 on an i686 machine (5537.79 BogoMips).
>   Notice : All mail here is now cached for review by Dictator Bush.
>                   98.36% of all statistics are fiction.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* How to debug kernel before there is no printk mechanism?
@ 2005-03-30 16:22 krishna
  2005-03-30 16:47 ` linux-os
  2005-03-30 18:33 ` Jon Smirl
  0 siblings, 2 replies; 8+ messages in thread
From: krishna @ 2005-03-30 16:22 UTC (permalink / raw)
  To: Linux Kernel

Hi all,

How can one debug kernel before there is no printk mechanism in kernel.

Regards,
Krishna Chaitanya


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to debug kernel before there is no printk mechanism?
  2005-03-30 16:22 How to debug kernel before there is no printk mechanism? krishna
@ 2005-03-30 16:47 ` linux-os
  2005-03-30 14:54   ` Vicente Feito
  2005-03-30 23:31   ` Randy.Dunlap
  2005-03-30 18:33 ` Jon Smirl
  1 sibling, 2 replies; 8+ messages in thread
From: linux-os @ 2005-03-30 16:47 UTC (permalink / raw)
  To: krishna; +Cc: Linux Kernel

On Wed, 30 Mar 2005, krishna wrote:

> Hi all,
>
> How can one debug kernel before there is no printk mechanism in kernel.
>
> Regards,
> Krishna Chaitanya

Write directly to screen memory at 0x000b8000, or write to the
RS-232C UART while polling the TX buf empty bit, or just write
bits that mean something to you out the printer port.

Screen - memory is 16-bit words with the high-word being
an attibute byte. FYI 0x07 is a good B&W byte. You can
initialize a pointer to it as:

unsigned short *screen = 0xc00b8000; Since low memory
is always mapped, the above cheat will work. The 0xc0000000
is PAGE_OFFSET.

An early '486 was brought up into a 32-bit protected-mode
(non linux) operating system using these debugging methods.
The first time I got to see some symbol written to the
screen in protected-mode marked the start of a week-end-
long party. Have fun!

Cheers,
Dick Johnson
Penguin : Linux version 2.6.11 on an i686 machine (5537.79 BogoMips).
  Notice : All mail here is now cached for review by Dictator Bush.
                  98.36% of all statistics are fiction.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to debug kernel before there is no printk mechanism?
  2005-03-30 14:54   ` Vicente Feito
@ 2005-03-30 18:09     ` linux-os
  2005-03-30 16:16       ` Vicente Feito
  0 siblings, 1 reply; 8+ messages in thread
From: linux-os @ 2005-03-30 18:09 UTC (permalink / raw)
  To: Vicente Feito; +Cc: krishna, Linux Kernel

On Wed, 30 Mar 2005, Vicente Feito wrote:

> Video memory is at b800:0000, for humans 0x0000b800, not at 0x000b8000
>

Wrong. "real-mode" can use a segment address of b800, that doesn't
work in protected mode. A segment address of b800:0000 is never
under any conditions 0000b800.

FYI, a real-mode segment is a 16-byte entity, therefore there are
many segment:offset combinations that can get you to 0x000b8000.

>
> On Wednesday 30 March 2005 04:47 pm, linux-os wrote:
>> On Wed, 30 Mar 2005, krishna wrote:
>>> Hi all,
>>>
>>> How can one debug kernel before there is no printk mechanism in kernel.
>>>
>>> Regards,
>>> Krishna Chaitanya
>>
>> Write directly to screen memory at 0x000b8000, or write to the
>> RS-232C UART while polling the TX buf empty bit, or just write
>> bits that mean something to you out the printer port.
>>
>> Screen - memory is 16-bit words with the high-word being
>> an attibute byte. FYI 0x07 is a good B&W byte. You can
>> initialize a pointer to it as:
>>
>> unsigned short *screen = 0xc00b8000; Since low memory
>> is always mapped, the above cheat will work. The 0xc0000000
>> is PAGE_OFFSET.
>>
>> An early '486 was brought up into a 32-bit protected-mode
>> (non linux) operating system using these debugging methods.
>> The first time I got to see some symbol written to the
>> screen in protected-mode marked the start of a week-end-
>> long party. Have fun!
>>
>> Cheers,
>> Dick Johnson
>> Penguin : Linux version 2.6.11 on an i686 machine (5537.79 BogoMips).
>>   Notice : All mail here is now cached for review by Dictator Bush.
>>                   98.36% of all statistics are fiction.
>> -
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
>

Cheers,
Dick Johnson
Penguin : Linux version 2.6.11 on an i686 machine (5537.79 BogoMips).
  Notice : All mail here is now cached for review by Dictator Bush.
                  98.36% of all statistics are fiction.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to debug kernel before there is no printk mechanism?
  2005-03-30 16:22 How to debug kernel before there is no printk mechanism? krishna
  2005-03-30 16:47 ` linux-os
@ 2005-03-30 18:33 ` Jon Smirl
  1 sibling, 0 replies; 8+ messages in thread
From: Jon Smirl @ 2005-03-30 18:33 UTC (permalink / raw)
  To: krishna; +Cc: Linux Kernel

Did you try turning on CONFIG_EARLY_PRINTK=y? That will allow printk
to a serial console much earlier.

You need to build the serial driver in too:
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y

-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to debug kernel before there is no printk mechanism?
  2005-03-30 16:16       ` Vicente Feito
@ 2005-03-30 20:11         ` linux-os
  0 siblings, 0 replies; 8+ messages in thread
From: linux-os @ 2005-03-30 20:11 UTC (permalink / raw)
  To: Vicente Feito; +Cc: krishna, Linux Kernel

On Wed, 30 Mar 2005, Vicente Feito wrote:

> On Wednesday 30 March 2005 06:09 pm, linux-os wrote:
>> On Wed, 30 Mar 2005, Vicente Feito wrote:
>>> Video memory is at b800:0000, for humans 0x0000b800, not at 0x000b8000
>>
>> Wrong. "real-mode" can use a segment address of b800, that doesn't
>> work in protected mode. A segment address of b800:0000 is never
>> under any conditions 0000b800.
> I was referring to the basic conditions, haven't played under protected mode
> with that, only in real mode, I assumed the question was under that mode.
> What you mean is this:
> B800:0010 -> B8010H right?
>

Sort of, but incomplete....

The real-mode segment is a 16-byte thing:

 	0001:0000	=  0x00000010
 	0002:0000	=  0x00000020
 	0003:0000	=  0x00000030

 	b801:0000	=  0x000B8010
 	b802:0000	=  0x000B8020
 	b803:0000	=  0x000B8030

To get the physical address, you multiply the
segment by 0x10 and add the offset. To access
these in 32-bit "linear" mode, you use the
address on the right. To access these in paged-
mode on Linux, you OR in PAGE_OFFSET. This
is an artifact of how the low-memory page-tables
were written. It is not the "correct" way. There
are macros available to perform the translation
for you if you are making some driver that needs
to work over many kernel versions.

[SNIPPED]


Cheers,
Dick Johnson
Penguin : Linux version 2.6.11 on an i686 machine (5537.79 BogoMips).
  Notice : All mail here is now cached for review by Dictator Bush.
                  98.36% of all statistics are fiction.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to debug kernel before there is no printk mechanism?
  2005-03-30 16:47 ` linux-os
  2005-03-30 14:54   ` Vicente Feito
@ 2005-03-30 23:31   ` Randy.Dunlap
  1 sibling, 0 replies; 8+ messages in thread
From: Randy.Dunlap @ 2005-03-30 23:31 UTC (permalink / raw)
  To: linux-os; +Cc: krishna, Linux Kernel

linux-os wrote:
> On Wed, 30 Mar 2005, krishna wrote:
> 
>> Hi all,
>>
>> How can one debug kernel before there is no printk mechanism in kernel.
>>
>> Regards,
>> Krishna Chaitanya

Here's an implementation by Keith Owens:
http://kernelnewbies.org/documents/videochar.txt

The patch there is to Linux 2.4.18, but should be workable
on many versions.

> Write directly to screen memory at 0x000b8000, or write to the
> RS-232C UART while polling the TX buf empty bit, or just write
> bits that mean something to you out the printer port.
> 
> Screen - memory is 16-bit words with the high-word being
> an attibute byte. FYI 0x07 is a good B&W byte. You can
> initialize a pointer to it as:
> 
> unsigned short *screen = 0xc00b8000; Since low memory
> is always mapped, the above cheat will work. The 0xc0000000
> is PAGE_OFFSET.
> 
> An early '486 was brought up into a 32-bit protected-mode
> (non linux) operating system using these debugging methods.
> The first time I got to see some symbol written to the
> screen in protected-mode marked the start of a week-end-
> long party. Have fun!


-- 
~Randy

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-03-30 23:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-30 16:22 How to debug kernel before there is no printk mechanism? krishna
2005-03-30 16:47 ` linux-os
2005-03-30 14:54   ` Vicente Feito
2005-03-30 18:09     ` linux-os
2005-03-30 16:16       ` Vicente Feito
2005-03-30 20:11         ` linux-os
2005-03-30 23:31   ` Randy.Dunlap
2005-03-30 18:33 ` Jon Smirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox