[syslinux:master] dos: vacuous ADV support
syslinux-bot for H. Peter Anvin
hpa at linux.intel.com
Tue Jun 22 17:12:20 PDT 2010
Commit-ID: 0b014e446285b7aad1e19163a15b9cc8936047d3
Gitweb: http://syslinux.zytor.com/commit/0b014e446285b7aad1e19163a15b9cc8936047d3
Author: H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Tue, 22 Jun 2010 17:07:03 -0700
Committer: H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Tue, 22 Jun 2010 17:07:03 -0700
dos: vacuous ADV support
Vacuous ADV support: install an empty ADV.
Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>
---
dos/Makefile | 3 ++-
dos/errno.h | 35 +++++++++++++++++++++++++++++++++++
dos/memmove.S | 36 ++++++++++++++++++++++++++++++++++++
dos/string.h | 1 +
dos/syslinux.c | 7 +++++++
5 files changed, 81 insertions(+), 1 deletions(-)
diff --git a/dos/Makefile b/dos/Makefile
index d4d20c7..574b65e 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 30aa046..da733bf 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 0000000..1ab2cb2
--- /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 8f8c896..5ee829e 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 5dc3483..d83cadc 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 */
More information about the Syslinux-commits
mailing list