diff options
author | Justus Winter <justus@gnupg.org> | 2016-10-24 23:07:55 +0200 |
---|---|---|
committer | Justus Winter <justus@gnupg.org> | 2016-10-27 11:52:14 +0200 |
commit | 8e499a60837add838647d7319dbd650cc4fb33ab (patch) | |
tree | 4867f0abd0e1038734e01a041040fd9c578a85b2 | |
parent | 205952a1dc7305f982049205e1dd39d534558c2c (diff) |
boot: Remove hacks for running boot on UX.unprivileged-subhurds-2016-10-27
* boot/Makefile (COMMON-OBJS): Do not build server stubs for the
bootstrap protocol.
Remove all UX-related variables and targets.
* boot/boot.c: Remove all UX-related definitions and includes.
* boot/frank1.ld: Delete file.
* boot/frankemul.ld: Likewise.
* boot/mach-crt0.c: Likewise.
* boot/sigvec.S: Likewise.
* boot/syscall.S: Likewise.
* boot/ux.c: Likewise.
* boot/ux.h: Likewise.
-rw-r--r-- | boot/Makefile | 20 | ||||
-rw-r--r-- | boot/boot.c | 14 | ||||
-rw-r--r-- | boot/frank1.ld | 94 | ||||
-rw-r--r-- | boot/frankemul.ld | 107 | ||||
-rw-r--r-- | boot/mach-crt0.c | 158 | ||||
-rw-r--r-- | boot/sigvec.S | 23 | ||||
-rw-r--r-- | boot/syscall.S | 35 | ||||
-rw-r--r-- | boot/ux.c | 303 | ||||
-rw-r--r-- | boot/ux.h | 114 |
9 files changed, 1 insertions, 867 deletions
diff --git a/boot/Makefile b/boot/Makefile index d700116d..ac400441 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -22,10 +22,9 @@ SRCS = mach-crt0.c boot.c ux.c sigvec.S syscall.S \ boot_script.c userland-boot.c COMMON-OBJS = notifyServer.o deviceServer.o \ ioServer.o io_replyUser.o device_replyUser.o \ - termServer.o bootstrapServer.o boot_script.o userland-boot.o + termServer.o boot_script.o userland-boot.o MIGSTUBS = machServer.o mach_hostServer.o gnumachServer.o task_notifyServer.o OBJS = boot.o $(COMMON-OBJS) $(MIGSTUBS) -UX-OBJS = mach-crt0.o uxboot.o sigvec.o syscall.o ux.o $(COMMON-OBJS) target = boot MIGSFLAGS=-imacros $(srcdir)/mig-mutate.h -DHURD_DEFAULT_PAYLOAD_TO_PORT=1 io-MIGSFLAGS=-DREPLY_PORTS -DHURD_DEFAULT_PAYLOAD_TO_PORT=1 @@ -33,20 +32,3 @@ HURDLIBS = store shouldbeinlibc ihash LDLIBS += -lpthread include ../Makeconf - -#install: /usr/local/bin/uxboot -# -#/usr/local/bin/uxboot: uxboot -# cp $< $@ - -all: boot # uxboot - -uxboot.o: boot.c - $(COMPILE.c) -DUX $< -o $@ - -uxboot.0: $(UX-OBJS) - $(LINK.o) -o $@ -static -nostartfiles -Wl,-T -Wl,$(srcdir)/frank1.ld $^ -uxboot.1: frankemul.ld uxboot.0 - $(LD) -o $@ -T $^ -uxboot: uxboot.1 - -$(OBJCOPY) -S --remove-section=.comment -O a.out-mach3 $< $@ diff --git a/boot/boot.c b/boot/boot.c index 19b28331..8f17d40b 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -61,18 +61,6 @@ #include <hurd/auth.h> -#ifdef UX -#undef STORE /* We can't use libstore when under UX. */ -#else -#define STORE -#endif - -#ifdef UX - -#include "ux.h" - -#else /* !UX */ - #include <unistd.h> #include <fcntl.h> #include <signal.h> @@ -128,8 +116,6 @@ host_exit (int status) exit (status); } -#endif /* UX */ - mach_port_t privileged_host_port, master_device_port; mach_port_t pseudo_privileged_host_port; mach_port_t pseudo_master_device_port; diff --git a/boot/frank1.ld b/boot/frank1.ld deleted file mode 100644 index 9de827ae..00000000 --- a/boot/frank1.ld +++ /dev/null @@ -1,94 +0,0 @@ -OUTPUT_FORMAT("elf32-i386", "elf32-i386", - "elf32-i386") -OUTPUT_ARCH(i386) -ENTRY(_start) - SEARCH_DIR(/usr/local/i386-gnuelf/lib); -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = 0x10020; - .text : - { - *(.text) - *(.interp) - *(.hash) - *(.dynsym) - *(.dynstr) - *(.rel.text) - *(.rela.text) - *(.rel.data) - *(.rela.data) - *(.rel.rodata) - *(.rela.rodata) - *(.rel.got) - *(.rela.got) - *(.rel.ctors) - *(.rela.ctors) - *(.rel.dtors) - *(.rela.dtors) - *(.rel.init) - *(.rela.init) - *(.rel.fini) - *(.rela.fini) - *(.rel.bss) - *(.rela.bss) - *(.rel.plt) - *(.rela.plt) - *(.init) - *(.plt) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.fini) - *(.rodata) - *(.rodata1) - _etext = .; - PROVIDE (etext = .); - . = ALIGN(0x1000); - } =0x9090 - . = ALIGN(0x1000); - .data : - { - *(.data) - CONSTRUCTORS - - *(.data1) - *(.ctors) - *(.dtors) - *(.got.plt) *(.got) - *(.dynamic) - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - *(.sdata) - _edata = .; - PROVIDE (edata = .); - . = ALIGN(0x10); -} - __bss_start = .; - .bss : - { - *(.sbss) *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - _end = ALIGN(4) ; - PROVIDE (end = ALIGN(4)); - } - /* These are needed for ELF backends which have not yet been - converted to the new style linker. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - /* DWARF debug sections. - Symbols in the .debug DWARF section are relative to the beginning of the - section so we begin .debug at 0. It's not clear yet what needs to happen - for the others. */ - .debug 0 : { *(.debug) } - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_sfnames 0 : { *(.debug_sfnames) } - .line 0 : { *(.line) } - /* These must appear regardless of . */ -} diff --git a/boot/frankemul.ld b/boot/frankemul.ld deleted file mode 100644 index 413953ef..00000000 --- a/boot/frankemul.ld +++ /dev/null @@ -1,107 +0,0 @@ -OUTPUT_FORMAT("elf32-i386", "elf32-i386", - "elf32-i386") -OUTPUT_ARCH(i386) -ENTRY(_start) - SEARCH_DIR(/usr/local/i386-gnuelf/lib); -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = 0x10020; - .text : - { - *(.text) - *(.interp) - *(.hash) - *(.dynsym) - *(.dynstr) - *(.rel.text) - *(.rela.text) - *(.rel.data) - *(.rela.data) - *(.rel.rodata) - *(.rela.rodata) - *(.rel.got) - *(.rela.got) - *(.rel.ctors) - *(.rela.ctors) - *(.rel.dtors) - *(.rela.dtors) - *(.rel.init) - *(.rela.init) - *(.rel.fini) - *(.rela.fini) - *(.rel.bss) - *(.rela.bss) - *(.rel.plt) - *(.rela.plt) - *(.init) - *(.plt) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.fini) - *(.rodata) - *(.rodata1) -*(_hurd_ioctl_handler_lists) -*(_hurd_pgrp_changed_hook) -*(_hurd_fork_locks) -*(_hurd_subinit) -*(__libc_atexit) -*(_hurd_fd_subinit) -*(_hurd_preinit_hook) -*(_hurd_fork_child_hook) -*(_hurd_fork_parent_hook) -*(_hurd_fork_prepare_hook) -*(_hurd_reauth_hook) -*(_hurd_proc_subinit) -*(__libc_subinit) - _etext = .; - PROVIDE (etext = .); - . = ALIGN(0x1000); - } =0x9090 - . = ALIGN(0x1000); - .data : - { - *(.data) - CONSTRUCTORS - - *(.data1) - *(.ctors) - *(.dtors) - *(.got.plt) *(.got) - *(.dynamic) - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - *(.sdata) - _edata = .; - PROVIDE (edata = .); - . = ALIGN(0x10); -} - __bss_start = .; - .bss : - { - *(.sbss) *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - _end = ALIGN(4) ; - PROVIDE (end = ALIGN(4)); - } - /* These are needed for ELF backends which have not yet been - converted to the new style linker. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - /* DWARF debug sections. - Symbols in the .debug DWARF section are relative to the beginning of the - section so we begin .debug at 0. It's not clear yet what needs to happen - for the others. */ - .debug 0 : { *(.debug) } - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_sfnames 0 : { *(.debug_sfnames) } - .line 0 : { *(.line) } - /* These must appear regardless of . */ -} diff --git a/boot/mach-crt0.c b/boot/mach-crt0.c deleted file mode 100644 index 0469424e..00000000 --- a/boot/mach-crt0.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms are permitted - * provided that: (1) source distributions retain this entire copyright - * notice and comment, and (2) distributions including binaries display - * the following acknowledgement: ``This product includes software - * developed by the University of California, Berkeley and its contributors'' - * in the documentation or other materials provided with the distribution - * and in all advertising materials mentioning features or use of this - * software. Neither the name of the University nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef lint -static char sccsid[] = "@(#)crt0.c 5.2 (Berkeley) 5/14/90"; -#endif /* not lint */ - -/* - * C start up routine. - * Robert Henry, UCB, 20 Oct 81 - * - * We make the following (true) assumptions: - * 1) when the kernel calls start, it does a jump to location 2, - * and thus avoids the register save mask. We are NOT called - * with a calls! see sys1.c:setregs(). - * 2) The only register variable that we can trust is sp, - * which points to the base of the kernel calling frame. - * Do NOT believe the documentation in exec(2) regarding the - * values of fp and ap. - * 3) We can allocate as many register variables as we want, - * and don't have to save them for anybody. - * 4) Because of the ways that asm's work, we can't have - * any automatic variables allocated on the stack, because - * we must catch the value of sp before any automatics are - * allocated. - */ - -#include <mach/machine/asm.h> - -int __data_start = 0; -char **environ = (char **)0; -#ifdef paranoid -static int fd; -#endif paranoid - -int (*mach_init_routine)(); -int (*_cthread_init_routine)(); -int (*_cthread_exit_routine)(); -int (*_monstartup_routine)(); -int (*_StrongBox_init_routine)(); -int errno = 0; -int exit(); - -extern int main(); - -extern unsigned char etext; -int _start() -{ - __label__ eprol; - struct kframe { - int kargc; - char *kargv[1]; /* size depends on kargc */ - char kargstr[1]; /* size varies */ - char kenvstr[1]; /* size varies */ - }; - /* - * ALL REGISTER VARIABLES!!! - */ - register struct kframe *kfp; /* r10 */ - register char **targv; - register char **argv; - -#ifdef lint - kfp = 0; - initcode = initcode = 0; -#else not lint -#define Entry_sp() \ -({ int _spl__, _tmp1__; \ - asm volatile("leal 4(%%ebp), %0" : "=r" (_spl__) : "r" (_tmp1__)); \ - _spl__; }) - - kfp = (struct kframe *)Entry_sp(); -#endif not lint - for (argv = targv = &kfp->kargv[0]; *targv++; /* void */) - /* void */ ; - if (targv >= (char **)(*argv)) - --targv; - environ = targv; - if (mach_init_routine) - (void) mach_init_routine(); - - eprol: -#ifdef paranoid - /* - * The standard I/O library assumes that file descriptors 0, 1, and 2 - * are open. If one of these descriptors is closed prior to the start - * of the process, I/O gets very confused. To avoid this problem, we - * insure that the first three file descriptors are open before calling - * main(). Normally this is undefined, as it adds two unnecessary - * system calls. - */ - do { - fd = open("/dev/null", 2); - } while (fd >= 0 && fd < 3); - close(fd); -#endif paranoid - - - if (_cthread_init_routine) { - int new_sp; - new_sp = (*_cthread_init_routine)(); - if (new_sp) { - asm volatile("movl %0, %%esp" : : "g" (new_sp) ); - } - } - if (_StrongBox_init_routine) (*_StrongBox_init_routine)(); - - if (_monstartup_routine) { - _monstartup_routine(&&eprol, &etext); - } - - (* (_cthread_exit_routine ? _cthread_exit_routine : exit)) - (main(kfp->kargc, argv, targv)); -} diff --git a/boot/sigvec.S b/boot/sigvec.S deleted file mode 100644 index cc7bb94e..00000000 --- a/boot/sigvec.S +++ /dev/null @@ -1,23 +0,0 @@ -#include <i386/asm.h> - -.text -ENTRY(sigreturn) - movl $0x67,%eax - lcall $0x7,$0x0 - jb error - ret -ENTRY(_sigreturn) - addl $0xc,%esp - call EXT(sigreturn) - ret -ENTRY(sigvec) - movl $0x6c,%eax - movl $EXT(_sigreturn),%edx - orl $0x80000000,%edx - lcall $0x7,$0x0 - jb error - ret -error: - movl %eax,EXT(errno) - movl $-1,%eax - ret diff --git a/boot/syscall.S b/boot/syscall.S deleted file mode 100644 index a04ab28d..00000000 --- a/boot/syscall.S +++ /dev/null @@ -1,35 +0,0 @@ -/* Temporary.... - Copyright (C) 1993, 1995 Free Software Foundation - -This file is part of the GNU Hurd. - -The GNU Hurd is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -The GNU Hurd is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with the GNU Hurd; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include <i386/asm.h> - -/* .globl EXT(errno)*/ -.text -ENTRY(syscall) - pop %ecx - pop %eax - push %ecx - lcall $7, $0 - push %ecx /* Restore stack position. */ - jb error - ret -error: - movl %eax,EXT(errno) - movl $-1,%eax - ret diff --git a/boot/ux.c b/boot/ux.c deleted file mode 100644 index 7239762c..00000000 --- a/boot/ux.c +++ /dev/null @@ -1,303 +0,0 @@ -/* Hacks to make boot work under UX - - Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - - This file is part of the GNU Hurd. - - The GNU Hurd is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - The GNU Hurd is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the GNU Hurd; see the file COPYING. If not, write to - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include <mach.h> -#include <sys/types.h> -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <pthread.h> - -#include "ux.h" - -#if 0 -static int (* const _sc)(int, ...) = &syscall; -int _sc_print = 1; - -#define syscall(num, args...) \ - ({ int _rv, _num = (num), _pr = _sc_print; \ - _sc_print = 0; \ - if (_pr) printf ("syscall (%d) start\r\n", _num); \ - _rv = (*_sc) (_num , ##args); \ - if (_pr) printf ("syscall (%d) end\r\n", _num); \ - _sc_print = _pr; \ - _rv; \ - }) -#endif - -extern void __mach_init (); -void (*mach_init_routine)() = __mach_init; - -/* These will prevent the Hurd-ish versions from being used */ - -struct free_reply_port -{ - mach_port_t port; - struct free_reply_port *next; -}; -static struct free_reply_port *free_reply_ports = NULL; -static pthread_spinlock_t free_reply_ports_lock = PTHREAD_SPINLOCK_INITIALIZER; - -mach_port_t __mig_get_reply_port () -{ - pthread_spin_lock (&free_reply_ports_lock); - if (free_reply_ports == NULL) - { - pthread_spin_unlock (&free_reply_ports_lock); - return __mach_reply_port (); - } - else - { - struct free_reply_port *frp = free_reply_ports; - mach_port_t reply_port = frp->port; - free_reply_ports = free_reply_ports->next; - pthread_spin_unlock (&free_reply_ports_lock); - free (frp); - return reply_port; - } -} -mach_port_t mig_get_reply_port () -{ - return __mig_get_reply_port (); -} -void __mig_put_reply_port (mach_port_t port) -{ - struct free_reply_port *frp = malloc (sizeof (struct free_reply_port)); - frp->port = port; - pthread_spin_lock (&free_reply_ports_lock); - frp->next = free_reply_ports; - free_reply_ports = frp; - pthread_spin_unlock (&free_reply_ports_lock); -} -void mig_put_reply_port (mach_port_t port) -{ - __mig_put_reply_port (port); -} -void __mig_dealloc_reply_port (mach_port_t port) -{ - mach_port_mod_refs (__mach_task_self (), port, - MACH_PORT_RIGHT_RECEIVE, -1); -} -void mig_dealloc_reply_port (mach_port_t port) -{ - __mig_dealloc_reply_port (port); -} -void __mig_init (void *stack) {} -void mig_init (void *stack) {} - -int -task_by_pid (int pid) -{ - return syscall (-33, pid); -} - -int -write (int fd, - const void *buf, - int buflen) -{ - return syscall (4, fd, buf, buflen); -} - -int -read (int fd, - void *buf, - int buflen) -{ - return syscall (3, fd, buf, buflen); -} - -int -open (const char *name, - int flags, - int mode) -{ - return syscall (5, name, flags, mode); -} - -int -uxfstat (int fd, struct uxstat *buf) -{ - return syscall (62, fd, buf); -} - -int -close (int fd) -{ - return syscall (6, fd); -} - -int -lseek (int fd, - int off, - int whence) -{ - return syscall (19, fd, off, whence); -} - -int -uxexit (int code) -{ - return syscall (1, code); -} - -int -getpid () -{ - return syscall (20); -} - -int -ioctl (int fd, int code, void *buf) -{ - return syscall (54, fd, code, buf); -} - -int -sigblock (int mask) -{ - return syscall (109, mask); -} - -int -sigsetmask (int mask) -{ - return syscall (110, mask); -} - -int -sigpause (int mask) -{ - return syscall (111, mask); -} - - -#if 0 -void -sigreturn () -{ - asm volatile ("movl $0x67,%eax\n" - "lcall $0x7, $0x0\n" - "ret"); -} - -void -_sigreturn () -{ - asm volatile ("addl $0xc, %%esp\n" - "call %0\n" - "ret"::"m" (sigreturn)); -} - -int -sigvec (int sig, struct sigvec *vec, struct sigvec *ovec) -{ - asm volatile ("movl $0x6c,%%eax\n" - "movl %0, %%edx\n" - "orl $0x80000000, %%edx\n" - "lcall $0x7,$0x0\n" - "ret"::"g" (_sigreturn)); -} -#else -int sigvec (); -#endif - -void get_privileged_ports (mach_port_t *host_port, mach_port_t *device_port) -{ - *host_port = task_by_pid (-1); - *device_port = task_by_pid (-2); -} - -/* A *really* stupid printf that only understands %s & %d. */ -int -printf (const char *fmt, ...) -{ - va_list ap; - const char *p = fmt, *q = p; - - void flush (const char *new) - { - if (p > q) - write (1, q, p - q); - q = p = new; - } - - va_start (ap, fmt); - while (*p) - if (*p == '%' && p[1] == 's') - { - char *str = va_arg (ap, char *); - flush (p + 2); - write (1, str, strlen (str)); - } - else if (*p == '%' && p[1] == 'd') - { - int i = va_arg (ap, int); - char rbuf[20], *e = rbuf + sizeof (rbuf), *b = e; - - if (i == 0) - *--b = '0'; - else - while (i) - { - *--b = i % 10 + '0'; - i /= 10; - } - - flush (p + 2); - write (1, b, e - b); - } - else - p++; - va_end (ap); - - flush (0); - - return 0; -} - -static struct sgttyb term_sgb; -static int localbits; - -void -init_termstate () -{ - struct sgttyb sgb; - int bits; - ioctl (0, TIOCGETP, &term_sgb); - ioctl (0, TIOCLGET, &localbits); - /* Enter raw made. Rather than try and interpret these bits, - we just do what emacs does in .../emacs/src/sysdep.c for - an old style terminal driver. */ - bits = localbits | LDECCTQ | LLITOUT | LPASS8 | LNOFLSH; - ioctl (0, TIOCLSET, &bits); - sgb = term_sgb; - sgb.sg_flags &= ~ECHO; - sgb.sg_flags |= RAW | ANYP; - ioctl (0, TIOCSETN, &sgb); -} - -void -restore_termstate () -{ - ioctl (0, TIOCLSET, &localbits); - ioctl (0, TIOCSETN, &term_sgb); -} diff --git a/boot/ux.h b/boot/ux.h deleted file mode 100644 index d3787c54..00000000 --- a/boot/ux.h +++ /dev/null @@ -1,114 +0,0 @@ -/* Hacks to make boot work under UX - - Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - - This file is part of the GNU Hurd. - - The GNU Hurd is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - The GNU Hurd is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the GNU Hurd; see the file COPYING. If not, write to - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#define sigmask(m) (1 << ((m)-1)) - -#define IOCPARM_MASK 0x7f -#define IOC_OUT 0x40000000 -#define IOC_IN 0x80000000 -#define _IOR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) -#define _IOW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) -#define FIONREAD _IOR('f', 127, int) -#define FIOASYNC _IOW('f', 125, int) -#define TIOCGETP _IOR('t', 8, struct sgttyb) -#define TIOCLGET _IOR('t', 124, int) -#define TIOCLSET _IOW('t', 125, int) -#define TIOCSETN _IOW('t', 10, struct sgttyb) -#define LDECCTQ 0x4000 -#define LLITOUT 0x0020 -#define LPASS8 0x0800 -#define LNOFLSH 0x8000 -#define RAW 0x0020 -#define ANYP 0x00c0 -#define ECHO 8 - - -struct sgttyb -{ - char unused[4]; - short sg_flags; -}; - -#define SIGIO 23 - -struct sigvec -{ - void (*sv_handler)(); - int sv_mask; - int sv_flags; -}; - -struct uxstat - { - short int st_dev; /* Device containing the file. */ - __ino_t st_ino; /* File serial number. */ - unsigned short int st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - unsigned short int st_uid; /* User ID of the file's owner. */ - unsigned short int st_gid; /* Group ID of the file's group.*/ - short int st_rdev; /* Device number, if device. */ - __off_t st_size; /* Size of file, in bytes. */ - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atime_usec; - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtime_usec; - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctime_usec; - unsigned long int st_blksize; /* Optimal block size for I/O. */ - unsigned long int st_blocks; /* Number of 512-byte blocks allocated. */ - long int st_spare[2]; - }; - -void get_privileged_ports (mach_port_t *host_port, mach_port_t *device_port); - -/* We can't include <unistd.h> for this, because that will fight witho - our definitions of syscalls below. */ -int syscall (int, ...); - -int open (const char *name, int flags, int mode); -int write (int fd, const void *buf, int len); -int read (int fd, void *buf, int len); -int uxfstat (int fd, struct uxstat *buf); -int close (int fd); -int lseek (int fd, int off, int whence); -int uxexit (int code); -int getpid (); -int ioctl (int fd, int code, void *buf); -int sigblock (int mask); -int sigsetmask (int mask); -int sigpause (int mask); -int sigvec (int sig, struct sigvec *vec, struct sigvec *ovec); - -#undef O_RDONLY -#undef O_WRONLY -#undef O_RDWR -#define O_RDONLY 0 -#define O_WRONLY 1 -#define O_RDWR 2 - -#define host_exit(c) uxexit(c) - -typedef struct uxstat host_stat_t; -#define host_fstat(fd, st) uxfstat (fd, st) - -void init_stdio (); - -#undef errno -int errno; |