diff options
Diffstat (limited to 'i386')
-rw-r--r-- | i386/include/mach/i386/bios.h | 64 | ||||
-rw-r--r-- | i386/include/mach/i386/code16.h | 29 | ||||
-rw-r--r-- | i386/include/mach/i386/debug_reg.h | 196 | ||||
-rw-r--r-- | i386/include/mach/i386/dpmi.h | 537 | ||||
-rw-r--r-- | i386/include/mach/i386/far_ptr.h | 35 | ||||
-rw-r--r-- | i386/include/mach/i386/paging.h | 134 | ||||
-rw-r--r-- | i386/include/mach/i386/pio.h | 70 | ||||
-rw-r--r-- | i386/include/mach/i386/pmode.h | 93 | ||||
-rw-r--r-- | i386/include/mach/i386/proc_reg.h | 340 | ||||
-rw-r--r-- | i386/include/mach/i386/seg.h | 190 | ||||
-rw-r--r-- | i386/include/mach/i386/time_stamp.h | 29 | ||||
-rw-r--r-- | i386/include/mach/i386/tss.h | 67 | ||||
-rw-r--r-- | i386/include/mach/i386/vcpi.h | 37 |
13 files changed, 0 insertions, 1821 deletions
diff --git a/i386/include/mach/i386/bios.h b/i386/include/mach/i386/bios.h deleted file mode 100644 index 6ad4445..0000000 --- a/i386/include/mach/i386/bios.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1994 The University of Utah and - * the Computer Systems Laboratory at the University of Utah (CSL). - * All rights reserved. - * - * Permission to use, copy, modify and distribute this software is hereby - * granted provided that (1) source code retains these copyright, permission, - * and disclaimer notices, and (2) redistributions including binaries - * reproduce the notices in supporting documentation, and (3) all advertising - * materials mentioning features or use of this software display the following - * acknowledgement: ``This product includes software developed by the - * Computer Systems Laboratory at the University of Utah.'' - * - * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSL requests users of this software to return to csl-dist@cs.utah.edu any - * improvements that they make and grant CSL redistribution rights. - * - * Author: Bryan Ford, University of Utah CSL - */ - -#ifndef _MACH_MACHINE_BIOS_ -#define _MACH_MACHINE_BIOS_ - -/* - * To make a call to a 16-bit BIOS entrypoint, - * fill in one of these structures and call bios_call(). - */ -struct bios_call_params -{ - union - { - struct - { - unsigned short ax; - unsigned short bx; - unsigned short cx; - unsigned short dx; - } w; - struct - { - unsigned char al; - unsigned char ah; - unsigned char bl; - unsigned char bh; - unsigned char cl; - unsigned char ch; - unsigned char dl; - unsigned char dh; - } b; - } u; - unsigned short si; - unsigned short di; - unsigned short bp; - unsigned short ds; - unsigned short es; - unsigned short flags; -}; - -void bios_call(unsigned char int_num, struct bios_call_params *bcp); - -#endif _MACH_MACHINE_BIOS_ diff --git a/i386/include/mach/i386/code16.h b/i386/include/mach/i386/code16.h deleted file mode 100644 index 7bc2dc1..0000000 --- a/i386/include/mach/i386/code16.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 1994 The University of Utah and - * the Center for Software Science (CSS). 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. - * - * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSS requests users of this software to return to css-dist@cs.utah.edu any - * improvements that they make and grant CSS redistribution rights. - * - * Author: Bryan Ford, University of Utah CSS - */ -#ifndef _MACH_I386_CODE16_H_ -#define _MACH_I386_CODE16_H_ - -/* Switch GAS into 16-bit mode. */ -#define CODE16 asm(".code16"); - -/* Switch back to 32-bit mode. */ -#define CODE32 asm(".code32"); - -#endif _MACH_I386_CODE16_H_ diff --git a/i386/include/mach/i386/debug_reg.h b/i386/include/mach/i386/debug_reg.h deleted file mode 100644 index ab4293a..0000000 --- a/i386/include/mach/i386/debug_reg.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 1995 The University of Utah and - * the Computer Systems Laboratory at the University of Utah (CSL). - * All rights reserved. - * - * Permission to use, copy, modify and distribute this software is hereby - * granted provided that (1) source code retains these copyright, permission, - * and disclaimer notices, and (2) redistributions including binaries - * reproduce the notices in supporting documentation, and (3) all advertising - * materials mentioning features or use of this software display the following - * acknowledgement: ``This product includes software developed by the - * Computer Systems Laboratory at the University of Utah.'' - * - * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSL requests users of this software to return to csl-dist@cs.utah.edu any - * improvements that they make and grant CSL redistribution rights. - * - * Author: Bryan Ford, University of Utah CSL - */ -#ifndef _MACH_I386_DEBUG_REG_H_ -#define _MACH_I386_DEBUG_REG_H_ - -/* Bits in DR7 - debug control register */ -#define DR7_LEN3 0xc0000000 -#define DR7_RW3 0x30000000 -#define DR7_LEN2 0x0c000000 -#define DR7_RW2 0x03000000 -#define DR7_LEN1 0x00c00000 -#define DR7_RW1 0x00300000 -#define DR7_LEN0 0x000c0000 -#define DR7_RW0 0x00030000 -#define DR7_GD 0x00002000 -#define DR7_GE 0x00000200 -#define DR7_LE 0x00000100 -#define DR7_G3 0x00000080 -#define DR7_L3 0x00000040 -#define DR7_G2 0x00000020 -#define DR7_L2 0x00000010 -#define DR7_G1 0x00000008 -#define DR7_L1 0x00000004 -#define DR7_G0 0x00000002 -#define DR7_L0 0x00000001 - -/* Shift values for multibit fields in DR7 */ -#define DR7_LEN3_SHIFT 30 -#define DR7_RW3_SHIFT 28 -#define DR7_LEN2_SHIFT 26 -#define DR7_RW2_SHIFT 24 -#define DR7_LEN1_SHIFT 22 -#define DR7_RW1_SHIFT 20 -#define DR7_LEN0_SHIFT 18 -#define DR7_RW0_SHIFT 16 - -/* Values for LEN fields in DR7 */ -#define DR7_LEN_1 0 -#define DR7_LEN_2 1 -#define DR7_LEN_4 3 - -/* Values for RW fields in DR7 */ -#define DR7_RW_INST 0 /* Break on instruction execution */ -#define DR7_RW_WRITE 1 /* Break on data writes */ -#define DR7_RW_IO 2 /* Break on I/O reads and writes (Pentium only) */ -#define DR7_RW_DATA 3 /* Break on data reads and writes */ - - -/* Bits in DR6 - debug status register */ -#define DR6_BT 0x00008000 -#define DR6_BS 0x00004000 -#define DR6_BD 0x00002000 -#define DR6_B3 0x00000008 -#define DR6_B2 0x00000004 -#define DR6_B1 0x00000002 -#define DR6_B0 0x00000001 - - -#include <mach/inline.h> - -/* Functions to set debug registers. */ - -MACH_INLINE unsigned get_dr0() -{ - unsigned val; - asm volatile("movl %%dr0,%0" : "=r" (val)); - return val; -} - -MACH_INLINE unsigned get_dr1() -{ - unsigned val; - asm volatile("movl %%dr1,%0" : "=r" (val)); - return val; -} - -MACH_INLINE unsigned get_dr2() -{ - unsigned val; - asm volatile("movl %%dr2,%0" : "=r" (val)); - return val; -} - -MACH_INLINE unsigned get_dr3() -{ - unsigned val; - asm volatile("movl %%dr3,%0" : "=r" (val)); - return val; -} - -MACH_INLINE unsigned get_dr6() -{ - unsigned val; - asm volatile("movl %%dr6,%0" : "=r" (val)); - return val; -} - -MACH_INLINE unsigned get_dr7() -{ - unsigned val; - asm volatile("movl %%dr7,%0" : "=r" (val)); - return val; -} - -MACH_INLINE void set_dr0(unsigned val) -{ - asm volatile("movl %0,%%dr0" : : "r" (val)); -} - - -/* Functions to read debug registers. */ - -MACH_INLINE void set_dr1(unsigned val) -{ - asm volatile("movl %0,%%dr1" : : "r" (val)); -} - -MACH_INLINE void set_dr2(unsigned val) -{ - asm volatile("movl %0,%%dr2" : : "r" (val)); -} - -MACH_INLINE void set_dr3(unsigned val) -{ - asm volatile("movl %0,%%dr3" : : "r" (val)); -} - -MACH_INLINE void set_dr6(unsigned val) -{ - asm volatile("movl %0,%%dr6" : : "r" (val)); -} - -MACH_INLINE void set_dr7(unsigned val) -{ - asm volatile("movl %0,%%dr7" : : "r" (val)); -} - - -/* Functions to set global breakpoints. */ - -MACH_INLINE void set_b0(unsigned addr, unsigned len, unsigned rw) -{ - set_dr0(addr); - addr = ((get_dr7() & ~(DR7_LEN0 | DR7_RW0)) - | (len << DR7_LEN0_SHIFT) | (rw << DR7_RW0_SHIFT) - | DR7_GE | DR7_G0); - set_dr7(addr); -} - -MACH_INLINE void set_b1(unsigned addr, unsigned len, unsigned rw) -{ - set_dr1(addr); - set_dr7((get_dr7() & ~(DR7_LEN1 | DR7_RW1)) - | (len << DR7_LEN1_SHIFT) | (rw << DR7_RW1_SHIFT) - | DR7_GE | DR7_G1); -} - -MACH_INLINE void set_b2(unsigned addr, unsigned len, unsigned rw) -{ - set_dr2(addr); - set_dr7((get_dr7() & ~(DR7_LEN2 | DR7_RW2)) - | (len << DR7_LEN2_SHIFT) | (rw << DR7_RW2_SHIFT) - | DR7_GE | DR7_G2); -} - -MACH_INLINE void set_b3(unsigned addr, unsigned len, unsigned rw) -{ - set_dr3(addr); - set_dr7((get_dr7() & ~(DR7_LEN3 | DR7_RW3)) - | (len << DR7_LEN3_SHIFT) | (rw << DR7_RW3_SHIFT) - | DR7_GE | DR7_G3); -} - - - -#endif /* _MACH_I386_DEBUG_REG_H_ */ diff --git a/i386/include/mach/i386/dpmi.h b/i386/include/mach/i386/dpmi.h deleted file mode 100644 index 51a638c..0000000 --- a/i386/include/mach/i386/dpmi.h +++ /dev/null @@ -1,537 +0,0 @@ -/* - * Copyright (c) 1996-1994 The University of Utah and - * the Computer Systems Laboratory at the University of Utah (CSL). - * All rights reserved. - * - * Permission to use, copy, modify and distribute this software is hereby - * granted provided that (1) source code retains these copyright, permission, - * and disclaimer notices, and (2) redistributions including binaries - * reproduce the notices in supporting documentation, and (3) all advertising - * materials mentioning features or use of this software display the following - * acknowledgement: ``This product includes software developed by the - * Computer Systems Laboratory at the University of Utah.'' - * - * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSL requests users of this software to return to csl-dist@cs.utah.edu any - * improvements that they make and grant CSL redistribution rights. - * - * Author: Bryan Ford, University of Utah CSL - */ -#ifndef _FLUX_KERNEL_I386_DOS_I16_DPMI_H_ -#define _FLUX_KERNEL_I386_DOS_I16_DPMI_H_ - -#include <mach/inline.h> -#include <mach/machine/seg.h> - -typedef unsigned short dpmi_error_t; - -#define DPMI_UNSUPPORTED_FUNCTION 0x8001 -#define DPMI_OBJECT_WRONG_STATE 0x8002 -#define DPMI_SYSTEM_INTEGRITY 0x8003 -#define DPMI_DEADLOCK 0x8004 -#define DPMI_SERIALIZATION_CANCELLED 0x8005 -#define DPMI_OUT_OF_RESOURCES 0x8010 -#define DPMI_DESCRIPTOR_UNAVAILABLE 0x8011 -#define DPMI_LINEAR_MEMORY_UNAVAILABLE 0x8012 -#define DPMI_PHYSICAL_MEMORY_UNAVAILABLE 0x8013 -#define DPMI_BACKING_STORE_UNAVAILABLE 0x8014 -#define DPMI_CALLBACK_UNAVAILABLE 0x8015 -#define DPMI_HANDLE_UNAVAILABLE 0x8016 -#define DPMI_MAX_LOCK_COUNT_EXCEEDED 0x8017 -#define DPMI_ALREADY_SERIALIZED_EXCLUSIVELY 0x8018 -#define DPMI_ALREADY_SERIALIZED_SHARED 0x8019 -#define DPMI_INVALID_VALUE 0x8021 -#define DPMI_INVALID_SELECTOR 0x8022 -#define DPMI_INVALID_HANDLE 0x8023 -#define DPMI_INVALID_CALLBACK 0x8024 -#define DPMI_INVALID_LINEAR_ADDRESS 0x8025 -#define DPMI_NOT_SUPPORTED_BY_HARDWARE 0x8026 - -struct real_call_data; /*XXX*/ - -MACH_INLINE dpmi_error_t dpmi_switch_to_pmode( - struct far_pointer_16 *pmode_entry_vector, - unsigned short host_data_seg) -{ - dpmi_error_t err; - - asm volatile(" - movw %3,%%es - lcallw %2 - jc 1f - xorw %%ax,%%ax - 1: pushw %%ds - popw %%es - " : "=a" (err) - : "a" (1), - "m" (*pmode_entry_vector), - "rm" (host_data_seg)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_allocate_descriptors( - unsigned short count, - unsigned short *out_selector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - movw %%ax,%1 - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=rm" (*out_selector) - : "a" (0x0000), - "c" (count)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_get_segment_base( - unsigned short selector, - unsigned long *out_base) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - shll $16,%ecx - movw %dx,%cx - 1: - " : "=a" (err), - "=c" (*out_base) - : "a" (0x0006), - "b" (selector) - : "edx"); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_set_segment_base( - unsigned short selector, - unsigned long base) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0007), - "b" (selector), - "c" (base >> 16), - "d" (base)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_set_segment_limit( - unsigned short selector, - unsigned limit) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0008), - "b" (selector), - "c" (limit >> 16), - "d" (limit)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_create_code_segment_alias( - unsigned short code_selector, - unsigned short *out_data_selector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - movw %%ax,%1 - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=rm" (*out_data_selector) - : "a" (0x000a), - "b" (code_selector)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_get_descriptor( - unsigned short selector, - struct i386_descriptor *out_descriptor) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x000b), - "b" (selector), - "D" (out_descriptor)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_set_descriptor( - unsigned short selector, - struct i386_descriptor *descriptor) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x000c), - "b" (selector), - "D" (descriptor)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_allocate_specific_descriptor( - unsigned short selector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x000d), - "b" (selector)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_get_exception_handler( - unsigned char trapno, - struct far_pointer_32 *out_vector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=c" (out_vector->seg), - "=d" (out_vector->ofs) - : "a" (0x0202), - "b" (trapno)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_set_exception_handler( - unsigned char trapno, - struct far_pointer_32 *vector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0203), - "b" (trapno), - "c" (vector->seg), - "d" (vector->ofs)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_get_interrupt_handler( - unsigned char intvec, - struct far_pointer_32 *out_vector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=c" (out_vector->seg), - "=d" (out_vector->ofs) - : "a" (0x0204), - "b" (intvec)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_set_interrupt_handler( - unsigned char intvec, - struct far_pointer_32 *vector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0205), - "b" (intvec), - "c" (vector->seg), - "d" (vector->ofs)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_simulate_real_mode_interrupt( - unsigned char intnum, - struct real_call_data *call_data) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0300), - "b" ((unsigned short)intnum), - "c" (0), - "D" (call_data)); - - return err; -} - -struct dpmi_version_status -{ - unsigned char minor_version; - unsigned char major_version; - unsigned short flags; - unsigned char slave_pic_base; - unsigned char master_pic_base; - unsigned char processor_type; -}; - -MACH_INLINE void dpmi_get_version(struct dpmi_version_status *status) -{ - asm volatile(" - int $0x31 - " : "=a" (*((short*)&status->minor_version)), - "=b" (status->flags), - "=c" (status->processor_type), - "=d" (*((short*)&status->slave_pic_base)) - : "a" (0x0400)); -} - -MACH_INLINE dpmi_error_t dpmi_allocate_memory( - unsigned size, - unsigned *out_linear_addr, - unsigned *out_mem_handle) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - shll $16,%%ebx - movw %%cx,%%bx - shll $16,%%esi - movw %%di,%%si - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=b" (*out_linear_addr), - "=S" (*out_mem_handle) - : "a" (0x0501), - "b" (size >> 16), - "c" (size) - : "ebx", "ecx", "esi", "edi"); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_free_memory( - unsigned mem_handle) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0502), - "S" (mem_handle >> 16), - "D" (mem_handle)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_allocate_linear_memory( - unsigned linear_addr, - unsigned size, - unsigned flags, - unsigned *out_linear_addr, - unsigned *out_mem_handle) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=b" (*out_linear_addr), - "=S" (*out_mem_handle) - : "a" (0x0504), - "b" (linear_addr), - "c" (size), - "d" (flags)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_resize_linear_memory( - unsigned handle, - unsigned new_size, - unsigned flags, - unsigned short *update_selector_array, - unsigned update_selector_count, - unsigned *out_new_linear_addr) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=b" (*out_new_linear_addr) - : "a" (0x0505), - "b" (update_selector_array), - "c" (new_size), - "d" (flags), - "S" (handle), - "D" (update_selector_count)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_map_conventional_memory( - unsigned handle, - vm_offset_t offset, - vm_offset_t low_addr, - vm_size_t page_count) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0509), - "S" (handle), - "b" (offset), - "c" (page_count), - "d" (low_addr)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_lock_linear_region( - vm_offset_t start_la, - vm_size_t size) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0600), - "b" (start_la >> 16), - "c" (start_la), - "S" (size >> 16), - "D" (size)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_unlock_linear_region( - vm_offset_t start_la, - vm_size_t size) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0601), - "b" (start_la >> 16), - "c" (start_la), - "S" (size >> 16), - "D" (size)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_get_page_size( - unsigned *out_page_size) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - shll $16,%%ebx - movw %%cx,%%bx - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=b" (*out_page_size) - : "a" (0x0604) - : "ecx"); - - return err; -} - - -#endif /* _FLUX_KERNEL_I386_DOS_I16_DPMI_H_ */ diff --git a/i386/include/mach/i386/far_ptr.h b/i386/include/mach/i386/far_ptr.h deleted file mode 100644 index e85962d..0000000 --- a/i386/include/mach/i386/far_ptr.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 1994 The University of Utah and - * the Center for Software Science (CSS). 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. - * - * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSS requests users of this software to return to css-dist@cs.utah.edu any - * improvements that they make and grant CSS redistribution rights. - * - * Author: Bryan Ford, University of Utah CSS - */ -#ifndef _MACH_I386_FAR_PTR_H_ -#define _MACH_I386_FAR_PTR_H_ - -struct far_pointer_16 -{ - unsigned short ofs; - unsigned short seg; -}; - -struct far_pointer_32 -{ - unsigned long ofs; - unsigned short seg; -}; - -#endif /* _MACH_I386_FAR_PTR_H_ */ diff --git a/i386/include/mach/i386/paging.h b/i386/include/mach/i386/paging.h deleted file mode 100644 index e24136c..0000000 --- a/i386/include/mach/i386/paging.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989,1988 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. - */ -/* - * Definitions relating to i386 page directories and page tables. - */ -#ifndef _MACH_I386_PAGING_H_ -#define _MACH_I386_PAGING_H_ - - -#define INTEL_OFFMASK 0xfff /* offset within page */ -#define PDESHIFT 22 /* page descriptor shift */ -#define PDEMASK 0x3ff /* mask for page descriptor index */ -#define PTESHIFT 12 /* page table shift */ -#define PTEMASK 0x3ff /* mask for page table index */ - -/* - * Convert linear offset to page descriptor/page table index - */ -#define lin2pdenum(a) (((a) >> PDESHIFT) & PDEMASK) -#define lin2ptenum(a) (((a) >> PTESHIFT) & PTEMASK) - -/* - * Convert page descriptor/page table index to linear address - */ -#define pdenum2lin(a) ((vm_offset_t)(a) << PDESHIFT) -#define ptenum2lin(a) ((vm_offset_t)(a) << PTESHIFT) - -/* - * Number of ptes/pdes in a page table/directory. - */ -#define NPTES (i386_ptob(1)/sizeof(pt_entry_t)) -#define NPDES (i386_ptob(1)/sizeof(pt_entry_t)) - -/* - * Hardware pte bit definitions (to be used directly on the ptes - * without using the bit fields). - */ -#define INTEL_PTE_VALID 0x00000001 -#define INTEL_PTE_WRITE 0x00000002 -#define INTEL_PTE_USER 0x00000004 -#define INTEL_PTE_WTHRU 0x00000008 -#define INTEL_PTE_NCACHE 0x00000010 -#define INTEL_PTE_REF 0x00000020 -#define INTEL_PTE_MOD 0x00000040 -#define INTEL_PTE_AVAIL 0x00000e00 -#define INTEL_PTE_PFN 0xfffff000 - -/* - * Macros to translate between page table entry values - * and physical addresses. - */ -#define pa_to_pte(a) ((a) & INTEL_PTE_PFN) -#define pte_to_pa(p) ((p) & INTEL_PTE_PFN) -#define pte_increment_pa(p) ((p) += INTEL_OFFMASK+1) - - -#ifndef ASSEMBLER - -#include <mach/inline.h> -#include <mach/machine/vm_param.h> -#include <mach/machine/proc_reg.h> - -/* - * i386/i486/i860 Page Table Entry - */ -typedef unsigned int pt_entry_t; -#define PT_ENTRY_NULL ((pt_entry_t *) 0) - - -/* - * Load page directory 'pdir' and turn paging on. - * Assumes that 'pdir' equivalently maps the physical memory - * that contains the currently executing code, - * the currently loaded GDT and IDT, etc. - */ -MACH_INLINE void i386_paging_enable(vm_offset_t pdir) -{ - /* Load the page directory. */ - set_cr3(pdir); - - /* Turn on paging. */ - asm volatile(" - movl %0,%%cr0 - jmp 1f - 1: - " : : "r" (get_cr0() | CR0_PG)); -} - -/* - * Turn paging off. - * Assumes that the currently loaded page directory - * equivalently maps the physical memory - * that contains the currently executing code, - * the currently loaded GDT and IDT, etc. - */ -MACH_INLINE void i386_paging_disable(void) -{ - /* Turn paging off. */ - asm volatile(" - movl %0,%%cr0 - jmp 1f - 1: - " : : "r" (get_cr0() & ~CR0_PG)); - - /* Flush the TLB. */ - set_cr3(0); -} - -#endif /* !ASSEMBLER */ - -#endif _MACH_I386_PAGING_H_ diff --git a/i386/include/mach/i386/pio.h b/i386/include/mach/i386/pio.h deleted file mode 100644 index 06311db..0000000 --- a/i386/include/mach/i386/pio.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990 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. - */ - -#ifndef _MACH_I386_PIO_H_ -#define _MACH_I386_PIO_H_ - -#ifdef __GNUC__ - -#define inl(port) \ -({ unsigned long _tmp__; \ - asm volatile("inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(port))); \ - _tmp__; }) - -#define inw(port) \ -({ unsigned short _tmp__; \ - asm volatile(".byte 0x66; inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(port))); \ - _tmp__; }) - -#define inb(port) \ -({ unsigned char _tmp__; \ - asm volatile("inb %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(port))); \ - _tmp__; }) - - -#define outl(port, val) \ -({ asm volatile("outl %0, %1" : : "a" (val) , "d" ((unsigned short)(port))); }) - - -#define outw(port, val) \ -({asm volatile(".byte 0x66; outl %0, %1" : : "a" ((unsigned short)(val)) , "d" ((unsigned short)(port))); }) - - -#define outb(port, val) \ -({ asm volatile("outb %0, %1" : : "a" ((unsigned char)(val)) , "d" ((unsigned short)(port))); }) - - -/* Inline code works just as well for 16-bit code as for 32-bit. */ -#define i16_inl(port) inl(port) -#define i16_inw(port) inw(port) -#define i16_inb(port) inb(port) -#define i16_outl(port, val) outl(port, val) -#define i16_outw(port, val) outw(port, val) -#define i16_outb(port, val) outb(port, val) - -#endif __GNUC__ - -#endif /* _MACH_I386_PIO_H_ */ diff --git a/i386/include/mach/i386/pmode.h b/i386/include/mach/i386/pmode.h deleted file mode 100644 index 99b7d26..0000000 --- a/i386/include/mach/i386/pmode.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 1994 The University of Utah and - * the Center for Software Science (CSS). 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. - * - * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSS requests users of this software to return to css-dist@cs.utah.edu any - * improvements that they make and grant CSS redistribution rights. - * - * Author: Bryan Ford, University of Utah CSS - */ -#ifndef _MACH_I386_PMODE_H_ -#define _MACH_I386_PMODE_H_ - -#include <mach/inline.h> -#include <mach/macro_help.h> -#include <mach/machine/proc_reg.h> - - - -/* Enter protected mode on i386 machines. - Assumes: - * Running in real mode. - * Interrupts are turned off. - * A20 is enabled (if on a PC). - * A suitable GDT is already loaded. - - You must supply a 16-bit code segment - equivalent to the real-mode code segment currently in use. - - You must reload all segment registers except CS - immediately after invoking this macro. -*/ -#define i16_enter_pmode(prot_cs) \ -MACRO_BEGIN \ - /* Switch to protected mode. */ \ - asm volatile(" - movl %0,%%cr0 - ljmp %1,$1f - 1: - " : : "r" (i16_get_cr0() | CR0_PE), "i" (KERNEL_16_CS)); \ -MACRO_END - - - -/* Leave protected mode and return to real mode. - Assumes: - * Running in protected mode - * Interrupts are turned off. - * Paging is turned off. - * All currently loaded segment registers - contain 16-bit segments with limits of 0xffff. - - You must supply a real-mode code segment - equivalent to the protected-mode code segment currently in use. - - You must reload all segment registers except CS - immediately after invoking this function. -*/ -MACH_INLINE i16_leave_pmode(int real_cs) -{ - /* Switch back to real mode. - Note: switching to the real-mode code segment - _must_ be done with an _immediate_ far jump, - not an indirect far jump. At least on my Am386DX/40, - an indirect far jump leaves the code segment read-only. */ - { - extern unsigned short real_jmp[]; - - real_jmp[3] = real_cs; - asm volatile(" - movl %0,%%cr0 - jmp 1f - 1: - real_jmp: - _real_jmp: - ljmp $0,$1f - 1: - " : : "r" (i16_get_cr0() & ~CR0_PE)); - } -} - - - -#endif _MACH_I386_PMODE_H_ diff --git a/i386/include/mach/i386/proc_reg.h b/i386/include/mach/i386/proc_reg.h deleted file mode 100644 index 20196ed..0000000 --- a/i386/include/mach/i386/proc_reg.h +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990 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. - */ -/* - * Processor registers for i386 and i486. - */ -#ifndef _MACH_I386_PROC_REG_H_ -#define _MACH_I386_PROC_REG_H_ - -/* - * CR0 - */ -#define CR0_PG 0x80000000 /* enable paging */ -#define CR0_CD 0x40000000 /* i486: cache disable */ -#define CR0_NW 0x20000000 /* i486: no write-through */ -#define CR0_AM 0x00040000 /* i486: alignment check mask */ -#define CR0_WP 0x00010000 /* i486: write-protect kernel access */ -#define CR0_NE 0x00000020 /* i486: handle numeric exceptions */ -#define CR0_ET 0x00000010 /* extension type is 80387 */ - /* (not official) */ -#define CR0_TS 0x00000008 /* task switch */ -#define CR0_EM 0x00000004 /* emulate coprocessor */ -#define CR0_MP 0x00000002 /* monitor coprocessor */ -#define CR0_PE 0x00000001 /* enable protected mode */ - -#ifndef ASSEMBLER -#ifdef __GNUC__ - -#include <mach/inline.h> - - -/* Some processors, notably my Am386DX/40, - seem to have some rather subtle pipeline- or timing-related bugs - which case really weird things to happen with pushf's and popf's - that come too close together... */ - -MACH_INLINE unsigned get_eflags() -{ - unsigned eflags; - asm volatile(" - jmp 1f - 1: jmp 1f - 1: jmp 1f - 1: pushf - jmp 1f - 1: jmp 1f - 1: jmp 1f - 1: popl %0" : "=r" (eflags)); - return eflags; -} - -MACH_INLINE void set_eflags(unsigned eflags) -{ - asm volatile(" - pushl %0 - jmp 1f - 1: jmp 1f - 1: jmp 1f - 1: popf - jmp 1f - 1: jmp 1f - 1: jmp 1f - 1: " : : "r" (eflags)); -} - -MACH_INLINE void cli() { asm volatile("cli"); } -MACH_INLINE void sti() { asm volatile("sti"); } -MACH_INLINE void cld() { asm volatile("cld"); } -MACH_INLINE void std() { asm volatile("std"); } -MACH_INLINE void clts() { asm volatile("clts"); } - -MACH_INLINE unsigned short get_cs() -{ - unsigned short cs; - asm volatile("movw %%cs,%w0" : "=r" (cs)); - return cs; -} - -MACH_INLINE unsigned short get_ds() -{ - unsigned short ds; - asm volatile("movw %%ds,%w0" : "=r" (ds)); - return ds; -} -MACH_INLINE void set_ds(unsigned short ds) -{ - asm volatile("movw %w0,%%ds" : : "r" (ds)); -} - -MACH_INLINE unsigned short get_es() -{ - unsigned short es; - asm volatile("movw %%es,%w0" : "=r" (es)); - return es; -} -MACH_INLINE void set_es(unsigned short es) -{ - asm volatile("movw %w0,%%es" : : "r" (es)); -} - -MACH_INLINE unsigned short get_fs() -{ - unsigned short fs; - asm volatile("movw %%fs,%w0" : "=r" (fs)); - return fs; -} -MACH_INLINE void set_fs(unsigned short fs) -{ - asm volatile("movw %w0,%%fs" : : "r" (fs)); -} - -MACH_INLINE unsigned short get_gs() -{ - unsigned short gs; - asm volatile("movw %%gs,%w0" : "=r" (gs)); - return gs; -} -MACH_INLINE void set_gs(unsigned short gs) -{ - asm volatile("movw %w0,%%gs" : : "r" (gs)); -} - -MACH_INLINE unsigned short get_ss() -{ - unsigned short ss; - asm volatile("movw %%ss,%w0" : "=r" (ss)); - return ss; -} -MACH_INLINE void set_ss(unsigned short ss) -{ - asm volatile("movw %w0,%%ss" : : "r" (ss)); -} - -#define get_eax() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%eax, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_ebx() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%ebx, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_ecx() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%ecx, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_edx() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%edx, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_esi() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%esi, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_edi() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%edi, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_ebp() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%ebp, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_esp() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%esp, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_eflags() \ - ({ \ - register unsigned int _temp__; \ - asm volatile("pushf; popl %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_cr0() \ - ({ \ - register unsigned int _temp__; \ - asm volatile("mov %%cr0, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define set_cr0(value) \ - ({ \ - register unsigned int _temp__ = (value); \ - asm volatile("mov %0, %%cr0" : : "r" (_temp__)); \ - }) - -MACH_INLINE unsigned short get_msw() -{ - unsigned short msw; - asm volatile("smsw %0" : "=r" (msw)); - return msw; -} - -#define get_cr2() \ - ({ \ - register unsigned int _temp__; \ - asm("mov %%cr2, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_cr3() \ - ({ \ - register unsigned int _temp__; \ - asm("mov %%cr3, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define set_cr3(value) \ - ({ \ - register unsigned int _temp__ = (value); \ - asm volatile("mov %0, %%cr3" : : "r" (_temp__)); \ - }) - -#define set_ts() \ - set_cr0(get_cr0() | CR0_TS) - -#define clear_ts() \ - asm volatile("clts") - -#define get_tr() \ - ({ \ - unsigned short _seg__; \ - asm volatile("str %0" : "=rm" (_seg__) ); \ - _seg__; \ - }) - -#define set_tr(seg) \ - asm volatile("ltr %0" : : "rm" ((unsigned short)(seg)) ) - -#define set_gdt(pseudo_desc) \ - ({ \ - asm volatile("lgdt %0" : : "m" ((pseudo_desc)->limit)); \ - }) - -#define set_idt(pseudo_desc) \ - ({ \ - asm volatile("lidt %0" : : "m" ((pseudo_desc)->limit)); \ - }) - -#define get_ldt() \ - ({ \ - unsigned short _seg__; \ - asm volatile("sldt %0" : "=rm" (_seg__) ); \ - _seg__; \ - }) - -#define set_ldt(seg) \ - asm volatile("lldt %0" : : "rm" ((unsigned short)(seg)) ) - -/* This doesn't set a processor register, - but it's often used immediately after setting one, - to flush the instruction queue. */ -#define flush_instr_queue() \ - asm volatile(" - jmp 0f - 0: - ") - -/* Inline functions work fine for 16-bit code as well. */ -#ifdef CODE16 -#define i16_get_eflags get_eflags -#define i16_set_eflags set_eflags -#define i16_cli cli -#define i16_sti sti -#define i16_cld cld -#define i16_std std -#define i16_clts clts -#define i16_get_cs get_cs -#define i16_set_cs set_cs -#define i16_get_ds get_ds -#define i16_set_ds set_ds -#define i16_get_es get_es -#define i16_set_es set_es -#define i16_get_fs get_fs -#define i16_set_fs set_fs -#define i16_get_gs get_gs -#define i16_set_gs set_gs -#define i16_get_ss get_ss -#define i16_set_ss set_ss -#define i16_get_cr0 get_cr0 -#define i16_set_cr0 set_cr0 -#define i16_get_cr3 get_cr3 -#define i16_set_cr3 set_cr3 -#define i16_get_msw get_msw -#define i16_set_gdt set_gdt -#define i16_set_idt set_idt -#define i16_set_ldt set_ldt -#define i16_set_tr set_tr -#define i16_flush_instr_queue flush_instr_queue -#endif - -#endif /* __GNUC__ */ -#endif /* ASSEMBLER */ - -#endif /* _MACH_I386_PROC_REG_H_ */ diff --git a/i386/include/mach/i386/seg.h b/i386/include/mach/i386/seg.h deleted file mode 100644 index 31ada9e..0000000 --- a/i386/include/mach/i386/seg.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990 Carnegie Mellon University - * Copyright (c) 1991 IBM Corporation - * 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, - * and that the name IBM not be used in advertising or publicity - * pertaining to distribution of the software without specific, written - * prior permission. - * - * CARNEGIE MELLON AND IBM ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON AND IBM DISCLAIM 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. - */ - -#ifndef _MACH_I386_SEG_H_ -#define _MACH_I386_SEG_H_ - - -/* - * i386 segmentation. - */ - -#ifndef ASSEMBLER - -/* - * Real segment descriptor. - */ -struct i386_descriptor { - unsigned int limit_low:16, /* limit 0..15 */ - base_low:16, /* base 0..15 */ - base_med:8, /* base 16..23 */ - access:8, /* access byte */ - limit_high:4, /* limit 16..19 */ - granularity:4, /* granularity */ - base_high:8; /* base 24..31 */ -}; - -struct i386_gate { - unsigned int offset_low:16, /* offset 0..15 */ - selector:16, - word_count:8, - access:8, - offset_high:16; /* offset 16..31 */ -}; - -#endif !ASSEMBLER - -#define SZ_32 0x4 /* 32-bit segment */ -#define SZ_16 0x0 /* 16-bit segment */ -#define SZ_G 0x8 /* 4K limit field */ - -#define ACC_A 0x01 /* accessed */ -#define ACC_TYPE 0x1e /* type field: */ - -#define ACC_TYPE_SYSTEM 0x00 /* system descriptors: */ - -#define ACC_LDT 0x02 /* LDT */ -#define ACC_CALL_GATE_16 0x04 /* 16-bit call gate */ -#define ACC_TASK_GATE 0x05 /* task gate */ -#define ACC_TSS 0x09 /* task segment */ -#define ACC_CALL_GATE 0x0c /* call gate */ -#define ACC_INTR_GATE 0x0e /* interrupt gate */ -#define ACC_TRAP_GATE 0x0f /* trap gate */ - -#define ACC_TSS_BUSY 0x02 /* task busy */ - -#define ACC_TYPE_USER 0x10 /* user descriptors */ - -#define ACC_DATA 0x10 /* data */ -#define ACC_DATA_W 0x12 /* data, writable */ -#define ACC_DATA_E 0x14 /* data, expand-down */ -#define ACC_DATA_EW 0x16 /* data, expand-down, - writable */ -#define ACC_CODE 0x18 /* code */ -#define ACC_CODE_R 0x1a /* code, readable */ -#define ACC_CODE_C 0x1c /* code, conforming */ -#define ACC_CODE_CR 0x1e /* code, conforming, - readable */ -#define ACC_PL 0x60 /* access rights: */ -#define ACC_PL_K 0x00 /* kernel access only */ -#define ACC_PL_U 0x60 /* user access */ -#define ACC_P 0x80 /* segment present */ - -/* - * Components of a selector - */ -#define SEL_LDT 0x04 /* local selector */ -#define SEL_PL 0x03 /* privilege level: */ -#define SEL_PL_K 0x00 /* kernel selector */ -#define SEL_PL_U 0x03 /* user selector */ - -/* - * Convert selector to descriptor table index. - */ -#define sel_idx(sel) ((sel)>>3) - - -#ifndef ASSEMBLER - -#include <mach/inline.h> - - -/* Format of a "pseudo-descriptor", used for loading the IDT and GDT. */ -struct pseudo_descriptor -{ - short pad; - unsigned short limit; - unsigned long linear_base; -}; - - -/* Fill a segment descriptor. */ -MACH_INLINE void -fill_descriptor(struct i386_descriptor *desc, unsigned base, unsigned limit, - unsigned char access, unsigned char sizebits) -{ - if (limit > 0xfffff) - { - limit >>= 12; - sizebits |= SZ_G; - } - desc->limit_low = limit & 0xffff; - desc->base_low = base & 0xffff; - desc->base_med = (base >> 16) & 0xff; - desc->access = access | ACC_P; - desc->limit_high = limit >> 16; - desc->granularity = sizebits; - desc->base_high = base >> 24; -} - -/* Set the base address in a segment descriptor. */ -MACH_INLINE void -fill_descriptor_base(struct i386_descriptor *desc, unsigned base) -{ - desc->base_low = base & 0xffff; - desc->base_med = (base >> 16) & 0xff; - desc->base_high = base >> 24; -} - -/* Set the limit in a segment descriptor. */ -MACH_INLINE void -fill_descriptor_limit(struct i386_descriptor *desc, unsigned limit) -{ - if (limit > 0xfffff) - { - limit >>= 12; - desc->granularity |= SZ_G; - } - else - desc->granularity &= ~SZ_G; - desc->limit_low = limit & 0xffff; - desc->limit_high = limit >> 16; -} - -/* Fill a gate with particular values. */ -MACH_INLINE void -fill_gate(struct i386_gate *gate, unsigned offset, unsigned short selector, - unsigned char access, unsigned char word_count) -{ - gate->offset_low = offset & 0xffff; - gate->selector = selector; - gate->word_count = word_count; - gate->access = access | ACC_P; - gate->offset_high = (offset >> 16) & 0xffff; -} - -#ifdef CODE16 -#define i16_fill_descriptor fill_descriptor -#define i16_fill_gate fill_gate -#endif - -#endif !ASSEMBLER - -#endif /* _MACH_I386_SEG_H_ */ diff --git a/i386/include/mach/i386/time_stamp.h b/i386/include/mach/i386/time_stamp.h deleted file mode 100644 index d6488e2..0000000 --- a/i386/include/mach/i386/time_stamp.h +++ /dev/null @@ -1,29 +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. - */ -/* - * The I386 timestamp implementation uses the default, so we don't - * need to do anything here. - */ diff --git a/i386/include/mach/i386/tss.h b/i386/include/mach/i386/tss.h deleted file mode 100644 index c9a8298..0000000 --- a/i386/include/mach/i386/tss.h +++ /dev/null @@ -1,67 +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. - */ - -#ifndef _MACH_I386_TSS_H_ -#define _MACH_I386_TSS_H_ - -/* - * i386 Task State Segment - */ -struct i386_tss { - int back_link; /* segment number of previous task, - if nested */ - int esp0; /* initial stack pointer ... */ - int ss0; /* and segment for ring 0 */ - int esp1; /* initial stack pointer ... */ - int ss1; /* and segment for ring 1 */ - int esp2; /* initial stack pointer ... */ - int ss2; /* and segment for ring 2 */ - int cr3; /* CR3 - page table directory - physical address */ - int eip; - int eflags; - int eax; - int ecx; - int edx; - int ebx; - int esp; /* current stack pointer */ - int ebp; - int esi; - int edi; - int es; - int cs; - int ss; /* current stack segment */ - int ds; - int fs; - int gs; - int ldt; /* local descriptor table segment */ - unsigned short trace_trap; /* trap on switch to this task */ - unsigned short io_bit_map_offset; - /* offset to start of IO permission - bit map */ -}; - -#endif /* _MACH_I386_TSS_H_ */ diff --git a/i386/include/mach/i386/vcpi.h b/i386/include/mach/i386/vcpi.h deleted file mode 100644 index 0c09ed0..0000000 --- a/i386/include/mach/i386/vcpi.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 1996-1994 The University of Utah and - * the Computer Systems Laboratory at the University of Utah (CSL). - * All rights reserved. - * - * Permission to use, copy, modify and distribute this software is hereby - * granted provided that (1) source code retains these copyright, permission, - * and disclaimer notices, and (2) redistributions including binaries - * reproduce the notices in supporting documentation, and (3) all advertising - * materials mentioning features or use of this software display the following - * acknowledgement: ``This product includes software developed by the - * Computer Systems Laboratory at the University of Utah.'' - * - * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSL requests users of this software to return to csl-dist@cs.utah.edu any - * improvements that they make and grant CSL redistribution rights. - * - * Author: Bryan Ford, University of Utah CSL - */ -#ifndef _FLUX_INCLUDE_FLUX_I386_VCPI_H_ -#define _FLUX_INCLUDE_FLUX_I386_VCPI_H_ - -struct vcpi_switch_data -{ - vm_offset_t phys_pdir; - vm_offset_t lin_gdt; - vm_offset_t lin_idt; - unsigned short ldt_sel; - unsigned short tss_sel; - unsigned long entry_eip; - unsigned short entry_cs; -}; - -#endif /* _FLUX_INCLUDE_FLUX_I386_VCPI_H_ */ |