Re: Stored data missed in setup.S

Richard B. Johnson (root@chaos.analogic.com)
Wed, 23 Apr 2003 11:06:12 -0400 (EDT)


On Wed, 23 Apr 2003, Andrew Kirilenko wrote:

> Hello!
> >
> > [SNIPPED...]
> >
> > > OK. And now code looks like:
> > > -->
> > > start_of_setup: # line 160
> > > # bla bla bla - some checking code
> > > movb $1, %al
> > > movb %al, (0x100)
> > > ....
> > > ....
> > > cmpb $1, (0x100)
> > > je bail820 # and it DON'T jump here
> > > <--
> > >
> > >
> > > I'm sure, I'm doing something wrong. But what???
> >
> > The only possibiity is that the code you just showed is not
> > being executed. Absolute location 0x100 is not being overwritten
> > by some timer-tick (normally) so whatever you write there should
> > remain. You just put a byte of 1 in that location and then
> > you compared against a byte of 1. If the CPU was broken, you
> > wouldn't have even loaded your code.
> >
> > It is quite likely that the IP is being diverted around your code
> > by some previous code.
> >
> > FYI, you can check the progress of your code by 'printing' on
> > the screen. Set up ES to point to the screen segment, and write
> > letters there:
> >
> > movw $0xb800, %ax
> > movb %ax, %es
> > movb $'A', %es:(0)
> >
> > This 'prints' an 'A' at the first location on the screen.
>
> Ha! I don't have video adapter not keyboard on that PC :)
> And, when I change je to jmp it works perfectly.
>

Then the only possibility is that your DS segment has not been set
to somewhere that's writable so that your `movb $1, (0x100)` didn't
"take". The BIOS normally sets DS to 0x40, but if you want to read/write
at offset 0x100, it's probably better to set DS to 0. You do this
as :
xorw %ax,%ax
movw %ax,%ds

You need to put the value into a register, then from the register
into a data segment. In real-mode, the absolute memory location
is the segment (address * 16) + the offset. If you left it at
0x40, you have (0x40 * 0x10) + 0x100 = 0x500 which is truly
writable if you got through POST.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.

-
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/