* Stored data missed in setup.S @ 2003-04-23 13:17 Andrew Kirilenko 2003-04-23 13:33 ` Richard B. Johnson 0 siblings, 1 reply; 8+ messages in thread From: Andrew Kirilenko @ 2003-04-23 13:17 UTC (permalink / raw) To: linux-kernel Hello! I feel myself stupid, when fighting against setup.S. Here is small piece of code (/arch/i386/boot/setup.S) ---> start_of_setup: # line 160 # bla bla bla - some checking code movb $1, %al movb %al, (0x100) .... .... pushw %ax movb (0x100), %al cmpb $1, %al popw %ax # pop don't change any flags - 386 asm reference je bail820 # and it don't jump -- al != 1 meme820: # line 300 <--- Any ideas? I've spent two days, trying to understand what's going on - no luck at all... Best regards, Andrew. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Stored data missed in setup.S 2003-04-23 13:17 Stored data missed in setup.S Andrew Kirilenko @ 2003-04-23 13:33 ` Richard B. Johnson 2003-04-23 13:39 ` Andrew Kirilenko 0 siblings, 1 reply; 8+ messages in thread From: Richard B. Johnson @ 2003-04-23 13:33 UTC (permalink / raw) To: Andrew Kirilenko; +Cc: linux-kernel On Wed, 23 Apr 2003, Andrew Kirilenko wrote: > Hello! > > I feel myself stupid, when fighting against setup.S. Here is small piece of > code (/arch/i386/boot/setup.S) > > ---> > start_of_setup: # line 160 > # bla bla bla - some checking code > movb $1, %al > movb %al, (0x100) > .... > .... > pushw %ax > movb (0x100), %al You put something from offset 0x100 into %al. > cmpb $1, %al Then you compared it against 1. This is where the comparaison occurred. > popw %ax # pop don't change any flags - 386 asm reference Then you put something else into %ax. Whatever it is, doesn't count. > je bail820 # and it don't jump -- al != 1 Then you jumped based upon the comparison you made before you destroyed the contents of %al by poping %eax (%eax is (%ah << 8) | %al). If you don't want to muck with registers, just do: cmpb $1, (0x100) jz wherever You don't need to put memory oprands into registers to compare. > meme820: # line 300 > <--- > > Any ideas? I've spent two days, trying to understand what's going on > - no luck > at all... > > Best regards, > Andrew. 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. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Stored data missed in setup.S 2003-04-23 13:33 ` Richard B. Johnson @ 2003-04-23 13:39 ` Andrew Kirilenko 2003-04-23 14:36 ` Richard B. Johnson 0 siblings, 1 reply; 8+ messages in thread From: Andrew Kirilenko @ 2003-04-23 13:39 UTC (permalink / raw) To: linux-kernel Hello! > > I feel myself stupid, when fighting against setup.S. Here is small piece > > of code (/arch/i386/boot/setup.S) > > > > ---> > > start_of_setup: # line 160 > > # bla bla bla - some checking code > > movb $1, %al > > movb %al, (0x100) > > .... > > .... > > pushw %ax > > movb (0x100), %al > > You put something from offset 0x100 into %al. > > > cmpb $1, %al > > Then you compared it against 1. This is where the comparaison > occurred. > > > popw %ax # pop don't change any flags - 386 asm reference > > Then you put something else into %ax. Whatever it is, doesn't count. > > > je bail820 # and it don't jump -- al != 1 > > Then you jumped based upon the comparison you made before you > destroyed the contents of %al by poping %eax (%eax is (%ah << 8) | %al). > > If you don't want to muck with registers, just do: > > cmpb $1, (0x100) > jz wherever > > You don't need to put memory oprands into registers to compare. > > > meme820: # line 300 > > <--- 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??? Best regards, Andrew. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Stored data missed in setup.S 2003-04-23 13:39 ` Andrew Kirilenko @ 2003-04-23 14:36 ` Richard B. Johnson 2003-04-23 14:50 ` Andrew Kirilenko 2003-04-23 14:51 ` Randy.Dunlap 0 siblings, 2 replies; 8+ messages in thread From: Richard B. Johnson @ 2003-04-23 14:36 UTC (permalink / raw) To: Andrew Kirilenko; +Cc: Linux kernel On Wed, 23 Apr 2003, Andrew Kirilenko wrote: [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. 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. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Stored data missed in setup.S 2003-04-23 14:36 ` Richard B. Johnson @ 2003-04-23 14:50 ` Andrew Kirilenko 2003-04-23 15:06 ` Richard B. Johnson 2003-04-23 14:51 ` Randy.Dunlap 1 sibling, 1 reply; 8+ messages in thread From: Andrew Kirilenko @ 2003-04-23 14:50 UTC (permalink / raw) To: linux-kernel 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. Best regards, Andrew. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Stored data missed in setup.S 2003-04-23 14:50 ` Andrew Kirilenko @ 2003-04-23 15:06 ` Richard B. Johnson 0 siblings, 0 replies; 8+ messages in thread From: Richard B. Johnson @ 2003-04-23 15:06 UTC (permalink / raw) To: Andrew Kirilenko; +Cc: linux-kernel 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. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Stored data missed in setup.S 2003-04-23 14:36 ` Richard B. Johnson 2003-04-23 14:50 ` Andrew Kirilenko @ 2003-04-23 14:51 ` Randy.Dunlap 2003-04-23 15:11 ` Richard B. Johnson 1 sibling, 1 reply; 8+ messages in thread From: Randy.Dunlap @ 2003-04-23 14:51 UTC (permalink / raw) To: root; +Cc: icedank, linux-kernel On Wed, 23 Apr 2003 10:36:55 -0400 (EDT) "Richard B. Johnson" <root@chaos.analogic.com> wrote: | On Wed, 23 Apr 2003, Andrew Kirilenko wrote: | | [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. Could possibly be that DS (seg register) is altered between the store and the comparison... | 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. -- ~Randy ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Stored data missed in setup.S 2003-04-23 14:51 ` Randy.Dunlap @ 2003-04-23 15:11 ` Richard B. Johnson 0 siblings, 0 replies; 8+ messages in thread From: Richard B. Johnson @ 2003-04-23 15:11 UTC (permalink / raw) To: Randy.Dunlap; +Cc: icedank, linux-kernel On Wed, 23 Apr 2003, Randy.Dunlap wrote: > On Wed, 23 Apr 2003 10:36:55 -0400 (EDT) "Richard B. Johnson" <root@chaos.analogic.com> wrote: > > | On Wed, 23 Apr 2003, Andrew Kirilenko wrote: > | > | [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. > > Could possibly be that DS (seg register) is altered between > the store and the comparison... I can only assume that the code presented is the only code that was executed. You are correct that DS may have never even been set. The data segment may be in some non-writable space, which is hard to find now-days with most evenything being shadowed and left writable. Many modern chip-sets can't turn off write, maybe it was too expensive from a performance standpoint. 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. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2003-04-23 14:58 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-04-23 13:17 Stored data missed in setup.S Andrew Kirilenko 2003-04-23 13:33 ` Richard B. Johnson 2003-04-23 13:39 ` Andrew Kirilenko 2003-04-23 14:36 ` Richard B. Johnson 2003-04-23 14:50 ` Andrew Kirilenko 2003-04-23 15:06 ` Richard B. Johnson 2003-04-23 14:51 ` Randy.Dunlap 2003-04-23 15:11 ` Richard B. Johnson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).