aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2014-02-13 10:07:44 -0800
committerH. Peter Anvin <hpa@linux.intel.com>2014-02-13 15:40:02 -0800
commit8c11d9231fa234ff30477ba9c958c9d3645abfa2 (patch)
treee94fb78753a0993bb2844734167be29ff3f03daa /com32
parente6374f1c88f925bd01212a783680eda928ecfff9 (diff)
downloadsyslinux-8c11d9231fa234ff30477ba9c958c9d3645abfa2.tar.gz
syslinux-8c11d9231fa234ff30477ba9c958c9d3645abfa2.tar.xz
syslinux-8c11d9231fa234ff30477ba9c958c9d3645abfa2.zip
pxe: Export the initial stack and PXE(NV) structure, fix pxechn
Export the initial stack and PXE(NV) structure pointers properly, even for users which need seg:offs. Use this in pxechn.c rather than the already-removed INT 22h AX=000Ah call. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Cc: Gene Cumm <gene.cumm@gmail.com>
Diffstat (limited to 'com32')
-rw-r--r--com32/include/syslinux/config.h4
-rw-r--r--com32/modules/pxechn.c32
2 files changed, 19 insertions, 17 deletions
diff --git a/com32/include/syslinux/config.h b/com32/include/syslinux/config.h
index 45a0ac77..131d7c8e 100644
--- a/com32/include/syslinux/config.h
+++ b/com32/include/syslinux/config.h
@@ -115,8 +115,8 @@ union syslinux_derivative_info {
const uint64_t *partoffset;
} disk; /* syslinux/extlinux */
struct {
- uint16_t _gs, _fs, _es, _ds;
- uint32_t _edi, _esi, _ebp, _esp, _ebx;
+ uint16_t _gs, stack_seg, pxenv_seg, _ds;
+ uint32_t _edi, stack_offs, _ebp, _esp, pxenv_offs;
uint16_t apiver;
uint16_t _dxh;
uint32_t myip;
diff --git a/com32/modules/pxechn.c b/com32/modules/pxechn.c
index bd614aa9..e4e21e88 100644
--- a/com32/modules/pxechn.c
+++ b/com32/modules/pxechn.c
@@ -326,25 +326,27 @@ void print_pxe_bootp_t(pxe_bootp_t *p, size_t len)
void pxe_set_regs(struct syslinux_rm_regs *regs)
{
- com32sys_t tregs;
+ const union syslinux_derivative_info *sdi;
+ const com32sys_t *pxe_regs;
+
+ sdi = syslinux_derivative_info();
+ pxe_regs = sdi->pxe.stack; /* Original register values */
+
+ /* Just to be sure... */
+ memset(regs, 0, sizeof *regs);
- memset(&tregs,0,sizeof(tregs));
regs->ip = 0x7C00;
- /* Plan A uses SS:[SP + 4] */
- /* sdi->pxe.stack is a usable pointer, not something that can be nicely
- and reliably split to SS:SP without causing issues */
- tregs.eax.l = 0x000A;
- __intcall(0x22, &tregs, &tregs);
- regs->ss = tregs.fs;
- regs->esp.l = tregs.esi.w[0] + sizeof(tregs);
- /* Plan B uses [ES:BX] */
- regs->es = tregs.es;
- regs->ebx = tregs.ebx;
+
+ /* Point to the original stack */
+ regs->ss = sdi->pxe.stack_seg;
+ regs->esp.l = sdi->pxe.stack_offs + sizeof(com32sys_t);
+
+ /* Point to the PXENV+ address */
+ regs->es = pxe_regs->es;
+ regs->ebx.l = pxe_regs->ebx.l;
+
dprintf("\nsp:%04x ss:%04x es:%04x bx:%04x\n", regs->esp.w[0],
regs->ss, regs->es, regs->ebx.w[0]);
- /* Zero out everything else just to be sure */
- regs->cs = regs->ds = regs->fs = regs->gs = 0;
- regs->eax.l = regs->ecx.l = regs->edx.l = 0;
}
int hostlen_limit(int len)