Re: x86 assembly question
Joachim Kuebart <[email protected]> Mon, 8 Sep 2025 23:02:08 +0200
| Newsgroups | gmane.os.netbsd.ports.x86-64 |
|---|---|
| Message-ID | <CAJGkkrQvzR6330kxYYXBzqGdyr33FGHh0f=-MrP22J=xohorVg@mail.gmail.com> |
--000000000000629e24063e5082a3 Content-Type: text/plain; charset="UTF-8" On Mon, 8 Sept 2025 at 22:38, Manuel Bouyer <[email protected]> wrote: > Hello, > I suspect that some assembly code is not doing what I think it should. > But as it's in the early stage of boot it's hard to debug. > > Here's the (32bits) code: > push %ebx /* save start_info to stack */ > /* do stuff */ > movl $RELOC(__kernel_end), %ebp > addl $3, %ebp > andl $~3, %ebp > movl 0(%ebp), %eax /* read size */ > addl %ebp, %eax /* compute esym */ > /* check if start_info is within symbol table */ > movl -4(%esp), %ebx > it's been many years, but shouldn't it be movl 0(%esp), %ebx to get the saved value? Or some positive offset if other values were pushed in the meantime? Cheers, Joachim --000000000000629e24063e5082a3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr">On Mon, 8 Sept 2025 at 22:38, Manuel Bouy= er <<a href=3D"mailto:[email protected]">[email protected]</a>= > wrote:<br></div><div class=3D"gmail_quote gmail_quote_container"><bloc= kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-= width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);paddin= g-left:1ex">Hello,<br> I suspect that some assembly code is not doing what I think it should.<br> But as it's in the early stage of boot it's hard to debug.<br> <br> Here's the (32bits) code:<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 push %ebx /* save start_info to stack */<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* do stuff */<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 movl $RELOC(__kernel_end), %ebp<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 addl $3, %ebp<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 andl $~3, %ebp<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 movl 0(%ebp), %eax /* read size */<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 addl %ebp, %eax /* compute esym */<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* check if start_info is within symbol table *= /<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 movl -4(%esp), %ebx<br></blockquote><div><br></= div><div>it's been many years, but shouldn't it be</div><div>=C2=A0= =C2=A0 movl 0(%esp), %ebx</div><div><br></div><div>to get the saved value?= Or some positive offset if other values were pushed in the meantime?</div>= <div><br></div><div>Cheers,</div><div><br></div><div>Joachim</div><div>=C2= =A0</div></div></div> --000000000000629e24063e5082a3--