diff options
| -rw-r--r-- | loader/Makefile | 18 | ||||
| -rw-r--r-- | loader/init.c | 2 | ||||
| -rw-r--r-- | loader/minilibc.c | 1 | ||||
| -rw-r--r-- | loader/minilibc.h | 75 |
4 files changed, 94 insertions, 2 deletions
diff --git a/loader/Makefile b/loader/Makefile index b63a5a5d2..050cf84aa 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -52,6 +52,16 @@ BINS += loader-local loader-network loader-pcmcia OBJS += dietstubs.o ctype.o endif +ifeq (x86_64, $(ARCH)) +BINS += loader-local loader-network loader-pcmcia + ifeq (1, $(JAPANESE)) + KONOBJS = ./kon2/src/libkon.a ./kon2/src/display.a ./kon2/lib/libgon.a + CFLAGS += -DINCLUDE_KON + DIRS += kon2 + endif +OBJS += stubs.o +endif + ifeq (ia64, $(ARCH)) BINS += loader endif @@ -101,6 +111,13 @@ CC=$(DIET) $(REALCC) STATIC=-static else REALCC=$(CC) +ifeq (x86_64, $(ARCH)) +COPTS+=-DUSE_MINILIBC=1 -DUSE_LOGDEV +MINILIBC=minilibc.o +LDFLAGS = -nostdlib /usr/lib64/crt1.o +LOADERLIBS += -lresolv +STATIC= -static +else ifeq (sparc, $(ARCH)) MINILIBC=minilibc.o /usr/lib/libc.a CFLAGS+=-DUSE_MINILIBC=1 -DUSE_LOGDEV @@ -113,6 +130,7 @@ STATIC=-static LOADERLIBS += -lresolv endif endif +endif LANGS = $(shell awk '{ print $$2 }' ../lang-table | egrep -v '(^en$$)') diff --git a/loader/init.c b/loader/init.c index 495bae39b..8eaed3af2 100644 --- a/loader/init.c +++ b/loader/init.c @@ -347,7 +347,7 @@ void undoMount(struct unmountInfo * fs, int numFs, int this) { printf("\t%s", fs[this].name); /* don't need to unmount /tmp. it is busy anyway. */ if (!testing) { - if (umount(fs[this].name) < 0) { + if (umount2(fs[this].name, 0) < 0) { printf(" umount failed (%d)", errno); } else { printf(" done"); diff --git a/loader/minilibc.c b/loader/minilibc.c index 78702b34a..783681757 100644 --- a/loader/minilibc.c +++ b/loader/minilibc.c @@ -206,3 +206,4 @@ void printf(char * fmt, ...) { } } } + diff --git a/loader/minilibc.h b/loader/minilibc.h index 16765be8e..2dd087c9c 100644 --- a/loader/minilibc.h +++ b/loader/minilibc.h @@ -51,6 +51,78 @@ typedef __sigset_t sigset_t; #include <asm/signal.h> #include <asm/stat.h> +/* x86_64 sucks and has this stuff only available to the kernel. cheat. */ +#if defined(__x86_64__) +#undef __FD_SET +static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) +{ + unsigned long _tmp = fd / __NFDBITS; + unsigned long _rem = fd % __NFDBITS; + fdsetp->fds_bits[_tmp] |= (1UL<<_rem); +} + +#undef __FD_CLR +static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp) +{ + unsigned long _tmp = fd / __NFDBITS; + unsigned long _rem = fd % __NFDBITS; + fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem); +} + +#undef __FD_ISSET +static __inline__ int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p){ + unsigned long _tmp = fd / __NFDBITS; + unsigned long _rem = fd % __NFDBITS; + return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0; + +} + +/* + * This will unroll the loop for the normal constant cases (8 or 32 longs, + * for 256 and 1024-bit fd_sets respectively) + */ +#undef __FD_ZERO +static __inline__ void __FD_ZERO(__kernel_fd_set *p) +{ + unsigned long *tmp = p->fds_bits; + int i; + + if (__builtin_constant_p(__FDSET_LONGS)) { + switch (__FDSET_LONGS) { + case 32: + tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; + tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; + tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0; + tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0; + tmp[16] = 0; tmp[17] = 0; tmp[18] = 0; tmp[19] = 0; + tmp[20] = 0; tmp[21] = 0; tmp[22] = 0; tmp[23] = 0; + tmp[24] = 0; tmp[25] = 0; tmp[26] = 0; tmp[27] = 0; + tmp[28] = 0; tmp[29] = 0; tmp[30] = 0; tmp[31] = 0; + return; + case 16: + tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; + tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; + tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0; + tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0; + return; + case 8: + tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; + tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; + return; + case 4: + tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; + return; + } + } + i = __FDSET_LONGS; + while (i) { + i--; + *tmp = 0; + tmp++; + } +} +#endif /* x86_64 hackery */ + void * alloca(size_t size); void exit(int arg); @@ -58,6 +130,7 @@ void exit(int arg); #if defined(__x86_64__) #define __NR__newselect __NR_select #define __NR_socketcall __NR_socket +#define __NR_signal __NR_rt_sigaction #endif @@ -81,7 +154,7 @@ static inline _syscall2(int,setdomainname,const char *,name,int,len) static inline _syscall2(int,setpgid,int,name,int,len) static inline _syscall2(int,signal,int,num,void *,len) static inline _syscall2(int,stat,const char *,file,struct stat *,buf) -static inline _syscall1(int,umount,const char *,dir) +static inline _syscall2(int,umount2,const char *,dir,int,flags) static inline _syscall1(int,unlink,const char *,fn) static inline _syscall1(int,close,int,fd) static inline _syscall1(int,swapoff,const char *,fn) |
