extern struct com32_sys_args {
uint32_t cs_sysargs;
char *cs_cmdline;
- void __cdecl(*cs_intcall) (uint8_t, const com32sys_t *, com32sys_t *);
+ void __cdecl (*cs_intcall)(uint8_t, const com32sys_t *, com32sys_t *);
void *cs_bounce;
uint32_t cs_bounce_size;
- void __cdecl(*cs_farcall) (uint32_t, const com32sys_t *, com32sys_t *);
- int __cdecl(*cs_cfarcall) (uint32_t, const void *, uint32_t);
+ void __cdecl (*cs_farcall)(uint32_t, const com32sys_t *, com32sys_t *);
+ int __cdecl (*cs_cfarcall)(uint32_t, const void *, uint32_t);
uint32_t cs_memsize;
+ const char *cs_name;
} __com32;
/*
#include <stddef.h>
#include <stdio.h>
#include <syslinux/align.h>
+#include <com32.h>
extern char _end[]; /* Symbol created by linker */
void *__mem_end = &_end; /* Global variable for use by malloc() */
int __parse_argv(char ***argv, const char *str)
{
- char argv0[] = "";
+ char dummy_argv0[] = "";
char *mem = __mem_end;
const char *p = str;
char *q = mem;
/* Now create argv */
arg = (char **)ALIGN_UP_FOR(q, char *);
*argv = arg;
- *arg++ = argv0; /* argv[0] */
+ *arg++ = __com32.cs_name ? __com32.cs_name : dummy_argv0; /* argv[0] */
q--; /* Point q to final null */
if (mem < q)
*/
/* Number of arguments in our version of the entry structure */
-#define COM32_ARGS 7
+#define COM32_ARGS 8
.section ".init","ax"
.globl _start
sub cx,si
fs rep movsb
+ mov si,KernelCName
+ mov di,Com32Name
+ call strcpy
+
call comboot_setup_api ; Set up the COMBOOT-style API
mov edi,pm_entry ; Load address
; Now everything is set up for interrupts...
+ push dword Com32Name ; Module filename
push dword [HighMemSize] ; Memory managed by Syslinux
push dword com32_cfarcall ; Cfarcall entry point
push dword com32_farcall ; Farcall entry point
push dword (xfer_buf_seg << 4) ; Bounce buffer address
push dword com32_intcall ; Intcall entry point
push dword command_line ; Command line pointer
- push dword 7 ; Argument count
+ push dword 8 ; Argument count
sti ; Interrupts OK now
call pm_entry ; Run the program...
; ... on return, fall through to com32_exit ...
PMESP resd 1 ; Protected-mode ESP
Com32SysSP resw 1 ; SP saved during COM32 syscall
+ section .uibss
+%if IS_SYSLINUX
+Com32Name resb FILENAME_MAX+2
+%else
+Com32Name resb FILENAME_MAX
+%endif
+
section .text
Address Size Meaning
[ESP] dword Return (termination) address
- [ESP+4] dword Number of additional arguments (currently 7)
+ [ESP+4] dword Number of additional arguments (currently 8)
[ESP+8] dword Pointer to the command line arguments (null-terminated string)
[ESP+12] dword Pointer to INT call helper function
[ESP+16] dword Pointer to low memory bounce buffer
[ESP+24] dword Pointer to FAR call helper function (new in 2.05)
[ESP+28] dword Pointer to CDECL helper function (new in 3.54)
[ESP+32] dword Amount of memory controlled by the Syslinux core (new in 3.74)
-
-This corresponds to the following C prototype, available in the file
-com32/include/com32.h:
-
-/* The standard prototype for _start() */
-int _start(unsigned int __nargs,
- char *__cmdline,
- void (*__intcall)(uint8_t, com32sys_t *, com32sys_t *),
- void *__bounce_ptr,
- unsigned int __bounce_len,
- void (*__farcall)(uint32_t, com32sys_t *, com32sys_t *),
- int (*__cfarcall)(uint32_t, void *, size_t)
- );
+ [ESP+36] dword Pointer to the filename of the com32 module (new in 3.86)
The intcall helper function can be used to issue BIOS or Syslinux API
calls, and takes the interrupt number as first argument. The second