path: root/doc
diff options
authorH. Peter Anvin <hpa@zytor.com>2010-02-23 18:14:12 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-02-23 18:14:12 -0800
commit3cda063b8e079ee6518d3425650d800db4227585 (patch)
tree5c31ff2924ad2d43e0174e1c7301e950543262d4 /doc
parent2e236fea2b554b7b72f66d96ceae9e3fa4da675a (diff)
core: add a direct 32-bit API
Add a direct 32-bit API to some functions; initially read file only. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'doc')
1 files changed, 32 insertions, 13 deletions
diff --git a/doc/comboot.txt b/doc/comboot.txt
index 6d026aab..79506887 100644
--- a/doc/comboot.txt
+++ b/doc/comboot.txt
@@ -90,19 +90,22 @@ The following arguments are passed to the program on the stack:
[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
-/* 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 protected-mode functions (new in 4.00)
+The libcom32 startup code loads this into a structure named __com32,
+defined in <com32.h>:
+extern struct com32_sys_args {
+ uint32_t cs_sysargs;
+ char *cs_cmdline;
+ 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);
+ uint32_t cs_memsize;
+ struct com32_pmapi *cs_pm;
+} __com32;
The intcall helper function can be used to issue BIOS or Syslinux API
calls, and takes the interrupt number as first argument. The second
@@ -149,6 +152,12 @@ The cfarcall helper function takes (CS << 16)+IP, a pointer to a stack
frame, a size of that stack frame, and returns the return value of EAX
(which may need to be appropriate truncated by the user.)
+Starting in version 4.00, some of these API calls are available as
+protected-mode function calls, using the regparm(3) calling convention
+(the first three argumetns in EAX, EDX, ECX; the rest on the stack.)
+Those functions are defined in struct com32_pmapi, defined in
@@ -342,6 +351,16 @@ AX=0007h [2.08] Read file
WARNING: Calling this function with an invalid file handle
will probably crash the system.
+ size_t cs_pm->read_file(uint16_t *handle, void *buf, size_t blocks)
+ handle - file handle (input and output, set to zero on end of file)
+ buf - buffer to write to
+ blocks - number of blocks to read
+ Returns number of bytes read, or 0 on failure.
AX=0008h [2.08] Close file