a.out.h

- defines the exec header for a.out files, some macros to access it
and stacktop for a.out files. Can be copied from i386.

atomic.h

- Atomic operations that C can't guarantee us.  Useful for resource
  counting etc..
  defines 
  static __inline__ void atomic_add(int i, volatile atomic_t *v)
  static __inline__ void atomic_sub(int i, volatile atomic_t *v)
  static __inline__ void atomic_inc(volatile atomic_t *v)	     
  static __inline__ void atomic_dec(volatile atomic_t *v)
  static __inline__ int atomic_dec_and_test(volatile atomic_t *v)
  #define atomic_clear_mask(mask, addr)
  #define atomic_set_mask(mask, addr)


bitops.h

- The usual bit operations...
  extern void set_bit(int nr, volatile void * addr);
  extern void clear_bit(int nr, volatile void * addr);	
  extern void change_bit(int nr, volatile void * addr);
  extern int test_and_set_bit(int nr, volatile void * addr);
  extern int test_and_clear_bit(int nr, volatile void * addr);
  extern int test_and_change_bit(int nr, volatile void * addr);
  extern int __constant_test_bit(int nr, const volatile void * addr);
  extern int __test_bit(int nr, volatile void * addr);
  extern int find_first_zero_bit(void * addr, unsigned size);
  extern int find_next_zero_bit (void * addr, int size, int offset);
  extern unsigned long ffz(unsigned long word);


boot.h

-  some constants used to boot the system (arch/i386/boot/setup.S)


bugs.h

    This is included by init/main.c to check for architecture-dependent bugs.

    Defines:

       static void check_bugs(void);

       Called at kernel initialization; should check for processor
       bugs and set global variables associated with them.

byteorder.h



cache.h

    Some definitions to allow for creation of cache friendly data structures

checksum.h

    Compute several TCP/IP checksums. We have to adapt them for
    L4/Linux (see versions for L4Linux 2.0)


cobalt.h

    Some definitions for cobalt specific hardware

current.h

    Definition of current. It is basically an inline assembly function
    that computes current based on the current stack pointer, since
    stack and tcb are allocated together (8 KBzte) with the stack
    growing towards the tcb.

debugreg.h

    Support for debug registers on i386. Since there is currently no
    support for debug registers on L4/x86 there is no need for
    debugreg.h.

delay.h

    Delay routines calling functions in arch/i386/lib/delay.c

