Support LOCALBOOT (ISOLINUX-style) in SYSLINUX/EXTLINUX
[syslinux.git] / memdisk / memdisk.h
blobad650e540a9548f6fd9dd898879337c23a9fc275
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2001-2008 H. Peter Anvin - All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 * Boston MA 02111-1307, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
14 * memdisk.h
16 * Miscellaneous header definitions
19 #ifndef MEMDISK_H
20 #define MEMDISK_H
22 /* We use the com32 interface for calling 16-bit code */
23 #include <com32.h>
25 /* The real-mode segment */
26 #define LOW_SEG 0x0800
28 typedef void (*syscall_t)(uint8_t, com32sys_t *, com32sys_t *);
29 extern syscall_t syscall;
30 extern void *sys_bounce;
32 /* What to call when we're dead */
33 extern void __attribute__((noreturn)) die(void);
35 /* Standard routines */
36 #define memcpy(a,b,c) __builtin_memcpy(a,b,c)
37 #define memset(a,b,c) __builtin_memset(a,b,c)
38 #define strcpy(a,b) __builtin_strcpy(a,b)
39 #define strlen(a) __builtin_strlen(a)
41 /* memcpy() but returns a pointer to end of buffer */
42 static inline void *
43 memcpy_endptr(void *__d, const void *__s, unsigned int __n)
45 memcpy(__d, __s, __n);
46 return (void *)((char *)__d + __n);
49 /* memcmp() */
50 static inline int
51 memcmp(const void *__a, const void *__b, unsigned int __n)
53 const unsigned char *__aa = __a;
54 const unsigned char *__bb = __b;
55 int __d;
57 while ( __n-- ) {
58 __d = *__bb++ - *__aa++;
59 if ( __d )
60 return __d;
63 return 0;
66 /* Decompression */
67 extern int check_zip(void *indata, uint32_t size, uint32_t *zbytes_p,
68 uint32_t *dbytes_p, uint32_t *orig_crc,
69 uint32_t *offset_p);
70 extern void *unzip(void *indata, uint32_t zbytes, uint32_t dbytes,
71 uint32_t orig_crc, void *target);
73 #endif