xstart16() fixed up to use new REAL_EXEC mechanism.

This commit is contained in:
Michael Brown
2005-04-17 12:36:45 +00:00
parent 1a6ca649a2
commit 63e0c8f947

View File

@@ -40,7 +40,7 @@ static struct tagged_context
static sector_t tagged_download(unsigned char *data, unsigned int len, int eof); static sector_t tagged_download(unsigned char *data, unsigned int len, int eof);
void xstart16 (unsigned long execaddr, segoff_t location, void xstart16 (unsigned long execaddr, segoff_t location,
void *bootp); struct bootpd_t *bootp);
static inline os_download_t tagged_probe(unsigned char *data, unsigned int len) static inline os_download_t tagged_probe(unsigned char *data, unsigned int len)
{ {
@@ -173,28 +173,29 @@ static sector_t tagged_download(unsigned char *data, unsigned int len, int eof)
} }
void xstart16 (unsigned long execaddr, segoff_t location, void xstart16 (unsigned long execaddr, segoff_t location,
void *bootp) { struct bootpd_t *bootp) {
struct { uint16_t basemem_bootp;
segoff_t execaddr; int discard_D, discard_S, discard_b;
segoff_t location;
segoff_t bootp;
} PACKED in_stack;
/* AFAICT, execaddr is actually already a segment:offset */ /* AFAICT, execaddr is actually already a segment:offset */
*((unsigned long *)&in_stack.execaddr) = execaddr; basemem_bootp = BASEMEM_PARAMETER_INIT ( *bootp );
in_stack.location = location; REAL_EXEC ( rm_xstart16,
in_stack.bootp.segment = SEGMENT(bootp); "pushw %%ds\n\t" /* far pointer to bootp data copy */
in_stack.bootp.offset = OFFSET(bootp); "pushw %%bx\n\t"
"pushl %%esi\n\t" /* location */
RM_FRAGMENT(rm_xstart16, "pushw %%cs\n\t" /* lcall execaddr */
"popl %eax\n\t" /* Calculated lcall */ "call 1f\n\t"
"pushw %cs\n\t" "jmp 2f\n\t"
"call 1f\n1:\tpopw %bp\n\t" "\n1:\n\t"
"leaw (2f-1b)(%bp), %bx\n\t" "pushl %%edi\n\t"
"pushw %bx\n\t" "lret\n\t"
"pushl %eax\n\t" "\n2:\n\t"
"lret\n2:\n\t" "addw $8,%%sp\n\t", /* pop location and bootp ptr */
); 3,
OUT_CONSTRAINTS ( "=D" ( discard_D ), "=S" ( discard_S ),
real_call ( rm_xstart16, &in_stack, NULL ); "=b" ( discard_b ) ),
IN_CONSTRAINTS ( "D" ( execaddr ), "S" ( location ),
"b" ( basemem_bootp ) ),
CLOBBER ( "eax", "ecx", "edx", "ebp" ) );
BASEMEM_PARAMETER_DONE ( *bootp );
} }