desc.h

    Definitions for descriptor structures for x86 (do we need these? I
    don't think so)

dma.h

    dma support for x86. can be copied for L4linux (how do we handle
    spin_locks?)


elf.h

    Support for ELF binary format (register definitions, core dump
    support, ...)


errno.h

    error definitions

fcntl.h

    definitions and structures for fcntl, can be copied

fixmap.h

    Some support for mapping special areas to wellknown
    addresses. Don't know wether we need this... Currently used by
    kernel/smp.c and kernel/io_apic.c


floppy.h

    floppy support, can be copied

hardirq.h
    
    some irq related definitions

    - Are we in an interrupt context? Either doing bottom half or
      hardware interrupt processing?

      #define in_interrupt() ...

      some definitions to aquire and release irq-locks (used by
      kernel/softirq.c)

      #define hardirq_trylock(cpu)	(local_irq_count[cpu] == 0)
      #define hardirq_endlock(cpu)	do { } while (0)
  
      #define hardirq_enter(cpu)	(local_irq_count[cpu]++)
      #define hardirq_exit(cpu)	(local_irq_count[cpu]--)

      #define synchronize_irq() barrier()


i82489.h

    definitions for programming the apic (should not be used by L4Linux)
	     
ide.h

    Definitions and functions for programming the ide controller on
    x86. Should be copied (same like floppy.h)

init.h

    some special magic to place init functions and init data in a
    special segment that can be discarded after finishing the
    initialization of the kernel (init_func, init_data)

io.h

    This file contains the definitions for the x86 IO instructions
    inb/inw/inl/outb/outw/outl and the "string versions" of the same
    (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
    versions of the single-IO instructions (inb_p/inw_p/..).

ioctl.h

    copy for L4Linux

ioctls.h

    copy for L4Linux

ipc.h

    definitions for sysv ipc, copy

irq.h

    static __inline__ int irq_cannonicalize(int irq)
    {
	return ((irq == 2) ? 9 : irq);
    }

    extern void disable_irq(unsigned int);
    extern void enable_irq(unsigned int);

keyboard.h

    keyboard related functions, copy

ldt.h

    ldt related definitions, since we don't have ldt's on L4 we can't
    support these.

linux_logo.h

    ???

lithium.h

    special hardware used on sgi, ignore

locks.h

    currently not used (at least grep told me so :)
    
math_emu.h

    Data structures for math emulation. Since we are running on
    processors with math coprocessor we don't need these.

mca_dma.h

    micro channel related stuff, ignore

md.h

    copy

mman.h

    memory management attributes, copy

mmu_context.h

    definitions for mmu_contexts, copy

mtrr.h

    handling of memory type range registers. These registers are
    priveledged resources and can only be accessed in supervisor
    mode. Since L4 doesn't support access to mtrr, we have to ignore
    them.
 
namei.h

    basically empty, just copy

page.h

    Now the interesting stuff :)


       #define PAGE_SHIFT      12
       #define PAGE_SIZE       (1UL << PAGE_SHIFT)
       #define PAGE_MASK       (~(PAGE_SIZE-1))

       typedef ... pte_t;
       typedef ... pmd_t;
       typedef ... pgd_t;
       typedef ... pgprot_t;

    Typedefs for hardware data structures: page table entry, page
    mid-level directory entry, page directory entry, page protection
    flags. There are actually to different defintions you can choose
    from. One uses structures to allow for aggressive type checking
    the other uses simple longs to make it easier for the
    compiler. The default definition uses structures.

       #define pte_val(x)      ...
       #define pmd_val(x)      ...
       #define pgd_val(x)      ...
       #define pgprot_val(x)   ..

    Access functions for the above types depending on the definition
    of the types. (This allows to implement type checks.)

       #define __pte(x)        ...
       #define __pgd(x)        ...
       #define __pgprot(x)     ...

    These macros cast a value to a given type depending on the used
    defintions.

       #define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)

    To align the pointer to the (next) page boundary.


	 #define __PAGE_OFFSET		(0xC0000000)

	 #define PAGE_OFFSET		((unsigned long)__PAGE_OFFSET)
	 #define __pa(x)			((unsigned long)(x)-PAGE_OFFSET)
	 #define __va(x)			((void *)((unsigned long)(x)+PAGE_OFFSET))
	 #define MAP_NR(addr)		(__pa(addr) >> PAGE_SHIFT)

    This handles subscripting the memory map array mem_map[] (defined
    in <linux/mm.h>). Since we are using a different memory layout on
    L4Linux we have to adjust them (and arch/i386/vmlinux.lds which
    uses the same constants).


param.h

    Some parameter definitions like HZ

pgtable.h

    memory management definitions regarding page tables

    cache flushing
    tlb flushing
    pte manpulations
    definition of three level page tables
    pgd entries used up by user/kernel
    definitions for vmalloc 
    page table attributes
    attribute manipulations
    page directory manipulations
    page table allocation/deallocation/caching


poll.h

    copy 

posix_types.h

    copy

processor.h

    some processor sepcific data structures and functions
    relevant:
	#define TASK_SIZE	(PAGE_OFFSET)

		size of user address space

	struct thread_struct {...}  
	       
	       thread structure, contains the necessary information
	       about a thread, can be reduced (see L4Linux 2.0)

	#define INIT_MMAP
	#define INIT_TSS 
	#define start_thread(regs, new_eip, new_esp)
	extern void release_thread(struct task_struct *);
	extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
	extern struct task_struct * alloc_task_struct(void);
	extern void free_task_struct(struct task_struct *);

ptrace.h

    /* this struct defines the way the registers are stored on the 
       stack during a system call. */

       struct pt_regs { ... }
       #define user_mode(regs) ((VM_MASK & (regs)->eflags) || (3 & (regs)->xcs))
       #define instruction_pointer(regs) ((regs)->eip)

resource.h

	definitions for ressource limits, copy
    
scatterlist.h
	
	definitions for scatter/gather operations of disk controllers, copy

segment.h
	
	definitions of user and kernel segments, copy or discard (mips
	says: /* Only here because we have some old header files that
	expect it.. */ )

semaphore.h

	SMP- and interrupt-safe semaphores..
	needs to be adjusted (together with spinlock.h)

serial.h
	definitions for serial ports, copy


shmparam.h
	definition of shared memorz parameters, copy

sigcontext.h
	Definition of signal context (structure that the kernel puts
	on top of the user stack before delivering a signal). 
	Adjust (floating point information). 
	There seems to be a bug in L4Linux 2.0. It doesn't store the
	floating point context on the stack and therefore can't
	restore it after returning from a signal.

siginfo.h
	siginfo stuff, copy

signal.h
	definitions for signal handling (signal numbers, signal
	structures, some functions, like sigaddset, sigdelset and
	other), copy
 
smp.h
	lots of smp stuff, I think, we need at least something
	smp_processor_id(), cpu_logical_map()... see linux/smp.h

smplock.h
	i386 SMP lock implementation
	/*
	 * Release global kernel lock and global interrupt lock
 	 */
	#define release_kernel_lock(task, cpu)
	/*
	 * Re-acquire the kernel lock
 	 */
	#define reacquire_kernel_lock(task) 
	/*
	 * Getting the big kernel lock.
	 *
	 * This cannot happen asynchronously,
	 * so we only need to worry about other
	 * CPU's.
	 */
	extern __inline__ void lock_kernel(void)
	extern __inline__ void unlock_kernel(void)
	
socket.h

	abi definitions, copy

sockios.h

	abi definitions, copy
	
softirq.h

	bottom half stuff, contains functions to enabe/disable bottom halfs
		extern inline void disable_bh(int nr);
		extern inline void enable_bh(int nr);
	start and stop bottom halfs, softirq_trylock, softirq_endlock
	(ensure that only one processors executes bottom halfs)
		extern inline void start_bh_atomic(void)
		extern inline void end_bh_atomic(void)
		#define softirq_trylock(cpu)
		#define softirq_endlock(cpu)
		#define synchronize_bh()

spinlock.h

	spin locks, read/write locks

	initialize the lock
		#define spin_lock_init(lock)		
	the usual
		#define spin_lock(lock)		
	try to aquire the lock; returns true, if successfull
		#define spin_trylock(lock)	
	wait for the lock to become free
		#define spin_unlock_wait(lock)	do { } while(0)
	the usual
		#define spin_unlock(lock)	do { } while(0)
	same like spin_lock, but disables interrupts for the local cpu
		#define spin_lock_irq(lock)	cli()
	same as normal unlock and enables interrupts again
		#define spin_unlock_irq(lock)	sti()

	same as *lock_irq and saves/restores flags into/from flags
		#define spin_lock_irqsave(lock, flags) 
		#define spin_unlock_irqrestore(lock, flags) 

	and the read/write lock (irq and irqsave mean the same like in
	the spin lock case)

	#define read_lock(lock)
	#define read_unlock(lock)
	#define write_lock(lock)
	#define write_unlock(lock)
	#define read_lock_irq(lock)
	#define read_unlock_irq(lock)
	#define write_lock_irq(lock)
	#define write_unlock_irq(lock)
	
	#define read_lock_irqsave(lock, flags)
	#define read_unlock_irqrestore(lock, flags)
	#define write_lock_irqsave(lock, flags)
	#define write_unlock_irqrestore(lock, flags)

stat.h

	abi definition, copy

statfs.h

	abi definition, copy


string-486.h

	some helper functions (string routines for i486)

string.h

	some helper functions (string routines for i486)

system.h

	the system specific implementations for
	task switching
		#define switch_to(prev,next)
	xchg, tas, nop;
	barriers to force ordering of cpu instructions (common
	barrier, read barrier, write barrier, anybody using rmb, wmb?);
		#define mb()
		#define rmb()
		#define wmb()
	primitives to implement critical regions (at some points it is
	really necessary to disable interrupts -- cli=clear interrupt
	flag; disable interrupts)
		cli - begin critical region
		sti - end critical region
		save_flags - save current state with respect to critical 
				regions
		restore_flags - restore previous state

termbits.h

	abi definition, copy

termios.h

	abi definition, copy

timex.h
	get_cycles() - read the processor cycle counter, used to
	implement time in the kernel

types.h

	some type definitions, copy
	
uaccess.h
	
	definitions of kernel segments, access checks

 * The fs value determines whether argument validity checking should be
 * performed or not.  If get_fs() == USER_DS, checking is performed, with
 * get_fs() == KERNEL_DS, checking is bypassed.
 *
 * For historical reasons, these macros are grossly misnamed.

	KERNEL_DS, USER_DS, get_ds(), get_fs(), set_fs()

	check whether access is ok or not (basically check address and
	size against the user address limit)
	
		access_ok()
	
	User space memory access functions (the __* version don't call
	access_ok before copying)
	
	put_user(), get_user(), copy_to_user(), copy_from_user()
	strncpy_from_user(), __strncpy_from_user(), strlen_user(),
	clear_user(), __clear_user();


ucontext.h

	abi definition, copy

unaligned.h

	handle unaligned data

unistd.h

	abi definition, copy

user.h

	abi definition, copy (core file format)

vga.h

	access to vga hardware, copy

vm86.h

	vm86, since l4 doesn't not know about virtual x86 mode we
	can't implement this.
