summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-08-12 21:51:54 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-08-12 21:51:54 -0700
commit39851b279e6001157094ea87ffe27d0ad152edb4 (patch)
treeeb81a148bccea09e0ecffb26e38074956a193c40
parent69269947f6f716dcb01f3bf00e9a4ca00c04c10c (diff)
downloadsyslinux-39851b279e6001157094ea87ffe27d0ad152edb4.tar.gz
core: cleaner way to call kaboom from 32-bit code
Make kaboom() a noreturn function directly callable from 32-bit code. Do a special macro hack to keep it from interfering with the symbol kaboom in 16-bit code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/call16.c2
-rw-r--r--core/fs/pxe/pxe.c17
-rw-r--r--core/include/core.h9
3 files changed, 18 insertions, 10 deletions
diff --git a/core/call16.c b/core/call16.c
index 1e369e29..86d70461 100644
--- a/core/call16.c
+++ b/core/call16.c
@@ -19,6 +19,8 @@
#include <stddef.h>
#include "core.h"
+const com32sys_t zero_regs; /* Common all-zero register set */
+
void call16(void (*func)(void), const com32sys_t *ireg, com32sys_t *oreg)
{
core_farcall((size_t)func, ireg, oreg);
diff --git a/core/fs/pxe/pxe.c b/core/fs/pxe/pxe.c
index ceb12102..d03847d3 100644
--- a/core/fs/pxe/pxe.c
+++ b/core/fs/pxe/pxe.c
@@ -324,7 +324,7 @@ static int pxe_get_cached_info(int type)
err = pxe_call(PXENV_GET_CACHED_INFO, &bq_pkt);
if (err) {
printf("%s %04x\n", err_pxefailed, err);
- call16(kaboom, NULL, NULL);
+ kaboom();
}
return bq_pkt.buffersize;
@@ -404,9 +404,8 @@ static void get_packet_gpxe(struct open_file_t *file)
if (!err) /* successed */
break;
- if (fr.status == PXENV_STATUS_TFTP_OPEN)
- continue;
- call16(kaboom, NULL, NULL);
+ if (fr.status != PXENV_STATUS_TFTP_OPEN)
+ kaboom();
}
file->tftp_bytesleft = fr.buffersize;
@@ -603,7 +602,7 @@ static void fill_buffer(struct open_file_t *file)
/* time runs out */
if (timeout == 0)
- call16(kaboom, NULL, NULL);
+ kaboom();
last_pkt = file->tftp_lastpkt;
last_pkt = ntohs(last_pkt); /* Host byte order */
@@ -996,7 +995,7 @@ err_reply:
uw_pkt.buffersize = 24;
pxe_call(PXENV_UDP_WRITE, &uw_pkt);
printf("TFTP server sent an incomprehesible reply\n");
- call16(kaboom, NULL, NULL);
+ kaboom();
failure:
timeout_ptr++;
@@ -1146,7 +1145,7 @@ static void pxe_load_config(com32sys_t *regs)
return;
printf("Unable to locate configuration file\n");
- call16(kaboom, NULL, NULL);
+ kaboom();
}
@@ -1382,7 +1381,7 @@ static void pxe_init(void)
/* Found nothing at all !! */
printf("%s\n", err_nopxe);
- call16(kaboom, NULL, NULL);
+ kaboom();
have_pxenv:
APIVer = pxenv->version;
@@ -1445,7 +1444,7 @@ static void udp_init(void)
if (err || uo_pkt.status) {
printf("%s", err_udpinit);
printf("%d\n", uo_pkt.status);
- call16(kaboom, NULL, NULL);
+ kaboom();
}
}
diff --git a/core/include/core.h b/core/include/core.h
index f7a69284..ad00492d 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -25,6 +25,7 @@ void __cdecl core_intcall(uint8_t, const com32sys_t *, com32sys_t *);
void __cdecl core_farcall(uint32_t, const com32sys_t *, com32sys_t *);
int __cdecl core_cfarcall(uint32_t, const void *, uint32_t);
+extern const com32sys_t zero_regs;
void call16(void (*)(void), const com32sys_t *, com32sys_t *);
/*
@@ -34,9 +35,15 @@ void call16(void (*)(void), const com32sys_t *, com32sys_t *);
#define __bss16 __attribute((nocommon,section(".bss16")))
/*
+ * Death! The macro trick is to avoid symbol conflict with
+ * the real-mode symbol kaboom.
+ */
+__noreturn _kaboom(void);
+#define kaboom() _kaboom()
+
+/*
* externs for pxelinux
*/
-extern void kaboom(void);
extern void dns_mangle(void);
extern uint32_t ServerIP;