chain.c32: allow "boot" as a drive specification
[syslinux.git] / memdisk / memdisk.h
blobbb2057dea12d3f7bd102be5a425e089572893609
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 #define __cdecl __attribute__((cdecl,regparm(0)))
30 typedef void (*syscall_t)(uint8_t, com32sys_t *, com32sys_t *);
31 extern __cdecl syscall_t syscall;
32 extern void *sys_bounce;
34 /* What to call when we're dead */
35 extern void __attribute__((noreturn)) die(void);
37 /* Standard routines */
38 #define memcpy(a,b,c) __builtin_memcpy(a,b,c)
39 #define memset(a,b,c) __builtin_memset(a,b,c)
40 #define strcpy(a,b) __builtin_strcpy(a,b)
41 #define strlen(a) __builtin_strlen(a)
43 /* memcpy() but returns a pointer to end of buffer */
44 static inline void *
45 memcpy_endptr(void *__d, const void *__s, unsigned int __n)
47 memcpy(__d, __s, __n);
48 return (void *)((char *)__d + __n);
51 /* memcmp() */
52 static inline int
53 memcmp(const void *__a, const void *__b, unsigned int __n)
55 const unsigned char *__aa = __a;
56 const unsigned char *__bb = __b;
57 int __d;
59 while ( __n-- ) {
60 __d = *__bb++ - *__aa++;
61 if ( __d )
62 return __d;
65 return 0;
68 /* Decompression */
69 extern int check_zip(void *indata, uint32_t size, uint32_t *zbytes_p,
70 uint32_t *dbytes_p, uint32_t *orig_crc,
71 uint32_t *offset_p);
72 extern void *unzip(void *indata, uint32_t zbytes, uint32_t dbytes,
73 uint32_t orig_crc, void *target);
75 #endif