summaryrefslogtreecommitdiff
path: root/dos
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-06-22 17:07:03 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-06-22 17:07:03 -0700
commit0b014e446285b7aad1e19163a15b9cc8936047d3 (patch)
tree3270ef7d7d94cbdf640bfc8f74fd679087f54abf /dos
parentbdf96656c4418a691868b85cb90a80f353b0cb0b (diff)
downloadsyslinux-0b014e446285b7aad1e19163a15b9cc8936047d3.tar.gz
dos: vacuous ADV support
Vacuous ADV support: install an empty ADV. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'dos')
-rw-r--r--dos/Makefile3
-rw-r--r--dos/errno.h35
-rw-r--r--dos/memmove.S36
-rw-r--r--dos/string.h1
-rw-r--r--dos/syslinux.c7
5 files changed, 81 insertions, 1 deletions
diff --git a/dos/Makefile b/dos/Makefile
index d4d20c7d..574b65ec 100644
--- a/dos/Makefile
+++ b/dos/Makefile
@@ -28,12 +28,13 @@ INCLUDES = -include code16.h -nostdinc -iwithprefix include \
SRCS = syslinux.c \
../libinstaller/fat.c \
../libinstaller/syslxmod.c \
+ ../libinstaller/setadv.c \
../libinstaller/bootsect_bin.c \
../libinstaller/ldlinux_bin.c \
../libinstaller/mbr_bin.c \
$(wildcard ../libfat/*.c)
OBJS = header.o crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
-LIBOBJS = int2526.o conio.o memcpy.o memset.o skipatou.o atou.o \
+LIBOBJS = int2526.o conio.o memcpy.o memset.o memmove.o skipatou.o atou.o \
malloc.o free.o getsetsl.o \
argv.o printf.o __divdi3.o __udivmoddi4.o
diff --git a/dos/errno.h b/dos/errno.h
index 30aa046f..da733bfa 100644
--- a/dos/errno.h
+++ b/dos/errno.h
@@ -1,6 +1,41 @@
#ifndef ERRNO_H
#define ERRNO_H
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Argument list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No child processes */
+#define EAGAIN 11 /* Try again */
+#define ENOMEM 12 /* Out of memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Device or resource busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* File table overflow */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Not a typewriter */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math argument out of domain of func */
+#define ERANGE 34 /* Math result not representable */
+
int errno;
void perror(const char *);
diff --git a/dos/memmove.S b/dos/memmove.S
new file mode 100644
index 00000000..1ab2cb23
--- /dev/null
+++ b/dos/memmove.S
@@ -0,0 +1,36 @@
+#
+# memmove.S
+#
+# Simple 16-bit memmove() implementation
+#
+
+ .text
+ .code16gcc
+ .globl memmove
+ .type memmove, @function
+memmove:
+ pushw %di
+ pushw %si
+ movw %ax,%di
+ movw %dx,%si
+ cmpw %si,%di
+ ja 1f
+ # The third argument is already in cx
+ cld
+ rep ; movsb
+2:
+ popw %si
+ popw %di
+ ret
+
+1: /* si <= di, need reverse copy */
+ add %cx,%di
+ add %cx,%si
+ dec %di
+ dec %si
+ std
+ rep ; movsb
+ cld
+ jmp 2b
+
+ .size memmove,.-memmove
diff --git a/dos/string.h b/dos/string.h
index 8f8c8967..5ee829e8 100644
--- a/dos/string.h
+++ b/dos/string.h
@@ -7,6 +7,7 @@
/* Standard routines */
#define memcpy(a,b,c) __builtin_memcpy(a,b,c)
+#define memmove(a,b,c) __builtin_memmove(a,b,c)
#define memset(a,b,c) __builtin_memset(a,b,c)
#define strcpy(a,b) __builtin_strcpy(a,b)
#define strlen(a) __builtin_strlen(a)
diff --git a/dos/syslinux.c b/dos/syslinux.c
index 5dc34836..d83cadc8 100644
--- a/dos/syslinux.c
+++ b/dos/syslinux.c
@@ -26,6 +26,7 @@
#include "syslinux.h"
#include "libfat.h"
+#include "setadv.h"
const char *program = "syslinux"; /* Name of program */
uint16_t dos_version;
@@ -658,6 +659,11 @@ int main(int argc, char *argv[])
usage();
/*
+ * Create an ADV in memory... this should be smarter.
+ */
+ syslinux_reset_adv(syslinux_adv);
+
+ /*
* Figure out which drive we're talking to
*/
dev_fd = (device[0] & ~0x20) - 0x40;
@@ -685,6 +691,7 @@ int main(int argc, char *argv[])
set_attributes(ldlinux_name, 0);
fd = creat(ldlinux_name, 0); /* SYSTEM HIDDEN READONLY */
write_ldlinux(fd);
+ write_file(fd, syslinux_adv, 2 * ADV_SIZE);
close(fd);
set_attributes(ldlinux_name, 0x07); /* SYSTEM HIDDEN READONLY */