aboutsummaryrefslogtreecommitdiff
path: root/src/arch/i386/core/setjmp.S
AgeCommit message (Collapse)AuthorFilesLines
2024-01-14[build] Fix building with newer binutilsMichael Brown1-1/+1
Newer versions of the GNU assembler (observed with binutils 2.41) will complain about the ".arch i386" in files assembled with "as --64", with the message "Error: 64bit mode not supported on 'i386'". In files such as stack.S that contain no instructions to be assembled, the ".arch i386" is redundant and may be removed entirely. In the remaining files, fix by moving ".arch i386" below the relevant ".code16" or ".code32" directive, so that the assembler is no longer expecting 64-bit instructions to be used by the time that the ".arch i386" directive is encountered. Reported-by: Ali Mustakim <alim@forwardcomputers.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2023-06-30[build] Inhibit linker warnings about an implied executable stackGeert Stappers1-0/+1
Signed-off-by: Geert Stappers <stappers@stappers.it> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-07[libc] Fix typo in longjmp()Michael Brown1-3/+3
Commit 8ab4b00 ("[libc] Rewrite setjmp() and longjmp()") introduced a regression in which the saved values of %ebx, %esi, and %edi were all accidentally restored into %esp. The result is that the second and subsequent returns from setjmp() would effectively corrupt %ebx, %esi, %edi, and the stack pointer %esp. Use of setjmp() and longjmp() is generally discouraged: our only use occurs as part of the implementation of PXENV_RESTART_TFTP, since the PXE API effectively mandates its use here. The call to setjmp() occurs at the start of pxe_start_nbp(), where there are almost certainly no values held in %ebx, %esi, or %edi. The corruption of these registers therefore had no visible effect on program execution. The corruption of %esp would have been visible on return from pxe_start_nbp(), but there are no known PXE NBPs which first call PXENV_RESTART_TFTP and subsequently attempt to return to the PXE base code. The effect on program execution was therefore similar to that of moving the stack to a pseudo-random location in the 32-bit address space; this will often allow execution to complete successfully since there is a high chance that the pseudo-random location will be unused. The regression therefore went undetected for around one month. Fix by restoring the correct registers from the saved jmp_buf structure. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02[libc] Rewrite setjmp() and longjmp()Michael Brown1-31/+53
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2009-05-18[legal] Add a selection of FILE_LICENCE declarationsMichael Brown1-0/+2
Add FILE_LICENCE declarations to almost all files that make up the various standard builds of gPXE.
2005-04-08Merged mcb30-realmode-redesign back to HEADMichael Brown1-0/+40