diff options
author | marcel <marcel@FreeBSD.org> | 2014-07-07 00:27:09 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2014-07-07 00:27:09 +0000 |
commit | 9f28abd980752efcf77578cd494f1015083c2a2b (patch) | |
tree | 98db2559cee662a9de7212211dd5c69176b58254 /sys | |
parent | 43f783bfcf60b349841acd57895767177114e4ae (diff) | |
download | FreeBSD-src-9f28abd980752efcf77578cd494f1015083c2a2b.zip FreeBSD-src-9f28abd980752efcf77578cd494f1015083c2a2b.tar.gz |
Remove ia64.
This includes:
o All directories named *ia64*
o All files named *ia64*
o All ia64-specific code guarded by __ia64__
o All ia64-specific makefile logic
o Mention of ia64 in comments and documentation
This excludes:
o Everything under contrib/
o Everything under crypto/
o sys/xen/interface
o sys/sys/elf_common.h
Discussed at: BSDcan
Diffstat (limited to 'sys')
281 files changed, 35 insertions, 51767 deletions
diff --git a/sys/Makefile b/sys/Makefile index a440e72..dc1d5e9 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -8,7 +8,7 @@ CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \ pci rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR} .if !defined(CSCOPE_ARCHDIR) .if defined(ALL_ARCH) -CSCOPE_ARCHDIR = amd64 arm i386 ia64 mips pc98 powerpc sparc64 x86 +CSCOPE_ARCHDIR = amd64 arm i386 mips pc98 powerpc sparc64 x86 .else CSCOPE_ARCHDIR = ${MACHINE} .if ${MACHINE} != ${MACHINE_CPUARCH} diff --git a/sys/boot/Makefile.ia64 b/sys/boot/Makefile.ia64 deleted file mode 100644 index 256201d..0000000 --- a/sys/boot/Makefile.ia64 +++ /dev/null @@ -1,4 +0,0 @@ -# $FreeBSD$ - -SUBDIR+= efi -SUBDIR+= zfs diff --git a/sys/boot/common/Makefile.inc b/sys/boot/common/Makefile.inc index 2a4d561..5aae7548 100644 --- a/sys/boot/common/Makefile.inc +++ b/sys/boot/common/Makefile.inc @@ -7,8 +7,6 @@ SRCS+= module.c panic.c .if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c -.elif ${MACHINE_CPUARCH} == "ia64" -SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c .elif ${MACHINE} == "pc98" SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c .elif ${MACHINE_CPUARCH} == "arm" diff --git a/sys/boot/efi/include/amd64/pe.h b/sys/boot/efi/include/amd64/pe.h index 1120464..f8033c5 100644 --- a/sys/boot/efi/include/amd64/pe.h +++ b/sys/boot/efi/include/amd64/pe.h @@ -498,7 +498,6 @@ typedef struct _IMAGE_BASE_RELOCATION { #define IMAGE_REL_BASED_HIGHLOW 3 #define IMAGE_REL_BASED_HIGHADJ 4 #define IMAGE_REL_BASED_MIPS_JMPADDR 5 -#define IMAGE_REL_BASED_IA64_IMM64 9 #define IMAGE_REL_BASED_DIR64 10 // diff --git a/sys/boot/efi/include/efiapi.h b/sys/boot/efi/include/efiapi.h index 187fe29..b955338 100644 --- a/sys/boot/efi/include/efiapi.h +++ b/sys/boot/efi/include/efiapi.h @@ -314,10 +314,6 @@ EFI_STATUS #define EFI_IMAGE_MACHINE_IA32 0x014c #endif -#if !defined(EFI_IMAGE_MACHINE_IA64) -#define EFI_IMAGE_MACHINE_IA64 0x0200 -#endif - #if !defined(EFI_IMAGE_MACHINE_EBC) #define EFI_IMAGE_MACHINE_EBC 0x0EBC #endif diff --git a/sys/boot/efi/include/i386/pe.h b/sys/boot/efi/include/i386/pe.h index 0381a44..e2ae25c 100644 --- a/sys/boot/efi/include/i386/pe.h +++ b/sys/boot/efi/include/i386/pe.h @@ -498,7 +498,6 @@ typedef struct _IMAGE_BASE_RELOCATION { #define IMAGE_REL_BASED_HIGHLOW 3 #define IMAGE_REL_BASED_HIGHADJ 4 #define IMAGE_REL_BASED_MIPS_JMPADDR 5 -#define IMAGE_REL_BASED_IA64_IMM64 9 #define IMAGE_REL_BASED_DIR64 10 // diff --git a/sys/boot/efi/include/ia64/efibind.h b/sys/boot/efi/include/ia64/efibind.h deleted file mode 100644 index 21f0d25..0000000 --- a/sys/boot/efi/include/ia64/efibind.h +++ /dev/null @@ -1,219 +0,0 @@ -/* $FreeBSD$ */ -/*++ - -Copyright (c) 1999 - 2003 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efefind.h - -Abstract: - - EFI to compile bindings - - - - -Revision History - ---*/ - -#pragma pack() - - -#ifdef __FreeBSD__ -#include <sys/stdint.h> -#else -// -// Basic int types of various widths -// - -#if (__STDC_VERSION__ < 199901L ) - - // No ANSI C 1999/2000 stdint.h integer width declarations - - #if _MSC_EXTENSIONS - - // Use Microsoft C compiler integer width declarations - - typedef unsigned __int64 uint64_t; - typedef __int64 int64_t; - typedef unsigned __int32 uint32_t; - typedef __int32 int32_t; - typedef unsigned __int16 uint16_t; - typedef __int16 int16_t; - typedef unsigned __int8 uint8_t; - typedef __int8 int8_t; - #else - #ifdef UNIX_LP64 - - // Use LP64 programming model from C_FLAGS for integer width declarations - - typedef unsigned long uint64_t; - typedef long int64_t; - typedef unsigned int uint32_t; - typedef int int32_t; - typedef unsigned short uint16_t; - typedef short int16_t; - typedef unsigned char uint8_t; - typedef char int8_t; - #else - - // Assume P64 programming model from C_FLAGS for integer width declarations - - typedef unsigned long long uint64_t; - typedef long long int64_t; - typedef unsigned int uint32_t; - typedef int int32_t; - typedef unsigned short uint16_t; - typedef short int16_t; - typedef unsigned char uint8_t; - typedef char int8_t; - #endif - #endif -#endif -#endif /* __FreeBSD__ */ - -// -// Basic EFI types of various widths -// - - -typedef uint64_t UINT64; -typedef int64_t INT64; -typedef uint32_t UINT32; -typedef int32_t INT32; -typedef uint16_t UINT16; -typedef int16_t INT16; -typedef uint8_t UINT8; -typedef int8_t INT8; - - -#undef VOID -#define VOID void - - -typedef int64_t INTN; -typedef uint64_t UINTN; - -//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// BugBug: Code to debug -// -#define BIT63 0x8000000000000000 - -#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63) -#define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) ) - -// -// Macro's with casts make this much easier to use and read. -// -#define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port))) -#define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data)) -// -// BugBug: End Debug Code!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#define EFIERR(a) (0x8000000000000000 | a) -#define EFI_ERROR_MASK 0x8000000000000000 -#define EFIERR_OEM(a) (0xc000000000000000 | a) - -#define BAD_POINTER 0xFBFBFBFBFBFBFBFB -#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF - -#pragma intrinsic (__break) -#define BREAKPOINT() __break(0) - -// -// Pointers must be aligned to these address to function -// you will get an alignment fault if this value is less than 8 -// -#define MIN_ALIGNMENT_SIZE 8 - -#define ALIGN_VARIABLE(Value , Adjustment) \ - (UINTN) Adjustment = 0; \ - if((UINTN)Value % MIN_ALIGNMENT_SIZE) \ - (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \ - Value = (UINTN)Value + (UINTN)Adjustment - -// -// Define macros to create data structure signatures. -// - -#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) -#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) -#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) - -// -// EFIAPI - prototype calling convention for EFI function pointers -// BOOTSERVICE - prototype for implementation of a boot service interface -// RUNTIMESERVICE - prototype for implementation of a runtime service interface -// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service -// RUNTIME_CODE - pragma macro for declaring runtime code -// - -#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options - #if _MSC_EXTENSIONS - #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler - #else - #define EFIAPI // Substitute expresion to force C calling convention - #endif -#endif - -#define BOOTSERVICE -#define RUNTIMESERVICE -#define RUNTIMEFUNCTION - -#define RUNTIME_CODE(a) alloc_text("rtcode", a) -#define BEGIN_RUNTIME_DATA() data_seg("rtdata") -#define END_RUNTIME_DATA() data_seg() - -#define VOLATILE volatile - -// -// BugBug: Need to find out if this is portable accross compliers. -// -void __mfa (void); -#pragma intrinsic (__mfa) -#define MEMORY_FENCE() __mfa() - -#ifdef EFI_NO_INTERFACE_DECL - #define EFI_FORWARD_DECLARATION(x) - #define EFI_INTERFACE_DECL(x) -#else - #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x - #define EFI_INTERFACE_DECL(x) typedef struct x -#endif - -// -// When build similiar to FW, then link everything together as -// one big module. -// - -#define EFI_DRIVER_ENTRY_POINT(InitFunction) - -#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ - (_if)->LoadInternal(type, name, entry) -// entry(NULL, ST) - -#ifdef __FreeBSD__ -#define INTERFACE_DECL(x) struct x -#else -// -// Some compilers don't support the forward reference construct: -// typedef struct XXXXX -// -// The following macro provide a workaround for such cases. -// -#ifdef NO_INTERFACE_DECL -#define INTERFACE_DECL(x) -#else -#define INTERFACE_DECL(x) typedef struct x -#endif -#endif diff --git a/sys/boot/efi/include/ia64/pe.h b/sys/boot/efi/include/ia64/pe.h deleted file mode 100644 index 24480a5..0000000 --- a/sys/boot/efi/include/ia64/pe.h +++ /dev/null @@ -1,637 +0,0 @@ -/* $FreeBSD$ */ -/* - PE32+ header file - */ -#ifndef _PE_H -#define _PE_H - -#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ -#define IMAGE_OS2_SIGNATURE 0x454E // NE -#define IMAGE_OS2_SIGNATURE_LE 0x454C // LE -#define IMAGE_NT_SIGNATURE 0x00004550 // PE00 -#define IMAGE_EDOS_SIGNATURE 0x44454550 // PEED - -/***************************************************************************** - * The following stuff comes from winnt.h from the ia64sdk, plus the Plabel for - * loading EM executables. - *****************************************************************************/ -// -// Intel IA64 specific -// - -#define IMAGE_REL_BASED_IA64_IMM64 9 -#define IMAGE_REL_BASED_IA64_DIR64 10 - -struct Plabel { - UINT64 EntryPoint; - UINT64 NewGP; -}; - -typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header - UINT16 e_magic; // Magic number - UINT16 e_cblp; // Bytes on last page of file - UINT16 e_cp; // Pages in file - UINT16 e_crlc; // Relocations - UINT16 e_cparhdr; // Size of header in paragraphs - UINT16 e_minalloc; // Minimum extra paragraphs needed - UINT16 e_maxalloc; // Maximum extra paragraphs needed - UINT16 e_ss; // Initial (relative) SS value - UINT16 e_sp; // Initial SP value - UINT16 e_csum; // Checksum - UINT16 e_ip; // Initial IP value - UINT16 e_cs; // Initial (relative) CS value - UINT16 e_lfarlc; // File address of relocation table - UINT16 e_ovno; // Overlay number - UINT16 e_res[4]; // Reserved words - UINT16 e_oemid; // OEM identifier (for e_oeminfo) - UINT16 e_oeminfo; // OEM information; e_oemid specific - UINT16 e_res2[10]; // Reserved words - UINT32 e_lfanew; // File address of new exe header - } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; - -typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header - UINT16 ne_magic; // Magic number - UINT8 ne_ver; // Version number - UINT8 ne_rev; // Revision number - UINT16 ne_enttab; // Offset of Entry Table - UINT16 ne_cbenttab; // Number of bytes in Entry Table - UINT32 ne_crc; // Checksum of whole file - UINT16 ne_flags; // Flag UINT16 - UINT16 ne_autodata; // Automatic data segment number - UINT16 ne_heap; // Initial heap allocation - UINT16 ne_stack; // Initial stack allocation - UINT32 ne_csip; // Initial CS:IP setting - UINT32 ne_sssp; // Initial SS:SP setting - UINT16 ne_cseg; // Count of file segments - UINT16 ne_cmod; // Entries in Module Reference Table - UINT16 ne_cbnrestab; // Size of non-resident name table - UINT16 ne_segtab; // Offset of Segment Table - UINT16 ne_rsrctab; // Offset of Resource Table - UINT16 ne_restab; // Offset of resident name table - UINT16 ne_modtab; // Offset of Module Reference Table - UINT16 ne_imptab; // Offset of Imported Names Table - UINT32 ne_nrestab; // Offset of Non-resident Names Table - UINT16 ne_cmovent; // Count of movable entries - UINT16 ne_align; // Segment alignment shift count - UINT16 ne_cres; // Count of resource segments - UINT8 ne_exetyp; // Target Operating system - UINT8 ne_flagsothers; // Other .EXE flags - UINT16 ne_pretthunks; // offset to return thunks - UINT16 ne_psegrefbytes; // offset to segment ref. bytes - UINT16 ne_swaparea; // Minimum code swap area size - UINT16 ne_expver; // Expected Windows version number - } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER; - -// -// File header format. -// - -typedef struct _IMAGE_FILE_HEADER { - UINT16 Machine; - UINT16 NumberOfSections; - UINT32 TimeDateStamp; - UINT32 PointerToSymbolTable; - UINT32 NumberOfSymbols; - UINT16 SizeOfOptionalHeader; - UINT16 Characteristics; -} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; - -#define IMAGE_SIZEOF_FILE_HEADER 20 - -#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file. -#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references). -#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file. -#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file. -#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed. -#define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine. -#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file -#define IMAGE_FILE_SYSTEM 0x1000 // System File. -#define IMAGE_FILE_DLL 0x2000 // File is a DLL. -#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed. - -#define IMAGE_FILE_MACHINE_UNKNOWN 0 -#define IMAGE_FILE_MACHINE_I386 0x14c // Intel 386. -#define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian -#define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian -#define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP -#define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC Little-Endian -#define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine -// -// Directory format. -// - -typedef struct _IMAGE_DATA_DIRECTORY { - UINT32 VirtualAddress; - UINT32 Size; -} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; - -#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 - - -typedef struct _IMAGE_ROM_OPTIONAL_HEADER { - UINT16 Magic; - UINT8 MajorLinkerVersion; - UINT8 MinorLinkerVersion; - UINT32 SizeOfCode; - UINT32 SizeOfInitializedData; - UINT32 SizeOfUninitializedData; - UINT32 AddressOfEntryPoint; - UINT32 BaseOfCode; - UINT32 BaseOfData; - UINT32 BaseOfBss; - UINT32 GprMask; - UINT32 CprMask[4]; - UINT32 GpValue; -} IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER; - -typedef struct _IMAGE_OPTIONAL_HEADER { - UINT16 Magic; - UINT8 MajorLinkerVersion; - UINT8 MinorLinkerVersion; - UINT32 SizeOfCode; - UINT32 SizeOfInitializedData; - UINT32 SizeOfUninitializedData; - UINT32 AddressOfEntryPoint; - UINT32 BaseOfCode; - // UINT32 BaseOfData; - UINT64 ImageBase; - UINT32 SectionAlignment; - UINT32 FileAlignment; - UINT16 MajorOperatingSystemVersion; - UINT16 MinorOperatingSystemVersion; - UINT16 MajorImageVersion; - UINT16 MinorImageVersion; - UINT16 MajorSubsystemVersion; - UINT16 MinorSubsystemVersion; - UINT32 Win32VersionValue; - UINT32 SizeOfImage; - UINT32 SizeOfHeaders; - UINT32 CheckSum; - UINT16 Subsystem; - UINT16 DllCharacteristics; - UINT64 SizeOfStackReserve; - UINT64 SizeOfStackCommit; - UINT64 SizeOfHeapReserve; - UINT64 SizeOfHeapCommit; - UINT32 LoaderFlags; - UINT32 NumberOfRvaAndSizes; - IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; -} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER; - - -#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56 -#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28 -#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224 -#define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 244 - -#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b -#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b -#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107 - -typedef struct _IMAGE_NT_HEADERS { - UINT32 Signature; - IMAGE_FILE_HEADER FileHeader; - IMAGE_OPTIONAL_HEADER OptionalHeader; -} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS; - -typedef struct _IMAGE_ROM_HEADERS { - IMAGE_FILE_HEADER FileHeader; - IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; -} IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS; - -#define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \ - ((UINT32)ntheader + \ - FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \ - ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \ - )) - - -// Subsystem Values - -#define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem. -#define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a subsystem. -#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem. -#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem. -#define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2 character subsystem. -#define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image run in the Posix character subsystem. - - -// Directory Entries - -#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory -#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory -#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory -#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory -#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory -#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table -#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory -#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // Description String -#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // Machine Value (MIPS GP) -#define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory -#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration Directory - -// -// Section header format. -// - -#define IMAGE_SIZEOF_SHORT_NAME 8 - -typedef struct _IMAGE_SECTION_HEADER { - UINT8 Name[IMAGE_SIZEOF_SHORT_NAME]; - union { - UINT32 PhysicalAddress; - UINT32 VirtualSize; - } Misc; - UINT32 VirtualAddress; - UINT32 SizeOfRawData; - UINT32 PointerToRawData; - UINT32 PointerToRelocations; - UINT32 PointerToLinenumbers; - UINT16 NumberOfRelocations; - UINT16 NumberOfLinenumbers; - UINT32 Characteristics; -} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; - -#define IMAGE_SIZEOF_SECTION_HEADER 40 - -#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved. - -#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code. -#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data. -#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data. - -#define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved. -#define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information. -#define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image. -#define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat. - -#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 // -#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 // -#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 // -#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 // -#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified. -#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 // -#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 // - -#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded. -#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable. -#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable. -#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable. -#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable. -#define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable. -#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable. - -// -// Symbol format. -// - - -#define IMAGE_SIZEOF_SYMBOL 18 - -// -// Section values. -// -// Symbols have a section number of the section in which they are -// defined. Otherwise, section numbers have the following meanings: -// - -#define IMAGE_SYM_UNDEFINED (UINT16)0 // Symbol is undefined or is common. -#define IMAGE_SYM_ABSOLUTE (UINT16)-1 // Symbol is an absolute value. -#define IMAGE_SYM_DEBUG (UINT16)-2 // Symbol is a special debug item. - -// -// Type (fundamental) values. -// - -#define IMAGE_SYM_TYPE_NULL 0 // no type. -#define IMAGE_SYM_TYPE_VOID 1 // -#define IMAGE_SYM_TYPE_CHAR 2 // type character. -#define IMAGE_SYM_TYPE_SHORT 3 // type short integer. -#define IMAGE_SYM_TYPE_INT 4 // -#define IMAGE_SYM_TYPE_LONG 5 // -#define IMAGE_SYM_TYPE_FLOAT 6 // -#define IMAGE_SYM_TYPE_DOUBLE 7 // -#define IMAGE_SYM_TYPE_STRUCT 8 // -#define IMAGE_SYM_TYPE_UNION 9 // -#define IMAGE_SYM_TYPE_ENUM 10 // enumeration. -#define IMAGE_SYM_TYPE_MOE 11 // member of enumeration. -#define IMAGE_SYM_TYPE_BYTE 12 // -#define IMAGE_SYM_TYPE_WORD 13 // -#define IMAGE_SYM_TYPE_UINT 14 // -#define IMAGE_SYM_TYPE_DWORD 15 // - -// -// Type (derived) values. -// - -#define IMAGE_SYM_DTYPE_NULL 0 // no derived type. -#define IMAGE_SYM_DTYPE_POINTER 1 // pointer. -#define IMAGE_SYM_DTYPE_FUNCTION 2 // function. -#define IMAGE_SYM_DTYPE_ARRAY 3 // array. - -// -// Storage classes. -// - -#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1 -#define IMAGE_SYM_CLASS_NULL 0 -#define IMAGE_SYM_CLASS_AUTOMATIC 1 -#define IMAGE_SYM_CLASS_EXTERNAL 2 -#define IMAGE_SYM_CLASS_STATIC 3 -#define IMAGE_SYM_CLASS_REGISTER 4 -#define IMAGE_SYM_CLASS_EXTERNAL_DEF 5 -#define IMAGE_SYM_CLASS_LABEL 6 -#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7 -#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8 -#define IMAGE_SYM_CLASS_ARGUMENT 9 -#define IMAGE_SYM_CLASS_STRUCT_TAG 10 -#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11 -#define IMAGE_SYM_CLASS_UNION_TAG 12 -#define IMAGE_SYM_CLASS_TYPE_DEFINITION 13 -#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14 -#define IMAGE_SYM_CLASS_ENUM_TAG 15 -#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16 -#define IMAGE_SYM_CLASS_REGISTER_PARAM 17 -#define IMAGE_SYM_CLASS_BIT_FIELD 18 -#define IMAGE_SYM_CLASS_BLOCK 100 -#define IMAGE_SYM_CLASS_FUNCTION 101 -#define IMAGE_SYM_CLASS_END_OF_STRUCT 102 -#define IMAGE_SYM_CLASS_FILE 103 -// new -#define IMAGE_SYM_CLASS_SECTION 104 -#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105 - -// type packing constants - -#define N_BTMASK 017 -#define N_TMASK 060 -#define N_TMASK1 0300 -#define N_TMASK2 0360 -#define N_BTSHFT 4 -#define N_TSHIFT 2 - -// MACROS - -// -// Communal selection types. -// - -#define IMAGE_COMDAT_SELECT_NODUPLICATES 1 -#define IMAGE_COMDAT_SELECT_ANY 2 -#define IMAGE_COMDAT_SELECT_SAME_SIZE 3 -#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 -#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 - -#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 -#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 -#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 - - -// -// Relocation format. -// - -typedef struct _IMAGE_RELOCATION { - UINT32 VirtualAddress; - UINT32 SymbolTableIndex; - UINT16 Type; -} IMAGE_RELOCATION; - -#define IMAGE_SIZEOF_RELOCATION 10 - -// -// I386 relocation types. -// - -#define IMAGE_REL_I386_ABSOLUTE 0 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_I386_DIR16 01 // Direct 16-bit reference to the symbols virtual address -#define IMAGE_REL_I386_REL16 02 // PC-relative 16-bit reference to the symbols virtual address -#define IMAGE_REL_I386_DIR32 06 // Direct 32-bit reference to the symbols virtual address -#define IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit reference to the symbols virtual address, base not included -#define IMAGE_REL_I386_SEG12 011 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address -#define IMAGE_REL_I386_SECTION 012 -#define IMAGE_REL_I386_SECREL 013 -#define IMAGE_REL_I386_REL32 024 // PC-relative 32-bit reference to the symbols virtual address - -// -// MIPS relocation types. -// - -#define IMAGE_REL_MIPS_ABSOLUTE 0 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_MIPS_REFHALF 01 -#define IMAGE_REL_MIPS_REFWORD 02 -#define IMAGE_REL_MIPS_JMPADDR 03 -#define IMAGE_REL_MIPS_REFHI 04 -#define IMAGE_REL_MIPS_REFLO 05 -#define IMAGE_REL_MIPS_GPREL 06 -#define IMAGE_REL_MIPS_LITERAL 07 -#define IMAGE_REL_MIPS_SECTION 012 -#define IMAGE_REL_MIPS_SECREL 013 -#define IMAGE_REL_MIPS_REFWORDNB 042 -#define IMAGE_REL_MIPS_PAIR 045 - -// -// Alpha Relocation types. -// - -#define IMAGE_REL_ALPHA_ABSOLUTE 0x0 -#define IMAGE_REL_ALPHA_REFLONG 0x1 -#define IMAGE_REL_ALPHA_REFQUAD 0x2 -#define IMAGE_REL_ALPHA_GPREL32 0x3 -#define IMAGE_REL_ALPHA_LITERAL 0x4 -#define IMAGE_REL_ALPHA_LITUSE 0x5 -#define IMAGE_REL_ALPHA_GPDISP 0x6 -#define IMAGE_REL_ALPHA_BRADDR 0x7 -#define IMAGE_REL_ALPHA_HINT 0x8 -#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x9 -#define IMAGE_REL_ALPHA_REFHI 0xA -#define IMAGE_REL_ALPHA_REFLO 0xB -#define IMAGE_REL_ALPHA_PAIR 0xC -#define IMAGE_REL_ALPHA_MATCH 0xD -#define IMAGE_REL_ALPHA_SECTION 0xE -#define IMAGE_REL_ALPHA_SECREL 0xF -#define IMAGE_REL_ALPHA_REFLONGNB 0x10 - -// -// IBM PowerPC relocation types. -// - -#define IMAGE_REL_PPC_ABSOLUTE 0x0000 // NOP -#define IMAGE_REL_PPC_ADDR64 0x0001 // 64-bit address -#define IMAGE_REL_PPC_ADDR32 0x0002 // 32-bit address -#define IMAGE_REL_PPC_ADDR24 0x0003 // 26-bit address, shifted left 2 (branch absolute) -#define IMAGE_REL_PPC_ADDR16 0x0004 // 16-bit address -#define IMAGE_REL_PPC_ADDR14 0x0005 // 16-bit address, shifted left 2 (load doubleword) -#define IMAGE_REL_PPC_REL24 0x0006 // 26-bit PC-relative offset, shifted left 2 (branch relative) -#define IMAGE_REL_PPC_REL14 0x0007 // 16-bit PC-relative offset, shifted left 2 (br cond relative) -#define IMAGE_REL_PPC_TOCREL16 0x0008 // 16-bit offset from TOC base -#define IMAGE_REL_PPC_TOCREL14 0x0009 // 16-bit offset from TOC base, shifted left 2 (load doubleword) - -#define IMAGE_REL_PPC_ADDR32NB 0x000A // 32-bit addr w/o image base -#define IMAGE_REL_PPC_SECREL 0x000B // va of containing section (as in an image sectionhdr) -#define IMAGE_REL_PPC_SECTION 0x000C // sectionheader number -#define IMAGE_REL_PPC_IFGLUE 0x000D // substitute TOC restore instruction iff symbol is glue code -#define IMAGE_REL_PPC_IMGLUE 0x000E // symbol is glue code; virtual address is TOC restore instruction - -#define IMAGE_REL_PPC_TYPEMASK 0x00FF // mask to isolate above values in IMAGE_RELOCATION.Type - -// Flag bits in IMAGE_RELOCATION.TYPE - -#define IMAGE_REL_PPC_NEG 0x0100 // subtract reloc value rather than adding it -#define IMAGE_REL_PPC_BRTAKEN 0x0200 // fix branch prediction bit to predict branch taken -#define IMAGE_REL_PPC_BRNTAKEN 0x0400 // fix branch prediction bit to predict branch not taken -#define IMAGE_REL_PPC_TOCDEFN 0x0800 // toc slot defined in file (or, data in toc) - -// -// Based relocation format. -// - -typedef struct _IMAGE_BASE_RELOCATION { - UINT32 VirtualAddress; - UINT32 SizeOfBlock; -// UINT16 TypeOffset[1]; -} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION; - -#define IMAGE_SIZEOF_BASE_RELOCATION 8 - -// -// Based relocation types. -// - -#define IMAGE_REL_BASED_ABSOLUTE 0 -#define IMAGE_REL_BASED_HIGH 1 -#define IMAGE_REL_BASED_LOW 2 -#define IMAGE_REL_BASED_HIGHLOW 3 -#define IMAGE_REL_BASED_HIGHADJ 4 -#define IMAGE_REL_BASED_MIPS_JMPADDR 5 -#define IMAGE_REL_BASED_IA64_IMM64 9 -#define IMAGE_REL_BASED_DIR64 10 - -// -// Line number format. -// - -typedef struct _IMAGE_LINENUMBER { - union { - UINT32 SymbolTableIndex; // Symbol table index of function name if Linenumber is 0. - UINT32 VirtualAddress; // Virtual address of line number. - } Type; - UINT16 Linenumber; // Line number. -} IMAGE_LINENUMBER; - -#define IMAGE_SIZEOF_LINENUMBER 6 - -// -// Archive format. -// - -#define IMAGE_ARCHIVE_START_SIZE 8 -#define IMAGE_ARCHIVE_START "!<arch>\n" -#define IMAGE_ARCHIVE_END "`\n" -#define IMAGE_ARCHIVE_PAD "\n" -#define IMAGE_ARCHIVE_LINKER_MEMBER "/ " -#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " - -typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { - UINT8 Name[16]; // File member name - `/' terminated. - UINT8 Date[12]; // File member date - decimal. - UINT8 UserID[6]; // File member user id - decimal. - UINT8 GroupID[6]; // File member group id - decimal. - UINT8 Mode[8]; // File member mode - octal. - UINT8 Size[10]; // File member size - decimal. - UINT8 EndHeader[2]; // String to end header. -} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER; - -#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 - -// -// DLL support. -// - -// -// Export Format -// - -typedef struct _IMAGE_EXPORT_DIRECTORY { - UINT32 Characteristics; - UINT32 TimeDateStamp; - UINT16 MajorVersion; - UINT16 MinorVersion; - UINT32 Name; - UINT32 Base; - UINT32 NumberOfFunctions; - UINT32 NumberOfNames; - UINT32 AddressOfFunctions; - UINT32 AddressOfNames; - UINT32 AddressOfNameOrdinals; -} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; - -// -// Import Format -// - -typedef struct _IMAGE_IMPORT_BY_NAME { - UINT16 Hint; - UINT8 Name[1]; -} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME; - -typedef struct _IMAGE_THUNK_DATA { - union { - UINT32 Function; - UINT32 Ordinal; - PIMAGE_IMPORT_BY_NAME AddressOfData; - } u1; -} IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA; - -#define IMAGE_ORDINAL_FLAG 0x80000000 -#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0) -#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff) - -typedef struct _IMAGE_IMPORT_DESCRIPTOR { - UINT32 Characteristics; - UINT32 TimeDateStamp; - UINT32 ForwarderChain; - UINT32 Name; - PIMAGE_THUNK_DATA FirstThunk; -} IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR; - -#define IMAGE_DEBUG_TYPE_CODEVIEW 2 - -typedef struct { - UINT32 Characteristics; - UINT32 TimeDateStamp; - UINT16 MajorVersion; - UINT16 MinorVersion; - UINT32 Type; - UINT32 SizeOfData; - UINT32 RVA; - UINT32 FileOffset; -} IMAGE_DEBUG_DIRECTORY_ENTRY; - -#define CODEVIEW_SIGNATURE_NB10 0x3031424E // "NB10" - -typedef struct { - UINT32 Signature; // "NB10" - UINT32 Unknown; - UINT32 Unknown2; - UINT32 Unknown3; - // - // Filename of .PDB goes here - // -} EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY; - -#define CODEVIEW_SIGNATURE_RSDS 0x53445352 // "RSDS" - -typedef struct { - UINT32 Signature; // "RSDS" - UINT32 Unknown; - UINT32 Unknown2; - UINT32 Unknown3; - UINT32 Unknown4; - UINT32 Unknown5; - // - // Filename of .PDB goes here - // -} EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY; - -#endif diff --git a/sys/boot/ficl/ia64/sysdep.c b/sys/boot/ficl/ia64/sysdep.c deleted file mode 100644 index 00b0d4a..0000000 --- a/sys/boot/ficl/ia64/sysdep.c +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************* -** s y s d e p . c -** Forth Inspired Command Language -** Author: John Sadler (john_sadler@alum.mit.edu) -** Created: 16 Oct 1997 -** Implementations of FICL external interface functions... -** -*******************************************************************/ - -/* $FreeBSD$ */ - -#ifdef TESTMAIN -#include <stdio.h> -#include <stdlib.h> -#else -#include <stand.h> -#endif -#include "ficl.h" - -/* -******************* FreeBSD P O R T B E G I N S H E R E ******************** Michael Smith -*/ - -#if PORTABLE_LONGMULDIV == 0 -DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y) -{ - DPUNS q; - u_int64_t qx; - - qx = (u_int64_t)x * (u_int64_t) y; - - q.hi = (u_int32_t)( qx >> 32 ); - q.lo = (u_int32_t)( qx & 0xFFFFFFFFL); - - return q; -} - -UNSQR ficlLongDiv(DPUNS q, FICL_UNS y) -{ - UNSQR result; - u_int64_t qx, qh; - - qh = q.hi; - qx = (qh << 32) | q.lo; - - result.quot = qx / y; - result.rem = qx % y; - - return result; -} -#endif - -void ficlTextOut(FICL_VM *pVM, char *msg, int fNewline) -{ - IGNORE(pVM); - - while(*msg != 0) - putchar(*(msg++)); - if (fNewline) - putchar('\n'); - - return; -} - -void *ficlMalloc (size_t size) -{ - return malloc(size); -} - -void *ficlRealloc (void *p, size_t size) -{ - return realloc(p, size); -} - -void ficlFree (void *p) -{ - free(p); -} - - -/* -** Stub function for dictionary access control - does nothing -** by default, user can redefine to guarantee exclusive dict -** access to a single thread for updates. All dict update code -** is guaranteed to be bracketed as follows: -** ficlLockDictionary(TRUE); -** <code that updates dictionary> -** ficlLockDictionary(FALSE); -** -** Returns zero if successful, nonzero if unable to acquire lock -** befor timeout (optional - could also block forever) -*/ -#if FICL_MULTITHREAD -int ficlLockDictionary(short fLock) -{ - IGNORE(fLock); - return 0; -} -#endif /* FICL_MULTITHREAD */ - - diff --git a/sys/boot/ficl/ia64/sysdep.h b/sys/boot/ficl/ia64/sysdep.h deleted file mode 100644 index 08bc0e1..0000000 --- a/sys/boot/ficl/ia64/sysdep.h +++ /dev/null @@ -1,434 +0,0 @@ -/******************************************************************* - s y s d e p . h -** Forth Inspired Command Language -** Author: John Sadler (john_sadler@alum.mit.edu) -** Created: 16 Oct 1997 -** Ficl system dependent types and prototypes... -** -** Note: Ficl also depends on the use of "assert" when -** FICL_ROBUST is enabled. This may require some consideration -** in firmware systems since assert often -** assumes stderr/stdout. -** $Id: sysdep.h,v 1.11 2001/12/05 07:21:34 jsadler Exp $ -*******************************************************************/ -/* -** Copyright (c) 1997-2001 John Sadler (john_sadler@alum.mit.edu) -** All rights reserved. -** -** Get the latest Ficl release at http://ficl.sourceforge.net -** -** I am interested in hearing from anyone who uses ficl. If you have -** a problem, a success story, a defect, an enhancement request, or -** if you would like to contribute to the ficl release, please -** contact me by email at the address above. -** -** L I C E N S E and D I S C L A I M E R -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -** SUCH DAMAGE. -** -** $Id: sysdep.h,v 1.6 2001-04-26 21:41:55-07 jsadler Exp jsadler $ -*/ - -/* $FreeBSD$ */ - -#if !defined (__SYSDEP_H__) -#define __SYSDEP_H__ - -#include <sys/types.h> - -#include <stddef.h> /* size_t, NULL */ -#include <setjmp.h> -#include <assert.h> - -#if !defined IGNORE /* Macro to silence unused param warnings */ -#define IGNORE(x) &x -#endif - -/* -** TRUE and FALSE for C boolean operations, and -** portable 32 bit types for CELLs -** -*/ -#if !defined TRUE -#define TRUE 1 -#endif -#if !defined FALSE -#define FALSE 0 -#endif - -/* -** System dependent data type declarations... -*/ -#if !defined INT32 -#define INT32 int -#endif - -#if !defined UNS32 -#define UNS32 unsigned int -#endif - -#if !defined UNS16 -#define UNS16 unsigned short -#endif - -#if !defined UNS8 -#define UNS8 unsigned char -#endif - -#if !defined NULL -#define NULL ((void *)0) -#endif - -/* -** FICL_UNS and FICL_INT must have the same size as a void* on -** the target system. A CELL is a union of void*, FICL_UNS, and -** FICL_INT. -** (11/2000: same for FICL_FLOAT) -*/ -#if !defined FICL_INT -#define FICL_INT long -#endif - -#if !defined FICL_UNS -#define FICL_UNS unsigned long -#endif - -#if !defined FICL_FLOAT -#define FICL_FLOAT float -#endif - -/* -** Ficl presently supports values of 32 and 64 for BITS_PER_CELL -*/ -#if !defined BITS_PER_CELL -#define BITS_PER_CELL 64 -#endif - -#if ((BITS_PER_CELL != 32) && (BITS_PER_CELL != 64)) - Error! -#endif - -typedef struct -{ - FICL_UNS hi; - FICL_UNS lo; -} DPUNS; - -typedef struct -{ - FICL_UNS quot; - FICL_UNS rem; -} UNSQR; - -typedef struct -{ - FICL_INT hi; - FICL_INT lo; -} DPINT; - -typedef struct -{ - FICL_INT quot; - FICL_INT rem; -} INTQR; - - -/* -** B U I L D C O N T R O L S -*/ - -#if !defined (FICL_MINIMAL) -#define FICL_MINIMAL 0 -#endif -#if (FICL_MINIMAL) -#define FICL_WANT_SOFTWORDS 0 -#define FICL_WANT_FILE 0 -#define FICL_WANT_FLOAT 0 -#define FICL_WANT_USER 0 -#define FICL_WANT_LOCALS 0 -#define FICL_WANT_DEBUGGER 0 -#define FICL_WANT_OOP 0 -#define FICL_PLATFORM_EXTEND 0 -#define FICL_MULTITHREAD 0 -#define FICL_ROBUST 0 -#define FICL_EXTENDED_PREFIX 0 -#endif - -/* -** FICL_PLATFORM_EXTEND -** Includes words defined in ficlCompilePlatform -*/ -#if !defined (FICL_PLATFORM_EXTEND) -#define FICL_PLATFORM_EXTEND 1 -#endif - - -/* -** FICL_WANT_FILE -** Includes the FILE and FILE-EXT wordset and associated code. Turn this off if you do not -** have a filesystem! -** Contributed by Larry Hastings -*/ -#if !defined (FICL_WANT_FILE) -#define FICL_WANT_FILE 0 -#endif - -/* -** FICL_WANT_FLOAT -** Includes a floating point stack for the VM, and words to do float operations. -** Contributed by Guy Carver -*/ -#if !defined (FICL_WANT_FLOAT) -#define FICL_WANT_FLOAT 0 -#endif - -/* -** FICL_WANT_DEBUGGER -** Inludes a simple source level debugger -*/ -#if !defined (FICL_WANT_DEBUGGER) -#define FICL_WANT_DEBUGGER 1 -#endif - -/* -** FICL_EXTENDED_PREFIX enables a bunch of extra prefixes in prefix.c and prefix.fr (if -** included as part of softcore.c) -*/ -#if !defined FICL_EXTENDED_PREFIX -#define FICL_EXTENDED_PREFIX 0 -#endif - -/* -** User variables: per-instance variables bound to the VM. -** Kinda like thread-local storage. Could be implemented in a -** VM private dictionary, but I've chosen the lower overhead -** approach of an array of CELLs instead. -*/ -#if !defined FICL_WANT_USER -#define FICL_WANT_USER 1 -#endif - -#if !defined FICL_USER_CELLS -#define FICL_USER_CELLS 16 -#endif - -/* -** FICL_WANT_LOCALS controls the creation of the LOCALS wordset and -** a private dictionary for local variable compilation. -*/ -#if !defined FICL_WANT_LOCALS -#define FICL_WANT_LOCALS 1 -#endif - -/* Max number of local variables per definition */ -#if !defined FICL_MAX_LOCALS -#define FICL_MAX_LOCALS 16 -#endif - -/* -** FICL_WANT_OOP -** Inludes object oriented programming support (in softwords) -** OOP support requires locals and user variables! -*/ -#if !(FICL_WANT_LOCALS) || !(FICL_WANT_USER) -#if !defined (FICL_WANT_OOP) -#define FICL_WANT_OOP 0 -#endif -#endif - -#if !defined (FICL_WANT_OOP) -#define FICL_WANT_OOP 1 -#endif - -/* -** FICL_WANT_SOFTWORDS -** Controls inclusion of all softwords in softcore.c -*/ -#if !defined (FICL_WANT_SOFTWORDS) -#define FICL_WANT_SOFTWORDS 1 -#endif - -/* -** FICL_MULTITHREAD enables dictionary mutual exclusion -** wia the ficlLockDictionary system dependent function. -** Note: this implementation is experimental and poorly -** tested. Further, it's unnecessary unless you really -** intend to have multiple SESSIONS (poor choice of name -** on my part) - that is, threads that modify the dictionary -** at the same time. -*/ -#if !defined FICL_MULTITHREAD -#define FICL_MULTITHREAD 0 -#endif - -/* -** PORTABLE_LONGMULDIV causes ficlLongMul and ficlLongDiv to be -** defined in C in sysdep.c. Use this if you cannot easily -** generate an inline asm definition -*/ -#if !defined (PORTABLE_LONGMULDIV) -#define PORTABLE_LONGMULDIV 0 -#endif - -/* -** INLINE_INNER_LOOP causes the inner interpreter to be inline code -** instead of a function call. This is mainly because MS VC++ 5 -** chokes with an internal compiler error on the function version. -** in release mode. Sheesh. -*/ -#if !defined INLINE_INNER_LOOP -#if defined _DEBUG -#define INLINE_INNER_LOOP 0 -#else -#define INLINE_INNER_LOOP 1 -#endif -#endif - -/* -** FICL_ROBUST enables bounds checking of stacks and the dictionary. -** This will detect stack over and underflows and dictionary overflows. -** Any exceptional condition will result in an assertion failure. -** (As generated by the ANSI assert macro) -** FICL_ROBUST == 1 --> stack checking in the outer interpreter -** FICL_ROBUST == 2 also enables checking in many primitives -*/ - -#if !defined FICL_ROBUST -#define FICL_ROBUST 2 -#endif - -/* -** FICL_DEFAULT_STACK Specifies the default size (in CELLs) of -** a new virtual machine's stacks, unless overridden at -** create time. -*/ -#if !defined FICL_DEFAULT_STACK -#define FICL_DEFAULT_STACK 128 -#endif - -/* -** FICL_DEFAULT_DICT specifies the number of CELLs to allocate -** for the system dictionary by default. The value -** can be overridden at startup time as well. -** FICL_DEFAULT_ENV specifies the number of cells to allot -** for the environment-query dictionary. -*/ -#if !defined FICL_DEFAULT_DICT -#define FICL_DEFAULT_DICT 12288 -#endif - -#if !defined FICL_DEFAULT_ENV -#define FICL_DEFAULT_ENV 260 -#endif - -/* -** FICL_DEFAULT_VOCS specifies the maximum number of wordlists in -** the dictionary search order. See Forth DPANS sec 16.3.3 -** (file://dpans16.htm#16.3.3) -*/ -#if !defined FICL_DEFAULT_VOCS -#define FICL_DEFAULT_VOCS 16 -#endif - -/* -** FICL_MAX_PARSE_STEPS controls the size of an array in the FICL_SYSTEM structure -** that stores pointers to parser extension functions. I would never expect to have -** more than 8 of these, so that's the default limit. Too many of these functions -** will probably exact a nasty performance penalty. -*/ -#if !defined FICL_MAX_PARSE_STEPS -#define FICL_MAX_PARSE_STEPS 8 -#endif - -/* -** FICL_ALIGN is the power of two to which the dictionary -** pointer address must be aligned. This value is usually -** either 1 or 2, depending on the memory architecture -** of the target system; 2 is safe on any 16 or 32 bit -** machine. 3 would be appropriate for a 64 bit machine. -*/ -#if !defined FICL_ALIGN -#define FICL_ALIGN 3 -#define FICL_ALIGN_ADD ((1 << FICL_ALIGN) - 1) -#endif - -/* -** System dependent routines -- -** edit the implementations in sysdep.c to be compatible -** with your runtime environment... -** ficlTextOut sends a NULL terminated string to the -** default output device - used for system error messages -** ficlMalloc and ficlFree have the same semantics as malloc and free -** in standard C -** ficlLongMul multiplies two UNS32s and returns a 64 bit unsigned -** product -** ficlLongDiv divides an UNS64 by an UNS32 and returns UNS32 quotient -** and remainder -*/ -struct vm; -void ficlTextOut(struct vm *pVM, char *msg, int fNewline); -void *ficlMalloc (size_t size); -void ficlFree (void *p); -void *ficlRealloc(void *p, size_t size); -/* -** Stub function for dictionary access control - does nothing -** by default, user can redefine to guarantee exclusive dict -** access to a single thread for updates. All dict update code -** must be bracketed as follows: -** ficlLockDictionary(TRUE); -** <code that updates dictionary> -** ficlLockDictionary(FALSE); -** -** Returns zero if successful, nonzero if unable to acquire lock -** before timeout (optional - could also block forever) -** -** NOTE: this function must be implemented with lock counting -** semantics: nested calls must behave properly. -*/ -#if FICL_MULTITHREAD -int ficlLockDictionary(short fLock); -#else -#define ficlLockDictionary(x) 0 /* ignore */ -#endif - -/* -** 64 bit integer math support routines: multiply two UNS32s -** to get a 64 bit product, & divide the product by an UNS32 -** to get an UNS32 quotient and remainder. Much easier in asm -** on a 32 bit CPU than in C, which usually doesn't support -** the double length result (but it should). -*/ -DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y); -UNSQR ficlLongDiv(DPUNS q, FICL_UNS y); - - -/* -** FICL_HAVE_FTRUNCATE indicates whether the current OS supports -** the ftruncate() function (available on most UNIXes). This -** function is necessary to provide the complete File-Access wordset. -*/ -#if !defined (FICL_HAVE_FTRUNCATE) -#define FICL_HAVE_FTRUNCATE 0 -#endif - - -#endif /*__SYSDEP_H__*/ diff --git a/sys/boot/ficl/loader.c b/sys/boot/ficl/loader.c index f39b1eb..349a7c6 100644 --- a/sys/boot/ficl/loader.c +++ b/sys/boot/ficl/loader.c @@ -800,15 +800,9 @@ void ficlCompilePlatform(FICL_SYSTEM *pSys) ficlSetEnv(pSys, "arch-pc98", FICL_TRUE); #elif defined(__i386__) ficlSetEnv(pSys, "arch-i386", FICL_TRUE); - ficlSetEnv(pSys, "arch-ia64", FICL_FALSE); - ficlSetEnv(pSys, "arch-powerpc", FICL_FALSE); -#elif defined(__ia64__) - ficlSetEnv(pSys, "arch-i386", FICL_FALSE); - ficlSetEnv(pSys, "arch-ia64", FICL_TRUE); ficlSetEnv(pSys, "arch-powerpc", FICL_FALSE); #elif defined(__powerpc__) ficlSetEnv(pSys, "arch-i386", FICL_FALSE); - ficlSetEnv(pSys, "arch-ia64", FICL_FALSE); ficlSetEnv(pSys, "arch-powerpc", FICL_TRUE); #endif diff --git a/sys/boot/ia64/Makefile b/sys/boot/ia64/Makefile deleted file mode 100644 index 5f24fb2..0000000 --- a/sys/boot/ia64/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -SUBDIR= common efi - -# In the ski sub-directory, one can build a loader for use under Ski. -# Ski is an Itanium simulator, originally developed by HP. It's not -# supported anymore in FreeBSD, but left for reference and education. -# SUBDIR += ski - -.include <bsd.subdir.mk> diff --git a/sys/boot/ia64/Makefile.inc b/sys/boot/ia64/Makefile.inc deleted file mode 100644 index e63fb54..0000000 --- a/sys/boot/ia64/Makefile.inc +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -BINDIR?= /boot - -# Options used when building standalone components -CFLAGS+= -ffreestanding -fshort-wchar -Wformat -LDFLAGS+= -nostdlib - -.include "../Makefile.inc" diff --git a/sys/boot/ia64/common/Makefile b/sys/boot/ia64/common/Makefile deleted file mode 100644 index ef2737f..0000000 --- a/sys/boot/ia64/common/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# $FreeBSD$ - -.include <src.opts.mk> -MK_SSP= no - -LIB= ia64 -INTERNALLIB= - -SRCS= autoload.c bootinfo.c copy.c devicename.c exec.c icache.c - -CFLAGS+= -I${.CURDIR}/../../efi/include -CFLAGS+= -I${.CURDIR}/../../efi/include/${MACHINE_CPUARCH} -CFLAGS+= -I${.CURDIR}/../../.. -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand - -.if ${MK_FORTH} != "no" -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -CFLAGS+= -I${.CURDIR}/../../ficl -CFLAGS+= -I${.CURDIR}/../../ficl/${MACHINE_CPUARCH} -.endif - -.PATH: ${.CURDIR}/../../common -.include "${.CURDIR}/../../common/Makefile.inc" - -CFLAGS+= -I${.CURDIR}/../../common - -FILES+= loader.help -CLEANFILES+= loader.help -loader.help: help.common - cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk \ - > ${.TARGET} - -.PATH: ${.CURDIR}/../../forth -FILES+= loader.4th support.4th loader.conf -FILES+= screen.4th frames.4th -FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th -FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th -.if !exists(${DESTDIR}/boot/loader.rc) -FILES+= loader.rc -.endif -.if !exists(${DESTDIR}/boot/menu.rc) -FILES+= menu.rc -.endif -FILESDIR_loader.conf= /boot/defaults - -.include <bsd.lib.mk> diff --git a/sys/boot/ia64/common/autoload.c b/sys/boot/ia64/common/autoload.c deleted file mode 100644 index ea334b9..0000000 --- a/sys/boot/ia64/common/autoload.c +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -int -ia64_autoload(void) -{ - - return (0); -} diff --git a/sys/boot/ia64/common/bootinfo.c b/sys/boot/ia64/common/bootinfo.c deleted file mode 100644 index 04e8ba2..0000000 --- a/sys/boot/ia64/common/bootinfo.c +++ /dev/null @@ -1,296 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> - * Copyright (c) 2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stand.h> -#include <string.h> -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/linker.h> -#include <sys/boot.h> - -#include <efi.h> -#include <efilib.h> - -#include "libia64.h" - -static const char howto_switches[] = "aCdrgDmphsv"; -static int howto_masks[] = { - RB_ASKNAME, RB_CDROM, RB_KDB, RB_DFLTROOT, RB_GDB, RB_MULTIPLE, - RB_MUTE, RB_PAUSE, RB_SERIAL, RB_SINGLE, RB_VERBOSE -}; - -int -bi_getboothowto(char *kargs) -{ - const char *sw; - char *opts; - int howto, i; - - howto = 0; - - /* Get the boot options from the environment first. */ - for (i = 0; howto_names[i].ev != NULL; i++) { - if (getenv(howto_names[i].ev) != NULL) - howto |= howto_names[i].mask; - } - - /* Parse kargs */ - if (kargs == NULL) - return (howto); - - opts = strchr(kargs, '-'); - while (opts != NULL) { - while (*(++opts) != '\0') { - sw = strchr(howto_switches, *opts); - if (sw == NULL) - break; - howto |= howto_masks[sw - howto_switches]; - } - opts = strchr(opts, '-'); - } - - return (howto); -} - -/* - * Copy the environment into the load area starting at (addr). - * Each variable is formatted as <name>=<value>, with a single nul - * separating each variable, and a double nul terminating the environment. - */ -vm_offset_t -bi_copyenv(vm_offset_t start) -{ - struct env_var *ep; - vm_offset_t addr, last; - size_t len; - - addr = last = start; - - /* Traverse the environment. */ - for (ep = environ; ep != NULL; ep = ep->ev_next) { - len = strlen(ep->ev_name); - if (ia64_copyin(ep->ev_name, addr, len) != len) - break; - addr += len; - if (ia64_copyin("=", addr, 1) != 1) - break; - addr++; - if (ep->ev_value != NULL) { - len = strlen(ep->ev_value); - if (ia64_copyin(ep->ev_value, addr, len) != len) - break; - addr += len; - } - if (ia64_copyin("", addr, 1) != 1) - break; - last = ++addr; - } - - if (ia64_copyin("", last++, 1) != 1) - last = start; - return(last); -} - -/* - * Copy module-related data into the load area, where it can be - * used as a directory for loaded modules. - * - * Module data is presented in a self-describing format. Each datum - * is preceded by a 32-bit identifier and a 32-bit size field. - * - * Currently, the following data are saved: - * - * MOD_NAME (variable) module name (string) - * MOD_TYPE (variable) module type (string) - * MOD_ARGS (variable) module parameters (string) - * MOD_ADDR sizeof(vm_offset_t) module load address - * MOD_SIZE sizeof(size_t) module size - * MOD_METADATA (variable) type-specific metadata - */ -#define COPY32(v, a) { \ - u_int32_t x = (v); \ - ia64_copyin(&x, a, sizeof(x)); \ - a += sizeof(x); \ -} - -#define MOD_STR(t, a, s) { \ - COPY32(t, a); \ - COPY32(strlen(s) + 1, a); \ - ia64_copyin(s, a, strlen(s) + 1); \ - a += roundup(strlen(s) + 1, sizeof(u_int64_t));\ -} - -#define MOD_NAME(a, s) MOD_STR(MODINFO_NAME, a, s) -#define MOD_TYPE(a, s) MOD_STR(MODINFO_TYPE, a, s) -#define MOD_ARGS(a, s) MOD_STR(MODINFO_ARGS, a, s) - -#define MOD_VAR(t, a, s) { \ - COPY32(t, a); \ - COPY32(sizeof(s), a); \ - ia64_copyin(&s, a, sizeof(s)); \ - a += roundup(sizeof(s), sizeof(u_int64_t)); \ -} - -#define MOD_ADDR(a, s) MOD_VAR(MODINFO_ADDR, a, s) -#define MOD_SIZE(a, s) MOD_VAR(MODINFO_SIZE, a, s) - -#define MOD_METADATA(a, mm) { \ - COPY32(MODINFO_METADATA | mm->md_type, a); \ - COPY32(mm->md_size, a); \ - ia64_copyin(mm->md_data, a, mm->md_size); \ - a += roundup(mm->md_size, sizeof(u_int64_t));\ -} - -#define MOD_END(a) { \ - COPY32(MODINFO_END, a); \ - COPY32(0, a); \ -} - -vm_offset_t -bi_copymodules(vm_offset_t addr) -{ - struct preloaded_file *fp; - struct file_metadata *md; - - /* Start with the first module on the list, should be the kernel. */ - for (fp = file_findfile(NULL, NULL); fp != NULL; fp = fp->f_next) { - /* The name field must come first. */ - MOD_NAME(addr, fp->f_name); - MOD_TYPE(addr, fp->f_type); - if (fp->f_args) - MOD_ARGS(addr, fp->f_args); - MOD_ADDR(addr, fp->f_addr); - MOD_SIZE(addr, fp->f_size); - for (md = fp->f_metadata; md != NULL; md = md->md_next) { - if (!(md->md_type & MODINFOMD_NOCOPY)) - MOD_METADATA(addr, md); - } - } - MOD_END(addr); - return(addr); -} - -/* - * Load the information expected by the kernel. - * - * - The kernel environment is copied into kernel space. - * - Module metadata are formatted and placed in kernel space. - */ -int -ia64_bootinfo(struct preloaded_file *fp, struct bootinfo **res) -{ - struct bootinfo bi; - struct preloaded_file *xp; - struct file_metadata *md; - struct devdesc *rootdev; - char *rootdevname; - vm_offset_t addr, ssym, esym; - int error; - - *res = NULL; - bzero(&bi, sizeof(struct bootinfo)); - bi.bi_magic = BOOTINFO_MAGIC; - bi.bi_version = 1; - bi.bi_boothowto = bi_getboothowto(fp->f_args); - - /* - * Allow the environment variable 'rootdev' to override the supplied - * device. This should perhaps go to MI code and/or have $rootdev - * tested/set by MI code before launching the kernel. - */ - rootdevname = getenv("rootdev"); - ia64_getdev((void**)&rootdev, rootdevname, NULL); - if (rootdev != NULL) { - /* Try reading /etc/fstab to select the root device. */ - getrootmount(ia64_fmtdev(rootdev)); - free(rootdev); - } - - md = file_findmetadata(fp, MODINFOMD_SSYM); - ssym = (md != NULL) ? *((vm_offset_t *)&(md->md_data)) : 0; - md = file_findmetadata(fp, MODINFOMD_ESYM); - esym = (md != NULL) ? *((vm_offset_t *)&(md->md_data)) : 0; - if (ssym != 0 && esym != 0) { - bi.bi_symtab = ssym; - bi.bi_esymtab = esym; - } - - /* Find the last module in the chain. */ - addr = 0; - for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) { - if (addr < (xp->f_addr + xp->f_size)) - addr = xp->f_addr + xp->f_size; - } - - addr = (addr + 15) & ~15; - - /* Copy module list and metadata. */ - bi.bi_modulep = addr; - addr = bi_copymodules(addr); - if (addr <= bi.bi_modulep) { - addr = bi.bi_modulep; - bi.bi_modulep = 0; - } - - addr = (addr + 15) & ~15; - - /* Copy our environment. */ - bi.bi_envp = addr; - addr = bi_copyenv(addr); - if (addr <= bi.bi_envp) { - addr = bi.bi_envp; - bi.bi_envp = 0; - } - - addr = (addr + 15) & ~15; - bi.bi_kernend = addr; - - error = ia64_platform_bootinfo(&bi, res); - if (error) - return (error); - - if (IS_LEGACY_KERNEL()) { - if (*res == NULL) - return (EDOOFUS); - - bcopy(&bi, *res, sizeof(bi)); - return (0); - } - - bi.bi_pbvm_pgtbl = (uintptr_t)ia64_pgtbl; - bi.bi_pbvm_pgtblsz = ia64_pgtblsz; - ia64_copyin((void *)bi.bi_memmap, addr, bi.bi_memmap_size); - bi.bi_memmap = addr; - addr = (addr + bi.bi_memmap_size + 15) & ~15; - bi.bi_kernend = addr + sizeof(bi); - ia64_copyin(&bi, addr, sizeof(bi)); - *res = (void *)addr; - return (0); -} diff --git a/sys/boot/ia64/common/copy.c b/sys/boot/ia64/common/copy.c deleted file mode 100644 index b14386e..0000000 --- a/sys/boot/ia64/common/copy.c +++ /dev/null @@ -1,217 +0,0 @@ -/*- - * Copyright (c) 2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stand.h> -#include <machine/param.h> -#include <machine/pte.h> - -#include "libia64.h" - -u_int ia64_legacy_kernel; - -uint64_t *ia64_pgtbl; -uint32_t ia64_pgtblsz; - -static int -pgtbl_extend(u_int idx) -{ - vm_paddr_t pa; - uint64_t *pgtbl; - uint32_t pgtblsz; - u_int pot; - - pgtblsz = (idx + 1) << 3; - - /* The minimum size is 4KB. */ - if (pgtblsz < 4096) - pgtblsz = 4096; - - /* Find the next higher power of 2. */ - pgtblsz--; - for (pot = 1; pot < 32; pot <<= 1) - pgtblsz = pgtblsz | (pgtblsz >> pot); - pgtblsz++; - - /* The maximum size is 1MB. */ - if (pgtblsz > 1048576) - return (ENOMEM); - - /* Make sure the size is a valid (mappable) page size. */ - if (pgtblsz == 32*1024 || pgtblsz == 128*1024 || pgtblsz == 512*1024) - pgtblsz <<= 1; - - /* Allocate naturally aligned memory. */ - pa = ia64_platform_alloc(0, pgtblsz); - if (pa == ~0UL) - return (ENOMEM); - pgtbl = (void *)pa; - - /* Initialize new page table. */ - if (ia64_pgtbl != NULL && ia64_pgtbl != pgtbl) - bcopy(ia64_pgtbl, pgtbl, ia64_pgtblsz); - bzero(pgtbl + (ia64_pgtblsz >> 3), pgtblsz - ia64_pgtblsz); - - if (ia64_pgtbl != NULL && ia64_pgtbl != pgtbl) - ia64_platform_free(0, (uintptr_t)ia64_pgtbl, ia64_pgtblsz); - - ia64_pgtbl = pgtbl; - ia64_pgtblsz = pgtblsz; - return (0); -} - -void * -ia64_va2pa(vm_offset_t va, size_t *len) -{ - uint64_t pa, pte; - u_int idx, ofs; - int error; - - /* Backward compatibility. */ - if (va >= IA64_RR_BASE(7)) { - ia64_legacy_kernel = 1; - pa = IA64_RR_MASK(va); - return ((void *)pa); - } - - if (va < IA64_PBVM_BASE) { - error = EINVAL; - goto fail; - } - - ia64_legacy_kernel = 0; - - idx = (va - IA64_PBVM_BASE) >> IA64_PBVM_PAGE_SHIFT; - if (idx >= (ia64_pgtblsz >> 3)) { - error = pgtbl_extend(idx); - if (error) - goto fail; - } - - ofs = va & IA64_PBVM_PAGE_MASK; - pte = ia64_pgtbl[idx]; - if ((pte & PTE_PRESENT) == 0) { - pa = ia64_platform_alloc(va - ofs, IA64_PBVM_PAGE_SIZE); - if (pa == ~0UL) { - error = ENOMEM; - goto fail; - } - pte = PTE_AR_RWX | PTE_DIRTY | PTE_ACCESSED | PTE_PRESENT; - pte |= (pa & PTE_PPN_MASK); - ia64_pgtbl[idx] = pte; - } - pa = (pte & PTE_PPN_MASK) + ofs; - - /* We can not cross page boundaries (in general). */ - if (*len + ofs > IA64_PBVM_PAGE_SIZE) - *len = IA64_PBVM_PAGE_SIZE - ofs; - - return ((void *)pa); - - fail: - *len = 0; - return (NULL); -} - -ssize_t -ia64_copyin(const void *src, vm_offset_t va, size_t len) -{ - void *pa; - ssize_t res; - size_t sz; - - res = 0; - while (len > 0) { - sz = len; - pa = ia64_va2pa(va, &sz); - if (sz == 0) - break; - bcopy(src, pa, sz); - len -= sz; - res += sz; - va += sz; - } - return (res); -} - -ssize_t -ia64_copyout(vm_offset_t va, void *dst, size_t len) -{ - void *pa; - ssize_t res; - size_t sz; - - res = 0; - while (len > 0) { - sz = len; - pa = ia64_va2pa(va, &sz); - if (sz == 0) - break; - bcopy(pa, dst, sz); - len -= sz; - res += sz; - va += sz; - } - return (res); -} - -uint64_t -ia64_loadaddr(u_int type, void *data, uint64_t addr) -{ - uint64_t align; - - /* - * Align ELF objects at PBVM page boundaries. Align all other - * objects at cache line boundaries for good measure. - */ - align = (type == LOAD_ELF) ? IA64_PBVM_PAGE_SIZE : CACHE_LINE_SIZE; - return ((addr + align - 1) & ~(align - 1)); -} - -ssize_t -ia64_readin(int fd, vm_offset_t va, size_t len) -{ - void *pa; - ssize_t res, s; - size_t sz; - - res = 0; - while (len > 0) { - sz = len; - pa = ia64_va2pa(va, &sz); - if (sz == 0) - break; - s = read(fd, pa, sz); - if (s <= 0) - break; - len -= s; - res += s; - va += s; - } - return (res); -} diff --git a/sys/boot/ia64/common/devicename.c b/sys/boot/ia64/common/devicename.c deleted file mode 100644 index 08d9b54..0000000 --- a/sys/boot/ia64/common/devicename.c +++ /dev/null @@ -1,169 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> - * Copyright (c) 2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stand.h> -#include <string.h> -#include <sys/disklabel.h> -#include "bootstrap.h" - -#include <efi.h> -#include <efilib.h> - -static int ia64_parsedev(struct devdesc **, const char *, const char **); - -/* - * Point (dev) at an allocated device specifier for the device matching the - * path in (devspec). If it contains an explicit device specification, - * use that. If not, use the default device. - */ -int -ia64_getdev(void **vdev, const char *devspec, const char **path) -{ - struct devdesc **dev = (struct devdesc **)vdev; - int rv; - - /* - * If it looks like this is just a path and no device, then - * use the current device instead. - */ - if (devspec == NULL || *devspec == '/' || !strchr(devspec, ':')) { - rv = ia64_parsedev(dev, getenv("currdev"), NULL); - if (rv == 0 && path != NULL) - *path = devspec; - return (rv); - } - - /* Parse the device name off the beginning of the devspec. */ - return (ia64_parsedev(dev, devspec, path)); -} - -/* - * Point (dev) at an allocated device specifier matching the string version - * at the beginning of (devspec). Return a pointer to the remaining - * text in (path). - * - * In all cases, the beginning of (devspec) is compared to the names - * of known devices in the device switch, and then any following text - * is parsed according to the rules applied to the device type. - * - * For disk-type devices, the syntax is: - * - * fs<unit>: - */ -static int -ia64_parsedev(struct devdesc **dev, const char *devspec, const char **path) -{ - struct devdesc *idev; - struct devsw *dv; - char *cp; - const char *np; - int i, err; - - /* minimum length check */ - if (strlen(devspec) < 2) - return (EINVAL); - - /* look for a device that matches */ - for (i = 0; devsw[i] != NULL; i++) { - dv = devsw[i]; - if (!strncmp(devspec, dv->dv_name, strlen(dv->dv_name))) - break; - } - if (devsw[i] == NULL) - return (ENOENT); - - idev = malloc(sizeof(struct devdesc)); - if (idev == NULL) - return (ENOMEM); - - idev->d_dev = dv; - idev->d_type = dv->dv_type; - idev->d_unit = -1; - - err = 0; - np = devspec + strlen(dv->dv_name); - if (*np != '\0' && *np != ':') { - idev->d_unit = strtol(np, &cp, 0); - if (cp == np) { - idev->d_unit = -1; - free(idev); - return (EUNIT); - } - } - if (*cp != '\0' && *cp != ':') { - free(idev); - return (EINVAL); - } - - if (path != NULL) - *path = (*cp == 0) ? cp : cp + 1; - if (dev != NULL) - *dev = idev; - else - free(idev); - return (0); -} - -char * -ia64_fmtdev(void *vdev) -{ - struct devdesc *dev = (struct devdesc *)vdev; - static char buf[32]; /* XXX device length constant? */ - - switch(dev->d_type) { - case DEVT_NONE: - strcpy(buf, "(no device)"); - break; - - default: - sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); - break; - } - - return(buf); -} - -/* - * Set currdev to suit the value being supplied in (value) - */ -int -ia64_setcurrdev(struct env_var *ev, int flags, const void *value) -{ - struct devdesc *ncurr; - int rv; - - rv = ia64_parsedev(&ncurr, value, NULL); - if (rv != 0) - return(rv); - - free(ncurr); - env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); - return (0); -} diff --git a/sys/boot/ia64/common/exec.c b/sys/boot/ia64/common/exec.c deleted file mode 100644 index b721f97..0000000 --- a/sys/boot/ia64/common/exec.c +++ /dev/null @@ -1,268 +0,0 @@ -/*- - * Copyright (c) 2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stand.h> -#include <string.h> - -#include <sys/param.h> -#include <sys/linker.h> -#include <machine/elf.h> -#include <machine/ia64_cpu.h> -#include <machine/pte.h> - -#include <efi.h> -#include <efilib.h> - -#include "libia64.h" - -static u_int itr_idx = 0; -static u_int dtr_idx = 0; - -static vm_offset_t ia64_text_start; -static size_t ia64_text_size; - -static vm_offset_t ia64_data_start; -static size_t ia64_data_size; - -static int elf64_exec(struct preloaded_file *amp); -static int elf64_obj_exec(struct preloaded_file *amp); - -static struct file_format ia64_elf = { - elf64_loadfile, - elf64_exec -}; -static struct file_format ia64_elf_obj = { - elf64_obj_loadfile, - elf64_obj_exec -}; - -struct file_format *file_formats[] = { - &ia64_elf, - &ia64_elf_obj, - NULL -}; - -static u_int -sz2shft(vm_offset_t ofs, vm_size_t sz) -{ - vm_size_t s; - u_int shft; - - shft = 12; /* Start with 4K */ - s = 1 << shft; - while (s <= sz) { - shft++; - s <<= 1; - } - do { - shft--; - s >>= 1; - } while (ofs & (s - 1)); - - return (shft); -} - -/* - * Entered with psr.ic and psr.i both zero. - */ -static void -enter_kernel(uint64_t start, struct bootinfo *bi) -{ - - __asm __volatile("srlz.i;;"); - __asm __volatile("mov cr.ipsr=%0" - :: "r"(IA64_PSR_IC - | IA64_PSR_DT - | IA64_PSR_RT - | IA64_PSR_IT - | IA64_PSR_BN)); - __asm __volatile("mov cr.iip=%0" :: "r"(start)); - __asm __volatile("mov cr.ifs=r0;;"); - __asm __volatile("mov ar.rsc=0;; flushrs;;"); - __asm __volatile("mov r8=%0" :: "r" (bi)); - __asm __volatile("rfi;;"); - - /* NOTREACHED */ -} - -static u_int -mmu_wire(vm_offset_t va, vm_paddr_t pa, u_int pgshft, u_int acc) -{ - pt_entry_t pte; - - /* Round up to the smallest possible page size. */ - if (pgshft < 12) - pgshft = 12; - /* Truncate to the largest possible page size (256MB). */ - if (pgshft > 28) - pgshft = 28; - /* Round down to a valid (mappable) page size. */ - if (pgshft > 14 && (pgshft & 1) != 0) - pgshft--; - - pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY | - PTE_PL_KERN | (acc & PTE_AR_MASK) | (pa & PTE_PPN_MASK); - - __asm __volatile("mov cr.ifa=%0" :: "r"(va)); - __asm __volatile("mov cr.itir=%0" :: "r"(pgshft << 2)); - __asm __volatile("srlz.d;;"); - - __asm __volatile("ptr.d %0,%1" :: "r"(va), "r"(pgshft << 2)); - __asm __volatile("srlz.d;;"); - __asm __volatile("itr.d dtr[%0]=%1" :: "r"(dtr_idx), "r"(pte)); - __asm __volatile("srlz.d;;"); - dtr_idx++; - - if (acc == PTE_AR_RWX || acc == PTE_AR_RX) { - __asm __volatile("ptr.i %0,%1;;" :: "r"(va), "r"(pgshft << 2)); - __asm __volatile("srlz.i;;"); - __asm __volatile("itr.i itr[%0]=%1;;" :: "r"(itr_idx), "r"(pte)); - __asm __volatile("srlz.i;;"); - itr_idx++; - } - - return (pgshft); -} - -static void -mmu_setup_legacy(uint64_t entry) -{ - - /* - * Region 6 is direct mapped UC and region 7 is direct mapped - * WC. The details of this is controlled by the Alt {I,D}TLB - * handlers. Here we just make sure that they have the largest - * possible page size to minimise TLB usage. - */ - ia64_set_rr(IA64_RR_BASE(6), (6 << 8) | (28 << 2)); - ia64_set_rr(IA64_RR_BASE(7), (7 << 8) | (28 << 2)); - __asm __volatile("srlz.i;;"); - - mmu_wire(entry, IA64_RR_MASK(entry), 28, PTE_AR_RWX); -} - -static void -mmu_setup_paged(struct bootinfo *bi) -{ - void *pa; - size_t sz; - u_int shft; - - ia64_set_rr(IA64_RR_BASE(IA64_PBVM_RR), - (IA64_PBVM_RR << 8) | (IA64_PBVM_PAGE_SHIFT << 2)); - __asm __volatile("srlz.i;;"); - - /* Wire the PBVM page table. */ - mmu_wire(IA64_PBVM_PGTBL, (uintptr_t)ia64_pgtbl, - sz2shft(IA64_PBVM_PGTBL, ia64_pgtblsz), PTE_AR_RW); - - /* Wire as much of the text segment as we can. */ - sz = ia64_text_size; /* XXX */ - pa = ia64_va2pa(ia64_text_start, &ia64_text_size); - ia64_text_size = sz; /* XXX */ - shft = sz2shft(ia64_text_start, ia64_text_size); - shft = mmu_wire(ia64_text_start, (uintptr_t)pa, shft, PTE_AR_RWX); - ia64_copyin(&shft, (uintptr_t)&bi->bi_text_mapped, 4); - - /* Wire as much of the data segment as well. */ - sz = ia64_data_size; /* XXX */ - pa = ia64_va2pa(ia64_data_start, &ia64_data_size); - ia64_data_size = sz; /* XXX */ - shft = sz2shft(ia64_data_start, ia64_data_size); - shft = mmu_wire(ia64_data_start, (uintptr_t)pa, shft, PTE_AR_RW); - ia64_copyin(&shft, (uintptr_t)&bi->bi_data_mapped, 4); - - /* Update the bootinfo with the number of TRs used. */ - ia64_copyin(&itr_idx, (uintptr_t)&bi->bi_itr_used, 4); - ia64_copyin(&dtr_idx, (uintptr_t)&bi->bi_dtr_used, 4); -} - -static int -elf64_exec(struct preloaded_file *fp) -{ - struct bootinfo *bi; - struct file_metadata *md; - Elf_Ehdr *hdr; - int error; - - md = file_findmetadata(fp, MODINFOMD_ELFHDR); - if (md == NULL) - return (EINVAL); - - error = ia64_bootinfo(fp, &bi); - if (error) - return (error); - - hdr = (Elf_Ehdr *)&(md->md_data); - printf("Entering %s at 0x%lx...\n", fp->f_name, hdr->e_entry); - - error = ia64_platform_enter(fp->f_name); - if (error) - return (error); - - __asm __volatile("rsm psr.ic|psr.i;;"); - __asm __volatile("srlz.i;;"); - - if (IS_LEGACY_KERNEL()) - mmu_setup_legacy(hdr->e_entry); - else - mmu_setup_paged(bi); - - enter_kernel(hdr->e_entry, bi); - /* NOTREACHED */ - return (EDOOFUS); -} - -static int -elf64_obj_exec(struct preloaded_file *fp) -{ - - printf("%s called for preloaded file %p (=%s):\n", __func__, fp, - fp->f_name); - return (ENOSYS); -} - -void -ia64_loadseg(Elf_Ehdr *eh, Elf_Phdr *ph, uint64_t delta) -{ - - if (eh->e_type != ET_EXEC) - return; - - if (ph->p_flags & PF_X) { - ia64_text_start = ph->p_vaddr + delta; - ia64_text_size = ph->p_memsz; - - ia64_sync_icache(ia64_text_start, ia64_text_size); - } else { - ia64_data_start = ph->p_vaddr + delta; - ia64_data_size = ph->p_memsz; - } -} - diff --git a/sys/boot/ia64/common/icache.c b/sys/boot/ia64/common/icache.c deleted file mode 100644 index 77a35d7..0000000 --- a/sys/boot/ia64/common/icache.c +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * Copyright (c) 2011 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stand.h> -#include <machine/ia64_cpu.h> - -#include "libia64.h" - -void -ia64_sync_icache(vm_offset_t va, size_t sz) -{ - uintptr_t pa; - size_t cnt, max; - - while (sz > 0) { - max = sz; - pa = (uintptr_t)ia64_va2pa(va, &max); - for (cnt = 0; cnt < max; cnt += 32) - ia64_fc_i(pa + cnt); - ia64_sync_i(); - va += max; - sz -= max; - } - ia64_srlz_i(); -} diff --git a/sys/boot/ia64/common/libia64.h b/sys/boot/ia64/common/libia64.h deleted file mode 100644 index 4bc7638..0000000 --- a/sys/boot/ia64/common/libia64.h +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * Copyright (c) 2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _LIBIA64_H_ -#define _LIBIA64_H_ - -#include <bootstrap.h> -#include <ia64/include/bootinfo.h> -#include <machine/vmparam.h> - -#define IS_LEGACY_KERNEL() (ia64_legacy_kernel) - -/* - * Portability functions provided by the loader - * implementation specific to the platform. - */ -vm_paddr_t ia64_platform_alloc(vm_offset_t, vm_size_t); -void ia64_platform_free(vm_offset_t, vm_paddr_t, vm_size_t); -int ia64_platform_bootinfo(struct bootinfo *, struct bootinfo **); -int ia64_platform_enter(const char *); - -/* - * Functions and variables provided by the ia64 common code - * and shared by all loader implementations. - */ -extern u_int ia64_legacy_kernel; - -extern uint64_t *ia64_pgtbl; -extern uint32_t ia64_pgtblsz; - -int ia64_autoload(void); -int ia64_bootinfo(struct preloaded_file *, struct bootinfo **); -uint64_t ia64_loadaddr(u_int, void *, uint64_t); -#ifdef __elfN -void ia64_loadseg(Elf_Ehdr *, Elf_Phdr *, uint64_t); -#else -void ia64_loadseg(void *, void *, uint64_t); -#endif - -ssize_t ia64_copyin(const void *, vm_offset_t, size_t); -ssize_t ia64_copyout(vm_offset_t, void *, size_t); -void ia64_sync_icache(vm_offset_t, size_t); -ssize_t ia64_readin(int, vm_offset_t, size_t); -void *ia64_va2pa(vm_offset_t, size_t *); - -char *ia64_fmtdev(struct devdesc *); -int ia64_getdev(void **, const char *, const char **); -int ia64_setcurrdev(struct env_var *, int, const void *); - -#endif /* !_LIBIA64_H_ */ diff --git a/sys/boot/ia64/efi/Makefile b/sys/boot/ia64/efi/Makefile deleted file mode 100644 index fc11d6e..0000000 --- a/sys/boot/ia64/efi/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# $FreeBSD$ - -MAN= - -.include <src.opts.mk> -MK_SSP= no - -PROG= loader.sym -INTERNALPROG= -SRCS= conf.c efimd.c main.c pal.S start.S vers.c - -.PATH: ${.CURDIR}/../../../${MACHINE_CPUARCH}/${MACHINE_CPUARCH} - -CFLAGS+= -I${.CURDIR}/../common -CFLAGS+= -I${.CURDIR}/../../common -CFLAGS+= -I${.CURDIR}/../../efi/include -CFLAGS+= -I${.CURDIR}/../../efi/include/${MACHINE_CPUARCH} -CFLAGS+= -I${.CURDIR}/../../.. -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand - -LDSCRIPT= ${.CURDIR}/ldscript.${MACHINE_CPUARCH} -LDFLAGS= -Wl,-T${LDSCRIPT} -shared -symbolic - -${PROG}: ${LDSCRIPT} - -NEWVERSWHAT= "EFI boot" ${MACHINE_CPUARCH} - -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - -OBJCOPY?= objcopy -OBJDUMP?= objdump - -FILES= loader.efi -FILESMODE_loader.efi= ${BINMODE} - -loader.efi: loader.sym - if [ `${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*' | wc -l` != 0 ]; then \ - ${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*'; \ - rm ${.ALLSRC}; \ - exit 1; \ - fi - ${OBJCOPY} -j .data -j .dynamic -j .dynstr -j .dynsym -j .hash \ - -j .rela.dyn -j .reloc -j .sdata -j .text \ - --target=efi-app-${MACHINE_CPUARCH} ${.ALLSRC} ${.TARGET} - -CLEANFILES= vers.c loader.efi - -LIBIA64= ${.OBJDIR}/../common/libia64.a -LIBEFI= ${.OBJDIR}/../../efi/libefi/libefi.a -.if ${MK_FORTH} != "no" -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - -DPADD= ${LIBIA64} ${LIBFICL} ${LIBEFI} ${LIBSTAND} -LDADD= -Wl,--whole-archive ${LIBIA64} -Wl,--no-whole-archive \ - ${LIBFICL} ${LIBEFI} -lstand - -.include <bsd.prog.mk> diff --git a/sys/boot/ia64/efi/conf.c b/sys/boot/ia64/efi/conf.c deleted file mode 100644 index 0e0d129..0000000 --- a/sys/boot/ia64/efi/conf.c +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * Copyright (c) 1997 - * Matthias Drochner. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed for the NetBSD Project - * by Matthias Drochner. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $NetBSD: conf.c,v 1.2 1997/03/22 09:03:29 thorpej Exp $ - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stand.h> -#include <efi.h> -#include <efilib.h> - -/* - * We could use linker sets for some or all of these, but - * then we would have to control what ended up linked into - * the bootstrap. So it's easier to conditionalise things - * here. - * - * XXX rename these arrays to be consistent and less namespace-hostile - */ - -/* Exported for libstand */ -struct devsw *devsw[] = { - &efipart_dev, - &efinet_dev, - NULL -}; - -struct fs_ops *file_system[] = { - &dosfs_fsops, - &ufs_fsops, - &cd9660_fsops, - &nfs_fsops, - &gzipfs_fsops, - NULL -}; - -struct netif_driver *netif_drivers[] = { - &efinetif, - NULL -}; - -/* - * Consoles - * - * We don't prototype these in efiboot.h because they require - * data structures from bootstrap.h as well. - */ -extern struct console efi_console; - -struct console *consoles[] = { - &efi_console, - NULL -}; diff --git a/sys/boot/ia64/efi/efimd.c b/sys/boot/ia64/efi/efimd.c deleted file mode 100644 index 0b29e12..0000000 --- a/sys/boot/ia64/efi/efimd.c +++ /dev/null @@ -1,264 +0,0 @@ -/*- - * Copyright (c) 2004, 2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stand.h> - -#include <efi.h> -#include <efilib.h> - -#include <libia64.h> - -#define EFI_INTEL_FPSWA \ - {0xc41b6531,0x97b9,0x11d3,{0x9a,0x29,0x00,0x90,0x27,0x3f,0xc1,0x4d}} - -static EFI_GUID fpswa_guid = EFI_INTEL_FPSWA; - -/* DIG64 Headless Console & Debug Port Table. */ -#define HCDP_TABLE_GUID \ - {0xf951938d,0x620b,0x42ef,{0x82,0x79,0xa8,0x4b,0x79,0x61,0x78,0x98}} - -static EFI_GUID hcdp_guid = HCDP_TABLE_GUID; - -static EFI_MEMORY_DESCRIPTOR *memmap; -static UINTN memmapsz; -static UINTN mapkey; -static UINTN descsz; -static UINT32 descver; - -#define IA64_EFI_CHUNK_SIZE (32 * 1048576) -static vm_paddr_t ia64_efi_chunk; - -#define IA64_EFI_PGTBLSZ_MAX 1048576 -static vm_paddr_t ia64_efi_pgtbl; -static vm_size_t ia64_efi_pgtblsz; - -/* Don't allocate memory below the boundary */ -#define IA64_EFI_ALLOC_BOUNDARY 1048576 - -static int -ia64_efi_memmap_update(void) -{ - EFI_STATUS status; - - if (memmap != NULL) { - free(memmap); - memmap = NULL; - } - - memmapsz = 0; - BS->GetMemoryMap(&memmapsz, NULL, &mapkey, &descsz, &descver); - if (memmapsz == 0) - return (FALSE); - memmap = malloc(memmapsz); - if (memmap == NULL) - return (FALSE); - - status = BS->GetMemoryMap(&memmapsz, memmap, &mapkey, &descsz, - &descver); - if (EFI_ERROR(status)) { - free(memmap); - memmap = NULL; - return (FALSE); - } - - return (TRUE); -} - -/* - * Returns 0 on failure. Successful allocations return an address - * larger or equal to IA64_EFI_ALLOC_BOUNDARY. - */ -static vm_paddr_t -ia64_efi_alloc(vm_size_t sz) -{ - EFI_PHYSICAL_ADDRESS pa; - EFI_MEMORY_DESCRIPTOR *mm; - uint8_t *mmiter, *mmiterend; - vm_size_t memsz; - UINTN npgs; - EFI_STATUS status; - - /* We can't allocate less than a page */ - if (sz < EFI_PAGE_SIZE) - return (0); - - /* The size must be a power of 2. */ - if (sz & (sz - 1)) - return (0); - - if (!ia64_efi_memmap_update()) - return (0); - - mmiter = (void *)memmap; - mmiterend = mmiter + memmapsz; - for (; mmiter < mmiterend; mmiter += descsz) { - mm = (void *)mmiter; - if (mm->Type != EfiConventionalMemory) - continue; - memsz = mm->NumberOfPages * EFI_PAGE_SIZE; - if (mm->PhysicalStart + memsz <= IA64_EFI_ALLOC_BOUNDARY) - continue; - /* - * XXX We really should make sure the memory is local to the - * BSP. - */ - pa = (mm->PhysicalStart < IA64_EFI_ALLOC_BOUNDARY) ? - IA64_EFI_ALLOC_BOUNDARY : mm->PhysicalStart; - pa = (pa + sz - 1) & ~(sz - 1); - if (pa + sz > mm->PhysicalStart + memsz) - continue; - - npgs = EFI_SIZE_TO_PAGES(sz); - status = BS->AllocatePages(AllocateAddress, EfiLoaderData, - npgs, &pa); - if (!EFI_ERROR(status)) - return (pa); - } - - printf("%s: unable to allocate %lx bytes\n", __func__, sz); - return (0); -} - -vm_paddr_t -ia64_platform_alloc(vm_offset_t va, vm_size_t sz) -{ - vm_paddr_t pa; - - if (va == 0) { - /* Page table itself. */ - if (sz > IA64_EFI_PGTBLSZ_MAX) - return (~0UL); - if (ia64_efi_pgtbl == 0) - ia64_efi_pgtbl = ia64_efi_alloc(IA64_EFI_PGTBLSZ_MAX); - if (ia64_efi_pgtbl != 0) - ia64_efi_pgtblsz = sz; - return (ia64_efi_pgtbl); - } else if (va < IA64_PBVM_BASE) { - /* Should not happen. */ - return (~0UL); - } - - /* Loader virtual memory page. */ - va -= IA64_PBVM_BASE; - - /* Allocate a big chunk that can be wired with a single PTE. */ - if (ia64_efi_chunk == 0) - ia64_efi_chunk = ia64_efi_alloc(IA64_EFI_CHUNK_SIZE); - if (va < IA64_EFI_CHUNK_SIZE) - return (ia64_efi_chunk + va); - - /* Allocate a page at a time when we go beyond the chunk. */ - pa = ia64_efi_alloc(sz); - return ((pa == 0) ? ~0UL : pa); -} - -void -ia64_platform_free(vm_offset_t va, vm_paddr_t pa, vm_size_t sz) -{ - - BS->FreePages(pa, sz >> EFI_PAGE_SHIFT); -} - -int -ia64_platform_bootinfo(struct bootinfo *bi, struct bootinfo **res) -{ - VOID *fpswa; - EFI_HANDLE handle; - EFI_STATUS status; - UINTN sz; - - bi->bi_systab = (uint64_t)ST; - bi->bi_hcdp = (uint64_t)efi_get_table(&hcdp_guid); - - sz = sizeof(EFI_HANDLE); - status = BS->LocateHandle(ByProtocol, &fpswa_guid, 0, &sz, &handle); - if (status == 0) - status = BS->HandleProtocol(handle, &fpswa_guid, &fpswa); - bi->bi_fpswa = (status == 0) ? (uint64_t)fpswa : 0; - - if (!ia64_efi_memmap_update()) - return (ENOMEM); - - bi->bi_memmap = (uint64_t)memmap; - bi->bi_memmap_size = memmapsz; - bi->bi_memdesc_size = descsz; - bi->bi_memdesc_version = descver; - - if (IS_LEGACY_KERNEL()) - *res = malloc(sizeof(**res)); - - return (0); -} - -int -ia64_platform_enter(const char *kernel) -{ - EFI_STATUS status; - - status = BS->ExitBootServices(IH, mapkey); - if (EFI_ERROR(status)) { - printf("%s: ExitBootServices() returned 0x%lx\n", __func__, - (long)status); - return (EINVAL); - } - - return (0); -} - -COMMAND_SET(pbvm, "pbvm", "show PBVM details", command_pbvm); - -static int -command_pbvm(int argc, char *argv[]) -{ - uint64_t limit, pg, start; - u_int idx; - - printf("Page table @ %p, size %x\n", ia64_pgtbl, ia64_pgtblsz); - - if (ia64_pgtbl == NULL) - return (0); - - limit = ~0; - start = ~0; - idx = 0; - while (ia64_pgtbl[idx] != 0) { - pg = ia64_pgtbl[idx]; - if (pg != limit) { - if (start != ~0) - printf("%#lx-%#lx\n", start, limit); - start = pg; - } - limit = pg + IA64_PBVM_PAGE_SIZE; - idx++; - } - if (start != ~0) - printf("%#lx-%#lx\n", start, limit); - - return (0); -} diff --git a/sys/boot/ia64/efi/ldscript.ia64 b/sys/boot/ia64/efi/ldscript.ia64 deleted file mode 100644 index 0d7901f..0000000 --- a/sys/boot/ia64/efi/ldscript.ia64 +++ /dev/null @@ -1,73 +0,0 @@ -/* $FreeBSD$ */ -OUTPUT_FORMAT("elf64-ia64-freebsd", "elf64-ia64-freebsd", "elf64-ia64-freebsd") -OUTPUT_ARCH(ia64) -ENTRY(_start_plabel) -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = 0; - ImageBase = .; - . = SIZEOF_HEADERS; - . = ALIGN(4096); - .text : { - *(.text .stub .text.* .gnu.linkonce.t.*) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.plt) - } =0x00300000010070000002000001000400 - . = ALIGN(4096); - __start_set_Xcommand_set = .; - set_Xcommand_set : { *(set_Xcommand_set) } - __stop_set_Xcommand_set = .; - .data : { - *(.rodata .rodata.* .gnu.linkonce.r.*) - *(.rodata1) - *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) - *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) - *(.opd) - *(.data .data.* .gnu.linkonce.d.*) - *(.data1) - *(.plabel) - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - } - .IA_64.unwind_info : { *(.IA_64.unwind_info* .gnu.linkonce.ia64unwi.*) } - .IA_64.unwind : { *(.IA_64.unwind* .gnu.linkonce.ia64unw.*) } - . = ALIGN(4096); - __gp = .; - .sdata : { - *(.got.plt .got) - *(.IA_64.pltoff) - *(.sdata .sdata.* .gnu.linkonce.s.*) - *(dynsbss) - *(.sbss .sbss.* .gnu.linkonce.sb.*) - *(.scommon) - } - . = ALIGN(4096); - .dynamic : { *(.dynamic) } - . = ALIGN(4096); - .rela.dyn : { - *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) - *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) - *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) - *(.rela.got) - *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) - *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) - *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) - *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) - *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) - *(.rela.plt) - *(.rela.IA_64.pltoff) - *(.relaset_*) - *(.rela.dyn .rela.dyn.*) - } - . = ALIGN(4096); - .reloc : { *(.reloc) } - . = ALIGN(4096); - .hash : { *(.hash) } - . = ALIGN(4096); - .dynsym : { *(.dynsym) } - . = ALIGN(4096); - .dynstr : { *(.dynstr) } -} diff --git a/sys/boot/ia64/efi/main.c b/sys/boot/ia64/efi/main.c deleted file mode 100644 index ec12b42..0000000 --- a/sys/boot/ia64/efi/main.c +++ /dev/null @@ -1,618 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> - * Copyright (c) 1998,2000 Doug Rabson <dfr@freebsd.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stand.h> -#include <string.h> -#include <setjmp.h> -#include <machine/sal.h> -#include <machine/pal.h> -#include <machine/pte.h> -#include <machine/dig64.h> - -#include <efi.h> -#include <efilib.h> - -#include <libia64.h> - -/* DIG64 Headless Console & Debug Port Table. */ -#define HCDP_TABLE_GUID \ - {0xf951938d,0x620b,0x42ef,{0x82,0x79,0xa8,0x4b,0x79,0x61,0x78,0x98}} - -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; - -struct arch_switch archsw; /* MI/MD interface boundary */ - -extern u_int64_t ia64_pal_entry; - -EFI_GUID acpi = ACPI_TABLE_GUID; -EFI_GUID acpi20 = ACPI_20_TABLE_GUID; -EFI_GUID devid = DEVICE_PATH_PROTOCOL; -EFI_GUID hcdp = HCDP_TABLE_GUID; -EFI_GUID imgid = LOADED_IMAGE_PROTOCOL; -EFI_GUID mps = MPS_TABLE_GUID; -EFI_GUID netid = EFI_SIMPLE_NETWORK_PROTOCOL; -EFI_GUID sal = SAL_SYSTEM_TABLE_GUID; -EFI_GUID smbios = SMBIOS_TABLE_GUID; - -static void -find_pal_proc(void) -{ - int i; - struct sal_system_table *saltab = 0; - static int sizes[6] = { - 48, 32, 16, 32, 16, 16 - }; - u_int8_t *p; - - saltab = efi_get_table(&sal); - if (saltab == NULL) { - printf("Can't find SAL System Table\n"); - return; - } - - if (memcmp(saltab->sal_signature, "SST_", 4)) { - printf("Bad signature for SAL System Table\n"); - return; - } - - p = (u_int8_t *) (saltab + 1); - for (i = 0; i < saltab->sal_entry_count; i++) { - if (*p == 0) { - struct sal_entrypoint_descriptor *dp; - dp = (struct sal_entrypoint_descriptor *) p; - ia64_pal_entry = dp->sale_pal_proc; - return; - } - p += sizes[*p]; - } - - printf("Can't find PAL proc\n"); - return; -} - -static int -usc2cmp(CHAR16 *s1, CHAR16 *s2) -{ - - while (*s1 == *s2++) { - if (*s1++ == 0) - return (0); - } - return (*s1 - *(s2 - 1)); -} - -static char * -get_dev_option(int argc, CHAR16 *argv[]) -{ - static char dev[32]; - CHAR16 *arg; - char *devp; - int i, j; - - devp = NULL; - for (i = 0; i < argc; i++) { - if (usc2cmp(argv[i], L"-dev") == 0 && i < argc - 1) { - arg = argv[i + 1]; - j = 0; - while (j < sizeof(dev) && *arg != 0) - dev[j++] = *arg++; - if (j == sizeof(dev)) - j--; - dev[j] = '\0'; - devp = dev; - break; - } - } - - return (devp); -} - -EFI_STATUS -main(int argc, CHAR16 *argv[]) -{ - struct devdesc currdev; - EFI_LOADED_IMAGE *img; - char *dev; - int i; - - /* - * XXX Chicken-and-egg problem; we want to have console output - * early, but some console attributes may depend on reading from - * eg. the boot device, which we can't do yet. We can use - * printf() etc. once this is done. - */ - cons_probe(); - - printf("\n%s, Revision %s\n", bootprog_name, bootprog_rev); - - find_pal_proc(); - - /* - * March through the device switch probing for things. - */ - for (i = 0; devsw[i] != NULL; i++) - if (devsw[i]->dv_init != NULL) - (devsw[i]->dv_init)(); - - /* - * Disable the watchdog timer. By default the boot manager sets - * the timer to 5 minutes before invoking a boot option. If we - * want to return to the boot manager, we have to disable the - * watchdog timer and since we're an interactive program, we don't - * want to wait until the user types "quit". The timer may have - * fired by then. We don't care if this fails. It does not prevent - * normal functioning in any way... - */ - BS->SetWatchdogTimer(0, 0, 0, NULL); - - /* Get our loaded image protocol interface structure. */ - BS->HandleProtocol(IH, &imgid, (VOID**)&img); - - bzero(&currdev, sizeof(currdev)); - efi_handle_lookup(img->DeviceHandle, &currdev.d_dev, &currdev.d_unit); - currdev.d_type = currdev.d_dev->dv_type; - - env_setenv("loaddev", EV_VOLATILE, ia64_fmtdev(&currdev), env_noset, - env_nounset); - - dev = get_dev_option(argc, argv); - if (dev == NULL) - dev = ia64_fmtdev(&currdev); - - env_setenv("currdev", EV_VOLATILE, dev, ia64_setcurrdev, env_nounset); - - setenv("LINES", "24", 1); /* optional */ - - archsw.arch_autoload = ia64_autoload; - archsw.arch_copyin = ia64_copyin; - archsw.arch_copyout = ia64_copyout; - archsw.arch_getdev = ia64_getdev; - archsw.arch_loadaddr = ia64_loadaddr; - archsw.arch_loadseg = ia64_loadseg; - archsw.arch_readin = ia64_readin; - - interact(); /* doesn't return */ - - return (EFI_SUCCESS); /* keep compiler happy */ -} - -COMMAND_SET(quit, "quit", "exit the loader", command_quit); - -static int -command_quit(int argc, char *argv[]) -{ - exit(0); - /* NOTREACHED */ - return (CMD_OK); -} - -COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); - -static int -command_reboot(int argc, char *argv[]) -{ - - RS->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL); - /* NOTREACHED */ - return (CMD_OK); -} - -COMMAND_SET(memmap, "memmap", "print memory map", command_memmap); - -static int -command_memmap(int argc, char *argv[]) -{ - UINTN sz; - EFI_MEMORY_DESCRIPTOR *map, *p; - UINTN key, dsz; - UINT32 dver; - EFI_STATUS status; - int i, ndesc; - static char *types[] = { - "Reserved", - "LoaderCode", - "LoaderData", - "BootServicesCode", - "BootServicesData", - "RuntimeServicesCode", - "RuntimeServicesData", - "ConventionalMemory", - "UnusableMemory", - "ACPIReclaimMemory", - "ACPIMemoryNVS", - "MemoryMappedIO", - "MemoryMappedIOPortSpace", - "PalCode" - }; - - sz = 0; - status = BS->GetMemoryMap(&sz, 0, &key, &dsz, &dver); - if (status != EFI_BUFFER_TOO_SMALL) { - printf("Can't determine memory map size\n"); - return CMD_ERROR; - } - map = malloc(sz); - status = BS->GetMemoryMap(&sz, map, &key, &dsz, &dver); - if (EFI_ERROR(status)) { - printf("Can't read memory map\n"); - return CMD_ERROR; - } - - ndesc = sz / dsz; - printf("%23s %12s %12s %8s %4s\n", - "Type", "Physical", "Virtual", "#Pages", "Attr"); - - for (i = 0, p = map; i < ndesc; - i++, p = NextMemoryDescriptor(p, dsz)) { - printf("%23s %012lx %012lx %08lx ", - types[p->Type], - p->PhysicalStart, - p->VirtualStart, - p->NumberOfPages); - if (p->Attribute & EFI_MEMORY_UC) - printf("UC "); - if (p->Attribute & EFI_MEMORY_WC) - printf("WC "); - if (p->Attribute & EFI_MEMORY_WT) - printf("WT "); - if (p->Attribute & EFI_MEMORY_WB) - printf("WB "); - if (p->Attribute & EFI_MEMORY_UCE) - printf("UCE "); - if (p->Attribute & EFI_MEMORY_WP) - printf("WP "); - if (p->Attribute & EFI_MEMORY_RP) - printf("RP "); - if (p->Attribute & EFI_MEMORY_XP) - printf("XP "); - if (p->Attribute & EFI_MEMORY_RUNTIME) - printf("RUNTIME"); - printf("\n"); - } - - return CMD_OK; -} - -COMMAND_SET(configuration, "configuration", - "print configuration tables", command_configuration); - -static const char * -guid_to_string(EFI_GUID *guid) -{ - static char buf[40]; - - sprintf(buf, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], - guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], - guid->Data4[5], guid->Data4[6], guid->Data4[7]); - return (buf); -} - -static int -command_configuration(int argc, char *argv[]) -{ - int i; - - printf("NumberOfTableEntries=%ld\n", ST->NumberOfTableEntries); - for (i = 0; i < ST->NumberOfTableEntries; i++) { - EFI_GUID *guid; - - printf(" "); - guid = &ST->ConfigurationTable[i].VendorGuid; - if (!memcmp(guid, &mps, sizeof(EFI_GUID))) - printf("MPS Table"); - else if (!memcmp(guid, &acpi, sizeof(EFI_GUID))) - printf("ACPI Table"); - else if (!memcmp(guid, &acpi20, sizeof(EFI_GUID))) - printf("ACPI 2.0 Table"); - else if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) - printf("SMBIOS Table"); - else if (!memcmp(guid, &sal, sizeof(EFI_GUID))) - printf("SAL System Table"); - else if (!memcmp(guid, &hcdp, sizeof(EFI_GUID))) - printf("DIG64 HCDP Table"); - else - printf("Unknown Table (%s)", guid_to_string(guid)); - printf(" at %p\n", ST->ConfigurationTable[i].VendorTable); - } - - return CMD_OK; -} - -COMMAND_SET(sal, "sal", "print SAL System Table", command_sal); - -static int -command_sal(int argc, char *argv[]) -{ - int i; - struct sal_system_table *saltab = 0; - static int sizes[6] = { - 48, 32, 16, 32, 16, 16 - }; - u_int8_t *p; - - saltab = efi_get_table(&sal); - if (saltab == NULL) { - printf("Can't find SAL System Table\n"); - return CMD_ERROR; - } - - if (memcmp(saltab->sal_signature, "SST_", 4)) { - printf("Bad signature for SAL System Table\n"); - return CMD_ERROR; - } - - printf("SAL Revision %x.%02x\n", - saltab->sal_rev[1], - saltab->sal_rev[0]); - printf("SAL A Version %x.%02x\n", - saltab->sal_a_version[1], - saltab->sal_a_version[0]); - printf("SAL B Version %x.%02x\n", - saltab->sal_b_version[1], - saltab->sal_b_version[0]); - - p = (u_int8_t *) (saltab + 1); - for (i = 0; i < saltab->sal_entry_count; i++) { - printf(" Desc %d", *p); - if (*p == 0) { - struct sal_entrypoint_descriptor *dp; - dp = (struct sal_entrypoint_descriptor *) p; - printf("\n"); - printf(" PAL Proc at 0x%lx\n", - dp->sale_pal_proc); - printf(" SAL Proc at 0x%lx\n", - dp->sale_sal_proc); - printf(" SAL GP at 0x%lx\n", - dp->sale_sal_gp); - } else if (*p == 1) { - struct sal_memory_descriptor *dp; - dp = (struct sal_memory_descriptor *) p; - printf(" Type %d.%d, ", - dp->sale_memory_type[0], - dp->sale_memory_type[1]); - printf("Address 0x%lx, ", - dp->sale_physical_address); - printf("Length 0x%x\n", - dp->sale_length); - } else if (*p == 5) { - struct sal_ap_wakeup_descriptor *dp; - dp = (struct sal_ap_wakeup_descriptor *) p; - printf("\n"); - printf(" Mechanism %d\n", dp->sale_mechanism); - printf(" Vector 0x%lx\n", dp->sale_vector); - } else - printf("\n"); - - p += sizes[*p]; - } - - return CMD_OK; -} - -int -print_trs(int type) -{ - struct ia64_pal_result res; - int i, maxtr; - struct { - pt_entry_t pte; - uint64_t itir; - uint64_t ifa; - struct ia64_rr rr; - } buf; - static const char *psnames[] = { - "1B", "2B", "4B", "8B", - "16B", "32B", "64B", "128B", - "256B", "512B", "1K", "2K", - "4K", "8K", "16K", "32K", - "64K", "128K", "256K", "512K", - "1M", "2M", "4M", "8M", - "16M", "32M", "64M", "128M", - "256M", "512M", "1G", "2G" - }; - static const char *manames[] = { - "WB", "bad", "bad", "bad", - "UC", "UCE", "WC", "NaT", - }; - - res = ia64_call_pal_static(PAL_VM_SUMMARY, 0, 0, 0); - if (res.pal_status != 0) { - printf("Can't get VM summary\n"); - return CMD_ERROR; - } - - if (type == 0) - maxtr = (res.pal_result[0] >> 40) & 0xff; - else - maxtr = (res.pal_result[0] >> 32) & 0xff; - - printf("%d translation registers\n", maxtr); - - pager_open(); - pager_output("TR# RID Virtual Page Physical Page PgSz ED AR PL D A MA P KEY\n"); - for (i = 0; i <= maxtr; i++) { - char lbuf[128]; - - bzero(&buf, sizeof(buf)); - res = ia64_call_pal_stacked(PAL_VM_TR_READ, i, type, - (u_int64_t) &buf); - if (res.pal_status != 0) - break; - - /* Only display valid translations */ - if ((buf.ifa & 1) == 0) - continue; - - if (!(res.pal_result[0] & 1)) - buf.pte &= ~PTE_AR_MASK; - if (!(res.pal_result[0] & 2)) - buf.pte &= ~PTE_PL_MASK; - if (!(res.pal_result[0] & 4)) - buf.pte &= ~PTE_DIRTY; - if (!(res.pal_result[0] & 8)) - buf.pte &= ~PTE_MA_MASK; - sprintf(lbuf, "%03d %06x %013lx %013lx %4s %d %d %d %d %d " - "%-3s %d %06x\n", i, buf.rr.rr_rid, buf.ifa >> 12, - (buf.pte & PTE_PPN_MASK) >> 12, - psnames[(buf.itir & ITIR_PS_MASK) >> 2], - (buf.pte & PTE_ED) ? 1 : 0, - (int)(buf.pte & PTE_AR_MASK) >> 9, - (int)(buf.pte & PTE_PL_MASK) >> 7, - (buf.pte & PTE_DIRTY) ? 1 : 0, - (buf.pte & PTE_ACCESSED) ? 1 : 0, - manames[(buf.pte & PTE_MA_MASK) >> 2], - (buf.pte & PTE_PRESENT) ? 1 : 0, - (int)((buf.itir & ITIR_KEY_MASK) >> 8)); - pager_output(lbuf); - } - pager_close(); - - if (res.pal_status != 0) { - printf("Error while getting TR contents\n"); - return CMD_ERROR; - } - return CMD_OK; -} - -COMMAND_SET(itr, "itr", "print instruction TRs", command_itr); - -static int -command_itr(int argc, char *argv[]) -{ - return print_trs(0); -} - -COMMAND_SET(dtr, "dtr", "print data TRs", command_dtr); - -static int -command_dtr(int argc, char *argv[]) -{ - return print_trs(1); -} - -COMMAND_SET(hcdp, "hcdp", "Dump HCDP info", command_hcdp); - -static char * -hcdp_string(char *s, u_int len) -{ - static char buffer[256]; - - memcpy(buffer, s, len); - buffer[len] = 0; - return (buffer); -} - -static int -command_hcdp(int argc, char *argv[]) -{ - struct dig64_hcdp_table *tbl; - struct dig64_hcdp_entry *ent; - struct dig64_gas *gas; - int i; - - tbl = efi_get_table(&hcdp); - if (tbl == NULL) { - printf("No HCDP table present\n"); - return (CMD_OK); - } - if (memcmp(tbl->signature, HCDP_SIGNATURE, sizeof(tbl->signature))) { - printf("HCDP table has invalid signature\n"); - return (CMD_OK); - } - if (tbl->length < sizeof(*tbl) - sizeof(*tbl->entry)) { - printf("HCDP table too short\n"); - return (CMD_OK); - } - printf("HCDP table at 0x%016lx\n", (u_long)tbl); - printf("Signature = %s\n", hcdp_string(tbl->signature, 4)); - printf("Length = %u\n", tbl->length); - printf("Revision = %u\n", tbl->revision); - printf("Checksum = %u\n", tbl->checksum); - printf("OEM Id = %s\n", hcdp_string(tbl->oem_id, 6)); - printf("Table Id = %s\n", hcdp_string(tbl->oem_tbl_id, 8)); - printf("OEM rev = %u\n", tbl->oem_rev); - printf("Creator Id = %s\n", hcdp_string(tbl->creator_id, 4)); - printf("Creator rev= %u\n", tbl->creator_rev); - printf("Entries = %u\n", tbl->entries); - for (i = 0; i < tbl->entries; i++) { - ent = tbl->entry + i; - printf("Entry #%d:\n", i + 1); - printf(" Type = %u\n", ent->type); - printf(" Databits = %u\n", ent->databits); - printf(" Parity = %u\n", ent->parity); - printf(" Stopbits = %u\n", ent->stopbits); - printf(" PCI seg = %u\n", ent->pci_segment); - printf(" PCI bus = %u\n", ent->pci_bus); - printf(" PCI dev = %u\n", ent->pci_device); - printf(" PCI func = %u\n", ent->pci_function); - printf(" Interrupt = %u\n", ent->interrupt); - printf(" PCI flag = %u\n", ent->pci_flag); - printf(" Baudrate = %lu\n", - ((u_long)ent->baud_high << 32) + (u_long)ent->baud_low); - gas = &ent->address; - printf(" Addr space= %u\n", gas->addr_space); - printf(" Bit width = %u\n", gas->bit_width); - printf(" Bit offset= %u\n", gas->bit_offset); - printf(" Address = 0x%016lx\n", - ((u_long)gas->addr_high << 32) + (u_long)gas->addr_low); - printf(" PCI type = %u\n", ent->pci_devid); - printf(" PCI vndr = %u\n", ent->pci_vendor); - printf(" IRQ = %u\n", ent->irq); - printf(" PClock = %u\n", ent->pclock); - printf(" PCI iface = %u\n", ent->pci_interface); - } - printf("<EOT>\n"); - return (CMD_OK); -} - -COMMAND_SET(about, "about", "about the loader", command_about); - -extern uint64_t _start_plabel[]; - -static int -command_about(int argc, char *argv[]) -{ - EFI_LOADED_IMAGE *img; - - printf("%s\n", bootprog_name); - printf("revision %s\n", bootprog_rev); - printf("built by %s\n", bootprog_maker); - printf("built on %s\n", bootprog_date); - - printf("\n"); - - BS->HandleProtocol(IH, &imgid, (VOID**)&img); - printf("image loaded at %p\n", img->ImageBase); - printf("entry at %#lx (%#lx)\n", _start_plabel[0], _start_plabel[1]); -} diff --git a/sys/boot/ia64/efi/start.S b/sys/boot/ia64/efi/start.S deleted file mode 100644 index 9d28a96..0000000 --- a/sys/boot/ia64/efi/start.S +++ /dev/null @@ -1,290 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - - .text - -#include <machine/asm.h> - -#define EFI_SUCCESS 0 -#define EFI_LOAD_ERROR 1 -#define EFI_BUFFER_TOO_SMALL 5 - -#define DT_NULL 0 /* Terminating entry. */ -#define DT_PLTRELSZ 2 /* Total size in bytes of PLT relocations. */ -#define DT_SYMTAB 6 /* Address of symbol table. */ -#define DT_RELA 7 /* Address of ElfNN_Rela relocations. */ -#define DT_RELASZ 8 /* Total size of ElfNN_Rela relocations. */ -#define DT_RELAENT 9 /* Size of each ElfNN_Rela relocation entry. */ -#define DT_SYMENT 11 /* Size of each symbol table entry. */ -#define DT_JMPREL 23 /* Address of PLT relocations. */ - -#define R_IA_64_NONE 0 /* None */ -#define R_IA_64_DIR64LSB 0x27 /* word64 LSB S + A */ -#define R_IA_64_FPTR64LSB 0x47 /* word64 LSB @fptr(S + A) */ -#define R_IA_64_REL32LSB 0x6d /* word32 LSB BD + A */ -#define R_IA_64_REL64LSB 0x6f /* word64 LSB BD + A */ -#define R_IA_64_IPLTLSB 0x81 /* function descriptor LSB speciaal */ - -ENTRY(_start, 2) - alloc loc0=ar.pfs,2,3,3,0 - mov loc1=rp - movl loc2=@gprel(ImageBase) - ;; - add loc2=gp,loc2 - ;; - mov out0=loc2 - mov out1=in1 - ;; - br.call.sptk.few rp=_reloc // relocate image - - cmp.ne p6,p0=EFI_SUCCESS,r8 // did it work? -(p6) br.cond.dpnt.few 9f - - mov out0=in0 // image_handle - mov out1=in1 // system_table - br.call.sptk.few rp=efi_main -9: - mov ar.pfs=loc0 - mov rp=loc1 - ;; - br.ret.sptk.few rp -END(_start) - - // PLABEL for PE32+ - .section .plabel, "a" - .align 16 - .global _start_plabel -_start_plabel: - data16 @iplt(_start) - .previous - - // A PE32+ relocation entry for the plabel - .section .reloc, "a" - data4 _start_plabel - data4 12 - data2 (10 << 12) + 0 - data2 (10 << 12) + 8 - .previous - -// in0: image base -// in1: system table -// -// XXX Assumes PLT relocations are of type Elf_Rela -// -// r2 = address of fptr_storage -// r3 = address of fptr_storage_end -// r4 = address of first free fptr -// -// r15 = r_offset -// r16 = r_info -OR- d_tag -// r17 = r_addend -OR- d_val (=d_ptr) -// r18 = address of .rela dynamic section -// r19 = size of .rela section -// r20 = size of .rela element (Elf_Rela) -// r21 = address of first PLT relocation -// r22 = size of PLT relocations -// r23 = relocation type -// r24 = address of symbol -// r28 = R_IA_64_IPLTLSB -// f8 = address of symbol table -// f9 = size of symtab element - -STATIC_ENTRY(_reloc, 2) - alloc loc0=ar.pfs,2,2,0,0 - ;; - mov loc1=rp - movl r29=@gprel(_DYNAMIC) // find _DYNAMIC etc. - ;; - add r15=r29,gp - movl r29=@gprel(fptr_storage) - ;; - add r2=r29,gp - movl r29=@gprel(fptr_storage_end) - ;; - add r3=r29,gp - mov r4=r2 - mov r19=0 - mov r22=0 - mov r20=24 - mov r28=R_IA_64_IPLTLSB - ;; -1: - ld8 r16=[r15],8 // read r15->d_tag - ;; - ld8 r17=[r15],8 // and r15->d_val - ;; - cmp.eq p6,p0=DT_NULL,r16 // done? -(p6) br.cond.dpnt.few 2f - ;; - cmp.eq p6,p0=DT_RELA,r16 // rela section? - ;; -(p6) add r18=r17,in0 - cmp.eq p6,p0=DT_RELASZ,r16 // rela section size? - ;; -(p6) mov r19=r17 - cmp.eq p6,p0=DT_RELAENT,r16 // rela entry size? - ;; -(p6) mov r20=r17 - cmp.eq p6,p0=DT_JMPREL,r16 // PLT relocs? - ;; -(p6) add r21=r17,in0 - cmp.eq p6,p0=DT_PLTRELSZ,r16 // PLT relocs size? - ;; -(p6) mov r22=r17 - cmp.eq p6,p0=DT_SYMTAB,r16 // symbol table? - ;; -(p6) add r29=r17,in0 - ;; -(p6) setf.sig f8=r29 - cmp.eq p6,p0=DT_SYMENT,r16 // symbol entry size? - ;; -(p6) setf.sig f9=r17 - br.dptk 1b - -2: - cmp.lt p6,p0=0,r19 -(p6) br.cond.dptk 3f - ;; - mov r19=r22 - mov r18=r21 - mov r21=0 - mov r22=0 - ;; - cmp.lt p6,p0=0,r19 -(p6) br.cond.dptk 3f - ;; - mov r8=EFI_SUCCESS - br.dptk 9f -3: - ld8 r29=[r18],8 // read r_offset - ;; - ld8 r16=[r18],8 // read r_info - add r15=r29,in0 // relocate r_offset - ;; - ld8 r17=[r18],8 // read r_addend - sub r19=r19,r20 // update relasz - extr.u r23=r16,0,32 // ELF64_R_TYPE(r16) - ;; - cmp.eq p6,p0=R_IA_64_NONE,r23 -(p6) br.cond.dpnt.few 2b - ;; - cmp.eq p6,p0=R_IA_64_REL32LSB,r23 -(p6) br.cond.dptk.few 3f - ;; - cmp.eq p6,p0=R_IA_64_REL64LSB,r23 -(p6) br.cond.dptk.few 4f - ;; - extr.u r29=r16,32,32 // ELF64_R_SYM(r16) - ;; - setf.sig f10=r29 // so we can multiply - ;; - xma.lu f10=f10,f9,f8 // f10=symtab + r_sym*syment - ;; - getf.sig r29=f10 - ;; - add r29=8,r29 // address of st_value - ;; - ld8 r29=[r29] // read symbol value - ;; - add r24=r29,in0 // relocate symbol value - ;; - cmp.eq p6,p0=R_IA_64_DIR64LSB,r23 -(p6) br.cond.dptk.few 5f - ;; - cmp.eq p6,p0=R_IA_64_FPTR64LSB,r23 -(p6) br.cond.dptk.few 6f - ;; - cmp.ne p6,p0=r28,r23 // IPLTLSB -(p6) br.cond.dptk.few 2b - - // IPLTLSB - add r29=r24,r17 // S + A - ;; - st8 [r15]=r29,8 // fdesc:FP - ;; - st8 [r15]=gp // fdesc:GP - br.cond.sptk.few 2b - - // REL32LSB -3: - add r29=in0,r17 - ;; - st4 [r15]=r29 - br.cond.sptk.few 2b - - // REL64LSB -4: - add r29=in0,r17 // BD + A - ;; - st8 [r15]=r29 // word64 - br.cond.sptk.few 2b - - // DIR64LSB -5: - add r29=r24,r17 // S + A - ;; - st8 [r15]=r29 // word64 - br.cond.sptk.few 2b - -6: - mov r29=r2 // FPTR64LSB - ;; -7: - cmp.geu p6,p0=r29,r4 // end of fptrs? -(p6) br.cond.dpnt.few 8f // can't find existing fptr - ld8 r17=[r29] // read function from fptr - ;; - cmp.eq p6,p0=r24,r17 // same function? - ;; -(p6) st8 [r15]=r29 // reuse fptr -(p6) br.cond.sptk.few 2b // done - add r29=16,r29 // next fptr - br.sptk.few 7b -8: - mov r8=EFI_BUFFER_TOO_SMALL // failure return value - cmp.geu p6,p0=r4,r3 // space left? -(p6) br.cond.dpnt.few 9f // bail out - st8 [r15]=r4 // install fptr - ;; - st8 [r4]=r24,8 // write fptr address - ;; - st8 [r4]=gp,8 // write fptr gp - br.cond.sptk.few 2b - -9: - mov ar.pfs=loc0 - mov rp=loc1 - ;; - br.ret.sptk.few rp -END(_reloc) - - .data - .align 16 -fptr_storage: - .space 1024*16 // XXX -fptr_storage_end: diff --git a/sys/boot/ia64/efi/version b/sys/boot/ia64/efi/version deleted file mode 100644 index 4f4203a..0000000 --- a/sys/boot/ia64/efi/version +++ /dev/null @@ -1,27 +0,0 @@ -$FreeBSD$ - -NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this -file is important. Make sure the current version number is on line 6. - -3.2: Various fixes to libstand, in particular dosfs. -3.1: Add the about, reboot and pbvm commands. - I-cache coherency is maintained. -3.0: Add support for PBVM. -2.2: Create direct mapping based on start address instead of mapping - first 256M. -2.1: Add support for "-dev <part>" argument parsing. -2.0: Provide devices based on the block I/O protocol, rather than the - simple file services protocol. Use the FreeBSD file system code - on top of those devices to access files. -1.2: Restructured. Has some user visible differences. -1.1: Pass the HCDP table address to the kernel via bootinfo if one - is present in the EFI system table. -1.0: Don't map the I/O port range. We expect the kernel to do it. It - was done in the loader as a debugging aid and not intended as a - service/feature. -0.3: Pass the physical address of the bootinfo block in register r8 - to the kernel. Continue to put it at the fixed address for now. -0.2: Much improved version. Significant is the support for passing - the FPSWA interface pointer to the kernel. -0.1: Initial EFI version, germinated from the NetBSD i386 - standalone, but enormously modified. diff --git a/sys/boot/ia64/ski/Makefile b/sys/boot/ia64/ski/Makefile deleted file mode 100644 index 0620126..0000000 --- a/sys/boot/ia64/ski/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# $FreeBSD$ - -MAN= - -.include <src.opts.mk> -MK_SSP= no - -PROG= skiload -STRIP= # We must not strip skiload at install time. - -SRCS= acpi_stub.c conf.c delay.c efi_stub.c exit.c main.c \ - pal_stub.S sal_stub.c skiconsole.c skifs.c skimd.c \ - ssc.c start.S time.c vers.c - -CFLAGS+= -I${.CURDIR}/../common -CFLAGS+= -I${.CURDIR}/../../common -CFLAGS+= -I${.CURDIR}/../../.. -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand - -LDSCRIPT= ${.CURDIR}/ldscript.${MACHINE_CPUARCH} -LDFLAGS= -Wl,-T${LDSCRIPT} - -NEWVERSWHAT= "SKI boot" ${MACHINE_CPUARCH} - -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - -CLEANFILES= vers.c - -LIBIA64= ${.OBJDIR}/../common/libia64.a -.if ${MK_FORTH} != "no" -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - -DPADD= ${LIBIA64} ${LIBFICL} ${LIBSTAND} -LDADD= -Wl,--whole-archive ${LIBIA64} -Wl,--no-whole-archive \ - ${LIBFICL} -lstand - -.include <bsd.prog.mk> diff --git a/sys/boot/ia64/ski/acpi_stub.c b/sys/boot/ia64/ski/acpi_stub.c deleted file mode 100644 index b16bb0a..0000000 --- a/sys/boot/ia64/ski/acpi_stub.c +++ /dev/null @@ -1,183 +0,0 @@ -/*- - * Copyright (c) 2003 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <contrib/dev/acpica/include/acpi.h> - -#define APIC_IO_SAPIC 6 -#define APIC_LOCAL_SAPIC 7 - -#pragma pack(1) - -typedef struct /* LOCAL SAPIC */ -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 ProcessorId; /* ACPI processor id */ - UINT8 LocalSapicId; /* Processor local SAPIC id */ - UINT8 LocalSapicEid; /* Processor local SAPIC eid */ - UINT8 Reserved[3]; - UINT32 ProcessorEnabled: 1; - UINT32 FlagsReserved: 31; -} LOCAL_SAPIC; - -typedef struct /* IO SAPIC */ -{ - ACPI_SUBTABLE_HEADER Header; - UINT8 IoSapicId; /* I/O SAPIC ID */ - UINT8 Reserved; /* reserved - must be zero */ - UINT32 Vector; /* interrupt base */ - UINT64 IoSapicAddress; /* SAPIC's physical address */ -} IO_SAPIC; - -/* - */ - -struct { - ACPI_TABLE_MADT MADT; - ACPI_MADT_LOCAL_SAPIC cpu0; - ACPI_MADT_LOCAL_SAPIC cpu1; - ACPI_MADT_LOCAL_SAPIC cpu2; - ACPI_MADT_LOCAL_SAPIC cpu3; - ACPI_MADT_IO_SAPIC sapic; -} apic = { - /* Header. */ - { - ACPI_SIG_MADT, /* Signature. */ - sizeof(apic), /* Length of table. */ - 0, /* ACPI minor revision. */ - 0, /* Checksum. */ - "FBSD", /* OEM Id. */ - "SKI", /* OEM table Id. */ - 0, /* OEM revision. */ - "FBSD", /* ASL compiler Id. */ - 0, /* ASL revision. */ - 0xfee00000, - }, - /* cpu0. */ - { - APIC_LOCAL_SAPIC, /* Type. */ - sizeof(apic.cpu0), /* Length. */ - 0, /* ACPI processor id */ - 0, /* Processor local SAPIC id */ - 0, /* Processor local SAPIC eid */ - { 0, 0, 0 }, - 1, /* FL: Enabled. */ - }, - /* cpu1. */ - { - APIC_LOCAL_SAPIC, /* Type. */ - sizeof(apic.cpu1), /* Length. */ - 1, /* ACPI processor id */ - 0, /* Processor local SAPIC id */ - 1, /* Processor local SAPIC eid */ - { 0, 0, 0 }, - 1, /* FL: Enabled. */ - }, - /* cpu2. */ - { - APIC_LOCAL_SAPIC, /* Type. */ - sizeof(apic.cpu2), /* Length. */ - 2, /* ACPI processor id */ - 1, /* Processor local SAPIC id */ - 0, /* Processor local SAPIC eid */ - { 0, 0, 0 }, - 0, /* FL: Enabled. */ - }, - /* cpu3. */ - { - APIC_LOCAL_SAPIC, /* Type. */ - sizeof(apic.cpu3), /* Length. */ - 3, /* ACPI processor id */ - 1, /* Processor local SAPIC id */ - 1, /* Processor local SAPIC eid */ - { 0, 0, 0 }, - 0, /* FL: Enabled. */ - }, - /* sapic. */ - { - APIC_IO_SAPIC, /* Type. */ - sizeof(apic.sapic), /* Length. */ - 4, /* IO SAPIC id. */ - 0, - 16, /* Interrupt base. */ - 0xfec00000 /* IO SAPIC address. */ - } -}; - -struct { - ACPI_TABLE_HEADER Header; - UINT64 apic_tbl; -} xsdt = { - { - ACPI_SIG_XSDT, /* Signature. */ - sizeof(xsdt), /* Length of table. */ - 0, /* ACPI minor revision. */ - 0, /* XXX checksum. */ - "FBSD", /* OEM Id. */ - "SKI", /* OEM table Id. */ - 0, /* OEM revision. */ - "FBSD", /* ASL compiler Id. */ - 0 /* ASL revision. */ - }, - 0UL /* XXX APIC table address. */ -}; - -ACPI_TABLE_RSDP acpi_root = { - ACPI_SIG_RSDP, - 0, /* XXX checksum. */ - "FBSD", - 2, /* ACPI Rev 2.0. */ - 0UL, - sizeof(xsdt), /* XSDT length. */ - 0UL, /* XXX PA of XSDT. */ - 0, /* XXX Extended checksum. */ -}; - -static void -cksum(void *addr, int sz, UINT8 *sum) -{ - UINT8 *p, s; - - p = addr; - s = 0; - while (sz--) - s += *p++; - *sum = -s; -} - -void -acpi_stub_init(void) -{ - acpi_root.XsdtPhysicalAddress = (UINT64)&xsdt; - cksum(&acpi_root, 20, &acpi_root.Checksum); - cksum(&acpi_root, sizeof(acpi_root), &acpi_root.ExtendedChecksum); - - cksum(&apic, sizeof(apic), &apic.MADT.Header.Checksum); - xsdt.apic_tbl = (UINT32)&apic; - cksum(&xsdt, sizeof(xsdt), &xsdt.Header.Checksum); -} diff --git a/sys/boot/ia64/ski/conf.c b/sys/boot/ia64/ski/conf.c deleted file mode 100644 index 3ee3b33..0000000 --- a/sys/boot/ia64/ski/conf.c +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * Copyright (c) 1997 - * Matthias Drochner. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed for the NetBSD Project - * by Matthias Drochner. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $NetBSD: conf.c,v 1.2 1997/03/22 09:03:29 thorpej Exp $ - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stand.h> - -#include "libski.h" - -/* - * We could use linker sets for some or all of these, but - * then we would have to control what ended up linked into - * the bootstrap. So it's easier to conditionalise things - * here. - * - * XXX rename these arrays to be consistent and less namespace-hostile - */ - -/* Exported for libstand */ -struct devsw *devsw[] = { - &skifs_dev, - NULL -}; - -struct fs_ops *file_system[] = { - &ski_fsops, - &ufs_fsops, - &gzipfs_fsops, - NULL -}; - -/* - * Consoles - * - * We don't prototype these in libski.h because they require - * data structures from bootstrap.h as well. - */ -extern struct console ski_console; - -struct console *consoles[] = { - &ski_console, - NULL -}; diff --git a/sys/boot/ia64/ski/delay.c b/sys/boot/ia64/ski/delay.c deleted file mode 100644 index 2389603..0000000 --- a/sys/boot/ia64/ski/delay.c +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -void -delay(int usecs) -{ - return; -} diff --git a/sys/boot/ia64/ski/efi_stub.c b/sys/boot/ia64/ski/efi_stub.c deleted file mode 100644 index 7236c69..0000000 --- a/sys/boot/ia64/ski/efi_stub.c +++ /dev/null @@ -1,259 +0,0 @@ -/*- - * Copyright (c) 2003,2004 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <machine/bootinfo.h> -#include <machine/efi.h> -#include <stand.h> -#include "libski.h" - -extern void acpi_root; -extern void sal_systab; - -struct efi_cfgtbl efi_cfgtab[] = { - { EFI_TABLE_ACPI20, (intptr_t)&acpi_root }, - { EFI_TABLE_SAL, (intptr_t)&sal_systab } -}; - -static efi_status GetTime(struct efi_tm *, struct efi_tmcap *); -static efi_status SetTime(struct efi_tm *); -static efi_status GetWakeupTime(uint8_t *, uint8_t *, struct efi_tm *); -static efi_status SetWakeupTime(uint8_t, struct efi_tm *); - -static efi_status SetVirtualAddressMap(u_long, u_long, uint32_t, - struct efi_md*); -static efi_status ConvertPointer(u_long, void **); - -static efi_status GetVariable(efi_char *, struct uuid *, uint32_t *, u_long *, - void *); -static efi_status GetNextVariableName(u_long *, efi_char *, struct uuid *); -static efi_status SetVariable(efi_char *, struct uuid *, uint32_t, u_long, - void *); - -static efi_status GetNextHighMonotonicCount(uint32_t *); -static efi_status ResetSystem(enum efi_reset, efi_status, u_long, efi_char *); - -struct efi_rt efi_rttab = { - /* Header. */ - { 0, /* XXX Signature */ - 0, /* XXX Revision */ - 0, /* XXX HeaderSize */ - 0, /* XXX CRC32 */ - }, - - /* Time services */ - GetTime, - SetTime, - GetWakeupTime, - SetWakeupTime, - - /* Virtual memory services */ - SetVirtualAddressMap, - ConvertPointer, - - /* Variable services */ - GetVariable, - GetNextVariableName, - SetVariable, - - /* Misc */ - GetNextHighMonotonicCount, - ResetSystem -}; - -struct efi_systbl efi_systab = { - /* Header. */ - { EFI_SYSTBL_SIG, - 0, /* XXX Revision */ - 0, /* XXX HeaderSize */ - 0, /* XXX CRC32 */ - }, - - /* Firmware info. */ - L"FreeBSD", 0, 0, - - /* Console stuff. */ - NULL, NULL, - NULL, NULL, - NULL, NULL, - - /* Services (runtime first). */ - (intptr_t)&efi_rttab, - NULL, - - /* Configuration tables. */ - sizeof(efi_cfgtab)/sizeof(struct efi_cfgtbl), - (intptr_t)efi_cfgtab -}; - -static efi_status -unsupported(const char *func) -{ - printf("EFI: %s not supported\n", func); - return ((1UL << 63) + 3); -} - -static efi_status -GetTime(struct efi_tm *time, struct efi_tmcap *caps) -{ - uint32_t comps[8]; - - ssc((uint64_t)comps, 0, 0, 0, SSC_GET_RTC); - time->tm_year = comps[0] + 1900; - time->tm_mon = comps[1] + 1; - time->tm_mday = comps[2]; - time->tm_hour = comps[3]; - time->tm_min = comps[4]; - time->tm_sec = comps[5]; - time->__pad1 = time->__pad2 = 0; - time->tm_nsec = 0; - time->tm_tz = 0; - time->tm_dst = 0; - return (0); -} - -static efi_status -SetTime(struct efi_tm *time) -{ - return (0); -} - -static efi_status -GetWakeupTime(uint8_t *enabled, uint8_t *pending, struct efi_tm *time) -{ - return (unsupported(__func__)); -} - -static efi_status -SetWakeupTime(uint8_t enable, struct efi_tm *time) -{ - return (unsupported(__func__)); -} - -static void -Reloc(void *addr, uint64_t delta) -{ - uint64_t **fpp = addr; - - *fpp[0] += delta; - *fpp[1] += delta; - *fpp += delta >> 3; -} - -static efi_status -SetVirtualAddressMap(u_long mapsz, u_long descsz, uint32_t version, - struct efi_md *memmap) -{ - uint64_t delta; - - delta = (uintptr_t)memmap->md_virt - memmap->md_phys; - Reloc(&efi_rttab.rt_gettime, delta); - Reloc(&efi_rttab.rt_settime, delta); - return (0); /* Hah... */ -} - -static efi_status -ConvertPointer(u_long debug, void **addr) -{ - return (unsupported(__func__)); -} - -static efi_status -GetVariable(efi_char *name, struct uuid *vendor, uint32_t *attrs, - u_long *datasz, void *data) -{ - return (unsupported(__func__)); -} - -static efi_status -GetNextVariableName(u_long *namesz, efi_char *name, struct uuid *vendor) -{ - return (unsupported(__func__)); -} - -static efi_status -SetVariable(efi_char *name, struct uuid *vendor, uint32_t attrs, u_long datasz, - void *data) -{ - return (unsupported(__func__)); -} - -static efi_status -GetNextHighMonotonicCount(uint32_t *high) -{ - static uint32_t counter = 0; - - *high = counter++; - return (0); -} - -static efi_status -ResetSystem(enum efi_reset type, efi_status status, u_long datasz, - efi_char *data) -{ - return (unsupported(__func__)); -} - -void -efi_stub_init(struct bootinfo *bi) -{ - static struct efi_md memmap[4]; - - /* Describe the SKI memory map. */ - bi->bi_memmap = (uintptr_t)(void *)memmap; - bi->bi_memmap_size = sizeof(memmap); - bi->bi_memdesc_size = sizeof(struct efi_md); - bi->bi_memdesc_version = 1; - - memmap[0].md_type = EFI_MD_TYPE_PALCODE; - memmap[0].md_phys = 0x100000; - memmap[0].md_virt = NULL; - memmap[0].md_pages = (1L*1024*1024)>>12; - memmap[0].md_attr = EFI_MD_ATTR_WB | EFI_MD_ATTR_RT; - - memmap[1].md_type = EFI_MD_TYPE_FREE; - memmap[1].md_phys = 4L*1024*1024; - memmap[1].md_virt = NULL; - memmap[1].md_pages = (128L*1024*1024)>>12; - memmap[1].md_attr = EFI_MD_ATTR_WB; - - memmap[2].md_type = EFI_MD_TYPE_FREE; - memmap[2].md_phys = 4L*1024*1024*1024; - memmap[2].md_virt = NULL; - memmap[2].md_pages = (64L*1024*1024)>>12; - memmap[2].md_attr = EFI_MD_ATTR_WB; - - memmap[3].md_type = EFI_MD_TYPE_IOPORT; - memmap[3].md_phys = 0xffffc000000; - memmap[3].md_virt = NULL; - memmap[3].md_pages = (64L*1024*1024)>>12; - memmap[3].md_attr = EFI_MD_ATTR_UC; - - bi->bi_systab = (u_int64_t)&efi_systab; -} diff --git a/sys/boot/ia64/ski/exit.c b/sys/boot/ia64/ski/exit.c deleted file mode 100644 index aeac67c..0000000 --- a/sys/boot/ia64/ski/exit.c +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/time.h> -#include <stddef.h> -#include <stand.h> -#include <stdarg.h> - -#include "libski.h" - -void -exit(int code) -{ - ssc(code, 0, 0, 0, SSC_EXIT); -} diff --git a/sys/boot/ia64/ski/ldscript.ia64 b/sys/boot/ia64/ski/ldscript.ia64 deleted file mode 100644 index e7a303f..0000000 --- a/sys/boot/ia64/ski/ldscript.ia64 +++ /dev/null @@ -1,61 +0,0 @@ -/* $FreeBSD$ */ -OUTPUT_FORMAT("elf64-ia64-freebsd", "elf64-ia64-freebsd", "elf64-ia64-freebsd") -OUTPUT_ARCH(ia64) -ENTRY(_start) -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = 0x100000; - .text : { - *(.text .stub .text.* .gnu.linkonce.t.*) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.plt) - } =0x00300000010070000002000001000400 - __start_set_Xcommand_set = .; - set_Xcommand_set : { *(set_Xcommand_set) } - __stop_set_Xcommand_set = .; - .data : { - *(.rodata .rodata.* .gnu.linkonce.r.*) - *(.rodata1) - *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) - *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) - *(.opd) - *(.data .data.* .gnu.linkonce.d.*) - *(.data1) - *(.plabel) - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - } - .IA_64.unwind_info : { *(.IA_64.unwind_info* .gnu.linkonce.ia64unwi.*) } - .IA_64.unwind : { *(.IA_64.unwind* .gnu.linkonce.ia64unw.*) } - __gp = .; - .sdata : { - *(.got.plt .got) - *(.IA_64.pltoff) - *(.sdata .sdata.* .gnu.linkonce.s.*) - *(dynsbss) - *(.sbss .sbss.* .gnu.linkonce.sb.*) - *(.scommon) - } - .dynamic : { *(.dynamic) } - .rela : { - *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) - *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) - *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) - *(.rela.got) - *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) - *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) - *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) - *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) - *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) - *(.rela.plt) - *(.rela.IA_64.pltoff) - *(.relaset_*) - *(.rela.dyn .rela.dyn.*) - } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } -} diff --git a/sys/boot/ia64/ski/libski.h b/sys/boot/ia64/ski/libski.h deleted file mode 100644 index 0e7fbc6..0000000 --- a/sys/boot/ia64/ski/libski.h +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#define MAXDEV 31 /* maximum number of distinct devices */ - -typedef unsigned long physaddr_t; - -/* exported devices XXX rename? */ -extern struct devsw skifs_dev; -extern struct devsw ski_disk; -extern struct netif_driver ski_net; - -/* Wrapper over SKI filesystems. */ -extern struct fs_ops ski_fsops; - -/* this is in startup code */ -extern void delay(int); -extern void reboot(void); - -extern int ski_boot(void); - -struct bootinfo; -struct preloaded_file; - -#define SSC_CONSOLE_INIT 20 -#define SSC_GETCHAR 21 -#define SSC_PUTCHAR 31 -#define SSC_OPEN 50 -#define SSC_CLOSE 51 -#define SSC_READ 52 -#define SSC_WRITE 53 -#define SSC_GET_COMPLETION 54 -#define SSC_WAIT_COMPLETION 55 -#define SSC_GET_RTC 65 -#define SSC_EXIT 66 -#define SSC_LOAD_SYMBOLS 69 -#define SSC_SAL_SET_VECTORS 120 - -u_int64_t ssc(u_int64_t in0, u_int64_t in1, u_int64_t in2, u_int64_t in3, - int which); diff --git a/sys/boot/ia64/ski/main.c b/sys/boot/ia64/ski/main.c deleted file mode 100644 index 5a00d1c..0000000 --- a/sys/boot/ia64/ski/main.c +++ /dev/null @@ -1,121 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> - * Copyright (c) 1998,2000 Doug Rabson <dfr@freebsd.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stand.h> -#include <string.h> -#include <setjmp.h> -#include <machine/fpu.h> - -#include <libia64.h> -#include "libski.h" - -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; - -struct devdesc currdev; /* our current device */ -struct arch_switch archsw; /* MI/MD interface boundary */ - -void -ski_main(void) -{ - static char malloc[512*1024]; - int i; - - /* - * initialise the heap as early as possible. Once this is done, - * alloc() is usable. The stack is buried inside us, so this is - * safe. - */ - setheap((void *)malloc, (void *)(malloc + 512*1024)); - - /* - * XXX Chicken-and-egg problem; we want to have console output - * early, but some console attributes may depend on reading from - * eg. the boot device, which we can't do yet. We can use - * printf() etc. once this is done. - */ - cons_probe(); - - /* - * March through the device switch probing for things. - */ - for (i = 0; devsw[i] != NULL; i++) - if (devsw[i]->dv_init != NULL) - (devsw[i]->dv_init)(); - - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); -#if 0 - printf("Memory: %ld k\n", memsize() / 1024); -#endif - - /* XXX presumes that biosdisk is first in devsw */ - currdev.d_dev = devsw[0]; - currdev.d_type = currdev.d_dev->dv_type; - currdev.d_unit = 0; - -#if 0 - /* Create arc-specific variables */ - bootfile = GetEnvironmentVariable(ARCENV_BOOTFILE); - if (bootfile) - setenv("bootfile", bootfile, 1); -#endif - - env_setenv("currdev", EV_VOLATILE, ia64_fmtdev(&currdev), - ia64_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, ia64_fmtdev(&currdev), env_noset, - env_nounset); - - setenv("LINES", "24", 1); /* optional */ - - archsw.arch_autoload = ia64_autoload; - archsw.arch_copyin = ia64_copyin; - archsw.arch_copyout = ia64_copyout; - archsw.arch_getdev = ia64_getdev; - archsw.arch_loadaddr = ia64_loadaddr; - archsw.arch_loadseg = ia64_loadseg; - archsw.arch_readin = ia64_readin; - - interact(); /* doesn't return */ - - exit(0); -} - -COMMAND_SET(quit, "quit", "exit the loader", command_quit); - -static int -command_quit(int argc, char *argv[]) -{ - exit(0); - return (CMD_OK); -} diff --git a/sys/boot/ia64/ski/pal_stub.S b/sys/boot/ia64/ski/pal_stub.S deleted file mode 100644 index 81fbd08..0000000 --- a/sys/boot/ia64/ski/pal_stub.S +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * Copyright (c) 2003 Marcel Moolenaar - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <machine/asm.h> - - .text -ENTRY(PalProc, 0) - cmp.eq p6,p0=6,r28 // PAL_PTCE_INFO -(p6) br.cond.dptk pal_ptce_info - ;; - cmp.eq p6,p0=8,r28 // PAL_VM_SUMMARY -(p6) br.cond.dptk pal_vm_summary - ;; - cmp.eq p6,p0=14,r28 // PAL_FREQ_RATIOS -(p6) br.cond.dptk pal_freq_ratios - ;; - cmp.eq p6,p0=29,r28 // PAL_HALT_LIGHT -(p6) br.cond.dptk pal_halt_light - ;; - mov r15=66 // EXIT - break.i 0x80000 // SSC - ;; -pal_ptce_info: - mov r8=0 - mov r9=0 // base - movl r10=0x0000000100000001 // loop counts (outer|inner) - mov r11=0x0000000000000000 // loop strides (outer|inner) - br.sptk b0 -pal_vm_summary: - mov r8=0 - movl r9=(8<<40)|(8<<32) // VM info 1 - mov r10=(18<<8)|(41<<0) // VM info 2 - mov r11=0 - br.sptk b0 -pal_freq_ratios: - mov r8=0 - movl r9=0x0000000B00000002 // processor ratio 11/2 - movl r10=0x0000000100000001 // bus ratio 1/1 - movl r11=0x0000000B00000002 // ITC ratio 11/2 - br.sptk b0 -pal_halt_light: - mov r8=0 - mov r9=0 - mov r10=0 - mov r11=0 - br.sptk b0 -END(PalProc) diff --git a/sys/boot/ia64/ski/sal_stub.c b/sys/boot/ia64/ski/sal_stub.c deleted file mode 100644 index 1ebbb4c..0000000 --- a/sys/boot/ia64/ski/sal_stub.c +++ /dev/null @@ -1,118 +0,0 @@ -/*- - * Copyright (c) 2003 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <machine/md_var.h> -#include <machine/sal.h> -#include <stand.h> -#include "libski.h" - -extern void PalProc(void); -static sal_entry_t SalProc; - -struct { - struct sal_system_table header; - struct sal_entrypoint_descriptor entry; - struct sal_ap_wakeup_descriptor wakeup; -} sal_systab = { - /* Header. */ - { - SAL_SIGNATURE, - sizeof(sal_systab), - { 00, 03 }, /* Revision 3.0. */ - 2, /* Number of decsriptors. */ - 0, /* XXX checksum. */ - { 0 }, - { 00, 00 }, /* XXX SAL_A version. */ - { 00, 00 }, /* XXX SAL_B version. */ - "FreeBSD", - "Ski loader", - { 0 } - }, - /* Entrypoint. */ - { - 0, /* Type=entrypoint descr. */ - { 0 }, - 0, /* XXX PalProc. */ - 0, /* XXX SalProc. */ - 0, /* XXX SalProc GP. */ - { 0 } - }, - /* AP wakeup. */ - { - 5, /* Type=AP wakeup descr. */ - 0, /* External interrupt. */ - { 0 }, - 255 /* Wakeup vector. */ - } -}; - -static inline void -puts(const char *s) -{ - s = (const char *)((7UL << 61) | (u_long)s); - while (*s) - ski_cons_putchar(*s++); -} - -static struct ia64_sal_result -SalProc(u_int64_t a1, u_int64_t a2, u_int64_t a3, u_int64_t a4, u_int64_t a5, - u_int64_t a6, u_int64_t a7, u_int64_t a8) -{ - struct ia64_sal_result res; - - res.sal_status = -3; - res.sal_result[0] = 0; - res.sal_result[1] = 0; - res.sal_result[2] = 0; - - if (a1 == SAL_FREQ_BASE) { - res.sal_status = 0; - res.sal_result[0] = 133338184; - } else if (a1 == SAL_SET_VECTORS) { - /* XXX unofficial SSC function. */ - ssc(a2, a3, a4, a5, SSC_SAL_SET_VECTORS); - } else if (a1 != SAL_GET_STATE_INFO_SIZE) { - puts("SAL: unimplemented function called\n"); - } - - return (res); -} - -void -sal_stub_init(void) -{ - struct ia64_fdesc *fd; - - fd = (void*)PalProc; - sal_systab.entry.sale_pal_proc = fd->func; - fd = (void*)SalProc; - sal_systab.entry.sale_sal_proc = fd->func; - sal_systab.entry.sale_sal_gp = fd->gp; -} diff --git a/sys/boot/ia64/ski/skiconsole.c b/sys/boot/ia64/ski/skiconsole.c deleted file mode 100644 index e5cea3d..0000000 --- a/sys/boot/ia64/ski/skiconsole.c +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stand.h> - -#include "bootstrap.h" -#include "libski.h" - -static void -ski_cons_probe(struct console *cp) -{ - cp->c_flags |= C_PRESENTIN | C_PRESENTOUT; -} - -static int -ski_cons_init(int arg) -{ - ssc(0, 0, 0, 0, SSC_CONSOLE_INIT); - return 0; -} - -void -ski_cons_putchar(int c) -{ - ssc(c, 0, 0, 0, SSC_PUTCHAR); -} - -static int pollchar = -1; - -int -ski_cons_getchar() -{ - int c; - - if (pollchar > 0) { - c = pollchar; - pollchar = -1; - return c; - } - - do { - c = ssc(0, 0, 0, 0, SSC_GETCHAR); - } while (c == 0); - - return c; -} - -int -ski_cons_poll() -{ - int c; - if (pollchar > 0) - return 1; - c = ssc(0, 0, 0, 0, SSC_GETCHAR); - if (!c) - return 0; - pollchar = c; - return 1; -} - -struct console ski_console = { - "ski", - "ia64 SKI console", - 0, - ski_cons_probe, - ski_cons_init, - ski_cons_putchar, - ski_cons_getchar, - ski_cons_poll -}; diff --git a/sys/boot/ia64/ski/skifs.c b/sys/boot/ia64/ski/skifs.c deleted file mode 100644 index 72276fe..0000000 --- a/sys/boot/ia64/ski/skifs.c +++ /dev/null @@ -1,194 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/time.h> -#include <stddef.h> -#include <stand.h> -#include <stdarg.h> - -#include <bootstrap.h> -#include "libski.h" - -struct disk_req { - unsigned long addr; - unsigned len; -}; - -struct disk_stat { - int fd; - unsigned count; -}; - -static int -skifs_open(const char *path, struct open_file *f) -{ - int fd; - - /* - * Skip leading '/' so that our pretend filesystem starts in - * the current working directory. - */ - while (*path == '/') - path++; - - fd = ssc((u_int64_t) path, 1, 0, 0, SSC_OPEN); - if (fd > 0) { - f->f_fsdata = (void*)(u_int64_t) fd; - return 0; - } - return ENOENT; -} - -static int -skifs_close(struct open_file *f) -{ - ssc((u_int64_t) f->f_fsdata, 0, 0, 0, SSC_CLOSE); - return 0; -} - -static int -skifs_read(struct open_file *f, void *buf, size_t size, size_t *resid) -{ - struct disk_req req; - struct disk_stat stat; - - req.len = size; - req.addr = (u_int64_t) buf; - ssc((u_int64_t) f->f_fsdata, 1, (u_int64_t) &req, f->f_offset, SSC_READ); - stat.fd = (u_int64_t) f->f_fsdata; - ssc((u_int64_t)&stat, 0, 0, 0, SSC_WAIT_COMPLETION); - - *resid = size - stat.count; - f->f_offset += stat.count; - return 0; -} - -static off_t -skifs_seek(struct open_file *f, off_t offset, int where) -{ - u_int64_t base; - - switch (where) { - case SEEK_SET: - base = 0; - break; - - case SEEK_CUR: - base = f->f_offset; - break; - - case SEEK_END: - printf("can't find end of file in SKI\n"); - base = f->f_offset; - break; - } - - f->f_offset = base + offset; - return base; -} - -static int -skifs_stat(struct open_file *f, struct stat *sb) -{ - bzero(sb, sizeof(*sb)); - sb->st_mode = S_IFREG | S_IRUSR; - return 0; -} - -static int -skifs_readdir(struct open_file *f, struct dirent *d) -{ - return ENOENT; -} - -struct fs_ops ski_fsops = { - "fs", - skifs_open, - skifs_close, - skifs_read, - null_write, - skifs_seek, - skifs_stat, - skifs_readdir -}; - -static int -skifs_dev_init(void) -{ - return 0; -} - -/* - * Print information about disks - */ -static void -skifs_dev_print(int verbose) -{ -} - -/* - * Attempt to open the disk described by (dev) for use by (f). - * - * Note that the philosophy here is "give them exactly what - * they ask for". This is necessary because being too "smart" - * about what the user might want leads to complications. - * (eg. given no slice or partition value, with a disk that is - * sliced - are they after the first BSD slice, or the DOS - * slice before it?) - */ -static int -skifs_dev_open(struct open_file *f, ...) -{ - return 0; -} - -static int -skifs_dev_close(struct open_file *f) -{ - - return 0; -} - -static int -skifs_dev_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) -{ - return 0; -} - -struct devsw skifs_dev = { - "fs", - DEVT_DISK, - skifs_dev_init, - skifs_dev_strategy, - skifs_dev_open, - skifs_dev_close, - noioctl, - skifs_dev_print -}; diff --git a/sys/boot/ia64/ski/skiload.cmd b/sys/boot/ia64/ski/skiload.cmd deleted file mode 100644 index 48b77e1..0000000 --- a/sys/boot/ia64/ski/skiload.cmd +++ /dev/null @@ -1,16 +0,0 @@ -# $FreeBSD$ -iar -fr -pa -b enter_kernel -c -b printf -c -b rp -c -b ssc -c -b rp -c -bD -s 11 diff --git a/sys/boot/ia64/ski/skimd.c b/sys/boot/ia64/ski/skimd.c deleted file mode 100644 index baa3138..0000000 --- a/sys/boot/ia64/ski/skimd.c +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * Copyright (c) 2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stand.h> - -#include <libia64.h> - -#include "libski.h" - -extern void acpi_stub_init(void); -extern void efi_stub_init(struct bootinfo *); -extern void sal_stub_init(void); - -vm_paddr_t -ia64_platform_alloc(vm_offset_t va, vm_size_t sz __unused) -{ - vm_paddr_t pa; - - if (va == 0) - pa = 2 * 1024 * 1024; - else - pa = (va - IA64_PBVM_BASE) + (32 * 1024 * 1024); - - return (pa); -} - -void -ia64_platform_free(vm_offset_t va __unused, vm_paddr_t pa __unused, - vm_size_t sz __unused) -{ -} - -int -ia64_platform_bootinfo(struct bootinfo *bi, struct bootinfo **res) -{ - static struct bootinfo bootinfo; - - efi_stub_init(bi); - sal_stub_init(); - acpi_stub_init(); - - if (IS_LEGACY_KERNEL()) - *res = &bootinfo; - - return (0); -} - -int -ia64_platform_enter(const char *kernel) -{ - - while (*kernel == '/') - kernel++; - ssc(0, (uint64_t)kernel, 0, 0, SSC_LOAD_SYMBOLS); - return (0); -} diff --git a/sys/boot/ia64/ski/ssc.c b/sys/boot/ia64/ski/ssc.c deleted file mode 100644 index e1f871c..0000000 --- a/sys/boot/ia64/ski/ssc.c +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stand.h> -#include "libski.h" - -/* - * Ugh... Work around a bug in the Linux version of ski for SSC_GET_RTC. The - * PSR.dt register is not preserved properly and causes further memory - * references to be done without translation. All we need to do is preserve - * PSR.dt across the SSC call. We do this by saving and restoring psr.l - * completely. - */ -u_int64_t -ssc(u_int64_t in0, u_int64_t in1, u_int64_t in2, u_int64_t in3, int which) -{ - register u_int64_t psr; - register u_int64_t ret0 __asm("r8"); - - __asm __volatile("mov %0=psr;;" : "=r"(psr)); - __asm __volatile("mov r15=%1\n\t" - "break 0x80000;;" - : "=r"(ret0) - : "r"(which), "r"(in0), "r"(in1), "r"(in2), "r"(in3)); - __asm __volatile("mov psr.l=%0;; srlz.d" :: "r"(psr)); - return ret0; -} diff --git a/sys/boot/ia64/ski/start.S b/sys/boot/ia64/ski/start.S deleted file mode 100644 index 0bd10e9..0000000 --- a/sys/boot/ia64/ski/start.S +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 2003 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#define STACKSIZE 16384 -#define FPSR_DEFAULT 0x0009804c0270033f - - .text - .global _start - .proc _start -_start: -{ .mlx - mov ar.rsc=0 - movl gp=__gp - ;; -} -{ .mlx - add r2=@gprel(stack),gp - movl r14=FPSR_DEFAULT - ;; -} -{ .mib - mov ar.bspstore=r2 - add r12=STACKSIZE-16,r2 - bsw.1 - ;; -} -{ .mmb - mov ar.rsc=3 - mov ar.fpsr=r14 - br.sptk ski_main - ;; -} - .endp _start - - .data - .align 16 -stack: .skip STACKSIZE diff --git a/sys/boot/ia64/ski/time.c b/sys/boot/ia64/ski/time.c deleted file mode 100644 index 7aa7120..0000000 --- a/sys/boot/ia64/ski/time.c +++ /dev/null @@ -1,174 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 - * Intel Corporation. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by Intel Corporation and - * its contributors. - * - * 4. Neither the name of Intel Corporation or its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <time.h> -#include <sys/time.h> -#include <stand.h> - -#include "libski.h" - -/* -// Accurate only for the past couple of centuries; -// that will probably do. -// -// (#defines From FreeBSD 3.2 lib/libc/stdtime/tzfile.h) -*/ - -#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) -#define SECSPERHOUR ( 60*60 ) -#define SECSPERDAY (24 * SECSPERHOUR) - -struct ssc_time { - int Year; - int Month; - int Day; - int Hour; - int Minute; - int Second; - int Msec; - int Wday; -}; - -time_t -EfiTimeToUnixTime(struct ssc_time *ETime) -{ - /* - // These arrays give the cumulative number of days up to the first of the - // month number used as the index (1 -> 12) for regular and leap years. - // The value at index 13 is for the whole year. - */ - static time_t CumulativeDays[2][14] = { - {0, - 0, - 31, - 31 + 28, - 31 + 28 + 31, - 31 + 28 + 31 + 30, - 31 + 28 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 }, - {0, - 0, - 31, - 31 + 29, - 31 + 29 + 31, - 31 + 29 + 31 + 30, - 31 + 29 + 31 + 30 + 31, - 31 + 29 + 31 + 30 + 31 + 30, - 31 + 29 + 31 + 30 + 31 + 30 + 31, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, - 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 }}; - - time_t UTime; - int Year; - - ETime->Year += 1900; - - /* - // Do a santity check - */ - if ( ETime->Year < 1998 || ETime->Year > 2099 || - ETime->Month == 0 || ETime->Month > 12 || - ETime->Day == 0 || ETime->Month > 31 || - ETime->Hour > 23 || - ETime->Minute > 59 || - ETime->Second > 59 ) { - return (0); - } - - /* - // Years - */ - UTime = 0; - for (Year = 1970; Year != ETime->Year; ++Year) { - UTime += (CumulativeDays[isleap(Year)][13] * SECSPERDAY); - } - - /* - // UTime should now be set to 00:00:00 on Jan 1 of the file's year. - // - // Months - */ - UTime += (CumulativeDays[isleap(ETime->Year)][ETime->Month] * SECSPERDAY); - - /* - // UTime should now be set to 00:00:00 on the first of the file's month and year - // - // Days -- Don't count the file's day - */ - UTime += (((ETime->Day > 0) ? ETime->Day-1:0) * SECSPERDAY); - - /* - // Hours - */ - UTime += (ETime->Hour * SECSPERHOUR); - - /* - // Minutes - */ - UTime += (ETime->Minute * 60); - - /* - // Seconds - */ - UTime += ETime->Second; - - return UTime; -} - -time_t -time(time_t *tloc) -{ - struct ssc_time time; - - ssc((u_int64_t) &time, 0, 0, 0, SSC_GET_RTC); - - return *tloc = EfiTimeToUnixTime(&time); -} diff --git a/sys/boot/ia64/ski/version b/sys/boot/ia64/ski/version deleted file mode 100644 index a5b40f5..0000000 --- a/sys/boot/ia64/ski/version +++ /dev/null @@ -1,12 +0,0 @@ -$FreeBSD$ - -NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this -file is important. Make sure the current version number is on line 6. - -2.0: Add support for PBVM. -1.2: Restructured. Has some user visible differences. Due to code - sharing, has been given the same version number as the EFI - loader. -0.2: Pass the address of the bootinfo block to the kernel in register - r8. Keep it at the hardwired address for now. -0.1: Initial SKI version. diff --git a/sys/boot/libstand32/Makefile b/sys/boot/libstand32/Makefile index 56f7d15..0325583 100644 --- a/sys/boot/libstand32/Makefile +++ b/sys/boot/libstand32/Makefile @@ -60,12 +60,10 @@ SRCS+= ntoh.c # string functions from libc .PATH: ${LIBC}/string -.if ${MACHINE_CPUARCH} != "ia64" SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \ memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \ strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \ strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c -.endif .if ${MACHINE_CPUARCH} == "arm" .PATH: ${LIBC}/arm/gen @@ -86,17 +84,6 @@ SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S .endif .endif -.if ${MACHINE_CPUARCH} == "ia64" -.PATH: ${LIBC}/ia64/string -SRCS+= bcmp.c bcopy.S bzero.S ffs.S memccpy.c memchr.c memcmp.c memcpy.S \ - memmove.S memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \ - strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ - strspn.c strstr.c strtok.c swab.c - -.PATH: ${LIBC}/ia64/gen -SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S -SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S -.endif .if ${MACHINE_CPUARCH} == "powerpc" .PATH: ${LIBC}/quad SRCS+= ashldi3.c ashrdi3.c diff --git a/sys/boot/userboot/libstand/Makefile b/sys/boot/userboot/libstand/Makefile index 042b6a3..692aa5a 100644 --- a/sys/boot/userboot/libstand/Makefile +++ b/sys/boot/userboot/libstand/Makefile @@ -69,18 +69,6 @@ SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \ .PATH: ${LIBC}/arm/gen SRCS+= divsi3.S .endif -.if ${MACHINE_CPUARCH} == "ia64" -.PATH: ${LIBC}/ia64/string -SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \ - memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \ - strcmp.c strcpy.c strcspn.c strlen.c \ - strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ - strspn.c strstr.c strtok.c swab.c - -.PATH: ${LIBC}/ia64/gen -SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S -SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S -.endif .if ${MACHINE_CPUARCH} == "powerpc" .PATH: ${LIBC}/libc/quad SRCS+= ashldi3.c ashrdi3.c diff --git a/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S b/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S deleted file mode 100644 index 4907ef6..0000000 --- a/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * Copyright (c) 2007 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <machine/asm.h> - - .text - -/* - * uint32_t atomic_cas_32(volatile uint32_t *p, uint32_t cmp, uint32_t v) - */ -ENTRY(atomic_cas_32, 3) - mov ar.ccv = r33 - ;; - cmpxchg4.acq r8 = [r32], r34, ar.ccv - ;; - br.ret.sptk rp -END(atomic_cas_32) - -/* - * uint64_t atomic_cas_64(volatile uint64_t *p, uint64_t cmp, uint64_t v) - */ -ENTRY(atomic_cas_64, 3) - mov ar.ccv = r33 - ;; - cmpxchg8.acq r8 = [r32], r34, ar.ccv - ;; - br.ret.sptk rp -END(atomic_cas_64) - -/* - * uint64_t atomic_add_64_nv(volatile uint64_t *p, uint64_t v) - */ -ENTRY(atomic_add_64_nv, 2) -1: - ld8 r16 = [r32] - ;; - mov ar.ccv = r16 - add r8 = r16, r33 - ;; - cmpxchg8.acq r17 = [r32], r8, ar.ccv - ;; - cmp.eq p6, p7 = r16, r17 -(p6) br.ret.sptk rp -(p7) br.cond.spnt 1b -END(atomic_add_64_nv) - -/* - * uint8_t atomic_or_8_nv(volatile uint8_t *p, uint8_t v) - */ -ENTRY(atomic_or_8_nv, 2) -1: - ld1 r16 = [r32] - ;; - mov ar.ccv = r16 - or r8 = r16, r33 - ;; - cmpxchg1.acq r17 = [r32], r8, ar.ccv - ;; - cmp.eq p6, p7 = r16, r17 -(p6) br.ret.sptk rp -(p7) br.cond.spnt 1b -END(atomic_or_8_nv) - -ENTRY(membar_producer, 0) - mf - ;; - br.ret.sptk rp -END(membar_producer) diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h b/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h index f515614..de16611 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h @@ -222,7 +222,7 @@ extern "C" { * The following set of definitions characterize Solaris on AMD's * 64-bit systems. */ -#if defined(__x86_64) || defined(__amd64) || defined(__ia64__) +#if defined(__x86_64) || defined(__amd64) #if !defined(__amd64) #define __amd64 /* preferred guard */ diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 68e761b..815a9b7 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -428,54 +428,6 @@ freebsd32_fexecve(struct thread *td, struct freebsd32_fexecve_args *uap) return (error); } -#ifdef __ia64__ -static int -freebsd32_mmap_partial(struct thread *td, vm_offset_t start, vm_offset_t end, - int prot, int fd, off_t pos) -{ - vm_map_t map; - vm_map_entry_t entry; - int rv; - - map = &td->td_proc->p_vmspace->vm_map; - if (fd != -1) - prot |= VM_PROT_WRITE; - - if (vm_map_lookup_entry(map, start, &entry)) { - if ((entry->protection & prot) != prot) { - rv = vm_map_protect(map, - trunc_page(start), - round_page(end), - entry->protection | prot, - FALSE); - if (rv != KERN_SUCCESS) - return (EINVAL); - } - } else { - vm_offset_t addr = trunc_page(start); - rv = vm_map_find(map, NULL, 0, &addr, PAGE_SIZE, 0, - VMFS_NO_SPACE, prot, VM_PROT_ALL, 0); - if (rv != KERN_SUCCESS) - return (EINVAL); - } - - if (fd != -1) { - struct pread_args r; - r.fd = fd; - r.buf = (void *) start; - r.nbyte = end - start; - r.offset = pos; - return (sys_pread(td, &r)); - } else { - while (start < end) { - subyte((void *) start, 0); - start++; - } - return (0); - } -} -#endif - int freebsd32_mprotect(struct thread *td, struct freebsd32_mprotect_args *uap) { @@ -484,7 +436,7 @@ freebsd32_mprotect(struct thread *td, struct freebsd32_mprotect_args *uap) ap.addr = PTRIN(uap->addr); ap.len = uap->len; ap.prot = uap->prot; -#if defined(__amd64__) || defined(__ia64__) +#if defined(__amd64__) if (i386_read_exec && (ap.prot & PROT_READ) != 0) ap.prot |= PROT_EXEC; #endif @@ -501,80 +453,8 @@ freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap) int flags = uap->flags; int fd = uap->fd; off_t pos = PAIR32TO64(off_t,uap->pos); -#ifdef __ia64__ - vm_size_t pageoff; - int error; - - /* - * Attempt to handle page size hassles. - */ - pageoff = (pos & PAGE_MASK); - if (flags & MAP_FIXED) { - vm_offset_t start, end; - start = addr; - end = addr + len; - - if (start != trunc_page(start)) { - error = freebsd32_mmap_partial(td, start, - round_page(start), prot, - fd, pos); - if (fd != -1) - pos += round_page(start) - start; - start = round_page(start); - } - if (end != round_page(end)) { - vm_offset_t t = trunc_page(end); - error = freebsd32_mmap_partial(td, t, end, - prot, fd, - pos + t - start); - end = trunc_page(end); - } - if (end > start && fd != -1 && (pos & PAGE_MASK)) { - /* - * We can't map this region at all. The specified - * address doesn't have the same alignment as the file - * position. Fake the mapping by simply reading the - * entire region into memory. First we need to make - * sure the region exists. - */ - vm_map_t map; - struct pread_args r; - int rv; - - prot |= VM_PROT_WRITE; - map = &td->td_proc->p_vmspace->vm_map; - rv = vm_map_remove(map, start, end); - if (rv != KERN_SUCCESS) - return (EINVAL); - rv = vm_map_find(map, NULL, 0, &start, end - start, - 0, VMFS_NO_SPACE, prot, VM_PROT_ALL, 0); - if (rv != KERN_SUCCESS) - return (EINVAL); - r.fd = fd; - r.buf = (void *) start; - r.nbyte = end - start; - r.offset = pos; - error = sys_pread(td, &r); - if (error) - return (error); - - td->td_retval[0] = addr; - return (0); - } - if (end == start) { - /* - * After dealing with the ragged ends, there - * might be none left. - */ - td->td_retval[0] = addr; - return (0); - } - addr = start; - len = end - start; - } -#endif -#if defined(__amd64__) || defined(__ia64__) +#if defined(__amd64__) if (i386_read_exec && (prot & PROT_READ)) prot |= PROT_EXEC; #endif diff --git a/sys/compat/freebsd32/freebsd32_util.h b/sys/compat/freebsd32/freebsd32_util.h index 9282275..a5945cf 100644 --- a/sys/compat/freebsd32/freebsd32_util.h +++ b/sys/compat/freebsd32/freebsd32_util.h @@ -47,7 +47,7 @@ struct freebsd32_ps_strings { int ps_nenvstr; /* the number of environment strings */ }; -#if defined(__amd64__) || defined(__ia64__) +#if defined(__amd64__) #include <compat/ia32/ia32_util.h> #endif diff --git a/sys/compat/ia32/ia32_util.h b/sys/compat/ia32/ia32_util.h index fe87b72..6b5f9a1 100644 --- a/sys/compat/ia32/ia32_util.h +++ b/sys/compat/ia32/ia32_util.h @@ -39,17 +39,10 @@ #include <sys/sysent.h> #include <sys/cdefs.h> -#ifdef __ia64__ -#define FREEBSD32_MAXUSER ((1ul << 32) - IA32_PAGE_SIZE * 2) -#define FREEBSD32_MINUSER 0 -#define FREEBSD32_SHAREDPAGE 0 -#define FREEBSD32_USRSTACK FREEBSD32_MAXUSER -#else /* __ia64__ */ #define FREEBSD32_MAXUSER ((1ul << 32) - IA32_PAGE_SIZE) #define FREEBSD32_MINUSER 0 #define FREEBSD32_SHAREDPAGE (FREEBSD32_MAXUSER - IA32_PAGE_SIZE) #define FREEBSD32_USRSTACK FREEBSD32_SHAREDPAGE -#endif /* __ia64 */ #define IA32_PAGE_SIZE 4096 #define IA32_MAXDSIZ (512*1024*1024) /* 512MB */ diff --git a/sys/compat/ndis/pe_var.h b/sys/compat/ndis/pe_var.h index 84e0162..9729f0b 100644 --- a/sys/compat/ndis/pe_var.h +++ b/sys/compat/ndis/pe_var.h @@ -111,7 +111,6 @@ typedef struct image_file_header image_file_header; #define IMAGE_FILE_MACHINE_AM33 0x01d3 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1 -#define IMAGE_FILE_MACHINE_IA64 0x0200 #define IMAGE_FILE_MACHINE_MIPS16 0x0266 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366 @@ -333,7 +332,6 @@ typedef struct image_base_reloc image_base_reloc; #define IMAGE_REL_BASED_SECTION 6 #define IMAGE_REL_BASED_REL 7 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9 -#define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */ #define IMAGE_REL_BASED_DIR64 10 #define IMAGE_REL_BASED_HIGH3ADJ 11 diff --git a/sys/conf/Makefile.ia64 b/sys/conf/Makefile.ia64 deleted file mode 100644 index de4d41c..0000000 --- a/sys/conf/Makefile.ia64 +++ /dev/null @@ -1,53 +0,0 @@ -# Makefile.ia64 -- with config changes. -# Copyright 1990 W. Jolitz -# from: src/sys/conf/Makefile.alpha,v 1.76 -# $FreeBSD$ -# -# Makefile for FreeBSD -# -# This makefile is constructed from a machine description: -# config machineid -# Most changes should be made in the machine description -# /sys/ia64/conf/``machineid'' -# after which you should do -# config machineid -# Generic makefile changes should be made in -# /sys/conf/Makefile.ia64 -# after which config should be rerun for all machines. -# - -# Which version of config(8) is required. -%VERSREQ= 600012 - -STD8X16FONT?= iso - -.if !defined(S) -.if exists(./@/.) -S= ./@ -.else -S= ../../.. -.endif -.endif -.include "$S/conf/kern.pre.mk" - -INCLUDES+= -I$S/contrib/ia64/libuwx/src - -CFLAGS+= -mconstant-gp - -ASM_CFLAGS= -x assembler-with-cpp -Wa,-x -DLOCORE ${CFLAGS} - -%BEFORE_DEPEND - -%OBJS - -%FILES.c - -%FILES.s - -%FILES.m - -%CLEAN - -%RULES - -.include "$S/conf/kern.post.mk" diff --git a/sys/conf/files.ia64 b/sys/conf/files.ia64 deleted file mode 100644 index 71b6232..0000000 --- a/sys/conf/files.ia64 +++ /dev/null @@ -1,137 +0,0 @@ -# This file tells config what files go into building a kernel, -# files marked standard are always included. -# -# $FreeBSD$ -# -# The long compile-with and dependency lines are required because of -# limitations in config: backslash-newline doesn't work in strings, and -# dependency lines other than the first are silently ignored. -# -# -font8x16.o optional std8x16font \ - compile-with "uudecode < /usr/share/syscons/fonts/${STD8X16FONT}-8x16.fnt && file2c 'unsigned char font_16[16*256] = {' '};' < ${STD8X16FONT}-8x16 > font8x16.c && ${CC} -c ${CFLAGS} font8x16.c" \ - no-implicit-rule before-depend \ - clean "${STD8X16FONT}-8x16 font8x16.c" -# -atkbdmap.h optional atkbd_dflt_keymap \ - compile-with "/usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ - no-obj no-implicit-rule before-depend \ - clean "atkbdmap.h" -# -font.h optional sc_dflt_font \ - compile-with "uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'static u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'static u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'static u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \ - no-obj no-implicit-rule before-depend \ - clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8" -# -ukbdmap.h optional ukbd_dflt_keymap \ - compile-with "/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ - no-obj no-implicit-rule before-depend \ - clean "ukbdmap.h" -# -cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S optional zfs compile-with "${ZFS_S}" -compat/ia32/ia32_sysvec.c optional compat_freebsd32 -contrib/ia64/libuwx/src/uwx_bstream.c standard -contrib/ia64/libuwx/src/uwx_context.c standard -contrib/ia64/libuwx/src/uwx_env.c standard -contrib/ia64/libuwx/src/uwx_scoreboard.c standard -contrib/ia64/libuwx/src/uwx_step.c standard -contrib/ia64/libuwx/src/uwx_str.c standard -contrib/ia64/libuwx/src/uwx_swap.c standard -contrib/ia64/libuwx/src/uwx_trace.c standard -contrib/ia64/libuwx/src/uwx_uinfo.c standard -contrib/ia64/libuwx/src/uwx_utable.c standard -crypto/blowfish/bf_enc.c optional crypto | ipsec -crypto/des/des_enc.c optional crypto | ipsec | netsmb -dev/atkbdc/atkbd.c optional atkbd atkbdc -dev/atkbdc/atkbd_atkbdc.c optional atkbd atkbdc -dev/atkbdc/atkbdc.c optional atkbdc -dev/atkbdc/atkbdc_isa.c optional atkbdc isa -dev/atkbdc/atkbdc_subr.c optional atkbdc -dev/atkbdc/psm.c optional psm atkbdc -dev/fb/fb.c optional fb | vga -dev/fb/vga.c optional vga -dev/hwpmc/hwpmc_ia64.c optional hwpmc -dev/io/iodev.c optional io -dev/kbd/kbd.c optional atkbd | sc | ukbd | vt -dev/syscons/scterm-teken.c optional sc -dev/syscons/scvgarndr.c optional sc vga -dev/syscons/scvtb.c optional sc -dev/uart/uart_cpu_ia64.c optional uart -dev/acpica/acpi_if.m standard -ia64/acpica/OsdEnvironment.c optional acpi -ia64/acpica/acpi_machdep.c optional acpi -ia64/acpica/acpi_wakeup.c optional acpi -ia64/acpica/madt.c optional acpi -ia64/disasm/disasm_decode.c standard -ia64/disasm/disasm_extract.c standard -ia64/disasm/disasm_format.c standard -ia64/ia32/ia32_misc.c optional compat_freebsd32 -ia64/ia32/ia32_reg.c optional compat_freebsd32 -ia64/ia32/ia32_signal.c optional compat_freebsd32 -ia64/ia32/ia32_trap.c optional compat_freebsd32 -ia64/ia64/autoconf.c standard -ia64/ia64/bus_machdep.c standard -ia64/ia64/busdma_machdep.c standard -ia64/ia64/clock.c standard -ia64/ia64/context.S standard -ia64/ia64/db_machdep.c optional ddb -ia64/ia64/dump_machdep.c standard -ia64/ia64/efi.c standard -ia64/ia64/elf_machdep.c standard -ia64/ia64/emulate.c standard -ia64/ia64/exception.S standard -ia64/ia64/gdb_machdep.c optional gdb -ia64/ia64/highfp.c standard -ia64/ia64/in_cksum.c optional inet | inet6 -ia64/ia64/interrupt.c standard -ia64/ia64/iodev_machdep.c optional io -ia64/ia64/locore.S standard no-obj -ia64/ia64/machdep.c standard -ia64/ia64/mca.c standard -ia64/ia64/mem.c optional mem -ia64/ia64/mp_locore.S optional smp -ia64/ia64/mp_machdep.c optional smp -ia64/ia64/nexus.c standard -ia64/ia64/pal.S standard -ia64/ia64/physical.S standard -ia64/ia64/physmem.c standard -ia64/ia64/pmap.c standard -ia64/ia64/ptrace_machdep.c standard -ia64/ia64/sal.c standard -ia64/ia64/sapic.c standard -ia64/ia64/setjmp.S standard -ia64/ia64/stack_machdep.c optional ddb | stack -ia64/ia64/support.S standard -ia64/ia64/sys_machdep.c standard -ia64/ia64/syscall.S standard -ia64/ia64/trap.c standard -ia64/ia64/uio_machdep.c standard -ia64/ia64/uma_machdep.c standard -ia64/ia64/unaligned.c standard -ia64/ia64/unwind.c standard -ia64/ia64/vm_machdep.c standard -ia64/ia64/xtrace.c optional xtrace -ia64/isa/isa.c optional isa -ia64/isa/isa_dma.c optional isa -ia64/pci/pci_cfgreg.c optional pci -isa/syscons_isa.c optional sc -isa/vga_isa.c optional vga -kern/kern_clocksource.c standard -libkern/bcmp.c standard -libkern/ffsl.c standard -libkern/fls.c standard -libkern/flsl.c standard -libkern/flsll.c standard -libkern/ia64/__divdi3.S standard -libkern/ia64/__divsi3.S standard -libkern/ia64/__moddi3.S standard -libkern/ia64/__modsi3.S standard -libkern/ia64/__udivdi3.S standard -libkern/ia64/__udivsi3.S standard -libkern/ia64/__umoddi3.S standard -libkern/ia64/__umodsi3.S standard -libkern/ia64/bswap16.S standard -libkern/ia64/bswap32.S standard -libkern/memmove.c standard -libkern/memset.c standard -kern/subr_dummy_vdso_tc.c standard diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index ee9a204..deba3e5 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -72,15 +72,6 @@ INLINE_LIMIT?= 8000 .endif # -# For IA-64, we use r13 for the kernel globals pointer and we only use -# a very small subset of float registers for integer divides. -# -.if ${MACHINE_CPUARCH} == "ia64" -CFLAGS+= -ffixed-r13 -mfixed-range=f32-f127 -fpic #-mno-sdata -INLINE_LIMIT?= 15000 -.endif - -# # For sparc64 we want the medany code model so modules may be located # anywhere in the 64-bit address space. We also tell GCC to use floating # point emulation. This avoids using floating point registers for integer @@ -147,7 +138,7 @@ CFLAGS+= -ffreestanding # # GCC SSP support # -.if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \ +.if ${MK_SSP} != "no" && \ ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" CFLAGS+= -fstack-protector .endif diff --git a/sys/conf/ldscript.ia64 b/sys/conf/ldscript.ia64 deleted file mode 100644 index 8e0b297..0000000 --- a/sys/conf/ldscript.ia64 +++ /dev/null @@ -1,152 +0,0 @@ -/* $FreeBSD$ */ -OUTPUT_FORMAT("elf64-ia64-freebsd", "elf64-ia64-freebsd", "elf64-ia64-freebsd") -OUTPUT_ARCH(ia64) -ENTRY(__start) -SEARCH_DIR(/usr/lib); -kernel_text = 0x9ffc000000000000; -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = kernel_text + SIZEOF_HEADERS; - .interp : { *(.interp) } - - PROVIDE (btext = .); - .text : - { - *(.ivt) - *(.ivt.text) - *(.text .stub .text.* .gnu.linkonce.t.*) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - } = 0x00300000010070000002000001000400 - .init : { *(.init) } = 0x00300000010070000002000001000400 - .plt : { *(.plt) } - .fini : { *(.fini) } = 0x00300000010070000002000001000400 - _etext = .; - PROVIDE (etext = .); - - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rela.init : { *(.rela.init) } - .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } - .rela.fini : { *(.rela.fini) } - .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } - .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } - .rela.ctors : { *(.rela.ctors) } - .rela.dtors : { *(.rela.dtors) } - .rela.got : { *(.rela.got) } - .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } - .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } - .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } - .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } - .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } - .rela.plt : { *(.rela.plt) } - .rela.IA_64.pltoff : { *(.rela.IA_64.pltoff) } - - .IA_64.unwind_info : { *(.IA_64.unwind_info* .gnu.linkonce.ia64unwi.*) } - .IA_64.unwind : { *(.IA_64.unwind* .gnu.linkonce.ia64unw.*) } - - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - .rodata1 : { *(.rodata1) } - .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } - .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } - .opd : { *(.opd) } - - /* Adjust the address for the data segment. We want to start in the next - page in the loader virtual memory. */ - . = ALIGN(65536); - - PROVIDE (bdata = .); - .data : - { - *(.ivt.data) - *(.data .data.* .gnu.linkonce.d.*) - SORT(CONSTRUCTORS) - } - .data1 : { *(.data1) } - .dynamic : { *(.dynamic) } - .ctors : - { - *(.ctors) - *(SORT(.ctors.*)) - } - .dtors : - { - *(.dtors) - *(SORT(.dtors.*)) - } - . = ALIGN(16); - __gp = . + 0x200000; - .got : { *(.got.plt) *(.got) } - .IA_64.pltoff : { *(.IA_64.pltoff) } - /* 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 : - { - *(.sdata .sdata.* .gnu.linkonce.s.*) - } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - .sbss : - { - PROVIDE (__sbss_start = .); - PROVIDE (___sbss_start = .); - *(.dynsbss) - *(.sbss .sbss.* .gnu.linkonce.sb.*) - *(.scommon) - PROVIDE (__sbss_end = .); - PROVIDE (___sbss_end = .); - } - .bss : - { - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - /* Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections. */ - . = ALIGN(64 / 8); - } - . = ALIGN(64 / 8); - _end = .; - PROVIDE (end = .); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } -} diff --git a/sys/conf/options.ia64 b/sys/conf/options.ia64 deleted file mode 100644 index e5ef143..0000000 --- a/sys/conf/options.ia64 +++ /dev/null @@ -1,33 +0,0 @@ -# $FreeBSD$ -# Options specific to the ia64 platform kernels - -ITANIUM opt_global.h -ITANIUM2 opt_global.h - -LOG2_ID_PAGE_SIZE opt_global.h -LOG2_PAGE_SIZE opt_global.h - -UWX_TRACE_ENABLE opt_global.h - -COMPAT_FREEBSD32 opt_compat.h - -PV_STATS opt_pmap.h - -XTRACE - -VGA_ALT_SEQACCESS opt_vga.h -VGA_DEBUG opt_vga.h -VGA_NO_FONT_LOADING opt_vga.h -VGA_NO_MODE_CHANGE opt_vga.h -VGA_SLOW_IOACCESS opt_vga.h -VGA_WIDTH90 opt_vga.h - -# AGP debugging. -AGP_DEBUG opt_agp.h - -PSM_HOOKRESUME opt_psm.h -PSM_RESETAFTERSUSPEND opt_psm.h -PSM_DEBUG opt_psm.h - -# Atkbd options -ATKBD_DFLT_KEYMAP opt_atkbd.h diff --git a/sys/contrib/dev/acpica/acpica_prep.sh b/sys/contrib/dev/acpica/acpica_prep.sh index 4a467a1..a6802ef 100755 --- a/sys/contrib/dev/acpica/acpica_prep.sh +++ b/sys/contrib/dev/acpica/acpica_prep.sh @@ -85,6 +85,6 @@ rm -rf ${wrk} # assist the developer in generating a diff echo "Directories you may want to 'svn diff':" echo " sys/contrib/dev/acpica sys/dev/acpica \\" -echo " sys/amd64/acpica sys/i386/acpica sys/ia64/acpica sys/x86/acpica \\" -echo " sys/amd64/include sys/i386/include sys/ia64/include \\" +echo " sys/amd64/acpica sys/i386/acpica sys/x86/acpica \\" +echo " sys/amd64/include sys/i386/include include \\" echo " sys/boot sys/conf sys/modules/acpi usr.sbin/acpi" diff --git a/sys/contrib/ia64/libuwx/src/Makefile b/sys/contrib/ia64/libuwx/src/Makefile deleted file mode 100644 index 7cc0f2d..0000000 --- a/sys/contrib/ia64/libuwx/src/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -# Makefile for IPF unwind express library, libuwx. -# -# To build a cross-unwind library (i.e., one hosted on a -# non-IPF, non-HP-UX system), omit the "self" callbacks -# and the dependency on libuca by setting SELFOBJS and -# SELFLIBS to empty strings. - -AR = ar -RANLIB = : - -OTHERCFLAGS = -# OTHERCFLAGS = -DUWX_TRACE_ENABLE # Enables trace output -# OTHERCFLAGS = +DD64 # Builds 64-bit library - -CFLAGS = -O $(OTHERCFLAGS) - -OBJS = uwx_bstream.o uwx_context.o uwx_env.o uwx_scoreboard.o \ - uwx_step.o uwx_str.o uwx_swap.o uwx_symbols.o \ - uwx_trace.o uwx_uinfo.o uwx_utable.o - -# SELFOBJS = # For cross-unwind library -# SELFOBJS = uwx_self.o uwx_self_context.o uwx_ttrace.o -SELFOBJS = uwx_self.o uwx_self_context.o - -# SELFLIBS = # For cross-unwind library -SELFLIBS = -luca - -libuwx.a: $(OBJS) $(SELFOBJS) - $(AR) rv libuwx.a $? - $(RANLIB) libuwx.a - -libuwx.so: $(OBJS) $(SELFOBJS) - ld -b -o libuwx.so $(OBJS) $(SELFOBJS) $(SELFLIBS) - -libuwx.sl: $(OBJS) $(SELFOBJS) - ld -b -o libuwx.sl $(OBJS) $(SELFOBJS) $(SELFLIBS) - -clean: - rm -f $(OBJS) $(SELFOBJS) libuwx.a libuwx.so libuwx.sl - -uwx_bstream.o: uwx.h uwx_env.h uwx_bstream.h - -uwx_context.o: uwx.h uwx_env.h uwx_scoreboard.h uwx_step.h uwx_trace.h - -uwx_env.o: uwx.h uwx_env.h uwx_scoreboard.h uwx_str.h uwx_trace.h - -uwx_scoreboard.o: uwx.h uwx_env.h uwx_scoreboard.h uwx_trace.h - -uwx_step.o: uwx.h uwx_env.h uwx_context.h uwx_utable.h \ - uwx_uinfo.h uwx_scoreboard.h uwx_str.h uwx_trace.h - -uwx_str.o: uwx.h uwx_env.h uwx_str.h - -uwx_swap.o: uwx.h uwx_env.h uwx_swap.h - -uwx_symbols.o: uwx.h uwx_env.h uwx_symbols.h - -uwx_trace.o: uwx.h uwx_env.h uwx_uinfo.h uwx_scoreboard.h uwx_trace.h - -uwx_uinfo.o: uwx.h uwx_env.h uwx_uinfo.h uwx_utable.h \ - uwx_scoreboard.h uwx_bstream.h uwx_trace.h - -uwx_utable.o: uwx.h uwx_env.h uwx_utable.h uwx_swap.h uwx_trace.h - -uwx_self.o: uwx.h uwx_env.h uwx_context.h uwx_trace.h uwx_self.h \ - uwx_symbols.h - -uwx_self_context.o: uwx_self_context.s - $(CC) -c $(CFLAGS) -o uwx_self_context.o uwx_self_context.s - -uwx_ttrace.o: uwx.h uwx_env.h uwx_context.h uwx_trace.h uwx_ttrace.h diff --git a/sys/contrib/ia64/libuwx/src/uwx.h b/sys/contrib/ia64/libuwx/src/uwx.h deleted file mode 100644 index 8fdbb43..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx.h +++ /dev/null @@ -1,418 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifndef __UWX_INCLUDED -#define __UWX_INCLUDED 1 - -#ifndef _KERNEL -#include <stdlib.h> -#include <inttypes.h> -#else -#include <sys/param.h> -#include <sys/systm.h> -#endif - -#if defined(__cplusplus) -#define __EXTERN_C extern "C" -#else -#define __EXTERN_C extern -#endif - -#define UWX_VERSION 3 /* Version id for callback interfaces */ - -/* Unwind environment structure (opaque) */ -struct uwx_env; - -/* Symbol Cache for uwx_find_symbol (opaque) */ -struct uwx_symbol_cache; - -/* Allocate and free callbacks */ -typedef void *(*alloc_cb)(size_t size); -typedef void (*free_cb)(void *ptr); -__EXTERN_C int uwx_register_alloc_cb(alloc_cb alloc, free_cb free); - -/* Allocate and initialize an unwind environment */ -__EXTERN_C struct uwx_env *uwx_init(void); - -/* Free an unwind environment */ -__EXTERN_C int uwx_free(struct uwx_env *env); - -/* Put unwind express into cross-process mode */ -__EXTERN_C int uwx_set_remote(struct uwx_env *env, int is_big_endian_target); - -/* Put unwind express into reduced-context mode (no floating-point regs) */ -__EXTERN_C int uwx_set_nofr(struct uwx_env *env); - -/* Copy-in callback */ -typedef int (*copyin_cb)( - int request, /* request code (see below) */ - char *loc, /* local (destination) address */ - uint64_t rem, /* remote (source) address */ - int len, /* number of bytes to copy */ - intptr_t tok); /* callback token */ - -/* Lookup IP callback */ -typedef int (*lookupip_cb)( - int request, /* request code (see below) */ - uint64_t ip, /* IP of current frame */ - intptr_t tok, /* callback token */ - uint64_t **vecp); /* parameter vector (in/out) */ - -/* Register copy-in and lookup IP callbacks */ -__EXTERN_C int uwx_register_callbacks( - struct uwx_env *env, /* unwind environment */ - intptr_t tok, /* callback token */ - copyin_cb copyin, /* copy-in callback */ - lookupip_cb lookupip); /* lookup IP callback */ - -/* Initialize a context with the basic info needed to start an unwind */ -__EXTERN_C int uwx_init_context( - struct uwx_env *env, /* unwind environment */ - uint64_t ip, /* IP (instruction pointer) */ - uint64_t sp, /* SP (stack pointer) */ - uint64_t bsp, /* BSP (backing store pointer) */ - uint64_t cfm); /* CFM (current frame marker) */ - -/* Set the value of a specific register in the current context (non fp) */ -__EXTERN_C int uwx_set_reg( - struct uwx_env *env, /* unwind environment */ - int regid, /* register id (see below) */ - uint64_t val); /* register value */ - -/* Set the value of a floating-point register in the current context */ -__EXTERN_C int uwx_set_fr( - struct uwx_env *env, /* unwind environment */ - int regid, /* register id (see below) */ - uint64_t *val); /* register value (ptr to 16 bytes) */ - /* (memory spill format) */ - -/* Initialize the unwind history */ -__EXTERN_C int uwx_init_history(struct uwx_env *env); - -/* Step one frame */ -__EXTERN_C int uwx_step(struct uwx_env *env); - -/* Get module name and text base, if available, for current frame */ -__EXTERN_C int uwx_get_module_info( - struct uwx_env *env, /* unwind environment */ - char **modp, /* load module name (out) */ - uint64_t *text_base); /* base address of text segment (out) */ - -/* Get function start address for current frame */ -__EXTERN_C int uwx_get_funcstart( - struct uwx_env *env, /* unwind environment */ - uint64_t *funcstart); /* function start address (out) */ - -/* Get symbol information, if available, for current frame */ -__EXTERN_C int uwx_get_sym_info( - struct uwx_env *env, /* unwind environment */ - char **modp, /* load module name (out) */ - char **symp, /* function name (out) */ - uint64_t *offsetp); /* offset from start of function (out) */ - -/* Get symbol information, given module name and IP */ -__EXTERN_C int uwx_find_symbol( - struct uwx_env *env, /* unwind environment */ - struct uwx_symbol_cache **cachep, - /* ptr to symbol cache ptr (in/out) */ - char *mod, /* load module name */ - uint64_t relip, /* IP, relative to text segment */ - char **symp, /* function name (out) */ - uint64_t *offsetp); /* offset from start of function (out) */ - -/* Release memory used by symbol cache */ -__EXTERN_C void uwx_release_symbol_cache( - struct uwx_env *env, /* unwind environment */ - struct uwx_symbol_cache *symbol_cache); - /* symbol cache ptr */ - -/* Get the value of a register from the current context */ -__EXTERN_C int uwx_get_reg( - struct uwx_env *env, /* unwind environment */ - int regid, /* register id (see below) */ - uint64_t *valp); /* register value (out) */ - -/* Get the NaT bit of a GR from the current context */ -__EXTERN_C int uwx_get_nat( - struct uwx_env *env, /* unwind environment */ - int regid, /* register id (see below) */ - int *natp); /* NaT value (out: 0 or 1) */ - -/* Get the spill location for a register in the current context */ -__EXTERN_C int uwx_get_spill_loc( - struct uwx_env *env, /* unwind environment */ - int regid, /* register id (see below) */ - uint64_t *dispp); /* disposition code (see below) (out) */ - -/* Get the ABI context code (if uwx_step returned UWX_ABI_FRAME) */ -__EXTERN_C int uwx_get_abi_context_code(struct uwx_env *env); - -/* Increment/Decrement the bsp by a number of slots */ -/* (accounts for NaT collections) */ -__EXTERN_C uint64_t uwx_add_to_bsp(uint64_t bsp, int nslots); - -/* Return status codes for uwx_ APIs */ -#define UWX_OK 0 -#define UWX_BOTTOM 1 /* Hit bottom of stack */ -#define UWX_ABI_FRAME 2 /* Hit ABI-dependent frame */ -#define UWX_ERR_NOENV (-1) /* No uwx_env allocated */ -#define UWX_ERR_IPNOTFOUND (-2) /* Lookup IP c/b returned NOTFOUND */ -#define UWX_ERR_LOOKUPERR (-3) /* Lookup IP c/b returned ERR */ -#define UWX_ERR_BADKEY (-4) /* Bad result vector key */ -#define UWX_ERR_COPYIN_UTBL (-5) /* Error reading unwind table */ -#define UWX_ERR_COPYIN_UINFO (-6) /* Error reading unwind info */ -#define UWX_ERR_COPYIN_MSTK (-7) /* Error reading memory stack */ -#define UWX_ERR_COPYIN_RSTK (-8) /* Error reading register stack */ -#define UWX_ERR_COPYIN_REG (-9) /* Error reading context register */ -#define UWX_ERR_NOUENTRY (-10) /* No unwind table entry for ip */ -#define UWX_ERR_NOUDESC (-11) /* No unwind descriptor covers ip */ -#define UWX_ERR_BADUDESC (-12) /* Bad unwind descriptor */ -#define UWX_ERR_NOMEM (-13) /* Out of memory */ -#define UWX_ERR_PROLOG_UF (-14) /* Prologue underflow */ -#define UWX_ERR_UNDEFLABEL (-15) /* Undefined label in copy_state */ -#define UWX_ERR_BADREGID (-16) /* Bad register identifier */ -#define UWX_ERR_CANTUNWIND (-17) /* Can't unwind */ -#define UWX_ERR_NOCALLBACKS (-18) /* No callbacks registered */ -#define UWX_ERR_NOCONTEXT (-19) /* Context not initialized */ -#define UWX_ERR_UCACCESS (-20) /* Failure in libuca */ -#define UWX_ERR_NOSYM (-21) /* Symbol not found */ - -/* Request codes for copyin callback */ -#define UWX_COPYIN_UINFO 1 /* Reading unwind info */ -#define UWX_COPYIN_MSTACK 2 /* Reading memory stack */ -#define UWX_COPYIN_RSTACK 3 /* Reading RSE backing store */ -#define UWX_COPYIN_REG 4 /* Reading initial register state */ - -/* Request codes for lookup IP callback */ -#define UWX_LKUP_LOOKUP 1 /* Lookup IP */ -#define UWX_LKUP_FREE 2 /* Free result vector */ -#define UWX_LKUP_SYMBOLS 3 /* Lookup symbolic information */ -#define UWX_LKUP_MODULE 4 /* Get module name */ - -/* Return status codes for lookup IP callback */ -#define UWX_LKUP_NOTFOUND 0 /* IP not found */ -#define UWX_LKUP_ERR 1 /* Other error */ -#define UWX_LKUP_UTABLE 2 /* Returned ref to unwind table */ -#define UWX_LKUP_FDESC 3 /* Returned frame description */ -#define UWX_LKUP_SYMINFO 4 /* Returned symbolic information */ -#define UWX_LKUP_REMAP 5 /* Returned remapped IP */ -#define UWX_LKUP_UINFO 6 /* Returned unw info block ptr */ - -/* The lookup IP callback receives a parameter vector, and returns */ -/* one on success. This vector is a series of key/value pairs; each */ -/* even-numbered slot is a key, and each odd-numbered slot is a */ -/* corresponding value. The vector is terminated by a pair whose */ -/* key is 0. */ -#define UWX_KEY_END 0 /* End of vector */ - -/* Keys passed to lookup IP callback */ -#define UWX_KEY_PREDS 1 /* Predicate registers */ -#define UWX_KEY_VERSION 2 /* Version id of unwind engine */ -/* UWX_KEY_FUNCSTART (below) may also be passed with the UWX_LKUP_SYMINFO */ -/* request. */ - -/* Keys returned with UWX_LKUP_UTABLE */ -/* These key/value pairs describe the unwind table corresponding */ -/* to the load module in which the current IP resides. */ -#define UWX_KEY_TBASE 1 /* Base address of text seg */ -#define UWX_KEY_UFLAGS 2 /* Unwind flags (optional) */ -#define UWX_KEY_USTART 3 /* Base of unwind tbl */ -#define UWX_KEY_UEND 4 /* End of unwind tbl */ -#define UWX_KEY_GP 7 /* GP value for module */ - -/* Keys returned with UWX_LKUP_FDESC */ -/* These key/value pairs describe the state of the frame at the */ -/* given IP. They are typically used for dynamically-generated code. */ -/* If UWX_KEY_CONTEXT is returned, it must be the only key returned. */ -/* Use UWX_KEY_GP for the module's gp value. */ -#define UWX_KEY_FSIZE 1 /* Frame size */ -#define UWX_KEY_SPILL(reg_id) (2 | ((reg_id) << 4)) /* Reg spilled */ -#define UWX_KEY_CONTEXT 3 /* ABI-dep. context */ - -/* Keys returned with UWX_LKUP_REMAP */ -#define UWX_KEY_NEWIP 5 /* Remapped IP */ - -/* Keys returned with UWX_LKUP_UINFO */ -/* Use UWX_KEY_GP for the module's gp value. */ -/* Use UWX_KEY_FUNCSTART for the start address of the function */ -/* Use UWX_KEY_UFLAGS for the unwind flags (optional) */ -#define UWX_KEY_UINFO 6 /* Address of unwind info block */ - -/* Keys returned with UWX_LKUP_SYMINFO */ -/* These keys may be returned with UWX_LKUP_FDESC or UWX_LKUP_UINFO, */ -/* if the information is cheap to obtain. */ -/* Use UWX_KEY_TBASE for the base of the text segment */ -#define UWX_KEY_MODULE 17 /* Name of load module */ -#define UWX_KEY_FUNC 18 /* Name of function */ -#define UWX_KEY_FUNCSTART 19 /* Address of start of function */ - -/* Register identifiers */ -/* For use in UWX_LKUP_FDESC result vectors and context access APIs. */ -/* "no spill info": These regs aren't spilled directly, so */ -/* result vectors must not describe these registers. */ -/* The result vector must describe the related register or */ -/* pseudo register instead (ip:rp, sp:psp, bsp/cfm:pfs). */ -/* "pseudo register": Not a machine register, but treated as */ -/* one for unwind purposes. */ -#define UWX_REG_IP 0 /* ip (no spill info) */ -#define UWX_REG_SP 1 /* sp (no spill info) */ -#define UWX_REG_BSP 2 /* ar.bsp (no spill info) */ -#define UWX_REG_CFM 3 /* cfm (no spill info) */ -#define UWX_REG_RP 4 /* rp (pseudo-register) */ -#define UWX_REG_PSP 5 /* psp (pseudo-register) */ -#define UWX_REG_PFS 6 /* pfs (pseudo-register) */ -#define UWX_REG_PREDS 7 /* p0 - p63 */ -#define UWX_REG_PRIUNAT 8 /* primary unat (pseudo-register) */ -#define UWX_REG_AR_BSPSTORE 9 /* ar.bspstore */ -#define UWX_REG_AR_RNAT 10 /* ar.rnat */ -#define UWX_REG_AR_UNAT 11 /* ar.unat */ -#define UWX_REG_AR_FPSR 12 /* ar.fpsr */ -#define UWX_REG_AR_LC 13 /* ar.lc */ -#define UWX_REG_AR_PFS 14 /* ar.pfs */ -#define UWX_REG_GP 15 /* gp (pseudo-register) */ -#define UWX_REG_GR(gr) (0x100 | (gr)) -#define UWX_REG_FR(fr) (0x200 | (fr)) -#define UWX_REG_BR(br) (0x300 | (br)) - -/* for backwards compatibility with previous releases... */ -#define UWX_REG_BSPSTORE UWX_REG_AR_BSPSTORE -#define UWX_REG_RNAT UWX_REG_AR_RNAT -#define UWX_REG_UNAT UWX_REG_AR_UNAT -#define UWX_REG_FPSR UWX_REG_AR_FPSR -#define UWX_REG_LC UWX_REG_AR_LC - -/* Values corresponding to UWX_KEY_SPILL keys indicate the disposition */ -/* of the spilled register -- either in the memory stack or in another */ -/* register. The PSP register may also have a disposition of "SPPLUS", */ -/* indicating that its value is SP plus a fixed constant. */ -#define UWX_DISP_NONE 0 /* Not spilled */ -#define UWX_DISP_SPPLUS(k) (1 | (k)) /* PSP = SP+constant */ -#define UWX_DISP_SPREL(disp) (2 | (disp)) /* Spilled at [SP+disp] */ -#define UWX_DISP_PSPREL(disp) (3 | (disp)) /* Spilled at [PSP+16-disp] */ -#define UWX_DISP_REG(reg) (4 | ((reg) << 4)) /* Saved to another reg. */ - -/* The uwx_get_spill_loc() routine returns a spill location for a */ -/* given register in the current context. It will return a disposition */ -/* code of UWX_DISP_NONE, UWX_DISP_REG(reg), or one of the following */ -/* to indicate that the spilled value can be found in the memory */ -/* stack or the register stack backing store. */ -#define UWX_DISP_MSTK(addr) (5 | (addr)) /* Spilled in mem. stack */ -#define UWX_DISP_RSTK(addr) (6 | (addr)) /* Spilled in reg. stack */ - -/* Extract the disposition code, offset, address, or register id */ -/* from a disposition returned from uwx_get_spill_loc(). */ -/* Compare the extracted disp code against UWX_DISP_REG(0), etc. */ -#define UWX_GET_DISP_CODE(disp) ((int)(disp) & 0x07) -#define UWX_GET_DISP_OFFSET(disp) ((disp) & ~(uint64_t)0x07) -#define UWX_GET_DISP_ADDR(disp) ((disp) & ~(uint64_t)0x07) -#define UWX_GET_DISP_REGID(disp) ((int)(disp) >> 4) - -#undef __EXTERN_C - -#if defined(__cplusplus) - -class UnwindExpress { - -public: - - UnwindExpress() { - env = uwx_init(); - } - - ~UnwindExpress() { - if (env != 0) - uwx_free(env); - env = 0; - } - - int init_context(uint64_t ip, uint64_t sp, uint64_t bsp, uint64_t cfm) { - return uwx_init_context(env, ip, sp, bsp, cfm); - } - - int init_history() { - return uwx_init_history(env); - } - - int set_reg(int regid, uint64_t val) { - return uwx_set_reg(env, regid, val); - } - - int set_fr(int regid, uint64_t *valp) { - return uwx_set_fr(env, regid, valp); - } - - int step() { - return uwx_step(env); - } - - int get_module_info(char **modp, uint64_t *text_base_p) { - return uwx_get_module_info(env, modp, text_base_p); - } - - int get_funcstart(uint64_t *funcstart) { - return uwx_get_funcstart(env, funcstart); - } - - int get_sym_info(char **modp, char **symp, uint64_t *offsetp) { - return uwx_get_sym_info(env, modp, symp, offsetp); - } - - int find_symbol(struct uwx_symbol_cache **cachep, - char *mod, uint64_t relip, char **symp, uint64_t *offsetp) { - return uwx_find_symbol(env, cachep, mod, relip, symp, offsetp); - } - - void release_symbol_cache(struct uwx_symbol_cache *symbol_cache) { - uwx_release_symbol_cache(env, symbol_cache); - } - - int get_reg(int regid, uint64_t *valp) { - return uwx_get_reg(env, regid, valp); - } - - int get_nat(int regid, int *natp) { - return uwx_get_nat(env, regid, natp); - } - - int get_spill_loc(int regid, uint64_t *dispp) { - return uwx_get_spill_loc(env, regid, dispp); - } - - int get_abi_context_code() { - return uwx_get_abi_context_code(env); - } - - struct uwx_env *get_env() { - return env; - } - -protected: - - struct uwx_env *env; - -}; - -#endif /* __cplusplus */ - -#endif /* __UWX_INCLUDED */ diff --git a/sys/contrib/ia64/libuwx/src/uwx_bstream.c b/sys/contrib/ia64/libuwx/src/uwx_bstream.c deleted file mode 100644 index 1495ed3..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_bstream.c +++ /dev/null @@ -1,181 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include "uwx_env.h" -#include "uwx_bstream.h" - - -/* uwx_init_bstream: initialize a byte stream for reading */ - -void uwx_init_bstream( - struct uwx_bstream *bstream, - struct uwx_env *env, - uint64_t source, - unsigned int len, - int request) -{ - bstream->buf = 0; - if (env->remote) { - bstream->source = source; - bstream->bufp = (unsigned char *) &bstream->buf; - bstream->nbuf = 0; - bstream->copyin = env->copyin; - bstream->cb_token = env->cb_token; - bstream->request = request; - } - else { - bstream->source = 0; - bstream->bufp = (unsigned char *) (intptr_t) source; - bstream->nbuf = len; - bstream->copyin = 0; - bstream->cb_token = 0; - bstream->request = 0; - } - bstream->ntotal = len; - bstream->peekc = -1; -} - - -/* uwx_get_byte: read the next byte from the byte stream */ - -int uwx_get_byte(struct uwx_bstream *bstream) -{ - int len; - int n; - int b; - - if (bstream->peekc >= 0) { - b = bstream->peekc; - bstream->peekc = -1; - return b; - } - if (bstream->ntotal <= 0) - return -1; - if (bstream->nbuf <= 0) { - if (bstream->source & 0x7 || bstream->ntotal < sizeof(uint64_t)) - len = sizeof(uint32_t); - else - len = sizeof(uint64_t); - n = (*bstream->copyin)(bstream->request, (char *)&bstream->buf, - bstream->source, len, bstream->cb_token); - if (n != len) - return -1; - bstream->bufp = (unsigned char *) &bstream->buf; - bstream->nbuf = n; - bstream->source += n; - } - - b = *bstream->bufp++; - bstream->nbuf--; - bstream->ntotal--; - return b; -} - - -/* uwx_unget_byte: push a byte back onto the byte stream */ - -int uwx_unget_byte(struct uwx_bstream *bstream, int b) -{ - bstream->peekc = b; - return 0; -} - - -/* uwx_get_uleb128: read a ULEB128 value from the byte stream */ - -int uwx_get_uleb128(struct uwx_bstream *bstream, uint64_t *valp) -{ - uint64_t val; - int i; - int b; - - b = uwx_get_byte(bstream); - val = (uint64_t)(b & 0x7f) << 56; - for (i = 0; i < 8; i++) { - val = val >> 7; - if (b & 0x80) { - b = uwx_get_byte(bstream); - val |= (uint64_t)(b & 0x7f) << 56; - } - } - if (b & 0x80) { - b = uwx_get_byte(bstream); - val |= (uint64_t)(b & 0x7f) << 63; - } - if (b & 0x80) - return -1; - *valp = val; - return 0; -} - -#if 0 -int uwx_get_uleb128_alt(struct uwx_bstream *bstream, uint64_t *valp) -{ - uint64_t val; - int b; - - b = uwx_get_byte(bstream); - val = b & 0x7f; - if (b & 0x80) { - b = uwx_get_byte(bstream); - val |= (uint64_t)(b & 0x7f) << 7; - if (b & 0x80) { - b = uwx_get_byte(bstream); - val |= (uint64_t)(b & 0x7f) << 14; - if (b & 0x80) { - b = uwx_get_byte(bstream); - val |= (uint64_t)(b & 0x7f) << 21; - if (b & 0x80) { - b = uwx_get_byte(bstream); - val |= (uint64_t)(b & 0x7f) << 28; - if (b & 0x80) { - b = uwx_get_byte(bstream); - val |= (uint64_t)(b & 0x7f) << 35; - if (b & 0x80) { - b = uwx_get_byte(bstream); - val |= (uint64_t)(b & 0x7f) << 42; - if (b & 0x80) { - b = uwx_get_byte(bstream); - val |= (uint64_t)(b & 0x7f) << 49; - if (b & 0x80) { - b = uwx_get_byte(bstream); - val |= (uint64_t)(b & 0x7f) << 56; - if (b & 0x80) { - b = uwx_get_byte(bstream); - val |= (uint64_t)(b & 0x7f) << 63; - if (b & 0x80) - return -1; - } - } - } - } - } - } - } - } - } - *valp = val; - return 0; -} -#endif diff --git a/sys/contrib/ia64/libuwx/src/uwx_bstream.h b/sys/contrib/ia64/libuwx/src/uwx_bstream.h deleted file mode 100644 index c2fe5da..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_bstream.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -struct uwx_bstream { - copyin_cb copyin; - intptr_t cb_token; - uint64_t source; - uint64_t buf; - unsigned char *bufp; - int nbuf; - unsigned int ntotal; - int request; - int peekc; -}; - -/* uwx_init_bstream: initialize a byte stream for reading */ - -extern void uwx_init_bstream( - struct uwx_bstream *bstream, - struct uwx_env *env, - uint64_t source, - unsigned int len, - int request); - - -/* uwx_get_byte: read the next byte from the byte stream */ - -extern int uwx_get_byte(struct uwx_bstream *bstream); - - -/* uwx_unget_byte: push a byte back onto the byte stream */ - -extern int uwx_unget_byte(struct uwx_bstream *bstream, int b); - - -/* uwx_get_uleb128: read a ULEB128 value from the byte stream */ - -extern int uwx_get_uleb128(struct uwx_bstream *bstream, uint64_t *val); diff --git a/sys/contrib/ia64/libuwx/src/uwx_context.c b/sys/contrib/ia64/libuwx/src/uwx_context.c deleted file mode 100644 index 9b1054a..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_context.c +++ /dev/null @@ -1,408 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include "uwx_env.h" -#include "uwx_scoreboard.h" -#include "uwx_step.h" -#include "uwx_trace.h" - -int uwx_init_context( - struct uwx_env *env, - uint64_t ip, - uint64_t sp, - uint64_t bsp, - uint64_t cfm) -{ - int i; - - if (env == 0) - return UWX_ERR_NOENV; - - env->context.special[UWX_REG_IP] = ip; - env->context.special[UWX_REG_SP] = sp; - env->context.special[UWX_REG_BSP] = bsp; - env->context.special[UWX_REG_CFM] = cfm; - for (i = UWX_REG_RP; i < NSPECIALREG; i++) - env->context.special[i] = 0; - for (i = 0; i < NPRESERVEDGR; i++) - env->context.gr[i] = 0; - env->context.valid_regs = VALID_BASIC4; - env->context.valid_frs = 0; - env->rstate = 0; - (void)uwx_init_history(env); - return UWX_OK; -} - -int uwx_get_reg(struct uwx_env *env, int regid, uint64_t *valp) -{ - int status; - int sor; - int rrb_gr; - uint64_t bsp; - int n; - - if (env == 0) - return UWX_ERR_NOENV; - - status = UWX_OK; - - if (regid == UWX_REG_GR(12)) - regid = UWX_REG_SP; - if (regid < NSPECIALREG && (env->context.valid_regs & (1 << regid))) - *valp = env->context.special[regid]; - else if (regid == UWX_REG_PSP || regid == UWX_REG_RP || - regid == UWX_REG_PFS) { - status = uwx_restore_markers(env); - if (status != UWX_OK) - return status; - *valp = env->context.special[regid]; - } - else if (regid >= UWX_REG_GR(4) && regid <= UWX_REG_GR(7) && - (env->context.valid_regs & - (1 << (regid - UWX_REG_GR(4) + VALID_GR_SHIFT))) ) - *valp = env->context.gr[regid - UWX_REG_GR(4)]; - else if (regid >= UWX_REG_GR(32) && regid <= UWX_REG_GR(127)) { - if (env->copyin == 0) - return UWX_ERR_NOCALLBACKS; - bsp = env->context.special[UWX_REG_BSP]; - TRACE_C_GET_REG(regid, bsp) - regid -= UWX_REG_GR(32); - sor = (((int) env->context.special[UWX_REG_CFM] >> 14) & 0x0f) * 8; - rrb_gr = ((int) env->context.special[UWX_REG_CFM] >> 18) & 0x7f; - if (sor != 0 && rrb_gr != 0 && regid < sor) { - TRACE_C_ROTATE_GR(regid, sor, rrb_gr, (regid+rrb_gr)%sor) - regid = (regid + rrb_gr) % sor; - } - bsp = uwx_add_to_bsp(bsp, regid); - n = (*env->copyin)(UWX_COPYIN_RSTACK, (char *)valp, - bsp, DWORDSZ, env->cb_token); - if (n != DWORDSZ) - status = UWX_ERR_COPYIN_RSTK; - } - else if (regid == UWX_REG_GR(0)) - *valp = 0; - else if (regid >= UWX_REG_BR(1) && regid <= UWX_REG_BR(5) && - (env->context.valid_regs & - (1 << (regid - UWX_REG_BR(1) + VALID_BR_SHIFT))) ) - *valp = env->context.br[regid - UWX_REG_BR(1)]; - else if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(5) && - (env->context.valid_frs & (1 << (regid - UWX_REG_FR(2)))) ) { - valp[0] = env->context.fr[regid - UWX_REG_FR(2)].part0; - valp[1] = env->context.fr[regid - UWX_REG_FR(2)].part1; - } - else if (regid >= UWX_REG_FR(16) && regid <= UWX_REG_FR(31) && - (env->context.valid_frs & (1 << (regid - UWX_REG_FR(16) + 4))) ) { - valp[0] = env->context.fr[regid - UWX_REG_FR(16) + 4].part0; - valp[1] = env->context.fr[regid - UWX_REG_FR(16) + 4].part1; - } - else if ( (regid < NSPECIALREG) || - (regid >= UWX_REG_GR(1) && regid <= UWX_REG_GR(31)) || - (regid >= UWX_REG_BR(0) && regid <= UWX_REG_BR(7)) ) { - if (env->copyin == 0) - return UWX_ERR_NOCALLBACKS; - n = (*env->copyin)(UWX_COPYIN_REG, (char *)valp, - regid, DWORDSZ, env->cb_token); - if (n != DWORDSZ) - status = UWX_ERR_COPYIN_REG; - } - else if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(127)) { - if (env->copyin == 0) - return UWX_ERR_NOCALLBACKS; - n = (*env->copyin)(UWX_COPYIN_REG, (char *)valp, - regid, 2*DWORDSZ, env->cb_token); - if (n != 2*DWORDSZ) - status = UWX_ERR_COPYIN_REG; - } - else if (regid == UWX_REG_FR(0)) { - valp[0] = 0; - valp[1] = 0; - } - else if (regid == UWX_REG_FR(1)) { - valp[0] = 0x000000000000ffffULL; - valp[1] = 0x8000000000000000ULL; - } - else - status = UWX_ERR_BADREGID; - return status; -} - -int uwx_get_nat(struct uwx_env *env, int regid, int *natp) -{ - int status; - int sor; - int rrb_gr; - uint64_t bsp; - uint64_t natcollp; - uint64_t natcoll; - int n; - - if (env == 0) - return UWX_ERR_NOENV; - - status = UWX_OK; - - if (regid >= UWX_REG_GR(4) && regid <= UWX_REG_GR(7) && - (env->context.valid_regs & - (1 << (regid - UWX_REG_GR(4) + VALID_GR_SHIFT))) ) { - *natp = (env->context.special[UWX_REG_PRIUNAT] >> - (regid - UWX_REG_GR(4)) ) & 0x01; - } - else if (regid >= UWX_REG_GR(32) && regid <= UWX_REG_GR(127)) { - if (env->copyin == 0) - return UWX_ERR_NOCALLBACKS; - bsp = env->context.special[UWX_REG_BSP]; - regid -= UWX_REG_GR(32); - sor = (((int) env->context.special[UWX_REG_CFM] >> 14) & 0x0f) * 8; - rrb_gr = ((int) env->context.special[UWX_REG_CFM] >> 18) & 0x7f; - if (sor != 0 && rrb_gr != 0 && regid < sor) { - regid = (regid + rrb_gr) % sor; - } - bsp = uwx_add_to_bsp(bsp, regid); - natcollp = bsp | 0x01f8; - n = (*env->copyin)(UWX_COPYIN_RSTACK, (char *)&natcoll, - natcollp, DWORDSZ, env->cb_token); - if (n != DWORDSZ) - return UWX_ERR_COPYIN_RSTK; - *natp = (int)(natcoll >> (((int)bsp >> 3) & 0x3f)) & 0x01; - } - else if (regid == UWX_REG_GR(0)) - *natp = 0; - else - status = UWX_ERR_BADREGID; - return status; -} - -int uwx_get_spill_loc(struct uwx_env *env, int regid, uint64_t *dispp) -{ - int status; - int sor; - int rrb_gr; - uint64_t bsp; - - if (env == 0) - return UWX_ERR_NOENV; - - status = UWX_OK; - - if (regid == UWX_REG_GR(12)) - regid = UWX_REG_SP; - if (regid < NSPECIALREG) { - if (regid == UWX_REG_PSP || regid == UWX_REG_RP || - regid == UWX_REG_PFS) { - if (!(env->context.valid_regs & (1 << regid))) { - status = uwx_restore_markers(env); - if (status != UWX_OK) - return status; - } - } - *dispp = env->history.special[regid]; - } - else if (regid >= UWX_REG_GR(4) && regid <= UWX_REG_GR(7)) - *dispp = env->history.gr[regid - UWX_REG_GR(4)]; - else if (regid >= UWX_REG_GR(32) && regid <= UWX_REG_GR(127)) { - bsp = env->context.special[UWX_REG_BSP]; - regid -= UWX_REG_GR(32); - sor = (((int) env->context.special[UWX_REG_CFM] >> 14) & 0x0f) * 8; - rrb_gr = ((int) env->context.special[UWX_REG_CFM] >> 18) & 0x7f; - if (sor != 0 && rrb_gr != 0 && regid < sor) - regid = (regid + rrb_gr) % sor; - bsp = uwx_add_to_bsp(bsp, regid); - *dispp = UWX_DISP_RSTK(bsp); - } - else if (regid >= UWX_REG_BR(1) && regid <= UWX_REG_GR(5)) - *dispp = env->history.br[regid - UWX_REG_BR(1)]; - else if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(5)) - *dispp = env->history.fr[regid - UWX_REG_FR(2)]; - else if (regid >= UWX_REG_FR(16) && regid <= UWX_REG_FR(31)) - *dispp = env->history.fr[regid - UWX_REG_FR(16) + 4]; - else if ( (regid >= UWX_REG_GR(1) && regid <= UWX_REG_GR(31)) || - (regid >= UWX_REG_BR(0) && regid <= UWX_REG_BR(7)) || - (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(127)) ) - *dispp = UWX_DISP_REG(regid); - else - status = UWX_ERR_BADREGID; - return status; -} - -int uwx_set_reg(struct uwx_env *env, int regid, uint64_t val) -{ - int status; - - if (env == 0) - return UWX_ERR_NOENV; - - if (regid == UWX_REG_GR(12)) - regid = UWX_REG_SP; - if (regid < NSPECIALREG) { - env->context.special[regid] = val; - env->context.valid_regs |= 1 << regid; - status = UWX_OK; - } - else if (regid >= UWX_REG_GR(4) && regid <= UWX_REG_GR(7)) { - env->context.gr[regid - UWX_REG_GR(4)] = val; - env->context.valid_regs |= - 1 << (regid - UWX_REG_GR(4) + VALID_GR_SHIFT); - status = UWX_OK; - } - else if (regid >= UWX_REG_GR(32) && regid <= UWX_REG_GR(127)) { - status = UWX_ERR_BADREGID; - } - else if (regid >= UWX_REG_BR(1) && regid <= UWX_REG_BR(5)) { - env->context.br[regid - UWX_REG_BR(1)] = val; - env->context.valid_regs |= - 1 << (regid - UWX_REG_BR(1) + VALID_BR_SHIFT); - status = UWX_OK; - } - else - status = UWX_ERR_BADREGID; - return status; -} - -int uwx_set_fr(struct uwx_env *env, int regid, uint64_t *val) -{ - - if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(5)) - regid -= UWX_REG_FR(2); - else if (regid >= UWX_REG_FR(16) && regid <= UWX_REG_FR(31)) - regid -= UWX_REG_FR(16) - 4; - else - return UWX_ERR_BADREGID; - - env->context.fr[regid].part0 = val[0]; - env->context.fr[regid].part1 = val[1]; - env->context.valid_frs |= 1 << regid; - env->nsbreg = NSBREG; - return UWX_OK; -} - -uint64_t uwx_add_to_bsp(uint64_t bsp, int nslots) -{ - int bias; - - /* - * Here's a picture of the backing store as modeled in - * the computations below. "X" marks NaT collections at - * every 0x1f8 mod 0x200 address. - * - * To make the NaT adjustments easier, we bias the current bsp - * by enough slots to place it at the previous NaT collection. - * Then we need to add the bias to the number of slots, - * then add 1 for every 63 slots to account for NaT collections. - * Then we can remove the bias again and add the adjusted - * number of slots to the bsp. - * - * 0 1f8 3f8 - * +---------------------------------------------------------------+ - * | X X| - * +---------------------------------------------------------------+ - * <-------- bias --------> - * <--- nslots ---> - * ^ - * | - * bsp - * <------------ nslots + bias -----------> - - * When subtracting from bsp, we avoid depending on the sign of - * the quotient by adding 63*8 before division and subtracting 8 - * after division. (Assumes that we will never be called upon - * to subtract more than 504 slots from bsp.) - * - * 0 1f8 3f8 - * +---------------------------------------------------------------+ - * | X X| - * +---------------------------------------------------------------+ - * <-- bias --> - * <--- (-nslots) ---> - * ^ - * | - * bsp - * <-----------------> - * -(nslots + bias) - */ - - bias = ((unsigned int)bsp & 0x1f8) / DWORDSZ; - nslots += (nslots + bias + 63*8) / 63 - 8; - return bsp + nslots * DWORDSZ; -} - -#if 0 -int uwx_selftest_bsp_arithmetic() -{ - int i; - int j; - int r; - uint64_t bstore[161]; - uint64_t *bsp; - uint64_t *p; - int failed = 0; - - printf("uwx_selftest_bsp_arithmetic: bsp at %08lx\n", (unsigned int)bstore); - r = 0; - bsp = bstore; - for (i = 0; i < 161; i++) { - if (((unsigned int)bsp & 0x1f8) == 0x1f8) - *bsp++ = 1000 + r; - else - *bsp++ = r++; - } - - printf("uwx_selftest_bsp_arithmetic: plus tests...\n"); - bsp = bstore; - for (i = 0; i < 64; i++) { - r = (int)*bsp; - if (r >= 1000) - r -= 1000; - for (j = 0; j < 96; j++) { - p = (uint64_t *)(intptr_t)uwx_add_to_bsp((uint64_t)bsp, j); - if (*p != (r + j)) { - failed++; - printf("%d [%08lx] + %d -> %08lx ", - i, (unsigned int)bsp, j, (unsigned int)p); - printf("(read %d instead of %d)\n", (int)*p, r + j); - } - } - bsp++; - } - - printf("uwx_selftest_bsp_arithmetic: minus tests...\n"); - bsp = &bstore[161]; - for (i = 63; i >= 0; i--) { - bsp--; - r = (int)*bsp; - if (r >= 1000) - r -= 1000; - for (j = 0; j < 96; j++) { - p = (uint64_t *)(intptr_t)uwx_add_to_bsp((uint64_t)bsp, -j); - if (*p != (r - j)) { - failed++; - printf("%d [%08lx] - %d -> %08lx ", - i, (unsigned int)bsp, j, (unsigned int)p); - printf("(read %d instead of %d)\n", (int)*p, r - j); - } - } - } - - return failed; -} -#endif diff --git a/sys/contrib/ia64/libuwx/src/uwx_context.h b/sys/contrib/ia64/libuwx/src/uwx_context.h deleted file mode 100644 index 1f172db..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_context.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -extern uint64_t uwx_add_to_bsp(uint64_t bsp, int nslots); diff --git a/sys/contrib/ia64/libuwx/src/uwx_env.c b/sys/contrib/ia64/libuwx/src/uwx_env.c deleted file mode 100644 index 252e397..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_env.c +++ /dev/null @@ -1,221 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifndef _KERNEL -#include <stdlib.h> -#endif - -#include "uwx_env.h" -#include "uwx_scoreboard.h" -#include "uwx_str.h" -#include "uwx_trace.h" - -#ifdef _KERNEL -static struct uwx_env uwx_env; -#define free(p) /* nullified */ -#define malloc(sz) ((sz == sizeof(uwx_env)) ? &uwx_env : NULL) -#endif - -alloc_cb uwx_allocate_cb = 0; -free_cb uwx_free_cb = 0; - -int uwx_register_alloc_cb(alloc_cb alloc, free_cb free) -{ - uwx_allocate_cb = alloc; - uwx_free_cb = free; - return UWX_OK; -} - -int uwx_init_history(struct uwx_env *env) -{ - int i; - - if (env == 0) - return UWX_ERR_NOENV; - - for (i = 0; i < NSPECIALREG; i++) - env->history.special[i] = UWX_DISP_REG(i);; - for (i = 0; i < NPRESERVEDGR; i++) - env->history.gr[i] = UWX_DISP_REG(UWX_REG_GR(4+i)); - for (i = 0; i < NPRESERVEDBR; i++) - env->history.br[i] = UWX_DISP_REG(UWX_REG_BR(1+i)); - for (i = 0; i < 4; i++) - env->history.fr[i] = UWX_DISP_REG(UWX_REG_FR(2+i)); - for ( ; i < NPRESERVEDFR; i++) - env->history.fr[i] = UWX_DISP_REG(UWX_REG_FR(12+i)); - - return UWX_OK; -} - -int uwx_init_env(struct uwx_env *env, size_t total_size) -{ - int i; - struct uwx_str_pool *str_pool; - struct uwx_scoreboard *scoreboards; - - str_pool = (struct uwx_str_pool *)(env + 1); - scoreboards = (struct uwx_scoreboard *)(str_pool + 1); - - if (sizeof(struct uwx_env) + sizeof(struct uwx_str_pool) > total_size) - return UWX_ERR_NOMEM; - total_size -= sizeof(struct uwx_env) + sizeof(struct uwx_str_pool); - - env->context.valid_regs = 0; - env->context.valid_frs = 0; - for (i = 0; i < NSPECIALREG; i++) - env->context.special[i] = 0; - for (i = 0; i < NPRESERVEDGR; i++) - env->context.gr[i] = 0; - for (i = 0; i < NPRESERVEDBR; i++) - env->context.br[i] = 0; - for (i = 0; i < NPRESERVEDFR; i++) { - env->context.fr[i].part0 = 0; - env->context.fr[i].part1 = 0; - } - env->rstate = 0; - env->remapped_ip = 0; - env->function_offset = 0; - env->ptr_size = DWORDSZ; - env->uinfo_hdr = 0; - env->uinfo_end = 0; - env->code_start = 0; - env->text_base = 0; - (void)uwx_init_history(env); - if (uwx_allocate_cb != NULL) - env->allocate_cb = uwx_allocate_cb; - else - env->allocate_cb = NULL; - if (uwx_free_cb != NULL) - env->free_cb = uwx_free_cb; - else - env->free_cb = NULL; - env->free_scoreboards = 0; - env->used_scoreboards = 0; - env->labeled_scoreboards = 0; - (void)uwx_init_str_pool(env, str_pool); - env->module_name = 0; - env->function_name = 0; - env->cb_token = 0; - env->copyin = 0; - env->lookupip = 0; - env->remote = 0; - env->byte_swap = 0; - env->abi_context = 0; - env->nsbreg = NSBREG; - env->nscoreboards = 0; - env->on_heap = 0; - env->trace = 0; - TRACE_INIT - for (i = 0; total_size >= sizeof(struct uwx_scoreboard); i++) { - (void) uwx_prealloc_scoreboard(env, &scoreboards[i]); - total_size -= sizeof(struct uwx_scoreboard); - } - return UWX_OK; -} - -int uwx_set_nofr(struct uwx_env *env) -{ - if (env == 0) - return UWX_ERR_NOENV; - - env->nsbreg = NSBREG_NOFR; - return UWX_OK; -} - -struct uwx_env *uwx_init() -{ - struct uwx_env *env; - size_t total_size; - - total_size = sizeof(struct uwx_env) + - sizeof(struct uwx_str_pool) + - NSCOREBOARDS * sizeof(struct uwx_scoreboard); - - if (uwx_allocate_cb == 0) - env = (struct uwx_env *) malloc(total_size); - else - env = (struct uwx_env *) (*uwx_allocate_cb)(total_size); - if (env != 0) { - uwx_init_env(env, total_size); - env->on_heap = 1; - } - return env; -} - -int uwx_set_remote(struct uwx_env *env, int is_big_endian_target) -{ - int is_big_endian_host; - char *p; - - if (env == 0) - return UWX_ERR_NOENV; - - env->remote = 1; - - is_big_endian_host = 1; - p = (char *)&is_big_endian_host; - *p = 0; - if (is_big_endian_target == is_big_endian_host) - env->byte_swap = 0; - else - env->byte_swap = 1; - - return UWX_OK; -} - -int uwx_register_callbacks( - struct uwx_env *env, - intptr_t tok, - copyin_cb copyin, - lookupip_cb lookupip) -{ - if (env == 0) - return UWX_ERR_NOENV; - env->cb_token = tok; - env->copyin = copyin; - env->lookupip = lookupip; - return UWX_OK; -} - -int uwx_get_abi_context_code(struct uwx_env *env) -{ - if (env == 0) - return UWX_ERR_NOENV; - return env->abi_context; -} - -int uwx_free(struct uwx_env *env) -{ - if (env != 0) { - uwx_free_scoreboards(env); - uwx_free_str_pool(env); - if (env->on_heap) { - if (env->free_cb == 0) - free((void *)env); - else - (*env->free_cb)((void *)env); - } - } - return UWX_OK; -} diff --git a/sys/contrib/ia64/libuwx/src/uwx_env.h b/sys/contrib/ia64/libuwx/src/uwx_env.h deleted file mode 100644 index 71b9d66..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_env.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include "uwx.h" - -#define WORDSZ 4 -#define DWORDSZ 8 -#define BUNDLESZ 16 -#define SLOTSPERBUNDLE 3 - -#define UNWIND_TBL_32BIT 0x8000000000000000LL - -#define UNW_VER(x) ((x) >> 48) -#define UNW_FLAG_MASK 0x0000ffff00000000LL -#define UNW_FLAG_EHANDLER 0x0000000100000000LL -#define UNW_FLAG_UHANDLER 0x0000000200000000LL -#define UNW_LENGTH(x) ((x) & 0x00000000ffffffffLL) - -struct uwx_scoreboard; - -#define NSCOREBOARDS 8 /* Initial allocation of scoreboards */ - -#define NSPECIALREG 16 /* Must be even, so FRs are aligned */ -#define NPRESERVEDGR 4 -#define NPRESERVEDBR 5 -#define NPRESERVEDFR 20 - -struct uwx_fpreg { - uint64_t part0; - uint64_t part1; -}; - -struct uwx_context { - unsigned int valid_regs; - unsigned int valid_frs; - uint64_t special[NSPECIALREG]; - uint64_t gr[NPRESERVEDGR]; - uint64_t br[NPRESERVEDBR]; - struct uwx_fpreg fr[NPRESERVEDFR]; -}; - -#define VALID_GR_SHIFT NSPECIALREG -#define VALID_BR_SHIFT (NSPECIALREG + NPRESERVEDGR) - -#define VALID_BASIC4 0x0f /* IP, SP, BSP, CFM */ -#define VALID_MARKERS 0x70 /* RP, PSP, PFS */ - -struct uwx_history { - uint64_t special[NSPECIALREG]; - uint64_t gr[NPRESERVEDGR]; - uint64_t br[NPRESERVEDBR]; - uint64_t fr[NPRESERVEDFR]; -}; - -struct uwx_str_pool; - -struct uwx_env { - struct uwx_context context; - uint64_t *rstate; - uint64_t remapped_ip; - int64_t function_offset; - uint64_t ptr_size; - uint64_t uinfo_hdr; - uint64_t uinfo_end; - uint64_t code_start; - uint64_t text_base; - struct uwx_history history; - alloc_cb allocate_cb; - free_cb free_cb; - struct uwx_scoreboard *free_scoreboards; - struct uwx_scoreboard *used_scoreboards; - struct uwx_scoreboard *labeled_scoreboards; - struct uwx_str_pool *string_pool; - char *module_name; - char *function_name; - intptr_t cb_token; - copyin_cb copyin; - lookupip_cb lookupip; - int remote; - int byte_swap; - int abi_context; - int nsbreg; - int nscoreboards; - int on_heap; - int trace; -}; - -extern alloc_cb uwx_allocate_cb; -extern free_cb uwx_free_cb; -extern int uwx_init_env(struct uwx_env *env, size_t total_size); diff --git a/sys/contrib/ia64/libuwx/src/uwx_scoreboard.c b/sys/contrib/ia64/libuwx/src/uwx_scoreboard.c deleted file mode 100644 index d68a6e1..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_scoreboard.c +++ /dev/null @@ -1,315 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifndef _KERNEL -#include <stdlib.h> -#endif - -#include "uwx_env.h" -#include "uwx_scoreboard.h" -#include "uwx_trace.h" - -#ifdef _KERNEL -static unsigned short uwx_allocated; -static struct uwx_scoreboard uwx_scoreboard[sizeof(uwx_allocated) << 3]; - -static void -free(struct uwx_scoreboard *p) -{ - int idx = p - uwx_scoreboard; - uwx_allocated &= ~(1 << idx); -} - -static struct uwx_scoreboard * -malloc(size_t sz) -{ - int idx; - if (sz != sizeof(struct uwx_scoreboard)) - return (NULL); - for (idx = 0; idx < (sizeof(uwx_allocated) << 3); idx++) { - if ((uwx_allocated & (1 << idx)) == 0) { - uwx_allocated |= 1 << idx; - return (uwx_scoreboard + idx); - } - } - return (NULL); -} -#endif - - -void uwx_prealloc_scoreboard(struct uwx_env *env, struct uwx_scoreboard *sb) -{ - sb->id = env->nscoreboards++; - sb->nextused = env->used_scoreboards; - sb->prealloc = 1; - env->used_scoreboards = sb; - TRACE_B_PREALLOC(sb->id) -} - -struct uwx_scoreboard *uwx_alloc_scoreboard(struct uwx_env *env) -{ - struct uwx_scoreboard *sb; - int i; - - if (env->free_scoreboards != 0) { - sb = env->free_scoreboards; - env->free_scoreboards = sb->nextfree; - TRACE_B_REUSE(sb->id) - } - else { - if (env->allocate_cb == 0) - sb = (struct uwx_scoreboard *) - malloc(sizeof(struct uwx_scoreboard)); - else - sb = (struct uwx_scoreboard *) - (*env->allocate_cb)(sizeof(struct uwx_scoreboard)); - if (sb == 0) - return 0; - sb->id = env->nscoreboards++; - sb->nextused = env->used_scoreboards; - sb->prealloc = 0; - env->used_scoreboards = sb; - TRACE_B_ALLOC(sb->id) - } - - sb->nextstack = 0; - sb->nextlabel = 0; - for (i = 0; i < env->nsbreg; i++) - sb->rstate[i] = UWX_DISP_NONE; - sb->rstate[SBREG_RP] = UWX_DISP_REG(UWX_REG_BR(0)); - sb->rstate[SBREG_PSP] = UWX_DISP_SPPLUS(0); - sb->rstate[SBREG_PFS] = UWX_DISP_REG(UWX_REG_AR_PFS); - sb->rstate[SBREG_PRIUNAT] = UWX_DISP_REG(UWX_REG_AR_UNAT); - sb->label = 0; - return sb; -} - -static -void uwx_reclaim_scoreboards(struct uwx_env *env) -{ - struct uwx_scoreboard *sb; - - env->free_scoreboards = 0; - for (sb = env->used_scoreboards; sb != 0; sb = sb->nextused) { - sb->nextfree = env->free_scoreboards; - env->free_scoreboards = sb; - } - env->labeled_scoreboards = 0; -} - -struct uwx_scoreboard *uwx_init_scoreboards(struct uwx_env *env) -{ - struct uwx_scoreboard *sb; - - uwx_reclaim_scoreboards(env); - sb = uwx_alloc_scoreboard(env); - return sb; -} - -struct uwx_scoreboard *uwx_new_scoreboard( - struct uwx_env *env, - struct uwx_scoreboard *prevsb) -{ - int i; - struct uwx_scoreboard *sb; - - sb = uwx_alloc_scoreboard(env); - if (sb == 0) - return 0; - sb->nextstack = prevsb; - for (i = 0; i < env->nsbreg; i++) - sb->rstate[i] = prevsb->rstate[i]; - return sb; -} - -struct uwx_scoreboard *uwx_pop_scoreboards( - struct uwx_env *env, - struct uwx_scoreboard *sb, - int ecount) -{ - struct uwx_scoreboard *next; - - while (ecount > 0) { - next = sb->nextstack; - TRACE_B_POP(sb->id) - sb->nextstack = 0; - sb->nextfree = env->free_scoreboards; - env->free_scoreboards = sb; - sb = next; - if (sb == 0) - return 0; - ecount--; - } - return sb; -} - -int uwx_label_scoreboard( - struct uwx_env *env, - struct uwx_scoreboard *sb, - int label) -{ - struct uwx_scoreboard *new; - struct uwx_scoreboard *back; - struct uwx_scoreboard *next; - int i; - - TRACE_B_LABEL(label) - - /* Copy the current stack, storing reverse links */ - /* in the "nextstack" field. */ - - back = 0; - new = 0; - while (sb != 0) { - TRACE_B_LABEL_COPY(sb->id) - new = uwx_alloc_scoreboard(env); - if (new == 0) - return UWX_ERR_NOMEM; - new->nextstack = back; - for (i = 0; i < env->nsbreg; i++) - new->rstate[i] = sb->rstate[i]; - sb = sb->nextstack; - back = new; - } - - /* The "new" pointer now points to the bottom of the new stack, */ - /* and the "nextstack" links lead towards the top. */ - /* Now go back down the stack, reversing the stack links to their */ - /* proper direction. */ - - back = 0; - while (new != 0) { - next = new->nextstack; - new->nextstack = back; - TRACE_B_LABEL_REVERSE(back, new) - back = new; - new = next; - } - - /* The "back" pointer now points to the top of the stack. */ - - back->label = label; - back->nextlabel = env->labeled_scoreboards; - env->labeled_scoreboards = back; - return UWX_OK; -} - -int uwx_copy_scoreboard( - struct uwx_env *env, - struct uwx_scoreboard *sb, - int label) -{ - struct uwx_scoreboard *next; - struct uwx_scoreboard *next2; - struct uwx_scoreboard *lsb; - struct uwx_scoreboard *new; - struct uwx_scoreboard *back; - int i; - - TRACE_B_COPY(label, sb->id) - - /* Free the existing stack. */ - - next = sb->nextstack; - while (next != 0) { - TRACE_B_COPY_FREE(next->id) - next2 = next->nextstack; - next->nextstack = 0; - next->nextfree = env->free_scoreboards; - env->free_scoreboards = next; - next = next2; - } - - /* Find the scoreboard with the requested label. */ - - for (lsb = env->labeled_scoreboards; lsb != 0; lsb = lsb->nextlabel) { - if (lsb->label == label) - break; - } - - if (lsb == 0) - return UWX_ERR_UNDEFLABEL; - - TRACE_B_COPY_FOUND(lsb->id) - - /* Copy the labeled scoreboard. */ - - sb->nextstack = 0; - sb->nextlabel = 0; - for (i = 0; i < env->nsbreg; i++) - sb->rstate[i] = lsb->rstate[i]; - sb->label = 0; - - /* Now copy its stack, storing reverse links in the nextstack field. */ - - back = sb; - new = 0; - for (next = lsb->nextstack; next != 0; next = next->nextstack) { - TRACE_B_COPY_COPY(next->id) - new = uwx_alloc_scoreboard(env); - if (new == 0) - return UWX_ERR_NOMEM; - new->nextstack = back; - for (i = 0; i < env->nsbreg; i++) - new->rstate[i] = next->rstate[i]; - back = new; - } - - /* The "new" pointer now points to the bottom of the new stack, */ - /* and the "nextstack" links lead towards the top. */ - /* Now go back down the stack, reversing the nextstack links to their */ - /* proper direction. */ - - back = 0; - while (new != 0) { - next = new->nextstack; - new->nextstack = back; - TRACE_B_COPY_REVERSE(back, new) - back = new; - new = next; - } - - return UWX_OK; -} - -void uwx_free_scoreboards(struct uwx_env *env) -{ - struct uwx_scoreboard *sb; - struct uwx_scoreboard *next; - - for (sb = env->used_scoreboards; sb != 0; sb = next) { - TRACE_B_FREE(sb->id) - next = sb->nextused; - if (!sb->prealloc) { - if (env->free_cb == 0) - free((void *)sb); - else - (*env->free_cb)((void *)sb); - } - } - env->free_scoreboards = 0; - env->used_scoreboards = 0; - env->labeled_scoreboards = 0; -} - diff --git a/sys/contrib/ia64/libuwx/src/uwx_scoreboard.h b/sys/contrib/ia64/libuwx/src/uwx_scoreboard.h deleted file mode 100644 index 752b8fb..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_scoreboard.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#define NSB_SPECIAL 9 -#define NSB_GR 4 -#define NSB_BR 5 -#define NSB_FR 20 - -#define SBREG_RP 0 -#define SBREG_PSP 1 -#define SBREG_PFS 2 -#define SBREG_PREDS 3 -#define SBREG_UNAT 4 -#define SBREG_PRIUNAT 5 -#define SBREG_RNAT 6 -#define SBREG_LC 7 -#define SBREG_FPSR 8 -#define SBREG_GR (0 + NSB_SPECIAL) -#define SBREG_BR (SBREG_GR + NSB_GR) -#define SBREG_FR (SBREG_BR + NSB_BR) - -#define NSBREG_NOFR (NSB_SPECIAL + NSB_GR + NSB_BR) -#define NSBREG (NSB_SPECIAL + NSB_GR + NSB_BR + NSB_FR) - -struct uwx_scoreboard { - struct uwx_scoreboard *nextused; - struct uwx_scoreboard *nextfree; - struct uwx_scoreboard *nextstack; - struct uwx_scoreboard *nextlabel; - uint64_t rstate[NSBREG]; - int label; - int id; - int prealloc; -}; - -extern void uwx_prealloc_scoreboard( - struct uwx_env *env, - struct uwx_scoreboard *sb); - -extern struct uwx_scoreboard *uwx_alloc_scoreboard(struct uwx_env *env); - -extern struct uwx_scoreboard *uwx_init_scoreboards(struct uwx_env *env); - -extern struct uwx_scoreboard *uwx_new_scoreboard( - struct uwx_env *env, - struct uwx_scoreboard *prevsb); - -extern struct uwx_scoreboard *uwx_pop_scoreboards( - struct uwx_env *env, - struct uwx_scoreboard *sb, - int ecount); - -extern int uwx_label_scoreboard( - struct uwx_env *env, - struct uwx_scoreboard *sb, - int label); - -extern int uwx_copy_scoreboard( - struct uwx_env *env, - struct uwx_scoreboard *sb, - int label); - -extern void uwx_free_scoreboards(struct uwx_env *env); diff --git a/sys/contrib/ia64/libuwx/src/uwx_self.c b/sys/contrib/ia64/libuwx/src/uwx_self.c deleted file mode 100644 index 5f47205..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_self.c +++ /dev/null @@ -1,442 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include <stdlib.h> -#include <string.h> -#include <crt0.h> -#include <dlfcn.h> -#include <sys/uc_access.h> - -#include "uwx_env.h" -#include "uwx_context.h" -#include "uwx_trace.h" -#include "uwx_self.h" -#include "uwx_self_info.h" - -#define UWX_ABI_HPUX_SIGCONTEXT 0x0101 /* abi = HP-UX, context = 1 */ - -void uwx_free_load_module_cache(struct uwx_self_info *info); - -int uwx_self_init_info_block(struct uwx_env *env, struct uwx_self_info *info) -{ - info->env = env; - info->ucontext = 0; - info->bspstore = 0; - info->sendsig_start = __load_info->li_sendsig_txt; - info->sendsig_end = __load_info->li_sendsig_txt + - __load_info->li_sendsig_tsz; - info->on_heap = 0; - info->trace = env->trace; - info->load_module_cache = NULL; - - return UWX_OK; -} - -struct uwx_self_info *uwx_self_init_info(struct uwx_env *env) -{ - struct uwx_self_info *info; - - info = (struct uwx_self_info *) - (*env->allocate_cb)(sizeof(struct uwx_self_info)); - if (info == 0) - return 0; - - uwx_self_init_info_block(env, info); - info->on_heap = 1; - return info; -} - -int uwx_self_free_info(struct uwx_self_info *info) -{ - int i; - - if (info->load_module_cache != NULL) - uwx_free_load_module_cache(info); - if (info->on_heap) - (*info->env->free_cb)((void *)info); - return UWX_OK; -} - -int uwx_self_init_from_sigcontext( - struct uwx_env *env, - struct uwx_self_info *info, - ucontext_t *ucontext) -{ - int status; - uint16_t reason; - uint64_t ip; - uint64_t sp; - uint64_t bsp; - uint64_t cfm; - unsigned int nat; - uint64_t ec; - int adj; - - info->ucontext = ucontext; - status = __uc_get_reason(ucontext, &reason); - if (status != 0) - return UWX_ERR_UCACCESS; - status = __uc_get_ip(ucontext, &ip); - if (status != 0) - return UWX_ERR_UCACCESS; - status = __uc_get_grs(ucontext, 12, 1, &sp, &nat); - if (status != 0) - return UWX_ERR_UCACCESS; - status = __uc_get_cfm(ucontext, &cfm); - if (status != 0) - return UWX_ERR_UCACCESS; -#ifdef NEW_UC_GET_AR - status = __uc_get_ar_bsp(ucontext, &bsp); - if (status != 0) - return UWX_ERR_UCACCESS; - status = __uc_get_ar_bspstore(ucontext, &info->bspstore); - if (status != 0) - return UWX_ERR_UCACCESS; - status = __uc_get_ar_ec(ucontext, &ec); - if (status != 0) - return UWX_ERR_UCACCESS; -#else - status = __uc_get_ar(ucontext, 17, &bsp); - if (status != 0) - return UWX_ERR_UCACCESS; - status = __uc_get_ar(ucontext, 18, &info->bspstore); - if (status != 0) - return UWX_ERR_UCACCESS; - status = __uc_get_ar(ucontext, 66, &ec); - if (status != 0) - return UWX_ERR_UCACCESS; -#endif - /* The returned bsp needs to be adjusted. */ - /* For interrupt frames, where bsp was advanced by a cover */ - /* instruction, subtract sof (size of frame). For non-interrupt */ - /* frames, where bsp was advanced by br.call, subtract sol */ - /* (size of locals). */ - if (reason != 0) - adj = (unsigned int)cfm & 0x7f; /* interrupt frame */ - else - adj = ((unsigned int)cfm >> 7) & 0x7f; /* non-interrupt frame */ - bsp = uwx_add_to_bsp(bsp, -adj); - cfm |= ec << 52; - uwx_init_context(env, ip, sp, bsp, cfm); - return UWX_OK; -} - -int uwx_self_do_context_frame( - struct uwx_env *env, - struct uwx_self_info *info) -{ - int abi_context; - int status; - uint64_t ucontext; - - abi_context = uwx_get_abi_context_code(env); - if (abi_context != UWX_ABI_HPUX_SIGCONTEXT) - return UWX_SELF_ERR_BADABICONTEXT; - status = uwx_get_reg(env, UWX_REG_GR(32), (uint64_t *)&ucontext); - if (status != UWX_OK) - return status; - return uwx_self_init_from_sigcontext(env, info, - (ucontext_t *)(intptr_t)ucontext); -} - -int uwx_self_copyin( - int request, - char *loc, - uint64_t rem, - int len, - intptr_t tok) -{ - int status; - int regid; - unsigned int nat; - struct uwx_self_info *info = (struct uwx_self_info *) tok; - unsigned long *wp; - uint64_t *dp; - - status = -1; - - dp = (uint64_t *) loc; - - switch (request) { - case UWX_COPYIN_UINFO: - case UWX_COPYIN_MSTACK: - if (len == 4) { - wp = (unsigned long *) loc; - *wp = *(unsigned long *)(intptr_t)rem; - TRACE_SELF_COPYIN4(rem, len, wp) - status = 0; - } - else if (len == 8) { - *dp = *(uint64_t *)(intptr_t)rem; - TRACE_SELF_COPYIN8(rem, len, dp) - status = 0; - } - break; - case UWX_COPYIN_RSTACK: - if (len == 8) { - if (info->ucontext == 0 && rem == (info->bspstore | 0x1f8)) { - *dp = info->env->context.special[UWX_REG_AR_RNAT]; - status = 0; - } - else if (info->ucontext == 0 || rem < info->bspstore) { - *dp = *(uint64_t *)(intptr_t)rem; - TRACE_SELF_COPYIN8(rem, len, dp) - status = 0; - } - else { - status = __uc_get_rsebs(info->ucontext, - (uint64_t *)(intptr_t)rem, 1, dp); - } - } - break; - case UWX_COPYIN_REG: - regid = (int)rem; - if (info->ucontext != 0) { - if (len == 8) { - if (rem == UWX_REG_PREDS) - status = __uc_get_prs(info->ucontext, dp); - else if (rem == UWX_REG_AR_PFS) - status = __uc_get_ar(info->ucontext, 64, dp); - else if (rem == UWX_REG_AR_RNAT) - status = __uc_get_ar(info->ucontext, 19, dp); - else if (rem == UWX_REG_AR_UNAT) - status = __uc_get_ar(info->ucontext, 36, dp); - else if (rem == UWX_REG_AR_FPSR) - status = __uc_get_ar(info->ucontext, 40, dp); - else if (rem == UWX_REG_AR_LC) - status = __uc_get_ar(info->ucontext, 65, dp); - else if (regid >= UWX_REG_GR(1) && - regid <= UWX_REG_GR(31)) - status = __uc_get_grs(info->ucontext, - regid - UWX_REG_GR(0), 1, dp, &nat); - else if (regid >= UWX_REG_BR(0) && - regid <= UWX_REG_BR(7)) - status = __uc_get_brs(info->ucontext, - regid - UWX_REG_BR(0), 1, dp); - } - else if (len == 16) { - if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(127)) { - status = __uc_get_frs(info->ucontext, - regid - UWX_REG_FR(0), 1, (fp_regval_t *)dp); - } - } - } - break; - } - if (status != 0) - return 0; - return len; -} - -#define MODULE_CACHE_SIZE 4 - -struct load_module_cache { - int clock; - char *names[MODULE_CACHE_SIZE]; - struct load_module_desc descs[MODULE_CACHE_SIZE]; - struct uwx_symbol_cache *symbol_cache; -}; - -void uwx_free_load_module_cache(struct uwx_self_info *info) -{ - int i; - - for (i = 0; i < MODULE_CACHE_SIZE; i++) { - if (info->load_module_cache->names[i] != NULL) - (*info->env->free_cb)((void *)info->load_module_cache->names[i]); - } - - if (info->load_module_cache->symbol_cache != NULL) - uwx_release_symbol_cache(info->env, - info->load_module_cache->symbol_cache); - - (*info->env->free_cb)((void *)info->load_module_cache); -} - -struct load_module_desc *uwx_get_modinfo( - struct uwx_self_info *info, - uint64_t ip, - char **module_name_p) -{ - int i; - UINT64 handle; - struct load_module_cache *cache; - struct load_module_desc *desc; - char *module_name; - - cache = info->load_module_cache; - if (cache == NULL) { - cache = (struct load_module_cache *) - (*info->env->allocate_cb)(sizeof(struct load_module_cache)); - if (cache == NULL) - return NULL; - for (i = 0; i < MODULE_CACHE_SIZE; i++) { - desc = &cache->descs[i]; - desc->text_base = 0; - desc->text_size = 0; - cache->names[i] = NULL; - } - cache->clock = 0; - cache->symbol_cache = NULL; - info->load_module_cache = cache; - } - for (i = 0; i < MODULE_CACHE_SIZE; i++) { - desc = &cache->descs[i]; - if (ip >= desc->text_base && ip < desc->text_base + desc->text_size) - break; - } - if (i >= MODULE_CACHE_SIZE) { - i = cache->clock; - cache->clock = (cache->clock + 1) % MODULE_CACHE_SIZE; - desc = &cache->descs[i]; - handle = dlmodinfo(ip, desc, sizeof(*desc), 0, 0, 0); - if (handle == 0) - return NULL; - if (cache->names[i] != NULL) - (*info->env->free_cb)(cache->names[i]); - cache->names[i] = NULL; - } - if (module_name_p != NULL) { - if (cache->names[i] == NULL) { - module_name = dlgetname(desc, sizeof(*desc), 0, 0, 0); - if (module_name != NULL) { - cache->names[i] = (char *) - (*info->env->allocate_cb)(strlen(module_name)+1); - if (cache->names[i] != NULL) - strcpy(cache->names[i], module_name); - } - } - *module_name_p = cache->names[i]; - } - return desc; -} - -int uwx_self_lookupip( - int request, - uint64_t ip, - intptr_t tok, - uint64_t **resultp) -{ - struct uwx_self_info *info = (struct uwx_self_info *) tok; - UINT64 handle; - struct load_module_desc *desc; - uint64_t *unwind_base; - uint64_t *rvec; - char *module_name; - char *func_name; - uint64_t offset; - int i; - int status; - - if (request == UWX_LKUP_LOOKUP) { - TRACE_SELF_LOOKUP(ip) - if (ip >= info->sendsig_start && ip < info->sendsig_end) { - i = 0; - rvec = info->rvec; - rvec[i++] = UWX_KEY_CONTEXT; - rvec[i++] = UWX_ABI_HPUX_SIGCONTEXT; - rvec[i++] = UWX_KEY_END; - rvec[i++] = 0; - *resultp = rvec; - return UWX_LKUP_FDESC; - } - else { - desc = uwx_get_modinfo(info, ip, NULL); - if (desc == NULL) - return UWX_LKUP_ERR; - unwind_base = (uint64_t *) (intptr_t) desc->unwind_base; - TRACE_SELF_LOOKUP_DESC(desc->text_base, - desc->linkage_ptr, unwind_base) - i = 0; - rvec = info->rvec; - rvec[i++] = UWX_KEY_TBASE; - rvec[i++] = desc->text_base; - rvec[i++] = UWX_KEY_UFLAGS; - rvec[i++] = unwind_base[0]; - rvec[i++] = UWX_KEY_USTART; - rvec[i++] = desc->text_base + unwind_base[1]; - rvec[i++] = UWX_KEY_UEND; - rvec[i++] = desc->text_base + unwind_base[2]; - rvec[i++] = UWX_KEY_GP; - rvec[i++] = desc->linkage_ptr; - rvec[i++] = UWX_KEY_END; - rvec[i++] = 0; - *resultp = rvec; - return UWX_LKUP_UTABLE; - } - } - else if (request == UWX_LKUP_FREE) { - return 0; - } - else if (request == UWX_LKUP_MODULE) { - desc = uwx_get_modinfo(info, ip, &module_name); - if (desc == NULL) - return UWX_LKUP_ERR; - if (module_name == NULL) - return UWX_LKUP_ERR; - i = 0; - rvec = info->rvec; - rvec[i++] = UWX_KEY_MODULE; - rvec[i++] = (uint64_t)(intptr_t)module_name; - rvec[i++] = UWX_KEY_TBASE; - rvec[i++] = desc->text_base; - rvec[i++] = UWX_KEY_END; - rvec[i++] = 0; - *resultp = rvec; - return UWX_LKUP_SYMINFO; - } - else if (request == UWX_LKUP_SYMBOLS) { - rvec = *resultp; - for (i = 0; rvec[i] != UWX_KEY_END; i += 2) { - if (rvec[i] == UWX_KEY_FUNCSTART) - ip = rvec[i+1]; - } - desc = uwx_get_modinfo(info, ip, &module_name); - if (desc == NULL) - return UWX_LKUP_ERR; - if (module_name == NULL) - return UWX_LKUP_ERR; - status = uwx_find_symbol(info->env, - &info->load_module_cache->symbol_cache, - module_name, ip - desc->text_base, - &func_name, &offset); - i = 0; - rvec = info->rvec; - rvec[i++] = UWX_KEY_MODULE; - rvec[i++] = (uint64_t)(intptr_t)module_name; - rvec[i++] = UWX_KEY_TBASE; - rvec[i++] = desc->text_base; - if (status == UWX_OK) { - rvec[i++] = UWX_KEY_FUNC; - rvec[i++] = (uint64_t)(intptr_t)func_name; - rvec[i++] = UWX_KEY_FUNCSTART; - rvec[i++] = ip - offset; - } - rvec[i++] = UWX_KEY_END; - rvec[i++] = 0; - *resultp = rvec; - return UWX_LKUP_SYMINFO; - } - return UWX_LKUP_ERR; -} diff --git a/sys/contrib/ia64/libuwx/src/uwx_self.h b/sys/contrib/ia64/libuwx/src/uwx_self.h deleted file mode 100644 index ada3184..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_self.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifndef __UWX_SELF_INCLUDED -#define __UWX_SELF_INCLUDED 1 - -#include <signal.h> - -#ifndef __UWX_INCLUDED -#include "uwx.h" -#endif /* __UWX_INCLUDED */ - -#if defined(__cplusplus) -#define __EXTERN_C extern "C" -#else -#define __EXTERN_C extern -#endif - -struct uwx_self_info; - -__EXTERN_C struct uwx_self_info *uwx_self_init_info(struct uwx_env *env); - -__EXTERN_C int uwx_self_free_info(struct uwx_self_info *info); - -__EXTERN_C int uwx_self_init_context(struct uwx_env *env); - -__EXTERN_C int uwx_self_init_from_sigcontext( - struct uwx_env *env, - struct uwx_self_info *info, - ucontext_t *ucontext); - -__EXTERN_C int uwx_self_do_context_frame( - struct uwx_env *env, - struct uwx_self_info *info); - -__EXTERN_C int uwx_self_copyin( - int request, - char *loc, - uint64_t rem, - int len, - intptr_t tok); - -__EXTERN_C int uwx_self_lookupip( - int request, - uint64_t ip, - intptr_t tok, - uint64_t **resultp); - -#define UWX_SELF_ERR_BADABICONTEXT (-101) - -#undef __EXTERN_C - -#if defined(__cplusplus) - -class UnwindExpressSelf : public UnwindExpress { - -public: - - UnwindExpressSelf() { - info = uwx_self_init_info(env); - (void)uwx_register_callbacks(env, (intptr_t)info, - uwx_self_copyin, uwx_self_lookupip); - } - - ~UnwindExpressSelf() { - if (info != 0) - uwx_self_free_info(info); - info = 0; - } - - int init_context() { - return uwx_self_init_context(env); - } - - int init_context(ucontext_t *ucontext) { - return uwx_self_init_from_sigcontext(env, info, ucontext); - } - - int do_context_frame() { - return uwx_self_do_context_frame(env, info); - } - -protected: - - struct uwx_self_info *info; - -}; - -#endif /* __cplusplus */ - -#endif /* __UWX_SELF_INCLUDED */ diff --git a/sys/contrib/ia64/libuwx/src/uwx_self_context.s b/sys/contrib/ia64/libuwx/src/uwx_self_context.s deleted file mode 100644 index e2986eb..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_self_context.s +++ /dev/null @@ -1,383 +0,0 @@ -// Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. - -#ifdef _LP64 -#define SWIZZLE add -#define STPTR st8 -#else -#define SWIZZLE addp4 -#define STPTR st4 -#endif - -rRP = r14 -rPFS = r15 -rUNAT = r16 -rRNAT = r17 -rENV0 = r18 -rENV1 = r19 -rENV2 = r20 -rNSLOT = r21 -rBSP = r22 -rPBSP = r23 -rRSC = r24 -rNATP = r25 -rBIAS = r26 -rRSC0 = r27 -rTMP1 = r28 -rTMP2 = r29 -rTMP3 = r30 -rTMP4 = r31 -rTMP5 = r8 -rMYPFS = r9 -rPSP = r10 - -VALID_IP = 1 -VALID_SP = 1 << 1 -VALID_BSP = 1 << 2 -VALID_CFM = 1 << 3 -VALID_PREDS = 1 << 7 -VALID_PRIUNAT = 1 << 8 -VALID_RNAT = 1 << 10 -VALID_UNAT = 1 << 11 -VALID_FPSR = 1 << 12 -VALID_LC = 1 << 13 -VALID_GRS = 0xf << 16 -VALID_BRS = 0x1f << 20 -VALID_BASIC4 = VALID_IP | VALID_SP | VALID_BSP | VALID_CFM -VALID_SPEC = VALID_PREDS | VALID_PRIUNAT | VALID_RNAT | VALID_UNAT | VALID_FPSR | VALID_LC -VALID_REGS = VALID_BASIC4 | VALID_SPEC | VALID_GRS | VALID_BRS -VALID_FRS = 0xfffff -// valid_regs and valid_frs are separate unsigned int fields. -// In order to store them with a single st8, we need to know -// the endianness. -#ifdef __LITTLE_ENDIAN__ -VALID_BITS = (VALID_FRS << 32) | VALID_REGS -#else -VALID_BITS = (VALID_REGS << 32) | VALID_FRS -#endif - - .text - -// int uwx_self_init_context(struct uwx_env *env); -// -// Stores a snapshot of the caller's context in the uwx_env structure. - - .proc uwx_self_init_context - .global uwx_self_init_context -uwx_self_init_context: - .prologue - alloc rPFS = ar.pfs, 1, 0, 0, 0 - mov rUNAT = ar.unat - .body - SWIZZLE rENV0 = r0, r32 // rENV0 = &env - ;; - flushrs - extr.u rNSLOT = rPFS, 7, 7 // nslots = pfs.sol - mov rRP = b0 - ;; - mov rRSC = ar.rsc - add rENV1 = 136, rENV0 // rENV1 = &env->context.gr[0] - add rENV2 = 144, rENV0 // rENV2 = &env->context.gr[1] - ;; - and rRSC0 = -4, rRSC // clear ar.rsc.mode - adds rNATP = 0x1f8, r0 - mov rTMP1 = b1 - ;; - st8.spill [rENV1] = r4, 16 // env+136: r4 - st8.spill [rENV2] = r5, 16 // env+144: r5 - mov rTMP2 = b2 - ;; - st8.spill [rENV1] = r6, 16 // env+152: r6 - st8.spill [rENV2] = r7, 16 // env+160: r7 - mov rTMP3 = b3 - ;; - st8 [rENV1] = rTMP1, 16 // env+168: b1 - st8 [rENV2] = rTMP2, 16 // env+176: b2 - mov rTMP1 = b4 - ;; - st8 [rENV1] = rTMP3, 16 // env+184: b3 - st8 [rENV2] = rTMP1, 16 // env+192: b4 - mov rTMP2 = b5 - ;; - st8 [rENV1] = rTMP2 // env+200: b5 - mov ar.rsc = rRSC0 // enforced lazy mode - add rENV1 = 8, rENV0 - ;; - mov rRNAT = ar.rnat // get copy of ar.rnat - movl rTMP1 = VALID_BITS // valid_regs: ip, sp, bsp, cfm, - // preds, priunat, rnat, unat, fpsr, - // lc, grs, brs - // = 0x1ff3d8f00000000 - ;; - mov ar.rsc = rRSC // restore ar.rsc - mov rBSP = ar.bsp - add rTMP3 = 136, rENV0 // spill_loc = &env->context.gr[0] - ;; - mov rTMP2 = ar.unat - nop - extr.u rTMP3 = rTMP3, 3, 6 // bitpos = spill_loc{8:3} - ;; - and rBIAS = rBSP, rNATP // bias = (bsp & 0x1f8) ... - sub rTMP4 = 64, rTMP3 // (64 - bitpos) - shr rTMP5 = rTMP2, rTMP3 // (unat >> bitpos) - ;; - nop - extr.u rBIAS = rBIAS, 3, 6 // ... div 8 - shl rTMP2 = rTMP2, rTMP4 // (unat << (64 - bitpos)) - ;; - or rTMP2 = rTMP2, rTMP5 // rotate_right(unat, bitpos) - nop - mov rTMP4 = pr - ;; - st8 [rENV0] = rTMP1, 16 // env+0: valid_regs mask - st8 [rENV1] = rRP, 24 // env+8: ip (my rp) - sub rBIAS = rNSLOT, rBIAS // bias = nslots - bias - ;; - cmp.lt p6, p0 = 0, rBIAS // if (0 < bias) ... - cmp.lt p7, p0 = 63, rBIAS // if (63 < bias) ... - ;; - st8 [rENV0] = r12, 48 // env+16: sp - st8 [rENV1] = rPFS, 40 // env+32: cfm (my pfs) -(p6) add rNSLOT = 1, rNSLOT // ... nslots++ - ;; - st8 [rENV0] = rTMP4, 24 // env+64: preds - st8 [rENV1] = rTMP2, 24 // env+72: priunat -(p7) add rNSLOT = 1, rNSLOT // ... nslots++ - ;; - st8 [rENV0] = rRNAT, -64 // env+88: ar.rnat - st8 [rENV1] = rUNAT, 8 // env+96: ar.unat - dep.z rTMP3 = rNSLOT, 3, 7 // (nslots << 3) - ;; - sub rPBSP = rBSP, rTMP3 // prev_bsp = bsp - (nslots << 3) - mov rTMP3 = ar.fpsr - mov rTMP1 = ar.lc - ;; - st8 [rENV0] = rPBSP, 184 // env+24: bsp (my prev bsp) - st8 [rENV1] = rTMP3, 8 // env+104: ar.fpsr - add rENV2 = 320, rENV2 // rENV2 = &env->context.rstate - ;; - st8 [rENV1] = rTMP1, 112 // env+112: ar.lc - STPTR [rENV2] = r0 // env+528: env->rstate = 0 - nop - ;; - // THIS CODE NEEDS TO BE SCHEDULED!!! - stf.spill [rENV0] = f2, 32 // env+208: f2 - stf.spill [rENV1] = f3, 32 // env+224: f3 - ;; - stf.spill [rENV0] = f4, 32 // env+240: f4 - stf.spill [rENV1] = f5, 32 // env+256: f5 - ;; - stf.spill [rENV0] = f16, 32 // env+272: f16 - stf.spill [rENV1] = f17, 32 // env+288: f17 - ;; - stf.spill [rENV0] = f18, 32 // env+304: f16 - stf.spill [rENV1] = f19, 32 // env+320: f17 - ;; - stf.spill [rENV0] = f20, 32 // env+336: f16 - stf.spill [rENV1] = f21, 32 // env+352: f17 - ;; - stf.spill [rENV0] = f22, 32 // env+368: f16 - stf.spill [rENV1] = f23, 32 // env+384: f17 - ;; - stf.spill [rENV0] = f24, 32 // env+400: f16 - stf.spill [rENV1] = f25, 32 // env+416: f17 - ;; - stf.spill [rENV0] = f26, 32 // env+432: f16 - stf.spill [rENV1] = f27, 32 // env+448: f17 - ;; - stf.spill [rENV0] = f28, 32 // env+464: f16 - stf.spill [rENV1] = f29, 32 // env+480: f17 - ;; - stf.spill [rENV0] = f30, 32 // env+496: f16 - stf.spill [rENV1] = f31, 32 // env+512: f17 - ;; - mov ar.unat = rUNAT - mov ret0 = r0 // return UWX_OK - br.ret.sptk b0 - .endp - -// uwx_self_install_context( -// struct uwx_env *env, -// uint64_t r15, -// uint64_t r16, -// uint64_t r17, -// uint64_t r18, -// uint64_t ret -// ); -// -// Installs the given context, and sets the landing pad binding -// registers r15-r18 to the values given. -// Returns the value "ret" to the new context (for testing -- -// when transferring to a landing pad, the new context won't -// care about the return value). - - .proc uwx_self_install_context - .global uwx_self_install_context -uwx_self_install_context: - .prologue - alloc rMYPFS = ar.pfs, 6, 0, 0, 0 - .body - SWIZZLE rENV0 = r0, r32 // rENV0 = &env - ;; - - // THIS CODE NEEDS TO BE SCHEDULED!!! - - // Restore GR 4-7 and ar.unat - add rENV1 = 136, rENV0 // &env->context.gr[0] - add rENV2 = 72, rENV0 // &env->context.priunat - ;; - ld8 rTMP2 = [rENV2], 24 // env+72: priunat - extr.u rTMP3 = rENV1, 3, 6 // bitpos = spill_loc{8:3} - ;; - ld8 rUNAT = [rENV2], 48 // env+96: ar.unat - sub rTMP4 = 64, rTMP3 // (64 - bitpos) - shl rTMP5 = rTMP2, rTMP3 // (unat << bitpos) - ;; - shr rTMP2 = rTMP2, rTMP4 // (unat >> (64 - bitpos)) - ;; - or rTMP2 = rTMP2, rTMP5 // rotate_left(unat, bitpos) - ;; - mov ar.unat = rTMP2 // put priunat in place - ;; - ld8.fill r4 = [rENV1], 16 // env+136: r4 - ld8.fill r5 = [rENV2], 16 // env+144: r5 - ;; - ld8.fill r6 = [rENV1], 16 // env+152: r6 - ld8.fill r7 = [rENV2], 16 // env+160: r7 - ;; - mov ar.unat = rUNAT // restore real ar.unat - - // Restore BR 1-5 - ld8 rTMP1 = [rENV1], 16 // env+168: b1 - ld8 rTMP2 = [rENV2], 16 // env+176: b2 - ;; - ld8 rTMP3 = [rENV1], 16 // env+184: b3 - ld8 rTMP4 = [rENV2], -168 // env+192: b4 - mov b1 = rTMP1 - ;; - ld8 rTMP1 = [rENV1], -168 // env+200: b5 - mov b2 = rTMP2 - mov b3 = rTMP3 - mov b4 = rTMP4 - ;; - mov b5 = rTMP1 - - // Restore ar.bsp, ar.pfs, and ar.rnat - ld8 rPFS = [rENV1], 56 // env+32: cfm (+saved ar.ec) - mov rRSC = ar.rsc - adds rBIAS = 0x1f8, r0 - ;; - flushrs - ld8 rRNAT = [rENV1], -24 // env+88: ar.rnat - ld8 rPBSP = [rENV2], 88 // env+24: prev_bsp - and rRSC0 = -4, rRSC // clear ar.rsc.mode - ;; - mov ar.rsc = rRSC0 // enforced lazy mode - extr.u rNSLOT = rPFS, 7, 7 // nslots = pfs.sol - ;; - invala - and rBIAS = rPBSP, rBIAS // bias = prev_bsp & 0x1f8 ... - ;; - extr.u rBIAS = rBIAS, 3, 6 // ... div 8 - ;; - add rBIAS = rNSLOT, rBIAS // bias += nslots - ;; - cmp.lt p6, p0 = 63, rBIAS // if (63 < bias) ... - cmp.lt p7, p0 = 126, rBIAS // if (126 < bias) ... - ;; -(p6) add rNSLOT = 1, rNSLOT // ... nslots++ - ;; -(p7) add rNSLOT = 1, rNSLOT // ... nslots++ - ;; - dep.z rTMP3 = rNSLOT, 3, 7 // (nslots << 3) - ;; - add rBSP = rPBSP, rTMP3 // bsp = prev_bsp + (nslots << 3) - ;; - mov ar.bspstore = rBSP // restore ar.bsp - ;; - mov ar.rnat = rRNAT // restore ar.rnat - mov ar.pfs = rPFS // restore ar.pfs - ;; - mov ar.rsc = rRSC // restore ar.rsc - - // Restore preds and ar.lc - ld8 rTMP1 = [rENV1], -56 // env+64: preds - ld8 rTMP2 = [rENV2], -96 // env+112: ar.lc - ;; - mov pr = rTMP1 - mov ar.lc = rTMP2 - - // Get previous sp and ip - ld8 rRP = [rENV1], 96 // env+8: ip (my rp) - ld8 rPSP = [rENV2], 112 // env+16: sp - ;; - - // Restore ar.fpsr and gp - ld8 rTMP1 = [rENV1], 104 // env+104: ar.fpsr - ld8 r1 = [rENV2], 96 // env+128: gp - ;; - mov ar.fpsr = rTMP1 // restore ar.fpsr - - // Restore FR 2-5 and 16-31 - ldf.fill f2 = [rENV1], 32 // env+208: f2 - ldf.fill f3 = [rENV2], 32 // env+224: f3 - ;; - ldf.fill f4 = [rENV1], 32 // env+240: f4 - ldf.fill f5 = [rENV2], 32 // env+256: f5 - ;; - ldf.fill f16 = [rENV1], 32 // env+272: f16 - ldf.fill f17 = [rENV2], 32 // env+288: f17 - ;; - ldf.fill f18 = [rENV1], 32 // env+304: f16 - ldf.fill f19 = [rENV2], 32 // env+320: f17 - ;; - ldf.fill f20 = [rENV1], 32 // env+336: f16 - ldf.fill f21 = [rENV2], 32 // env+352: f17 - ;; - ldf.fill f22 = [rENV1], 32 // env+368: f16 - ldf.fill f23 = [rENV2], 32 // env+384: f17 - ;; - ldf.fill f24 = [rENV1], 32 // env+400: f16 - ldf.fill f25 = [rENV2], 32 // env+416: f17 - ;; - ldf.fill f26 = [rENV1], 32 // env+432: f16 - ldf.fill f27 = [rENV2], 32 // env+448: f17 - ;; - ldf.fill f28 = [rENV1], 32 // env+464: f16 - ldf.fill f29 = [rENV2], 32 // env+480: f17 - ;; - ldf.fill f30 = [rENV1], 32 // env+496: f16 - ldf.fill f31 = [rENV2], 32 // env+512: f17 - - // Set landing pad parameter registers - mov r15 = r33 - mov r16 = r34 - mov r17 = r35 - mov r18 = r36 - - // Restore previous sp and Return - mov ret0 = r37 - mov sp = rPSP - mov b0 = rRP - br.ret.sptk b0 - - .endp diff --git a/sys/contrib/ia64/libuwx/src/uwx_self_info.h b/sys/contrib/ia64/libuwx/src/uwx_self_info.h deleted file mode 100644 index 1d1cc57..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_self_info.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#define MAX_RVEC_SIZE 12 - -struct load_module_cache; - -struct uwx_self_info { - struct uwx_env *env; - ucontext_t *ucontext; - uint64_t bspstore; - uint64_t rvec[MAX_RVEC_SIZE]; - uint64_t sendsig_start; - uint64_t sendsig_end; - int on_heap; - int trace; - struct load_module_cache *load_module_cache; -}; - -extern int uwx_self_init_info_block( - struct uwx_env *env, - struct uwx_self_info *info - ); diff --git a/sys/contrib/ia64/libuwx/src/uwx_step.c b/sys/contrib/ia64/libuwx/src/uwx_step.c deleted file mode 100644 index 42b8c93..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_step.c +++ /dev/null @@ -1,827 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include "uwx_env.h" -#include "uwx_utable.h" -#include "uwx_uinfo.h" -#include "uwx_scoreboard.h" -#include "uwx_str.h" -#include "uwx_step.h" -#include "uwx_trace.h" - -/* - * uwx_step.c - * - * This file contains the routines for stepping from one frame - * into its callers frame. The context for the current frame - * is maintained inside the current unwind environment - * (struct uwx_env), and is updated with each call to - * uwx_step() to refer to the previous frame. - */ - - -/* Forward Declarations */ - -int uwx_decode_uvec(struct uwx_env *env, uint64_t *uvec, uint64_t **rstate); -int uwx_restore_reg(struct uwx_env *env, uint64_t rstate, - uint64_t *valp, uint64_t *histp); -int uwx_restore_freg(struct uwx_env *env, uint64_t rstate, - uint64_t *valp, uint64_t *histp); -int uwx_restore_nat(struct uwx_env *env, uint64_t rstate, int unat); - - -/* uwx_lookupip_hook: Hook routine so dynamic instrumentation */ -/* tools can intercept Lookup IP events. When not */ -/* intercepted, it just returns "Not found", so that */ -/* the callback routine is invoked. */ - -/*ARGSUSED*/ -int uwx_lookupip_hook(int request, uint64_t ip, intptr_t tok, uint64_t **vecp, - size_t uvecsize) -{ - return UWX_LKUP_NOTFOUND; -} - - -/* uwx_get_frame_info: Gets unwind info for current frame */ -static -int uwx_get_frame_info(struct uwx_env *env) -{ - int i; - int status; - int cbstatus; - int cbcalled = 0; - uint64_t ip; - uint64_t *uvec; - uint64_t *rstate; - struct uwx_utable_entry uentry; - uint64_t uvecout[UVECSIZE]; - - if (env->copyin == 0 || env->lookupip == 0) - return UWX_ERR_NOCALLBACKS; - - env->ptr_size = DWORDSZ; - env->code_start = 0; - env->function_offset = -1LL; - env->function_name = 0; - env->module_name = 0; - env->abi_context = 0; - uwx_reset_str_pool(env); - - /* Use the lookup IP callback routine to find out about the */ - /* current IP. If the predicate registers are valid, pass them */ - /* in the uvec. */ - - /* When self-unwinding, we call a hook routine before the */ - /* callback. If the application is running under control of */ - /* a dynamic instrumentation tool, that tool will have an */ - /* opportunity to intercept lookup IP requests. */ - - i = 0; - uvecout[i++] = UWX_KEY_VERSION; - uvecout[i++] = UWX_VERSION; - if (env->context.valid_regs & (1 << UWX_REG_PREDS)) { - uvecout[i++] = UWX_KEY_PREDS; - uvecout[i++] = env->context.special[UWX_REG_PREDS]; - } - uvecout[i++] = UWX_KEY_END; - uvecout[i++] = 0; - uvec = uvecout; - cbstatus = UWX_LKUP_NOTFOUND; - ip = env->context.special[UWX_REG_IP]; - env->remapped_ip = ip; - - /* Call the hook routine. */ - - if (env->remote == 0) - cbstatus = uwx_lookupip_hook(UWX_LKUP_LOOKUP, ip, env->cb_token, &uvec, - sizeof(uvecout)); - - /* If the hook routine remapped the IP, use the new IP for */ - /* the callback instead of the original IP. */ - - if (cbstatus == UWX_LKUP_REMAP) { - for (i = 0; uvec[i] != UWX_KEY_END; i += 2) { - switch ((int)uvec[i]) { - case UWX_KEY_NEWIP: - ip = uvec[i+1]; - break; - } - } - env->remapped_ip = ip; - } - - /* Now call the callback routine unless the hook routine gave */ - /* us all the info. */ - - if (cbstatus == UWX_LKUP_NOTFOUND || cbstatus == UWX_LKUP_REMAP) { - cbcalled = 1; - cbstatus = (*env->lookupip)(UWX_LKUP_LOOKUP, ip, env->cb_token, &uvec); - } - - /* If the callback routine remapped the IP, call it one more time */ - /* with the new IP. */ - - if (cbstatus == UWX_LKUP_REMAP) { - for (i = 0; uvec[i] != UWX_KEY_END; i += 2) { - switch ((int)uvec[i]) { - case UWX_KEY_NEWIP: - ip = uvec[i+1]; - break; - } - } - env->remapped_ip = ip; - cbstatus = (*env->lookupip)(UWX_LKUP_LOOKUP, ip, env->cb_token, &uvec); - } - - /* If NOTFOUND, there's nothing we can do but return an error. */ - - if (cbstatus == UWX_LKUP_NOTFOUND) { - status = UWX_ERR_IPNOTFOUND; - } - - /* If the callback returns an unwind table, we need to */ - /* search the table for an unwind entry that describes the */ - /* code region of interest, then decode the unwind information */ - /* associated with that unwind table entry, and store the */ - /* resulting register state array in the unwind environment */ - /* block. */ - - else if (cbstatus == UWX_LKUP_UTABLE) { - status = uwx_search_utable(env, ip, uvec, &uentry); - if (cbcalled) - (void) (*env->lookupip)(UWX_LKUP_FREE, 0, env->cb_token, &uvec); - if (status == UWX_OK) { - env->ptr_size = uentry.ptr_size; - env->code_start = uentry.code_start; - status = uwx_decode_uinfo(env, &uentry, &rstate); - } - if (status == UWX_ERR_NOUENTRY || status == UWX_ERR_NOUDESC) - status = uwx_default_rstate(env, &rstate); - if (status == UWX_OK) - env->rstate = rstate; - } - - /* If the callback returns an unwind info block, we can */ - /* proceed directly to decoding the unwind information. */ - - else if (cbstatus == UWX_LKUP_UINFO) { - uentry.ptr_size = DWORDSZ; - uentry.code_start = 0; - uentry.code_end = 0; - uentry.unwind_info = 0; - uentry.unwind_flags = 0; - for (i = 0; uvec[i] != UWX_KEY_END; i += 2) { - switch ((int)uvec[i]) { - case UWX_KEY_UFLAGS: - uentry.unwind_flags = uvec[i+1]; - if (uentry.unwind_flags & UNWIND_TBL_32BIT) - uentry.ptr_size = WORDSZ; - break; - case UWX_KEY_UINFO: - uentry.unwind_info = uvec[i+1]; - break; - case UWX_KEY_GP: - uwx_set_reg(env, UWX_REG_GP, uvec[i+1]); - break; - case UWX_KEY_MODULE: - env->module_name = - uwx_alloc_str(env, (char *)(intptr_t)(uvec[i+1])); - break; - case UWX_KEY_FUNC: - env->function_name = - uwx_alloc_str(env, (char *)(intptr_t)(uvec[i+1])); - break; - case UWX_KEY_FUNCSTART: - uentry.code_start = uvec[i+1]; - env->code_start = uentry.code_start; - break; - } - } - env->ptr_size = uentry.ptr_size; - if (cbcalled) - (void) (*env->lookupip)(UWX_LKUP_FREE, 0, env->cb_token, &uvec); - status = uwx_decode_uinfo(env, &uentry, &rstate); - if (status == UWX_ERR_NOUDESC) - status = uwx_default_rstate(env, &rstate); - if (status == UWX_OK) - env->rstate = rstate; - } - - /* If the callback returns a frame description (in the form */ - /* of an update vector), convert the update vector into a */ - /* register state array, then invoke the callback again to */ - /* let it free any memory it allocated. */ - - else if (cbstatus == UWX_LKUP_FDESC) { - status = uwx_decode_uvec(env, uvec, &rstate); - if (cbcalled) - (void) (*env->lookupip)(UWX_LKUP_FREE, 0, env->cb_token, &uvec); - if (status == UWX_OK) - env->rstate = rstate; - } - - /* Any other return from the callback is an error. */ - - else { - status = UWX_ERR_LOOKUPERR; - } - return status; -} - - -/* uwx_restore_markers: Restores the stack markers -- PSP, RP, PFS */ - -int uwx_restore_markers(struct uwx_env *env) -{ - int status; - uint64_t val; - uint64_t hist; - - if ((env->context.valid_regs & VALID_BASIC4) != VALID_BASIC4) - return UWX_ERR_NOCONTEXT; - - /* If we haven't already obtained the frame info for the */ - /* current frame, get it now. */ - - if (env->rstate == 0) { - status = uwx_get_frame_info(env); - if (status != UWX_OK) - return status; - } - - TRACE_S_STEP(env->rstate) - - if (env->rstate[SBREG_PSP] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, env->rstate[SBREG_PSP], &val, &hist); - if (status != UWX_OK) - return status; - env->context.special[UWX_REG_PSP] = val; - env->history.special[UWX_REG_PSP] = hist; - env->context.valid_regs |= 1 << UWX_REG_PSP; - TRACE_S_RESTORE_REG("PSP", env->rstate[SBREG_PSP], val) - } - - if (env->rstate[SBREG_RP] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, env->rstate[SBREG_RP], &val, &hist); - if (status != UWX_OK) - return status; - env->context.special[UWX_REG_RP] = val; - env->history.special[UWX_REG_RP] = hist; - env->context.valid_regs |= 1 << UWX_REG_RP; - TRACE_S_RESTORE_REG("RP", env->rstate[SBREG_RP], val) - } - - if (env->rstate[SBREG_PFS] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, env->rstate[SBREG_PFS], &val, &hist); - if (status != UWX_OK) - return status; - env->context.special[UWX_REG_PFS] = val; - env->history.special[UWX_REG_PFS] = hist; - env->context.valid_regs |= 1 << UWX_REG_PFS; - TRACE_S_RESTORE_REG("PFS", env->rstate[SBREG_PFS], val) - } - - return UWX_OK; -} - -/* uwx_get_module_info: Gets module name and text base for current frame */ - -int uwx_get_module_info( - struct uwx_env *env, - char **modp, - uint64_t *text_base) -{ - int i; - int status; - int cbstatus; - uint64_t ip; - uint64_t *uvec; - uint64_t uvecout[UVECSIZE]; - - if (env == 0) - return UWX_ERR_NOENV; - - /* If we haven't already obtained the frame info for the */ - /* current frame, get it now. */ - - if (env->rstate == 0) { - status = uwx_get_frame_info(env); - if (status != UWX_OK) - return status; - } - - /* Get the module name from the lookup IP callback. */ - if (env->module_name == 0) { - ip = env->remapped_ip; - i = 0; - if (env->function_offset >= 0) { - uvecout[i++] = UWX_KEY_FUNCSTART; - uvecout[i++] = ip - env->function_offset; - } - uvecout[i++] = UWX_KEY_END; - uvecout[i++] = 0; - uvec = uvecout; - cbstatus = (*env->lookupip)(UWX_LKUP_MODULE, ip, env->cb_token, &uvec); - - if (cbstatus == UWX_LKUP_SYMINFO) { - for (i = 0; uvec[i] != UWX_KEY_END; i += 2) { - switch ((int)uvec[i]) { - case UWX_KEY_TBASE: - env->text_base = uvec[i+1]; - break; - case UWX_KEY_MODULE: - env->module_name = - uwx_alloc_str(env, (char *)(intptr_t)(uvec[i+1])); - break; - case UWX_KEY_FUNC: - env->function_name = - uwx_alloc_str(env, (char *)(intptr_t)(uvec[i+1])); - break; - case UWX_KEY_FUNCSTART: - env->function_offset = ip - uvec[i+1]; - break; - } - } - (void) (*env->lookupip)(UWX_LKUP_FREE, 0, env->cb_token, &uvec); - } - } - - *modp = env->module_name; - *text_base = env->text_base; - - return UWX_OK; -} - -/* uwx_get_funcstart: Gets start address of function from current frame */ - -int uwx_get_funcstart( - struct uwx_env *env, - uint64_t *funcstart) -{ - int status; - - if (env == 0) - return UWX_ERR_NOENV; - - /* If we haven't already obtained the frame info for the */ - /* current frame, get it now. */ - - if (env->rstate == 0) { - status = uwx_get_frame_info(env); - if (status != UWX_OK) - return status; - } - - *funcstart = env->remapped_ip - env->function_offset; - - return UWX_OK; -} - -/* uwx_get_sym_info: Gets symbolic info from current frame */ -/* (Will make a UWX_LKUP_SYMBOLS callback if info */ -/* was not provided by UWX_LKUP_LOOKUP callback) */ - -int uwx_get_sym_info( - struct uwx_env *env, - char **modp, - char **symp, - uint64_t *offsetp) -{ - int status; - int cbstatus; - uint64_t ip; - uint64_t *uvec; - uint64_t uvecout[UVECSIZE]; - int i; - - if (env == 0) - return UWX_ERR_NOENV; - - /* If we haven't already obtained the frame info for the */ - /* current frame, get it now. */ - - if (env->rstate == 0) { - status = uwx_get_frame_info(env); - if (status != UWX_OK) - return status; - } - - /* Get the symbolic information from the lookup IP callback. */ - if (env->function_name == 0) { - ip = env->remapped_ip; - i = 0; - if (env->function_offset >= 0) { - uvecout[i++] = UWX_KEY_FUNCSTART; - uvecout[i++] = ip - env->function_offset; - } - uvecout[i++] = UWX_KEY_END; - uvecout[i++] = 0; - uvec = uvecout; - cbstatus = (*env->lookupip)(UWX_LKUP_SYMBOLS, ip, env->cb_token, &uvec); - - if (cbstatus == UWX_LKUP_SYMINFO) { - for (i = 0; uvec[i] != UWX_KEY_END; i += 2) { - switch ((int)uvec[i]) { - case UWX_KEY_MODULE: - env->module_name = - uwx_alloc_str(env, (char *)(intptr_t)(uvec[i+1])); - break; - case UWX_KEY_FUNC: - env->function_name = - uwx_alloc_str(env, (char *)(intptr_t)(uvec[i+1])); - break; - case UWX_KEY_FUNCSTART: - env->function_offset = ip - uvec[i+1]; - break; - } - } - (void) (*env->lookupip)(UWX_LKUP_FREE, 0, env->cb_token, &uvec); - } - } - - *modp = env->module_name; - *symp = env->function_name; - *offsetp = env->function_offset; - - return UWX_OK; -} - - -/* uwx_step: Steps from the current frame to the previous frame */ - -int uwx_step(struct uwx_env *env) -{ - int i; - int status; - int pfs_sol; - int dispcode; - uint64_t val; - uint64_t fval[2]; - uint64_t hist; - uint64_t tempgr[NPRESERVEDGR]; - int needpriunat; - int unat; - int tempnat; - - if (env == 0) - return UWX_ERR_NOENV; - - /* Complete the current context by restoring the current values */ - /* of psp, rp, and pfs. */ - - if (env->rstate == 0 || - (env->context.valid_regs & VALID_MARKERS) != VALID_MARKERS) { - status = uwx_restore_markers(env); - if (status != UWX_OK) - return status; - } - - /* Check for bottom of stack (rp == 0). */ - - if (env->context.special[UWX_REG_RP] == 0) - return UWX_BOTTOM; - - /* Find where the primary unat is saved, get a copy. */ - /* Then, as we restore the GRs, we'll merge the NaT bits into the */ - /* priunat register in the context. */ - /* (Make sure we need it, though, before we try to get it, */ - /* because the attempt to get it might invoke the copy-in callback. */ - /* We don't need the priunat unless one of GR 4-7 was */ - /* saved to the memory stack.) */ - - needpriunat = 0; - for (i = 0; i < NSB_GR; i++) { - dispcode = UWX_GET_DISP_CODE(env->rstate[SBREG_GR + i]); - if (dispcode == UWX_DISP_SPREL(0) || dispcode == UWX_DISP_PSPREL(0)) - needpriunat = 1; - } - unat = 0; - if (needpriunat && env->rstate[SBREG_PRIUNAT] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, env->rstate[SBREG_PRIUNAT], &val, &hist); - if (status != UWX_OK) - return status; - unat = (int) val; - env->history.special[UWX_REG_PRIUNAT] = hist; - TRACE_S_RESTORE_REG("PRIUNAT", env->rstate[SBREG_PRIUNAT], val) - } - - /* Retrieve saved values of the preserved GRs into temporaries. */ - - tempnat = (int) env->context.special[UWX_REG_PRIUNAT]; - for (i = 0; i < NSB_GR; i++) { - if (env->rstate[SBREG_GR + i] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, - env->rstate[SBREG_GR + i], &val, &hist); - if (status != UWX_OK) - return status; - tempgr[i] = val; - if (uwx_restore_nat(env, env->rstate[SBREG_GR + i], unat)) - tempnat |= 1 << i; - else - tempnat &= ~(1 << i); - env->history.gr[i] = hist; - env->context.valid_regs |= 1 << (i + VALID_GR_SHIFT); - TRACE_S_RESTORE_GR(i, env->rstate[SBREG_GR + i], val) - } - } - - /* Now we have everything we need to step back to the previous frame. */ - - /* Restore preserved BRs. */ - - for (i = 0; i < NSB_BR; i++) { - if (env->rstate[SBREG_BR + i] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, - env->rstate[SBREG_BR + i], &val, &hist); - if (status != UWX_OK) - return status; - env->context.br[i] = val; - env->history.br[i] = hist; - env->context.valid_regs |= 1 << (i + VALID_BR_SHIFT); - TRACE_S_RESTORE_BR(i, env->rstate[SBREG_BR + i], val) - } - } - - /* Restore preserved FRs. */ - - if (env->nsbreg == NSBREG) { - for (i = 0; i < NSB_FR; i++) { - if (env->rstate[SBREG_FR + i] != UWX_DISP_NONE) { - status = uwx_restore_freg(env, - env->rstate[SBREG_FR + i], fval, &hist); - if (status != UWX_OK) - return status; - env->context.fr[i].part0 = fval[0]; - env->context.fr[i].part1 = fval[1]; - env->history.fr[i] = hist; - env->context.valid_frs |= 1 << i; - TRACE_S_RESTORE_FR(i, env->rstate[SBREG_FR + i], fval) - } - } - } - - /* Restore other preserved regs. */ - - if (env->rstate[SBREG_PREDS] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, env->rstate[SBREG_PREDS], &val, &hist); - if (status != UWX_OK) - return status; - env->context.special[UWX_REG_PREDS] = val; - env->history.special[UWX_REG_PREDS] = hist; - env->context.valid_regs |= 1 << UWX_REG_PREDS; - TRACE_S_RESTORE_REG("PREDS", env->rstate[SBREG_PREDS], val) - } - if (env->rstate[SBREG_RNAT] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, env->rstate[SBREG_RNAT], &val, &hist); - if (status != UWX_OK) - return status; - env->context.special[UWX_REG_AR_RNAT] = val; - env->history.special[UWX_REG_AR_RNAT] = hist; - env->context.valid_regs |= 1 << UWX_REG_AR_RNAT; - TRACE_S_RESTORE_REG("RNAT", env->rstate[SBREG_RNAT], val) - } - if (env->rstate[SBREG_UNAT] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, env->rstate[SBREG_UNAT], &val, &hist); - if (status != UWX_OK) - return status; - env->context.special[UWX_REG_AR_UNAT] = val; - env->history.special[UWX_REG_AR_UNAT] = hist; - env->context.valid_regs |= 1 << UWX_REG_AR_UNAT; - TRACE_S_RESTORE_REG("UNAT", env->rstate[SBREG_UNAT], val) - } - if (env->rstate[SBREG_FPSR] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, env->rstate[SBREG_FPSR], &val, &hist); - if (status != UWX_OK) - return status; - env->context.special[UWX_REG_AR_FPSR] = val; - env->history.special[UWX_REG_AR_FPSR] = hist; - env->context.valid_regs |= 1 << UWX_REG_AR_FPSR; - TRACE_S_RESTORE_REG("FPSR", env->rstate[SBREG_FPSR], val) - } - if (env->rstate[SBREG_LC] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, env->rstate[SBREG_LC], &val, &hist); - if (status != UWX_OK) - return status; - env->context.special[UWX_REG_AR_LC] = val; - env->history.special[UWX_REG_AR_LC] = hist; - env->context.valid_regs |= 1 << UWX_REG_AR_LC; - TRACE_S_RESTORE_REG("LC", env->rstate[SBREG_LC], val) - } - - /* Restore preserved GRs from temporaries. */ - - for (i = 0; i < NSB_GR; i++) { - if (env->rstate[SBREG_GR + i] != UWX_DISP_NONE) - env->context.gr[i] = tempgr[i]; - } - env->context.special[UWX_REG_PRIUNAT] = tempnat; - - /* Restore the frame markers. */ - - env->context.special[UWX_REG_IP] = env->context.special[UWX_REG_RP]; - env->history.special[UWX_REG_IP] = env->history.special[UWX_REG_RP]; - - env->context.special[UWX_REG_SP] = env->context.special[UWX_REG_PSP]; - env->history.special[UWX_REG_SP] = env->history.special[UWX_REG_PSP]; - - pfs_sol = ((unsigned int)env->context.special[UWX_REG_PFS] >> 7) & 0x7f; - env->context.special[UWX_REG_BSP] = uwx_add_to_bsp( - env->context.special[UWX_REG_BSP], - -pfs_sol); - - env->context.special[UWX_REG_CFM] = env->context.special[UWX_REG_PFS]; - env->history.special[UWX_REG_CFM] = env->history.special[UWX_REG_PFS]; - - env->context.special[UWX_REG_RP] = 0; - - /* The frame info for the new frame isn't yet available. */ - - env->rstate = 0; - env->context.valid_regs &= ~VALID_MARKERS; - - return UWX_OK; -} - - -/* uwx_decode_uvec: Converts the update vector into a register state array */ - -int uwx_decode_uvec(struct uwx_env *env, uint64_t *uvec, uint64_t **rstate) -{ - int i; - int status; - - status = uwx_default_rstate(env, rstate); - if (status != UWX_OK) - return status; - - for (i = 0; uvec[i] != UWX_KEY_END; i += 2) { - switch ((int)uvec[i]) { - case UWX_KEY_CONTEXT: - env->abi_context = (int)(uvec[i+1]); - status = UWX_ABI_FRAME; - break; - case UWX_KEY_GP: - uwx_set_reg(env, UWX_REG_GP, uvec[i+1]); - break; - case UWX_KEY_MODULE: - env->module_name = - uwx_alloc_str(env, (char *)(intptr_t)(uvec[i+1])); - break; - case UWX_KEY_FUNC: - env->function_name = - uwx_alloc_str(env, (char *)(intptr_t)(uvec[i+1])); - break; - case UWX_KEY_FUNCSTART: - env->function_offset = env->remapped_ip - uvec[i+1]; - break; - default: - return UWX_ERR_CANTUNWIND; - } - } - return status; -} - - -/* uwx_restore_reg: Restores a register according to the scoreboard */ - -#define COPYIN_MSTACK_8(dest, src) \ - (env->remote? \ - (*env->copyin)(UWX_COPYIN_MSTACK, (dest), (src), \ - DWORDSZ, env->cb_token) : \ - (*(uint64_t *)(intptr_t)(dest) = \ - *(uint64_t *)(intptr_t)(src), DWORDSZ) ) - -int uwx_restore_reg(struct uwx_env *env, uint64_t rstate, - uint64_t *valp, uint64_t *histp) -{ - int status; - uint64_t p; - int n; - int regid; - - status = UWX_OK; - - switch (UWX_GET_DISP_CODE(rstate)) { - case UWX_DISP_SPPLUS(0): - *valp = env->context.special[UWX_REG_SP] + - UWX_GET_DISP_OFFSET(rstate); - *histp = UWX_DISP_NONE; - break; - case UWX_DISP_SPREL(0): - p = env->context.special[UWX_REG_SP] + - UWX_GET_DISP_OFFSET(rstate); - n = COPYIN_MSTACK_8((char *)valp, p); - if (n != DWORDSZ) - status = UWX_ERR_COPYIN_MSTK; - *histp = UWX_DISP_MSTK(p); - break; - case UWX_DISP_PSPREL(0): - p = env->context.special[UWX_REG_PSP] + 16 - - UWX_GET_DISP_OFFSET(rstate); - n = COPYIN_MSTACK_8((char *)valp, p); - if (n != DWORDSZ) - status = UWX_ERR_COPYIN_MSTK; - *histp = UWX_DISP_MSTK(p); - break; - case UWX_DISP_REG(0): - regid = UWX_GET_DISP_REGID(rstate); - status = uwx_get_reg(env, regid, valp); - (void) uwx_get_spill_loc(env, regid, histp); - break; - } - return status; -} - -#define COPYIN_MSTACK_16(dest, src) \ - (env->remote? \ - (*env->copyin)(UWX_COPYIN_MSTACK, (dest), (src), \ - 2*DWORDSZ, env->cb_token) : \ - (*(uint64_t *)(intptr_t)(dest) = *(uint64_t *)(intptr_t)(src), \ - *(uint64_t *)(intptr_t)((dest)+8) = \ - *(uint64_t *)(intptr_t)((src)+8), \ - 2*DWORDSZ) ) - -int uwx_restore_freg(struct uwx_env *env, uint64_t rstate, - uint64_t *valp, uint64_t *histp) -{ - int status; - uint64_t p; - int n; - int regid; - - status = UWX_OK; - - switch (UWX_GET_DISP_CODE(rstate)) { - case UWX_DISP_SPREL(0): - p = env->context.special[UWX_REG_SP] + - UWX_GET_DISP_OFFSET(rstate); - n = COPYIN_MSTACK_16((char *)valp, p); - if (n != 2*DWORDSZ) - status = UWX_ERR_COPYIN_MSTK; - *histp = UWX_DISP_MSTK(p); - break; - case UWX_DISP_PSPREL(0): - p = env->context.special[UWX_REG_PSP] + 16 - - UWX_GET_DISP_OFFSET(rstate); - n = COPYIN_MSTACK_16((char *)valp, p); - if (n != 2*DWORDSZ) - status = UWX_ERR_COPYIN_MSTK; - *histp = UWX_DISP_MSTK(p); - break; - case UWX_DISP_REG(0): - regid = UWX_GET_DISP_REGID(rstate); - status = uwx_get_reg(env, regid, valp); - (void) uwx_get_spill_loc(env, regid, histp); - break; - } - return status; -} - -/* uwx_restore_nat: Returns the saved NaT bit for a preserved GR */ - -int uwx_restore_nat(struct uwx_env *env, uint64_t rstate, int unat) -{ - int nat; - uint64_t p; - - nat = 0; - switch (UWX_GET_DISP_CODE(rstate)) { - case UWX_DISP_SPREL(0): - p = env->context.special[UWX_REG_SP] + - UWX_GET_DISP_OFFSET(rstate); - nat = (unat >> (((int)p >> 3) & 0x3f)) & 0x01; - break; - case UWX_DISP_PSPREL(0): - p = env->context.special[UWX_REG_PSP] + 16 - - UWX_GET_DISP_OFFSET(rstate); - nat = (unat >> (((int)p >> 3) & 0x3f)) & 0x01; - break; - case UWX_DISP_REG(0): - (void) uwx_get_nat(env, UWX_GET_DISP_REGID(rstate), &nat); - break; - } - return nat; -} - diff --git a/sys/contrib/ia64/libuwx/src/uwx_step.h b/sys/contrib/ia64/libuwx/src/uwx_step.h deleted file mode 100644 index 0f41521..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_step.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#define UVECSIZE 20 /* Size of uvec supplied by unwind engine */ - /* for callback's use. */ - -extern int uwx_lookupip_hook(int request, uint64_t ip, intptr_t tok, - uint64_t **vecp, size_t uvecsize); -extern int uwx_restore_markers(struct uwx_env *env); diff --git a/sys/contrib/ia64/libuwx/src/uwx_str.c b/sys/contrib/ia64/libuwx/src/uwx_str.c deleted file mode 100644 index 8e66f1c..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_str.c +++ /dev/null @@ -1,128 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifndef _KERNEL -#include <string.h> -#endif - -#include "uwx_env.h" -#include "uwx_str.h" - -#ifdef _KERNEL -static struct uwx_str_pool uwx_str_pool; -#define free(p) /* nullified */ -#define malloc(sz) ((sz == sizeof(uwx_str_pool)) ? &uwx_str_pool : NULL) -#endif - -/* - * uwx_str.c - * - * This file contains the routines for maintaining a string - * pool for the unwind environment. We preallocate enough - * space for most purposes so that no memory allocation is - * necessary during a normal unwind. If we do need more, - * we use the allocate callback, if one is provided. - * - * The string pool is reused with each call to step(), - * and is completely freed when the unwind environment is - * freed. - */ - - -int uwx_init_str_pool(struct uwx_env *env, struct uwx_str_pool *pool) -{ - if (pool == 0) - return UWX_ERR_NOMEM; - - pool->next = 0; - pool->size = STRPOOLSIZE; - pool->used = 0; - - env->string_pool = pool; - - return UWX_OK; -} - -void uwx_free_str_pool(struct uwx_env *env) -{ - struct uwx_str_pool *pool; - struct uwx_str_pool *next; - - /* The first pool is preallocated as part of the uwx_env. Don't free it! */ - pool = env->string_pool; - if (pool != 0) - pool = pool->next; - for (; pool != 0; pool = next) { - next = pool->next; - if (env->free_cb == 0) - free(pool); - else - (*env->free_cb)(pool); - } -} - -char *uwx_alloc_str(struct uwx_env *env, char *str) -{ - int len; - int size; - struct uwx_str_pool *pool; - struct uwx_str_pool *prev; - char *p; - - len = strlen(str) + 1; - prev = 0; - for (pool = env->string_pool; pool != 0; pool = pool->next) { - prev = pool; - if (pool->size - pool->used >= len) - break; - } - if (pool == 0) { - size = STRPOOLSIZE; - if (len > size) - size = len; - size += sizeof(struct uwx_str_pool) - STRPOOLSIZE; - if (env->allocate_cb == 0) - pool = (struct uwx_str_pool *) malloc(size); - else - pool = (struct uwx_str_pool *) (*env->allocate_cb)(size); - if (env->string_pool == 0) - return 0; - pool->next = 0; - pool->size = size; - pool->used = 0; - prev->next = pool; - } - p = pool->pool + pool->used; - strcpy(p, str); - pool->used += len; - return p; -} - -void uwx_reset_str_pool(struct uwx_env *env) -{ - struct uwx_str_pool *pool; - - for (pool = env->string_pool; pool != 0; pool = pool->next) - pool->used = 0; -} diff --git a/sys/contrib/ia64/libuwx/src/uwx_str.h b/sys/contrib/ia64/libuwx/src/uwx_str.h deleted file mode 100644 index 5e85d6a..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_str.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#define STRPOOLSIZE (400-sizeof(void *)-2*sizeof(int)) - -struct uwx_str_pool { - struct uwx_str_pool *next; - int size; - int used; - char pool[STRPOOLSIZE]; -}; - -extern int uwx_init_str_pool(struct uwx_env *env, struct uwx_str_pool *pool); -extern void uwx_free_str_pool(struct uwx_env *env); -extern char *uwx_alloc_str(struct uwx_env *env, char *str); -extern void uwx_reset_str_pool(struct uwx_env *env); diff --git a/sys/contrib/ia64/libuwx/src/uwx_swap.c b/sys/contrib/ia64/libuwx/src/uwx_swap.c deleted file mode 100644 index 5917393..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_swap.c +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include "uwx_env.h" -#include "uwx_swap.h" - -void uwx_swap4(uint32_t *w) -{ - unsigned char *p; - unsigned char t[4]; - - p = (unsigned char *) w; - - t[0] = p[0]; - t[1] = p[1]; - t[2] = p[2]; - t[3] = p[3]; - - p[0] = t[3]; - p[1] = t[2]; - p[2] = t[1]; - p[3] = t[0]; -} - -void uwx_swap8(uint64_t *dw) -{ - unsigned char *p; - unsigned char t[8]; - - p = (unsigned char *) dw; - - t[0] = p[0]; - t[1] = p[1]; - t[2] = p[2]; - t[3] = p[3]; - t[4] = p[4]; - t[5] = p[5]; - t[6] = p[6]; - t[7] = p[7]; - - p[0] = t[7]; - p[1] = t[6]; - p[2] = t[5]; - p[3] = t[4]; - p[4] = t[3]; - p[5] = t[2]; - p[6] = t[1]; - p[7] = t[0]; -} diff --git a/sys/contrib/ia64/libuwx/src/uwx_swap.h b/sys/contrib/ia64/libuwx/src/uwx_swap.h deleted file mode 100644 index 70d921c..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_swap.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -extern void uwx_swap4(uint32_t *w); -extern void uwx_swap8(uint64_t *dw); diff --git a/sys/contrib/ia64/libuwx/src/uwx_symbols.c b/sys/contrib/ia64/libuwx/src/uwx_symbols.c deleted file mode 100644 index b91c2db..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_symbols.c +++ /dev/null @@ -1,850 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifdef USE_CLEAN_NAMESPACE -#define fopen _fopen -#define fseek _fseek -#define fread _fread -#define fclose _fclose -#endif /* USE_CLEAN_NAMESPACE */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <inttypes.h> -#include <elf.h> - -#include "uwx.h" -#include "uwx_env.h" - -#ifdef USE_CLEAN_NAMESPACE -/* - * Moved the defines above the include of stdio.h, - * so we don't need these unless that causes problems - * and we have to move them back down here. - * #define fopen _fopen - * #define fseek _fseek - * #define fread _fread - * #define fclose _fclose - * extern FILE *_fopen(const char *, const char *); - * extern int _fseek(FILE *, long int, int); - * extern size_t _fread(void *, size_t, size_t, FILE *); - * extern int _fclose(FILE *); - */ -#endif /* USE_CLEAN_NAMESPACE */ - -struct uwx_symbol_cache { - char *module_name; - int nsyms; - uint64_t *sym_values; - char **sym_names; - char *strings; -}; - - -int uwx_read_func_symbols( - struct uwx_env *env, - struct uwx_symbol_cache *cache, - char *module_name); - - -int uwx_find_symbol( - struct uwx_env *env, - struct uwx_symbol_cache **symbol_cache_p, - char *module_name, - uint64_t relip, - char **func_name_p, - uint64_t *offset_p) -{ - int status; - int i; - uint64_t offset; - uint64_t best_offset; - char *best_name; - struct symbol *sym; - struct uwx_symbol_cache *cache = NULL; - - /* Allocate a symbol cache on first call */ - if (symbol_cache_p != NULL) - cache = *symbol_cache_p; - if (cache == NULL) { - cache = (struct uwx_symbol_cache *) - (*env->allocate_cb)(sizeof(struct uwx_symbol_cache)); - if (cache == NULL) - return UWX_ERR_NOMEM; - cache->module_name = NULL; - cache->nsyms = 0; - cache->sym_values = NULL; - cache->sym_names = NULL; - cache->strings = NULL; - if (symbol_cache_p != NULL) - *symbol_cache_p = cache; - } - - /* Read function symbols from the object file */ - status = uwx_read_func_symbols(env, cache, module_name); - if (status != UWX_OK) - return status; - - /* Search for best match */ - best_offset = ~(uint64_t)0; - best_name = NULL; - for (i = 0; i < cache->nsyms; i++) { - if (cache->sym_values[i] == relip) { - *func_name_p = cache->sym_names[i]; - *offset_p = 0; - if (symbol_cache_p == NULL) - uwx_release_symbol_cache(env, cache); - return UWX_OK; - } - if (relip > cache->sym_values[i]) { - offset = relip - cache->sym_values[i]; - if (offset < best_offset) { - best_offset = offset; - best_name = cache->sym_names[i]; - } - } - } - if (best_name == NULL) - return UWX_ERR_NOSYM; - - if (symbol_cache_p == NULL) - uwx_release_symbol_cache(env, cache); - - *func_name_p = best_name; - *offset_p = best_offset; - return UWX_OK; -} - - -void uwx_release_symbol_cache( - struct uwx_env *env, - struct uwx_symbol_cache *symbol_cache) -{ - if (symbol_cache->module_name != NULL) - (*env->free_cb)(symbol_cache->module_name); - if (symbol_cache->sym_values != NULL) - (*env->free_cb)(symbol_cache->sym_values); - if (symbol_cache->sym_names != NULL) - (*env->free_cb)(symbol_cache->sym_names); - if (symbol_cache->strings != NULL) - (*env->free_cb)(symbol_cache->strings); - (*env->free_cb)(symbol_cache); -} - - -#define ELF_ERR_NOMEM UWX_ERR_NOMEM /* Out of memory */ -#define ELF_ERR_OPEN UWX_ERR_NOSYM /* Can't open file */ - -#define ELF_ERR_NOHEADER UWX_ERR_NOSYM /* Can't read ELF header */ -#define ELF_ERR_NOTELF UWX_ERR_NOSYM /* Not an ELF file */ -#define ELF_ERR_HEADER_SIZE UWX_ERR_NOSYM /* Invalid e_ehsize */ -#define ELF_ERR_INVALID_CLASS UWX_ERR_NOSYM /* Invalid EI_CLASS */ -#define ELF_ERR_INVALID_DATA UWX_ERR_NOSYM /* Invalid EI_DATA */ - -#define ELF_ERR_READ_SECTHDR UWX_ERR_NOSYM /* Can't read section headers */ -#define ELF_ERR_SECTHDR_SIZE UWX_ERR_NOSYM /* Invalid e_shentsize */ - -#define ELF_ERR_READ_PROGHDR UWX_ERR_NOSYM /* Can't read program headers */ -#define ELF_ERR_PROGHDR_SIZE UWX_ERR_NOSYM /* Invalid e_phentsize */ - -#define ELF_ERR_READ_SECTION UWX_ERR_NOSYM /* Can't read section contents */ - -#define ELF_ERR_READ_SYMTAB UWX_ERR_NOSYM /* Can't read symbol table */ -#define ELF_ERR_SYMTAB_SIZE UWX_ERR_NOSYM /* Invalid sh_entsize for symtab */ - - -struct elf_file { - uint64_t phoff; - uint64_t shoff; - uint64_t text_base; - uint64_t text_end; - alloc_cb allocate_cb; - free_cb free_cb; - const char *filename; - FILE *fd; - struct elf_section *sections; - struct elf_symbol *symbols; - char *symbol_strings; - int native_data; - int source_class; - int source_data; - int ehsize; - int phentsize; - int phnum; - int shentsize; - int shnum; - int nsyms; -}; - -struct elf_section { - uint64_t flags; - uint64_t addr; - uint64_t offset; - uint64_t size; - uint64_t entsize; - char *contents; - struct elf_symbol *symbols; - int type; - int link; - int info; - int nelems; -}; - -struct elf_symbol { - uint64_t value; - char *namep; - int name; - int type; - int shndx; -}; - - -static void elf_swap_bytes(char *buf, char *template) -{ - int i; - int sz; - char temp[16]; - - while (sz = *template++) { - if (sz > 16) - exit(1); - for (i = 0; i < sz; i++) - temp[i] = buf[i]; - for (i = 0; i < sz; i++) - buf[i] = temp[sz-i-1]; - buf += sz; - } -} - - -static int elf_read_section(struct elf_file *ef, int shndx) -{ - struct elf_section *sect; - - if (shndx < 0 || shndx > ef->shnum) - return 0; - - sect = &ef->sections[shndx]; - - /* Return if section has already been read */ - if (sect->contents != NULL) - return 0; - - sect->contents = (*ef->allocate_cb)(sect->size); - if (sect->contents == NULL) - return ELF_ERR_NOMEM; - - fseek(ef->fd, (long)sect->offset, SEEK_SET); - if (fread(sect->contents, 1, sect->size, ef->fd) != sect->size) - return ELF_ERR_READ_SECTION; - - return 0; -} - - -static char template_elf32_sym[] = {4, 4, 4, 1, 1, 2, 0}; -static char template_elf64_sym[] = {4, 1, 1, 2, 8, 8, 0}; - -static int elf_read_symtab_section(struct elf_file *ef, int shndx) -{ - int i; - int nsyms; - long size; - union { - Elf32_Sym sym32; - Elf64_Sym sym64; - } sym; - struct elf_section *sect; - struct elf_symbol *syms; - struct elf_symbol *symp; - char *strtab; - - sect = &ef->sections[shndx]; - - /* Return if section has already been read */ - if (sect->symbols != NULL) - return 0; - - if (ef->source_class == ELFCLASS32) { - if (sect->entsize != sizeof(sym.sym32)) - return ELF_ERR_SYMTAB_SIZE; - } - else { - if (sect->entsize != sizeof(sym.sym64)) - return ELF_ERR_SYMTAB_SIZE; - } - - nsyms = sect->nelems; - syms = (struct elf_symbol *) - (*ef->allocate_cb)(sizeof(struct elf_symbol) * nsyms); - if (syms == NULL) - return ELF_ERR_NOMEM; - - /* Read the symbol table */ - fseek(ef->fd, (long)sect->offset, SEEK_SET); - for (i = 0; i < nsyms; i++) { - - symp = &syms[i]; - - /* Read the next symbol table entry */ - if (fread((char *)&sym, sect->entsize, 1, ef->fd) != 1) { - (*ef->free_cb)(syms); - return ELF_ERR_READ_SYMTAB; - } - - /* Get fields from appropriate structure */ - if (ef->source_class == ELFCLASS32) { - /* Swap bytes if necessary */ - if (ef->source_data != ef->native_data) - elf_swap_bytes((char *)&sym, template_elf32_sym); - symp->name = sym.sym32.st_name; - symp->type = sym.sym32.st_info & 0x0f; - symp->shndx = sym.sym32.st_shndx; - symp->value = sym.sym32.st_value; - } - else { - /* Swap bytes if necessary */ - if (ef->source_data != ef->native_data) - elf_swap_bytes((char *)&sym, template_elf64_sym); - symp->name = sym.sym64.st_name; - symp->type = sym.sym64.st_info & 0x0f; - symp->shndx = sym.sym64.st_shndx; - symp->value = sym.sym64.st_value; - } - symp->namep = NULL; - - } - - /* Read the symbol string table and convert section names */ - /* from string table offsets to pointers */ - if (sect->link > 0 && sect->link < ef->shnum) { - if (elf_read_section(ef, sect->link) == 0) { - strtab = ef->sections[sect->link].contents; - for (i = 0; i < nsyms; i++) { - symp = &syms[i]; - symp->namep = strtab + symp->name; - } - ef->symbol_strings = strtab; - ef->sections[sect->link].contents = NULL; - } - } - - sect->symbols = syms; - return 0; -} - - -static char template_elf32_phdr[] = {4, 4, 4, 4, 4, 4, 4, 4, 0}; -static char template_elf64_phdr[] = {4, 4, 8, 8, 8, 8, 8, 8, 0}; - -static int elf_read_prog_hdrs(struct elf_file *ef) -{ - int i; - union { - Elf32_Phdr hdr32; - Elf64_Phdr hdr64; - } header; - uint64_t vaddr; - uint64_t memsz; - uint64_t unwind_base; - int type; - - if (ef->phnum == 0) - return 0; - - if (ef->source_class == ELFCLASS32) { - if (ef->phentsize != sizeof(header.hdr32)) - return ELF_ERR_PROGHDR_SIZE; - } - else { - if (ef->phentsize != sizeof(header.hdr64)) - return ELF_ERR_PROGHDR_SIZE; - } - - /* Look for the PT_IA_64_UNWIND segment */ - /* (That will help us identify the text segment) */ - - fseek(ef->fd, (long)ef->phoff, SEEK_SET); - for (i = 0; i < ef->phnum; i++) { - - /* Read the next program header */ - if (fread((char *)&header, ef->phentsize, 1, ef->fd) != 1) - return ELF_ERR_READ_PROGHDR; - - /* Get fields from appropriate structure */ - if (ef->source_class == ELFCLASS32) { - /* Swap bytes in header fields if necessary */ - if (ef->source_data != ef->native_data) - elf_swap_bytes((char *)&header, template_elf32_phdr); - type = header.hdr32.p_type; - vaddr = header.hdr32.p_vaddr; - } - else { - /* Swap bytes in header fields if necessary */ - if (ef->source_data != ef->native_data) - elf_swap_bytes((char *)&header, template_elf64_phdr); - type = header.hdr64.p_type; - vaddr = header.hdr64.p_vaddr; - } - - if (type == PT_IA_64_UNWIND) { - unwind_base = vaddr; - break; - } - - } - - /* Now look for the PT_LOAD segment that includes the unwind segment */ - - fseek(ef->fd, (long)ef->phoff, SEEK_SET); - for (i = 0; i < ef->phnum; i++) { - - /* Read the next program header */ - if (fread((char *)&header, ef->phentsize, 1, ef->fd) != 1) - return ELF_ERR_READ_PROGHDR; - - /* Get fields from appropriate structure */ - if (ef->source_class == ELFCLASS32) { - /* Swap bytes in header fields if necessary */ - if (ef->source_data != ef->native_data) - elf_swap_bytes((char *)&header, template_elf32_phdr); - type = header.hdr32.p_type; - vaddr = header.hdr32.p_vaddr; - memsz = header.hdr32.p_memsz; - } - else { - /* Swap bytes in header fields if necessary */ - if (ef->source_data != ef->native_data) - elf_swap_bytes((char *)&header, template_elf64_phdr); - type = header.hdr64.p_type; - vaddr = header.hdr64.p_vaddr; - memsz = header.hdr64.p_memsz; - } - - if (type == PT_LOAD && - vaddr <= unwind_base && unwind_base < vaddr + memsz) { - ef->text_base = vaddr; - ef->text_end = vaddr + memsz; - break; - } - - } - - return 0; -} - - -static char template_elf32_shdr[] = {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0}; -static char template_elf64_shdr[] = {4, 4, 8, 8, 8, 8, 4, 4, 8, 8, 0}; - -static int elf_read_sect_hdrs(struct elf_file *ef) -{ - int i; - long size; - int err; - union { - Elf32_Shdr hdr32; - Elf64_Shdr hdr64; - } header; - struct elf_section *sect; - char *shstrtab; - - if (ef->source_class == ELFCLASS32) { - if (ef->shentsize != sizeof(header.hdr32)) - return ELF_ERR_SECTHDR_SIZE; - } - else { - if (ef->shentsize != sizeof(header.hdr64)) - return ELF_ERR_SECTHDR_SIZE; - } - - fseek(ef->fd, (long)ef->shoff, SEEK_SET); - ef->sections = (struct elf_section *) - (*ef->allocate_cb)(sizeof(struct elf_section) * ef->shnum); - if (ef->sections == NULL) - return ELF_ERR_NOMEM; - - /* Read the section header table */ - for (i = 0; i < ef->shnum; i++) { - - sect = &ef->sections[i]; - - /* Read the next section header */ - if (fread((char *)&header, ef->shentsize, 1, ef->fd) != 1) { - (*ef->free_cb)(ef->sections); - return ELF_ERR_READ_SECTHDR; - } - - /* Get fields from appropriate structure */ - if (ef->source_class == ELFCLASS32) { - /* Swap bytes in header fields if necessary */ - if (ef->source_data != ef->native_data) - elf_swap_bytes((char *)&header, template_elf32_shdr); - sect->type = header.hdr32.sh_type; - sect->flags = header.hdr32.sh_flags; - sect->addr = header.hdr32.sh_addr; - sect->offset = header.hdr32.sh_offset; - sect->size = header.hdr32.sh_size; - sect->link = header.hdr32.sh_link; - sect->info = header.hdr32.sh_info; - sect->entsize = header.hdr32.sh_entsize; - } - else { - /* Swap bytes in header fields if necessary */ - if (ef->source_data != ef->native_data) - elf_swap_bytes((char *)&header, template_elf64_shdr); - sect->type = header.hdr64.sh_type; - sect->flags = header.hdr64.sh_flags; - sect->addr = header.hdr64.sh_addr; - sect->offset = header.hdr64.sh_offset; - sect->size = header.hdr64.sh_size; - sect->link = header.hdr64.sh_link; - sect->info = header.hdr64.sh_info; - sect->entsize = header.hdr64.sh_entsize; - } - sect->contents = NULL; - sect->symbols = NULL; - if (sect->entsize > 0) - sect->nelems = sect->size / sect->entsize; - - } - - return 0; -} - - -static char template_elf32_ehdr[] = {2, 2, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 0}; -static char template_elf64_ehdr[] = {2, 2, 4, 8, 8, 8, 4, 2, 2, 2, 2, 2, 2, 0}; - -static int elf_read_header(struct elf_file *ef) -{ - union { - char ident[EI_NIDENT]; - Elf32_Ehdr hdr32; - Elf64_Ehdr hdr64; - } header; - - /* Read the ELF header */ - fseek(ef->fd, 0L, SEEK_SET); - if (fread((char *)header.ident, EI_NIDENT, 1, ef->fd) != 1) { - return ELF_ERR_NOHEADER; - } - - /* Verify that this is an ELF file */ - if (header.ident[EI_MAG0] != ELFMAG0 || - header.ident[EI_MAG1] != ELFMAG1 || - header.ident[EI_MAG2] != ELFMAG2 || - header.ident[EI_MAG3] != ELFMAG3) { - return ELF_ERR_NOTELF; - } - - /* Get header fields from the byte array e_ident */ - /* (These are independent of EI_CLASS and EI_DATA) */ - ef->source_class = header.ident[EI_CLASS]; - ef->source_data = header.ident[EI_DATA]; - - /* Verify EI_CLASS and EI_DATA */ - if (header.ident[EI_CLASS] != ELFCLASS32 && - header.ident[EI_CLASS] != ELFCLASS64) { - return ELF_ERR_INVALID_CLASS; - } - if (header.ident[EI_DATA] != ELFDATA2LSB && - header.ident[EI_DATA] != ELFDATA2MSB) { - return ELF_ERR_INVALID_DATA; - } - - /* Get remaining header fields from appropriate structure */ - if (ef->source_class == ELFCLASS32) { - if (fread((char *)&header.hdr32 + EI_NIDENT, - sizeof(header.hdr32) - EI_NIDENT, 1, ef->fd) != 1) - return ELF_ERR_NOHEADER; - /* Swap bytes in header fields if necessary */ - if (ef->source_data != ef->native_data) - elf_swap_bytes((char *)&header + EI_NIDENT, template_elf32_ehdr); - ef->phoff = header.hdr32.e_phoff; - ef->shoff = header.hdr32.e_shoff; - ef->ehsize = header.hdr32.e_ehsize; - ef->phentsize = header.hdr32.e_phentsize; - ef->phnum = header.hdr32.e_phnum; - ef->shentsize = header.hdr32.e_shentsize; - ef->shnum = header.hdr32.e_shnum; - if (ef->ehsize != sizeof(header.hdr32)) { - return ELF_ERR_HEADER_SIZE; - } - } - else { - if (fread((char *)&header.hdr64 + EI_NIDENT, - sizeof(header.hdr64) - EI_NIDENT, 1, ef->fd) != 1) - return ELF_ERR_NOHEADER; - /* Swap bytes in header fields if necessary */ - if (ef->source_data != ef->native_data) - elf_swap_bytes((char *)&header + EI_NIDENT, template_elf64_ehdr); - ef->phoff = header.hdr64.e_phoff; - ef->shoff = header.hdr64.e_shoff; - ef->ehsize = header.hdr64.e_ehsize; - ef->phentsize = header.hdr64.e_phentsize; - ef->phnum = header.hdr64.e_phnum; - ef->shentsize = header.hdr64.e_shentsize; - ef->shnum = header.hdr64.e_shnum; - if (ef->ehsize != sizeof(header.hdr64)) { - return ELF_ERR_HEADER_SIZE; - } - } - - return 0; -} - - -static struct elf_file *elf_new(struct uwx_env *env) -{ - int native_be; - char *p; - struct elf_file *ef; - - ef = (struct elf_file *)(*env->allocate_cb)(sizeof(struct elf_file)); - if (ef == NULL) - return NULL; - - /* Determine the native byte order */ - p = (char *)&native_be; - native_be = 1; /* Assume big-endian */ - *p = 0; /* Sets be == 0 only if little-endian */ - - ef->allocate_cb = env->allocate_cb; - ef->free_cb = env->free_cb; - ef->filename = NULL; - ef->native_data = (native_be ? ELFDATA2MSB : ELFDATA2LSB); - ef->fd = NULL; - ef->source_class = 0; - ef->source_data = 0; - ef->phoff = 0; - ef->shoff = 0; - ef->text_base = 0; - ef->text_end = 0; - ef->ehsize = 0; - ef->phentsize = 0; - ef->phnum = 0; - ef->shentsize = 0; - ef->shnum = 0; - ef->sections = NULL; - ef->symbols = NULL; - ef->symbol_strings = NULL; - ef->nsyms = 0; - return ef; -} - - -static int elf_open(struct elf_file *ef, const char *filename) -{ - int err; - - ef->filename = filename; - - ef->fd = fopen(filename, "r"); - if (ef->fd == NULL) - return ELF_ERR_OPEN; - - if ((err = elf_read_header(ef)) != 0) - return err; - - if ((err = elf_read_sect_hdrs(ef)) != 0) - return err; - - if ((err = elf_read_prog_hdrs(ef)) != 0) - return err; - - return 0; -} - - -static void elf_free_sections(struct elf_file *ef) -{ - int i; - struct elf_section *sect; - - for (i = 0; i < ef->shnum; i++) { - sect = &ef->sections[i]; - if (sect->contents != NULL) - (*ef->free_cb)(sect->contents); - if ((sect->type == SHT_SYMTAB || sect->type == SHT_DYNSYM) - && sect->symbols != NULL) - (*ef->free_cb)(sect->symbols); - } - (*ef->free_cb)(ef->sections); -} - - -static void elf_close(struct elf_file *ef) -{ - if (ef->fd != NULL) { - fclose(ef->fd); - ef->fd = NULL; - } -} - - -static void elf_free(struct elf_file *ef) -{ - elf_close(ef); - if (ef->sections != NULL) - elf_free_sections(ef); - (*ef->free_cb)(ef); -} - - -static int elf_read_symbols(struct elf_file *ef) -{ - int i; - int err; - struct elf_section *sect; - - for (i = 1; i < ef->shnum; i++) { - sect = &ef->sections[i]; - if (sect->type == SHT_SYMTAB) { - if (elf_read_symtab_section(ef, i) == 0) { - ef->symbols = sect->symbols; - ef->nsyms = sect->nelems; -#ifdef DEBUG_SYMBOLS - printf("Read %d symbols from SHT_SYMTAB section\n", ef->nsyms); -#endif /* DEBUG_SYMBOLS */ - return 0; - } - } - } - for (i = 1; i < ef->shnum; i++) { - sect = &ef->sections[i]; - if (sect->type == SHT_DYNSYM) { - if (elf_read_symtab_section(ef, i) == 0) { - ef->symbols = sect->symbols; - ef->nsyms = sect->nelems; -#ifdef DEBUG_SYMBOLS - printf("Read %d symbols from SHT_DYNSYM section\n", ef->nsyms); -#endif /* DEBUG_SYMBOLS */ - return 0; - } - } - } - return UWX_ERR_NOSYM; -} - - -#define SYM_IS_DEFINED(sym) \ - ((sym)->shndx != SHN_UNDEF) - -#define SYM_IS_IN_TEXT_SEGMENT(value) \ - ((value) >= ef->text_base && (value) < ef->text_end) - -#define SYM_HAS_INTERESTING_TYPE(type) ( \ - (type) == STT_FUNC || \ - (type) == STT_OBJECT || \ - (type) == STT_HP_STUB \ - ) - -#define SYM_IS_INTERESTING(sym) ( \ - SYM_IS_DEFINED(sym) && \ - SYM_IS_IN_TEXT_SEGMENT((sym)->value) && \ - SYM_HAS_INTERESTING_TYPE((sym)->type) \ - ) - -int uwx_read_func_symbols( - struct uwx_env *env, - struct uwx_symbol_cache *cache, - char *module_name) -{ - int i, j; - int status; - struct elf_file *ef; - struct elf_symbol *sym; - int nfuncsyms; - char **names; - uint64_t *values; - - if (module_name != NULL && - cache->module_name != NULL && - strcmp(module_name, cache->module_name) == 0) - return UWX_OK; - - if (cache->sym_names != NULL) - (*env->free_cb)(cache->sym_names); - if (cache->sym_values != NULL) - (*env->free_cb)(cache->sym_values); - if (cache->strings != NULL) - (*env->free_cb)(cache->strings); - - ef = elf_new(env); - if (ef == NULL) - return UWX_ERR_NOMEM; - status = elf_open(ef, module_name); - if (status != 0) - return UWX_ERR_NOSYM; - status = elf_read_symbols(ef); - if (status != 0) - return UWX_ERR_NOSYM; - - nfuncsyms = 0; - for (i = 0; i < ef->nsyms; i++) { - sym = &ef->symbols[i]; - if (SYM_IS_INTERESTING(sym)) - nfuncsyms++; - } - - names = (char **)(*env->allocate_cb)(nfuncsyms * sizeof(char *)); - if (names == NULL) - return UWX_ERR_NOMEM; - values = (uint64_t *)(*env->allocate_cb)(nfuncsyms * sizeof(uint64_t)); - if (values == NULL) - return UWX_ERR_NOMEM; - - j = 0; - for (i = 0; i < ef->nsyms; i++) { - sym = &ef->symbols[i]; - if (SYM_IS_INTERESTING(sym)) { - if (j >= nfuncsyms) /* should not happen! */ - break; - names[j] = sym->namep; - values[j] = sym->value - ef->text_base; - j++; - } - } - - cache->module_name = (char *)(*env->allocate_cb)(strlen(module_name)+1); - if (cache->module_name != NULL) { - strcpy(cache->module_name, module_name); - cache->nsyms = nfuncsyms; - cache->sym_names = names; - cache->sym_values = values; - cache->strings = ef->symbol_strings; - ef->symbol_strings = NULL; - } - - elf_close(ef); - elf_free(ef); - -#ifdef DEBUG_SYMBOLS - printf("Cached %d interesting symbols\n", nfuncsyms); -#endif /* DEBUG_SYMBOLS */ - - return UWX_OK; -} diff --git a/sys/contrib/ia64/libuwx/src/uwx_symbols.h b/sys/contrib/ia64/libuwx/src/uwx_symbols.h deleted file mode 100644 index 83b0bfe..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_symbols.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -struct uwx_env; -struct uwx_symbol_cache; - -extern int uwx_find_symbol( - struct uwx_env *env, - struct uwx_symbol_cache **symbol_cache_p, - char *module_name, - uint64_t relip, - char **func_name_p, - uint64_t *offset_p); - -extern void uwx_release_symbol_cache( - struct uwx_env *env, - struct uwx_symbol_cache *symbol_cache); diff --git a/sys/contrib/ia64/libuwx/src/uwx_trace.c b/sys/contrib/ia64/libuwx/src/uwx_trace.c deleted file mode 100644 index 0338dbe..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_trace.c +++ /dev/null @@ -1,166 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include "uwx_env.h" -#include "uwx_utable.h" -#include "uwx_uinfo.h" -#include "uwx_scoreboard.h" -#include "uwx_trace.h" - -#ifdef UWX_TRACE_ENABLE - -void uwx_trace_init(struct uwx_env *env) -{ - char *tstr; - - tstr = getenv("UWX_TRACE"); - if (tstr != NULL) { - while (*tstr != '\0') { - switch (*tstr) { - case 'i': env->trace |= UWX_TRACE_UINFO; break; - case 't': env->trace |= UWX_TRACE_UTABLE; break; - case 'b': env->trace |= UWX_TRACE_SB; break; - case 'r': env->trace |= UWX_TRACE_RSTATE; break; - case 's': env->trace |= UWX_TRACE_STEP; break; - case 'c': env->trace |= UWX_TRACE_CONTEXT; break; - case 'C': env->trace |= UWX_TRACE_COPYIN; break; - case 'L': env->trace |= UWX_TRACE_LOOKUPIP; break; - case '?': -#ifdef _KERNEL - fprintf(stderr, "UWX_TRACE flag `%c' unknown.\n", *tstr); -#else - fprintf(stderr, "UWX_TRACE flags:\n"); - fprintf(stderr, " i: unwind info\n"); - fprintf(stderr, " t: unwind table searching\n"); - fprintf(stderr, " b: scoreboard management\n"); - fprintf(stderr, " r: register state vector\n"); - fprintf(stderr, " s: step\n"); - fprintf(stderr, " c: context\n"); - fprintf(stderr, " C: copyin callback\n"); - fprintf(stderr, " L: lookup ip callback\n"); - exit(1); -#endif - } - tstr++; - } - } -} - -char *uwx_sb_rnames[] = { - "RP", "PSP", "PFS", - "PREDS", "UNAT", "PRIUNAT", "RNAT", "LC", "FPSR", - "GR4", "GR5", "GR6", "GR7", - "BR1", "BR2", "BR3", "BR4", "BR5", - "FR2", "FR3", "FR4", "FR5", - "FR16", "FR17", "FR18", "FR19", - "FR20", "FR21", "FR22", "FR23", - "FR24", "FR25", "FR26", "FR27", - "FR28", "FR29", "FR30", "FR31", -}; - -void uwx_dump_rstate(int regid, uint64_t rstate) -{ - int reg; - - if (rstate == UWX_DISP_NONE) - return; - fprintf(stderr, " %-7s", uwx_sb_rnames[regid]); - switch (UWX_GET_DISP_CODE(rstate)) { - case UWX_DISP_NONE: - fprintf(stderr, " unchanged\n"); - break; - case UWX_DISP_SPPLUS(0): - fprintf(stderr, " SP + %d\n", (int)rstate & ~0x07); - break; - case UWX_DISP_SPREL(0): - fprintf(stderr, " [SP + %d]\n", (int)rstate & ~0x07); - break; - case UWX_DISP_PSPREL(0): - fprintf(stderr, " [PSP + 16 - %d]\n", (int)rstate & ~0x07); - break; - case UWX_DISP_REG(0): - reg = UWX_GET_DISP_REGID(rstate); - if (reg == UWX_REG_AR_PFS) - fprintf(stderr, " AR.PFS\n"); - else if (reg == UWX_REG_AR_UNAT) - fprintf(stderr, " AR.UNAT\n"); - else if (reg >= UWX_REG_GR(0) && reg < UWX_REG_GR(128)) - fprintf(stderr, " GR%d\n", reg - UWX_REG_GR(0)); - else if (reg >= UWX_REG_FR(0) && reg < UWX_REG_FR(128)) - fprintf(stderr, " FR%d\n", reg - UWX_REG_FR(0)); - else if (reg >= UWX_REG_BR(0) && reg < UWX_REG_BR(8)) - fprintf(stderr, " BR%d\n", reg - UWX_REG_BR(0)); - else - fprintf(stderr, " <reg %d>\n", reg); - break; - default: - fprintf(stderr, " <%08lx>\n", (long)rstate); - break; - } -} - -void uwx_dump_scoreboard( - struct uwx_scoreboard *scoreboard, - int nsbreg, - struct uwx_rhdr *rhdr, - int cur_slot, - int ip_slot) -{ - int i; - - if (rhdr->is_prologue) - fprintf(stderr, " Prologue region (start = %d, length = %d)\n", - (int)cur_slot, (int)rhdr->rlen); - else - fprintf(stderr, " Body region (start = %d, length = %d, ecount = %d)\n", - cur_slot, (int)rhdr->rlen, rhdr->ecount); - if (ip_slot < rhdr->rlen) - fprintf(stderr, " IP is in this region (offset = %d)\n", ip_slot); - for (i = 0; i < nsbreg; i++) - uwx_dump_rstate(i, scoreboard->rstate[i]); -} - -void uwx_dump_uinfo_block( - struct uwx_utable_entry *uentry, - unsigned int ulen) -{ - int i; - uint32_t *uinfo = (uint32_t *)(intptr_t)uentry->unwind_info; - - ulen += DWORDSZ; /* Include unwind info header */ - if (uentry->unwind_flags & UNWIND_TBL_32BIT) /* and personality routine */ - ulen += WORDSZ; - else - ulen += DWORDSZ; - while (ulen >= WORDSZ) { - fprintf(stderr, " %08lx: ", (unsigned long)uinfo); - for (i = 0; i < 4 * WORDSZ && ulen >= WORDSZ; i += WORDSZ) { - fprintf(stderr, " %04x", *uinfo++); - ulen -= WORDSZ; - } - fprintf(stderr, "\n"); - } -} - -#endif /* UWX_TRACE_ENABLE */ diff --git a/sys/contrib/ia64/libuwx/src/uwx_trace.h b/sys/contrib/ia64/libuwx/src/uwx_trace.h deleted file mode 100644 index 9202a38..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_trace.h +++ /dev/null @@ -1,370 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#define UWX_TRACE_SB 1 /* UWX_TRACE=b: scoreboard mgmt */ -#define UWX_TRACE_UINFO 2 /* UWX_TRACE=i: unwind info */ -#define UWX_TRACE_RSTATE 4 /* UWX_TRACE=r: reg state vector */ -#define UWX_TRACE_STEP 8 /* UWX_TRACE=s: step */ -#define UWX_TRACE_UTABLE 16 /* UWX_TRACE=t: unwind tbl search */ -#define UWX_TRACE_CONTEXT 32 /* UWX_TRACE=c: context */ -#define UWX_TRACE_COPYIN 64 /* UWX_TRACE=C: copyin callback */ -#define UWX_TRACE_LOOKUPIP 128 /* UWX_TRACE=L: lookupip callback */ - -#ifdef UWX_TRACE_ENABLE - -#ifdef _KERNEL -#define fprintf(f, ...) printf(__VA_ARGS__) -#endif - -extern void uwx_trace_init(struct uwx_env *env); - -struct uwx_utable_entry; - -extern void uwx_dump_uinfo_block(struct uwx_utable_entry *, unsigned int); - -extern void uwx_dump_rstate(int regid, uint64_t rstate); - -struct uwx_rhdr; - -extern void uwx_dump_scoreboard( - struct uwx_scoreboard *scoreboard, - int nsbreg, - struct uwx_rhdr *rhdr, - int cur_slot, - int ip_slot); - -#define TRACE_INIT uwx_trace_init(env); - -#define TRACE_B_REUSE(id) \ - if (env->trace & UWX_TRACE_SB) \ - fprintf(stderr, "uwx_alloc_scoreboard: reuse id %d\n", (id)); - -#define TRACE_B_PREALLOC(id) \ - if (env->trace & UWX_TRACE_SB) \ - fprintf(stderr, "uwx_prealloc_scoreboard: prealloc id %d\n", (id)); - -#define TRACE_B_ALLOC(id) \ - if (env->trace & UWX_TRACE_SB) \ - fprintf(stderr, "uwx_alloc_scoreboard: alloc id %d\n", (id)); - -#define TRACE_B_POP(id) \ - if (env->trace & UWX_TRACE_SB) \ - fprintf(stderr, "uwx_pop_scoreboards: free id %d\n", (id)); - -#define TRACE_B_LABEL(label) \ - if (env->trace & UWX_TRACE_SB) \ - fprintf(stderr, "uwx_label_scoreboard: label %d\n", (label)); - -#define TRACE_B_LABEL_COPY(id) \ - if (env->trace & UWX_TRACE_SB) \ - fprintf(stderr, "uwx_label_scoreboard: copy id %d\n", (id)); - -#define TRACE_B_LABEL_REVERSE(back, new) \ - if (env->trace & UWX_TRACE_SB) \ - fprintf(stderr, "uwx_label_scoreboard: reverse link %d -> %d\n", \ - (new)->id, ((back) == 0) ? -1 : (back)->id); - -#define TRACE_B_COPY(label, id) \ - if (env->trace & UWX_TRACE_SB) \ - fprintf(stderr, "uwx_copy_scoreboard: label %d, cur sb id %d\n", (label), (id)); - -#define TRACE_B_COPY_FREE(id) \ - if (env->trace & UWX_TRACE_SB) \ - fprintf(stderr, "uwx_copy_scoreboard: free id %d\n", (id)); - -#define TRACE_B_COPY_FOUND(id) \ - if (env->trace & UWX_TRACE_SB) \ - fprintf(stderr, "uwx_copy_scoreboard: found id %d\n", (id)); - -#define TRACE_B_COPY_COPY(id) \ - if (env->trace & UWX_TRACE_SB) \ - fprintf(stderr, "uwx_copy_scoreboard: copy id %d\n", (id)); - -#define TRACE_B_COPY_REVERSE(back, new) \ - if (env->trace & UWX_TRACE_SB) \ - fprintf(stderr, "uwx_copy_scoreboard: reverse link %d -> %d\n", \ - (new)->id, ((back) == 0) ? -1 : (back)->id); - -#define TRACE_B_FREE(id) \ - if (env->trace & UWX_TRACE_SB) \ - fprintf(stderr, "uwx_free_scoreboards: free id %d\n", (id)); - -#define TRACE_I_DECODE_RHDR_1(name, b0) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_rhdr: %02x %s\n", \ - (b0), (name)); - -#define TRACE_I_DECODE_RHDR_1L(name, b0, val) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_rhdr: %02x %08x %s\n", \ - (b0), (int)(val), (name)); - -#define TRACE_I_DECODE_RHDR_2L(name, b0, b1, val) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_rhdr: %02x %02x %08x %s\n", \ - (b0), (b1), (int)(val), (name)); - -#define TRACE_I_DECODE_PROLOGUE_1(name, b0) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_prologue: %02x %s\n", \ - (b0), (name)); - -#define TRACE_I_DECODE_PROLOGUE_1L(name, b0, val) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_prologue: %02x %08x %s\n", \ - (b0), (int)(val), (name)); - -#define TRACE_I_DECODE_PROLOGUE_1LL(name, b0, val1, val2) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_prologue: %02x %08x %08x %s\n", \ - (b0), (int)(val1), (int)(val2), (name)); - -#define TRACE_I_DECODE_PROLOGUE_2(name, b0, b1) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_prologue: %02x %02x %s\n", \ - (b0), (b1), (name)); - -#define TRACE_I_DECODE_PROLOGUE_2L(name, b0, b1, val) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_prologue: %02x %02x %08x %s\n", \ - (b0), (b1), (int)(val), (name)); - -#define TRACE_I_DECODE_PROLOGUE_3(name, b0, b1, b2) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_prologue: %02x %02x %02x %s\n", \ - (b0), (b1), (b2), (name)); - -#define TRACE_I_DECODE_PROLOGUE_4(name, b0, b1, b2, b3) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_prologue: %02x %02x %02x %02x %s\n", \ - (b0), (b1), (b2), (b3), (name)); - -#define TRACE_I_DECODE_PROLOGUE_SPILL_BASE(spill_base) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_prologue: spill base = %08x\n", (int)(spill_base)); - -#define TRACE_I_DECODE_PROLOGUE_MASKS(gr_mem_mask, gr_gr_mask) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_prologue: gr_mem_mask = %02x; gr_gr_mask = %02x\n", \ - (gr_mem_mask), (gr_gr_mask)); - -#define TRACE_I_DECODE_PROLOGUE_NSPILL(ngr) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_prologue: ngr = %d\n", (ngr)); - -#define TRACE_I_DECODE_BODY_1(name, b0) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_body: %02x %s\n", \ - (b0), (name)); - -#define TRACE_I_DECODE_BODY_1L(name, b0, val) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_body: %02x %08x %s\n", \ - (b0), (int)(val), (name)); - -#define TRACE_I_DECODE_BODY_1LL(name, b0, val1, val2) \ - if (env->trace & UWX_TRACE_UINFO) \ - fprintf(stderr, "uwx_decode_body: %02x %08x %08x %s\n", \ - (b0), (int)(val1), (int)(val2), (name)); - -#define TRACE_R_UIB(uentry, ulen) \ - if (env->trace & UWX_TRACE_RSTATE) { \ - fprintf(stderr, "Unwind info block (info = %08x %08x, flags = %08x %08x, ulen = %d)\n", \ - (unsigned int)((uentry)->unwind_info >> 32), \ - (unsigned int)(uentry)->unwind_info, \ - (unsigned int)((uentry)->unwind_flags >> 32), \ - (unsigned int)(uentry)->unwind_flags, \ - (ulen)); \ - if (!env->remote) uwx_dump_uinfo_block(uentry, ulen); \ - } - -#define TRACE_R_DUMP_SB(scoreboard, rhdr, cur_slot, ip_slot) \ - if (env->trace & UWX_TRACE_RSTATE) \ - uwx_dump_scoreboard(scoreboard, env->nsbreg, \ - &(rhdr), cur_slot, ip_slot); - -#define TRACE_S_STEP(rstate) \ - if (env->trace & UWX_TRACE_STEP) { \ - fprintf(stderr, "uwx_restore_markers:\n"); \ - uwx_dump_rstate(SBREG_RP, (rstate)[SBREG_RP]); \ - uwx_dump_rstate(SBREG_PSP, (rstate)[SBREG_PSP]); \ - uwx_dump_rstate(SBREG_PFS, (rstate)[SBREG_PFS]); \ - } - -#define TRACE_S_RESTORE_REG(regname, rstate, val) \ - if (env->trace & UWX_TRACE_STEP) \ - fprintf(stderr, " restore %-7s (rstate = %08x %08x) = %08x %08x\n", \ - regname, \ - (unsigned int) ((rstate) >> 32), \ - (unsigned int) (rstate), \ - (unsigned int) ((val) >> 32), \ - (unsigned int) (val)); - -#define TRACE_S_RESTORE_GR(regid, rstate, val) \ - if (env->trace & UWX_TRACE_STEP) \ - fprintf(stderr, " restore GR%d (rstate = %08x %08x) = %08x %08x\n", \ - (regid) + 4, \ - (unsigned int) ((rstate) >> 32), \ - (unsigned int) (rstate), \ - (unsigned int) ((val) >> 32), \ - (unsigned int) (val)); - -#define TRACE_S_RESTORE_BR(regid, rstate, val) \ - if (env->trace & UWX_TRACE_STEP) \ - fprintf(stderr, " restore BR%d (rstate = %08x %08x) = %08x %08x\n", \ - (regid) + 1, \ - (unsigned int) ((rstate) >> 32), \ - (unsigned int) (rstate), \ - (unsigned int) ((val) >> 32), \ - (unsigned int) (val)); - -#define TRACE_S_RESTORE_FR(regid, rstate, fval) \ - if (env->trace & UWX_TRACE_STEP) \ - fprintf(stderr, " restore FR%d (rstate = %08x %08x) = %08x %08x %08x %08x\n", \ - (regid) + 1, \ - (unsigned int) ((rstate) >> 32), \ - (unsigned int) (rstate), \ - (unsigned int) ((fval[0]) >> 32), \ - (unsigned int) (fval[0]), \ - (unsigned int) ((fval[1]) >> 32), \ - (unsigned int) (fval[1])); - -#define TRACE_T_SEARCH32(ip) \ - if (env->trace & UWX_TRACE_UTABLE) \ - fprintf(stderr, "uwx_search_utable32 (relative ip = %08x)\n", (ip)); - -#define TRACE_T_BINSEARCH32(lb, ub, mid, code_start, code_end) \ - if (env->trace & UWX_TRACE_UTABLE) \ - fprintf(stderr, " lb/ub = %d/%d, mid = %d, start/end = %08x %08x\n", \ - lb, ub, mid, code_start, code_end); - -#define TRACE_C_GET_REG(regid, bsp) \ - if (env->trace & UWX_TRACE_CONTEXT) \ - fprintf(stderr, "uwx_get_reg (gr%d, bsp = %08x %08x)\n", \ - (regid) - UWX_REG_GR(0), \ - (unsigned int) ((bsp) >> 32), \ - (unsigned int) (bsp)); - -#define TRACE_C_ROTATE_GR(regid, sor, rrb_gr, newregid) \ - if (env->trace & UWX_TRACE_CONTEXT) \ - fprintf(stderr, "uwx_get_reg (gr%d, sor = %d, rrb = %d) --> gr%d\n", \ - (regid) + 32, \ - (sor), \ - (rrb_gr), \ - (newregid) + 32); - -#define TRACE_SELF_COPYIN4(rem, len, wp) \ - if (info->trace & UWX_TRACE_COPYIN) \ - fprintf(stderr, "copyin (rem = %08x %08x, len = %d, val = %08x)\n", \ - (unsigned int) ((rem) >> 32), \ - (unsigned int) (rem), \ - (len), *(wp)); - -#define TRACE_SELF_COPYIN8(rem, len, dp) \ - if (info->trace & UWX_TRACE_COPYIN) \ - fprintf(stderr, "copyin (rem = %08x %08x, len = %d, val = %08x %08x)\n", \ - (unsigned int) ((rem) >> 32), \ - (unsigned int) (rem), \ - (len), \ - ((unsigned int *)(dp))[0], \ - ((unsigned int *)(dp))[1]); - -#define TRACE_SELF_LOOKUP(ip) \ - if (info->trace & UWX_TRACE_LOOKUPIP) \ - fprintf(stderr, "Lookup IP callback: ip = %08x %08x\n", \ - (unsigned int) ((ip) >> 32), \ - (unsigned int) (ip)); - -#define TRACE_SELF_LOOKUP_DESC(text_base, linkage_ptr, unwind_base) \ - if (info->trace & UWX_TRACE_LOOKUPIP) { \ - fprintf(stderr, " text base: %08x %08x\n", \ - (unsigned int) ((text_base) >> 32), \ - (unsigned int) (text_base)); \ - fprintf(stderr, " linkage ptr: %08x %08x\n", \ - (unsigned int) ((linkage_ptr) >> 32), \ - (unsigned int) (linkage_ptr)); \ - fprintf(stderr, " unwind base: %08x %08x\n", \ - (unsigned int) ((uint64_t)(unwind_base) >> 32), \ - (unsigned int) (unwind_base)); \ - fprintf(stderr, " unwind flags: %08x %08x\n", \ - (unsigned int) ((unwind_base)[0] >> 32), \ - (unsigned int) (unwind_base)[0]); \ - fprintf(stderr, " unwind start: %08x %08x\n", \ - (unsigned int) (((text_base)+(unwind_base)[1]) >> 32), \ - (unsigned int) ((text_base)+(unwind_base)[1])); \ - fprintf(stderr, " unwind end: %08x %08x\n", \ - (unsigned int) (((text_base)+(unwind_base)[2]) >> 32), \ - (unsigned int) ((text_base)+(unwind_base)[2])); \ - } - -#else /* !UWX_TRACE_ENABLE */ - -#define TRACE_INIT -#define TRACE_B_REUSE(id) -#define TRACE_B_PREALLOC(id) -#define TRACE_B_ALLOC(id) -#define TRACE_B_POP(id) -#define TRACE_B_LABEL(label) -#define TRACE_B_LABEL_COPY(id) -#define TRACE_B_LABEL_REVERSE(back, new) -#define TRACE_B_COPY(label, id) -#define TRACE_B_COPY_FREE(id) -#define TRACE_B_COPY_FOUND(id) -#define TRACE_B_COPY_COPY(id) -#define TRACE_B_COPY_REVERSE(back, new) -#define TRACE_B_FREE(id) -#define TRACE_I_DECODE_RHDR_1(name, b0) -#define TRACE_I_DECODE_RHDR_1L(name, b0, val) -#define TRACE_I_DECODE_RHDR_2L(name, b0, b1, val) -#define TRACE_I_DECODE_PROLOGUE_1(name, b0) -#define TRACE_I_DECODE_PROLOGUE_1L(name, b0, val) -#define TRACE_I_DECODE_PROLOGUE_1LL(name, b0, val1, val2) -#define TRACE_I_DECODE_PROLOGUE_2(name, b0, b1) -#define TRACE_I_DECODE_PROLOGUE_2L(name, b0, b1, parm1) -#define TRACE_I_DECODE_PROLOGUE_3(name, b0, b1, b2) -#define TRACE_I_DECODE_PROLOGUE_4(name, b0, b1, b2, b3) -#define TRACE_I_DECODE_PROLOGUE_SPILL_BASE(spill_base) -#define TRACE_I_DECODE_PROLOGUE_MASKS(gr_mem_mask, gr_gr_mask) -#define TRACE_I_DECODE_PROLOGUE_NSPILL(ngr) -#define TRACE_I_DECODE_BODY_1(name, b0) -#define TRACE_I_DECODE_BODY_1L(name, b0, parm1) -#define TRACE_I_DECODE_BODY_1LL(name, b0, parm1, parm2) -#define TRACE_R_UIB(uentry, ulen) -#define TRACE_R_DUMP_SB(scoreboard, rhdr, cur_slot, ip_slot) -#define TRACE_S_STEP(rstate) -#define TRACE_S_RESTORE_REG(regname, rstate, val) -#define TRACE_S_RESTORE_GR(regid, rstate, val) -#define TRACE_S_RESTORE_BR(regid, rstate, val) -#define TRACE_S_RESTORE_FR(regid, rstate, val) -#define TRACE_T_SEARCH32(ip) -#define TRACE_T_BINSEARCH32(lb, ub, mid, code_start, code_end) -#define TRACE_C_GET_REG(regid, bsp) -#define TRACE_C_ROTATE_GR(regid, sor, rrb_gr, newregid) -#define TRACE_SELF_COPYIN4(rem, len, wp) -#define TRACE_SELF_COPYIN8(rem, len, dp) -#define TRACE_SELF_LOOKUP(ip) -#define TRACE_SELF_LOOKUP_DESC(text_base, linkage_ptr, unwind_base) - -#endif /* UWX_TRACE_ENABLE */ - diff --git a/sys/contrib/ia64/libuwx/src/uwx_uinfo.c b/sys/contrib/ia64/libuwx/src/uwx_uinfo.c deleted file mode 100644 index 5f63b7e..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_uinfo.c +++ /dev/null @@ -1,1119 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include "uwx_env.h" -#include "uwx_uinfo.h" -#include "uwx_utable.h" -#include "uwx_scoreboard.h" -#include "uwx_bstream.h" -#include "uwx_trace.h" -#include "uwx_swap.h" - -int uwx_count_ones(unsigned int mask); - -/* - * uwx_uinfo.c - * - * This file contains the routines for reading and decoding - * the unwind information block. - * - * The main entry point, uwx_decode_uinfo(), is given a pointer - * to an unwind table entry and a pointer (passed by reference) - * to be filled in with a pointer to an update vector. It will - * read and decode the unwind descriptors contained in the - * unwind information block, then build the register state array, - * which describes the actions necessary to step from the current - * frame to the previous one. - */ - -#define COPYIN_UINFO_4(dest, src) \ - (env->remote? \ - (*env->copyin)(UWX_COPYIN_UINFO, (dest), (src), \ - WORDSZ, env->cb_token) : \ - (*(uint32_t *)(intptr_t)(dest) = *(uint32_t *)(intptr_t)(src), WORDSZ) ) - -#define COPYIN_UINFO_8(dest, src) \ - (env->remote? \ - (*env->copyin)(UWX_COPYIN_UINFO, (dest), (src), \ - DWORDSZ, env->cb_token) : \ - (*(uint64_t *)(intptr_t)(dest) = *(uint64_t *)(intptr_t)(src), DWORDSZ) ) - - -/* uwx_default_rstate: Returns the default register state for a leaf routine */ - -int uwx_default_rstate(struct uwx_env *env, uint64_t **rstatep) -{ - struct uwx_scoreboard *sb; - - sb = uwx_init_scoreboards(env); - *rstatep = sb->rstate; - return UWX_OK; -} - - -/* uwx_decode_uinfo: Decodes unwind info region */ - -int uwx_decode_uinfo( - struct uwx_env *env, - struct uwx_utable_entry *uentry, - uint64_t **rstatep) -{ - uint64_t uinfohdr; - unsigned int ulen; - int len; - struct uwx_bstream bstream; - struct uwx_scoreboard *scoreboard; - int ip_slot; - int cur_slot; - int status; - struct uwx_rhdr rhdr; - - /* Remember the offset from the start of the function */ - /* to the current IP. This helps the client find */ - /* the symbolic information. */ - - env->function_offset = env->remapped_ip - uentry->code_start; - - /* Read the unwind info header using the copyin callback. */ - /* (If we're reading a 32-bit unwind table, we need to */ - /* read the header as two 32-bit pieces to preserve the */ - /* guarantee that we always call copyin for aligned */ - /* 4-byte or 8-byte chunks.) */ - /* Then compute the length of the unwind descriptor */ - /* region and initialize a byte stream to read it. */ - - if (uentry->unwind_flags & UNWIND_TBL_32BIT) { - len = COPYIN_UINFO_4((char *)&uinfohdr, uentry->unwind_info); - len += COPYIN_UINFO_4((char *)&uinfohdr + WORDSZ, - uentry->unwind_info + WORDSZ); - } - else - len = COPYIN_UINFO_8((char *)&uinfohdr, uentry->unwind_info); - if (len != DWORDSZ) - return UWX_ERR_COPYIN_UINFO; - if (env->byte_swap) - uwx_swap8(&uinfohdr); - if (uentry->unwind_flags & UNWIND_TBL_32BIT) - ulen = UNW_LENGTH(uinfohdr) * WORDSZ; - else - ulen = UNW_LENGTH(uinfohdr) * DWORDSZ; - uwx_init_bstream(&bstream, env, - uentry->unwind_info + DWORDSZ, ulen, UWX_COPYIN_UINFO); - - /* Save the header and a pointer to the personality routine ptr */ - /* for later use in exception handling. */ - - env->uinfo_hdr = uinfohdr; - env->uinfo_end = uentry->unwind_info + DWORDSZ + ulen; - - TRACE_R_UIB(uentry, ulen) - - /* Create an initial scoreboard for tracking the unwind state. */ - - scoreboard = uwx_init_scoreboards(env); - - /* Prepare to read and decode the unwind regions described */ - /* by the unwind info block. Find the target "ip" slot */ - /* relative to the beginning of the region. The lower 4 bits */ - /* of the actual IP encode the slot number within a bundle. */ - - cur_slot = 0; - ip_slot = (int) ((env->context.special[UWX_REG_IP] & ~0x0fLL) - - uentry->code_start) - / BUNDLESZ * SLOTSPERBUNDLE - + (unsigned int) (env->context.special[UWX_REG_IP] & 0x0f); - - /* Loop over the regions in the unwind info block. */ - - for (;;) { - - /* Decode the next region header. */ - /* We have an error if we reach the end of the info block, */ - /* since we should have found our target ip slot by then. */ - /* We also have an error if the next byte isn't a region */ - /* header record. */ - - status = uwx_decode_rhdr(env, &bstream, &rhdr); - if (status != UWX_OK) - return status; - - /* If a prologue region, get a new scoreboard, pushing */ - /* the previous one onto the prologue stack. Then read */ - /* and decode the prologue region records. */ - - if (rhdr.is_prologue) { - scoreboard = uwx_new_scoreboard(env, scoreboard); - if (scoreboard == 0) - return UWX_ERR_NOMEM; - status = uwx_decode_prologue(env, &bstream, - scoreboard, &rhdr, ip_slot); - } - - /* If a body region, read and decode the body region */ - /* records. If the body has an epilogue count, */ - /* uwx_decode_body will note that in the region header */ - /* record for use at the bottom of the loop. */ - - else { - status = uwx_decode_body(env, &bstream, scoreboard, &rhdr, ip_slot); - } - - if (status != UWX_OK) - return status; - - TRACE_R_DUMP_SB(scoreboard, rhdr, cur_slot, ip_slot) - - /* If the target ip slot is within this region, we're done. */ - /* Return the scoreboard's register state array. */ - - if (ip_slot < rhdr.rlen) { - *rstatep = scoreboard->rstate; - return UWX_OK; - } - - /* Otherwise, update the current ip slot, pop the */ - /* scoreboard stack based on the epilogue count, */ - /* and loop back around for the next region. */ - - cur_slot += rhdr.rlen; - ip_slot -= rhdr.rlen; - if (rhdr.ecount > 0) { - scoreboard = uwx_pop_scoreboards(env, scoreboard, rhdr.ecount); - if (scoreboard == 0) - return UWX_ERR_PROLOG_UF; - } - } - /*NOTREACHED*/ -} - - -/* uwx_decode_rhdr: Decodes a region header record */ - -int uwx_decode_rhdr( - struct uwx_env *env, - struct uwx_bstream *bstream, - struct uwx_rhdr *rhdr) -{ - int b0; - int b1; - uint64_t val; - int status; - - /* Get the first byte of the next descriptor record. */ - b0 = uwx_get_byte(bstream); - if (b0 < 0) - return UWX_ERR_NOUDESC; - - /* Initialize region header record. */ - - rhdr->is_prologue = 0; - rhdr->rlen = 0; - rhdr->mask = 0; - rhdr->grsave = 0; - rhdr->ecount = 0; - - /* Format R1 */ - - if (b0 < 0x40) { - if ((b0 & 0x20) == 0) { - TRACE_I_DECODE_RHDR_1("(R1) prologue", b0) - rhdr->is_prologue = 1; - } - else { - TRACE_I_DECODE_RHDR_1("(R1) body", b0) - } - rhdr->rlen = b0 & 0x1f; - } - - /* Format R2 */ - - else if (b0 < 0x60) { - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - status = uwx_get_uleb128(bstream, &val); - if (status != 0) - return UWX_ERR_BADUDESC; - TRACE_I_DECODE_RHDR_2L("(R2) prologue_gr", b0, b1, val) - rhdr->is_prologue = 1; - rhdr->rlen = (unsigned int) val; - rhdr->mask = ((b0 & 0x07) << 1) | (b1 >> 7); - rhdr->grsave = b1 & 0x7f; - } - - /* Format R3 */ - - else if (b0 < 0x80) { - status = uwx_get_uleb128(bstream, &val); - if (status != 0) - return UWX_ERR_BADUDESC; - if ((b0 & 0x03) == 0) { - TRACE_I_DECODE_RHDR_1L("(R3) prologue", b0, val) - rhdr->is_prologue = 1; - } - else { - TRACE_I_DECODE_RHDR_1L("(R3) body", b0, val) - } - rhdr->rlen = (unsigned int) val; - } - - /* Otherwise, not a region header record. */ - - else { - TRACE_I_DECODE_RHDR_1("(?)", b0) - return UWX_ERR_BADUDESC; - } - - return UWX_OK; -} - - -/* uwx_decode_prologue: Decodes a prologue region */ - -int uwx_decode_prologue( - struct uwx_env *env, - struct uwx_bstream *bstream, - struct uwx_scoreboard *scoreboard, - struct uwx_rhdr *rhdr, - int ip_slot) -{ - int status; - int reg; - int mask; - int b0; - int b1; - int b2; - int b3; - int r; - int t; - int i; - uint64_t parm1; - uint64_t parm2; - uint64_t newrstate[NSBREG]; - int tspill[NSBREG]; - int priunat_mem_rstate; - int t_priunat_mem; - unsigned int gr_mem_mask; - unsigned int br_mem_mask; - unsigned int fr_mem_mask; - unsigned int gr_gr_mask; - unsigned int br_gr_mask; - int ngr; - int nbr; - int nfr; - unsigned int spill_base; - unsigned int gr_base; - unsigned int br_base; - unsigned int fr_base; - - /* Initialize an array of register states from the current */ - /* scoreboard, along with a parallel array of spill times. */ - /* We use this as a temporary scoreboard, then update the */ - /* real scoreboard at the end of the procedure. */ - /* We initialize the spill time to (rhdr.rlen - 1) so that */ - /* spills without a "when" descriptor will take effect */ - /* at the end of the prologue region. */ - /* (Boundary condition: all actions in a zero-length prologue */ - /* will appear to have happened in the instruction slot */ - /* immediately preceding the prologue.) */ - - for (i = 0; i < env->nsbreg; i++) { - newrstate[i] = scoreboard->rstate[i]; - tspill[i] = rhdr->rlen - 1; - } - priunat_mem_rstate = UWX_DISP_NONE; - t_priunat_mem = rhdr->rlen - 1; - - fr_mem_mask = 0; - gr_mem_mask = 0; - br_mem_mask = 0; - gr_gr_mask = 0; - br_gr_mask = 0; - nfr = 127; - ngr = 127; - nbr = 127; - spill_base = 0; - - /* If prologue_gr header record supplied mask and grsave, */ - /* record these in the scoreboard. */ - - reg = rhdr->grsave; - mask = rhdr->mask; - if (mask & 0x8) { - newrstate[SBREG_RP] = UWX_DISP_REG(UWX_REG_GR(reg)); - reg++; - } - if (mask & 0x4) { - newrstate[SBREG_PFS] = UWX_DISP_REG(UWX_REG_GR(reg)); - reg++; - } - if (mask & 0x2) { - newrstate[SBREG_PSP] = UWX_DISP_REG(UWX_REG_GR(reg)); - reg++; - } - if (mask & 0x1) { - newrstate[SBREG_PREDS] = UWX_DISP_REG(UWX_REG_GR(reg)); - reg++; - } - - /* Read prologue descriptor records until */ - /* we hit another region header. */ - - for (;;) { - - b0 = uwx_get_byte(bstream); - - if (b0 < 0x80) { - /* Return the last byte read to the byte stream, since it's */ - /* really the first byte of the next region header record. */ - if (b0 >= 0) - (void) uwx_unget_byte(bstream, b0); - break; - } - - switch ((b0 & 0x70) >> 4) { - - case 0: /* 1000 xxxx */ - case 1: /* 1001 xxxx */ - /* Format P1 (br_mem) */ - TRACE_I_DECODE_PROLOGUE_1("(P1) br_mem", b0) - br_mem_mask = b0 & 0x1f; - break; - - case 2: /* 1010 xxxx */ - /* Format P2 (br_gr) */ - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - TRACE_I_DECODE_PROLOGUE_2("(P2) br_gr", b0, b1) - mask = ((b0 & 0x0f) << 1) | (b1 >> 7); - reg = b1 & 0x7f; - br_gr_mask = mask; - for (i = 0; i < NSB_BR && mask != 0; i++) { - if (mask & 0x01) { - newrstate[SBREG_BR + i] = UWX_DISP_REG(UWX_REG_GR(reg)); - reg++; - } - mask = mask >> 1; - } - break; - - case 3: /* 1011 xxxx */ - /* Format P3 */ - if (b0 < 0xb8) { - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - r = ((b0 & 0x7) << 1) | (b1 >> 7); - reg = b1 & 0x7f; - switch (r) { - case 0: /* psp_gr */ - TRACE_I_DECODE_PROLOGUE_2("(P3) psp_gr", b0, b1) - newrstate[SBREG_PSP] = UWX_DISP_REG(UWX_REG_GR(reg)); - break; - case 1: /* rp_gr */ - TRACE_I_DECODE_PROLOGUE_2("(P3) rp_gr", b0, b1) - newrstate[SBREG_RP] = UWX_DISP_REG(UWX_REG_GR(reg)); - break; - case 2: /* pfs_gr */ - TRACE_I_DECODE_PROLOGUE_2("(P3) pfs_gr", b0, b1) - newrstate[SBREG_PFS] = UWX_DISP_REG(UWX_REG_GR(reg)); - break; - case 3: /* preds_gr */ - TRACE_I_DECODE_PROLOGUE_2("(P3) preds_gr", b0, b1) - newrstate[SBREG_PREDS] = - UWX_DISP_REG(UWX_REG_GR(reg)); - break; - case 4: /* unat_gr */ - TRACE_I_DECODE_PROLOGUE_2("(P3) unat_gr", b0, b1) - newrstate[SBREG_UNAT] = - UWX_DISP_REG(UWX_REG_GR(reg)); - break; - case 5: /* lc_gr */ - TRACE_I_DECODE_PROLOGUE_2("(P3) lc_gr", b0, b1) - newrstate[SBREG_LC] = - UWX_DISP_REG(UWX_REG_GR(reg)); - break; - case 6: /* rp_br */ - TRACE_I_DECODE_PROLOGUE_2("(P3) rp_br", b0, b1) - scoreboard->rstate[SBREG_RP] = - UWX_DISP_REG(UWX_REG_BR(reg)); - if (newrstate[SBREG_RP] == - UWX_DISP_REG(UWX_REG_BR(0))) - newrstate[SBREG_RP] = - UWX_DISP_REG(UWX_REG_BR(reg)); - break; - case 7: /* rnat_gr */ - TRACE_I_DECODE_PROLOGUE_2("(P3) rnat_gr", b0, b1) - newrstate[SBREG_RNAT] = - UWX_DISP_REG(UWX_REG_GR(reg)); - break; - case 8: /* bsp_gr */ - TRACE_I_DECODE_PROLOGUE_2("(P3) bsp_gr", b0, b1) - /* Don't track BSP yet */ - return UWX_ERR_CANTUNWIND; - /* break; */ - case 9: /* bspstore_gr */ - TRACE_I_DECODE_PROLOGUE_2("(P3) bspstore_gr", b0, b1) - /* Don't track BSPSTORE yet */ - return UWX_ERR_CANTUNWIND; - /* break; */ - case 10: /* fpsr_gr */ - TRACE_I_DECODE_PROLOGUE_2("(P3) fpsr_gr", b0, b1) - newrstate[SBREG_FPSR] = - UWX_DISP_REG(UWX_REG_GR(reg)); - break; - case 11: /* priunat_gr */ - TRACE_I_DECODE_PROLOGUE_2("(P3) priunat_gr", b0, b1) - newrstate[SBREG_PRIUNAT] = - UWX_DISP_REG(UWX_REG_GR(reg)); - break; - default: - TRACE_I_DECODE_PROLOGUE_2("(P3) ??", b0, b1) - return UWX_ERR_BADUDESC; - } - } - - /* Format P4 (spill_mask) */ - else if (b0 == 0xb8) { - TRACE_I_DECODE_PROLOGUE_1("(P4) spill_mask", b0) - /* The spill_mask descriptor is followed by */ - /* an imask field whose length is determined */ - /* by the region length: there are two mask */ - /* bits per instruction slot in the region. */ - /* We decode these bits two at a time, counting */ - /* the number of FRs, GRs, and BRs that are */ - /* saved up to the slot of interest. Other */ - /* descriptors describe which sets of these */ - /* registers are spilled, and we put those */ - /* two pieces of information together at the */ - /* end of the main loop. */ - t = 0; - nfr = 0; - ngr = 0; - nbr = 0; - while (t < rhdr->rlen) { - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - for (i = 0; i < 4 && (t + i) < ip_slot; i++) { - switch (b1 & 0xc0) { - case 0x00: break; - case 0x40: nfr++; break; - case 0x80: ngr++; break; - case 0xc0: nbr++; break; - } - b1 = b1 << 2; - } - t += 4; - } - } - - /* Format P5 (frgr_mem) */ - else if (b0 == 0xb9) { - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - b2 = uwx_get_byte(bstream); - if (b2 < 0) - return UWX_ERR_BADUDESC; - b3 = uwx_get_byte(bstream); - if (b3 < 0) - return UWX_ERR_BADUDESC; - TRACE_I_DECODE_PROLOGUE_4("(P5) frgr_mem", b0, b1, b2, b3) - gr_mem_mask = b1 >> 4; - fr_mem_mask = ((b1 & 0x0f) << 16) | (b2 << 8) | b3; - } - - /* Invalid descriptor record */ - else { - TRACE_I_DECODE_PROLOGUE_1("(?)", b0) - return UWX_ERR_BADUDESC; - } - - break; - - case 4: /* 1100 xxxx */ - /* Format P6 (fr_mem) */ - TRACE_I_DECODE_PROLOGUE_1("(P6) fr_mem", b0) - fr_mem_mask = b0 & 0x0f; - break; - - case 5: /* 1101 xxxx */ - /* Format P6 (gr_mem) */ - TRACE_I_DECODE_PROLOGUE_1("(P6) gr_mem", b0) - gr_mem_mask = b0 & 0x0f; - break; - - case 6: /* 1110 xxxx */ - /* Format P7 */ - r = b0 & 0xf; - status = uwx_get_uleb128(bstream, &parm1); - if (status != 0) - return UWX_ERR_BADUDESC; - switch (r) { - case 0: /* mem_stack_f */ - status = uwx_get_uleb128(bstream, &parm2); - if (status != 0) - return UWX_ERR_BADUDESC; - TRACE_I_DECODE_PROLOGUE_1LL("(P7) mem_stack_f", b0, parm1, parm2) - newrstate[SBREG_PSP] = UWX_DISP_SPPLUS(parm2 * 16); - tspill[SBREG_PSP] = (int) parm1; - break; - case 1: /* mem_stack_v */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) mem_stack_v", b0, parm1) - tspill[SBREG_PSP] = (int) parm1; - break; - case 2: /* spill_base */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) spill_base", b0, parm1) - spill_base = 4 * (unsigned int) parm1; - break; - case 3: /* psp_sprel */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) psp_sprel", b0, parm1) - newrstate[SBREG_PSP] = UWX_DISP_SPREL(parm1 * 4); - break; - case 4: /* rp_when */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) rp_when", b0, parm1) - tspill[SBREG_RP] = (int) parm1; - break; - case 5: /* rp_psprel */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) rp_psprel", b0, parm1) - newrstate[SBREG_RP] = UWX_DISP_PSPREL(parm1 * 4); - break; - case 6: /* pfs_when */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) pfs_when", b0, parm1) - tspill[SBREG_PFS] = (int) parm1; - break; - case 7: /* pfs_psprel */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) pfs_psprel", b0, parm1) - newrstate[SBREG_PFS] = UWX_DISP_PSPREL(parm1 * 4); - break; - case 8: /* preds_when */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) preds_when", b0, parm1) - tspill[SBREG_PREDS] = (int) parm1; - break; - case 9: /* preds_psprel */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) preds_psprel", b0, parm1) - newrstate[SBREG_PREDS] = UWX_DISP_PSPREL(parm1 * 4); - break; - case 10: /* lc_when */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) lc_when", b0, parm1) - tspill[SBREG_LC] = (int) parm1; - break; - case 11: /* lc_psprel */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) lc_psprel", b0, parm1) - newrstate[SBREG_LC] = UWX_DISP_PSPREL(parm1 * 4); - break; - case 12: /* unat_when */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) unat_when", b0, parm1) - tspill[SBREG_UNAT] = (int) parm1; - break; - case 13: /* unat_psprel */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) unat_psprel", b0, parm1) - newrstate[SBREG_UNAT] = UWX_DISP_PSPREL(parm1 * 4); - break; - case 14: /* fpsr_when */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) fpsr_when", b0, parm1) - tspill[SBREG_FPSR] = (int) parm1; - break; - case 15: /* fpsr_psprel */ - TRACE_I_DECODE_PROLOGUE_1L("(P7) fpsr_psprel", b0, parm1) - newrstate[SBREG_FPSR] = UWX_DISP_PSPREL(parm1 * 4); - break; - } - break; - - case 7: /* 1111 xxxx */ - /* Format P8 */ - if (b0 == 0xf0) { - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - status = uwx_get_uleb128(bstream, &parm1); - if (status != 0) - return UWX_ERR_BADUDESC; - switch (b1) { - case 1: /* rp_sprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) rp_sprel", b0, b1, parm1) - newrstate[SBREG_RP] = UWX_DISP_SPREL(parm1 * 4); - break; - case 2: /* pfs_sprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) pfs_sprel", b0, b1, parm1) - newrstate[SBREG_PFS] = UWX_DISP_SPREL(parm1 * 4); - break; - case 3: /* preds_sprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) preds_sprel", b0, b1, parm1) - newrstate[SBREG_PREDS] = UWX_DISP_SPREL(parm1 * 4); - break; - case 4: /* lc_sprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) lc_sprel", b0, b1, parm1) - newrstate[SBREG_LC] = UWX_DISP_SPREL(parm1 * 4); - break; - case 5: /* unat_sprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) unat_sprel", b0, b1, parm1) - newrstate[SBREG_UNAT] = UWX_DISP_SPREL(parm1 * 4); - break; - case 6: /* fpsr_sprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) fpsr_sprel", b0, b1, parm1) - newrstate[SBREG_FPSR] = UWX_DISP_SPREL(parm1 * 4); - break; - case 7: /* bsp_when */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) bsp_when", b0, b1, parm1) - /* Don't track BSP yet */ - return UWX_ERR_CANTUNWIND; - /* break; */ - case 8: /* bsp_psprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) bsp_psprel", b0, b1, parm1) - /* Don't track BSP yet */ - return UWX_ERR_CANTUNWIND; - /* break; */ - case 9: /* bsp_sprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) bsp_sprel", b0, b1, parm1) - /* Don't track BSP yet */ - return UWX_ERR_CANTUNWIND; - /* break; */ - case 10: /* bspstore_when */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) bspstore_when", b0, b1, parm1) - /* Don't track BSP yet */ - return UWX_ERR_CANTUNWIND; - /* break; */ - case 11: /* bspstore_psprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) bspstore_psprel", b0, b1, parm1) - /* Don't track BSP yet */ - return UWX_ERR_CANTUNWIND; - /* break; */ - case 12: /* bspstore_sprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) bspstore_sprel", b0, b1, parm1) - /* Don't track BSP yet */ - return UWX_ERR_CANTUNWIND; - /* break; */ - case 13: /* rnat_when */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) rnat_when", b0, b1, parm1) - tspill[SBREG_RNAT] = (int) parm1; - break; - case 14: /* rnat_psprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) rnat_psprel", b0, b1, parm1) - newrstate[SBREG_RNAT] = UWX_DISP_PSPREL(parm1 * 4); - break; - case 15: /* rnat_sprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) rnat_sprel", b0, b1, parm1) - newrstate[SBREG_RNAT] = UWX_DISP_SPREL(parm1 * 4); - break; - case 16: /* priunat_when_gr */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) priunat_when_gr", b0, b1, parm1) - tspill[SBREG_PRIUNAT] = (int) parm1; - break; - case 17: /* priunat_psprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) priunat_psprel", b0, b1, parm1) - priunat_mem_rstate = UWX_DISP_PSPREL(parm1 * 4); - break; - case 18: /* priunat_sprel */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) priunat_sprel", b0, b1, parm1) - priunat_mem_rstate = UWX_DISP_SPREL(parm1 * 4); - break; - case 19: /* priunat_when_mem */ - TRACE_I_DECODE_PROLOGUE_2L("(P8) priunat_when_mem", b0, b1, parm1) - t_priunat_mem = (int) parm1; - break; - default: - TRACE_I_DECODE_PROLOGUE_2L("(P8) ??", b0, b1, parm1) - return UWX_ERR_BADUDESC; - } - } - - /* Format P9 (gr_gr) */ - else if (b0 == 0xf1) { - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - b2 = uwx_get_byte(bstream); - if (b2 < 0) - return UWX_ERR_BADUDESC; - TRACE_I_DECODE_PROLOGUE_3("(P9) gr_gr", b0, b1, b2) - mask = b1 & 0x0f; - reg = b2 & 0x7f; - gr_gr_mask = mask; - for (i = 0; i < NSB_GR && mask != 0; i++) { - if (mask & 0x01) { - newrstate[SBREG_GR + i] = - UWX_DISP_REG(UWX_REG_GR(reg)); - reg++; - } - mask = mask >> 1; - } - } - - /* Format X1 */ - else if (b0 == 0xf9) { - TRACE_I_DECODE_PROLOGUE_1("(X1)", b0) - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - /* Don't support X-format descriptors yet */ - return UWX_ERR_CANTUNWIND; - } - - /* Format X2 */ - else if (b0 == 0xfa) { - TRACE_I_DECODE_PROLOGUE_1("(X2)", b0) - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - b2 = uwx_get_byte(bstream); - if (b2 < 0) - return UWX_ERR_BADUDESC; - /* Don't support X-format descriptors yet */ - return UWX_ERR_CANTUNWIND; - } - - /* Format X3 */ - else if (b0 == 0xfb) { - TRACE_I_DECODE_PROLOGUE_1("(X3)", b0) - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - b2 = uwx_get_byte(bstream); - if (b2 < 0) - return UWX_ERR_BADUDESC; - /* Don't support X-format descriptors yet */ - return UWX_ERR_CANTUNWIND; - } - - /* Format X4 */ - else if (b0 == 0xfc) { - TRACE_I_DECODE_PROLOGUE_1("(X4)", b0) - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - b2 = uwx_get_byte(bstream); - if (b2 < 0) - return UWX_ERR_BADUDESC; - b3 = uwx_get_byte(bstream); - if (b3 < 0) - return UWX_ERR_BADUDESC; - /* Don't support X-format descriptors yet */ - return UWX_ERR_CANTUNWIND; - } - - /* Format P10 */ - else if (b0 == 0xff) { - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - b2 = uwx_get_byte(bstream); - if (b2 < 0) - return UWX_ERR_BADUDESC; - TRACE_I_DECODE_PROLOGUE_3("(P10) abi", b0, b1, b2) - env->abi_context = (b1 << 8) | b2; - return UWX_ABI_FRAME; - } - - /* Invalid descriptor record */ - else { - TRACE_I_DECODE_PROLOGUE_1("(?)", b0) - return UWX_ERR_BADUDESC; - } - break; - } - } - - /* Process the masks of spilled GRs, FRs, and BRs to */ - /* determine when and where each register was saved. */ - - fr_base = spill_base + 16 * uwx_count_ones(fr_mem_mask); - br_base = fr_base + 8 * uwx_count_ones(br_mem_mask); - gr_base = br_base + 8 * uwx_count_ones(gr_mem_mask); - TRACE_I_DECODE_PROLOGUE_SPILL_BASE(spill_base) - TRACE_I_DECODE_PROLOGUE_MASKS(gr_mem_mask, gr_gr_mask) - TRACE_I_DECODE_PROLOGUE_NSPILL(ngr) - for (i = 0; ngr > 0 && i <= NSB_GR; i++) { - if (gr_mem_mask & 1) { - newrstate[SBREG_GR + i] = UWX_DISP_PSPREL(gr_base); - tspill[SBREG_GR + i] = 0; - gr_base -= 8; - ngr--; - } - else if (gr_gr_mask & 1) { - tspill[SBREG_GR + i] = 0; - ngr--; - } - gr_gr_mask = gr_gr_mask >> 1; - gr_mem_mask = gr_mem_mask >> 1; - } - for (i = 0; nbr > 0 && i <= NSB_BR; i++) { - if (br_mem_mask & 1) { - newrstate[SBREG_BR + i] = UWX_DISP_PSPREL(br_base); - tspill[SBREG_BR + i] = 0; - br_base -= 8; - nbr--; - } - else if (br_gr_mask & 1) { - tspill[SBREG_BR + i] = 0; - nbr--; - } - br_gr_mask = br_gr_mask >> 1; - br_mem_mask = br_mem_mask >> 1; - } - for (i = 0; nfr > 0 && i <= NSB_FR; i++) { - if (fr_mem_mask & 1) { - newrstate[SBREG_FR + i] = UWX_DISP_PSPREL(fr_base); - tspill[SBREG_FR + i] = 0; - fr_base -= 16; - nfr--; - } - fr_mem_mask = fr_mem_mask >> 1; - } - - /* Update the scoreboard. */ - - for (i = 0; i < env->nsbreg; i++) { - if (ip_slot >= rhdr->rlen || ip_slot > tspill[i]) - scoreboard->rstate[i] = newrstate[i]; - } - if (priunat_mem_rstate != UWX_DISP_NONE && ip_slot > t_priunat_mem) - scoreboard->rstate[SBREG_PRIUNAT] = priunat_mem_rstate; - - return UWX_OK; -} - -int uwx_count_ones(unsigned int mask) -{ - mask = (mask & 0x55555555) + ((mask & 0xaaaaaaaa) >> 1); - mask = (mask & 0x33333333) + ((mask & 0xcccccccc) >> 2); - mask = (mask & 0x0f0f0f0f) + ((mask & 0xf0f0f0f0) >> 4); - mask = (mask & 0x00ff00ff) + ((mask & 0xff00ff00) >> 8); - return (mask & 0x0000ffff) + ((mask & 0xffff0000) >> 16); -} - -/* uwx_decode_body: Decodes a body region */ - -int uwx_decode_body( - struct uwx_env *env, - struct uwx_bstream *bstream, - struct uwx_scoreboard *scoreboard, - struct uwx_rhdr *rhdr, - int ip_slot) -{ - int status; - int b0; - int b1; - int b2; - int b3; - int label; - int ecount; - int i; - uint64_t parm1; - uint64_t parm2; - uint64_t newrstate[NSBREG]; - int tspill[NSBREG]; - int t_sp_restore; - - /* Initialize an array of register states from the current */ - /* scoreboard, along with a parallel array of spill times. */ - /* We use this as a temporary scoreboard, then update the */ - /* real scoreboard at the end of the procedure. */ - /* We initialize the spill time to (rhdr.rlen - 1) so that */ - /* spills without a "when" descriptor will take effect */ - /* at the end of the prologue region. */ - /* (Boundary condition: all actions in a zero-length prologue */ - /* will appear to have happened in the instruction slot */ - /* immediately preceding the prologue.) */ - - for (i = 0; i < env->nsbreg; i++) { - newrstate[i] = scoreboard->rstate[i]; - tspill[i] = rhdr->rlen - 1; - } - t_sp_restore = rhdr->rlen - 1; - - /* Read body descriptor records until */ - /* we hit another region header. */ - - for (;;) { - - b0 = uwx_get_byte(bstream); - - if (b0 < 0x80) { - /* Return the last byte read to the byte stream, since it's */ - /* really the first byte of the next region header record. */ - if (b0 >= 0) - (void) uwx_unget_byte(bstream, b0); - break; - } - - /* Format B1 (label_state) */ - if (b0 < 0xa0) { - TRACE_I_DECODE_BODY_1("(B1) label_state", b0) - label = b0 & 0x1f; - status = uwx_label_scoreboard(env, scoreboard, label); - if (status != UWX_OK) - return (status); - } - - /* Format B1 (copy_state) */ - else if (b0 < 0xc0) { - TRACE_I_DECODE_BODY_1("(B1) copy_state", b0) - label = b0 & 0x1f; - status = uwx_copy_scoreboard(env, scoreboard, label); - if (status != UWX_OK) - return (status); - for (i = 0; i < env->nsbreg; i++) { - newrstate[i] = scoreboard->rstate[i]; - tspill[i] = rhdr->rlen; - } - } - - /* Format B2 (epilogue) */ - else if (b0 < 0xe0) { - ecount = b0 & 0x1f; - status = uwx_get_uleb128(bstream, &parm1); - if (status != 0) - return UWX_ERR_BADUDESC; - TRACE_I_DECODE_BODY_1L("(B2) epilogue", b0, parm1) - rhdr->ecount = ecount + 1; - t_sp_restore = rhdr->rlen - (unsigned int) parm1; - } - - /* Format B3 (epilogue) */ - else if (b0 == 0xe0) { - status = uwx_get_uleb128(bstream, &parm1); - if (status != 0) - return UWX_ERR_BADUDESC; - status = uwx_get_uleb128(bstream, &parm2); - if (status != 0) - return UWX_ERR_BADUDESC; - TRACE_I_DECODE_BODY_1LL("(B3) epilogue", b0, parm1, parm2) - t_sp_restore = rhdr->rlen - (unsigned int) parm1; - rhdr->ecount = (unsigned int) parm2 + 1; - } - - /* Format B4 (label_state) */ - else if (b0 == 0xf0) { - status = uwx_get_uleb128(bstream, &parm1); - if (status != 0) - return UWX_ERR_BADUDESC; - TRACE_I_DECODE_BODY_1L("(B4) label_state", b0, parm1) - label = (int) parm1; - status = uwx_label_scoreboard(env, scoreboard, label); - if (status != UWX_OK) - return (status); - } - - /* Format B4 (copy_state) */ - else if (b0 == 0xf8) { - status = uwx_get_uleb128(bstream, &parm1); - if (status != 0) - return UWX_ERR_BADUDESC; - TRACE_I_DECODE_BODY_1L("(B4) copy_state", b0, parm1) - label = (int) parm1; - status = uwx_copy_scoreboard(env, scoreboard, label); - if (status != UWX_OK) - return (status); - for (i = 0; i < env->nsbreg; i++) { - newrstate[i] = scoreboard->rstate[i]; - tspill[i] = rhdr->rlen; - } - } - - /* Format X1 */ - else if (b0 == 0xf9) { - TRACE_I_DECODE_BODY_1("(X1)", b0) - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - /* Don't support X-format descriptors yet */ - return UWX_ERR_CANTUNWIND; - } - - /* Format X2 */ - else if (b0 == 0xfa) { - TRACE_I_DECODE_BODY_1("(X2)", b0) - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - b2 = uwx_get_byte(bstream); - if (b2 < 0) - return UWX_ERR_BADUDESC; - /* Don't support X-format descriptors yet */ - return UWX_ERR_CANTUNWIND; - } - - /* Format X3 */ - else if (b0 == 0xfb) { - TRACE_I_DECODE_BODY_1("(X3)", b0) - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - b2 = uwx_get_byte(bstream); - if (b2 < 0) - return UWX_ERR_BADUDESC; - /* Don't support X-format descriptors yet */ - return UWX_ERR_CANTUNWIND; - } - - /* Format X4 */ - else if (b0 == 0xfc) { - TRACE_I_DECODE_BODY_1("(X4)", b0) - b1 = uwx_get_byte(bstream); - if (b1 < 0) - return UWX_ERR_BADUDESC; - b2 = uwx_get_byte(bstream); - if (b2 < 0) - return UWX_ERR_BADUDESC; - b3 = uwx_get_byte(bstream); - if (b3 < 0) - return UWX_ERR_BADUDESC; - /* Don't support X-format descriptors yet */ - return UWX_ERR_CANTUNWIND; - } - - /* Invalid descriptor record */ - else { - TRACE_I_DECODE_BODY_1("(?)", b0) - return UWX_ERR_BADUDESC; - } - } - - /* Update the scoreboard. */ - - for (i = 0; i < env->nsbreg; i++) { - if (ip_slot > tspill[i]) - scoreboard->rstate[i] = newrstate[i]; - } - - /* If we've passed the point in the epilogue where sp */ - /* is restored, update the scoreboard entry for PSP */ - /* and reset any entries for registers saved in memory. */ - - if (rhdr->ecount > 0 && ip_slot > t_sp_restore) { - scoreboard->rstate[SBREG_PSP] = UWX_DISP_SPPLUS(0); - for (i = 0; i < env->nsbreg; i++) { - if (UWX_GET_DISP_CODE(scoreboard->rstate[i]) == UWX_DISP_SPREL(0) || - UWX_GET_DISP_CODE(scoreboard->rstate[i]) == UWX_DISP_PSPREL(0)) - scoreboard->rstate[i] = UWX_DISP_NONE; - } - } - - return UWX_OK; -} - diff --git a/sys/contrib/ia64/libuwx/src/uwx_uinfo.h b/sys/contrib/ia64/libuwx/src/uwx_uinfo.h deleted file mode 100644 index 1bb477c..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_uinfo.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -struct uwx_utable_entry; - -extern int uwx_decode_uinfo( - struct uwx_env *env, - struct uwx_utable_entry *uentry, - uint64_t **rstatep); - -extern int uwx_default_rstate( - struct uwx_env *env, - uint64_t **rstatep); - -/* Region header record */ - -struct uwx_rhdr { - int is_prologue; /* true if prologue region */ - unsigned int rlen; /* length of region (# instruction slots) */ - int mask; /* register save mask */ - int grsave; /* first gr used for saving */ - unsigned int ecount; /* epilogue count (0 = no epilogue) */ - unsigned int epilogue_t; /* epilogue "t" value */ -}; - -struct uwx_bstream; - -extern int uwx_decode_rhdr( - struct uwx_env *env, - struct uwx_bstream *bstream, - struct uwx_rhdr *rhdr); - -extern int uwx_decode_prologue( - struct uwx_env *env, - struct uwx_bstream *bstream, - struct uwx_scoreboard *scoreboard, - struct uwx_rhdr *rhdr, - int ip_slot); - -extern int uwx_decode_body( - struct uwx_env *env, - struct uwx_bstream *bstream, - struct uwx_scoreboard *scoreboard, - struct uwx_rhdr *rhdr, - int ip_slot); diff --git a/sys/contrib/ia64/libuwx/src/uwx_utable.c b/sys/contrib/ia64/libuwx/src/uwx_utable.c deleted file mode 100644 index 908a3ae..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_utable.c +++ /dev/null @@ -1,273 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include "uwx_env.h" -#include "uwx_utable.h" -#include "uwx_swap.h" -#include "uwx_trace.h" - -/* - * uwx_utable.c - * - * This file contains the routines for searching an unwind table. - * The main entry point, uwx_search_utable(), gets the - * necessary information from the lookup ip callback's result - * vector, determines whether the table is 32-bit or 64-bit, - * then invokes the binary search routine for that format. - */ - - -/* Forward declarations */ - -int uwx_search_utable32( - struct uwx_env *env, - uint32_t ip, - uint32_t text_base, - uint32_t unwind_start, - uint32_t unwind_end, - struct uwx_utable_entry *uentry); - -int uwx_search_utable64( - struct uwx_env *env, - uint64_t ip, - uint64_t text_base, - uint64_t unwind_start, - uint64_t unwind_end, - struct uwx_utable_entry *uentry); - - -/* uwx_search_utable: Searches an unwind table for IP in current context */ - -int uwx_search_utable( - struct uwx_env *env, - uint64_t ip, - uint64_t *uvec, - struct uwx_utable_entry *uentry) -{ - uint64_t text_base; - uint64_t unwind_flags; - uint64_t unwind_start; - uint64_t unwind_end; - int keys; - int status; - - /* Get unwind table information from the result vector. */ - /* Make sure all three required values are given. */ - - keys = 0; - text_base = 0; - unwind_flags = 0; - unwind_start = 0; - unwind_end = 0; - while (*uvec != 0) { - switch ((int)*uvec++) { - case UWX_KEY_TBASE: - keys |= 1; - env->text_base = text_base = *uvec++; - break; - case UWX_KEY_UFLAGS: - unwind_flags = *uvec++; - break; - case UWX_KEY_USTART: - keys |= 2; - unwind_start = *uvec++; - break; - case UWX_KEY_UEND: - keys |= 4; - unwind_end = *uvec++; - break; - case UWX_KEY_GP: - uwx_set_reg(env, UWX_REG_GP, *uvec++); - break; - default: - return UWX_ERR_BADKEY; - } - } - if (keys != 7) - return UWX_ERR_BADKEY; - - /* Copy the unwind flags into the unwind entry. */ - /* (uwx_decode_uinfo needs to know whether it's 32-bit or 64-bit.) */ - - uentry->unwind_flags = unwind_flags; - - /* Call the appropriate binary search routine. */ - - if (unwind_flags & UNWIND_TBL_32BIT) - status = uwx_search_utable32(env, - (uint32_t) ip, - (uint32_t) text_base, - (uint32_t) unwind_start, - (uint32_t) unwind_end, - uentry); - else - status = uwx_search_utable64(env, - ip, text_base, unwind_start, unwind_end, uentry); - - return status; -} - - -/* uwx_search_utable32: Binary search of 32-bit unwind table */ - -#define COPYIN_UINFO_4(dest, src) \ - (env->remote? \ - (*env->copyin)(UWX_COPYIN_UINFO, (dest), (src), \ - WORDSZ, env->cb_token) : \ - (*(uint32_t *)(dest) = *(uint32_t *)(src), WORDSZ) ) - -#define SWIZZLE(x) (((uint64_t)((x) & 0xc0000000) << 31) | (x)) - -int uwx_search_utable32( - struct uwx_env *env, - uint32_t ip, - uint32_t text_base, - uint32_t unwind_start, - uint32_t unwind_end, - struct uwx_utable_entry *uentry) -{ - int lb; - int ub; - int mid; - int len; - uint32_t code_start; - uint32_t code_end; - uint32_t unwind_info; - - /* Since the unwind table uses segment-relative offsets, convert */ - /* the IP in the current context to a segment-relative offset. */ - - ip -= text_base; - - TRACE_T_SEARCH32(ip) - - /* Standard binary search. */ - /* Might modify this to do interpolation in the future. */ - - lb = 0; - ub = (unwind_end - unwind_start) / (3 * WORDSZ); - mid = 0; - while (ub > lb) { - mid = (lb + ub) / 2; - len = COPYIN_UINFO_4((char *)&code_start, - (uintptr_t)(unwind_start+mid*3*WORDSZ)); - len += COPYIN_UINFO_4((char *)&code_end, - (uintptr_t)(unwind_start+mid*3*WORDSZ+WORDSZ)); - if (len != 2 * WORDSZ) - return UWX_ERR_COPYIN_UTBL; - if (env->byte_swap) { - uwx_swap4(&code_start); - uwx_swap4(&code_end); - } - TRACE_T_BINSEARCH32(lb, ub, mid, code_start, code_end) - if (ip >= code_end) - lb = mid + 1; - else if (ip < code_start) - ub = mid; - else - break; - } - if (ub <= lb) - return UWX_ERR_NOUENTRY; - len = COPYIN_UINFO_4((char *)&unwind_info, - (uintptr_t)(unwind_start+mid*3*WORDSZ+2*WORDSZ)); - if (len != WORDSZ) - return UWX_ERR_COPYIN_UTBL; - if (env->byte_swap) - uwx_swap4(&unwind_info); - uentry->ptr_size = WORDSZ; - uentry->code_start = SWIZZLE(text_base + code_start); - uentry->code_end = SWIZZLE(text_base + code_end); - uentry->unwind_info = SWIZZLE(text_base + unwind_info); - return UWX_OK; -} - - -/* uwx_search_utable64: Binary search of 64-bit unwind table */ - -#define COPYIN_UINFO_8(dest, src) \ - (env->remote? \ - (*env->copyin)(UWX_COPYIN_UINFO, (dest), (src), \ - DWORDSZ, env->cb_token) : \ - (*(uint64_t *)(intptr_t)(dest) = *(uint64_t *)(intptr_t)(src), DWORDSZ) ) - -int uwx_search_utable64( - struct uwx_env *env, - uint64_t ip, - uint64_t text_base, - uint64_t unwind_start, - uint64_t unwind_end, - struct uwx_utable_entry *uentry) -{ - int lb; - int ub; - int mid; - int len; - uint64_t code_start; - uint64_t code_end; - uint64_t unwind_info; - - /* Since the unwind table uses segment-relative offsets, convert */ - /* the IP in the current context to a segment-relative offset. */ - - ip -= text_base; - - /* Standard binary search. */ - /* Might modify this to do interpolation in the future. */ - - lb = 0; - ub = (unwind_end - unwind_start) / (3 * DWORDSZ); - mid = 0; - while (ub > lb) { - mid = (lb + ub) / 2; - len = COPYIN_UINFO_8((char *)&code_start, unwind_start+mid*3*DWORDSZ); - len += COPYIN_UINFO_8((char *)&code_end, - unwind_start+mid*3*DWORDSZ+DWORDSZ); - if (len != 2 * DWORDSZ) - return UWX_ERR_COPYIN_UTBL; - if (env->byte_swap) { - uwx_swap8(&code_start); - uwx_swap8(&code_end); - } - if (ip >= code_end) - lb = mid + 1; - else if (ip < code_start) - ub = mid; - else - break; - } - if (ub <= lb) - return UWX_ERR_NOUENTRY; - len = COPYIN_UINFO_8((char *)&unwind_info, - unwind_start+mid*3*DWORDSZ+2*DWORDSZ); - if (len != DWORDSZ) - return UWX_ERR_COPYIN_UTBL; - if (env->byte_swap) - uwx_swap8(&unwind_info); - uentry->ptr_size = DWORDSZ; - uentry->code_start = text_base + code_start; - uentry->code_end = text_base + code_end; - uentry->unwind_info = text_base + unwind_info; - return UWX_OK; -} diff --git a/sys/contrib/ia64/libuwx/src/uwx_utable.h b/sys/contrib/ia64/libuwx/src/uwx_utable.h deleted file mode 100644 index 69f1cc7..0000000 --- a/sys/contrib/ia64/libuwx/src/uwx_utable.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -struct uwx_utable_entry { - uint64_t ptr_size; - uint64_t code_start; - uint64_t code_end; - uint64_t unwind_info; - uint64_t unwind_flags; -}; - -extern int uwx_search_utable( - struct uwx_env *env, - uint64_t ip, - uint64_t *uvec, - struct uwx_utable_entry *uentry); diff --git a/sys/contrib/ia64/libuwx/test/Makefile b/sys/contrib/ia64/libuwx/test/Makefile deleted file mode 100644 index 11251d4..0000000 --- a/sys/contrib/ia64/libuwx/test/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -UWXINCDIR = ../include -UWXLIBDIR = ../lib/ipf32 - -CFLAGS = -O -I $(UWXINCDIR) -LDFLAGS = -L $(UWXLIBDIR) - -dumpmyself: dumpmyself.o dump_context.o primeregs.o - $(CC) -o dumpmyself $(LDFLAGS) dumpmyself.o dump_context.o primeregs.o -luwx - - -dumpmyself.o: $(UWXINCDIR)/uwx.h $(UWXINCDIR)/uwx_self.h - -dump_context.o: -primeregs.o: diff --git a/sys/contrib/ia64/libuwx/test/dump_context.c b/sys/contrib/ia64/libuwx/test/dump_context.c deleted file mode 100644 index db46e3d..0000000 --- a/sys/contrib/ia64/libuwx/test/dump_context.c +++ /dev/null @@ -1,100 +0,0 @@ -#include <stdio.h> -#include <inttypes.h> - -#define IP 0 -#define SP 1 -#define BSP 2 -#define CFM 3 -#define RP 4 -#define PSP 5 -#define PFS 6 -#define PREDS 7 -#define PRIUNAT 8 -#define AR_BSPSTORE 9 -#define AR_RNAT 10 -#define AR_UNAT 11 -#define AR_FPSR 12 -#define AR_LC 13 -#define AR_PFS 14 -#define GR4 16 -#define GR5 17 -#define GR6 18 -#define GR7 19 -#define BR1 20 -#define BR2 21 -#define BR3 22 -#define BR4 23 -#define BR5 24 - -void dump_context(uint64_t *context) -{ - int i, j; - unsigned int valid; - uint64_t val; - static char *names[] = { - /* 0 */ "ip", "sp", "bsp", "cfm", - /* 4 */ "rp", "psp", "pfs", "preds", - /* 8 */ "priunat", "ar.bspstore", "ar.rnat", "ar.unat", - /* 12 */ "ar.fpsr", "ar.lc", "ar.pfs", "(pad)", - /* 16 */ "gr4", "gr5", "gr6", "gr7", - /* 20 */ "br1", "br2", "br3", "br4", "br5" - }; - static int col1[] = { - IP, - SP, - BSP, - CFM, - RP, - PSP, - PFS, - AR_RNAT, - AR_UNAT, - AR_FPSR, - AR_LC, - AR_PFS, - }; - static int col2[] = { - PREDS, - PRIUNAT, - GR4, - GR5, - GR6, - GR7, - BR1, - BR2, - BR3, - BR4, - BR5, - }; - -#define NCOL1 (sizeof(col1)/sizeof(int)) -#define NCOL2 (sizeof(col2)/sizeof(int)) -#define NPRINT (NCOL1 > NCOL2 ? NCOL1 : NCOL2) - - valid = (unsigned int)(context[0] >> 32); - printf(" valid_regs (%08lx):", valid); - for (i = 0; i <= BR5; i++) { - if (valid & 1) printf(" %s", names[i]); - valid >>= 1; - } - printf("\n"); - for (i = 0; i < NPRINT; i++) { - if (i < NCOL1) { - j = col1[i]; - val = context[j+1]; - printf(" %-8s %08x %08x", names[j], - (unsigned int)(val >> 32), - (unsigned int)val); - } - else - printf(" "); - if (i < NCOL2) { - j = col2[i]; - val = context[j+1]; - printf(" %-8s %08x %08x", names[j], - (unsigned int)(val >> 32), - (unsigned int)val); - } - putchar('\n'); - } -} diff --git a/sys/contrib/ia64/libuwx/test/dumpmyself.c b/sys/contrib/ia64/libuwx/test/dumpmyself.c deleted file mode 100644 index c2b63d0..0000000 --- a/sys/contrib/ia64/libuwx/test/dumpmyself.c +++ /dev/null @@ -1,106 +0,0 @@ -#include "uwx.h" -#include "uwx_self.h" - -struct uwx_env *uenv; -struct uwx_self_info *cbinfo; - -extern int uwx_get_frame_info(struct uwx_env *uenv); - -extern void dump_context(uint64_t *context); - -extern void prime_registers(); - -int main(int argc, char **argv) -{ - int status; - unsigned int *wp; - uenv = uwx_init(); - printf("uwx_init returned %08x\n", uenv); - cbinfo = uwx_self_init_info(uenv); - status = uwx_register_callbacks( - uenv, - (intptr_t)cbinfo, - uwx_self_copyin, - uwx_self_lookupip); - printf("uwx_register_callbacks returned %d\n", status); - uwx_self_init_context(uenv); - printf("In main():\n"); - dump_context((uint64_t *)uenv); - prime_registers(); - uwx_free(uenv); - return 0; -} - -int func1(void) -{ - uwx_self_init_context(uenv); - printf("In func1():\n"); - dump_context((uint64_t *)uenv); - return func2(); -} - -int func2(void) -{ - uwx_self_init_context(uenv); - printf("In func2():\n"); - dump_context((uint64_t *)uenv); - return func3(); -} - -int func3(void) -{ - uwx_self_init_context(uenv); - printf("In func3():\n"); - dump_context((uint64_t *)uenv); - return func4(); -} - -int func4(void) -{ - int status; - int foo[10]; - uint64_t *p; - uint64_t disp; - uint64_t val; - - func5(foo); - uwx_self_init_context(uenv); - uwx_init_history(uenv); - printf("In func4():\n"); - dump_context((uint64_t *)uenv); - for (;;) { - status = uwx_step(uenv); - if (status != UWX_OK) { - printf("uwx_step returned %d\n", status); - break; - } - status = uwx_get_reg(uenv, UWX_REG_PFS, &val); - if (status != UWX_OK) { - printf("uwx_get_reg returned %d\n", status); - break; - } - printf("After step:\n"); - dump_context((uint64_t *)uenv); - status = uwx_get_spill_loc(uenv, UWX_REG_IP, &disp); - if (status == UWX_OK) { - p = (uint64_t *)(disp & ~0x7LL); - if ((disp & 0x7) == UWX_DISP_RSTK(0)) - printf("IP spilled to backing store %08x = %08x\n", - (int)p, (int)(*p)); - else if ((disp & 0x7) == UWX_DISP_MSTK(0)) - printf("IP spilled to mem stack %08x = %08x\n", - (int)p, (int)(*p)); - else if ((disp & 0x7) == UWX_DISP_REG(0)) - printf("IP found in register %08x\n", (int)disp >> 4); - else - printf("IP history not available\n"); - } - } - return 0; -} - -int func5(int *foo) -{ - foo[0] = 0; - return 0; -} diff --git a/sys/contrib/ia64/libuwx/test/primeregs.s b/sys/contrib/ia64/libuwx/test/primeregs.s deleted file mode 100644 index 12444a2..0000000 --- a/sys/contrib/ia64/libuwx/test/primeregs.s +++ /dev/null @@ -1,93 +0,0 @@ - .text - .proc prime_registers - .global prime_registers - -prime_registers: - - .prologue - - .save ar.pfs, r32 - alloc r32 = ar.pfs, 0, 3, 0, 0 - .save rp, r33 - mov r33 = b0 - .save ar.unat, r34 - mov r34 = ar.unat - add r14 = -56, sp - add r15 = -48, sp - .fframe 80 - add sp = -80, sp - mov r16 = b1 - ;; - - .save.g 0x1 - st8.spill [r14] = r4, 16 - .save.g 0x2 - st8.spill [r15] = r5, 16 - mov r17 = b2 - ;; - .save.g 0x4 - st8.spill [r14] = r6, 16 - .save.g 0x8 - st8.spill [r15] = r7, 16 - mov r18 = b3 - ;; - .save.b 0x1 - st8 [r14] = r16, 16 - .save.b 0x2 - st8 [r15] = r17, 16 - mov r19 = b4 - ;; - .save.b 0x4 - st8 [r14] = r18, 16 - .save.b 0x8 - st8 [r15] = r19 - mov r20 = b5 - ;; - .save.b 0x10 - st8 [r14] = r20 - - .body - - dep.z r4 = -0x34, 16, 32 - ;; - add r5 = 1, r4 - add r6 = 2, r4 - ;; - add r7 = 3, r4 - ;; - - .global func1 - .type func1, @function - br.call.sptk b0 = func1 - ;; - - add r14 = 80, sp - add r15 = 88, sp - ;; - ld8 r20 = [r15], -16 - ;; - ld8 r19 = [r14], -16 - ld8 r18 = [r15], -16 - mov b5 = r20 - ;; - ld8 r17 = [r14], -16 - ld8 r16 = [r15], -16 - mov b4 = r19 - ;; - ld8.fill r7 = [r14], -16 - ld8.fill r6 = [r15], -16 - mov b3 = r18 - ;; - ld8.fill r5 = [r14] - ld8.fill r4 = [r15] - mov b2 = r17 - mov b1 = r16 - - .restore sp - mov ar.pfs = r32 - ;; - add sp = 80, sp - mov ar.unat = r34 - mov b0 = r33 - br.ret.sptk b0 - .endp diff --git a/sys/dev/acpica/acpi_hpet.c b/sys/dev/acpica/acpi_hpet.c index 4d600f5..2558648 100644 --- a/sys/dev/acpica/acpi_hpet.c +++ b/sys/dev/acpica/acpi_hpet.c @@ -29,7 +29,7 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" -#if defined(__amd64__) || defined(__ia64__) +#if defined(__amd64__) #define DEV_APIC #else #include "opt_apic.h" diff --git a/sys/dev/amr/amrio.h b/sys/dev/amr/amrio.h index bc06a86..9c81d2d 100644 --- a/sys/dev/amr/amrio.h +++ b/sys/dev/amr/amrio.h @@ -108,7 +108,7 @@ struct amr_user_ioctl { #define AMR_IO_COMMAND _IOWR('A', 0x201, struct amr_user_ioctl) -#if defined(__amd64__) || defined(__ia64__) +#if defined(__amd64__) struct amr_user_ioctl32 { unsigned char au_cmd[32]; /* command text from userspace */ diff --git a/sys/dev/ath/if_ath_ahb.c b/sys/dev/ath/if_ath_ahb.c index 362257f..4511ae4 100644 --- a/sys/dev/ath/if_ath_ahb.c +++ b/sys/dev/ath/if_ath_ahb.c @@ -164,8 +164,7 @@ ath_ahb_attach(device_t dev) goto bad0; } - /* XXX uintptr_t is a bandaid for ia64; to be fixed */ - sc->sc_st = (HAL_BUS_TAG)(uintptr_t) rman_get_bustag(psc->sc_sr); + sc->sc_st = (HAL_BUS_TAG) rman_get_bustag(psc->sc_sr); sc->sc_sh = (HAL_BUS_HANDLE) rman_get_bushandle(psc->sc_sr); /* * Mark device invalid so any interrupts (shared or otherwise) diff --git a/sys/dev/ath/if_ath_pci.c b/sys/dev/ath/if_ath_pci.c index 0b1153c..dbbc411 100644 --- a/sys/dev/ath/if_ath_pci.c +++ b/sys/dev/ath/if_ath_pci.c @@ -173,8 +173,7 @@ ath_pci_attach(device_t dev) device_printf(dev, "cannot map register space\n"); goto bad; } - /* XXX uintptr_t is a bandaid for ia64; to be fixed */ - sc->sc_st = (HAL_BUS_TAG)(uintptr_t) rman_get_bustag(psc->sc_sr); + sc->sc_st = (HAL_BUS_TAG) rman_get_bustag(psc->sc_sr); sc->sc_sh = (HAL_BUS_HANDLE) rman_get_bushandle(psc->sc_sr); /* * Mark device invalid so any interrupts (shared or otherwise) diff --git a/sys/dev/atkbdc/atkbdc.c b/sys/dev/atkbdc/atkbdc.c index 460626c..9368dbe 100644 --- a/sys/dev/atkbdc/atkbdc.c +++ b/sys/dev/atkbdc/atkbdc.c @@ -176,8 +176,6 @@ atkbdc_configure(void) /* XXX: tag should be passed from the caller */ #if defined(__amd64__) || defined(__i386__) tag = X86_BUS_SPACE_IO; -#elif defined(__ia64__) - tag = IA64_BUS_SPACE_IO; #elif defined(__sparc64__) tag = &atkbdc_bst_store[0]; #else diff --git a/sys/dev/drm/drm.h b/sys/dev/drm/drm.h index 592b5b3..e579a16 100644 --- a/sys/dev/drm/drm.h +++ b/sys/dev/drm/drm.h @@ -163,7 +163,7 @@ struct drm_hw_lock { /* This is beyond ugly, and only works on GCC. However, it allows me to use * drm.h in places (i.e., in the X-server) where I can't use size_t. The real * fix is to use uint32_t instead of size_t, but that fix will break existing - * LP64 (i.e., PowerPC64, SPARC64, IA-64, Alpha, etc.) systems. That *will* + * LP64 (i.e., PowerPC64, SPARC64, Alpha, etc.) systems. That *will* * eventually happen, though. I chose 'unsigned long' to be the fallback type * because that works on all the platforms I know about. Hopefully, the * real fix will happen before that bites us. diff --git a/sys/dev/drm/drm_sarea.h b/sys/dev/drm/drm_sarea.h index bf5b464..bb95759 100644 --- a/sys/dev/drm/drm_sarea.h +++ b/sys/dev/drm/drm_sarea.h @@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$"); /* SAREA area needs to be at least a page */ #if defined(__alpha__) #define SAREA_MAX 0x2000 -#elif defined(__ia64__) -#define SAREA_MAX 0x10000 /* 64kB */ #else /* Intel 830M driver needs at least 8k SAREA */ #define SAREA_MAX 0x2000UL diff --git a/sys/dev/drm2/drm.h b/sys/dev/drm2/drm.h index d2eac91..dff0f94 100644 --- a/sys/dev/drm2/drm.h +++ b/sys/dev/drm2/drm.h @@ -163,7 +163,7 @@ struct drm_hw_lock { /* This is beyond ugly, and only works on GCC. However, it allows me to use * drm.h in places (i.e., in the X-server) where I can't use size_t. The real * fix is to use uint32_t instead of size_t, but that fix will break existing - * LP64 (i.e., PowerPC64, SPARC64, IA-64, Alpha, etc.) systems. That *will* + * LP64 (i.e., PowerPC64, SPARC64, Alpha, etc.) systems. That *will* * eventually happen, though. I chose 'unsigned long' to be the fallback type * because that works on all the platforms I know about. Hopefully, the * real fix will happen before that bites us. diff --git a/sys/dev/drm2/drm_sarea.h b/sys/dev/drm2/drm_sarea.h index 9f37fcb..f800cfe 100644 --- a/sys/dev/drm2/drm_sarea.h +++ b/sys/dev/drm2/drm_sarea.h @@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$"); /* SAREA area needs to be at least a page */ #if defined(__alpha__) #define SAREA_MAX 0x2000 -#elif defined(__ia64__) -#define SAREA_MAX 0x10000 /* 64kB */ #else /* Intel 830M driver needs at least 8k SAREA */ #define SAREA_MAX 0x2000UL diff --git a/sys/dev/fb/fbreg.h b/sys/dev/fb/fbreg.h index e13408a..0ae2d54 100644 --- a/sys/dev/fb/fbreg.h +++ b/sys/dev/fb/fbreg.h @@ -49,27 +49,7 @@ copyw(uint16_t *src, uint16_t *dst, size_t size) #define bzero_io(d, c) bzero((void *)(d), (c)) #define fill_io(p, d, c) fill((p), (void *)(d), (c)) #define fillw_io(p, d, c) fillw((p), (void *)(d), (c)) -#elif defined(__ia64__) || defined(__sparc64__) -#if defined(__ia64__) -#include <machine/bus.h> -#define bcopy_fromio(s, d, c) \ - bus_space_read_region_1(IA64_BUS_SPACE_MEM, s, 0, (void*)(d), c) -#define bcopy_io(s, d, c) \ - bus_space_copy_region_1(IA64_BUS_SPACE_MEM, s, 0, d, 0, c) -#define bcopy_toio(s, d, c) \ - bus_space_write_region_1(IA64_BUS_SPACE_MEM, d, 0, (void*)(s), c) -#define bzero_io(d, c) \ - bus_space_set_region_1(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, 0, c) -#define fill_io(p, d, c) \ - bus_space_set_region_1(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, p, c) -#define fillw_io(p, d, c) \ - bus_space_set_region_2(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, p, c) -#define readb(a) bus_space_read_1(IA64_BUS_SPACE_MEM, a, 0) -#define readw(a) bus_space_read_2(IA64_BUS_SPACE_MEM, a, 0) -#define writeb(a, v) bus_space_write_1(IA64_BUS_SPACE_MEM, a, 0, v) -#define writew(a, v) bus_space_write_2(IA64_BUS_SPACE_MEM, a, 0, v) -#define writel(a, v) bus_space_write_4(IA64_BUS_SPACE_MEM, a, 0, v) -#endif /* __ia64__ */ +#elif defined(__sparc64__) static __inline void fillw(int val, uint16_t *buf, size_t size) { @@ -120,7 +100,7 @@ fillw(int val, uint16_t *buf, size_t size) #define writew(a, v) (*(uint16_t*)(a) = (v)) #endif -#else /* !__i386__ && !__amd64__ && !__ia64__ && !__sparc64__ && !__powerpc__ */ +#else /* !__i386__ && !__amd64__ && !__sparc64__ && !__powerpc__ */ #define bcopy_io(s, d, c) memcpy_io((d), (s), (c)) #define bcopy_toio(s, d, c) memcpy_toio((d), (void *)(s), (c)) #define bcopy_fromio(s, d, c) memcpy_fromio((void *)(d), (s), (c)) diff --git a/sys/dev/hwpmc/hwpmc_ia64.c b/sys/dev/hwpmc/hwpmc_ia64.c deleted file mode 100644 index ce1caf6..0000000 --- a/sys/dev/hwpmc/hwpmc_ia64.c +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * Copyright (c) 2005, Joseph Koshy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/pmc.h> - -#include <machine/pmc_mdep.h> - -struct pmc_mdep * -pmc_md_initialize() -{ - return NULL; -} - -void -pmc_md_finalize(struct pmc_mdep *md) -{ - (void) md; -} - -int -pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, - struct trapframe *tf) -{ - (void) cc; - (void) maxsamples; - (void) tf; - return (0); -} - -int -pmc_save_user_callchain(uintptr_t *cc, int maxsamples, - struct trapframe *tf) -{ - (void) cc; - (void) maxsamples; - (void) tf; - return (0); -} diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c index 46f3250..7083582 100644 --- a/sys/dev/pci/vga_pci.c +++ b/sys/dev/pci/vga_pci.c @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include <sys/sysctl.h> #include <sys/systm.h> -#if defined(__amd64__) || defined(__i386__) || defined(__ia64__) +#if defined(__amd64__) || defined(__i386__) #include <vm/vm.h> #include <vm/pmap.h> #endif @@ -137,7 +137,7 @@ vga_pci_map_bios(device_t dev, size_t *size) int rid; struct resource *res; -#if defined(__amd64__) || defined(__i386__) || defined(__ia64__) +#if defined(__amd64__) || defined(__i386__) if (vga_pci_is_boot_display(dev)) { /* * On x86, the System BIOS copy the default display @@ -173,7 +173,7 @@ vga_pci_unmap_bios(device_t dev, void *bios) return; } -#if defined(__amd64__) || defined(__i386__) || defined(__ia64__) +#if defined(__amd64__) || defined(__i386__) if (vga_pci_is_boot_display(dev)) { /* We mapped the BIOS shadow copy located at 0xC0000. */ pmap_unmapdev((vm_offset_t)bios, VGA_PCI_BIOS_SHADOW_SIZE); diff --git a/sys/dev/sound/pcm/pcm.h b/sys/dev/sound/pcm/pcm.h index aab3750..a3a4ec3 100644 --- a/sys/dev/sound/pcm/pcm.h +++ b/sys/dev/sound/pcm/pcm.h @@ -42,7 +42,7 @@ /* * Automatically turn on 64bit arithmetic on suitable archs - * (amd64 64bit, ia64, etc..) for wider 32bit samples / integer processing. + * (amd64 64bit, etc..) for wider 32bit samples / integer processing. */ #if LONG_BIT >= 64 #undef SND_PCM_64 diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c index 4dc5ca5..bd533f5 100644 --- a/sys/dev/sym/sym_hipd.c +++ b/sys/dev/sym/sym_hipd.c @@ -132,8 +132,6 @@ typedef u_int32_t u32; #define MEMORY_BARRIER() do { ; } while(0) #elif defined __powerpc__ #define MEMORY_BARRIER() __asm__ volatile("eieio; sync" : : : "memory") -#elif defined __ia64__ -#define MEMORY_BARRIER() __asm__ volatile("mf.a; mf" : : : "memory") #elif defined __sparc64__ #define MEMORY_BARRIER() __asm__ volatile("membar #Sync" : : : "memory") #elif defined __arm__ diff --git a/sys/dev/txp/if_txp.c b/sys/dev/txp/if_txp.c index f513225..e0452be 100644 --- a/sys/dev/txp/if_txp.c +++ b/sys/dev/txp/if_txp.c @@ -112,7 +112,7 @@ MODULE_DEPEND(txp, ether, 1, 1, 1); * restriction by copying received frame to align the frame on * 32bit boundary on strict-alignment architectures. This adds a * lot of CPU burden and it effectively reduce Rx performance on - * strict-alignment architectures(e.g. sparc64, arm, mips and ia64). + * strict-alignment architectures(e.g. sparc64, arm and mips). * * Unfortunately it seems that 3Com have no longer interests in * releasing fixed firmware so we may have to live with these bugs. diff --git a/sys/dev/uart/uart_cpu_ia64.c b/sys/dev/uart/uart_cpu_ia64.c deleted file mode 100644 index 9a71e20..0000000 --- a/sys/dev/uart/uart_cpu_ia64.c +++ /dev/null @@ -1,113 +0,0 @@ -/*- - * Copyright (c) 2003, 2004 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/bus.h> - -#include <machine/bus.h> -#include <machine/dig64.h> -#include <machine/md_var.h> -#include <machine/vmparam.h> - -#include <dev/uart/uart.h> -#include <dev/uart/uart_cpu.h> - -bus_space_tag_t uart_bus_space_io = IA64_BUS_SPACE_IO; -bus_space_tag_t uart_bus_space_mem = IA64_BUS_SPACE_MEM; - -static int dig64_to_uart_parity[] = { - UART_PARITY_NONE, UART_PARITY_NONE, UART_PARITY_EVEN, - UART_PARITY_ODD, UART_PARITY_MARK, UART_PARITY_SPACE -}; - -int -uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) -{ - - return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0); -} - -int -uart_cpu_getdev(int devtype, struct uart_devinfo *di) -{ - struct dig64_hcdp_table *tbl; - struct dig64_hcdp_entry *ent; - struct uart_class *class; - bus_addr_t addr; - uint64_t hcdp; - unsigned int i; - - class = &uart_ns8250_class; - if (class == NULL) - return (ENXIO); - - /* - * Use the DIG64 HCDP table if present. - */ - hcdp = ia64_get_hcdp(); - if (hcdp != 0) { - tbl = (void*)IA64_PHYS_TO_RR7(hcdp); - for (i = 0; i < tbl->entries; i++) { - ent = tbl->entry + i; - - if (devtype == UART_DEV_CONSOLE && - ent->type != DIG64_HCDP_CONSOLE) - continue; - - if (devtype == UART_DEV_DBGPORT && - ent->type != DIG64_HCDP_DBGPORT) - continue; - - addr = ent->address.addr_high; - addr = (addr << 32) + ent->address.addr_low; - di->ops = uart_getops(class); - di->bas.chan = 0; - di->bas.bst = (ent->address.addr_space == 0) - ? uart_bus_space_mem : uart_bus_space_io; - if (bus_space_map(di->bas.bst, addr, - uart_getrange(class), 0, &di->bas.bsh) != 0) - continue; - di->bas.regshft = 0; - di->bas.rclk = ent->pclock << 4; - /* We don't deal with 64-bit baud rates. */ - di->baudrate = ent->baud_low; - di->databits = ent->databits; - di->stopbits = ent->stopbits; - di->parity = (ent->parity >= 6) ? UART_PARITY_NONE - : dig64_to_uart_parity[ent->parity]; - return (0); - } - - /* FALLTHROUGH */ - } - - /* Check the environment. */ - return (uart_getenv(devtype, di, class)); -} diff --git a/sys/dev/vt/hw/vga/vt_vga.c b/sys/dev/vt/hw/vga/vt_vga.c index 15bed12..cac752f 100644 --- a/sys/dev/vt/hw/vga/vt_vga.c +++ b/sys/dev/vt/hw/vga/vt_vga.c @@ -656,11 +656,6 @@ vga_init(struct vt_device *vd) sc->vga_fb_handle = KERNBASE + VGA_MEM_BASE; sc->vga_reg_tag = X86_BUS_SPACE_IO; sc->vga_reg_handle = VGA_REG_BASE; -#elif defined(__ia64__) - sc->vga_fb_tag = IA64_BUS_SPACE_MEM; - sc->vga_fb_handle = IA64_PHYS_TO_RR6(VGA_MEM_BASE); - sc->vga_reg_tag = IA64_BUS_SPACE_IO; - sc->vga_reg_handle = VGA_REG_BASE; #else # error "Architecture not yet supported!" #endif diff --git a/sys/ia64/acpica/OsdEnvironment.c b/sys/ia64/acpica/OsdEnvironment.c deleted file mode 100644 index 7aa281f..0000000 --- a/sys/ia64/acpica/OsdEnvironment.c +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * Copyright (c) 2000,2001 Michael Smith - * Copyright (c) 2000 BSDi - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/efi.h> -#include <sys/sysctl.h> - -#include <contrib/dev/acpica/include/acpi.h> - -static u_long acpi_root_phys; - -SYSCTL_ULONG(_machdep, OID_AUTO, acpi_root, CTLFLAG_RD, &acpi_root_phys, 0, - "The physical address of the RSDP"); - -ACPI_STATUS -AcpiOsInitialize(void) -{ - - return (AE_OK); -} - -ACPI_STATUS -AcpiOsTerminate(void) -{ - - return (AE_OK); -} - -static u_long -acpi_get_root_from_efi(void) -{ - static struct uuid acpi_root_uuid = EFI_TABLE_ACPI20; - void *acpi_root; - - acpi_root = efi_get_table(&acpi_root_uuid); - if (acpi_root != NULL) - return (IA64_RR_MASK((uintptr_t)acpi_root)); - - return (0); -} - -ACPI_PHYSICAL_ADDRESS -AcpiOsGetRootPointer(void) -{ - - if (acpi_root_phys == 0) - acpi_root_phys = acpi_get_root_from_efi(); - - return (acpi_root_phys); -} diff --git a/sys/ia64/acpica/acpi_machdep.c b/sys/ia64/acpica/acpi_machdep.c deleted file mode 100644 index 1466cfe..0000000 --- a/sys/ia64/acpica/acpi_machdep.c +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/bus.h> -#include <machine/md_var.h> -#include <machine/pal.h> - -#include <contrib/dev/acpica/include/acpi.h> -#include <contrib/dev/acpica/include/actables.h> -#include <dev/acpica/acpivar.h> - -int -acpi_machdep_init(device_t dev) -{ - struct acpi_softc *sc; - - sc = device_get_softc(dev); - - acpi_install_wakeup_handler(sc); - - return (0); -} - -int -acpi_machdep_quirks(int *quirks) -{ - return (0); -} - -void -acpi_cpu_c1() -{ -#ifdef INVARIANTS - register_t ie; - - ie = intr_disable(); - KASSERT(ie == 0, ("%s called with interrupts enabled\n", __func__)); -#endif - ia64_call_pal_static(PAL_HALT_LIGHT, 0, 0, 0); - ia64_enable_intr(); -} - -void * -acpi_find_table(const char *sig) -{ - ACPI_PHYSICAL_ADDRESS rsdp_ptr; - ACPI_TABLE_RSDP *rsdp; - ACPI_TABLE_XSDT *xsdt; - ACPI_TABLE_HEADER *table; - UINT64 addr; - u_int i, count; - - if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0) - return (NULL); - - rsdp = (ACPI_TABLE_RSDP *)IA64_PHYS_TO_RR7(rsdp_ptr); - xsdt = (ACPI_TABLE_XSDT *)IA64_PHYS_TO_RR7(rsdp->XsdtPhysicalAddress); - - count = (UINT64 *)((char *)xsdt + xsdt->Header.Length) - - xsdt->TableOffsetEntry; - - for (i = 0; i < count; i++) { - addr = xsdt->TableOffsetEntry[i]; - table = (ACPI_TABLE_HEADER *)IA64_PHYS_TO_RR7(addr); - - if (strncmp(table->Signature, sig, ACPI_NAME_SIZE) != 0) - continue; - if (ACPI_FAILURE(AcpiTbChecksum((void *)table, table->Length))) - continue; - - return (table); - } - - return (NULL); -} diff --git a/sys/ia64/acpica/acpi_wakeup.c b/sys/ia64/acpica/acpi_wakeup.c deleted file mode 100644 index 6c70ca7..0000000 --- a/sys/ia64/acpica/acpi_wakeup.c +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/bus.h> - -#include <contrib/dev/acpica/include/acpi.h> - -#include <dev/acpica/acpivar.h> - -int -acpi_sleep_machdep(struct acpi_softc *sc, int state) -{ - return (0); -} - -int -acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result, - int intr_enabled) -{ - return (0); -} - -void -acpi_install_wakeup_handler(struct acpi_softc *sc) -{ -} diff --git a/sys/ia64/acpica/madt.c b/sys/ia64/acpica/madt.c deleted file mode 100644 index 51193ff..0000000 --- a/sys/ia64/acpica/madt.c +++ /dev/null @@ -1,247 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <contrib/dev/acpica/include/acpi.h> -#include <contrib/dev/acpica/include/actables.h> - -#include <machine/md_var.h> - -struct sapic *sapic_create(int, int, u_int64_t); - -static void -print_entry(ACPI_SUBTABLE_HEADER *entry) -{ - - switch (entry->Type) { - case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE: { - ACPI_MADT_INTERRUPT_OVERRIDE *iso = - (ACPI_MADT_INTERRUPT_OVERRIDE *)entry; - printf("\tInterrupt source override entry\n"); - printf("\t\tBus=%u, Source=%u, Irq=0x%x\n", iso->Bus, - iso->SourceIrq, iso->GlobalIrq); - break; - } - - case ACPI_MADT_TYPE_IO_APIC: - printf("\tI/O APIC entry\n"); - break; - - case ACPI_MADT_TYPE_IO_SAPIC: { - ACPI_MADT_IO_SAPIC *sapic = (ACPI_MADT_IO_SAPIC *)entry; - printf("\tI/O SAPIC entry\n"); - printf("\t\tId=0x%x, InterruptBase=0x%x, Address=0x%lx\n", - sapic->Id, sapic->GlobalIrqBase, sapic->Address); - break; - } - - case ACPI_MADT_TYPE_LOCAL_APIC_NMI: - printf("\tLocal APIC NMI entry\n"); - break; - - case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE: { - ACPI_MADT_LOCAL_APIC_OVERRIDE *lapic = - (ACPI_MADT_LOCAL_APIC_OVERRIDE *)entry; - printf("\tLocal APIC override entry\n"); - printf("\t\tLocal APIC address=0x%jx\n", lapic->Address); - break; - } - - case ACPI_MADT_TYPE_LOCAL_SAPIC: { - ACPI_MADT_LOCAL_SAPIC *sapic = (ACPI_MADT_LOCAL_SAPIC *)entry; - printf("\tLocal SAPIC entry\n"); - printf("\t\tProcessorId=0x%x, Id=0x%x, Eid=0x%x", - sapic->ProcessorId, sapic->Id, sapic->Eid); - if (!(sapic->LapicFlags & ACPI_MADT_ENABLED)) - printf(" (disabled)"); - printf("\n"); - break; - } - - case ACPI_MADT_TYPE_NMI_SOURCE: - printf("\tNMI entry\n"); - break; - - case ACPI_MADT_TYPE_INTERRUPT_SOURCE: { - ACPI_MADT_INTERRUPT_SOURCE *pis = - (ACPI_MADT_INTERRUPT_SOURCE *)entry; - printf("\tPlatform interrupt entry\n"); - printf("\t\tPolarity=%u, TriggerMode=%u, Id=0x%x, " - "Eid=0x%x, Vector=0x%x, Irq=%d\n", - pis->IntiFlags & ACPI_MADT_POLARITY_MASK, - (pis->IntiFlags & ACPI_MADT_TRIGGER_MASK) >> 2, - pis->Id, pis->Eid, pis->IoSapicVector, pis->GlobalIrq); - break; - } - - case ACPI_MADT_TYPE_LOCAL_APIC: - printf("\tLocal APIC entry\n"); - break; - - default: - printf("\tUnknown type %d entry\n", entry->Type); - break; - } -} - -void -ia64_probe_sapics(void) -{ - ACPI_PHYSICAL_ADDRESS rsdp_ptr; - ACPI_SUBTABLE_HEADER *entry; - ACPI_TABLE_MADT *table; - ACPI_TABLE_RSDP *rsdp; - ACPI_TABLE_XSDT *xsdt; - char *end, *p; - int t, tables; - - if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0) - return; - - rsdp = (ACPI_TABLE_RSDP *)IA64_PHYS_TO_RR7(rsdp_ptr); - xsdt = (ACPI_TABLE_XSDT *)IA64_PHYS_TO_RR7(rsdp->XsdtPhysicalAddress); - - tables = (UINT64 *)((char *)xsdt + xsdt->Header.Length) - - xsdt->TableOffsetEntry; - - for (t = 0; t < tables; t++) { - table = (ACPI_TABLE_MADT *) - IA64_PHYS_TO_RR7(xsdt->TableOffsetEntry[t]); - - if (bootverbose) - printf("Table '%c%c%c%c' at %p\n", - table->Header.Signature[0], - table->Header.Signature[1], - table->Header.Signature[2], - table->Header.Signature[3], table); - - if (strncmp(table->Header.Signature, ACPI_SIG_MADT, - ACPI_NAME_SIZE) != 0 || - ACPI_FAILURE(AcpiTbChecksum((void *)table, - table->Header.Length))) - continue; - - /* Save the address of the processor interrupt block. */ - if (bootverbose) - printf("\tLocal APIC address=0x%x\n", table->Address); - ia64_lapic_addr = table->Address; - - end = (char *)table + table->Header.Length; - p = (char *)(table + 1); - while (p < end) { - entry = (ACPI_SUBTABLE_HEADER *)p; - - if (bootverbose) - print_entry(entry); - - switch (entry->Type) { - case ACPI_MADT_TYPE_IO_SAPIC: { - ACPI_MADT_IO_SAPIC *sapic = - (ACPI_MADT_IO_SAPIC *)entry; - sapic_create(sapic->Id, sapic->GlobalIrqBase, - sapic->Address); - break; - } - - case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE: { - ACPI_MADT_LOCAL_APIC_OVERRIDE *lapic = - (ACPI_MADT_LOCAL_APIC_OVERRIDE *)entry; - ia64_lapic_addr = lapic->Address; - break; - } - -#ifdef SMP - case ACPI_MADT_TYPE_LOCAL_SAPIC: { - ACPI_MADT_LOCAL_SAPIC *sapic = - (ACPI_MADT_LOCAL_SAPIC *)entry; - if (sapic->LapicFlags & ACPI_MADT_ENABLED) - cpu_mp_add(sapic->ProcessorId, - sapic->Id, sapic->Eid); - break; - } -#endif - - default: - break; - } - - p += entry->Length; - } - } -} - -/* - * Count the number of local SAPIC entries in the APIC table. Every enabled - * entry corresponds to a processor. - */ -int -ia64_count_cpus(void) -{ - ACPI_PHYSICAL_ADDRESS rsdp_ptr; - ACPI_MADT_LOCAL_SAPIC *entry; - ACPI_TABLE_MADT *table; - ACPI_TABLE_RSDP *rsdp; - ACPI_TABLE_XSDT *xsdt; - char *end, *p; - int cpus, t, tables; - - if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0) - return (0); - - rsdp = (ACPI_TABLE_RSDP *)IA64_PHYS_TO_RR7(rsdp_ptr); - xsdt = (ACPI_TABLE_XSDT *)IA64_PHYS_TO_RR7(rsdp->XsdtPhysicalAddress); - - tables = (UINT64 *)((char *)xsdt + xsdt->Header.Length) - - xsdt->TableOffsetEntry; - - cpus = 0; - - for (t = 0; t < tables; t++) { - table = (ACPI_TABLE_MADT *) - IA64_PHYS_TO_RR7(xsdt->TableOffsetEntry[t]); - - if (strncmp(table->Header.Signature, ACPI_SIG_MADT, - ACPI_NAME_SIZE) != 0 || - ACPI_FAILURE(AcpiTbChecksum((void *)table, - table->Header.Length))) - continue; - - end = (char *)table + table->Header.Length; - p = (char *)(table + 1); - while (p < end) { - entry = (ACPI_MADT_LOCAL_SAPIC *)p; - - if (entry->Header.Type == ACPI_MADT_TYPE_LOCAL_SAPIC && - (entry->LapicFlags & ACPI_MADT_ENABLED)) - cpus++; - - p += entry->Header.Length; - } - } - - return (cpus); -} diff --git a/sys/ia64/conf/DEFAULTS b/sys/ia64/conf/DEFAULTS deleted file mode 100644 index a3e10d6..0000000 --- a/sys/ia64/conf/DEFAULTS +++ /dev/null @@ -1,22 +0,0 @@ -# -# DEFAULTS -- Default kernel configuration file for FreeBSD/ia64 -# -# $FreeBSD$ - -machine ia64 - -# Bus support. -device acpi # ACPI support - -# Pseudo devices. -device io # I/O & EFI runtime device -device mem # Memory and kernel memory devices - -# UART chips on this platform -device uart_ns8250 - -options GEOM_PART_BSD -options GEOM_PART_GPT -options GEOM_PART_MBR - -options NEW_PCIB diff --git a/sys/ia64/conf/GENERIC b/sys/ia64/conf/GENERIC deleted file mode 100644 index 532b74b..0000000 --- a/sys/ia64/conf/GENERIC +++ /dev/null @@ -1,213 +0,0 @@ -# -# GENERIC -- Generic kernel configuration file for FreeBSD/ia64 -# -# For more information on this file, please read the handbook section on -# Kernel Configuration Files: -# -# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check -# first in NOTES. -# -# For hardware specific information check HARDWARE.TXT -# -# $FreeBSD$ - -cpu ITANIUM2 -ident GENERIC - -makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols - -options AUDIT # Security event auditing -options CAPABILITY_MODE # Capsicum capability mode -options CAPABILITIES # Capsicum capabilities -options CD9660 # ISO 9660 Filesystem -options COMPAT_FREEBSD7 # Compatible with FreeBSD7 -options FFS # Berkeley Fast Filesystem -options GEOM_LABEL # Provides labelization -options INCLUDE_CONFIG_FILE # Include this file in kernel -options INET # InterNETworking -options INET6 # IPv6 communications protocols -options KTRACE # ktrace(1) syscall trace support -options MAC # TrustedBSD MAC Framework -options MD_ROOT # MD usable as root device -options MSDOSFS # MSDOS Filesystem -options NFSCL # New Network Filesystem Client -options NFSLOCKD # Network Lock Manager -options NFSD # New Network Filesystem Server -options NFS_ROOT # NFS usable as root device -options P1003_1B_SEMAPHORES # POSIX-style semaphores -options PREEMPTION # Enable kernel thread preemption -options PRINTF_BUFR_SIZE=128 # Printf buffering to limit interspersion -options PROCFS # Process filesystem (/proc) -options PSEUDOFS # Pseudo-filesystem framework -options SCHED_ULE # ULE scheduler -options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI -options SCTP # Stream Control Transmission Protocol -options SMP # Symmetric Multi-Processor support -options SOFTUPDATES # Enable FFS soft updates support -options STACK # stack(9) support -options SYSVMSG # SYSV-style message queues -options SYSVSEM # SYSV-style semaphores -options SYSVSHM # SYSV-style shared memory -options UFS_ACL # Support for access control lists -options UFS_DIRHASH # Hash-based directory lookup scheme -options UFS_GJOURNAL # Enable gjournal-based UFS journaling -options QUOTA # Enable disk quotas for UFS -options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B RT extensions - -# Debugging support. Always need this: -options KDB # Enable kernel debugger support. -options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB -options GDB # Support remote GDB -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones - -# Various "busses" -device miibus # MII bus support (Ethernet) -device pci # PCI bus support -device scbus # SCSI bus (required for ATA/SCSI) -device usb # USB Bus (required for USB) - -# ATA controllers -device ahci # AHCI-compatible SATA controllers -device ata # Legacy ATA/SATA controllers -device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA -device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA - -# SCSI Controllers -device ahc # AHA2940 and AIC7xxx devices -device ahd # AHA39320/29320 and AIC79xx devices -device hptiop # Highpoint RocketRaid 3xxx series -device isp # Qlogic family -device mpt # LSI-Logic MPT-Fusion -device mps # LSI-Logic MPT-Fusion 2 -device mpr # LSI-Logic MPT-Fusion 3 -device sym # NCR/Symbios Logic - -# RAID controllers interfaced to the SCSI subsystem -device amr # AMI MegaRAID -device ciss # Compaq Smart RAID 5* -device dpt # DPT Smartcache III, IV -device iir # Intel Integrated RAID -device ips # IBM (Adaptec) ServeRAID -device mly # Mylex AcceleRAID/eXtremeRAID -device twa # 3ware 9000 series PATA/SATA RAID - -# ATA/SCSI peripherals -device cd # CD-ROM, DVD-ROM etc. -device ch # Media changer -device da # Direct Access (ie disk) -device pass # Passthrough (direct ATA/SCSI access) -device sa # Sequential Access (ie tape) -device ses # Enclosure Services (SES and SAF-TE) -#device ctl # CAM Target Layer - -# RAID controllers -device aac # Adaptec FSA RAID -device aacp # SCSI passthrough for aac (requires CAM) -device aacraid # Adaptec by PMC RAID -device ida # Compaq Smart RAID -device mlx # Mylex DAC960 family - -# USB host controllers and peripherals -options USB_DEBUG # enable debug msgs -device ehci # EHCI host controller -device ohci # OHCI PCI->USB interface -device uhci # UHCI PCI->USB interface -device uhid # Human Interface Devices -device ukbd # Keyboard -device ulpt # Printer -device umass # Disks/Mass storage (need scbus & da) -device ums # Mouse - -# PCI Ethernet NICs. -device de # DEC/Intel DC21x4x (``Tulip'') -device em # Intel PRO/1000 Gigabit Ethernet Family -device igb # Intel PRO/1000 PCIE Server Gigabit Family -device ixgbe # Intel PRO/10GbE PCIE Ethernet Family -device txp # 3Com 3cR990 (``Typhoon'') - -# PCI Ethernet NICs that use the common MII bus controller code. -device ae # Attansic/Atheros L2 FastEthernet -device age # Attansic/Atheros L1 Gigabit Ethernet -device alc # Atheros AR8131/AR8132 Ethernet -device ale # Atheros AR8121/AR8113/AR8114 Ethernet -device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet -device bfe # Broadcom BCM440x 10/100 Ethernet -device bge # Broadcom BCM570xx Gigabit Ethernet -device et # Agere ET1310 10/100/Gigabit Ethernet -device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet -device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet -device nge # NatSemi DP83820 gigabit Ethernet -device fxp # Intel EtherExpress PRO/100B (82557, 82558) -device re # RealTek 8139C+/8169/8169S/8110S -device sf # Adaptec AIC-6915 (``Starfire'') -device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet -device ste # Sundance ST201 (D-Link DFE-550TX) -device stge # Sundance/Tamarack TC9021 gigabit Ethernet -device tx # SMC EtherPower II (83c170 ``EPIC'') -device vge # VIA VT612x gigabit Ethernet -device xl # 3Com 3c90x ("Boomerang", "Cyclone") - -# USB Ethernet -device aue # ADMtek USB Ethernet -device axe # ASIX Electronics USB Ethernet -device cdce # Generic USB over Ethernet -device cue # CATC USB Ethernet -device kue # Kawasaki LSI USB Ethernet -device rue # RealTek RTL8150 USB Ethernet -device udav # Davicom DM9601E USB - -# USB Serial -device uark # Technologies ARK3116 based serial adapters -device ubsa # Belkin F5U103 and compatible serial adapters -device uftdi # For FTDI usb serial adapters -device uipaq # Some WinCE based devices -device uplcom # Prolific PL-2303 serial adapters -device uslcom # SI Labs CP2101/CP2102 serial adapters -device uvisor # Visor and Palm devices -device uvscom # USB serial support for DDI pocket's PHS - -# Wireless NIC cards. -# The wlan(4) module assumes this, so just define it so it -# at least correctly loads. -options IEEE80211_SUPPORT_MESH - -# The ath(4) and ath_hal(4) code requires this. The module currently -# builds everything including AR5416 (and later 11n NIC) support. -options AH_SUPPORT_AR5416 - -# Various (pseudo) devices -device ether # Ethernet support -device faith # IPv6-to-IPv4 relaying (translation) -device firmware # firmware assist module -device gif # IPv6 and IPv4 tunneling -device kbdmux # keyboard multiplexer -device loop # Network loopback -device md # Memory "disks" -device puc # Multi I/O cards and multi-channel UARTs -device random # Entropy device -device tun # Packet tunnel. -device uart # Serial port (UART) -device vlan # 802.1Q VLAN support -device vt # Virtual terminals -device vt_vga # VGA terminal device - -# The `bpf' device enables the Berkeley Packet Filter. -# Be aware of the administrative consequences of enabling this! -# Note that 'bpf' is required for DHCP. -device bpf # Berkeley packet filter diff --git a/sys/ia64/conf/GENERIC.hints b/sys/ia64/conf/GENERIC.hints deleted file mode 100644 index ee22250..0000000 --- a/sys/ia64/conf/GENERIC.hints +++ /dev/null @@ -1,2 +0,0 @@ -# $FreeBSD$ -hw.uart.console="io:0x3f8" diff --git a/sys/ia64/conf/Makefile b/sys/ia64/conf/Makefile deleted file mode 100644 index 122a7d0..0000000 --- a/sys/ia64/conf/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -TARGET=ia64 - -.include "${.CURDIR}/../../conf/makeLINT.mk" diff --git a/sys/ia64/conf/NOTES b/sys/ia64/conf/NOTES deleted file mode 100644 index b85d6b0..0000000 --- a/sys/ia64/conf/NOTES +++ /dev/null @@ -1,108 +0,0 @@ -# $FreeBSD$ -# -# This file contains machine dependent kernel configuration notes. For -# machine independent notes, look in /sys/conf/NOTES. - -# directive: cpu -# You must specify at least one CPU (the one you intend to run on). Deleting -# the support for CPUs you don't need to use may make parts of the system run -# faster. There's currently no special code for the different CPUs. Note also -# that the cpu declares the family. We may need to add support for specifying -# particular models. -cpu ITANIUM -cpu ITANIUM2 - -# option: COMPAT_FREEBSD32 -# This option enables the support for execution of i386 (32-bit) programs on -# ia64. It is based on the ia32 emulation in the processor. -options COMPAT_FREEBSD32 - -# option: LOG2_ID_PAGE_SIZE -# Specify the log2 size of the identity (direct) mappings in regions 6 and 7 -# of the virtual address space. -options LOG2_ID_PAGE_SIZE=27 # 128M - -# option: LOG2_PAGE_SIZE -# Specify the log2 size of the page to be used for virtual memory management. -# The page size being equal to 1<<LOG2_PAGE_SIZE. -options LOG2_PAGE_SIZE=14 # 16K - -# option: UWX_TRACE_ENABLE -# Build the unwinder with tracing support. This option is used to debug the -# unwinder itself and the glue around it. -options UWX_TRACE_ENABLE - -# MI options -options ACPI_DEBUG -options KSTACK_PAGES=3 - -device acpi - -device agp -device isa -device pci - -# PS/2 mouse -device psm -hint.psm.0.at="atkbdc" -hint.psm.0.irq="12" - -# Options for psm: -options PSM_HOOKRESUME #hook the system resume event, useful - #for some laptops -options PSM_RESETAFTERSUSPEND #reset the device at the resume event - -# The keyboard controller; it controls the keyboard and the PS/2 mouse. -device atkbdc -hint.atkbdc.0.at="isa" -hint.atkbdc.0.port="0x060" - -# The AT keyboard -device atkbd -hint.atkbd.0.at="atkbdc" -hint.atkbd.0.irq="1" - -# Options for atkbd: -options ATKBD_DFLT_KEYMAP # specify the built-in keymap -makeoptions ATKBD_DFLT_KEYMAP=jp.106 - -# `flags' for atkbd: -# 0x01 Force detection of keyboard, else we always assume a keyboard -# 0x02 Don't reset keyboard, useful for some newer ThinkPads -# 0x03 Force detection and avoid reset, might help with certain -# dockingstations -# 0x04 Old-style (XT) keyboard support, useful for older ThinkPads - -# Video card driver for VGA adapters. -device vga -hint.vga.0.at="isa" - -# Options for vga: -# Try the following option if the mouse pointer is not drawn correctly -# or font does not seem to be loaded properly. May cause flicker on -# some systems. -options VGA_ALT_SEQACCESS - -# If you can dispense with some vga driver features, you may want to -# use the following options to save some memory. -#options VGA_NO_FONT_LOADING # don't save/load font -#options VGA_NO_MODE_CHANGE # don't change video modes - -# Older video cards may require this option for proper operation. -options VGA_SLOW_IOACCESS # do byte-wide i/o's to TS and GDC regs - -# The following option probably won't work with the LCD displays. -options VGA_WIDTH90 # support 90 column modes - -# Debugging. -options VGA_DEBUG - -# vt(4) drivers. -device vt_vga - -# AGP debugging. -options AGP_DEBUG - -# The following devices are not supported. -nodevice fdc -nooption FDC_DEBUG diff --git a/sys/ia64/disasm/disasm.h b/sys/ia64/disasm/disasm.h deleted file mode 100644 index 7a94197..0000000 --- a/sys/ia64/disasm/disasm.h +++ /dev/null @@ -1,328 +0,0 @@ -/*- - * Copyright (c) 2000-2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _DISASM_H_ -#define _DISASM_H_ - -#ifndef _DISASM_INT_H_ -#define ASM_ADDITIONAL_OPCODES ASM_OP_NUMBER_OF_OPCODES -#endif - -/* Application registers. */ -#define AR_K0 0 -#define AR_K1 1 -#define AR_K2 2 -#define AR_K3 3 -#define AR_K4 4 -#define AR_K5 5 -#define AR_K6 6 -#define AR_K7 7 -#define AR_RSC 16 -#define AR_BSP 17 -#define AR_BSPSTORE 18 -#define AR_RNAT 19 -#define AR_FCR 21 -#define AR_EFLAG 24 -#define AR_CSD 25 -#define AR_SSD 26 -#define AR_CFLG 27 -#define AR_FSR 28 -#define AR_FIR 29 -#define AR_FDR 30 -#define AR_CCV 32 -#define AR_UNAT 36 -#define AR_FPSR 40 -#define AR_ITC 44 -#define AR_PFS 64 -#define AR_LC 65 -#define AR_EC 66 - -/* Control registers. */ -#define CR_DCR 0 -#define CR_ITM 1 -#define CR_IVA 2 -#define CR_PTA 8 -#define CR_IPSR 16 -#define CR_ISR 17 -#define CR_IIP 19 -#define CR_IFA 20 -#define CR_ITIR 21 -#define CR_IIPA 22 -#define CR_IFS 23 -#define CR_IIM 24 -#define CR_IHA 25 -#define CR_LID 64 -#define CR_IVR 65 -#define CR_TPR 66 -#define CR_EOI 67 -#define CR_IRR0 68 -#define CR_IRR1 69 -#define CR_IRR2 70 -#define CR_IRR3 71 -#define CR_ITV 72 -#define CR_PMV 73 -#define CR_CMCV 74 -#define CR_LRR0 80 -#define CR_LRR1 81 - -enum asm_cmpltr_class { - ASM_CC_NONE, - ASM_CC_ACLR, - ASM_CC_BSW, ASM_CC_BTYPE, ASM_CC_BWH, - ASM_CC_CHK, ASM_CC_CLRRRB, ASM_CC_CREL, ASM_CC_CTYPE, - ASM_CC_DEP, ASM_CC_DH, - ASM_CC_FC, ASM_CC_FCREL, ASM_CC_FCTYPE, ASM_CC_FCVT, ASM_CC_FLDTYPE, - ASM_CC_FMERGE, ASM_CC_FREL, ASM_CC_FSWAP, - ASM_CC_GETF, - ASM_CC_IH, ASM_CC_INVALA, ASM_CC_IPWH, ASM_CC_ITC, ASM_CC_ITR, - ASM_CC_LDHINT, ASM_CC_LDTYPE, ASM_CC_LFETCH, ASM_CC_LFHINT, - ASM_CC_LFTYPE, ASM_CC_LR, - ASM_CC_MF, ASM_CC_MOV, ASM_CC_MWH, - ASM_CC_PAVG, ASM_CC_PC, ASM_CC_PH, ASM_CC_PREL, ASM_CC_PRTYPE, - ASM_CC_PTC, ASM_CC_PTR, ASM_CC_PVEC, - ASM_CC_SAT, ASM_CC_SEM, ASM_CC_SETF, ASM_CC_SF, ASM_CC_SRLZ, - ASM_CC_STHINT, ASM_CC_STTYPE, ASM_CC_SYNC, - ASM_CC_RW, - ASM_CC_TREL, ASM_CC_TRUNC, - ASM_CC_UNIT, ASM_CC_UNPACK, ASM_CC_UNS, - ASM_CC_VMSW, - ASM_CC_XMA -}; - -enum asm_cmpltr_type { - ASM_CT_NONE, - ASM_CT_COND = ASM_CT_NONE, - - ASM_CT_0, ASM_CT_1, - ASM_CT_A, ASM_CT_ACQ, ASM_CT_AND, - ASM_CT_B, ASM_CT_BIAS, - ASM_CT_C_CLR, ASM_CT_C_CLR_ACQ, ASM_CT_C_NC, ASM_CT_CALL, - ASM_CT_CEXIT, ASM_CT_CLOOP, ASM_CT_CLR, ASM_CT_CTOP, - ASM_CT_D, ASM_CT_DC_DC, ASM_CT_DC_NT, ASM_CT_DPNT, ASM_CT_DPTK, - ASM_CT_E, ASM_CT_EQ, ASM_CT_EXCL, ASM_CT_EXIT, ASM_CT_EXP, - ASM_CT_F, ASM_CT_FAULT, ASM_CT_FEW, ASM_CT_FILL, ASM_CT_FX, ASM_CT_FXU, - ASM_CT_G, ASM_CT_GA, ASM_CT_GE, ASM_CT_GT, - ASM_CT_H, ASM_CT_HU, - ASM_CT_I, ASM_CT_IA, ASM_CT_IMP, - ASM_CT_L, ASM_CT_LE, ASM_CT_LOOP, ASM_CT_LR, ASM_CT_LT, ASM_CT_LTU, - ASM_CT_M, ASM_CT_MANY, - ASM_CT_NC, ASM_CT_NE, ASM_CT_NEQ, ASM_CT_NL, ASM_CT_NLE, ASM_CT_NLT, - ASM_CT_NM, ASM_CT_NR, ASM_CT_NS, ASM_CT_NT_DC, ASM_CT_NT_NT, - ASM_CT_NT_TK, ASM_CT_NT1, ASM_CT_NT2, ASM_CT_NTA, ASM_CT_NZ, - ASM_CT_OR, ASM_CT_OR_ANDCM, ASM_CT_ORD, - ASM_CT_PR, - ASM_CT_R, ASM_CT_RAZ, ASM_CT_REL, ASM_CT_RET, ASM_CT_RW, - ASM_CT_S, ASM_CT_S0, ASM_CT_S1, ASM_CT_S2, ASM_CT_S3, ASM_CT_SA, - ASM_CT_SE, ASM_CT_SIG, ASM_CT_SPILL, ASM_CT_SPNT, ASM_CT_SPTK, - ASM_CT_SSS, - ASM_CT_TK_DC, ASM_CT_TK_NT, ASM_CT_TK_TK, ASM_CT_TRUNC, - ASM_CT_U, ASM_CT_UNC, ASM_CT_UNORD, ASM_CT_USS, ASM_CT_UUS, ASM_CT_UUU, - ASM_CT_W, ASM_CT_WEXIT, ASM_CT_WTOP, - ASM_CT_X, ASM_CT_XF, - ASM_CT_Z, -}; - -/* Completer. */ -struct asm_cmpltr { - enum asm_cmpltr_class c_class; - enum asm_cmpltr_type c_type; -}; - -/* Operand types. */ -enum asm_oper_type { - ASM_OPER_NONE, - ASM_OPER_AREG, /* = ar# */ - ASM_OPER_BREG, /* = b# */ - ASM_OPER_CPUID, /* = cpuid[r#] */ - ASM_OPER_CREG, /* = cr# */ - ASM_OPER_DBR, /* = dbr[r#] */ - ASM_OPER_DISP, /* IP relative displacement. */ - ASM_OPER_DTR, /* = dtr[r#] */ - ASM_OPER_FREG, /* = f# */ - ASM_OPER_GREG, /* = r# */ - ASM_OPER_IBR, /* = ibr[r#] */ - ASM_OPER_IMM, /* Immediate */ - ASM_OPER_IP, /* = ip */ - ASM_OPER_ITR, /* = itr[r#] */ - ASM_OPER_MEM, /* = [r#] */ - ASM_OPER_MSR, /* = msr[r#] */ - ASM_OPER_PKR, /* = pkr[r#] */ - ASM_OPER_PMC, /* = pmc[r#] */ - ASM_OPER_PMD, /* = pmd[r#] */ - ASM_OPER_PR, /* = pr */ - ASM_OPER_PR_ROT, /* = pr.rot */ - ASM_OPER_PREG, /* = p# */ - ASM_OPER_PSR, /* = psr */ - ASM_OPER_PSR_L, /* = psr.l */ - ASM_OPER_PSR_UM, /* = psr.um */ - ASM_OPER_RR /* = rr[r#] */ -}; - -/* Operand */ -struct asm_oper { - enum asm_oper_type o_type; - uint64_t o_value; -}; - -/* Instruction formats. */ -enum asm_fmt { - ASM_FMT_NONE, - ASM_FMT_A = 0x0100, - ASM_FMT_A1, ASM_FMT_A2, ASM_FMT_A3, ASM_FMT_A4, - ASM_FMT_A5, ASM_FMT_A6, ASM_FMT_A7, ASM_FMT_A8, - ASM_FMT_A9, ASM_FMT_A10, - ASM_FMT_B = 0x0200, - ASM_FMT_B1, ASM_FMT_B2, ASM_FMT_B3, ASM_FMT_B4, - ASM_FMT_B5, ASM_FMT_B6, ASM_FMT_B7, ASM_FMT_B8, - ASM_FMT_B9, - ASM_FMT_F = 0x0300, - ASM_FMT_F1, ASM_FMT_F2, ASM_FMT_F3, ASM_FMT_F4, - ASM_FMT_F5, ASM_FMT_F6, ASM_FMT_F7, ASM_FMT_F8, - ASM_FMT_F9, ASM_FMT_F10, ASM_FMT_F11, ASM_FMT_F12, - ASM_FMT_F13, ASM_FMT_F14, ASM_FMT_F15, ASM_FMT_F16, - ASM_FMT_I = 0x0400, - ASM_FMT_I1, ASM_FMT_I2, ASM_FMT_I3, ASM_FMT_I4, - ASM_FMT_I5, ASM_FMT_I6, ASM_FMT_I7, ASM_FMT_I8, - ASM_FMT_I9, ASM_FMT_I10, ASM_FMT_I11, ASM_FMT_I12, - ASM_FMT_I13, ASM_FMT_I14, ASM_FMT_I15, ASM_FMT_I16, - ASM_FMT_I17, ASM_FMT_I18, ASM_FMT_I19, ASM_FMT_I20, - ASM_FMT_I21, ASM_FMT_I22, ASM_FMT_I23, ASM_FMT_I24, - ASM_FMT_I25, ASM_FMT_I26, ASM_FMT_I27, ASM_FMT_I28, - ASM_FMT_I29, ASM_FMT_I30, - ASM_FMT_M = 0x0500, - ASM_FMT_M1, ASM_FMT_M2, ASM_FMT_M3, ASM_FMT_M4, - ASM_FMT_M5, ASM_FMT_M6, ASM_FMT_M7, ASM_FMT_M8, - ASM_FMT_M9, ASM_FMT_M10, ASM_FMT_M11, ASM_FMT_M12, - ASM_FMT_M13, ASM_FMT_M14, ASM_FMT_M15, ASM_FMT_M16, - ASM_FMT_M17, ASM_FMT_M18, ASM_FMT_M19, ASM_FMT_M20, - ASM_FMT_M21, ASM_FMT_M22, ASM_FMT_M23, ASM_FMT_M24, - ASM_FMT_M25, ASM_FMT_M26, ASM_FMT_M27, ASM_FMT_M28, - ASM_FMT_M29, ASM_FMT_M30, ASM_FMT_M31, ASM_FMT_M32, - ASM_FMT_M33, ASM_FMT_M34, ASM_FMT_M35, ASM_FMT_M36, - ASM_FMT_M37, ASM_FMT_M38, ASM_FMT_M39, ASM_FMT_M40, - ASM_FMT_M41, ASM_FMT_M42, ASM_FMT_M43, ASM_FMT_M44, - ASM_FMT_M45, ASM_FMT_M46, ASM_FMT_M47, ASM_FMT_M48, - ASM_FMT_X = 0x0600, - ASM_FMT_X1, ASM_FMT_X2, ASM_FMT_X3, ASM_FMT_X4, - ASM_FMT_X5 -}; - -/* Instruction opcodes. */ -enum asm_op { - ASM_OP_NONE, - ASM_OP_ADD, ASM_OP_ADDL, ASM_OP_ADDP4, ASM_OP_ADDS, ASM_OP_ALLOC, - ASM_OP_AND, ASM_OP_ANDCM, - ASM_OP_BR, ASM_OP_BREAK, ASM_OP_BRL, ASM_OP_BRP, ASM_OP_BSW, - ASM_OP_CHK, ASM_OP_CLRRRB, ASM_OP_CMP, ASM_OP_CMP4, ASM_OP_CMP8XCHG16, - ASM_OP_CMPXCHG1, ASM_OP_CMPXCHG2, ASM_OP_CMPXCHG4, ASM_OP_CMPXCHG8, - ASM_OP_COVER, ASM_OP_CZX1, ASM_OP_CZX2, - ASM_OP_DEP, - ASM_OP_EPC, ASM_OP_EXTR, - ASM_OP_FAMAX, ASM_OP_FAMIN, ASM_OP_FAND, ASM_OP_FANDCM, ASM_OP_FC, - ASM_OP_FCHKF, ASM_OP_FCLASS, ASM_OP_FCLRF, ASM_OP_FCMP, ASM_OP_FCVT, - ASM_OP_FETCHADD4, ASM_OP_FETCHADD8, ASM_OP_FLUSHRS, ASM_OP_FMA, - ASM_OP_FMAX, ASM_OP_FMERGE, ASM_OP_FMIN, ASM_OP_FMIX, ASM_OP_FMS, - ASM_OP_FNMA, ASM_OP_FOR, ASM_OP_FPACK, ASM_OP_FPAMAX, ASM_OP_FPAMIN, - ASM_OP_FPCMP, ASM_OP_FPCVT, ASM_OP_FPMA, ASM_OP_FPMAX, ASM_OP_FPMERGE, - ASM_OP_FPMIN, ASM_OP_FPMS, ASM_OP_FPNMA, ASM_OP_FPRCPA, - ASM_OP_FPRSQRTA, ASM_OP_FRCPA, ASM_OP_FRSQRTA, ASM_OP_FSELECT, - ASM_OP_FSETC, ASM_OP_FSWAP, ASM_OP_FSXT, ASM_OP_FWB, ASM_OP_FXOR, - ASM_OP_GETF, - ASM_OP_HINT, - ASM_OP_INVALA, ASM_OP_ITC, ASM_OP_ITR, - ASM_OP_LD1, ASM_OP_LD16, ASM_OP_LD2, ASM_OP_LD4, ASM_OP_LD8, - ASM_OP_LDF, ASM_OP_LDF8, ASM_OP_LDFD, ASM_OP_LDFE, ASM_OP_LDFP8, - ASM_OP_LDFPD, ASM_OP_LDFPS, ASM_OP_LDFS, ASM_OP_LFETCH, ASM_OP_LOADRS, - ASM_OP_MF, ASM_OP_MIX1, ASM_OP_MIX2, ASM_OP_MIX4, ASM_OP_MOV, - ASM_OP_MOVL, ASM_OP_MUX1, ASM_OP_MUX2, - ASM_OP_NOP, - ASM_OP_OR, - ASM_OP_PACK2, ASM_OP_PACK4, ASM_OP_PADD1, ASM_OP_PADD2, ASM_OP_PADD4, - ASM_OP_PAVG1, ASM_OP_PAVG2, ASM_OP_PAVGSUB1, ASM_OP_PAVGSUB2, - ASM_OP_PCMP1, ASM_OP_PCMP2, ASM_OP_PCMP4, ASM_OP_PMAX1, ASM_OP_PMAX2, - ASM_OP_PMIN1, ASM_OP_PMIN2, ASM_OP_PMPY2, ASM_OP_PMPYSHR2, - ASM_OP_POPCNT, ASM_OP_PROBE, ASM_OP_PSAD1, ASM_OP_PSHL2, ASM_OP_PSHL4, - ASM_OP_PSHLADD2, ASM_OP_PSHR2, ASM_OP_PSHR4, ASM_OP_PSHRADD2, - ASM_OP_PSUB1, ASM_OP_PSUB2, ASM_OP_PSUB4, ASM_OP_PTC, ASM_OP_PTR, - ASM_OP_RFI, ASM_OP_RSM, ASM_OP_RUM, - ASM_OP_SETF, ASM_OP_SHL, ASM_OP_SHLADD, ASM_OP_SHLADDP4, ASM_OP_SHR, - ASM_OP_SHRP, ASM_OP_SRLZ, ASM_OP_SSM, ASM_OP_ST1, ASM_OP_ST16, - ASM_OP_ST2, ASM_OP_ST4, ASM_OP_ST8, ASM_OP_STF, ASM_OP_STF8, - ASM_OP_STFD, ASM_OP_STFE, ASM_OP_STFS, ASM_OP_SUB, ASM_OP_SUM, - ASM_OP_SXT1, ASM_OP_SXT2, ASM_OP_SXT4, ASM_OP_SYNC, - ASM_OP_TAK, ASM_OP_TBIT, ASM_OP_TF, ASM_OP_THASH, ASM_OP_TNAT, - ASM_OP_TPA, ASM_OP_TTAG, - ASM_OP_UNPACK1, ASM_OP_UNPACK2, ASM_OP_UNPACK4, - ASM_OP_VMSW, - ASM_OP_XCHG1, ASM_OP_XCHG2, ASM_OP_XCHG4, ASM_OP_XCHG8, ASM_OP_XMA, - ASM_OP_XOR, - ASM_OP_ZXT1, ASM_OP_ZXT2, ASM_OP_ZXT4, - /* Additional opcodes used only internally. */ - ASM_ADDITIONAL_OPCODES -}; - -/* Instruction. */ -struct asm_inst { - uint64_t i_bits; - struct asm_oper i_oper[7]; - struct asm_cmpltr i_cmpltr[5]; - enum asm_fmt i_format; - enum asm_op i_op; - int i_ncmpltrs; - int i_srcidx; -}; - -struct asm_bundle { - const char *b_templ; - struct asm_inst b_inst[3]; -}; - -/* Functional units. */ -enum asm_unit { - ASM_UNIT_NONE, - ASM_UNIT_A = 0x0100, /* A unit. */ - ASM_UNIT_B = 0x0200, /* B unit. */ - ASM_UNIT_F = 0x0300, /* F unit. */ - ASM_UNIT_I = 0x0400, /* I unit. */ - ASM_UNIT_M = 0x0500, /* M unit. */ - ASM_UNIT_X = 0x0600 /* X unit. */ -}; - -#ifdef _DISASM_INT_H_ -int asm_extract(enum asm_op, enum asm_fmt, uint64_t, struct asm_bundle *, int); -#endif - -int asm_decode(uint64_t, struct asm_bundle *); - -void asm_completer(const struct asm_cmpltr *, char *); -void asm_mnemonic(const enum asm_op, char *); -void asm_operand(const struct asm_oper *, char *, uint64_t); -void asm_print_bundle(const struct asm_bundle *, uint64_t); -void asm_print_inst(const struct asm_bundle *, int, uint64_t); - -#endif /* _DISASM_H_ */ diff --git a/sys/ia64/disasm/disasm_decode.c b/sys/ia64/disasm/disasm_decode.c deleted file mode 100644 index 0359e44..0000000 --- a/sys/ia64/disasm/disasm_decode.c +++ /dev/null @@ -1,2565 +0,0 @@ -/*- - * Copyright (c) 2000-2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> - -#include <ia64/disasm/disasm_int.h> -#include <ia64/disasm/disasm.h> - -/* - * Template names. - */ -static const char *asm_templname[] = { - "MII", "MII;", "MI;I", "MI;I;", "MLX", "MLX;", 0, 0, - "MMI", "MMI;", "M;MI", "M;MI;", "MFI", "MFI;", "MMF", "MMF;", - "MIB", "MIB;", "MBB", "MBB;", 0, 0, "BBB", "BBB;", - "MMB", "MMB;", 0, 0, "MFB", "MFB;", 0, 0 -}; - -/* - * Decode A-unit instructions. - */ -static int -asm_decodeA(uint64_t bits, struct asm_bundle *b, int slot) -{ - enum asm_fmt fmt; - enum asm_op op; - - fmt = ASM_FMT_NONE, op = ASM_OP_NONE; - switch((int)OPCODE(bits)) { - case 0x8: - switch (FIELD(bits, 34, 2)) { /* x2a */ - case 0x0: - if (FIELD(bits, 33, 1) == 0) { /* ve */ - switch (FIELD(bits, 29, 4)) { /* x4 */ - case 0x0: - if (FIELD(bits, 27, 2) <= 1) /* x2b */ - op = ASM_OP_ADD, - fmt = ASM_FMT_A1; - break; - case 0x1: - if (FIELD(bits, 27, 2) <= 1) /* x2b */ - op = ASM_OP_SUB, - fmt = ASM_FMT_A1; - break; - case 0x2: - if (FIELD(bits, 27, 2) == 0) /* x2b */ - op = ASM_OP_ADDP4, - fmt = ASM_FMT_A1; - break; - case 0x3: - switch (FIELD(bits, 27, 2)) { /* x2b */ - case 0x0: - op = ASM_OP_AND, - fmt = ASM_FMT_A1; - break; - case 0x1: - op = ASM_OP_ANDCM, - fmt = ASM_FMT_A1; - break; - case 0x2: - op = ASM_OP_OR, - fmt = ASM_FMT_A1; - break; - case 0x3: - op = ASM_OP_XOR, - fmt = ASM_FMT_A1; - break; - } - break; - case 0xB: - switch (FIELD(bits, 27, 2)) { /* x2b */ - case 0x0: - op = ASM_OP_AND, - fmt = ASM_FMT_A3; - break; - case 0x1: - op = ASM_OP_ANDCM, - fmt = ASM_FMT_A3; - break; - case 0x2: - op = ASM_OP_OR, - fmt = ASM_FMT_A3; - break; - case 0x3: - op = ASM_OP_XOR, - fmt = ASM_FMT_A3; - break; - } - break; - case 0x4: - op = ASM_OP_SHLADD, fmt = ASM_FMT_A2; - break; - case 0x6: - op = ASM_OP_SHLADDP4, fmt = ASM_FMT_A2; - break; - case 0x9: - if (FIELD(bits, 27, 2) == 1) /* x2b */ - op = ASM_OP_SUB, - fmt = ASM_FMT_A3; - break; - } - } - break; - case 0x1: - switch (FIELD(bits, 29, 8)) { /* za + x2a + zb + x4 */ - case 0x20: - switch (FIELD(bits, 27, 2)) { /* x2b */ - case 0x0: - op = ASM_OP_PADD1_, fmt = ASM_FMT_A9; - break; - case 0x1: - op = ASM_OP_PADD1_SSS, - fmt = ASM_FMT_A9; - break; - case 0x2: - op = ASM_OP_PADD1_UUU, - fmt = ASM_FMT_A9; - break; - case 0x3: - op = ASM_OP_PADD1_UUS, - fmt = ASM_FMT_A9; - break; - } - break; - case 0x21: - switch (FIELD(bits, 27, 2)) { /* x2b */ - case 0x0: - op = ASM_OP_PSUB1_, fmt = ASM_FMT_A9; - break; - case 0x1: - op = ASM_OP_PSUB1_SSS, - fmt = ASM_FMT_A9; - break; - case 0x2: - op = ASM_OP_PSUB1_UUU, - fmt = ASM_FMT_A9; - break; - case 0x3: - op = ASM_OP_PSUB1_UUS, - fmt = ASM_FMT_A9; - break; - } - break; - case 0x22: - switch (FIELD(bits, 27, 2)) { /* x2b */ - case 0x2: - op = ASM_OP_PAVG1_, fmt = ASM_FMT_A9; - break; - case 0x3: - op = ASM_OP_PAVG1_RAZ, - fmt = ASM_FMT_A9; - break; - } - break; - case 0x23: - if (FIELD(bits, 27, 2) == 2) /* x2b */ - op = ASM_OP_PAVGSUB1, fmt = ASM_FMT_A9; - break; - case 0x29: - switch (FIELD(bits, 27, 2)) { /* x2b */ - case 0x0: - op = ASM_OP_PCMP1_EQ, fmt = ASM_FMT_A9; - break; - case 0x1: - op = ASM_OP_PCMP1_GT, fmt = ASM_FMT_A9; - break; - } - break; - case 0x30: - switch (FIELD(bits, 27, 2)) { /* x2b */ - case 0x0: - op = ASM_OP_PADD2_, fmt = ASM_FMT_A9; - break; - case 0x1: - op = ASM_OP_PADD2_SSS, - fmt = ASM_FMT_A9; - break; - case 0x2: - op = ASM_OP_PADD2_UUU, - fmt = ASM_FMT_A9; - break; - case 0x3: - op = ASM_OP_PADD2_UUS, - fmt = ASM_FMT_A9; - break; - } - break; - case 0x31: - switch (FIELD(bits, 27, 2)) { /* x2b */ - case 0x0: - op = ASM_OP_PSUB2_, fmt = ASM_FMT_A9; - break; - case 0x1: - op = ASM_OP_PSUB2_SSS, - fmt = ASM_FMT_A9; - break; - case 0x2: - op = ASM_OP_PSUB2_UUU, - fmt = ASM_FMT_A9; - break; - case 0x3: - op = ASM_OP_PSUB2_UUS, - fmt = ASM_FMT_A9; - break; - } - break; - case 0x32: - switch (FIELD(bits, 27, 2)) { /* x2b */ - case 0x2: - op = ASM_OP_PAVG2_, fmt = ASM_FMT_A9; - break; - case 0x3: - op = ASM_OP_PAVG2_RAZ, - fmt = ASM_FMT_A9; - break; - } - break; - case 0x33: - if (FIELD(bits, 27, 2) == 2) /* x2b */ - op = ASM_OP_PAVGSUB2, fmt = ASM_FMT_A9; - break; - case 0x34: - op = ASM_OP_PSHLADD2, fmt = ASM_FMT_A10; - break; - case 0x36: - op = ASM_OP_PSHRADD2, fmt = ASM_FMT_A10; - break; - case 0x39: - switch (FIELD(bits, 27, 2)) { /* x2b */ - case 0x0: - op = ASM_OP_PCMP2_EQ, fmt = ASM_FMT_A9; - break; - case 0x1: - op = ASM_OP_PCMP2_GT, fmt = ASM_FMT_A9; - break; - } - break; - case 0xA0: - if (FIELD(bits, 27, 2) == 0) /* x2b */ - op = ASM_OP_PADD4, fmt = ASM_FMT_A9; - break; - case 0xA1: - if (FIELD(bits, 27, 2) == 0) /* x2b */ - op = ASM_OP_PSUB4, fmt = ASM_FMT_A9; - break; - case 0xA9: - switch (FIELD(bits, 27, 2)) { /* x2b */ - case 0x0: - op = ASM_OP_PCMP4_EQ, fmt = ASM_FMT_A9; - break; - case 0x1: - op = ASM_OP_PCMP4_GT, fmt = ASM_FMT_A9; - break; - } - break; - } - break; - case 0x2: - if (FIELD(bits, 33, 1) == 0) /* ve */ - op = ASM_OP_ADDS, fmt = ASM_FMT_A4; - break; - case 0x3: - if (FIELD(bits, 33, 1) == 0) /* ve */ - op = ASM_OP_ADDP4, fmt = ASM_FMT_A4; - break; - } - break; - case 0x9: - op = ASM_OP_ADDL, fmt = ASM_FMT_A5; - break; - case 0xC: case 0xD: case 0xE: - if (FIELD(bits, 12, 1) == 0) { /* c */ - switch (FIELD(bits, 33, 8)) { /* maj + tb + x2 + ta */ - case 0xC0: - op = ASM_OP_CMP_LT, fmt = ASM_FMT_A6; - break; - case 0xC1: - op = ASM_OP_CMP_EQ_AND, fmt = ASM_FMT_A6; - break; - case 0xC2: - op = ASM_OP_CMP4_LT, fmt = ASM_FMT_A6; - break; - case 0xC3: - op = ASM_OP_CMP4_EQ_AND, fmt = ASM_FMT_A6; - break; - case 0xC4: case 0xCC: - op = ASM_OP_CMP_LT, fmt = ASM_FMT_A8; - break; - case 0xC5: case 0xCD: - op = ASM_OP_CMP_EQ_AND, fmt = ASM_FMT_A8; - break; - case 0xC6: case 0xCE: - op = ASM_OP_CMP4_LT, fmt = ASM_FMT_A8; - break; - case 0xC7: case 0xCF: - op = ASM_OP_CMP4_EQ_AND, fmt = ASM_FMT_A8; - break; - case 0xC8: - op = ASM_OP_CMP_GT_AND, fmt = ASM_FMT_A7; - break; - case 0xC9: - op = ASM_OP_CMP_GE_AND, fmt = ASM_FMT_A7; - break; - case 0xCA: - op = ASM_OP_CMP4_GT_AND, fmt = ASM_FMT_A7; - break; - case 0xCB: - op = ASM_OP_CMP4_GE_AND, fmt = ASM_FMT_A7; - break; - case 0xD0: - op = ASM_OP_CMP_LTU, fmt = ASM_FMT_A6; - break; - case 0xD1: - op = ASM_OP_CMP_EQ_OR, fmt = ASM_FMT_A6; - break; - case 0xD2: - op = ASM_OP_CMP4_LTU, fmt = ASM_FMT_A6; - break; - case 0xD3: - op = ASM_OP_CMP4_EQ_OR, fmt = ASM_FMT_A6; - break; - case 0xD4: case 0xDC: - op = ASM_OP_CMP_LTU, fmt = ASM_FMT_A8; - break; - case 0xD5: case 0xDD: - op = ASM_OP_CMP_EQ_OR, fmt = ASM_FMT_A8; - break; - case 0xD6: case 0xDE: - op = ASM_OP_CMP4_LTU, fmt = ASM_FMT_A8; - break; - case 0xD7: case 0xDF: - op = ASM_OP_CMP4_EQ_OR, fmt = ASM_FMT_A8; - break; - case 0xD8: - op = ASM_OP_CMP_GT_OR, fmt = ASM_FMT_A7; - break; - case 0xD9: - op = ASM_OP_CMP_GE_OR, fmt = ASM_FMT_A7; - break; - case 0xDA: - op = ASM_OP_CMP4_GT_OR, fmt = ASM_FMT_A7; - break; - case 0xDB: - op = ASM_OP_CMP4_GE_OR, fmt = ASM_FMT_A7; - break; - case 0xE0: - op = ASM_OP_CMP_EQ, fmt = ASM_FMT_A6; - break; - case 0xE1: - op = ASM_OP_CMP_EQ_OR_ANDCM, fmt = ASM_FMT_A6; - break; - case 0xE2: - op = ASM_OP_CMP4_EQ, fmt = ASM_FMT_A6; - break; - case 0xE3: - op = ASM_OP_CMP4_EQ_OR_ANDCM, fmt = ASM_FMT_A6; - break; - case 0xE4: case 0xEC: - op = ASM_OP_CMP_EQ, fmt = ASM_FMT_A8; - break; - case 0xE5: case 0xED: - op = ASM_OP_CMP_EQ_OR_ANDCM, fmt = ASM_FMT_A8; - break; - case 0xE6: case 0xEE: - op = ASM_OP_CMP4_EQ, fmt = ASM_FMT_A8; - break; - case 0xE7: case 0xEF: - op = ASM_OP_CMP4_EQ_OR_ANDCM, fmt = ASM_FMT_A8; - break; - case 0xE8: - op = ASM_OP_CMP_GT_OR_ANDCM, fmt = ASM_FMT_A7; - break; - case 0xE9: - op = ASM_OP_CMP_GE_OR_ANDCM, fmt = ASM_FMT_A7; - break; - case 0xEA: - op = ASM_OP_CMP4_GT_OR_ANDCM, fmt = ASM_FMT_A7; - break; - case 0xEB: - op = ASM_OP_CMP4_GE_OR_ANDCM, fmt = ASM_FMT_A7; - break; - } - } else { - switch (FIELD(bits, 33, 8)) { /* maj + tb + x2 + ta */ - case 0xC0: - op = ASM_OP_CMP_LT_UNC, fmt = ASM_FMT_A6; - break; - case 0xC1: - op = ASM_OP_CMP_NE_AND, fmt = ASM_FMT_A6; - break; - case 0xC2: - op = ASM_OP_CMP4_LT_UNC, fmt = ASM_FMT_A6; - break; - case 0xC3: - op = ASM_OP_CMP4_NE_AND, fmt = ASM_FMT_A6; - break; - case 0xC4: case 0xCC: - op = ASM_OP_CMP_LT_UNC, fmt = ASM_FMT_A8; - break; - case 0xC5: case 0xCD: - op = ASM_OP_CMP_NE_AND, fmt = ASM_FMT_A8; - break; - case 0xC6: case 0xCE: - op = ASM_OP_CMP4_LT_UNC, fmt = ASM_FMT_A8; - break; - case 0xC7: case 0xCF: - op = ASM_OP_CMP4_NE_AND, fmt = ASM_FMT_A8; - break; - case 0xC8: - op = ASM_OP_CMP_LE_AND, fmt = ASM_FMT_A7; - break; - case 0xC9: - op = ASM_OP_CMP_LT_AND, fmt = ASM_FMT_A7; - break; - case 0xCA: - op = ASM_OP_CMP4_LE_AND, fmt = ASM_FMT_A7; - break; - case 0xCB: - op = ASM_OP_CMP4_LT_AND, fmt = ASM_FMT_A7; - break; - case 0xD0: - op = ASM_OP_CMP_LTU_UNC, fmt = ASM_FMT_A6; - break; - case 0xD1: - op = ASM_OP_CMP_NE_OR, fmt = ASM_FMT_A6; - break; - case 0xD2: - op = ASM_OP_CMP4_LTU_UNC, fmt = ASM_FMT_A6; - break; - case 0xD3: - op = ASM_OP_CMP4_NE_OR, fmt = ASM_FMT_A6; - break; - case 0xD4: case 0xDC: - op = ASM_OP_CMP_LTU_UNC, fmt = ASM_FMT_A8; - break; - case 0xD5: case 0xDD: - op = ASM_OP_CMP_NE_OR, fmt = ASM_FMT_A8; - break; - case 0xD6: case 0xDE: - op = ASM_OP_CMP4_LTU_UNC, fmt = ASM_FMT_A8; - break; - case 0xD7: case 0xDF: - op = ASM_OP_CMP4_NE_OR, fmt = ASM_FMT_A8; - break; - case 0xD8: - op = ASM_OP_CMP_LE_OR, fmt = ASM_FMT_A7; - break; - case 0xD9: - op = ASM_OP_CMP_LT_OR, fmt = ASM_FMT_A7; - break; - case 0xDA: - op = ASM_OP_CMP4_LE_OR, fmt = ASM_FMT_A7; - break; - case 0xDB: - op = ASM_OP_CMP4_LT_OR, fmt = ASM_FMT_A7; - break; - case 0xE0: - op = ASM_OP_CMP_EQ_UNC, fmt = ASM_FMT_A6; - break; - case 0xE1: - op = ASM_OP_CMP_NE_OR_ANDCM, fmt = ASM_FMT_A6; - break; - case 0xE2: - op = ASM_OP_CMP4_EQ_UNC, fmt = ASM_FMT_A6; - break; - case 0xE3: - op = ASM_OP_CMP4_NE_OR_ANDCM, fmt = ASM_FMT_A6; - break; - case 0xE4: case 0xEC: - op = ASM_OP_CMP_EQ_UNC, fmt = ASM_FMT_A8; - break; - case 0xE5: case 0xED: - op = ASM_OP_CMP_NE_OR_ANDCM, fmt = ASM_FMT_A8; - break; - case 0xE6: case 0xEE: - op = ASM_OP_CMP4_EQ_UNC, fmt = ASM_FMT_A8; - break; - case 0xE7: case 0xEF: - op = ASM_OP_CMP4_NE_OR_ANDCM, fmt = ASM_FMT_A8; - break; - case 0xE8: - op = ASM_OP_CMP_LE_OR_ANDCM, fmt = ASM_FMT_A7; - break; - case 0xE9: - op = ASM_OP_CMP_LT_OR_ANDCM, fmt = ASM_FMT_A7; - break; - case 0xEA: - op = ASM_OP_CMP4_LE_OR_ANDCM, fmt = ASM_FMT_A7; - break; - case 0xEB: - op = ASM_OP_CMP4_LT_OR_ANDCM, fmt = ASM_FMT_A7; - break; - } - } - break; - } - - if (op != ASM_OP_NONE) - return (asm_extract(op, fmt, bits, b, slot)); - return (0); -} - -/* - * Decode B-unit instructions. - */ -static int -asm_decodeB(uint64_t ip, struct asm_bundle *b, int slot) -{ - uint64_t bits; - enum asm_fmt fmt; - enum asm_op op; - - bits = SLOT(ip, slot); - fmt = ASM_FMT_NONE, op = ASM_OP_NONE; - - switch((int)OPCODE(bits)) { - case 0x0: - switch (FIELD(bits, 27, 6)) { /* x6 */ - case 0x0: - op = ASM_OP_BREAK_B, fmt = ASM_FMT_B9; - break; - case 0x2: - op = ASM_OP_COVER, fmt = ASM_FMT_B8; - break; - case 0x4: - op = ASM_OP_CLRRRB_, fmt = ASM_FMT_B8; - break; - case 0x5: - op = ASM_OP_CLRRRB_PR, fmt = ASM_FMT_B8; - break; - case 0x8: - op = ASM_OP_RFI, fmt = ASM_FMT_B8; - break; - case 0xC: - op = ASM_OP_BSW_0, fmt = ASM_FMT_B8; - break; - case 0xD: - op = ASM_OP_BSW_1, fmt = ASM_FMT_B8; - break; - case 0x10: - op = ASM_OP_EPC, fmt = ASM_FMT_B8; - break; - case 0x18: - op = ASM_OP_VMSW_0, fmt = ASM_FMT_B8; - break; - case 0x19: - op = ASM_OP_VMSW_1, fmt = ASM_FMT_B8; - break; - case 0x20: - switch (FIELD(bits, 6, 3)) { /* btype */ - case 0x0: - op = ASM_OP_BR_COND, fmt = ASM_FMT_B4; - break; - case 0x1: - op = ASM_OP_BR_IA, fmt = ASM_FMT_B4; - break; - } - break; - case 0x21: - if (FIELD(bits, 6, 3) == 4) /* btype */ - op = ASM_OP_BR_RET, fmt = ASM_FMT_B4; - break; - } - break; - case 0x1: - op = ASM_OP_BR_CALL, fmt = ASM_FMT_B5; - break; - case 0x2: - switch (FIELD(bits, 27, 6)) { /* x6 */ - case 0x0: - op = ASM_OP_NOP_B, fmt = ASM_FMT_B9; - break; - case 0x1: - op = ASM_OP_HINT_B, fmt = ASM_FMT_B9; - break; - case 0x10: - op = ASM_OP_BRP_, fmt = ASM_FMT_B7; - break; - case 0x11: - op = ASM_OP_BRP_RET, fmt = ASM_FMT_B7; - break; - } - break; - case 0x4: - switch (FIELD(bits, 6, 3)) { /* btype */ - case 0x0: - op = ASM_OP_BR_COND, fmt = ASM_FMT_B1; - break; - case 0x2: - op = ASM_OP_BR_WEXIT, fmt = ASM_FMT_B1; - break; - case 0x3: - op = ASM_OP_BR_WTOP, fmt = ASM_FMT_B1; - break; - case 0x5: - op = ASM_OP_BR_CLOOP, fmt = ASM_FMT_B2; - break; - case 0x6: - op = ASM_OP_BR_CEXIT, fmt = ASM_FMT_B2; - break; - case 0x7: - op = ASM_OP_BR_CTOP, fmt = ASM_FMT_B2; - break; - } - break; - case 0x5: - op = ASM_OP_BR_CALL, fmt = ASM_FMT_B3; - break; - case 0x7: - op = ASM_OP_BRP_, fmt = ASM_FMT_B6; - break; - } - - if (op != ASM_OP_NONE) - return (asm_extract(op, fmt, bits, b, slot)); - return (0); -} - -/* - * Decode F-unit instructions. - */ -static int -asm_decodeF(uint64_t ip, struct asm_bundle *b, int slot) -{ - uint64_t bits; - enum asm_fmt fmt; - enum asm_op op; - - bits = SLOT(ip, slot); - fmt = ASM_FMT_NONE, op = ASM_OP_NONE; - - switch((int)OPCODE(bits)) { - case 0x0: - if (FIELD(bits, 33, 1) == 0) { /* x */ - switch (FIELD(bits, 27, 6)) { /* x6 */ - case 0x0: - op = ASM_OP_BREAK_F, fmt = ASM_FMT_F15; - break; - case 0x1: - if (FIELD(bits, 26, 1) == 0) /* y */ - op = ASM_OP_NOP_F, fmt = ASM_FMT_F16; - else - op = ASM_OP_HINT_F, fmt = ASM_FMT_F16; - break; - case 0x4: - op = ASM_OP_FSETC, fmt = ASM_FMT_F12; - break; - case 0x5: - op = ASM_OP_FCLRF, fmt = ASM_FMT_F13; - break; - case 0x8: - op = ASM_OP_FCHKF, fmt = ASM_FMT_F14; - break; - case 0x10: - op = ASM_OP_FMERGE_S, fmt = ASM_FMT_F9; - break; - case 0x11: - op = ASM_OP_FMERGE_NS, fmt = ASM_FMT_F9; - break; - case 0x12: - op = ASM_OP_FMERGE_SE, fmt = ASM_FMT_F9; - break; - case 0x14: - op = ASM_OP_FMIN, fmt = ASM_FMT_F8; - break; - case 0x15: - op = ASM_OP_FMAX, fmt = ASM_FMT_F8; - break; - case 0x16: - op = ASM_OP_FAMIN, fmt = ASM_FMT_F8; - break; - case 0x17: - op = ASM_OP_FAMAX, fmt = ASM_FMT_F8; - break; - case 0x18: - op = ASM_OP_FCVT_FX, fmt = ASM_FMT_F10; - break; - case 0x19: - op = ASM_OP_FCVT_FXU, fmt = ASM_FMT_F10; - break; - case 0x1A: - op = ASM_OP_FCVT_FX_TRUNC, fmt = ASM_FMT_F10; - break; - case 0x1B: - op = ASM_OP_FCVT_FXU_TRUNC, fmt = ASM_FMT_F10; - break; - case 0x1C: - op = ASM_OP_FCVT_XF, fmt = ASM_FMT_F11; - break; - case 0x28: - op = ASM_OP_FPACK, fmt = ASM_FMT_F9; - break; - case 0x2C: - op = ASM_OP_FAND, fmt = ASM_FMT_F9; - break; - case 0x2D: - op = ASM_OP_FANDCM, fmt = ASM_FMT_F9; - break; - case 0x2E: - op = ASM_OP_FOR, fmt = ASM_FMT_F9; - break; - case 0x2F: - op = ASM_OP_FXOR, fmt = ASM_FMT_F9; - break; - case 0x34: - op = ASM_OP_FSWAP_, fmt = ASM_FMT_F9; - break; - case 0x35: - op = ASM_OP_FSWAP_NL, fmt = ASM_FMT_F9; - break; - case 0x36: - op = ASM_OP_FSWAP_NR, fmt = ASM_FMT_F9; - break; - case 0x39: - op = ASM_OP_FMIX_LR, fmt = ASM_FMT_F9; - break; - case 0x3A: - op = ASM_OP_FMIX_R, fmt = ASM_FMT_F9; - break; - case 0x3B: - op = ASM_OP_FMIX_L, fmt = ASM_FMT_F9; - break; - case 0x3C: - op = ASM_OP_FSXT_R, fmt = ASM_FMT_F9; - break; - case 0x3D: - op = ASM_OP_FSXT_L, fmt = ASM_FMT_F9; - break; - } - } else { - if (FIELD(bits, 36, 1) == 0) /* q */ - op = ASM_OP_FRCPA, fmt = ASM_FMT_F6; - else - op = ASM_OP_FRSQRTA, fmt = ASM_FMT_F7; - } - break; - case 0x1: - if (FIELD(bits, 33, 1) == 0) { /* x */ - switch (FIELD(bits, 27, 6)) { /* x6 */ - case 0x10: - op = ASM_OP_FPMERGE_S, fmt = ASM_FMT_F9; - break; - case 0x11: - op = ASM_OP_FPMERGE_NS, fmt = ASM_FMT_F9; - break; - case 0x12: - op = ASM_OP_FPMERGE_SE, fmt = ASM_FMT_F9; - break; - case 0x14: - op = ASM_OP_FPMIN, fmt = ASM_FMT_F8; - break; - case 0x15: - op = ASM_OP_FPMAX, fmt = ASM_FMT_F8; - break; - case 0x16: - op = ASM_OP_FPAMIN, fmt = ASM_FMT_F8; - break; - case 0x17: - op = ASM_OP_FPAMAX, fmt = ASM_FMT_F8; - break; - case 0x18: - op = ASM_OP_FPCVT_FX, fmt = ASM_FMT_F10; - break; - case 0x19: - op = ASM_OP_FPCVT_FXU, fmt = ASM_FMT_F10; - break; - case 0x1A: - op = ASM_OP_FPCVT_FX_TRUNC, fmt = ASM_FMT_F10; - break; - case 0x1B: - op = ASM_OP_FPCVT_FXU_TRUNC, fmt = ASM_FMT_F10; - break; - case 0x30: - op = ASM_OP_FPCMP_EQ, fmt = ASM_FMT_F8; - break; - case 0x31: - op = ASM_OP_FPCMP_LT, fmt = ASM_FMT_F8; - break; - case 0x32: - op = ASM_OP_FPCMP_LE, fmt = ASM_FMT_F8; - break; - case 0x33: - op = ASM_OP_FPCMP_UNORD, fmt = ASM_FMT_F8; - break; - case 0x34: - op = ASM_OP_FPCMP_NEQ, fmt = ASM_FMT_F8; - break; - case 0x35: - op = ASM_OP_FPCMP_NLT, fmt = ASM_FMT_F8; - break; - case 0x36: - op = ASM_OP_FPCMP_NLE, fmt = ASM_FMT_F8; - break; - case 0x37: - op = ASM_OP_FPCMP_ORD, fmt = ASM_FMT_F8; - break; - } - } else { - if (FIELD(bits, 36, 1) == 0) /* q */ - op = ASM_OP_FPRCPA, fmt = ASM_FMT_F6; - else - op = ASM_OP_FPRSQRTA, fmt = ASM_FMT_F7; - } - break; - case 0x4: - op = ASM_OP_FCMP, fmt = ASM_FMT_F4; - break; - case 0x5: - op = ASM_OP_FCLASS_M, fmt = ASM_FMT_F5; - break; - case 0x8: - if (FIELD(bits, 36, 1) == 0) /* x */ - op = ASM_OP_FMA_, fmt = ASM_FMT_F1; - else - op = ASM_OP_FMA_S, fmt = ASM_FMT_F1; - break; - case 0x9: - if (FIELD(bits, 36, 1) == 0) /* x */ - op = ASM_OP_FMA_D, fmt = ASM_FMT_F1; - else - op = ASM_OP_FPMA, fmt = ASM_FMT_F1; - break; - case 0xA: - if (FIELD(bits, 36, 1) == 0) /* x */ - op = ASM_OP_FMS_, fmt = ASM_FMT_F1; - else - op = ASM_OP_FMS_S, fmt = ASM_FMT_F1; - break; - case 0xB: - if (FIELD(bits, 36, 1) == 0) /* x */ - op = ASM_OP_FMS_D, fmt = ASM_FMT_F1; - else - op = ASM_OP_FPMS, fmt = ASM_FMT_F1; - break; - case 0xC: - if (FIELD(bits, 36, 1) == 0) /* x */ - op = ASM_OP_FNMA_, fmt = ASM_FMT_F1; - else - op = ASM_OP_FNMA_S, fmt = ASM_FMT_F1; - break; - case 0xD: - if (FIELD(bits, 36, 1) == 0) /* x */ - op = ASM_OP_FNMA_D, fmt = ASM_FMT_F1; - else - op = ASM_OP_FPNMA, fmt = ASM_FMT_F1; - break; - case 0xE: - if (FIELD(bits, 36, 1) == 1) { /* x */ - switch (FIELD(bits, 34, 2)) { /* x2 */ - case 0x0: - op = ASM_OP_XMA_L, fmt = ASM_FMT_F2; - break; - case 0x2: - op = ASM_OP_XMA_HU, fmt = ASM_FMT_F2; - break; - case 0x3: - op = ASM_OP_XMA_H, fmt = ASM_FMT_F2; - break; - } - } else - op = ASM_OP_FSELECT, fmt = ASM_FMT_F3; - break; - } - - if (op != ASM_OP_NONE) - return (asm_extract(op, fmt, bits, b, slot)); - return (0); -} - -/* - * Decode I-unit instructions. - */ -static int -asm_decodeI(uint64_t ip, struct asm_bundle *b, int slot) -{ - uint64_t bits; - enum asm_fmt fmt; - enum asm_op op; - - bits = SLOT(ip, slot); - if ((int)OPCODE(bits) >= 8) - return (asm_decodeA(bits, b, slot)); - fmt = ASM_FMT_NONE, op = ASM_OP_NONE; - - switch((int)OPCODE(bits)) { - case 0x0: - switch (FIELD(bits, 33, 3)) { /* x3 */ - case 0x0: - switch (FIELD(bits, 27, 6)) { /* x6 */ - case 0x0: - op = ASM_OP_BREAK_I, fmt = ASM_FMT_I19; - break; - case 0x1: - if (FIELD(bits, 26, 1) == 0) /* y */ - op = ASM_OP_NOP_I, fmt = ASM_FMT_I18; - else - op = ASM_OP_HINT_I, fmt = ASM_FMT_I18; - break; - case 0xA: - op = ASM_OP_MOV_I, fmt = ASM_FMT_I27; - break; - case 0x10: - op = ASM_OP_ZXT1, fmt = ASM_FMT_I29; - break; - case 0x11: - op = ASM_OP_ZXT2, fmt = ASM_FMT_I29; - break; - case 0x12: - op = ASM_OP_ZXT4, fmt = ASM_FMT_I29; - break; - case 0x14: - op = ASM_OP_SXT1, fmt = ASM_FMT_I29; - break; - case 0x15: - op = ASM_OP_SXT2, fmt = ASM_FMT_I29; - break; - case 0x16: - op = ASM_OP_SXT4, fmt = ASM_FMT_I29; - break; - case 0x18: - op = ASM_OP_CZX1_L, fmt = ASM_FMT_I29; - break; - case 0x19: - op = ASM_OP_CZX2_L, fmt = ASM_FMT_I29; - break; - case 0x1C: - op = ASM_OP_CZX1_R, fmt = ASM_FMT_I29; - break; - case 0x1D: - op = ASM_OP_CZX2_R, fmt = ASM_FMT_I29; - break; - case 0x2A: - op = ASM_OP_MOV_I, fmt = ASM_FMT_I26; - break; - case 0x30: - op = ASM_OP_MOV_IP, fmt = ASM_FMT_I25; - break; - case 0x31: - op = ASM_OP_MOV_, fmt = ASM_FMT_I22; - break; - case 0x32: - op = ASM_OP_MOV_I, fmt = ASM_FMT_I28; - break; - case 0x33: - op = ASM_OP_MOV_PR, fmt = ASM_FMT_I25; - break; - } - break; - case 0x1: - op = ASM_OP_CHK_S_I, fmt = ASM_FMT_I20; - break; - case 0x2: - op = ASM_OP_MOV_, fmt = ASM_FMT_I24; - break; - case 0x3: - op = ASM_OP_MOV_, fmt = ASM_FMT_I23; - break; - case 0x7: - if (FIELD(bits, 22, 1) == 0) /* x */ - op = ASM_OP_MOV_, fmt = ASM_FMT_I21; - else - op = ASM_OP_MOV_RET, fmt = ASM_FMT_I21; - break; - } - break; - case 0x4: - op = ASM_OP_DEP_, fmt = ASM_FMT_I15; - break; - case 0x5: - switch (FIELD(bits, 33, 3)) { /* x + x2 */ - case 0x0: - if (FIELD(bits, 36, 1) == 0) { /* tb */ - switch (FIELD(bits, 12, 2)) { /* c + y */ - case 0x0: - op = ASM_OP_TBIT_Z, fmt = ASM_FMT_I16; - break; - case 0x1: - op = ASM_OP_TBIT_Z_UNC, - fmt = ASM_FMT_I16; - break; - case 0x2: - if (FIELD(bits, 19, 1) == 0) /* x */ - op = ASM_OP_TNAT_Z, - fmt = ASM_FMT_I17; - else - op = ASM_OP_TF_Z, - fmt = ASM_FMT_I30; - break; - case 0x3: - if (FIELD(bits, 19, 1) == 0) /* x */ - op = ASM_OP_TNAT_Z_UNC, - fmt = ASM_FMT_I17; - else - op = ASM_OP_TF_Z_UNC, - fmt = ASM_FMT_I30; - break; - } - } else { - switch (FIELD(bits, 12, 2)) { /* c + y */ - case 0x0: - op = ASM_OP_TBIT_Z_AND, - fmt = ASM_FMT_I16; - break; - case 0x1: - op = ASM_OP_TBIT_NZ_AND, - fmt = ASM_FMT_I16; - break; - case 0x2: - if (FIELD(bits, 19, 1) == 0) /* x */ - op = ASM_OP_TNAT_Z_AND, - fmt = ASM_FMT_I17; - else - op = ASM_OP_TF_Z_AND, - fmt = ASM_FMT_I30; - break; - case 0x3: - if (FIELD(bits, 19, 1) == 0) /* x */ - op = ASM_OP_TNAT_NZ_AND, - fmt = ASM_FMT_I17; - else - op = ASM_OP_TF_NZ_AND, - fmt = ASM_FMT_I30; - break; - } - } - break; - case 0x1: - if (FIELD(bits, 36, 1) == 0) { /* tb */ - switch (FIELD(bits, 12, 2)) { /* c + y */ - case 0x0: - op = ASM_OP_TBIT_Z_OR, - fmt = ASM_FMT_I16; - break; - case 0x1: - op = ASM_OP_TBIT_NZ_OR, - fmt = ASM_FMT_I16; - break; - case 0x2: - if (FIELD(bits, 19, 1) == 0) /* x */ - op = ASM_OP_TNAT_Z_OR, - fmt = ASM_FMT_I17; - else - op = ASM_OP_TF_Z_OR, - fmt = ASM_FMT_I30; - break; - case 0x3: - if (FIELD(bits, 19, 1) == 0) /* x */ - op = ASM_OP_TNAT_NZ_OR, - fmt = ASM_FMT_I17; - else - op = ASM_OP_TF_NZ_OR, - fmt = ASM_FMT_I30; - break; - } - } else { - switch (FIELD(bits, 12, 2)) { /* c + y */ - case 0x0: - op = ASM_OP_TBIT_Z_OR_ANDCM, - fmt = ASM_FMT_I16; - break; - case 0x1: - op = ASM_OP_TBIT_NZ_OR_ANDCM, - fmt = ASM_FMT_I16; - break; - case 0x2: - if (FIELD(bits, 19, 1) == 0) /* x */ - op = ASM_OP_TNAT_Z_OR_ANDCM, - fmt = ASM_FMT_I17; - else - op = ASM_OP_TF_Z_OR_ANDCM, - fmt = ASM_FMT_I30; - break; - case 0x3: - if (FIELD(bits, 19, 1) == 0) /* x */ - op = ASM_OP_TNAT_NZ_OR_ANDCM, - fmt = ASM_FMT_I17; - else - op = ASM_OP_TF_NZ_OR_ANDCM, - fmt = ASM_FMT_I30; - break; - } - } - break; - case 0x2: - op = ASM_OP_EXTR, fmt = ASM_FMT_I11; - break; - case 0x3: - if (FIELD(bits, 26, 1) == 0) /* y */ - op = ASM_OP_DEP_Z, fmt = ASM_FMT_I12; - else - op = ASM_OP_DEP_Z, fmt = ASM_FMT_I13; - break; - case 0x6: - op = ASM_OP_SHRP, fmt = ASM_FMT_I10; - break; - case 0x7: - op = ASM_OP_DEP_, fmt = ASM_FMT_I14; - break; - } - break; - case 0x7: - switch (FIELD(bits, 32, 5)) { /* ve + zb + x2a + za */ - case 0x2: - switch (FIELD(bits, 28, 4)) { /* x2b + x2c */ - case 0x0: - op = ASM_OP_PSHR2_U, fmt = ASM_FMT_I5; - break; - case 0x1: case 0x5: case 0x9: case 0xD: - op = ASM_OP_PMPYSHR2_U, fmt = ASM_FMT_I1; - break; - case 0x2: - op = ASM_OP_PSHR2_, fmt = ASM_FMT_I5; - break; - case 0x3: case 0x7: case 0xB: case 0xF: - op = ASM_OP_PMPYSHR2_, fmt = ASM_FMT_I1; - break; - case 0x4: - op = ASM_OP_PSHL2, fmt = ASM_FMT_I7; - break; - } - break; - case 0x6: - switch (FIELD(bits, 28, 4)) { /* x2b + x2c */ - case 0x1: - op = ASM_OP_PSHR2_U, fmt = ASM_FMT_I6; - break; - case 0x3: - op = ASM_OP_PSHR2_, fmt = ASM_FMT_I6; - break; - case 0x9: - op = ASM_OP_POPCNT, fmt = ASM_FMT_I9; - break; - } - break; - case 0x8: - switch (FIELD(bits, 28, 4)) { /* x2b + x2c */ - case 0x1: - op = ASM_OP_PMIN1_U, fmt = ASM_FMT_I2; - break; - case 0x4: - op = ASM_OP_UNPACK1_H, fmt = ASM_FMT_I2; - break; - case 0x5: - op = ASM_OP_PMAX1_U, fmt = ASM_FMT_I2; - break; - case 0x6: - op = ASM_OP_UNPACK1_L, fmt = ASM_FMT_I2; - break; - case 0x8: - op = ASM_OP_MIX1_R, fmt = ASM_FMT_I2; - break; - case 0xA: - op = ASM_OP_MIX1_L, fmt = ASM_FMT_I2; - break; - case 0xB: - op = ASM_OP_PSAD1, fmt = ASM_FMT_I2; - break; - } - break; - case 0xA: - switch (FIELD(bits, 28, 4)) { /* x2b + x2c */ - case 0x0: - op = ASM_OP_PACK2_USS, fmt = ASM_FMT_I2; - break; - case 0x2: - op = ASM_OP_PACK2_SSS, fmt = ASM_FMT_I2; - break; - case 0x3: - op = ASM_OP_PMIN2, fmt = ASM_FMT_I2; - break; - case 0x4: - op = ASM_OP_UNPACK2_H, fmt = ASM_FMT_I2; - break; - case 0x6: - op = ASM_OP_UNPACK2_L, fmt = ASM_FMT_I2; - break; - case 0x7: - op = ASM_OP_PMAX2, fmt = ASM_FMT_I2; - break; - case 0x8: - op = ASM_OP_MIX2_R, fmt = ASM_FMT_I2; - break; - case 0xA: - op = ASM_OP_MIX2_L, fmt = ASM_FMT_I2; - break; - case 0xD: - op = ASM_OP_PMPY2_R, fmt = ASM_FMT_I2; - break; - case 0xF: - op = ASM_OP_PMPY2_L, fmt = ASM_FMT_I2; - break; - } - break; - case 0xC: - switch (FIELD(bits, 28, 4)) { /* x2b + x2c */ - case 0xA: - op = ASM_OP_MUX1, fmt = ASM_FMT_I3; - break; - } - break; - case 0xE: - switch (FIELD(bits, 28, 4)) { /* x2b + x2c */ - case 0x5: - op = ASM_OP_PSHL2, fmt = ASM_FMT_I8; - break; - case 0xA: - op = ASM_OP_MUX2, fmt = ASM_FMT_I4; - break; - } - break; - case 0x10: - switch (FIELD(bits, 28, 4)) { /* x2b + x2c */ - case 0x0: - op = ASM_OP_PSHR4_U, fmt = ASM_FMT_I5; - break; - case 0x2: - op = ASM_OP_PSHR4_, fmt = ASM_FMT_I5; - break; - case 0x4: - op = ASM_OP_PSHL4, fmt = ASM_FMT_I7; - break; - } - break; - case 0x12: - switch (FIELD(bits, 28, 4)) { /* x2b + x2c */ - case 0x0: - op = ASM_OP_SHR_U, fmt = ASM_FMT_I5; - break; - case 0x2: - op = ASM_OP_SHR_, fmt = ASM_FMT_I5; - break; - case 0x4: - op = ASM_OP_SHL, fmt = ASM_FMT_I7; - break; - } - break; - case 0x14: - switch (FIELD(bits, 28, 4)) { /* x2b + x2c */ - case 0x1: - op = ASM_OP_PSHR4_U, fmt = ASM_FMT_I6; - break; - case 0x3: - op = ASM_OP_PSHR4_, fmt = ASM_FMT_I6; - break; - } - break; - case 0x18: - switch (FIELD(bits, 28, 4)) { /* x2b + x2c */ - case 0x2: - op = ASM_OP_PACK4_SSS, fmt = ASM_FMT_I2; - break; - case 0x4: - op = ASM_OP_UNPACK4_H, fmt = ASM_FMT_I2; - break; - case 0x6: - op = ASM_OP_UNPACK4_L, fmt = ASM_FMT_I2; - break; - case 0x8: - op = ASM_OP_MIX4_R, fmt = ASM_FMT_I2; - break; - case 0xA: - op = ASM_OP_MIX4_L, fmt = ASM_FMT_I2; - break; - } - break; - case 0x1C: - switch (FIELD(bits, 28, 4)) { /* x2b + x2c */ - case 0x5: - op = ASM_OP_PSHL4, fmt = ASM_FMT_I8; - break; - } - break; - } - break; - } - - if (op != ASM_OP_NONE) - return (asm_extract(op, fmt, bits, b, slot)); - return (0); -} - -/* - * Decode M-unit instructions. - */ -static int -asm_decodeM(uint64_t ip, struct asm_bundle *b, int slot) -{ - uint64_t bits; - enum asm_fmt fmt; - enum asm_op op; - - bits = SLOT(ip, slot); - if ((int)OPCODE(bits) >= 8) - return (asm_decodeA(bits, b, slot)); - fmt = ASM_FMT_NONE, op = ASM_OP_NONE; - - switch((int)OPCODE(bits)) { - case 0x0: - switch (FIELD(bits, 33, 3)) { /* x3 */ - case 0x0: - switch (FIELD(bits, 27, 6)) { /* x6 (x4 + x2) */ - case 0x0: - op = ASM_OP_BREAK_M, fmt = ASM_FMT_M37; - break; - case 0x1: - if (FIELD(bits, 26, 1) == 0) /* y */ - op = ASM_OP_NOP_M, fmt = ASM_FMT_M48; - else - op = ASM_OP_HINT_M, fmt = ASM_FMT_M48; - break; - case 0x4: case 0x14: case 0x24: case 0x34: - op = ASM_OP_SUM, fmt = ASM_FMT_M44; - break; - case 0x5: case 0x15: case 0x25: case 0x35: - op = ASM_OP_RUM, fmt = ASM_FMT_M44; - break; - case 0x6: case 0x16: case 0x26: case 0x36: - op = ASM_OP_SSM, fmt = ASM_FMT_M44; - break; - case 0x7: case 0x17: case 0x27: case 0x37: - op = ASM_OP_RSM, fmt = ASM_FMT_M44; - break; - case 0xA: - op = ASM_OP_LOADRS, fmt = ASM_FMT_M25; - break; - case 0xC: - op = ASM_OP_FLUSHRS, fmt = ASM_FMT_M25; - break; - case 0x10: - op = ASM_OP_INVALA_, fmt = ASM_FMT_M24; - break; - case 0x12: - op = ASM_OP_INVALA_E, fmt = ASM_FMT_M26; - break; - case 0x13: - op = ASM_OP_INVALA_E, fmt = ASM_FMT_M27; - break; - case 0x20: - op = ASM_OP_FWB, fmt = ASM_FMT_M24; - break; - case 0x22: - op = ASM_OP_MF_, fmt = ASM_FMT_M24; - break; - case 0x23: - op = ASM_OP_MF_A, fmt = ASM_FMT_M24; - break; - case 0x28: - op = ASM_OP_MOV_M, fmt = ASM_FMT_M30; - break; - case 0x30: - op = ASM_OP_SRLZ_D, fmt = ASM_FMT_M24; - break; - case 0x31: - op = ASM_OP_SRLZ_I, fmt = ASM_FMT_M24; - break; - case 0x33: - op = ASM_OP_SYNC_I, fmt = ASM_FMT_M24; - break; - } - break; - case 0x4: - op = ASM_OP_CHK_A_NC, fmt = ASM_FMT_M22; - break; - case 0x5: - op = ASM_OP_CHK_A_CLR, fmt = ASM_FMT_M22; - break; - case 0x6: - op = ASM_OP_CHK_A_NC, fmt = ASM_FMT_M23; - break; - case 0x7: - op = ASM_OP_CHK_A_CLR, fmt = ASM_FMT_M23; - break; - } - break; - case 0x1: - switch (FIELD(bits, 33, 3)) { /* x3 */ - case 0x0: - switch (FIELD(bits, 27, 6)) { /* x6 (x4 + x2) */ - case 0x0: - op = ASM_OP_MOV_RR, fmt = ASM_FMT_M42; - break; - case 0x1: - op = ASM_OP_MOV_DBR, fmt = ASM_FMT_M42; - break; - case 0x2: - op = ASM_OP_MOV_IBR, fmt = ASM_FMT_M42; - break; - case 0x3: - op = ASM_OP_MOV_PKR, fmt = ASM_FMT_M42; - break; - case 0x4: - op = ASM_OP_MOV_PMC, fmt = ASM_FMT_M42; - break; - case 0x5: - op = ASM_OP_MOV_PMD, fmt = ASM_FMT_M42; - break; - case 0x6: - op = ASM_OP_MOV_MSR, fmt = ASM_FMT_M42; - break; - case 0x9: - op = ASM_OP_PTC_L, fmt = ASM_FMT_M45; - break; - case 0xA: - op = ASM_OP_PTC_G, fmt = ASM_FMT_M45; - break; - case 0xB: - op = ASM_OP_PTC_GA, fmt = ASM_FMT_M45; - break; - case 0xC: - op = ASM_OP_PTR_D, fmt = ASM_FMT_M45; - break; - case 0xD: - op = ASM_OP_PTR_I, fmt = ASM_FMT_M45; - break; - case 0xE: - op = ASM_OP_ITR_D, fmt = ASM_FMT_M42; - break; - case 0xF: - op = ASM_OP_ITR_I, fmt = ASM_FMT_M42; - break; - case 0x10: - op = ASM_OP_MOV_RR, fmt = ASM_FMT_M43; - break; - case 0x11: - op = ASM_OP_MOV_DBR, fmt = ASM_FMT_M43; - break; - case 0x12: - op = ASM_OP_MOV_IBR, fmt = ASM_FMT_M43; - break; - case 0x13: - op = ASM_OP_MOV_PKR, fmt = ASM_FMT_M43; - break; - case 0x14: - op = ASM_OP_MOV_PMC, fmt = ASM_FMT_M43; - break; - case 0x15: - op = ASM_OP_MOV_PMD, fmt = ASM_FMT_M43; - break; - case 0x16: - op = ASM_OP_MOV_MSR, fmt = ASM_FMT_M43; - break; - case 0x17: - op = ASM_OP_MOV_CPUID, fmt = ASM_FMT_M43; - break; - case 0x18: - op = ASM_OP_PROBE_R, fmt = ASM_FMT_M39; - break; - case 0x19: - op = ASM_OP_PROBE_W, fmt = ASM_FMT_M39; - break; - case 0x1A: - op = ASM_OP_THASH, fmt = ASM_FMT_M46; - break; - case 0x1B: - op = ASM_OP_TTAG, fmt = ASM_FMT_M46; - break; - case 0x1E: - op = ASM_OP_TPA, fmt = ASM_FMT_M46; - break; - case 0x1F: - op = ASM_OP_TAK, fmt = ASM_FMT_M46; - break; - case 0x21: - op = ASM_OP_MOV_PSR_UM, fmt = ASM_FMT_M36; - break; - case 0x22: - op = ASM_OP_MOV_M, fmt = ASM_FMT_M31; - break; - case 0x24: - op = ASM_OP_MOV_, fmt = ASM_FMT_M33; - break; - case 0x25: - op = ASM_OP_MOV_PSR, fmt = ASM_FMT_M36; - break; - case 0x29: - op = ASM_OP_MOV_PSR_UM, fmt = ASM_FMT_M35; - break; - case 0x2A: - op = ASM_OP_MOV_M, fmt = ASM_FMT_M29; - break; - case 0x2C: - op = ASM_OP_MOV_, fmt = ASM_FMT_M32; - break; - case 0x2D: - op = ASM_OP_MOV_PSR_L, fmt = ASM_FMT_M35; - break; - case 0x2E: - op = ASM_OP_ITC_D, fmt = ASM_FMT_M41; - break; - case 0x2F: - op = ASM_OP_ITC_I, fmt = ASM_FMT_M41; - break; - case 0x30: - if (FIELD(bits, 36, 1) == 0) /* x */ - op = ASM_OP_FC_, fmt = ASM_FMT_M28; - else - op = ASM_OP_FC_I, fmt = ASM_FMT_M28; - break; - case 0x31: - op = ASM_OP_PROBE_RW_FAULT, fmt = ASM_FMT_M40; - break; - case 0x32: - op = ASM_OP_PROBE_R_FAULT, fmt = ASM_FMT_M40; - break; - case 0x33: - op = ASM_OP_PROBE_W_FAULT, fmt = ASM_FMT_M40; - break; - case 0x34: - op = ASM_OP_PTC_E, fmt = ASM_FMT_M47; - break; - case 0x38: - op = ASM_OP_PROBE_R, fmt = ASM_FMT_M38; - break; - case 0x39: - op = ASM_OP_PROBE_W, fmt = ASM_FMT_M38; - break; - } - break; - case 0x1: - op = ASM_OP_CHK_S_M, fmt = ASM_FMT_M20; - break; - case 0x3: - op = ASM_OP_CHK_S, fmt = ASM_FMT_M21; - break; - case 0x6: - op = ASM_OP_ALLOC, fmt = ASM_FMT_M34; - break; - } - break; - case 0x4: - if (FIELD(bits, 27, 1) == 0) { /* x */ - switch (FIELD(bits, 30, 7)) { /* x6 + m */ - case 0x0: - op = ASM_OP_LD1_, fmt = ASM_FMT_M1; - break; - case 0x1: - op = ASM_OP_LD2_, fmt = ASM_FMT_M1; - break; - case 0x2: - op = ASM_OP_LD4_, fmt = ASM_FMT_M1; - break; - case 0x3: - op = ASM_OP_LD8_, fmt = ASM_FMT_M1; - break; - case 0x4: - op = ASM_OP_LD1_S, fmt = ASM_FMT_M1; - break; - case 0x5: - op = ASM_OP_LD2_S, fmt = ASM_FMT_M1; - break; - case 0x6: - op = ASM_OP_LD4_S, fmt = ASM_FMT_M1; - break; - case 0x7: - op = ASM_OP_LD8_S, fmt = ASM_FMT_M1; - break; - case 0x8: - op = ASM_OP_LD1_A, fmt = ASM_FMT_M1; - break; - case 0x9: - op = ASM_OP_LD2_A, fmt = ASM_FMT_M1; - break; - case 0xA: - op = ASM_OP_LD4_A, fmt = ASM_FMT_M1; - break; - case 0xB: - op = ASM_OP_LD8_A, fmt = ASM_FMT_M1; - break; - case 0xC: - op = ASM_OP_LD1_SA, fmt = ASM_FMT_M1; - break; - case 0xD: - op = ASM_OP_LD2_SA, fmt = ASM_FMT_M1; - break; - case 0xE: - op = ASM_OP_LD4_SA, fmt = ASM_FMT_M1; - break; - case 0xF: - op = ASM_OP_LD8_SA, fmt = ASM_FMT_M1; - break; - case 0x10: - op = ASM_OP_LD1_BIAS, fmt = ASM_FMT_M1; - break; - case 0x11: - op = ASM_OP_LD2_BIAS, fmt = ASM_FMT_M1; - break; - case 0x12: - op = ASM_OP_LD4_BIAS, fmt = ASM_FMT_M1; - break; - case 0x13: - op = ASM_OP_LD8_BIAS, fmt = ASM_FMT_M1; - break; - case 0x14: - op = ASM_OP_LD1_ACQ, fmt = ASM_FMT_M1; - break; - case 0x15: - op = ASM_OP_LD2_ACQ, fmt = ASM_FMT_M1; - break; - case 0x16: - op = ASM_OP_LD4_ACQ, fmt = ASM_FMT_M1; - break; - case 0x17: - op = ASM_OP_LD8_ACQ, fmt = ASM_FMT_M1; - break; - case 0x1B: - op = ASM_OP_LD8_FILL, fmt = ASM_FMT_M1; - break; - case 0x20: - op = ASM_OP_LD1_C_CLR, fmt = ASM_FMT_M1; - break; - case 0x21: - op = ASM_OP_LD2_C_CLR, fmt = ASM_FMT_M1; - break; - case 0x22: - op = ASM_OP_LD4_C_CLR, fmt = ASM_FMT_M1; - break; - case 0x23: - op = ASM_OP_LD8_C_CLR, fmt = ASM_FMT_M1; - break; - case 0x24: - op = ASM_OP_LD1_C_NC, fmt = ASM_FMT_M1; - break; - case 0x25: - op = ASM_OP_LD2_C_NC, fmt = ASM_FMT_M1; - break; - case 0x26: - op = ASM_OP_LD4_C_NC, fmt = ASM_FMT_M1; - break; - case 0x27: - op = ASM_OP_LD8_C_NC, fmt = ASM_FMT_M1; - break; - case 0x28: - op = ASM_OP_LD1_C_CLR_ACQ, fmt = ASM_FMT_M1; - break; - case 0x29: - op = ASM_OP_LD2_C_CLR_ACQ, fmt = ASM_FMT_M1; - break; - case 0x2A: - op = ASM_OP_LD4_C_CLR_ACQ, fmt = ASM_FMT_M1; - break; - case 0x2B: - op = ASM_OP_LD8_C_CLR_ACQ, fmt = ASM_FMT_M1; - break; - case 0x30: - op = ASM_OP_ST1_, fmt = ASM_FMT_M4; - break; - case 0x31: - op = ASM_OP_ST2_, fmt = ASM_FMT_M4; - break; - case 0x32: - op = ASM_OP_ST4_, fmt = ASM_FMT_M4; - break; - case 0x33: - op = ASM_OP_ST8_, fmt = ASM_FMT_M4; - break; - case 0x34: - op = ASM_OP_ST1_REL, fmt = ASM_FMT_M4; - break; - case 0x35: - op = ASM_OP_ST2_REL, fmt = ASM_FMT_M4; - break; - case 0x36: - op = ASM_OP_ST4_REL, fmt = ASM_FMT_M4; - break; - case 0x37: - op = ASM_OP_ST8_REL, fmt = ASM_FMT_M4; - break; - case 0x3B: - op = ASM_OP_ST8_SPILL, fmt = ASM_FMT_M4; - break; - case 0x40: - op = ASM_OP_LD1_, fmt = ASM_FMT_M2; - break; - case 0x41: - op = ASM_OP_LD2_, fmt = ASM_FMT_M2; - break; - case 0x42: - op = ASM_OP_LD4_, fmt = ASM_FMT_M2; - break; - case 0x43: - op = ASM_OP_LD8_, fmt = ASM_FMT_M2; - break; - case 0x44: - op = ASM_OP_LD1_S, fmt = ASM_FMT_M2; - break; - case 0x45: - op = ASM_OP_LD2_S, fmt = ASM_FMT_M2; - break; - case 0x46: - op = ASM_OP_LD4_S, fmt = ASM_FMT_M2; - break; - case 0x47: - op = ASM_OP_LD8_S, fmt = ASM_FMT_M2; - break; - case 0x48: - op = ASM_OP_LD1_A, fmt = ASM_FMT_M2; - break; - case 0x49: - op = ASM_OP_LD2_A, fmt = ASM_FMT_M2; - break; - case 0x4A: - op = ASM_OP_LD4_A, fmt = ASM_FMT_M2; - break; - case 0x4B: - op = ASM_OP_LD8_A, fmt = ASM_FMT_M2; - break; - case 0x4C: - op = ASM_OP_LD1_SA, fmt = ASM_FMT_M2; - break; - case 0x4D: - op = ASM_OP_LD2_SA, fmt = ASM_FMT_M2; - break; - case 0x4E: - op = ASM_OP_LD4_SA, fmt = ASM_FMT_M2; - break; - case 0x4F: - op = ASM_OP_LD8_SA, fmt = ASM_FMT_M2; - break; - case 0x50: - op = ASM_OP_LD1_BIAS, fmt = ASM_FMT_M2; - break; - case 0x51: - op = ASM_OP_LD2_BIAS, fmt = ASM_FMT_M2; - break; - case 0x52: - op = ASM_OP_LD4_BIAS, fmt = ASM_FMT_M2; - break; - case 0x53: - op = ASM_OP_LD8_BIAS, fmt = ASM_FMT_M2; - break; - case 0x54: - op = ASM_OP_LD1_ACQ, fmt = ASM_FMT_M2; - break; - case 0x55: - op = ASM_OP_LD2_ACQ, fmt = ASM_FMT_M2; - break; - case 0x56: - op = ASM_OP_LD4_ACQ, fmt = ASM_FMT_M2; - break; - case 0x57: - op = ASM_OP_LD8_ACQ, fmt = ASM_FMT_M2; - break; - case 0x5B: - op = ASM_OP_LD8_FILL, fmt = ASM_FMT_M2; - break; - case 0x60: - op = ASM_OP_LD1_C_CLR, fmt = ASM_FMT_M2; - break; - case 0x61: - op = ASM_OP_LD2_C_CLR, fmt = ASM_FMT_M2; - break; - case 0x62: - op = ASM_OP_LD4_C_CLR, fmt = ASM_FMT_M2; - break; - case 0x63: - op = ASM_OP_LD8_C_CLR, fmt = ASM_FMT_M2; - break; - case 0x64: - op = ASM_OP_LD1_C_NC, fmt = ASM_FMT_M2; - break; - case 0x65: - op = ASM_OP_LD2_C_NC, fmt = ASM_FMT_M2; - break; - case 0x66: - op = ASM_OP_LD4_C_NC, fmt = ASM_FMT_M2; - break; - case 0x67: - op = ASM_OP_LD8_C_NC, fmt = ASM_FMT_M2; - break; - case 0x68: - op = ASM_OP_LD1_C_CLR_ACQ, fmt = ASM_FMT_M2; - break; - case 0x69: - op = ASM_OP_LD2_C_CLR_ACQ, fmt = ASM_FMT_M2; - break; - case 0x6A: - op = ASM_OP_LD4_C_CLR_ACQ, fmt = ASM_FMT_M2; - break; - case 0x6B: - op = ASM_OP_LD8_C_CLR_ACQ, fmt = ASM_FMT_M2; - break; - } - } else { - switch (FIELD(bits, 30, 7)) { /* x6 + m */ - case 0x0: - op = ASM_OP_CMPXCHG1_ACQ, fmt = ASM_FMT_M16; - break; - case 0x1: - op = ASM_OP_CMPXCHG2_ACQ, fmt = ASM_FMT_M16; - break; - case 0x2: - op = ASM_OP_CMPXCHG4_ACQ, fmt = ASM_FMT_M16; - break; - case 0x3: - op = ASM_OP_CMPXCHG8_ACQ, fmt = ASM_FMT_M16; - break; - case 0x4: - op = ASM_OP_CMPXCHG1_REL, fmt = ASM_FMT_M16; - break; - case 0x5: - op = ASM_OP_CMPXCHG2_REL, fmt = ASM_FMT_M16; - break; - case 0x6: - op = ASM_OP_CMPXCHG4_REL, fmt = ASM_FMT_M16; - break; - case 0x7: - op = ASM_OP_CMPXCHG8_REL, fmt = ASM_FMT_M16; - break; - case 0x8: - op = ASM_OP_XCHG1, fmt = ASM_FMT_M16; - break; - case 0x9: - op = ASM_OP_XCHG2, fmt = ASM_FMT_M16; - break; - case 0xA: - op = ASM_OP_XCHG4, fmt = ASM_FMT_M16; - break; - case 0xB: - op = ASM_OP_XCHG8, fmt = ASM_FMT_M16; - break; - case 0x12: - op = ASM_OP_FETCHADD4_ACQ, fmt = ASM_FMT_M17; - break; - case 0x13: - op = ASM_OP_FETCHADD8_ACQ, fmt = ASM_FMT_M17; - break; - case 0x16: - op = ASM_OP_FETCHADD4_REL, fmt = ASM_FMT_M17; - break; - case 0x17: - op = ASM_OP_FETCHADD8_REL, fmt = ASM_FMT_M17; - break; - case 0x1C: - op = ASM_OP_GETF_SIG, fmt = ASM_FMT_M19; - break; - case 0x1D: - op = ASM_OP_GETF_EXP, fmt = ASM_FMT_M19; - break; - case 0x1E: - op = ASM_OP_GETF_S, fmt = ASM_FMT_M19; - break; - case 0x1F: - op = ASM_OP_GETF_D, fmt = ASM_FMT_M19; - break; - case 0x20: - op = ASM_OP_CMP8XCHG16_ACQ, fmt = ASM_FMT_M16; - break; - case 0x24: - op = ASM_OP_CMP8XCHG16_REL, fmt = ASM_FMT_M16; - break; - case 0x28: - op = ASM_OP_LD16_, fmt = ASM_FMT_M1; - break; - case 0x2C: - op = ASM_OP_LD16_ACQ, fmt = ASM_FMT_M1; - break; - case 0x30: - op = ASM_OP_ST16_, fmt = ASM_FMT_M4; - break; - case 0x34: - op = ASM_OP_ST16_REL, fmt = ASM_FMT_M4; - break; - } - } - break; - case 0x5: - switch (FIELD(bits, 30, 6)) { /* x6 */ - case 0x0: - op = ASM_OP_LD1_, fmt = ASM_FMT_M3; - break; - case 0x1: - op = ASM_OP_LD2_, fmt = ASM_FMT_M3; - break; - case 0x2: - op = ASM_OP_LD4_, fmt = ASM_FMT_M3; - break; - case 0x3: - op = ASM_OP_LD8_, fmt = ASM_FMT_M3; - break; - case 0x4: - op = ASM_OP_LD1_S, fmt = ASM_FMT_M3; - break; - case 0x5: - op = ASM_OP_LD2_S, fmt = ASM_FMT_M3; - break; - case 0x6: - op = ASM_OP_LD4_S, fmt = ASM_FMT_M3; - break; - case 0x7: - op = ASM_OP_LD8_S, fmt = ASM_FMT_M3; - break; - case 0x8: - op = ASM_OP_LD1_A, fmt = ASM_FMT_M3; - break; - case 0x9: - op = ASM_OP_LD2_A, fmt = ASM_FMT_M3; - break; - case 0xA: - op = ASM_OP_LD4_A, fmt = ASM_FMT_M3; - break; - case 0xB: - op = ASM_OP_LD8_A, fmt = ASM_FMT_M3; - break; - case 0xC: - op = ASM_OP_LD1_SA, fmt = ASM_FMT_M3; - break; - case 0xD: - op = ASM_OP_LD2_SA, fmt = ASM_FMT_M3; - break; - case 0xE: - op = ASM_OP_LD4_SA, fmt = ASM_FMT_M3; - break; - case 0xF: - op = ASM_OP_LD8_SA, fmt = ASM_FMT_M3; - break; - case 0x10: - op = ASM_OP_LD1_BIAS, fmt = ASM_FMT_M3; - break; - case 0x11: - op = ASM_OP_LD2_BIAS, fmt = ASM_FMT_M3; - break; - case 0x12: - op = ASM_OP_LD4_BIAS, fmt = ASM_FMT_M3; - break; - case 0x13: - op = ASM_OP_LD8_BIAS, fmt = ASM_FMT_M3; - break; - case 0x14: - op = ASM_OP_LD1_ACQ, fmt = ASM_FMT_M3; - break; - case 0x15: - op = ASM_OP_LD2_ACQ, fmt = ASM_FMT_M3; - break; - case 0x16: - op = ASM_OP_LD4_ACQ, fmt = ASM_FMT_M3; - break; - case 0x17: - op = ASM_OP_LD8_ACQ, fmt = ASM_FMT_M3; - break; - case 0x1B: - op = ASM_OP_LD8_FILL, fmt = ASM_FMT_M3; - break; - case 0x20: - op = ASM_OP_LD1_C_CLR, fmt = ASM_FMT_M3; - break; - case 0x21: - op = ASM_OP_LD2_C_CLR, fmt = ASM_FMT_M3; - break; - case 0x22: - op = ASM_OP_LD4_C_CLR, fmt = ASM_FMT_M3; - break; - case 0x23: - op = ASM_OP_LD8_C_CLR, fmt = ASM_FMT_M3; - break; - case 0x24: - op = ASM_OP_LD1_C_NC, fmt = ASM_FMT_M3; - break; - case 0x25: - op = ASM_OP_LD2_C_NC, fmt = ASM_FMT_M3; - break; - case 0x26: - op = ASM_OP_LD4_C_NC, fmt = ASM_FMT_M3; - break; - case 0x27: - op = ASM_OP_LD8_C_NC, fmt = ASM_FMT_M3; - break; - case 0x28: - op = ASM_OP_LD1_C_CLR_ACQ, fmt = ASM_FMT_M3; - break; - case 0x29: - op = ASM_OP_LD2_C_CLR_ACQ, fmt = ASM_FMT_M3; - break; - case 0x2A: - op = ASM_OP_LD4_C_CLR_ACQ, fmt = ASM_FMT_M3; - break; - case 0x2B: - op = ASM_OP_LD8_C_CLR_ACQ, fmt = ASM_FMT_M3; - break; - case 0x30: - op = ASM_OP_ST1_, fmt = ASM_FMT_M5; - break; - case 0x31: - op = ASM_OP_ST2_, fmt = ASM_FMT_M5; - break; - case 0x32: - op = ASM_OP_ST4_, fmt = ASM_FMT_M5; - break; - case 0x33: - op = ASM_OP_ST8_, fmt = ASM_FMT_M5; - break; - case 0x34: - op = ASM_OP_ST1_REL, fmt = ASM_FMT_M5; - break; - case 0x35: - op = ASM_OP_ST2_REL, fmt = ASM_FMT_M5; - break; - case 0x36: - op = ASM_OP_ST4_REL, fmt = ASM_FMT_M5; - break; - case 0x37: - op = ASM_OP_ST8_REL, fmt = ASM_FMT_M5; - break; - case 0x3B: - op = ASM_OP_ST8_SPILL, fmt = ASM_FMT_M5; - break; - } - break; - case 0x6: - if (FIELD(bits, 27, 1) == 0) { /* x */ - switch (FIELD(bits, 30, 7)) { /* x6 + m */ - case 0x0: - op = ASM_OP_LDFE_, fmt = ASM_FMT_M6; - break; - case 0x1: - op = ASM_OP_LDF8_, fmt = ASM_FMT_M6; - break; - case 0x2: - op = ASM_OP_LDFS_, fmt = ASM_FMT_M6; - break; - case 0x3: - op = ASM_OP_LDFD_, fmt = ASM_FMT_M6; - break; - case 0x4: - op = ASM_OP_LDFE_S, fmt = ASM_FMT_M6; - break; - case 0x5: - op = ASM_OP_LDF8_S, fmt = ASM_FMT_M6; - break; - case 0x6: - op = ASM_OP_LDFS_S, fmt = ASM_FMT_M6; - break; - case 0x7: - op = ASM_OP_LDFD_S, fmt = ASM_FMT_M6; - break; - case 0x8: - op = ASM_OP_LDFE_A, fmt = ASM_FMT_M6; - break; - case 0x9: - op = ASM_OP_LDF8_A, fmt = ASM_FMT_M6; - break; - case 0xA: - op = ASM_OP_LDFS_A, fmt = ASM_FMT_M6; - break; - case 0xB: - op = ASM_OP_LDFD_A, fmt = ASM_FMT_M6; - break; - case 0xC: - op = ASM_OP_LDFE_SA, fmt = ASM_FMT_M6; - break; - case 0xD: - op = ASM_OP_LDF8_SA, fmt = ASM_FMT_M6; - break; - case 0xE: - op = ASM_OP_LDFS_SA, fmt = ASM_FMT_M6; - break; - case 0xF: - op = ASM_OP_LDFD_SA, fmt = ASM_FMT_M6; - break; - case 0x1B: - op = ASM_OP_LDF_FILL, fmt = ASM_FMT_M6; - break; - case 0x20: - op = ASM_OP_LDFE_C_CLR, fmt = ASM_FMT_M6; - break; - case 0x21: - op = ASM_OP_LDF8_C_CLR, fmt = ASM_FMT_M6; - break; - case 0x22: - op = ASM_OP_LDFS_C_CLR, fmt = ASM_FMT_M6; - break; - case 0x23: - op = ASM_OP_LDFD_C_CLR, fmt = ASM_FMT_M6; - break; - case 0x24: - op = ASM_OP_LDFE_C_NC, fmt = ASM_FMT_M6; - break; - case 0x25: - op = ASM_OP_LDF8_C_NC, fmt = ASM_FMT_M6; - break; - case 0x26: - op = ASM_OP_LDFS_C_NC, fmt = ASM_FMT_M6; - break; - case 0x27: - op = ASM_OP_LDFD_C_NC, fmt = ASM_FMT_M6; - break; - case 0x2C: - op = ASM_OP_LFETCH_, fmt = ASM_FMT_M13; - break; - case 0x2D: - op = ASM_OP_LFETCH_EXCL, fmt = ASM_FMT_M13; - break; - case 0x2E: - op = ASM_OP_LFETCH_FAULT, fmt = ASM_FMT_M13; - break; - case 0x2F: - op = ASM_OP_LFETCH_FAULT_EXCL, - fmt = ASM_FMT_M13; - break; - case 0x30: - op = ASM_OP_STFE, fmt = ASM_FMT_M9; - break; - case 0x31: - op = ASM_OP_STF8, fmt = ASM_FMT_M9; - break; - case 0x32: - op = ASM_OP_STFS, fmt = ASM_FMT_M9; - break; - case 0x33: - op = ASM_OP_STFD, fmt = ASM_FMT_M9; - break; - case 0x3B: - op = ASM_OP_STF_SPILL, fmt = ASM_FMT_M9; - break; - case 0x40: - op = ASM_OP_LDFE_, fmt = ASM_FMT_M7; - break; - case 0x41: - op = ASM_OP_LDF8_, fmt = ASM_FMT_M7; - break; - case 0x42: - op = ASM_OP_LDFS_, fmt = ASM_FMT_M7; - break; - case 0x43: - op = ASM_OP_LDFD_, fmt = ASM_FMT_M7; - break; - case 0x44: - op = ASM_OP_LDFE_S, fmt = ASM_FMT_M7; - break; - case 0x45: - op = ASM_OP_LDF8_S, fmt = ASM_FMT_M7; - break; - case 0x46: - op = ASM_OP_LDFS_S, fmt = ASM_FMT_M7; - break; - case 0x47: - op = ASM_OP_LDFD_S, fmt = ASM_FMT_M7; - break; - case 0x48: - op = ASM_OP_LDFE_A, fmt = ASM_FMT_M7; - break; - case 0x49: - op = ASM_OP_LDF8_A, fmt = ASM_FMT_M7; - break; - case 0x4A: - op = ASM_OP_LDFS_A, fmt = ASM_FMT_M7; - break; - case 0x4B: - op = ASM_OP_LDFD_A, fmt = ASM_FMT_M7; - break; - case 0x4C: - op = ASM_OP_LDFE_SA, fmt = ASM_FMT_M7; - break; - case 0x4D: - op = ASM_OP_LDF8_SA, fmt = ASM_FMT_M7; - break; - case 0x4E: - op = ASM_OP_LDFS_SA, fmt = ASM_FMT_M7; - break; - case 0x4F: - op = ASM_OP_LDFD_SA, fmt = ASM_FMT_M7; - break; - case 0x5B: - op = ASM_OP_LDF_FILL, fmt = ASM_FMT_M7; - break; - case 0x60: - op = ASM_OP_LDFE_C_CLR, fmt = ASM_FMT_M7; - break; - case 0x61: - op = ASM_OP_LDF8_C_CLR, fmt = ASM_FMT_M7; - break; - case 0x62: - op = ASM_OP_LDFS_C_CLR, fmt = ASM_FMT_M7; - break; - case 0x63: - op = ASM_OP_LDFD_C_CLR, fmt = ASM_FMT_M7; - break; - case 0x64: - op = ASM_OP_LDFE_C_NC, fmt = ASM_FMT_M7; - break; - case 0x65: - op = ASM_OP_LDF8_C_NC, fmt = ASM_FMT_M7; - break; - case 0x66: - op = ASM_OP_LDFS_C_NC, fmt = ASM_FMT_M7; - break; - case 0x67: - op = ASM_OP_LDFD_C_NC, fmt = ASM_FMT_M7; - break; - case 0x6C: - op = ASM_OP_LFETCH_, fmt = ASM_FMT_M14; - break; - case 0x6D: - op = ASM_OP_LFETCH_EXCL, fmt = ASM_FMT_M14; - break; - case 0x6E: - op = ASM_OP_LFETCH_FAULT, fmt = ASM_FMT_M14; - break; - case 0x6F: - op = ASM_OP_LFETCH_FAULT_EXCL, - fmt = ASM_FMT_M14; - break; - } - } else { - switch (FIELD(bits, 30, 7)) { /* x6 + m */ - case 0x1: - op = ASM_OP_LDFP8_, fmt = ASM_FMT_M11; - break; - case 0x2: - op = ASM_OP_LDFPS_, fmt = ASM_FMT_M11; - break; - case 0x3: - op = ASM_OP_LDFPD_, fmt = ASM_FMT_M11; - break; - case 0x5: - op = ASM_OP_LDFP8_S, fmt = ASM_FMT_M11; - break; - case 0x6: - op = ASM_OP_LDFPS_S, fmt = ASM_FMT_M11; - break; - case 0x7: - op = ASM_OP_LDFPD_S, fmt = ASM_FMT_M11; - break; - case 0x9: - op = ASM_OP_LDFP8_A, fmt = ASM_FMT_M11; - break; - case 0xA: - op = ASM_OP_LDFPS_A, fmt = ASM_FMT_M11; - break; - case 0xB: - op = ASM_OP_LDFPD_A, fmt = ASM_FMT_M11; - break; - case 0xD: - op = ASM_OP_LDFP8_SA, fmt = ASM_FMT_M11; - break; - case 0xE: - op = ASM_OP_LDFPS_SA, fmt = ASM_FMT_M11; - break; - case 0xF: - op = ASM_OP_LDFPD_SA, fmt = ASM_FMT_M11; - break; - case 0x1C: - op = ASM_OP_SETF_SIG, fmt = ASM_FMT_M18; - break; - case 0x1D: - op = ASM_OP_SETF_EXP, fmt = ASM_FMT_M18; - break; - case 0x1E: - op = ASM_OP_SETF_S, fmt = ASM_FMT_M18; - break; - case 0x1F: - op = ASM_OP_SETF_D, fmt = ASM_FMT_M18; - break; - case 0x21: - op = ASM_OP_LDFP8_C_CLR, fmt = ASM_FMT_M11; - break; - case 0x22: - op = ASM_OP_LDFPS_C_CLR, fmt = ASM_FMT_M11; - break; - case 0x23: - op = ASM_OP_LDFPD_C_CLR, fmt = ASM_FMT_M11; - break; - case 0x25: - op = ASM_OP_LDFP8_C_NC, fmt = ASM_FMT_M11; - break; - case 0x26: - op = ASM_OP_LDFPS_C_NC, fmt = ASM_FMT_M11; - break; - case 0x27: - op = ASM_OP_LDFPD_C_NC, fmt = ASM_FMT_M11; - break; - case 0x41: - op = ASM_OP_LDFP8_, fmt = ASM_FMT_M12; - break; - case 0x42: - op = ASM_OP_LDFPS_, fmt = ASM_FMT_M12; - break; - case 0x43: - op = ASM_OP_LDFPD_, fmt = ASM_FMT_M12; - break; - case 0x45: - op = ASM_OP_LDFP8_S, fmt = ASM_FMT_M12; - break; - case 0x46: - op = ASM_OP_LDFPS_S, fmt = ASM_FMT_M12; - break; - case 0x47: - op = ASM_OP_LDFPD_S, fmt = ASM_FMT_M12; - break; - case 0x49: - op = ASM_OP_LDFP8_A, fmt = ASM_FMT_M12; - break; - case 0x4A: - op = ASM_OP_LDFPS_A, fmt = ASM_FMT_M12; - break; - case 0x4B: - op = ASM_OP_LDFPD_A, fmt = ASM_FMT_M12; - break; - case 0x4D: - op = ASM_OP_LDFP8_SA, fmt = ASM_FMT_M12; - break; - case 0x4E: - op = ASM_OP_LDFPS_SA, fmt = ASM_FMT_M12; - break; - case 0x4F: - op = ASM_OP_LDFPD_SA, fmt = ASM_FMT_M12; - break; - case 0x61: - op = ASM_OP_LDFP8_C_CLR, fmt = ASM_FMT_M12; - break; - case 0x62: - op = ASM_OP_LDFPS_C_CLR, fmt = ASM_FMT_M12; - break; - case 0x63: - op = ASM_OP_LDFPD_C_CLR, fmt = ASM_FMT_M12; - break; - case 0x65: - op = ASM_OP_LDFP8_C_NC, fmt = ASM_FMT_M12; - break; - case 0x66: - op = ASM_OP_LDFPS_C_NC, fmt = ASM_FMT_M12; - break; - case 0x67: - op = ASM_OP_LDFPD_C_NC, fmt = ASM_FMT_M12; - break; - } - } - break; - case 0x7: - switch (FIELD(bits, 30, 6)) { /* x6 */ - case 0x0: - op = ASM_OP_LDFE_, fmt = ASM_FMT_M8; - break; - case 0x1: - op = ASM_OP_LDF8_, fmt = ASM_FMT_M8; - break; - case 0x2: - op = ASM_OP_LDFS_, fmt = ASM_FMT_M8; - break; - case 0x3: - op = ASM_OP_LDFD_, fmt = ASM_FMT_M8; - break; - case 0x4: - op = ASM_OP_LDFE_S, fmt = ASM_FMT_M8; - break; - case 0x5: - op = ASM_OP_LDF8_S, fmt = ASM_FMT_M8; - break; - case 0x6: - op = ASM_OP_LDFS_S, fmt = ASM_FMT_M8; - break; - case 0x7: - op = ASM_OP_LDFD_S, fmt = ASM_FMT_M8; - break; - case 0x8: - op = ASM_OP_LDFE_A, fmt = ASM_FMT_M8; - break; - case 0x9: - op = ASM_OP_LDF8_A, fmt = ASM_FMT_M8; - break; - case 0xA: - op = ASM_OP_LDFS_A, fmt = ASM_FMT_M8; - break; - case 0xB: - op = ASM_OP_LDFD_A, fmt = ASM_FMT_M8; - break; - case 0xC: - op = ASM_OP_LDFE_SA, fmt = ASM_FMT_M8; - break; - case 0xD: - op = ASM_OP_LDF8_SA, fmt = ASM_FMT_M8; - break; - case 0xE: - op = ASM_OP_LDFS_SA, fmt = ASM_FMT_M8; - break; - case 0xF: - op = ASM_OP_LDFD_SA, fmt = ASM_FMT_M8; - break; - case 0x1B: - op = ASM_OP_LDF_FILL, fmt = ASM_FMT_M8; - break; - case 0x20: - op = ASM_OP_LDFE_C_CLR, fmt = ASM_FMT_M8; - break; - case 0x21: - op = ASM_OP_LDF8_C_CLR, fmt = ASM_FMT_M8; - break; - case 0x22: - op = ASM_OP_LDFS_C_CLR, fmt = ASM_FMT_M8; - break; - case 0x23: - op = ASM_OP_LDFD_C_CLR, fmt = ASM_FMT_M8; - break; - case 0x24: - op = ASM_OP_LDFE_C_NC, fmt = ASM_FMT_M8; - break; - case 0x25: - op = ASM_OP_LDF8_C_NC, fmt = ASM_FMT_M8; - break; - case 0x26: - op = ASM_OP_LDFS_C_NC, fmt = ASM_FMT_M8; - break; - case 0x27: - op = ASM_OP_LDFD_C_NC, fmt = ASM_FMT_M8; - break; - case 0x2C: - op = ASM_OP_LFETCH_, fmt = ASM_FMT_M15; - break; - case 0x2D: - op = ASM_OP_LFETCH_EXCL, fmt = ASM_FMT_M15; - break; - case 0x2E: - op = ASM_OP_LFETCH_FAULT, fmt = ASM_FMT_M15; - break; - case 0x2F: - op = ASM_OP_LFETCH_FAULT_EXCL, fmt = ASM_FMT_M15; - break; - case 0x30: - op = ASM_OP_STFE, fmt = ASM_FMT_M10; - break; - case 0x31: - op = ASM_OP_STF8, fmt = ASM_FMT_M10; - break; - case 0x32: - op = ASM_OP_STFS, fmt = ASM_FMT_M10; - break; - case 0x33: - op = ASM_OP_STFD, fmt = ASM_FMT_M10; - break; - case 0x3B: - op = ASM_OP_STF_SPILL, fmt = ASM_FMT_M10; - break; - } - break; - } - - if (op != ASM_OP_NONE) - return (asm_extract(op, fmt, bits, b, slot)); - return (0); -} - -/* - * Decode X-unit instructions. - */ -static int -asm_decodeX(uint64_t ip, struct asm_bundle *b, int slot) -{ - uint64_t bits; - enum asm_fmt fmt; - enum asm_op op; - - KASSERT(slot == 2, ("foo")); - bits = SLOT(ip, slot); - fmt = ASM_FMT_NONE, op = ASM_OP_NONE; - /* Initialize slot 1 (slot - 1) */ - b->b_inst[slot - 1].i_format = ASM_FMT_NONE; - b->b_inst[slot - 1].i_bits = SLOT(ip, slot - 1); - - switch((int)OPCODE(bits)) { - case 0x0: - if (FIELD(bits, 33, 3) == 0) { /* x3 */ - switch (FIELD(bits, 27, 6)) { /* x6 */ - case 0x0: - op = ASM_OP_BREAK_X, fmt = ASM_FMT_X1; - break; - case 0x1: - if (FIELD(bits, 26, 1) == 0) /* y */ - op = ASM_OP_NOP_X, fmt = ASM_FMT_X5; - else - op = ASM_OP_HINT_X, fmt = ASM_FMT_X5; - break; - } - } - break; - case 0x6: - if (FIELD(bits, 20, 1) == 0) - op = ASM_OP_MOVL, fmt = ASM_FMT_X2; - break; - case 0xC: - if (FIELD(bits, 6, 3) == 0) /* btype */ - op = ASM_OP_BRL_COND, fmt = ASM_FMT_X3; - break; - case 0xD: - op = ASM_OP_BRL_CALL, fmt = ASM_FMT_X4; - break; - } - - if (op != ASM_OP_NONE) - return (asm_extract(op, fmt, bits, b, slot)); - return (0); -} - -int -asm_decode(uint64_t ip, struct asm_bundle *b) -{ - const char *tp; - unsigned int slot; - int ok; - - memset(b, 0, sizeof(*b)); - - b->b_templ = asm_templname[TMPL(ip)]; - if (b->b_templ == 0) - return (0); - - slot = 0; - tp = b->b_templ; - - ok = 1; - while (ok && *tp != 0) { - switch (*tp++) { - case 'B': - ok = asm_decodeB(ip, b, slot++); - break; - case 'F': - ok = asm_decodeF(ip, b, slot++); - break; - case 'I': - ok = asm_decodeI(ip, b, slot++); - break; - case 'L': - ok = (slot++ == 1) ? 1 : 0; - break; - case 'M': - ok = asm_decodeM(ip, b, slot++); - break; - case 'X': - ok = asm_decodeX(ip, b, slot++); - break; - case ';': - ok = 1; - break; - default: - ok = 0; - break; - } - } - return (ok); -} diff --git a/sys/ia64/disasm/disasm_extract.c b/sys/ia64/disasm/disasm_extract.c deleted file mode 100644 index 1cec07e..0000000 --- a/sys/ia64/disasm/disasm_extract.c +++ /dev/null @@ -1,2609 +0,0 @@ -/*- - * Copyright (c) 2000-2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> - -#include <machine/stdarg.h> - -#include <ia64/disasm/disasm_int.h> -#include <ia64/disasm/disasm.h> - -#define FRAG(o,l) ((int)((o << 8) | (l & 0xff))) -#define FRAG_OFS(f) (f >> 8) -#define FRAG_LEN(f) (f & 0xff) - -/* - * Support functions. - */ -static void -asm_cmpltr_add(struct asm_inst *i, enum asm_cmpltr_class c, - enum asm_cmpltr_type t) -{ - - i->i_cmpltr[i->i_ncmpltrs].c_class = c; - i->i_cmpltr[i->i_ncmpltrs].c_type = t; - i->i_ncmpltrs++; - KASSERT(i->i_ncmpltrs < 6, ("foo")); -} - -static void -asm_hint(struct asm_inst *i, enum asm_cmpltr_class c) -{ - - switch (FIELD(i->i_bits, 28, 2)) { /* hint */ - case 0: - asm_cmpltr_add(i, c, ASM_CT_NONE); - break; - case 1: - asm_cmpltr_add(i, c, ASM_CT_NT1); - break; - case 2: - asm_cmpltr_add(i, c, ASM_CT_NT2); - break; - case 3: - asm_cmpltr_add(i, c, ASM_CT_NTA); - break; - } -} - -static void -asm_sf(struct asm_inst *i) -{ - - switch (FIELD(i->i_bits, 34, 2)) { - case 0: - asm_cmpltr_add(i, ASM_CC_SF, ASM_CT_S0); - break; - case 1: - asm_cmpltr_add(i, ASM_CC_SF, ASM_CT_S1); - break; - case 2: - asm_cmpltr_add(i, ASM_CC_SF, ASM_CT_S2); - break; - case 3: - asm_cmpltr_add(i, ASM_CC_SF, ASM_CT_S3); - break; - } -} - -static void -asm_brhint(struct asm_inst *i) -{ - uint64_t bits = i->i_bits; - - switch (FIELD(bits, 33, 2)) { /* bwh */ - case 0: - asm_cmpltr_add(i, ASM_CC_BWH, ASM_CT_SPTK); - break; - case 1: - asm_cmpltr_add(i, ASM_CC_BWH, ASM_CT_SPNT); - break; - case 2: - asm_cmpltr_add(i, ASM_CC_BWH, ASM_CT_DPTK); - break; - case 3: - asm_cmpltr_add(i, ASM_CC_BWH, ASM_CT_DPNT); - break; - } - - if (FIELD(bits, 12, 1)) /* ph */ - asm_cmpltr_add(i, ASM_CC_PH, ASM_CT_MANY); - else - asm_cmpltr_add(i, ASM_CC_PH, ASM_CT_FEW); - - if (FIELD(bits, 35, 1)) /* dh */ - asm_cmpltr_add(i, ASM_CC_DH, ASM_CT_CLR); - else - asm_cmpltr_add(i, ASM_CC_DH, ASM_CT_NONE); -} - -static void -asm_brphint(struct asm_inst *i) -{ - uint64_t bits = i->i_bits; - - switch (FIELD(bits, 3, 2)) { /* ipwh, indwh */ - case 0: - asm_cmpltr_add(i, ASM_CC_IPWH, ASM_CT_SPTK); - break; - case 1: - asm_cmpltr_add(i, ASM_CC_IPWH, ASM_CT_LOOP); - break; - case 2: - asm_cmpltr_add(i, ASM_CC_IPWH, ASM_CT_DPTK); - break; - case 3: - asm_cmpltr_add(i, ASM_CC_IPWH, ASM_CT_EXIT); - break; - } - - if (FIELD(bits, 5, 1)) /* ph */ - asm_cmpltr_add(i, ASM_CC_PH, ASM_CT_MANY); - else - asm_cmpltr_add(i, ASM_CC_PH, ASM_CT_FEW); - - switch (FIELD(bits, 0, 3)) { /* pvec */ - case 0: - asm_cmpltr_add(i, ASM_CC_PVEC, ASM_CT_DC_DC); - break; - case 1: - asm_cmpltr_add(i, ASM_CC_PVEC, ASM_CT_DC_NT); - break; - case 2: - asm_cmpltr_add(i, ASM_CC_PVEC, ASM_CT_TK_DC); - break; - case 3: - asm_cmpltr_add(i, ASM_CC_PVEC, ASM_CT_TK_TK); - break; - case 4: - asm_cmpltr_add(i, ASM_CC_PVEC, ASM_CT_TK_NT); - break; - case 5: - asm_cmpltr_add(i, ASM_CC_PVEC, ASM_CT_NT_DC); - break; - case 6: - asm_cmpltr_add(i, ASM_CC_PVEC, ASM_CT_NT_TK); - break; - case 7: - asm_cmpltr_add(i, ASM_CC_PVEC, ASM_CT_NT_NT); - break; - } - - if (FIELD(bits, 35, 1)) /* ih */ - asm_cmpltr_add(i, ASM_CC_IH, ASM_CT_IMP); - else - asm_cmpltr_add(i, ASM_CC_IH, ASM_CT_NONE); -} - -static enum asm_oper_type -asm_normalize(struct asm_inst *i, enum asm_op op) -{ - enum asm_oper_type ot = ASM_OPER_NONE; - - switch (op) { - case ASM_OP_BR_CALL: - asm_cmpltr_add(i, ASM_CC_BTYPE, ASM_CT_CALL); - op = ASM_OP_BR; - break; - case ASM_OP_BR_CEXIT: - asm_cmpltr_add(i, ASM_CC_BTYPE, ASM_CT_CEXIT); - op = ASM_OP_BR; - break; - case ASM_OP_BR_CLOOP: - asm_cmpltr_add(i, ASM_CC_BTYPE, ASM_CT_CLOOP); - op = ASM_OP_BR; - break; - case ASM_OP_BR_COND: - asm_cmpltr_add(i, ASM_CC_BTYPE, ASM_CT_COND); - op = ASM_OP_BR; - break; - case ASM_OP_BR_CTOP: - asm_cmpltr_add(i, ASM_CC_BTYPE, ASM_CT_CTOP); - op = ASM_OP_BR; - break; - case ASM_OP_BR_IA: - asm_cmpltr_add(i, ASM_CC_BTYPE, ASM_CT_IA); - op = ASM_OP_BR; - break; - case ASM_OP_BR_RET: - asm_cmpltr_add(i, ASM_CC_BTYPE, ASM_CT_RET); - op = ASM_OP_BR; - break; - case ASM_OP_BR_WEXIT: - asm_cmpltr_add(i, ASM_CC_BTYPE, ASM_CT_WEXIT); - op = ASM_OP_BR; - break; - case ASM_OP_BR_WTOP: - asm_cmpltr_add(i, ASM_CC_BTYPE, ASM_CT_WTOP); - op = ASM_OP_BR; - break; - case ASM_OP_BREAK_B: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_B); - op = ASM_OP_BREAK; - break; - case ASM_OP_BREAK_F: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_F); - op = ASM_OP_BREAK; - break; - case ASM_OP_BREAK_I: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_I); - op = ASM_OP_BREAK; - break; - case ASM_OP_BREAK_M: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_M); - op = ASM_OP_BREAK; - break; - case ASM_OP_BREAK_X: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_X); - op = ASM_OP_BREAK; - break; - case ASM_OP_BRL_COND: - asm_cmpltr_add(i, ASM_CC_BTYPE, ASM_CT_COND); - op = ASM_OP_BRL; - break; - case ASM_OP_BRL_CALL: - asm_cmpltr_add(i, ASM_CC_BTYPE, ASM_CT_CALL); - op = ASM_OP_BRL; - break; - case ASM_OP_BRP_: - asm_cmpltr_add(i, ASM_CC_BTYPE, ASM_CT_NONE); - op = ASM_OP_BRP; - break; - case ASM_OP_BRP_RET: - asm_cmpltr_add(i, ASM_CC_BTYPE, ASM_CT_RET); - op = ASM_OP_BRP; - break; - case ASM_OP_BSW_0: - asm_cmpltr_add(i, ASM_CC_BSW, ASM_CT_0); - op = ASM_OP_BSW; - break; - case ASM_OP_BSW_1: - asm_cmpltr_add(i, ASM_CC_BSW, ASM_CT_1); - op = ASM_OP_BSW; - break; - case ASM_OP_CHK_A_CLR: - asm_cmpltr_add(i, ASM_CC_CHK, ASM_CT_A); - asm_cmpltr_add(i, ASM_CC_ACLR, ASM_CT_CLR); - op = ASM_OP_CHK; - break; - case ASM_OP_CHK_A_NC: - asm_cmpltr_add(i, ASM_CC_CHK, ASM_CT_A); - asm_cmpltr_add(i, ASM_CC_ACLR, ASM_CT_NC); - op = ASM_OP_CHK; - break; - case ASM_OP_CHK_S: - asm_cmpltr_add(i, ASM_CC_CHK, ASM_CT_S); - op = ASM_OP_CHK; - break; - case ASM_OP_CHK_S_I: - asm_cmpltr_add(i, ASM_CC_CHK, ASM_CT_S); - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_I); - op = ASM_OP_CHK; - break; - case ASM_OP_CHK_S_M: - asm_cmpltr_add(i, ASM_CC_CHK, ASM_CT_S); - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_M); - op = ASM_OP_CHK; - break; - case ASM_OP_CLRRRB_: - asm_cmpltr_add(i, ASM_CC_CLRRRB, ASM_CT_NONE); - op = ASM_OP_CLRRRB; - break; - case ASM_OP_CLRRRB_PR: - asm_cmpltr_add(i, ASM_CC_CLRRRB, ASM_CT_PR); - op = ASM_OP_CLRRRB; - break; - case ASM_OP_CMP_EQ: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_EQ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_NONE); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_EQ_AND: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_EQ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_EQ_OR: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_EQ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_EQ_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_EQ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_EQ_UNC: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_EQ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_UNC); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_GE_AND: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_GE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_GE_OR: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_GE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_GE_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_GE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_GT_AND: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_GT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_GT_OR: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_GT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_GT_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_GT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_LE_AND: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_LE_OR: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_LE_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_LT: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_NONE); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_LT_AND: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_LT_OR: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_LT_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_LT_UNC: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_UNC); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_LTU: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LTU); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_NONE); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_LTU_UNC: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LTU); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_UNC); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_NE_AND: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_NE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_NE_OR: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_NE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP_NE_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_NE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_CMP; - break; - case ASM_OP_CMP4_EQ: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_EQ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_NONE); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_EQ_AND: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_EQ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_EQ_OR: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_EQ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_EQ_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_EQ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_EQ_UNC: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_EQ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_UNC); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_GE_AND: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_GE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_GE_OR: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_GE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_GE_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_GE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_GT_AND: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_GT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_GT_OR: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_GT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_GT_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_GT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_LE_AND: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_LE_OR: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_LE_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_LT: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_NONE); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_LT_AND: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_LT_OR: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_LT_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_LT_UNC: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LT); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_UNC); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_LTU: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LTU); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_NONE); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_LTU_UNC: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_LTU); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_UNC); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_NE_AND: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_NE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_NE_OR: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_NE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP4_NE_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_CREL, ASM_CT_NE); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_CMP4; - break; - case ASM_OP_CMP8XCHG16_ACQ: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_ACQ); - op = ASM_OP_CMP8XCHG16; - break; - case ASM_OP_CMP8XCHG16_REL: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_REL); - op = ASM_OP_CMP8XCHG16; - break; - case ASM_OP_CMPXCHG1_ACQ: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_ACQ); - op = ASM_OP_CMPXCHG1; - break; - case ASM_OP_CMPXCHG1_REL: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_REL); - op = ASM_OP_CMPXCHG1; - break; - case ASM_OP_CMPXCHG2_ACQ: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_ACQ); - op = ASM_OP_CMPXCHG2; - break; - case ASM_OP_CMPXCHG2_REL: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_REL); - op = ASM_OP_CMPXCHG2; - break; - case ASM_OP_CMPXCHG4_ACQ: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_ACQ); - op = ASM_OP_CMPXCHG4; - break; - case ASM_OP_CMPXCHG4_REL: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_REL); - op = ASM_OP_CMPXCHG4; - break; - case ASM_OP_CMPXCHG8_ACQ: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_ACQ); - op = ASM_OP_CMPXCHG8; - break; - case ASM_OP_CMPXCHG8_REL: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_REL); - op = ASM_OP_CMPXCHG8; - break; - case ASM_OP_CZX1_L: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_L); - op = ASM_OP_CZX1; - break; - case ASM_OP_CZX1_R: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_R); - op = ASM_OP_CZX1; - break; - case ASM_OP_CZX2_L: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_L); - op = ASM_OP_CZX2; - break; - case ASM_OP_CZX2_R: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_R); - op = ASM_OP_CZX2; - break; - case ASM_OP_DEP_: - asm_cmpltr_add(i, ASM_CC_DEP, ASM_CT_NONE); - op = ASM_OP_DEP; - break; - case ASM_OP_DEP_Z: - asm_cmpltr_add(i, ASM_CC_DEP, ASM_CT_Z); - op = ASM_OP_DEP; - break; - case ASM_OP_FC_: - asm_cmpltr_add(i, ASM_CC_FC, ASM_CT_NONE); - op = ASM_OP_FC; - break; - case ASM_OP_FC_I: - asm_cmpltr_add(i, ASM_CC_FC, ASM_CT_I); - op = ASM_OP_FC; - break; - case ASM_OP_FCLASS_M: - asm_cmpltr_add(i, ASM_CC_FCREL, ASM_CT_M); - op = ASM_OP_FCLASS; - break; - case ASM_OP_FCVT_FX: - asm_cmpltr_add(i, ASM_CC_FCVT, ASM_CT_FX); - asm_cmpltr_add(i, ASM_CC_TRUNC, ASM_CT_NONE); - op = ASM_OP_FCVT; - break; - case ASM_OP_FCVT_FX_TRUNC: - asm_cmpltr_add(i, ASM_CC_FCVT, ASM_CT_FX); - asm_cmpltr_add(i, ASM_CC_TRUNC, ASM_CT_TRUNC); - op = ASM_OP_FCVT; - break; - case ASM_OP_FCVT_FXU: - asm_cmpltr_add(i, ASM_CC_FCVT, ASM_CT_FXU); - asm_cmpltr_add(i, ASM_CC_TRUNC, ASM_CT_NONE); - op = ASM_OP_FCVT; - break; - case ASM_OP_FCVT_FXU_TRUNC: - asm_cmpltr_add(i, ASM_CC_FCVT, ASM_CT_FXU); - asm_cmpltr_add(i, ASM_CC_TRUNC, ASM_CT_TRUNC); - op = ASM_OP_FCVT; - break; - case ASM_OP_FCVT_XF: - asm_cmpltr_add(i, ASM_CC_FCVT, ASM_CT_XF); - asm_cmpltr_add(i, ASM_CC_TRUNC, ASM_CT_NONE); - op = ASM_OP_FCVT; - break; - case ASM_OP_FETCHADD4_ACQ: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_ACQ); - op = ASM_OP_FETCHADD4; - break; - case ASM_OP_FETCHADD4_REL: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_REL); - op = ASM_OP_FETCHADD4; - break; - case ASM_OP_FETCHADD8_ACQ: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_ACQ); - op = ASM_OP_FETCHADD8; - break; - case ASM_OP_FETCHADD8_REL: - asm_cmpltr_add(i, ASM_CC_SEM, ASM_CT_REL); - op = ASM_OP_FETCHADD8; - break; - case ASM_OP_FMA_: - asm_cmpltr_add(i, ASM_CC_PC, ASM_CT_NONE); - op = ASM_OP_FMA; - break; - case ASM_OP_FMA_D: - asm_cmpltr_add(i, ASM_CC_PC, ASM_CT_D); - op = ASM_OP_FMA; - break; - case ASM_OP_FMA_S: - asm_cmpltr_add(i, ASM_CC_PC, ASM_CT_S); - op = ASM_OP_FMA; - break; - case ASM_OP_FMERGE_NS: - asm_cmpltr_add(i, ASM_CC_FMERGE, ASM_CT_NS); - op = ASM_OP_FMERGE; - break; - case ASM_OP_FMERGE_S: - asm_cmpltr_add(i, ASM_CC_FMERGE, ASM_CT_S); - op = ASM_OP_FMERGE; - break; - case ASM_OP_FMERGE_SE: - asm_cmpltr_add(i, ASM_CC_FMERGE, ASM_CT_SE); - op = ASM_OP_FMERGE; - break; - case ASM_OP_FMIX_L: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_L); - op = ASM_OP_FMIX; - break; - case ASM_OP_FMIX_LR: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_LR); - op = ASM_OP_FMIX; - break; - case ASM_OP_FMIX_R: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_R); - op = ASM_OP_FMIX; - break; - case ASM_OP_FMS_: - asm_cmpltr_add(i, ASM_CC_PC, ASM_CT_NONE); - op = ASM_OP_FMS; - break; - case ASM_OP_FMS_D: - asm_cmpltr_add(i, ASM_CC_PC, ASM_CT_D); - op = ASM_OP_FMS; - break; - case ASM_OP_FMS_S: - asm_cmpltr_add(i, ASM_CC_PC, ASM_CT_S); - op = ASM_OP_FMS; - break; - case ASM_OP_FNMA_: - asm_cmpltr_add(i, ASM_CC_PC, ASM_CT_NONE); - op = ASM_OP_FNMA; - break; - case ASM_OP_FNMA_D: - asm_cmpltr_add(i, ASM_CC_PC, ASM_CT_D); - op = ASM_OP_FNMA; - break; - case ASM_OP_FNMA_S: - asm_cmpltr_add(i, ASM_CC_PC, ASM_CT_S); - op = ASM_OP_FNMA; - break; - case ASM_OP_FPCMP_EQ: - asm_cmpltr_add(i, ASM_CC_FREL, ASM_CT_EQ); - op = ASM_OP_FPCMP; - break; - case ASM_OP_FPCMP_LE: - asm_cmpltr_add(i, ASM_CC_FREL, ASM_CT_LE); - op = ASM_OP_FPCMP; - break; - case ASM_OP_FPCMP_LT: - asm_cmpltr_add(i, ASM_CC_FREL, ASM_CT_LT); - op = ASM_OP_FPCMP; - break; - case ASM_OP_FPCMP_NEQ: - asm_cmpltr_add(i, ASM_CC_FREL, ASM_CT_NEQ); - op = ASM_OP_FPCMP; - break; - case ASM_OP_FPCMP_NLE: - asm_cmpltr_add(i, ASM_CC_FREL, ASM_CT_NLE); - op = ASM_OP_FPCMP; - break; - case ASM_OP_FPCMP_NLT: - asm_cmpltr_add(i, ASM_CC_FREL, ASM_CT_NLT); - op = ASM_OP_FPCMP; - break; - case ASM_OP_FPCMP_ORD: - asm_cmpltr_add(i, ASM_CC_FREL, ASM_CT_ORD); - op = ASM_OP_FPCMP; - break; - case ASM_OP_FPCMP_UNORD: - asm_cmpltr_add(i, ASM_CC_FREL, ASM_CT_UNORD); - op = ASM_OP_FPCMP; - break; - case ASM_OP_FPCVT_FX: - asm_cmpltr_add(i, ASM_CC_FCVT, ASM_CT_FX); - asm_cmpltr_add(i, ASM_CC_TRUNC, ASM_CT_NONE); - op = ASM_OP_FPCVT; - break; - case ASM_OP_FPCVT_FX_TRUNC: - asm_cmpltr_add(i, ASM_CC_FCVT, ASM_CT_FX); - asm_cmpltr_add(i, ASM_CC_TRUNC, ASM_CT_TRUNC); - op = ASM_OP_FPCVT; - break; - case ASM_OP_FPCVT_FXU: - asm_cmpltr_add(i, ASM_CC_FCVT, ASM_CT_FXU); - asm_cmpltr_add(i, ASM_CC_TRUNC, ASM_CT_NONE); - op = ASM_OP_FPCVT; - break; - case ASM_OP_FPCVT_FXU_TRUNC: - asm_cmpltr_add(i, ASM_CC_FCVT, ASM_CT_FXU); - asm_cmpltr_add(i, ASM_CC_TRUNC, ASM_CT_TRUNC); - op = ASM_OP_FPCVT; - break; - case ASM_OP_FPMERGE_NS: - asm_cmpltr_add(i, ASM_CC_FMERGE, ASM_CT_NS); - op = ASM_OP_FPMERGE; - break; - case ASM_OP_FPMERGE_S: - asm_cmpltr_add(i, ASM_CC_FMERGE, ASM_CT_S); - op = ASM_OP_FPMERGE; - break; - case ASM_OP_FPMERGE_SE: - asm_cmpltr_add(i, ASM_CC_FMERGE, ASM_CT_SE); - op = ASM_OP_FPMERGE; - break; - case ASM_OP_FSWAP_: - asm_cmpltr_add(i, ASM_CC_FSWAP, ASM_CT_NONE); - op = ASM_OP_FSWAP; - break; - case ASM_OP_FSWAP_NL: - asm_cmpltr_add(i, ASM_CC_FSWAP, ASM_CT_NL); - op = ASM_OP_FSWAP; - break; - case ASM_OP_FSWAP_NR: - asm_cmpltr_add(i, ASM_CC_FSWAP, ASM_CT_NR); - op = ASM_OP_FSWAP; - break; - case ASM_OP_FSXT_L: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_L); - op = ASM_OP_FSXT; - break; - case ASM_OP_FSXT_R: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_R); - op = ASM_OP_FSXT; - break; - case ASM_OP_GETF_D: - asm_cmpltr_add(i, ASM_CC_GETF, ASM_CT_D); - op = ASM_OP_GETF; - break; - case ASM_OP_GETF_EXP: - asm_cmpltr_add(i, ASM_CC_GETF, ASM_CT_EXP); - op = ASM_OP_GETF; - break; - case ASM_OP_GETF_S: - asm_cmpltr_add(i, ASM_CC_GETF, ASM_CT_S); - op = ASM_OP_GETF; - break; - case ASM_OP_GETF_SIG: - asm_cmpltr_add(i, ASM_CC_GETF, ASM_CT_SIG); - op = ASM_OP_GETF; - break; - case ASM_OP_HINT_B: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_B); - op = ASM_OP_HINT; - break; - case ASM_OP_HINT_F: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_F); - op = ASM_OP_HINT; - break; - case ASM_OP_HINT_I: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_I); - op = ASM_OP_HINT; - break; - case ASM_OP_HINT_M: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_M); - op = ASM_OP_HINT; - break; - case ASM_OP_HINT_X: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_X); - op = ASM_OP_HINT; - break; - case ASM_OP_INVALA_: - asm_cmpltr_add(i, ASM_CC_INVALA, ASM_CT_NONE); - op = ASM_OP_INVALA; - break; - case ASM_OP_INVALA_E: - asm_cmpltr_add(i, ASM_CC_INVALA, ASM_CT_E); - op = ASM_OP_INVALA; - break; - case ASM_OP_ITC_D: - asm_cmpltr_add(i, ASM_CC_ITC, ASM_CT_D); - op = ASM_OP_ITC; - break; - case ASM_OP_ITC_I: - asm_cmpltr_add(i, ASM_CC_ITC, ASM_CT_I); - op = ASM_OP_ITC; - break; - case ASM_OP_ITR_D: - asm_cmpltr_add(i, ASM_CC_ITR, ASM_CT_D); - ot = ASM_OPER_DTR; - op = ASM_OP_ITR; - break; - case ASM_OP_ITR_I: - asm_cmpltr_add(i, ASM_CC_ITR, ASM_CT_I); - ot = ASM_OPER_ITR; - op = ASM_OP_ITR; - break; - case ASM_OP_LD1_: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_NONE); - op = ASM_OP_LD1; - break; - case ASM_OP_LD1_A: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_A); - op = ASM_OP_LD1; - break; - case ASM_OP_LD1_ACQ: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_ACQ); - op = ASM_OP_LD1; - break; - case ASM_OP_LD1_BIAS: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_BIAS); - op = ASM_OP_LD1; - break; - case ASM_OP_LD1_C_CLR: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_C_CLR); - op = ASM_OP_LD1; - break; - case ASM_OP_LD1_C_CLR_ACQ: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_C_CLR_ACQ); - op = ASM_OP_LD1; - break; - case ASM_OP_LD1_C_NC: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_C_NC); - op = ASM_OP_LD1; - break; - case ASM_OP_LD1_S: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_S); - op = ASM_OP_LD1; - break; - case ASM_OP_LD1_SA: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_SA); - op = ASM_OP_LD1; - break; - case ASM_OP_LD16_: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_NONE); - op = ASM_OP_LD16; - break; - case ASM_OP_LD16_ACQ: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_ACQ); - op = ASM_OP_LD16; - break; - case ASM_OP_LD2_: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_NONE); - op = ASM_OP_LD2; - break; - case ASM_OP_LD2_A: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_A); - op = ASM_OP_LD2; - break; - case ASM_OP_LD2_ACQ: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_ACQ); - op = ASM_OP_LD2; - break; - case ASM_OP_LD2_BIAS: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_BIAS); - op = ASM_OP_LD2; - break; - case ASM_OP_LD2_C_CLR: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_C_CLR); - op = ASM_OP_LD2; - break; - case ASM_OP_LD2_C_CLR_ACQ: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_C_CLR_ACQ); - op = ASM_OP_LD2; - break; - case ASM_OP_LD2_C_NC: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_C_NC); - op = ASM_OP_LD2; - break; - case ASM_OP_LD2_S: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_S); - op = ASM_OP_LD2; - break; - case ASM_OP_LD2_SA: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_SA); - op = ASM_OP_LD2; - break; - case ASM_OP_LD4_: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_NONE); - op = ASM_OP_LD4; - break; - case ASM_OP_LD4_A: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_A); - op = ASM_OP_LD4; - break; - case ASM_OP_LD4_ACQ: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_ACQ); - op = ASM_OP_LD4; - break; - case ASM_OP_LD4_BIAS: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_BIAS); - op = ASM_OP_LD4; - break; - case ASM_OP_LD4_C_CLR: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_C_CLR); - op = ASM_OP_LD4; - break; - case ASM_OP_LD4_C_CLR_ACQ: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_C_CLR_ACQ); - op = ASM_OP_LD4; - break; - case ASM_OP_LD4_C_NC: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_C_NC); - op = ASM_OP_LD4; - break; - case ASM_OP_LD4_S: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_S); - op = ASM_OP_LD4; - break; - case ASM_OP_LD4_SA: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_SA); - op = ASM_OP_LD4; - break; - case ASM_OP_LD8_: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_NONE); - op = ASM_OP_LD8; - break; - case ASM_OP_LD8_A: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_A); - op = ASM_OP_LD8; - break; - case ASM_OP_LD8_ACQ: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_ACQ); - op = ASM_OP_LD8; - break; - case ASM_OP_LD8_BIAS: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_BIAS); - op = ASM_OP_LD8; - break; - case ASM_OP_LD8_C_CLR: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_C_CLR); - op = ASM_OP_LD8; - break; - case ASM_OP_LD8_C_CLR_ACQ: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_C_CLR_ACQ); - op = ASM_OP_LD8; - break; - case ASM_OP_LD8_C_NC: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_C_NC); - op = ASM_OP_LD8; - break; - case ASM_OP_LD8_FILL: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_FILL); - op = ASM_OP_LD8; - break; - case ASM_OP_LD8_S: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_S); - op = ASM_OP_LD8; - break; - case ASM_OP_LD8_SA: - asm_cmpltr_add(i, ASM_CC_LDTYPE, ASM_CT_SA); - op = ASM_OP_LD8; - break; - case ASM_OP_LDF_FILL: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_FILL); - op = ASM_OP_LDF; - break; - case ASM_OP_LDF8_: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_NONE); - op = ASM_OP_LDF8; - break; - case ASM_OP_LDF8_A: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_A); - op = ASM_OP_LDF8; - break; - case ASM_OP_LDF8_C_CLR: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_CLR); - op = ASM_OP_LDF8; - break; - case ASM_OP_LDF8_C_NC: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_NC); - op = ASM_OP_LDF8; - break; - case ASM_OP_LDF8_S: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_S); - op = ASM_OP_LDF8; - break; - case ASM_OP_LDF8_SA: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_SA); - op = ASM_OP_LDF8; - break; - case ASM_OP_LDFD_: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_NONE); - op = ASM_OP_LDFD; - break; - case ASM_OP_LDFD_A: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_A); - op = ASM_OP_LDFD; - break; - case ASM_OP_LDFD_C_CLR: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_CLR); - op = ASM_OP_LDFD; - break; - case ASM_OP_LDFD_C_NC: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_NC); - op = ASM_OP_LDFD; - break; - case ASM_OP_LDFD_S: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_S); - op = ASM_OP_LDFD; - break; - case ASM_OP_LDFD_SA: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_SA); - op = ASM_OP_LDFD; - break; - case ASM_OP_LDFE_: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_NONE); - op = ASM_OP_LDFE; - break; - case ASM_OP_LDFE_A: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_A); - op = ASM_OP_LDFE; - break; - case ASM_OP_LDFE_C_CLR: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_CLR); - op = ASM_OP_LDFE; - break; - case ASM_OP_LDFE_C_NC: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_NC); - op = ASM_OP_LDFE; - break; - case ASM_OP_LDFE_S: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_S); - op = ASM_OP_LDFE; - break; - case ASM_OP_LDFE_SA: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_SA); - op = ASM_OP_LDFE; - break; - case ASM_OP_LDFP8_: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_NONE); - op = ASM_OP_LDFP8; - break; - case ASM_OP_LDFP8_A: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_A); - op = ASM_OP_LDFP8; - break; - case ASM_OP_LDFP8_C_CLR: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_CLR); - op = ASM_OP_LDFP8; - break; - case ASM_OP_LDFP8_C_NC: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_NC); - op = ASM_OP_LDFP8; - break; - case ASM_OP_LDFP8_S: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_S); - op = ASM_OP_LDFP8; - break; - case ASM_OP_LDFP8_SA: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_SA); - op = ASM_OP_LDFP8; - break; - case ASM_OP_LDFPD_: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_NONE); - op = ASM_OP_LDFPD; - break; - case ASM_OP_LDFPD_A: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_A); - op = ASM_OP_LDFPD; - break; - case ASM_OP_LDFPD_C_CLR: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_CLR); - op = ASM_OP_LDFPD; - break; - case ASM_OP_LDFPD_C_NC: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_NC); - op = ASM_OP_LDFPD; - break; - case ASM_OP_LDFPD_S: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_S); - op = ASM_OP_LDFPD; - break; - case ASM_OP_LDFPD_SA: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_SA); - op = ASM_OP_LDFPD; - break; - case ASM_OP_LDFPS_: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_NONE); - op = ASM_OP_LDFPS; - break; - case ASM_OP_LDFPS_A: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_A); - op = ASM_OP_LDFPS; - break; - case ASM_OP_LDFPS_C_CLR: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_CLR); - op = ASM_OP_LDFPS; - break; - case ASM_OP_LDFPS_C_NC: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_NC); - op = ASM_OP_LDFPS; - break; - case ASM_OP_LDFPS_S: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_S); - op = ASM_OP_LDFPS; - break; - case ASM_OP_LDFPS_SA: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_SA); - op = ASM_OP_LDFPS; - break; - case ASM_OP_LDFS_: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_NONE); - op = ASM_OP_LDFS; - break; - case ASM_OP_LDFS_A: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_A); - op = ASM_OP_LDFS; - break; - case ASM_OP_LDFS_C_CLR: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_CLR); - op = ASM_OP_LDFS; - break; - case ASM_OP_LDFS_C_NC: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_C_NC); - op = ASM_OP_LDFS; - break; - case ASM_OP_LDFS_S: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_S); - op = ASM_OP_LDFS; - break; - case ASM_OP_LDFS_SA: - asm_cmpltr_add(i, ASM_CC_FLDTYPE, ASM_CT_SA); - op = ASM_OP_LDFS; - break; - case ASM_OP_LFETCH_: - asm_cmpltr_add(i, ASM_CC_LFTYPE, ASM_CT_NONE); - asm_cmpltr_add(i, ASM_CC_LFETCH, ASM_CT_NONE); - op = ASM_OP_LFETCH; - break; - case ASM_OP_LFETCH_EXCL: - asm_cmpltr_add(i, ASM_CC_LFTYPE, ASM_CT_NONE); - asm_cmpltr_add(i, ASM_CC_LFETCH, ASM_CT_EXCL); - op = ASM_OP_LFETCH; - break; - case ASM_OP_LFETCH_FAULT: - asm_cmpltr_add(i, ASM_CC_LFTYPE, ASM_CT_FAULT); - asm_cmpltr_add(i, ASM_CC_LFETCH, ASM_CT_NONE); - op = ASM_OP_LFETCH; - break; - case ASM_OP_LFETCH_FAULT_EXCL: - asm_cmpltr_add(i, ASM_CC_LFTYPE, ASM_CT_FAULT); - asm_cmpltr_add(i, ASM_CC_LFETCH, ASM_CT_EXCL); - op = ASM_OP_LFETCH; - break; - case ASM_OP_MF_: - asm_cmpltr_add(i, ASM_CC_MF, ASM_CT_NONE); - op = ASM_OP_MF; - break; - case ASM_OP_MF_A: - asm_cmpltr_add(i, ASM_CC_MF, ASM_CT_A); - op = ASM_OP_MF; - break; - case ASM_OP_MIX1_L: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_L); - op = ASM_OP_MIX1; - break; - case ASM_OP_MIX1_R: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_R); - op = ASM_OP_MIX1; - break; - case ASM_OP_MIX2_L: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_L); - op = ASM_OP_MIX2; - break; - case ASM_OP_MIX2_R: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_R); - op = ASM_OP_MIX2; - break; - case ASM_OP_MIX4_L: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_L); - op = ASM_OP_MIX4; - break; - case ASM_OP_MIX4_R: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_R); - op = ASM_OP_MIX4; - break; - case ASM_OP_MOV_: - asm_cmpltr_add(i, ASM_CC_MOV, ASM_CT_NONE); - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_I: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_I); - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_M: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_M); - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_RET: - asm_cmpltr_add(i, ASM_CC_MOV, ASM_CT_RET); - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_CPUID: - ot = ASM_OPER_CPUID; - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_DBR: - ot = ASM_OPER_DBR; - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_IBR: - ot = ASM_OPER_IBR; - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_IP: - ot = ASM_OPER_IP; - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_MSR: - ot = ASM_OPER_MSR; - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_PKR: - ot = ASM_OPER_PKR; - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_PMC: - ot = ASM_OPER_PMC; - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_PMD: - ot = ASM_OPER_PMD; - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_PR: - ot = ASM_OPER_PR; - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_PSR: - ot = ASM_OPER_PSR; - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_PSR_L: - ot = ASM_OPER_PSR_L; - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_PSR_UM: - ot = ASM_OPER_PSR_UM; - op = ASM_OP_MOV; - break; - case ASM_OP_MOV_RR: - ot = ASM_OPER_RR; - op = ASM_OP_MOV; - break; - case ASM_OP_NOP_B: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_B); - op = ASM_OP_NOP; - break; - case ASM_OP_NOP_F: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_F); - op = ASM_OP_NOP; - break; - case ASM_OP_NOP_I: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_I); - op = ASM_OP_NOP; - break; - case ASM_OP_NOP_M: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_M); - op = ASM_OP_NOP; - break; - case ASM_OP_NOP_X: - asm_cmpltr_add(i, ASM_CC_UNIT, ASM_CT_X); - op = ASM_OP_NOP; - break; - case ASM_OP_PACK2_SSS: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_SSS); - op = ASM_OP_PACK2; - break; - case ASM_OP_PACK2_USS: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_USS); - op = ASM_OP_PACK2; - break; - case ASM_OP_PACK4_SSS: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_SSS); - op = ASM_OP_PACK4; - break; - case ASM_OP_PADD1_: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_NONE); - op = ASM_OP_PADD1; - break; - case ASM_OP_PADD1_SSS: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_SSS); - op = ASM_OP_PADD1; - break; - case ASM_OP_PADD1_UUS: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_UUS); - op = ASM_OP_PADD1; - break; - case ASM_OP_PADD1_UUU: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_UUU); - op = ASM_OP_PADD1; - break; - case ASM_OP_PADD2_: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_NONE); - op = ASM_OP_PADD2; - break; - case ASM_OP_PADD2_SSS: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_SSS); - op = ASM_OP_PADD2; - break; - case ASM_OP_PADD2_UUS: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_UUS); - op = ASM_OP_PADD2; - break; - case ASM_OP_PADD2_UUU: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_UUU); - op = ASM_OP_PADD2; - break; - case ASM_OP_PAVG1_: - asm_cmpltr_add(i, ASM_CC_PAVG, ASM_CT_NONE); - op = ASM_OP_PAVG1; - break; - case ASM_OP_PAVG1_RAZ: - asm_cmpltr_add(i, ASM_CC_PAVG, ASM_CT_RAZ); - op = ASM_OP_PAVG1; - break; - case ASM_OP_PAVG2_: - asm_cmpltr_add(i, ASM_CC_PAVG, ASM_CT_NONE); - op = ASM_OP_PAVG2; - break; - case ASM_OP_PAVG2_RAZ: - asm_cmpltr_add(i, ASM_CC_PAVG, ASM_CT_RAZ); - op = ASM_OP_PAVG2; - break; - case ASM_OP_PCMP1_EQ: - asm_cmpltr_add(i, ASM_CC_PREL, ASM_CT_EQ); - op = ASM_OP_PCMP1; - break; - case ASM_OP_PCMP1_GT: - asm_cmpltr_add(i, ASM_CC_PREL, ASM_CT_GT); - op = ASM_OP_PCMP1; - break; - case ASM_OP_PCMP2_EQ: - asm_cmpltr_add(i, ASM_CC_PREL, ASM_CT_EQ); - op = ASM_OP_PCMP2; - break; - case ASM_OP_PCMP2_GT: - asm_cmpltr_add(i, ASM_CC_PREL, ASM_CT_GT); - op = ASM_OP_PCMP2; - break; - case ASM_OP_PCMP4_EQ: - asm_cmpltr_add(i, ASM_CC_PREL, ASM_CT_EQ); - op = ASM_OP_PCMP4; - break; - case ASM_OP_PCMP4_GT: - asm_cmpltr_add(i, ASM_CC_PREL, ASM_CT_GT); - op = ASM_OP_PCMP4; - break; - case ASM_OP_PMAX1_U: - asm_cmpltr_add(i, ASM_CC_UNS, ASM_CT_U); - op = ASM_OP_PMAX1; - break; - case ASM_OP_PMIN1_U: - asm_cmpltr_add(i, ASM_CC_UNS, ASM_CT_U); - op = ASM_OP_PMIN1; - break; - case ASM_OP_PMPY2_L: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_L); - op = ASM_OP_PMPY2; - break; - case ASM_OP_PMPY2_R: - asm_cmpltr_add(i, ASM_CC_LR, ASM_CT_R); - op = ASM_OP_PMPY2; - break; - case ASM_OP_PMPYSHR2_: - asm_cmpltr_add(i, ASM_CC_UNS, ASM_CT_NONE); - op = ASM_OP_PMPYSHR2; - break; - case ASM_OP_PMPYSHR2_U: - asm_cmpltr_add(i, ASM_CC_UNS, ASM_CT_U); - op = ASM_OP_PMPYSHR2; - break; - case ASM_OP_PROBE_R: - asm_cmpltr_add(i, ASM_CC_RW, ASM_CT_R); - asm_cmpltr_add(i, ASM_CC_PRTYPE, ASM_CT_NONE); - op = ASM_OP_PROBE; - break; - case ASM_OP_PROBE_R_FAULT: - asm_cmpltr_add(i, ASM_CC_RW, ASM_CT_R); - asm_cmpltr_add(i, ASM_CC_PRTYPE, ASM_CT_FAULT); - op = ASM_OP_PROBE; - break; - case ASM_OP_PROBE_RW_FAULT: - asm_cmpltr_add(i, ASM_CC_RW, ASM_CT_RW); - asm_cmpltr_add(i, ASM_CC_PRTYPE, ASM_CT_FAULT); - op = ASM_OP_PROBE; - break; - case ASM_OP_PROBE_W: - asm_cmpltr_add(i, ASM_CC_RW, ASM_CT_W); - asm_cmpltr_add(i, ASM_CC_PRTYPE, ASM_CT_NONE); - op = ASM_OP_PROBE; - break; - case ASM_OP_PROBE_W_FAULT: - asm_cmpltr_add(i, ASM_CC_RW, ASM_CT_W); - asm_cmpltr_add(i, ASM_CC_PRTYPE, ASM_CT_FAULT); - op = ASM_OP_PROBE; - break; - case ASM_OP_PSHR2_: - asm_cmpltr_add(i, ASM_CC_UNS, ASM_CT_NONE); - op = ASM_OP_PSHR2; - break; - case ASM_OP_PSHR2_U: - asm_cmpltr_add(i, ASM_CC_UNS, ASM_CT_U); - op = ASM_OP_PSHR2; - break; - case ASM_OP_PSHR4_: - asm_cmpltr_add(i, ASM_CC_UNS, ASM_CT_NONE); - op = ASM_OP_PSHR4; - break; - case ASM_OP_PSHR4_U: - asm_cmpltr_add(i, ASM_CC_UNS, ASM_CT_U); - op = ASM_OP_PSHR4; - break; - case ASM_OP_PSUB1_: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_NONE); - op = ASM_OP_PSUB1; - break; - case ASM_OP_PSUB1_SSS: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_SSS); - op = ASM_OP_PSUB1; - break; - case ASM_OP_PSUB1_UUS: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_UUS); - op = ASM_OP_PSUB1; - break; - case ASM_OP_PSUB1_UUU: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_UUU); - op = ASM_OP_PSUB1; - break; - case ASM_OP_PSUB2_: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_NONE); - op = ASM_OP_PSUB2; - break; - case ASM_OP_PSUB2_SSS: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_SSS); - op = ASM_OP_PSUB2; - break; - case ASM_OP_PSUB2_UUS: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_UUS); - op = ASM_OP_PSUB2; - break; - case ASM_OP_PSUB2_UUU: - asm_cmpltr_add(i, ASM_CC_SAT, ASM_CT_UUU); - op = ASM_OP_PSUB2; - break; - case ASM_OP_PTC_E: - asm_cmpltr_add(i, ASM_CC_PTC, ASM_CT_E); - op = ASM_OP_PTC; - break; - case ASM_OP_PTC_G: - asm_cmpltr_add(i, ASM_CC_PTC, ASM_CT_G); - op = ASM_OP_PTC; - break; - case ASM_OP_PTC_GA: - asm_cmpltr_add(i, ASM_CC_PTC, ASM_CT_GA); - op = ASM_OP_PTC; - break; - case ASM_OP_PTC_L: - asm_cmpltr_add(i, ASM_CC_PTC, ASM_CT_L); - op = ASM_OP_PTC; - break; - case ASM_OP_PTR_D: - asm_cmpltr_add(i, ASM_CC_PTR, ASM_CT_D); - op = ASM_OP_PTR; - break; - case ASM_OP_PTR_I: - asm_cmpltr_add(i, ASM_CC_PTR, ASM_CT_I); - op = ASM_OP_PTR; - break; - case ASM_OP_SETF_D: - asm_cmpltr_add(i, ASM_CC_SETF, ASM_CT_D); - op = ASM_OP_SETF; - break; - case ASM_OP_SETF_EXP: - asm_cmpltr_add(i, ASM_CC_SETF, ASM_CT_EXP); - op = ASM_OP_SETF; - break; - case ASM_OP_SETF_S: - asm_cmpltr_add(i, ASM_CC_SETF, ASM_CT_S); - op = ASM_OP_SETF; - break; - case ASM_OP_SETF_SIG: - asm_cmpltr_add(i, ASM_CC_SETF, ASM_CT_SIG); - op = ASM_OP_SETF; - break; - case ASM_OP_SHR_: - asm_cmpltr_add(i, ASM_CC_UNS, ASM_CT_NONE); - op = ASM_OP_SHR; - break; - case ASM_OP_SHR_U: - asm_cmpltr_add(i, ASM_CC_UNS, ASM_CT_U); - op = ASM_OP_SHR; - break; - case ASM_OP_SRLZ_D: - asm_cmpltr_add(i, ASM_CC_SRLZ, ASM_CT_D); - op = ASM_OP_SRLZ; - break; - case ASM_OP_SRLZ_I: - asm_cmpltr_add(i, ASM_CC_SRLZ, ASM_CT_I); - op = ASM_OP_SRLZ; - break; - case ASM_OP_ST1_: - asm_cmpltr_add(i, ASM_CC_STTYPE, ASM_CT_NONE); - op = ASM_OP_ST1; - break; - case ASM_OP_ST1_REL: - asm_cmpltr_add(i, ASM_CC_STTYPE, ASM_CT_REL); - op = ASM_OP_ST1; - break; - case ASM_OP_ST16_: - asm_cmpltr_add(i, ASM_CC_STTYPE, ASM_CT_NONE); - op = ASM_OP_ST16; - break; - case ASM_OP_ST16_REL: - asm_cmpltr_add(i, ASM_CC_STTYPE, ASM_CT_REL); - op = ASM_OP_ST16; - break; - case ASM_OP_ST2_: - asm_cmpltr_add(i, ASM_CC_STTYPE, ASM_CT_NONE); - op = ASM_OP_ST2; - break; - case ASM_OP_ST2_REL: - asm_cmpltr_add(i, ASM_CC_STTYPE, ASM_CT_REL); - op = ASM_OP_ST2; - break; - case ASM_OP_ST4_: - asm_cmpltr_add(i, ASM_CC_STTYPE, ASM_CT_NONE); - op = ASM_OP_ST4; - break; - case ASM_OP_ST4_REL: - asm_cmpltr_add(i, ASM_CC_STTYPE, ASM_CT_REL); - op = ASM_OP_ST4; - break; - case ASM_OP_ST8_: - asm_cmpltr_add(i, ASM_CC_STTYPE, ASM_CT_NONE); - op = ASM_OP_ST8; - break; - case ASM_OP_ST8_REL: - asm_cmpltr_add(i, ASM_CC_STTYPE, ASM_CT_REL); - op = ASM_OP_ST8; - break; - case ASM_OP_ST8_SPILL: - asm_cmpltr_add(i, ASM_CC_STTYPE, ASM_CT_SPILL); - op = ASM_OP_ST8; - break; - case ASM_OP_STF_SPILL: - asm_cmpltr_add(i, ASM_CC_STTYPE, ASM_CT_SPILL); - op = ASM_OP_STF; - break; - case ASM_OP_SYNC_I: - asm_cmpltr_add(i, ASM_CC_SYNC, ASM_CT_I); - op = ASM_OP_SYNC; - break; - case ASM_OP_TBIT_NZ_AND: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_NZ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_TBIT; - break; - case ASM_OP_TBIT_NZ_OR: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_NZ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_TBIT; - break; - case ASM_OP_TBIT_NZ_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_NZ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_TBIT; - break; - case ASM_OP_TBIT_Z: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_NONE); - op = ASM_OP_TBIT; - break; - case ASM_OP_TBIT_Z_AND: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_TBIT; - break; - case ASM_OP_TBIT_Z_OR: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_TBIT; - break; - case ASM_OP_TBIT_Z_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_TBIT; - break; - case ASM_OP_TBIT_Z_UNC: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_UNC); - op = ASM_OP_TBIT; - break; - case ASM_OP_TF_NZ_AND: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_NZ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_TF; - break; - case ASM_OP_TF_NZ_OR: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_NZ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_TF; - break; - case ASM_OP_TF_NZ_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_NZ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_TF; - break; - case ASM_OP_TF_Z: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_NONE); - op = ASM_OP_TF; - break; - case ASM_OP_TF_Z_AND: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_TF; - break; - case ASM_OP_TF_Z_OR: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_TF; - break; - case ASM_OP_TF_Z_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_TF; - break; - case ASM_OP_TF_Z_UNC: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_UNC); - op = ASM_OP_TF; - break; - case ASM_OP_TNAT_NZ_AND: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_NZ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_TNAT; - break; - case ASM_OP_TNAT_NZ_OR: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_NZ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_TNAT; - break; - case ASM_OP_TNAT_NZ_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_NZ); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_TNAT; - break; - case ASM_OP_TNAT_Z: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_NONE); - op = ASM_OP_TNAT; - break; - case ASM_OP_TNAT_Z_AND: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_AND); - op = ASM_OP_TNAT; - break; - case ASM_OP_TNAT_Z_OR: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR); - op = ASM_OP_TNAT; - break; - case ASM_OP_TNAT_Z_OR_ANDCM: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_OR_ANDCM); - op = ASM_OP_TNAT; - break; - case ASM_OP_TNAT_Z_UNC: - asm_cmpltr_add(i, ASM_CC_TREL, ASM_CT_Z); - asm_cmpltr_add(i, ASM_CC_CTYPE, ASM_CT_UNC); - op = ASM_OP_TNAT; - break; - case ASM_OP_UNPACK1_H: - asm_cmpltr_add(i, ASM_CC_UNPACK, ASM_CT_H); - op = ASM_OP_UNPACK1; - break; - case ASM_OP_UNPACK1_L: - asm_cmpltr_add(i, ASM_CC_UNPACK, ASM_CT_L); - op = ASM_OP_UNPACK1; - break; - case ASM_OP_UNPACK2_H: - asm_cmpltr_add(i, ASM_CC_UNPACK, ASM_CT_H); - op = ASM_OP_UNPACK2; - break; - case ASM_OP_UNPACK2_L: - asm_cmpltr_add(i, ASM_CC_UNPACK, ASM_CT_L); - op = ASM_OP_UNPACK2; - break; - case ASM_OP_UNPACK4_H: - asm_cmpltr_add(i, ASM_CC_UNPACK, ASM_CT_H); - op = ASM_OP_UNPACK4; - break; - case ASM_OP_UNPACK4_L: - asm_cmpltr_add(i, ASM_CC_UNPACK, ASM_CT_L); - op = ASM_OP_UNPACK4; - break; - case ASM_OP_VMSW_0: - asm_cmpltr_add(i, ASM_CC_VMSW, ASM_CT_0); - op = ASM_OP_VMSW; - break; - case ASM_OP_VMSW_1: - asm_cmpltr_add(i, ASM_CC_VMSW, ASM_CT_1); - op = ASM_OP_VMSW; - break; - case ASM_OP_XMA_H: - asm_cmpltr_add(i, ASM_CC_XMA, ASM_CT_H); - op = ASM_OP_XMA; - break; - case ASM_OP_XMA_HU: - asm_cmpltr_add(i, ASM_CC_XMA, ASM_CT_HU); - op = ASM_OP_XMA; - break; - case ASM_OP_XMA_L: - asm_cmpltr_add(i, ASM_CC_XMA, ASM_CT_L); - op = ASM_OP_XMA; - break; - default: - KASSERT(op < ASM_OP_NUMBER_OF_OPCODES, ("foo")); - break; - } - i->i_op = op; - return (ot); -} - -static __inline void -op_imm(struct asm_inst *i, int op, uint64_t val) -{ - i->i_oper[op].o_type = ASM_OPER_IMM; - i->i_oper[op].o_value = val; -} - -static __inline void -op_type(struct asm_inst *i, int op, enum asm_oper_type ot) -{ - i->i_oper[op].o_type = ot; -} - -static __inline void -op_value(struct asm_inst *i, int op, uint64_t val) -{ - i->i_oper[op].o_value = val; -} - -static __inline void -operand(struct asm_inst *i, int op, enum asm_oper_type ot, uint64_t bits, - int o, int l) -{ - i->i_oper[op].o_type = ot; - i->i_oper[op].o_value = FIELD(bits, o, l); -} - -static uint64_t -imm(uint64_t bits, int sign, int o, int l) -{ - uint64_t val = FIELD(bits, o, l); - - if (sign && (val & (1LL << (l - 1))) != 0) - val |= -1LL << l; - return (val); -} - -static void -s_imm(struct asm_inst *i, int op, uint64_t bits, int o, int l) -{ - i->i_oper[op].o_type = ASM_OPER_IMM; - i->i_oper[op].o_value = imm(bits, 1, o, l); -} - -static void -u_imm(struct asm_inst *i, int op, uint64_t bits, int o, int l) -{ - i->i_oper[op].o_type = ASM_OPER_IMM; - i->i_oper[op].o_value = imm(bits, 0, o, l); -} - -static uint64_t -vimm(uint64_t bits, int sign, va_list ap) -{ - uint64_t val = 0; - int len = 0; - int frag; - - while ((frag = va_arg(ap, int)) != 0) { - val |= (uint64_t)FIELD(bits, FRAG_OFS(frag), FRAG_LEN(frag)) - << len; - len += FRAG_LEN(frag); - } - if (sign && (val & (1LL << (len - 1))) != 0) - val |= -1LL << len; - return (val); -} - -static void -s_immf(struct asm_inst *i, int op, uint64_t bits, ...) -{ - va_list ap; - va_start(ap, bits); - i->i_oper[op].o_type = ASM_OPER_IMM; - i->i_oper[op].o_value = vimm(bits, 1, ap); - va_end(ap); -} - -static void -u_immf(struct asm_inst *i, int op, uint64_t bits, ...) -{ - va_list ap; - va_start(ap, bits); - i->i_oper[op].o_type = ASM_OPER_IMM; - i->i_oper[op].o_value = vimm(bits, 0, ap); - va_end(ap); -} - -static void -disp(struct asm_inst *i, int op, uint64_t bits, ...) -{ - va_list ap; - va_start(ap, bits); - i->i_oper[op].o_type = ASM_OPER_DISP; - i->i_oper[op].o_value = vimm(bits, 1, ap) << 4; - va_end(ap); -} - -static __inline void -combine(uint64_t *dst, int dl, uint64_t src, int sl, int so) -{ - *dst = (*dst & ((1LL << dl) - 1LL)) | - ((uint64_t)_FLD64(src, so, sl) << dl); -} - -int -asm_extract(enum asm_op op, enum asm_fmt fmt, uint64_t bits, - struct asm_bundle *b, int slot) -{ - struct asm_inst *i = b->b_inst + slot; - enum asm_oper_type ot; - - KASSERT(op != ASM_OP_NONE, ("foo")); - i->i_bits = bits; - i->i_format = fmt; - i->i_srcidx = 2; - - ot = asm_normalize(i, op); - - if (fmt != ASM_FMT_B6 && fmt != ASM_FMT_B7) - operand(i, 0, ASM_OPER_PREG, bits, 0, 6); - - switch (fmt) { - case ASM_FMT_A1: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - operand(i, 3, ASM_OPER_GREG, bits, 20, 7); - if ((op == ASM_OP_ADD && FIELD(bits, 27, 2) == 1) || - (op == ASM_OP_SUB && FIELD(bits, 27, 2) == 0)) - op_imm(i, 4, 1LL); - break; - case ASM_FMT_A2: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - op_imm(i, 3, 1LL + FIELD(bits, 27, 2)); - operand(i, 4, ASM_OPER_GREG, bits, 20, 7); - break; - case ASM_FMT_A3: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - s_immf(i, 2, bits, FRAG(13,7), FRAG(36,1), 0); - operand(i, 3, ASM_OPER_GREG, bits, 20, 7); - break; - case ASM_FMT_A4: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - s_immf(i, 2, bits, FRAG(13,7), FRAG(27,6), FRAG(36,1), 0); - operand(i, 3, ASM_OPER_GREG, bits, 20, 7); - break; - case ASM_FMT_A5: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - s_immf(i, 2, bits, FRAG(13,7), FRAG(27,9), FRAG(22,5), - FRAG(36,1), 0); - operand(i, 3, ASM_OPER_GREG, bits, 20, 2); - break; - case ASM_FMT_A6: /* 2 dst */ - operand(i, 1, ASM_OPER_PREG, bits, 6, 6); - operand(i, 2, ASM_OPER_PREG, bits, 27, 6); - operand(i, 3, ASM_OPER_GREG, bits, 13, 7); - operand(i, 4, ASM_OPER_GREG, bits, 20, 7); - i->i_srcidx++; - break; - case ASM_FMT_A7: /* 2 dst */ - if (FIELD(bits, 13, 7) != 0) - return (0); - operand(i, 1, ASM_OPER_PREG, bits, 6, 6); - operand(i, 2, ASM_OPER_PREG, bits, 27, 6); - operand(i, 3, ASM_OPER_GREG, bits, 13, 7); - operand(i, 4, ASM_OPER_GREG, bits, 20, 7); - i->i_srcidx++; - break; - case ASM_FMT_A8: /* 2 dst */ - operand(i, 1, ASM_OPER_PREG, bits, 6, 6); - operand(i, 2, ASM_OPER_PREG, bits, 27, 6); - s_immf(i, 3, bits, FRAG(13,7), FRAG(36,1), 0); - operand(i, 4, ASM_OPER_GREG, bits, 20, 7); - i->i_srcidx++; - break; - case ASM_FMT_A9: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - operand(i, 3, ASM_OPER_GREG, bits, 20, 7); - break; - case ASM_FMT_A10: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - op_imm(i, 3, 1LL + FIELD(bits, 27, 2)); - operand(i, 4, ASM_OPER_GREG, bits, 20, 7); - break; - case ASM_FMT_B1: /* 0 dst */ - asm_brhint(i); - disp(i, 1, bits, FRAG(13,20), FRAG(36,1), 0); - break; - case ASM_FMT_B2: /* 0 dst */ - if (FIELD(bits, 0, 6) != 0) - return (0); - asm_brhint(i); - disp(i, 1, bits, FRAG(13,20), FRAG(36,1), 0); - break; - case ASM_FMT_B3: - asm_brhint(i); - operand(i, 1, ASM_OPER_BREG, bits, 6, 3); - disp(i, 2, bits, FRAG(13,20), FRAG(36,1), 0); - break; - case ASM_FMT_B4: /* 0 dst */ - asm_brhint(i); - operand(i, 1, ASM_OPER_BREG, bits, 13, 3); - break; - case ASM_FMT_B5: -#if 0 - if (FIELD(bits, 32, 1) == 0) - return (0); -#endif - asm_brhint(i); - operand(i, 1, ASM_OPER_BREG, bits, 6, 3); - operand(i, 2, ASM_OPER_BREG, bits, 13, 3); - break; - case ASM_FMT_B6: /* 0 dst */ - asm_brphint(i); - disp(i, 1, bits, FRAG(13,20), FRAG(36,1), 0); - disp(i, 2, bits, FRAG(6,7), FRAG(33,2), 0); - i->i_srcidx--; - break; - case ASM_FMT_B7: /* 0 dst */ - asm_brphint(i); - operand(i, 1, ASM_OPER_BREG, bits, 13, 3); - disp(i, 2, bits, FRAG(6,7), FRAG(33,2), 0); - i->i_srcidx--; - break; - case ASM_FMT_B8: - /* no operands */ - break; - case ASM_FMT_B9: /* 0 dst */ - u_immf(i, 1, bits, FRAG(6,20), FRAG(36,1), 0); - break; - case ASM_FMT_F1: - asm_sf(i); - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_FREG, bits, 13, 7); - operand(i, 3, ASM_OPER_FREG, bits, 20, 7); - operand(i, 4, ASM_OPER_FREG, bits, 27, 7); - break; - case ASM_FMT_F2: - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_FREG, bits, 13, 7); - operand(i, 3, ASM_OPER_FREG, bits, 20, 7); - operand(i, 4, ASM_OPER_FREG, bits, 27, 7); - break; - case ASM_FMT_F3: - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_FREG, bits, 13, 7); - operand(i, 3, ASM_OPER_FREG, bits, 20, 7); - operand(i, 4, ASM_OPER_FREG, bits, 27, 7); - break; - case ASM_FMT_F4: /* 2 dst */ - if (FIELD(bits, 33, 1)) { /* ra */ - if (FIELD(bits, 36, 1)) /* rb */ - asm_cmpltr_add(i, ASM_CC_FREL, ASM_CT_UNORD); - else - asm_cmpltr_add(i, ASM_CC_FREL, ASM_CT_LE); - } else { - if (FIELD(bits, 36, 1)) /* rb */ - asm_cmpltr_add(i, ASM_CC_FREL, ASM_CT_LT); - else - asm_cmpltr_add(i, ASM_CC_FREL, ASM_CT_EQ); - } - if (FIELD(bits, 12, 1)) /* ta */ - asm_cmpltr_add(i, ASM_CC_FCTYPE, ASM_CT_UNC); - else - asm_cmpltr_add(i, ASM_CC_FCTYPE, ASM_CT_NONE); - asm_sf(i); - operand(i, 1, ASM_OPER_PREG, bits, 6, 6); - operand(i, 2, ASM_OPER_PREG, bits, 27, 6); - operand(i, 3, ASM_OPER_FREG, bits, 13, 7); - operand(i, 4, ASM_OPER_FREG, bits, 20, 7); - i->i_srcidx++; - break; - case ASM_FMT_F5: /* 2 dst */ - operand(i, 1, ASM_OPER_PREG, bits, 6, 6); - operand(i, 2, ASM_OPER_PREG, bits, 27, 6); - operand(i, 3, ASM_OPER_FREG, bits, 13, 7); - u_immf(i, 4, bits, FRAG(33,2), FRAG(20,7), 0); - i->i_srcidx++; - break; - case ASM_FMT_F6: /* 2 dst */ - asm_sf(i); - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_PREG, bits, 27, 6); - operand(i, 3, ASM_OPER_FREG, bits, 13, 7); - operand(i, 4, ASM_OPER_FREG, bits, 20, 7); - i->i_srcidx++; - break; - case ASM_FMT_F7: /* 2 dst */ - asm_sf(i); - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_PREG, bits, 27, 6); - operand(i, 3, ASM_OPER_FREG, bits, 20, 7); - i->i_srcidx++; - break; - case ASM_FMT_F8: - asm_sf(i); - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_FREG, bits, 13, 7); - operand(i, 3, ASM_OPER_FREG, bits, 20, 7); - break; - case ASM_FMT_F9: - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_FREG, bits, 13, 7); - operand(i, 3, ASM_OPER_FREG, bits, 20, 7); - break; - case ASM_FMT_F10: - asm_sf(i); - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_FREG, bits, 13, 7); - break; - case ASM_FMT_F11: - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_FREG, bits, 13, 7); - break; - case ASM_FMT_F12: /* 0 dst */ - asm_sf(i); - u_imm(i, 1, bits, 13, 7); - u_imm(i, 2, bits, 20, 7); - i->i_srcidx--; - break; - case ASM_FMT_F13: - asm_sf(i); - /* no operands */ - break; - case ASM_FMT_F14: /* 0 dst */ - asm_sf(i); - disp(i, 1, bits, FRAG(6,20), FRAG(36,1), 0); - break; - case ASM_FMT_F15: /* 0 dst */ - u_imm(i, 1, bits, 6, 20); - break; - case ASM_FMT_F16: /* 0 dst */ - u_imm(i, 1, bits, 6, 20); - break; - case ASM_FMT_I1: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - operand(i, 3, ASM_OPER_GREG, bits, 20, 7); - switch (FIELD(bits, 30, 2)) { - case 0: op_imm(i, 4, 0LL); break; - case 1: op_imm(i, 4, 7LL); break; - case 2: op_imm(i, 4, 15LL); break; - case 3: op_imm(i, 4, 16LL); break; - } - break; - case ASM_FMT_I2: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - operand(i, 3, ASM_OPER_GREG, bits, 20, 7); - break; - case ASM_FMT_I3: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - u_imm(i, 3, bits, 20, 4); - break; - case ASM_FMT_I4: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - u_imm(i, 3, bits, 20, 8); - break; - case ASM_FMT_I5: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 20, 7); - operand(i, 3, ASM_OPER_GREG, bits, 13, 7); - break; - case ASM_FMT_I6: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 20, 7); - u_imm(i, 3, bits, 14, 5); - break; - case ASM_FMT_I7: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - operand(i, 3, ASM_OPER_GREG, bits, 20, 7); - break; - case ASM_FMT_I8: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - op_imm(i, 3, 31LL - FIELD(bits, 20, 5)); - break; - case ASM_FMT_I9: - if (FIELD(bits, 13, 7) != 0) - return (0); - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 20, 7); - break; - case ASM_FMT_I10: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - operand(i, 3, ASM_OPER_GREG, bits, 20, 7); - u_imm(i, 4, bits, 27, 6); - break; - case ASM_FMT_I11: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 20, 7); - u_imm(i, 3, bits, 14, 6); - op_imm(i, 4, 1LL + FIELD(bits, 27, 6)); - break; - case ASM_FMT_I12: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - op_imm(i, 3, 63LL - FIELD(bits, 20, 6)); - op_imm(i, 4, 1LL + FIELD(bits, 27, 6)); - break; - case ASM_FMT_I13: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - s_immf(i, 2, bits, FRAG(13,7), FRAG(36,1), 0); - op_imm(i, 3, 63LL - FIELD(bits, 20, 6)); - op_imm(i, 4, 1LL + FIELD(bits, 27, 6)); - break; - case ASM_FMT_I14: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - s_imm(i, 2, bits, 36, 1); - operand(i, 3, ASM_OPER_GREG, bits, 20, 7); - op_imm(i, 4, 63LL - FIELD(bits, 14, 6)); - op_imm(i, 5, 1LL + FIELD(bits, 27, 6)); - break; - case ASM_FMT_I15: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - operand(i, 3, ASM_OPER_GREG, bits, 20, 7); - op_imm(i, 4, 63LL - FIELD(bits, 31, 6)); - op_imm(i, 5, 1LL + FIELD(bits, 27, 4)); - break; - case ASM_FMT_I16: /* 2 dst */ - operand(i, 1, ASM_OPER_PREG, bits, 6, 6); - operand(i, 2, ASM_OPER_PREG, bits, 27, 6); - operand(i, 3, ASM_OPER_GREG, bits, 20, 7); - u_imm(i, 4, bits, 14, 6); - i->i_srcidx++; - break; - case ASM_FMT_I17: /* 2 dst */ - operand(i, 1, ASM_OPER_PREG, bits, 6, 6); - operand(i, 2, ASM_OPER_PREG, bits, 27, 6); - operand(i, 3, ASM_OPER_GREG, bits, 20, 7); - i->i_srcidx++; - break; - case ASM_FMT_I18: - u_immf(i, 1, bits, FRAG(6,20), FRAG(36,1), 0); - break; - case ASM_FMT_I19: - u_immf(i, 1, bits, FRAG(6,20), FRAG(36,1), 0); - break; - case ASM_FMT_I20: /* 0 dst */ - operand(i, 1, ASM_OPER_GREG, bits, 13, 7); - disp(i, 2, bits, FRAG(6,7), FRAG(20,13), FRAG(36,1), 0); - i->i_srcidx--; - break; - case ASM_FMT_I21: - switch (FIELD(bits, 20, 2)) { /* wh */ - case 0: asm_cmpltr_add(i, ASM_CC_MWH, ASM_CT_SPTK); break; - case 1: asm_cmpltr_add(i, ASM_CC_MWH, ASM_CT_NONE); break; - case 2: asm_cmpltr_add(i, ASM_CC_MWH, ASM_CT_DPTK); break; - case 3: return (0); - } - if (FIELD(bits, 23, 1)) /* ih */ - asm_cmpltr_add(i, ASM_CC_IH, ASM_CT_IMP); - else - asm_cmpltr_add(i, ASM_CC_IH, ASM_CT_NONE); - operand(i, 1, ASM_OPER_BREG, bits, 6, 3); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - disp(i, 3, bits, FRAG(24,9), 0); - break; - case ASM_FMT_I22: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_BREG, bits, 13, 3); - break; - case ASM_FMT_I23: - op_type(i, 1, ASM_OPER_PR); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - u_immf(i, 3, bits, FRAG(6,7), FRAG(24,8), FRAG(36,1), 0); - i->i_oper[3].o_value <<= 1; - break; - case ASM_FMT_I24: - op_type(i, 1, ASM_OPER_PR_ROT); - s_immf(i, 2, bits, FRAG(6,27), FRAG(36,1), 0); - break; - case ASM_FMT_I25: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - op_type(i, 2, ot); - break; - case ASM_FMT_I26: - operand(i, 1, ASM_OPER_AREG, bits, 20, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - break; - case ASM_FMT_I27: - operand(i, 1, ASM_OPER_AREG, bits, 20, 7); - s_immf(i, 2, bits, FRAG(13,7), FRAG(36,1), 0); - break; - case ASM_FMT_I28: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_AREG, bits, 20, 7); - break; - case ASM_FMT_I29: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 20, 7); - break; - case ASM_FMT_I30: /* 2 dst */ - operand(i, 1, ASM_OPER_PREG, bits, 6, 6); - operand(i, 2, ASM_OPER_PREG, bits, 27, 6); - op_imm(i, 3, 32LL + FIELD(bits, 14, 5)); - i->i_srcidx++; - break; - case ASM_FMT_M1: - asm_hint(i, ASM_CC_LDHINT); - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - if (i->i_op == ASM_OP_LD16) { - op_type(i, 2, ASM_OPER_AREG); - op_value(i, 2, AR_CSD); - i->i_srcidx++; - } - operand(i, i->i_srcidx, ASM_OPER_MEM, bits, 20, 7); - break; - case ASM_FMT_M2: - asm_hint(i, ASM_CC_LDHINT); - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_MEM, bits, 20, 7); - operand(i, 3, ASM_OPER_GREG, bits, 13, 7); - break; - case ASM_FMT_M3: - asm_hint(i, ASM_CC_LDHINT); - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_MEM, bits, 20, 7); - s_immf(i, 3, bits, FRAG(13,7), FRAG(27,1), FRAG(36,1), 0); - break; - case ASM_FMT_M4: - asm_hint(i, ASM_CC_STHINT); - operand(i, 1, ASM_OPER_MEM, bits, 20, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - if (i->i_op == ASM_OP_ST16) { - op_type(i, 3, ASM_OPER_AREG); - op_value(i, 3, AR_CSD); - } - break; - case ASM_FMT_M5: - asm_hint(i, ASM_CC_STHINT); - operand(i, 1, ASM_OPER_MEM, bits, 20, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - s_immf(i, 3, bits, FRAG(6,7), FRAG(27,1), FRAG(36,1), 0); - break; - case ASM_FMT_M6: - asm_hint(i, ASM_CC_LDHINT); - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_MEM, bits, 20, 7); - break; - case ASM_FMT_M7: - asm_hint(i, ASM_CC_LDHINT); - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_MEM, bits, 20, 7); - operand(i, 3, ASM_OPER_GREG, bits, 13, 7); - break; - case ASM_FMT_M8: - asm_hint(i, ASM_CC_LDHINT); - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_MEM, bits, 20, 7); - s_immf(i, 3, bits, FRAG(13,7), FRAG(27,1), FRAG(36,1), 0); - break; - case ASM_FMT_M9: - asm_hint(i, ASM_CC_STHINT); - operand(i, 1, ASM_OPER_MEM, bits, 20, 7); - operand(i, 2, ASM_OPER_FREG, bits, 13, 7); - break; - case ASM_FMT_M10: - asm_hint(i, ASM_CC_STHINT); - operand(i, 1, ASM_OPER_MEM, bits, 20, 7); - operand(i, 2, ASM_OPER_FREG, bits, 13, 7); - s_immf(i, 3, bits, FRAG(6,7), FRAG(27,1), FRAG(36,1), 0); - break; - case ASM_FMT_M11: /* 2 dst */ - asm_hint(i, ASM_CC_LDHINT); - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_FREG, bits, 13, 7); - operand(i, 3, ASM_OPER_MEM, bits, 20, 7); - i->i_srcidx++; - break; - case ASM_FMT_M12: /* 2 dst */ - asm_hint(i, ASM_CC_LDHINT); - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_FREG, bits, 13, 7); - operand(i, 3, ASM_OPER_MEM, bits, 20, 7); - op_imm(i, 4, 8LL << FIELD(bits, 30, 1)); - i->i_srcidx++; - break; - case ASM_FMT_M13: - asm_hint(i, ASM_CC_LFHINT); - operand(i, 1, ASM_OPER_MEM, bits, 20, 7); - break; - case ASM_FMT_M14: /* 0 dst */ - asm_hint(i, ASM_CC_LFHINT); - operand(i, 1, ASM_OPER_MEM, bits, 20, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - i->i_srcidx--; - break; - case ASM_FMT_M15: /* 0 dst */ - asm_hint(i, ASM_CC_LFHINT); - operand(i, 1, ASM_OPER_MEM, bits, 20, 7); - s_immf(i, 2, bits, FRAG(13,7), FRAG(27,1), FRAG(36,1), 0); - i->i_srcidx--; - break; - case ASM_FMT_M16: - asm_hint(i, ASM_CC_LDHINT); - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_MEM, bits, 20, 7); - operand(i, 3, ASM_OPER_GREG, bits, 13, 7); - if (i->i_op == ASM_OP_CMP8XCHG16) { - op_type(i, 4, ASM_OPER_AREG); - op_value(i, 4, AR_CSD); - op_type(i, 5, ASM_OPER_AREG); - op_value(i, 5, AR_CCV); - } else { - if (FIELD(bits, 30, 6) < 8) { - op_type(i, 4, ASM_OPER_AREG); - op_value(i, 4, AR_CCV); - } - } - break; - case ASM_FMT_M17: - asm_hint(i, ASM_CC_LDHINT); - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_MEM, bits, 20, 7); - switch (FIELD(bits, 13, 2)) { - case 0: op_imm(i, 3, 1LL << 4); break; - case 1: op_imm(i, 3, 1LL << 3); break; - case 2: op_imm(i, 3, 1LL << 2); break; - case 3: op_imm(i, 3, 1LL); break; - } - if (FIELD(bits, 15, 1)) - i->i_oper[3].o_value *= -1LL; - break; - case ASM_FMT_M18: - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - break; - case ASM_FMT_M19: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_FREG, bits, 13, 7); - break; - case ASM_FMT_M20: /* 0 dst */ - operand(i, 1, ASM_OPER_GREG, bits, 13, 7); - disp(i, 2, bits, FRAG(6,7), FRAG(20,13), FRAG(36,1), 0); - i->i_srcidx--; - break; - case ASM_FMT_M21: /* 0 dst */ - operand(i, 1, ASM_OPER_FREG, bits, 13, 7); - disp(i, 2, bits, FRAG(6,7), FRAG(20,13), FRAG(36,1), 0); - i->i_srcidx--; - break; - case ASM_FMT_M22: /* 0 dst */ - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - disp(i, 2, bits, FRAG(13,20), FRAG(36,1), 0); - i->i_srcidx--; - break; - case ASM_FMT_M23: /* 0 dst */ - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - disp(i, 2, bits, FRAG(13,20), FRAG(36,1), 0); - i->i_srcidx--; - break; - case ASM_FMT_M24: - /* no operands */ - break; - case ASM_FMT_M25: - if (FIELD(bits, 0, 6) != 0) - return (0); - /* no operands */ - break; - case ASM_FMT_M26: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - break; - case ASM_FMT_M27: - operand(i, 1, ASM_OPER_FREG, bits, 6, 7); - break; - case ASM_FMT_M28: - operand(i, 1, ASM_OPER_GREG, bits, 20, 7); - break; - case ASM_FMT_M29: - operand(i, 1, ASM_OPER_AREG, bits, 20, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - break; - case ASM_FMT_M30: - operand(i, 1, ASM_OPER_AREG, bits, 20, 7); - s_immf(i, 2, bits, FRAG(13,7), FRAG(36,1), 0); - break; - case ASM_FMT_M31: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_AREG, bits, 20, 7); - break; - case ASM_FMT_M32: - operand(i, 1, ASM_OPER_CREG, bits, 20, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - break; - case ASM_FMT_M33: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_CREG, bits, 20, 7); - break; - case ASM_FMT_M34: { - uint64_t loc, out; - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - op_type(i, 2, ASM_OPER_AREG); - op_value(i, 2, AR_PFS); - loc = FIELD(bits, 20, 7); - out = FIELD(bits, 13, 7) - loc; - op_imm(i, 3, 0); - op_imm(i, 4, loc); - op_imm(i, 5, out); - op_imm(i, 6, (uint64_t)FIELD(bits, 27, 4) << 3); - break; - } - case ASM_FMT_M35: - if (FIELD(bits, 27, 6) == 0x2D) - op_type(i, 1, ASM_OPER_PSR_L); - else - op_type(i, 1, ASM_OPER_PSR_UM); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - break; - case ASM_FMT_M36: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - if (FIELD(bits, 27, 6) == 0x25) - op_type(i, 2, ASM_OPER_PSR); - else - op_type(i, 2, ASM_OPER_PSR_UM); - break; - case ASM_FMT_M37: - u_immf(i, 1, bits, FRAG(6,20), FRAG(36,1), 0); - break; - case ASM_FMT_M38: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 20, 7); - operand(i, 3, ASM_OPER_GREG, bits, 13, 7); - break; - case ASM_FMT_M39: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 20, 7); - u_imm(i, 3, bits, 13, 2); - break; - case ASM_FMT_M40: /* 0 dst */ - operand(i, 1, ASM_OPER_GREG, bits, 20, 7); - u_imm(i, 2, bits, 13, 2); - i->i_srcidx--; - break; - case ASM_FMT_M41: - operand(i, 1, ASM_OPER_GREG, bits, 13, 7); - break; - case ASM_FMT_M42: - operand(i, 1, ot, bits, 20, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - break; - case ASM_FMT_M43: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ot, bits, 20, 7); - break; - case ASM_FMT_M44: - u_immf(i, 1, bits, FRAG(6,21), FRAG(31,2), FRAG(36,1), 0); - break; - case ASM_FMT_M45: /* 0 dst */ - operand(i, 1, ASM_OPER_GREG, bits, 20, 7); - operand(i, 2, ASM_OPER_GREG, bits, 13, 7); - i->i_srcidx--; - break; - case ASM_FMT_M46: - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - operand(i, 2, ASM_OPER_GREG, bits, 20, 7); - break; - case ASM_FMT_M47: - operand(i, 1, ASM_OPER_GREG, bits, 20, 7); - break; - case ASM_FMT_M48: - u_immf(i, 1, bits, FRAG(6,20), FRAG(36,1), 0); - break; - case ASM_FMT_X1: - KASSERT(slot == 2, ("foo")); - u_immf(i, 1, bits, FRAG(6,20), FRAG(36,1), 0); - combine(&i->i_oper[1].o_value, 21, b->b_inst[1].i_bits, 41, 0); - break; - case ASM_FMT_X2: - KASSERT(slot == 2, ("foo")); - operand(i, 1, ASM_OPER_GREG, bits, 6, 7); - u_immf(i, 2, bits, FRAG(13,7), FRAG(27,9), FRAG(22,5), - FRAG(21,1), 0); - combine(&i->i_oper[2].o_value, 22, b->b_inst[1].i_bits, 41, 0); - combine(&i->i_oper[2].o_value, 63, bits, 1, 36); - break; - case ASM_FMT_X3: - KASSERT(slot == 2, ("foo")); - asm_brhint(i); - u_imm(i, 1, bits, 13, 20); - combine(&i->i_oper[1].o_value, 20, b->b_inst[1].i_bits, 39, 2); - combine(&i->i_oper[1].o_value, 59, bits, 1, 36); - i->i_oper[1].o_value <<= 4; - i->i_oper[1].o_type = ASM_OPER_DISP; - break; - case ASM_FMT_X4: - KASSERT(slot == 2, ("foo")); - asm_brhint(i); - operand(i, 1, ASM_OPER_BREG, bits, 6, 3); - u_imm(i, 2, bits, 13, 20); - combine(&i->i_oper[2].o_value, 20, b->b_inst[1].i_bits, 39, 2); - combine(&i->i_oper[2].o_value, 59, bits, 1, 36); - i->i_oper[2].o_value <<= 4; - i->i_oper[2].o_type = ASM_OPER_DISP; - break; - case ASM_FMT_X5: - KASSERT(slot == 2, ("foo")); - u_immf(i, 1, bits, FRAG(6,20), FRAG(36,1), 0); - combine(&i->i_oper[1].o_value, 21, b->b_inst[1].i_bits, 41, 0); - break; - default: - KASSERT(fmt == ASM_FMT_NONE, ("foo")); - return (0); - } - - return (1); -} diff --git a/sys/ia64/disasm/disasm_format.c b/sys/ia64/disasm/disasm_format.c deleted file mode 100644 index 37a3650..0000000 --- a/sys/ia64/disasm/disasm_format.c +++ /dev/null @@ -1,346 +0,0 @@ -/*- - * Copyright (c) 2000-2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> - -#include <ia64/disasm/disasm_int.h> -#include <ia64/disasm/disasm.h> - -/* - * Mnemonics (keep in sync with enum asm_op). - */ -static const char *asm_mnemonics[] = { - NULL, - "add", "addl", "addp4", "adds", "alloc", "and", "andcm", - "br", "break", "brl", "brp", "bsw", - "chk", "clrrrb", "cmp", "cmp4", "cmp8xchg16", "cmpxchg1", "cmpxchg2", - "cmpxchg4", "cmpxchg8", "cover", "czx1", "czx2", - "dep", - "epc", "extr", - "famax", "famin", "fand", "fandcm", "fc", "fchkf", "fclass", "fclrf", - "fcmp", "fcvt", "fetchadd4", "fetchadd8", "flushrs", "fma", "fmax", - "fmerge", "fmin", "fmix", "fms", "fnma", "for", "fpack", "fpamax", - "fpamin", "fpcmp", "fpcvt", "fpma", "fpmax", "fpmerge", "fpmin", - "fpms", "fpnma", "fprcpa", "fprsqrta", "frcpa", "frsqrta", "fselect", - "fsetc", "fswap", "fsxt", "fwb", "fxor", - "getf", - "hint", - "invala", "itc", "itr", - "ld1", "ld16", "ld2", "ld4", "ld8", "ldf", "ldf8", "ldfd", "ldfe", - "ldfp8", "ldfpd", "ldfps", "ldfs", "lfetch", "loadrs", - "mf", "mix1", "mix2", "mix4", "mov", "movl", "mux1", "mux2", - "nop", - "or", - "pack2", "pack4", "padd1", "padd2", "padd4", "pavg1", "pavg2", - "pavgsub1", "pavgsub2", "pcmp1", "pcmp2", "pcmp4", "pmax1", "pmax2", - "pmin1", "pmin2", "pmpy2", "pmpyshr2", "popcnt", "probe", "psad1", - "pshl2", "pshl4", "pshladd2", "pshr2", "pshr4", "pshradd2", "psub1", - "psub2", "psub4", "ptc", "ptr", - "rfi", "rsm", "rum", - "setf", "shl", "shladd", "shladdp4", "shr", "shrp", "srlz", "ssm", - "st1", "st16", "st2", "st4", "st8", "stf", "stf8", "stfd", "stfe", - "stfs", "sub", "sum", "sxt1", "sxt2", "sxt4", "sync", - "tak", "tbit", "tf", "thash", "tnat", "tpa", "ttag", - "unpack1", "unpack2", "unpack4", - "vmsw", - "xchg1", "xchg2", "xchg4", "xchg8", "xma", "xor", - "zxt1", "zxt2", "zxt4" -}; - -/* - * Completers (keep in sync with enum asm_cmpltr_type). - */ -static const char *asm_completers[] = { - "", - ".0", ".1", - ".a", ".acq", ".and", - ".b", ".bias", - ".c.clr", ".c.clr.acq", ".c.nc", ".call", ".cexit", ".cloop", ".clr", - ".ctop", - ".d", ".dc.dc", ".dc.nt", ".dpnt", ".dptk", - ".e", ".eq", ".excl", ".exit", ".exp", - ".f", ".fault", ".few", ".fill", ".fx", ".fxu", - ".g", ".ga", ".ge", ".gt", - ".h", ".hu", - ".i", ".ia", ".imp", - ".l", ".le", ".loop", ".lr", ".lt", ".ltu", - ".m", ".many", - ".nc", ".ne", ".neq", ".nl", ".nle", ".nlt", ".nm", ".nr", ".ns", - ".nt.dc", ".nt.nt", ".nt.tk", ".nt1", ".nt2", ".nta", ".nz", - ".or", ".or.andcm", ".ord", - ".pr", - ".r", ".raz", ".rel", ".ret", ".rw", - ".s", ".s0", ".s1", ".s2", ".s3", ".sa", ".se", ".sig", ".spill", - ".spnt", ".sptk", ".sss", - ".tk.dc", ".tk.nt", ".tk.tk", ".trunc", - ".u", ".unc", ".unord", ".uss", ".uus", ".uuu", - ".w", ".wexit", ".wtop", - ".x", ".xf", - ".z" -}; - -void -asm_completer(const struct asm_cmpltr *c, char *buf) -{ - strcpy(buf, asm_completers[c->c_type]); -} - -void -asm_mnemonic(enum asm_op op, char *buf) -{ - strcpy(buf, asm_mnemonics[(op < ASM_OP_INTERNAL_OPCODES) ? op : 0]); -} - -void -asm_operand(const struct asm_oper *o, char *buf, uint64_t ip) -{ - const char *n; - - n = NULL; - switch (o->o_type) { - case ASM_OPER_AREG: - switch ((int)o->o_value) { - case AR_K0: n = "k0"; break; - case AR_K1: n = "k1"; break; - case AR_K2: n = "k2"; break; - case AR_K3: n = "k3"; break; - case AR_K4: n = "k4"; break; - case AR_K5: n = "k5"; break; - case AR_K6: n = "k6"; break; - case AR_K7: n = "k7"; break; - case AR_RSC: n = "rsc"; break; - case AR_BSP: n = "bsp"; break; - case AR_BSPSTORE: n = "bspstore"; break; - case AR_RNAT: n = "rnat"; break; - case AR_FCR: n = "fcr"; break; - case AR_EFLAG: n = "eflag"; break; - case AR_CSD: n = "csd"; break; - case AR_SSD: n = "ssd"; break; - case AR_CFLG: n = "cflg"; break; - case AR_FSR: n = "fsr"; break; - case AR_FIR: n = "fir"; break; - case AR_FDR: n = "fdr"; break; - case AR_CCV: n = "ccv"; break; - case AR_UNAT: n = "unat"; break; - case AR_FPSR: n = "fpsr"; break; - case AR_ITC: n = "itc"; break; - case AR_PFS: n = "pfs"; break; - case AR_LC: n = "lc"; break; - case AR_EC: n = "ec"; break; - default: - sprintf(buf, "ar%d", (int)o->o_value); - return; - } - sprintf(buf, "ar.%s", n); - return; - case ASM_OPER_BREG: - if (o->o_value != 0) - sprintf(buf, "b%d", (int)o->o_value); - else - strcpy(buf, "rp"); - return; - case ASM_OPER_CPUID: - n = "cpuid"; - break; - case ASM_OPER_CREG: - switch ((int)o->o_value) { - case CR_DCR: n = "dcr"; break; - case CR_ITM: n = "itm"; break; - case CR_IVA: n = "iva"; break; - case CR_PTA: n = "pta"; break; - case CR_IPSR: n = "ipsr"; break; - case CR_ISR: n = "isr"; break; - case CR_IIP: n = "iip"; break; - case CR_IFA: n = "ifa"; break; - case CR_ITIR: n = "itir"; break; - case CR_IIPA: n = "iipa"; break; - case CR_IFS: n = "ifs"; break; - case CR_IIM: n = "iim"; break; - case CR_IHA: n = "iha"; break; - case CR_LID: n = "lid"; break; - case CR_IVR: n = "ivr"; break; - case CR_TPR: n = "tpr"; break; - case CR_EOI: n = "eoi"; break; - case CR_IRR0: n = "irr0"; break; - case CR_IRR1: n = "irr1"; break; - case CR_IRR2: n = "irr2"; break; - case CR_IRR3: n = "irr3"; break; - case CR_ITV: n = "itv"; break; - case CR_PMV: n = "pmv"; break; - case CR_CMCV: n = "cmcv"; break; - case CR_LRR0: n = "lrr0"; break; - case CR_LRR1: n = "lrr1"; break; - default: - sprintf(buf, "cr%d", (int)o->o_value); - return; - } - sprintf(buf, "cr.%s", n); - return; - case ASM_OPER_DBR: - n = "dbr"; - break; - case ASM_OPER_DISP: - sprintf(buf, "%lx", ip + o->o_value); - return; - case ASM_OPER_DTR: - n = "dtr"; - break; - case ASM_OPER_FREG: - sprintf(buf, "f%d", (int)o->o_value); - return; - case ASM_OPER_GREG: - break; - case ASM_OPER_IBR: - n = "ibr"; - break; - case ASM_OPER_IMM: - sprintf(buf, "0x%lx", o->o_value); - return; - case ASM_OPER_IP: - strcpy(buf, "ip"); - return; - case ASM_OPER_ITR: - n = "itr"; - break; - case ASM_OPER_MEM: - n = ""; - break; - case ASM_OPER_MSR: - n = "msr"; - break; - case ASM_OPER_PKR: - n = "pkr"; - break; - case ASM_OPER_PMC: - n = "pmc"; - break; - case ASM_OPER_PMD: - n = "pmd"; - break; - case ASM_OPER_PR: - strcpy(buf, "pr"); - return; - case ASM_OPER_PR_ROT: - strcpy(buf, "pr.rot"); - return; - case ASM_OPER_PREG: - sprintf(buf, "p%d", (int)o->o_value); - return; - case ASM_OPER_PSR: - strcpy(buf, "psr"); - return; - case ASM_OPER_PSR_L: - strcpy(buf, "psr.l"); - return; - case ASM_OPER_PSR_UM: - strcpy(buf, "psr.um"); - return; - case ASM_OPER_RR: - n = "rr"; - break; - case ASM_OPER_NONE: - KASSERT(0, ("foo")); - break; - } - if (n != NULL) - buf += sprintf(buf, "%s[", n); - switch ((int)o->o_value) { - case 1: strcpy(buf, "gp"); buf += 2; break; - case 12: strcpy(buf, "sp"); buf += 2; break; - case 13: strcpy(buf, "tp"); buf += 2; break; - default: buf += sprintf(buf, "r%d", (int)o->o_value); break; - } - if (n != NULL) - strcpy(buf, "]"); -} - -void -asm_print_bundle(const struct asm_bundle *b, uint64_t ip) -{ - asm_print_inst(b, 0, ip); - asm_print_inst(b, 1, ip); - asm_print_inst(b, 2, ip); -} - -void -asm_print_inst(const struct asm_bundle *b, int slot, uint64_t ip) -{ - char buf[32]; - const struct asm_inst *i; - const char *tmpl; - int n, w; - - tmpl = b->b_templ + slot; - if (*tmpl == ';' || (slot == 2 && b->b_templ[1] == ';')) - tmpl++; - i = b->b_inst + slot; - if (*tmpl == 'L' || i->i_op == ASM_OP_NONE) - return; - - /* Address + slot. */ - printf("%lx[%c] ", ip + slot, *tmpl); - - /* Predicate. */ - if (i->i_oper[0].o_value != 0) { - asm_operand(i->i_oper+0, buf, ip); - w = printf("(%s)", buf); - } else - w = 0; - while (w++ < 8) - printf(" "); - - /* Mnemonic & completers. */ - asm_mnemonic(i->i_op, buf); - w = printf(buf); - n = 0; - while (n < i->i_ncmpltrs) { - asm_completer(i->i_cmpltr + n, buf); - w += printf(buf); - n++; - } - while (w++ < 15) - printf(" "); - printf(" "); - - /* Operands. */ - n = 1; - while (n < 7 && i->i_oper[n].o_type != ASM_OPER_NONE) { - if (n > 1) { - if (n == i->i_srcidx) - printf(" = "); - else - printf(", "); - } - asm_operand(i->i_oper + n, buf, ip); - printf(buf); - n++; - } - printf("\n"); -} diff --git a/sys/ia64/disasm/disasm_int.h b/sys/ia64/disasm/disasm_int.h deleted file mode 100644 index e1410c1..0000000 --- a/sys/ia64/disasm/disasm_int.h +++ /dev/null @@ -1,222 +0,0 @@ -/*- - * Copyright (c) 2000-2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _DISASM_INT_H_ -#define _DISASM_INT_H_ - -#ifdef _DISASM_H_ -#error Include disasm_int.h before disasm.h -#endif - -/* - * Instruction bundle specifics. - */ -#define TMPL_BITS 5 -#define SLOT_BITS 41 -#define SLOT_COUNT 3 - -#define BUNDLE_SIZE (SLOT_COUNT * SLOT_BITS + TMPL_BITS) -#define BUNDLE_BYTES ((BUNDLE_SIZE+7) >> 3) -#define TMPL_MASK ((1 << TMPL_BITS) - 1) -#define SLOT_MASK ((1ULL << SLOT_BITS) - 1ULL) -#define TMPL(p) (*(const uint8_t*)(p) & TMPL_MASK) -#define _U32(p,i) ((uint64_t)(((const uint32_t*)(p))[i])) -#define _SLOT(p,i) (_U32(p,i) | (_U32(p,(i)+1)<<32)) -#define SLOT(p,i) ((_SLOT(p,i) >> (TMPL_BITS+((i)<<3)+(i))) & SLOT_MASK) - -/* - * Instruction specifics - */ -#define _FLD64(i,o,l) ((i >> o) & ((1LL << l) - 1LL)) -#define FIELD(i,o,l) ((uint32_t)_FLD64(i,o,l)) -#define OPCODE(i) FIELD(i, 37, 4) -#define QP_BITS 6 -#define QP(i) FIELD(i, 0, QP_BITS) -#define REG_BITS 7 -#define REG(i,r) FIELD(i, ((r) - 1) * REG_BITS + QP_BITS, REG_BITS) - -/* - * Opcodes used internally as sentinels to denote either a lack of more - * specific information or to preserve the additional state/information - * we already have and need to pass around for later use. - */ -#define ASM_ADDITIONAL_OPCODES \ - ASM_OP_INTERNAL_OPCODES, \ - ASM_OP_BR_CALL, ASM_OP_BR_CEXIT, ASM_OP_BR_CLOOP, \ - ASM_OP_BR_COND, ASM_OP_BR_CTOP, ASM_OP_BR_IA, ASM_OP_BR_RET, \ - ASM_OP_BR_WEXIT, ASM_OP_BR_WTOP, \ - ASM_OP_BREAK_B, ASM_OP_BREAK_F, ASM_OP_BREAK_I, ASM_OP_BREAK_M, \ - ASM_OP_BREAK_X, \ - ASM_OP_BRL_COND, ASM_OP_BRL_CALL, \ - ASM_OP_BRP_, ASM_OP_BRP_RET, \ - ASM_OP_BSW_0, ASM_OP_BSW_1, \ - ASM_OP_CHK_A_CLR, ASM_OP_CHK_A_NC, ASM_OP_CHK_S, \ - ASM_OP_CHK_S_I, ASM_OP_CHK_S_M, \ - ASM_OP_CLRRRB_, ASM_OP_CLRRRB_PR, \ - ASM_OP_CMP_EQ, ASM_OP_CMP_EQ_AND, ASM_OP_CMP_EQ_OR, \ - ASM_OP_CMP_EQ_OR_ANDCM, ASM_OP_CMP_EQ_UNC, ASM_OP_CMP_GE_AND, \ - ASM_OP_CMP_GE_OR, ASM_OP_CMP_GE_OR_ANDCM, ASM_OP_CMP_GT_AND, \ - ASM_OP_CMP_GT_OR, ASM_OP_CMP_GT_OR_ANDCM, ASM_OP_CMP_LE_AND, \ - ASM_OP_CMP_LE_OR, ASM_OP_CMP_LE_OR_ANDCM, ASM_OP_CMP_LT, \ - ASM_OP_CMP_LT_AND, ASM_OP_CMP_LT_OR, ASM_OP_CMP_LT_OR_ANDCM, \ - ASM_OP_CMP_LT_UNC, ASM_OP_CMP_LTU, ASM_OP_CMP_LTU_UNC, \ - ASM_OP_CMP_NE_AND, ASM_OP_CMP_NE_OR, ASM_OP_CMP_NE_OR_ANDCM, \ - ASM_OP_CMP4_EQ, ASM_OP_CMP4_EQ_AND, ASM_OP_CMP4_EQ_OR, \ - ASM_OP_CMP4_EQ_OR_ANDCM, ASM_OP_CMP4_EQ_UNC, ASM_OP_CMP4_GE_AND,\ - ASM_OP_CMP4_GE_OR, ASM_OP_CMP4_GE_OR_ANDCM, ASM_OP_CMP4_GT_AND, \ - ASM_OP_CMP4_GT_OR, ASM_OP_CMP4_GT_OR_ANDCM, ASM_OP_CMP4_LE_AND, \ - ASM_OP_CMP4_LE_OR, ASM_OP_CMP4_LE_OR_ANDCM, ASM_OP_CMP4_LT, \ - ASM_OP_CMP4_LT_AND, ASM_OP_CMP4_LT_OR, ASM_OP_CMP4_LT_OR_ANDCM, \ - ASM_OP_CMP4_LT_UNC, ASM_OP_CMP4_LTU, ASM_OP_CMP4_LTU_UNC, \ - ASM_OP_CMP4_NE_AND, ASM_OP_CMP4_NE_OR, ASM_OP_CMP4_NE_OR_ANDCM, \ - ASM_OP_CMP8XCHG16_ACQ, ASM_OP_CMP8XCHG16_REL, \ - ASM_OP_CMPXCHG1_ACQ, ASM_OP_CMPXCHG1_REL, \ - ASM_OP_CMPXCHG2_ACQ, ASM_OP_CMPXCHG2_REL, \ - ASM_OP_CMPXCHG4_ACQ, ASM_OP_CMPXCHG4_REL, \ - ASM_OP_CMPXCHG8_ACQ, ASM_OP_CMPXCHG8_REL, \ - ASM_OP_CZX1_L, ASM_OP_CZX1_R, \ - ASM_OP_CZX2_L, ASM_OP_CZX2_R, \ - ASM_OP_DEP_, ASM_OP_DEP_Z, \ - ASM_OP_FC_, ASM_OP_FC_I, \ - ASM_OP_FCLASS_M, \ - ASM_OP_FCVT_FX, ASM_OP_FCVT_FX_TRUNC, ASM_OP_FCVT_FXU, \ - ASM_OP_FCVT_FXU_TRUNC, ASM_OP_FCVT_XF, \ - ASM_OP_FETCHADD4_ACQ, ASM_OP_FETCHADD4_REL, \ - ASM_OP_FETCHADD8_ACQ, ASM_OP_FETCHADD8_REL, \ - ASM_OP_FMA_, ASM_OP_FMA_D, ASM_OP_FMA_S, \ - ASM_OP_FMERGE_NS, ASM_OP_FMERGE_S, ASM_OP_FMERGE_SE, \ - ASM_OP_FMIX_L, ASM_OP_FMIX_LR, ASM_OP_FMIX_R, \ - ASM_OP_FMS_, ASM_OP_FMS_D, ASM_OP_FMS_S, \ - ASM_OP_FNMA_, ASM_OP_FNMA_D, ASM_OP_FNMA_S, \ - ASM_OP_FPCMP_EQ, ASM_OP_FPCMP_LE, ASM_OP_FPCMP_LT, \ - ASM_OP_FPCMP_NEQ, ASM_OP_FPCMP_NLE, ASM_OP_FPCMP_NLT, \ - ASM_OP_FPCMP_ORD, ASM_OP_FPCMP_UNORD, \ - ASM_OP_FPCVT_FX, ASM_OP_FPCVT_FX_TRUNC, ASM_OP_FPCVT_FXU, \ - ASM_OP_FPCVT_FXU_TRUNC, \ - ASM_OP_FPMERGE_NS, ASM_OP_FPMERGE_S, ASM_OP_FPMERGE_SE, \ - ASM_OP_FSWAP_, ASM_OP_FSWAP_NL, ASM_OP_FSWAP_NR, \ - ASM_OP_FSXT_L, ASM_OP_FSXT_R, \ - ASM_OP_GETF_D, ASM_OP_GETF_EXP, ASM_OP_GETF_S, ASM_OP_GETF_SIG, \ - ASM_OP_HINT_B, ASM_OP_HINT_F, ASM_OP_HINT_I, ASM_OP_HINT_M, \ - ASM_OP_HINT_X, \ - ASM_OP_INVALA_, ASM_OP_INVALA_E, \ - ASM_OP_ITC_D, ASM_OP_ITC_I, \ - ASM_OP_ITR_D, ASM_OP_ITR_I, \ - ASM_OP_LD1_, ASM_OP_LD1_A, ASM_OP_LD1_ACQ, ASM_OP_LD1_BIAS, \ - ASM_OP_LD1_C_CLR, ASM_OP_LD1_C_CLR_ACQ, ASM_OP_LD1_C_NC, \ - ASM_OP_LD1_S, ASM_OP_LD1_SA, \ - ASM_OP_LD16_, ASM_OP_LD16_ACQ, \ - ASM_OP_LD2_, ASM_OP_LD2_A, ASM_OP_LD2_ACQ, ASM_OP_LD2_BIAS, \ - ASM_OP_LD2_C_CLR, ASM_OP_LD2_C_CLR_ACQ, ASM_OP_LD2_C_NC, \ - ASM_OP_LD2_S, ASM_OP_LD2_SA, \ - ASM_OP_LD4_, ASM_OP_LD4_A, ASM_OP_LD4_ACQ, ASM_OP_LD4_BIAS, \ - ASM_OP_LD4_C_CLR, ASM_OP_LD4_C_CLR_ACQ, ASM_OP_LD4_C_NC, \ - ASM_OP_LD4_S, ASM_OP_LD4_SA, \ - ASM_OP_LD8_, ASM_OP_LD8_A, ASM_OP_LD8_ACQ, ASM_OP_LD8_BIAS, \ - ASM_OP_LD8_C_CLR, ASM_OP_LD8_C_CLR_ACQ, ASM_OP_LD8_C_NC, \ - ASM_OP_LD8_FILL, ASM_OP_LD8_S, ASM_OP_LD8_SA, \ - ASM_OP_LDF_FILL, \ - ASM_OP_LDF8_, ASM_OP_LDF8_A, ASM_OP_LDF8_C_CLR, \ - ASM_OP_LDF8_C_NC, ASM_OP_LDF8_S, ASM_OP_LDF8_SA, \ - ASM_OP_LDFD_, ASM_OP_LDFD_A, ASM_OP_LDFD_C_CLR, \ - ASM_OP_LDFD_C_NC, ASM_OP_LDFD_S, ASM_OP_LDFD_SA, \ - ASM_OP_LDFE_, ASM_OP_LDFE_A, ASM_OP_LDFE_C_CLR, \ - ASM_OP_LDFE_C_NC, ASM_OP_LDFE_S, ASM_OP_LDFE_SA, \ - ASM_OP_LDFP8_, ASM_OP_LDFP8_A, ASM_OP_LDFP8_C_CLR, \ - ASM_OP_LDFP8_C_NC, ASM_OP_LDFP8_S, ASM_OP_LDFP8_SA, \ - ASM_OP_LDFPD_, ASM_OP_LDFPD_A, ASM_OP_LDFPD_C_CLR, \ - ASM_OP_LDFPD_C_NC, ASM_OP_LDFPD_S, ASM_OP_LDFPD_SA, \ - ASM_OP_LDFPS_, ASM_OP_LDFPS_A, ASM_OP_LDFPS_C_CLR, \ - ASM_OP_LDFPS_C_NC, ASM_OP_LDFPS_S, ASM_OP_LDFPS_SA, \ - ASM_OP_LDFS_, ASM_OP_LDFS_A, ASM_OP_LDFS_C_CLR, \ - ASM_OP_LDFS_C_NC, ASM_OP_LDFS_S, ASM_OP_LDFS_SA, \ - ASM_OP_LFETCH_, ASM_OP_LFETCH_EXCL, ASM_OP_LFETCH_FAULT, \ - ASM_OP_LFETCH_FAULT_EXCL, \ - ASM_OP_MF_, ASM_OP_MF_A, \ - ASM_OP_MIX1_L, ASM_OP_MIX1_R, \ - ASM_OP_MIX2_L, ASM_OP_MIX2_R, \ - ASM_OP_MIX4_L, ASM_OP_MIX4_R, \ - ASM_OP_MOV_, ASM_OP_MOV_CPUID, ASM_OP_MOV_DBR, ASM_OP_MOV_I, \ - ASM_OP_MOV_IBR, ASM_OP_MOV_IP, ASM_OP_MOV_M, ASM_OP_MOV_MSR, \ - ASM_OP_MOV_PKR, ASM_OP_MOV_PMC, ASM_OP_MOV_PMD, ASM_OP_MOV_PR, \ - ASM_OP_MOV_PSR, ASM_OP_MOV_PSR_L, ASM_OP_MOV_PSR_UM, \ - ASM_OP_MOV_RET, ASM_OP_MOV_RR, \ - ASM_OP_NOP_B, ASM_OP_NOP_F, ASM_OP_NOP_I, ASM_OP_NOP_M, \ - ASM_OP_NOP_X, \ - ASM_OP_PACK2_SSS, ASM_OP_PACK2_USS, \ - ASM_OP_PACK4_SSS, \ - ASM_OP_PADD1_, ASM_OP_PADD1_SSS, ASM_OP_PADD1_UUS, \ - ASM_OP_PADD1_UUU, \ - ASM_OP_PADD2_, ASM_OP_PADD2_SSS, ASM_OP_PADD2_UUS, \ - ASM_OP_PADD2_UUU, \ - ASM_OP_PAVG1_, ASM_OP_PAVG1_RAZ, \ - ASM_OP_PAVG2_, ASM_OP_PAVG2_RAZ, \ - ASM_OP_PCMP1_EQ, ASM_OP_PCMP1_GT, \ - ASM_OP_PCMP2_EQ, ASM_OP_PCMP2_GT, \ - ASM_OP_PCMP4_EQ, ASM_OP_PCMP4_GT, \ - ASM_OP_PMAX1_U, \ - ASM_OP_PMIN1_U, \ - ASM_OP_PMPY2_L, ASM_OP_PMPY2_R, \ - ASM_OP_PMPYSHR2_, ASM_OP_PMPYSHR2_U, \ - ASM_OP_PROBE_R, ASM_OP_PROBE_R_FAULT, ASM_OP_PROBE_RW_FAULT, \ - ASM_OP_PROBE_W, ASM_OP_PROBE_W_FAULT, \ - ASM_OP_PSHR2_, ASM_OP_PSHR2_U, \ - ASM_OP_PSHR4_, ASM_OP_PSHR4_U, \ - ASM_OP_PSUB1_, ASM_OP_PSUB1_SSS, ASM_OP_PSUB1_UUS, \ - ASM_OP_PSUB1_UUU, \ - ASM_OP_PSUB2_, ASM_OP_PSUB2_SSS, ASM_OP_PSUB2_UUS, \ - ASM_OP_PSUB2_UUU, \ - ASM_OP_PTC_E, ASM_OP_PTC_G, ASM_OP_PTC_GA, ASM_OP_PTC_L, \ - ASM_OP_PTR_D, ASM_OP_PTR_I, \ - ASM_OP_SETF_EXP, ASM_OP_SETF_D, ASM_OP_SETF_S, ASM_OP_SETF_SIG, \ - ASM_OP_SHR_, ASM_OP_SHR_U, \ - ASM_OP_SRLZ_D, ASM_OP_SRLZ_I, \ - ASM_OP_ST1_, ASM_OP_ST1_REL, \ - ASM_OP_ST16_, ASM_OP_ST16_REL, \ - ASM_OP_ST2_, ASM_OP_ST2_REL, \ - ASM_OP_ST4_, ASM_OP_ST4_REL, \ - ASM_OP_ST8_, ASM_OP_ST8_REL, ASM_OP_ST8_SPILL, \ - ASM_OP_STF_SPILL, \ - ASM_OP_SYNC_I, \ - ASM_OP_TBIT_NZ_AND, ASM_OP_TBIT_NZ_OR, ASM_OP_TBIT_NZ_OR_ANDCM, \ - ASM_OP_TBIT_Z, ASM_OP_TBIT_Z_AND, ASM_OP_TBIT_Z_OR, \ - ASM_OP_TBIT_Z_OR_ANDCM, ASM_OP_TBIT_Z_UNC, \ - ASM_OP_TF_NZ_AND, ASM_OP_TF_NZ_OR, ASM_OP_TF_NZ_OR_ANDCM, \ - ASM_OP_TF_Z, ASM_OP_TF_Z_AND, ASM_OP_TF_Z_OR, \ - ASM_OP_TF_Z_OR_ANDCM, ASM_OP_TF_Z_UNC, \ - ASM_OP_TNAT_NZ_AND, ASM_OP_TNAT_NZ_OR, ASM_OP_TNAT_NZ_OR_ANDCM, \ - ASM_OP_TNAT_Z, ASM_OP_TNAT_Z_AND, ASM_OP_TNAT_Z_OR, \ - ASM_OP_TNAT_Z_OR_ANDCM, ASM_OP_TNAT_Z_UNC, \ - ASM_OP_UNPACK1_H, ASM_OP_UNPACK1_L, \ - ASM_OP_UNPACK2_H, ASM_OP_UNPACK2_L, \ - ASM_OP_UNPACK4_H, ASM_OP_UNPACK4_L, \ - ASM_OP_VMSW_0, ASM_OP_VMSW_1, \ - ASM_OP_XMA_H, ASM_OP_XMA_HU, ASM_OP_XMA_L, \ - ASM_OP_NUMBER_OF_OPCODES - -#endif /* _DISASM_INT_H_ */ diff --git a/sys/ia64/ia32/ia32_misc.c b/sys/ia64/ia32/ia32_misc.c deleted file mode 100644 index 148e31a..0000000 --- a/sys/ia64/ia32/ia32_misc.c +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * Copyright (c) 2009 Konstantin Belousov - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_compat.h" - -#include <sys/param.h> -#include <sys/mount.h> -#include <sys/proc.h> -#include <sys/socket.h> -#include <sys/sysent.h> -#include <sys/sysproto.h> -#include <sys/systm.h> -#include <sys/uio.h> - -#include <compat/freebsd32/freebsd32_util.h> -#include <compat/freebsd32/freebsd32.h> -#include <compat/freebsd32/freebsd32_proto.h> - -int -freebsd32_sysarch(struct thread *td, struct freebsd32_sysarch_args *uap) -{ - - return (EOPNOTSUPP); -} - -#ifdef COMPAT_43 -int -ofreebsd32_getpagesize(struct thread *td, - struct ofreebsd32_getpagesize_args *uap) -{ - - td->td_retval[0] = IA32_PAGE_SIZE; - return (0); -} -#endif diff --git a/sys/ia64/ia32/ia32_reg.c b/sys/ia64/ia32/ia32_reg.c deleted file mode 100644 index ae47f72..0000000 --- a/sys/ia64/ia32/ia32_reg.c +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * Copyright (c) 2005 Peter Wemm - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_compat.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <sys/procfs.h> - -int -fill_regs32(struct thread *td, struct reg32 *regs) -{ - - bzero(regs, sizeof(*regs)); - return (EOPNOTSUPP); -} - -int -set_regs32(struct thread *td, struct reg32 *regs) -{ - - return (EOPNOTSUPP); -} - -int -fill_fpregs32(struct thread *td, struct fpreg32 *regs) -{ - - bzero(regs, sizeof(*regs)); - return (EOPNOTSUPP); -} - -int -set_fpregs32(struct thread *td, struct fpreg32 *regs) -{ - - return (EOPNOTSUPP); -} - -int -fill_dbregs32(struct thread *td, struct dbreg32 *regs) -{ - - bzero(regs, sizeof(*regs)); - return (EOPNOTSUPP); -} - -int -set_dbregs32(struct thread *td, struct dbreg32 *regs) -{ - - return (EOPNOTSUPP); -} diff --git a/sys/ia64/ia32/ia32_signal.c b/sys/ia64/ia32/ia32_signal.c deleted file mode 100644 index d17f060..0000000 --- a/sys/ia64/ia32/ia32_signal.c +++ /dev/null @@ -1,298 +0,0 @@ -/*- - * Copyright (c) 2002 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_compat.h" - -#define __ELF_WORD_SIZE 32 - -#include <sys/param.h> -#include <sys/exec.h> -#include <sys/fcntl.h> -#include <sys/imgact.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/mutex.h> -#include <sys/mman.h> -#include <sys/namei.h> -#include <sys/pioctl.h> -#include <sys/proc.h> -#include <sys/procfs.h> -#include <sys/resourcevar.h> -#include <sys/systm.h> -#include <sys/signalvar.h> -#include <sys/stat.h> -#include <sys/sx.h> -#include <sys/syscall.h> -#include <sys/sysctl.h> -#include <sys/sysent.h> -#include <sys/vnode.h> -#include <sys/imgact_elf.h> -#include <sys/sysproto.h> - -#include <machine/frame.h> -#include <machine/md_var.h> -#include <machine/pcb.h> - -#include <vm/vm.h> -#include <vm/vm_kern.h> -#include <vm/vm_param.h> -#include <vm/pmap.h> -#include <vm/vm_map.h> -#include <vm/vm_object.h> -#include <vm/vm_extern.h> - -#include <compat/freebsd32/freebsd32_signal.h> -#include <compat/freebsd32/freebsd32_util.h> -#include <compat/freebsd32/freebsd32_proto.h> -#include <compat/ia32/ia32_signal.h> -#include <x86/include/psl.h> -#include <x86/include/segments.h> -#include <x86/include/specialreg.h> - -char ia32_sigcode[] = { - 0xff, 0x54, 0x24, 0x10, /* call *SIGF_HANDLER(%esp) */ - 0x8d, 0x44, 0x24, 0x14, /* lea SIGF_UC(%esp),%eax */ - 0x50, /* pushl %eax */ - 0xf7, 0x40, 0x54, 0x00, 0x00, 0x02, 0x02, /* testl $PSL_VM,UC_EFLAGS(%ea -x) */ - 0x75, 0x03, /* jne 9f */ - 0x8e, 0x68, 0x14, /* movl UC_GS(%eax),%gs */ - 0xb8, 0x57, 0x01, 0x00, 0x00, /* 9: movl $SYS_sigreturn,%eax */ - 0x50, /* pushl %eax */ - 0xcd, 0x80, /* int $0x80 */ - 0xeb, 0xfe, /* 0: jmp 0b */ - 0 -}; -int sz_ia32_sigcode = sizeof(ia32_sigcode); - -#ifdef COMPAT_43 -int -ofreebsd32_sigreturn(struct thread *td, struct ofreebsd32_sigreturn_args *uap) -{ - - return (EOPNOTSUPP); -} -#endif - -/* - * Signal sending has not been implemented on ia64. This causes - * the sigtramp code to not understand the arguments and the application - * will generally crash if it tries to handle a signal. Calling - * sendsig() means that at least untrapped signals will work. - */ -void -ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) -{ - sendsig(catcher, ksi, mask); -} - -#ifdef COMPAT_FREEBSD4 -int -freebsd4_freebsd32_sigreturn(struct thread *td, struct freebsd4_freebsd32_sigreturn_args *uap) -{ - return (sys_sigreturn(td, (struct sigreturn_args *)uap)); -} -#endif - -int -freebsd32_sigreturn(struct thread *td, struct freebsd32_sigreturn_args *uap) -{ - return (sys_sigreturn(td, (struct sigreturn_args *)uap)); -} - - -void -ia32_setregs(struct thread *td, struct image_params *imgp, u_long stack) -{ - struct trapframe *tf = td->td_frame; - vm_offset_t gdt, ldt; - u_int64_t codesel, datasel, ldtsel; - u_int64_t codeseg, dataseg, gdtseg, ldtseg; - struct segment_descriptor desc; - struct vmspace *vmspace = td->td_proc->p_vmspace; - struct sysentvec *sv; - - sv = td->td_proc->p_sysent; - exec_setregs(td, imgp, stack); - - /* Non-syscall frames are cleared by exec_setregs() */ - if (tf->tf_flags & FRAME_SYSCALL) { - bzero(&tf->tf_scratch, sizeof(tf->tf_scratch)); - bzero(&tf->tf_scratch_fp, sizeof(tf->tf_scratch_fp)); - } else - tf->tf_special.ndirty = 0; - - tf->tf_special.psr |= IA64_PSR_IS; - tf->tf_special.sp = stack; - - /* Point the RSE backstore to something harmless. */ - tf->tf_special.bspstore = (sv->sv_psstrings - sz_ia32_sigcode - - SPARE_USRSPACE + 15) & ~15; - - codesel = LSEL(LUCODE_SEL, SEL_UPL); - datasel = LSEL(LUDATA_SEL, SEL_UPL); - ldtsel = GSEL(GLDT_SEL, SEL_UPL); - - /* Setup ia32 segment registers. */ - tf->tf_scratch.gr16 = (datasel << 48) | (datasel << 32) | - (datasel << 16) | datasel; - tf->tf_scratch.gr17 = (ldtsel << 32) | (datasel << 16) | codesel; - - /* - * Build the GDT and LDT. - */ - gdt = sv->sv_usrstack; - vm_map_find(&vmspace->vm_map, NULL, 0, &gdt, IA32_PAGE_SIZE << 1, 0, - VMFS_NO_SPACE, VM_PROT_ALL, VM_PROT_ALL, 0); - ldt = gdt + IA32_PAGE_SIZE; - - desc.sd_lolimit = 8*NLDT-1; - desc.sd_lobase = ldt & 0xffffff; - desc.sd_type = SDT_SYSLDT; - desc.sd_dpl = SEL_UPL; - desc.sd_p = 1; - desc.sd_hilimit = 0; - desc.sd_def32 = 0; - desc.sd_gran = 0; - desc.sd_hibase = ldt >> 24; - copyout(&desc, (caddr_t) gdt + 8*GLDT_SEL, sizeof(desc)); - - desc.sd_lolimit = ((sv->sv_usrstack >> 12) - 1) & 0xffff; - desc.sd_lobase = 0; - desc.sd_type = SDT_MEMERA; - desc.sd_dpl = SEL_UPL; - desc.sd_p = 1; - desc.sd_hilimit = ((sv->sv_usrstack >> 12) - 1) >> 16; - desc.sd_def32 = 1; - desc.sd_gran = 1; - desc.sd_hibase = 0; - copyout(&desc, (caddr_t) ldt + 8*LUCODE_SEL, sizeof(desc)); - desc.sd_type = SDT_MEMRWA; - copyout(&desc, (caddr_t) ldt + 8*LUDATA_SEL, sizeof(desc)); - - codeseg = 0 /* base */ - + (((sv->sv_usrstack >> 12) - 1) << 32) /* limit */ - + ((long)SDT_MEMERA << 52) - + ((long)SEL_UPL << 57) - + (1L << 59) /* present */ - + (1L << 62) /* 32 bits */ - + (1L << 63); /* page granularity */ - dataseg = 0 /* base */ - + (((sv->sv_usrstack >> 12) - 1) << 32) /* limit */ - + ((long)SDT_MEMRWA << 52) - + ((long)SEL_UPL << 57) - + (1L << 59) /* present */ - + (1L << 62) /* 32 bits */ - + (1L << 63); /* page granularity */ - - tf->tf_scratch.csd = codeseg; - tf->tf_scratch.ssd = dataseg; - tf->tf_scratch.gr24 = dataseg; /* ESD */ - tf->tf_scratch.gr27 = dataseg; /* DSD */ - tf->tf_scratch.gr28 = dataseg; /* FSD */ - tf->tf_scratch.gr29 = dataseg; /* GSD */ - - gdtseg = gdt /* base */ - + ((8L*NGDT - 1) << 32) /* limit */ - + ((long)SDT_SYSNULL << 52) - + ((long)SEL_UPL << 57) - + (1L << 59) /* present */ - + (0L << 62) /* 16 bits */ - + (0L << 63); /* byte granularity */ - ldtseg = ldt /* base */ - + ((8L*NLDT - 1) << 32) /* limit */ - + ((long)SDT_SYSLDT << 52) - + ((long)SEL_UPL << 57) - + (1L << 59) /* present */ - + (0L << 62) /* 16 bits */ - + (0L << 63); /* byte granularity */ - - tf->tf_scratch.gr30 = ldtseg; /* LDTD */ - tf->tf_scratch.gr31 = gdtseg; /* GDTD */ - - /* Set ia32 control registers on this processor. */ - ia64_set_cflg(CR0_PE | CR0_PG | ((long)(CR4_XMM | CR4_FXSR) << 32)); - ia64_set_eflag(PSL_USER); - - /* PS_STRINGS value for BSD/OS binaries. It is 0 for non-BSD/OS. */ - tf->tf_scratch.gr11 = td->td_proc->p_sysent->sv_psstrings; - - /* - * XXX - Linux emulator - * Make sure sure edx is 0x0 on entry. Linux binaries depend - * on it. - */ - td->td_retval[1] = 0; -} - -void -ia32_restorectx(struct pcb *pcb) -{ - - ia64_set_cflg(pcb->pcb_ia32_cflg); - ia64_set_eflag(pcb->pcb_ia32_eflag); - ia64_set_fcr(pcb->pcb_ia32_fcr); - ia64_set_fdr(pcb->pcb_ia32_fdr); - ia64_set_fir(pcb->pcb_ia32_fir); - ia64_set_fsr(pcb->pcb_ia32_fsr); -} - -void -ia32_savectx(struct pcb *pcb) -{ - - pcb->pcb_ia32_cflg = ia64_get_cflg(); - pcb->pcb_ia32_eflag = ia64_get_eflag(); - pcb->pcb_ia32_fcr = ia64_get_fcr(); - pcb->pcb_ia32_fdr = ia64_get_fdr(); - pcb->pcb_ia32_fir = ia64_get_fir(); - pcb->pcb_ia32_fsr = ia64_get_fsr(); -} - -int -freebsd32_getcontext(struct thread *td, struct freebsd32_getcontext_args *uap) -{ - - return (nosys(td, NULL)); -} - -int -freebsd32_setcontext(struct thread *td, struct freebsd32_setcontext_args *uap) -{ - - return (nosys(td, NULL)); -} - -int -freebsd32_swapcontext(struct thread *td, struct freebsd32_swapcontext_args *uap) -{ - - return (nosys(td, NULL)); -} diff --git a/sys/ia64/ia32/ia32_trap.c b/sys/ia64/ia32/ia32_trap.c deleted file mode 100644 index cea8f92..0000000 --- a/sys/ia64/ia32/ia32_trap.c +++ /dev/null @@ -1,282 +0,0 @@ -/*- - * Copyright (c) 2004 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/ktr.h> -#include <sys/sysproto.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/pioctl.h> -#include <sys/proc.h> -#include <sys/ptrace.h> -#include <sys/signalvar.h> -#include <sys/syscall.h> -#include <sys/sysent.h> -#include <machine/cpu.h> -#include <machine/fpu.h> -#include <machine/frame.h> -#include <machine/md_var.h> -#include <x86/include/psl.h> - -#include <security/audit/audit.h> - -#include <compat/ia32/ia32_util.h> - -void -ia32_set_syscall_retval(struct thread *td, int error) -{ - struct proc *p; - struct trapframe *tf; - - tf = td->td_frame; - - switch (error) { - case 0: - tf->tf_scratch.gr8 = td->td_retval[0]; /* eax */ - tf->tf_scratch.gr10 = td->td_retval[1]; /* edx */ - ia64_set_eflag(ia64_get_eflag() & ~PSL_C); - break; - - case ERESTART: - /* - * Reconstruct pc, assuming lcall $X,y is 7 bytes, - * int 0x80 is 2 bytes. XXX Assume int 0x80. - */ - tf->tf_special.iip -= 2; - break; - - case EJUSTRETURN: - break; - - default: - p = td->td_proc; - if (p->p_sysent->sv_errsize) { - if (error >= p->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = p->p_sysent->sv_errtbl[error]; - } - tf->tf_scratch.gr8 = error; - ia64_set_eflag(ia64_get_eflag() | PSL_C); - break; - } -} - -int -ia32_fetch_syscall_args(struct thread *td, struct syscall_args *sa) -{ - struct trapframe *tf; - struct proc *p; - uint32_t args[8]; - caddr_t params; - int error, i; - - tf = td->td_frame; - p = td->td_proc; - - params = (caddr_t)(tf->tf_special.sp & ((1L<<32)-1)) + - sizeof(uint32_t); - sa->code = tf->tf_scratch.gr8; /* eax */ - - if (sa->code == SYS_syscall) { - /* Code is first argument, followed by actual args. */ - sa->code = fuword32(params); - params += sizeof(int); - } else if (sa->code == SYS___syscall) { - /* - * Like syscall, but code is a quad, so as to maintain - * quad alignment for the rest of the arguments. We - * use a 32-bit fetch in case params is not aligned. - */ - sa->code = fuword32(params); - params += sizeof(quad_t); - } - - if (p->p_sysent->sv_mask) - sa->code &= p->p_sysent->sv_mask; - if (sa->code >= p->p_sysent->sv_size) - sa->callp = &p->p_sysent->sv_table[0]; - else - sa->callp = &p->p_sysent->sv_table[sa->code]; - sa->narg = sa->callp->sy_narg; - - if (params != NULL && sa->narg != 0) - error = copyin(params, (caddr_t)args, sa->narg * sizeof(int)); - else - error = 0; - sa->args = &sa->args32[0]; - - if (error == 0) { - for (i = 0; i < sa->narg; i++) - sa->args32[i] = args[i]; - td->td_retval[0] = 0; - td->td_retval[1] = tf->tf_scratch.gr10; /* edx */ - } - - return (error); -} - -#include "../../kern/subr_syscall.c" - -static void -ia32_syscall(struct trapframe *tf) -{ - struct thread *td; - struct syscall_args sa; - register_t eflags; - int error; - ksiginfo_t ksi; - - td = curthread; - eflags = ia64_get_eflag(); - - error = syscallenter(td, &sa); - - /* - * Traced syscall. - */ - if ((eflags & PSL_T) && !(eflags & PSL_VM)) { - ia64_set_eflag(ia64_get_eflag() & ~PSL_T); - ksiginfo_init_trap(&ksi); - ksi.ksi_signo = SIGTRAP; - ksi.ksi_code = TRAP_TRACE; - ksi.ksi_addr = (void *)tf->tf_special.iip; - trapsignal(td, &ksi); - } - - syscallret(td, error, &sa); -} - -/* - * ia32_trap() is called from exception.S to handle the IA-32 specific - * interruption vectors. - */ -void -ia32_trap(int vector, struct trapframe *tf) -{ - struct proc *p; - struct thread *td; - uint64_t ucode; - int sig; - ksiginfo_t ksi; - - KASSERT(TRAPF_USERMODE(tf), ("%s: In kernel mode???", __func__)); - - ia64_set_fpsr(IA64_FPSR_DEFAULT); - PCPU_INC(cnt.v_trap); - - td = curthread; - td->td_frame = tf; - td->td_pticks = 0; - p = td->td_proc; - if (td->td_ucred != p->p_ucred) - cred_update_thread(td); - sig = 0; - ucode = 0; - switch (vector) { - case IA64_VEC_IA32_EXCEPTION: - switch ((tf->tf_special.isr >> 16) & 0xffff) { - case IA32_EXCEPTION_DIVIDE: - ucode = FPE_INTDIV; - sig = SIGFPE; - break; - case IA32_EXCEPTION_DEBUG: - case IA32_EXCEPTION_BREAK: - sig = SIGTRAP; - break; - case IA32_EXCEPTION_OVERFLOW: - ucode = FPE_INTOVF; - sig = SIGFPE; - break; - case IA32_EXCEPTION_BOUND: - ucode = FPE_FLTSUB; - sig = SIGFPE; - break; - case IA32_EXCEPTION_DNA: - ucode = 0; - sig = SIGFPE; - break; - case IA32_EXCEPTION_NOT_PRESENT: - case IA32_EXCEPTION_STACK_FAULT: - case IA32_EXCEPTION_GPFAULT: - ucode = (tf->tf_special.isr & 0xffff) + BUS_SEGM_FAULT; - sig = SIGBUS; - break; - case IA32_EXCEPTION_FPERROR: - ucode = 0; /* XXX */ - sig = SIGFPE; - break; - case IA32_EXCEPTION_ALIGNMENT_CHECK: - ucode = tf->tf_special.ifa; /* VA */ - sig = SIGBUS; - break; - case IA32_EXCEPTION_STREAMING_SIMD: - ucode = 0; /* XXX */ - sig = SIGFPE; - break; - default: - trap_panic(vector, tf); - break; - } - break; - - case IA64_VEC_IA32_INTERCEPT: - /* XXX Maybe need to emulate ia32 instruction. */ - trap_panic(vector, tf); - - case IA64_VEC_IA32_INTERRUPT: - /* INT n instruction - probably a syscall. */ - if (((tf->tf_special.isr >> 16) & 0xffff) == 0x80) { - ia32_syscall(tf); - goto out; - } - ucode = (tf->tf_special.isr >> 16) & 0xffff; - sig = SIGILL; - break; - - default: - /* Should never happen of course. */ - trap_panic(vector, tf); - break; - } - - KASSERT(sig != 0, ("%s: signal not set", __func__)); - - ksiginfo_init_trap(&ksi); - ksi.ksi_signo = sig; - ksi.ksi_code = (int)ucode; /* XXX */ - /* ksi.ksi_addr */ - trapsignal(td, &ksi); - -out: - userret(td, tf); - do_ast(tf); -} diff --git a/sys/ia64/ia64/autoconf.c b/sys/ia64/ia64/autoconf.c deleted file mode 100644 index fa99ecb..0000000 --- a/sys/ia64/ia64/autoconf.c +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * Copyright (c) 1998 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "opt_isa.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/reboot.h> -#include <sys/kernel.h> -#include <sys/mount.h> -#include <sys/sysctl.h> -#include <sys/bus.h> -#include <sys/cons.h> - -#include <machine/intr.h> -#include <machine/md_var.h> - -static void configure_first(void *); -static void configure(void *); -static void configure_final(void *); - -SYSINIT(configure1, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure_first, NULL); -/* SI_ORDER_SECOND is hookable */ -SYSINIT(configure2, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL); -/* SI_ORDER_MIDDLE is hookable */ -SYSINIT(configure3, SI_SUB_CONFIGURE, SI_ORDER_ANY, configure_final, NULL); - -#ifdef DEV_ISA -#include <isa/isavar.h> -device_t isa_bus_device = 0; -#endif - -/* - * Determine i/o configuration for a machine. - */ -static void -configure_first(void *dummy) -{ - - device_add_child(root_bus, "nexus", 0); -} - -static void -configure(void *dummy) -{ - - root_bus_configure(); - - /* - * Probe ISA devices after everything. - */ -#ifdef DEV_ISA - if (isa_bus_device) - isa_probe_children(isa_bus_device); -#endif -} - -static void -configure_final(void *dummy) -{ - - cninit_finish(); - - ia64_enable_intr(); - - cold = 0; -} diff --git a/sys/ia64/ia64/bus_machdep.c b/sys/ia64/ia64/bus_machdep.c deleted file mode 100644 index cd9ebc8..0000000 --- a/sys/ia64/ia64/bus_machdep.c +++ /dev/null @@ -1,377 +0,0 @@ -/*- - * Copyright (c) 2009 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <machine/bus.h> -#include <vm/vm.h> -#include <vm/pmap.h> - -extern u_long ia64_port_base; - -#define __PIO_ADDR(port) \ - (void *)(ia64_port_base | (((port) & 0xfffc) << 10) | ((port) & 0xFFF)) - -int -bus_space_map(bus_space_tag_t bst, bus_addr_t addr, bus_size_t size, - int flags __unused, bus_space_handle_t *bshp) -{ - - *bshp = (__predict_false(bst == IA64_BUS_SPACE_IO)) - ? addr : (uintptr_t)pmap_mapdev(addr, size); - return (0); -} - - -void -bus_space_unmap(bus_space_tag_t bst __unused, bus_space_handle_t bsh, - bus_size_t size) -{ - - pmap_unmapdev(bsh, size); -} - -uint8_t -bus_space_read_io_1(u_long port) -{ - uint8_t v; - - ia64_mf(); - v = ia64_ld1(__PIO_ADDR(port)); - ia64_mf_a(); - ia64_mf(); - return (v); -} - -uint16_t -bus_space_read_io_2(u_long port) -{ - uint16_t v; - - ia64_mf(); - v = ia64_ld2(__PIO_ADDR(port)); - ia64_mf_a(); - ia64_mf(); - return (v); -} - -uint32_t -bus_space_read_io_4(u_long port) -{ - uint32_t v; - - ia64_mf(); - v = ia64_ld4(__PIO_ADDR(port)); - ia64_mf_a(); - ia64_mf(); - return (v); -} - -#if 0 -uint64_t -bus_space_read_io_8(u_long port) -{ -} -#endif - -void -bus_space_write_io_1(u_long port, uint8_t val) -{ - - ia64_mf(); - ia64_st1(__PIO_ADDR(port), val); - ia64_mf_a(); - ia64_mf(); -} - -void -bus_space_write_io_2(u_long port, uint16_t val) -{ - - ia64_mf(); - ia64_st2(__PIO_ADDR(port), val); - ia64_mf_a(); - ia64_mf(); -} - -void -bus_space_write_io_4(u_long port, uint32_t val) -{ - - ia64_mf(); - ia64_st4(__PIO_ADDR(port), val); - ia64_mf_a(); - ia64_mf(); -} - -#if 0 -void -bus_space_write_io_8(u_long port, uint64_t val) -{ -} -#endif - -void -bus_space_read_multi_io_1(u_long port, uint8_t *ptr, size_t count) -{ - - while (count-- > 0) - *ptr++ = bus_space_read_io_1(port); -} - -void -bus_space_read_multi_io_2(u_long port, uint16_t *ptr, size_t count) -{ - - while (count-- > 0) - *ptr++ = bus_space_read_io_2(port); -} - -void -bus_space_read_multi_io_4(u_long port, uint32_t *ptr, size_t count) -{ - - while (count-- > 0) - *ptr++ = bus_space_read_io_4(port); -} - -#if 0 -void -bus_space_read_multi_io_8(u_long port, uint64_t *ptr, size_t count) -{ -} -#endif - -void -bus_space_write_multi_io_1(u_long port, const uint8_t *ptr, size_t count) -{ - - while (count-- > 0) - bus_space_write_io_1(port, *ptr++); -} - -void -bus_space_write_multi_io_2(u_long port, const uint16_t *ptr, size_t count) -{ - - while (count-- > 0) - bus_space_write_io_2(port, *ptr++); -} - -void -bus_space_write_multi_io_4(u_long port, const uint32_t *ptr, size_t count) -{ - - while (count-- > 0) - bus_space_write_io_4(port, *ptr++); -} - -#if 0 -void -bus_space_write_multi_io_8(u_long port, const uint64_t *ptr, size_t count) -{ -} -#endif - -void -bus_space_read_region_io_1(u_long port, uint8_t *ptr, size_t count) -{ - - while (count-- > 0) { - *ptr++ = bus_space_read_io_1(port); - port += 1; - } -} - -void -bus_space_read_region_io_2(u_long port, uint16_t *ptr, size_t count) -{ - - while (count-- > 0) { - *ptr++ = bus_space_read_io_2(port); - port += 2; - } -} - -void -bus_space_read_region_io_4(u_long port, uint32_t *ptr, size_t count) -{ - - while (count-- > 0) { - *ptr++ = bus_space_read_io_4(port); - port += 4; - } -} - -#if 0 -void bus_space_read_region_io_8(u_long, uint64_t *, size_t); -#endif - -void -bus_space_write_region_io_1(u_long port, const uint8_t *ptr, size_t count) -{ - - while (count-- > 0) { - bus_space_write_io_1(port, *ptr++); - port += 1; - } -} - -void -bus_space_write_region_io_2(u_long port, const uint16_t *ptr, size_t count) -{ - - while (count-- > 0) { - bus_space_write_io_2(port, *ptr++); - port += 2; - } -} - -void -bus_space_write_region_io_4(u_long port, const uint32_t *ptr, size_t count) -{ - - while (count-- > 0) { - bus_space_write_io_4(port, *ptr++); - port += 4; - } -} - -#if 0 -void -bus_space_write_region_io_8(u_long port, const uint64_t *ptr, size_t count) -{ -} -#endif - -void -bus_space_set_region_io_1(u_long port, uint8_t val, size_t count) -{ - - while (count-- > 0) { - bus_space_write_io_1(port, val); - port += 1; - } -} - -void -bus_space_set_region_io_2(u_long port, uint16_t val, size_t count) -{ - - while (count-- > 0) { - bus_space_write_io_2(port, val); - port += 2; - } -} - -void -bus_space_set_region_io_4(u_long port, uint32_t val, size_t count) -{ - - while (count-- > 0) { - bus_space_write_io_4(port, val); - port += 4; - } -} - -#if 0 -void -bus_space_set_region_io_8(u_long port, uint64_t val, size_t count) -{ -} -#endif - -void -bus_space_copy_region_io_1(u_long src, u_long dst, size_t count) -{ - long delta; - uint8_t val; - - if (src < dst) { - src += count - 1; - dst += count - 1; - delta = -1; - } else - delta = 1; - - while (count-- > 0) { - val = bus_space_read_io_1(src); - bus_space_write_io_1(dst, val); - src += delta; - dst += delta; - } -} - -void -bus_space_copy_region_io_2(u_long src, u_long dst, size_t count) -{ - long delta; - uint16_t val; - - if (src < dst) { - src += 2 * (count - 1); - dst += 2 * (count - 1); - delta = -2; - } else - delta = 2; - - while (count-- > 0) { - val = bus_space_read_io_2(src); - bus_space_write_io_2(dst, val); - src += delta; - dst += delta; - } -} - -void -bus_space_copy_region_io_4(u_long src, u_long dst, size_t count) -{ - long delta; - uint32_t val; - - if (src < dst) { - src += 4 * (count - 1); - dst += 4 * (count - 1); - delta = -4; - } else - delta = 4; - - while (count-- > 0) { - val = bus_space_read_io_4(src); - bus_space_write_io_4(dst, val); - src += delta; - dst += delta; - } -} - -#if 0 -void -bus_space_copy_region_io_8(u_long src, u_long dst, size_t count) -{ -} -#endif diff --git a/sys/ia64/ia64/busdma_machdep.c b/sys/ia64/ia64/busdma_machdep.c deleted file mode 100644 index 206fc6e..0000000 --- a/sys/ia64/ia64/busdma_machdep.c +++ /dev/null @@ -1,975 +0,0 @@ -/*- - * Copyright (c) 1997 Justin T. Gibbs. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification, immediately at the beginning of the file. - * 2. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/malloc.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/bus.h> -#include <sys/interrupt.h> -#include <sys/memdesc.h> -#include <sys/proc.h> -#include <sys/sysctl.h> -#include <sys/uio.h> - -#include <vm/vm.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> - -#include <machine/atomic.h> -#include <machine/bus.h> -#include <machine/md_var.h> - -#define MAX_BPAGES 1024 - -struct bus_dma_tag { - bus_dma_tag_t parent; - bus_size_t alignment; - bus_addr_t boundary; - bus_addr_t lowaddr; - bus_addr_t highaddr; - bus_dma_filter_t *filter; - void *filterarg; - bus_size_t maxsize; - u_int nsegments; - bus_size_t maxsegsz; - int flags; - int ref_count; - int map_count; - bus_dma_lock_t *lockfunc; - void *lockfuncarg; - bus_dma_segment_t *segments; -}; - -struct bounce_page { - vm_offset_t vaddr; /* kva of bounce buffer */ - bus_addr_t busaddr; /* Physical address */ - vm_offset_t datavaddr; /* kva of client data */ - bus_addr_t dataaddr; /* client physical address */ - bus_size_t datacount; /* client data count */ - STAILQ_ENTRY(bounce_page) links; -}; - -u_int busdma_swi_pending; - -static struct mtx bounce_lock; -static STAILQ_HEAD(bp_list, bounce_page) bounce_page_list; -static int free_bpages; -static int reserved_bpages; -static int active_bpages; -static int total_bpages; -static int total_bounced; -static int total_deferred; - -static SYSCTL_NODE(_hw, OID_AUTO, busdma, CTLFLAG_RD, 0, "Busdma parameters"); -SYSCTL_INT(_hw_busdma, OID_AUTO, free_bpages, CTLFLAG_RD, &free_bpages, 0, - "Free bounce pages"); -SYSCTL_INT(_hw_busdma, OID_AUTO, reserved_bpages, CTLFLAG_RD, &reserved_bpages, - 0, "Reserved bounce pages"); -SYSCTL_INT(_hw_busdma, OID_AUTO, active_bpages, CTLFLAG_RD, &active_bpages, 0, - "Active bounce pages"); -SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, &total_bpages, 0, - "Total bounce pages"); -SYSCTL_INT(_hw_busdma, OID_AUTO, total_bounced, CTLFLAG_RD, &total_bounced, 0, - "Total bounce requests"); -SYSCTL_INT(_hw_busdma, OID_AUTO, total_deferred, CTLFLAG_RD, &total_deferred, - 0, "Total bounce requests that were deferred"); - -struct bus_dmamap { - struct bp_list bpages; - int pagesneeded; - int pagesreserved; - bus_dma_tag_t dmat; - struct memdesc mem; - bus_dmamap_callback_t *callback; - void *callback_arg; - STAILQ_ENTRY(bus_dmamap) links; -}; - -static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist; -static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist; -static struct bus_dmamap nobounce_dmamap; - -static void init_bounce_pages(void *dummy); -static int alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages); -static int reserve_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t map, - int commit); -static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, - vm_offset_t vaddr, bus_addr_t addr, bus_size_t size); -static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage); -static __inline int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, - bus_size_t len); - -/* - * Return true if a match is made. - * - * To find a match walk the chain of bus_dma_tag_t's looking for 'paddr'. - * - * If paddr is within the bounds of the dma tag then call the filter callback - * to check for a match, if there is no filter callback then assume a match. - */ -static __inline int -run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, bus_size_t len) -{ - bus_addr_t bndy; - int retval; - - retval = 0; - bndy = dmat->boundary; - do { - if (((paddr > dmat->lowaddr && paddr <= dmat->highaddr) || - (paddr & (dmat->alignment - 1)) != 0 || - (paddr & bndy) != ((paddr + len) & bndy)) && - (dmat->filter == NULL || - (*dmat->filter)(dmat->filterarg, paddr) != 0)) - retval = 1; - dmat = dmat->parent; - } while (retval == 0 && dmat != NULL); - return (retval); -} - -/* - * Convenience function for manipulating driver locks from busdma (during - * busdma_swi, for example). Drivers that don't provide their own locks - * should specify &Giant to dmat->lockfuncarg. Drivers that use their own - * non-mutex locking scheme don't have to use this at all. - */ -void -busdma_lock_mutex(void *arg, bus_dma_lock_op_t op) -{ - struct mtx *dmtx; - - dmtx = (struct mtx *)arg; - switch (op) { - case BUS_DMA_LOCK: - mtx_lock(dmtx); - break; - case BUS_DMA_UNLOCK: - mtx_unlock(dmtx); - break; - default: - panic("Unknown operation 0x%x for busdma_lock_mutex!", op); - } -} - -/* - * dflt_lock should never get called. It gets put into the dma tag when - * lockfunc == NULL, which is only valid if the maps that are associated - * with the tag are meant to never be defered. - * XXX Should have a way to identify which driver is responsible here. - */ -static void -dflt_lock(void *arg, bus_dma_lock_op_t op) -{ - panic("driver error: busdma dflt_lock called"); -} - -#define BUS_DMA_MIN_ALLOC_COMP BUS_DMA_BUS4 - -/* - * Allocate a device specific dma_tag. - */ -int -bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, - bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, - bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, - int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, - void *lockfuncarg, bus_dma_tag_t *dmat) -{ - bus_dma_tag_t newtag; - int error = 0; - - /* Basic sanity checking */ - if (boundary != 0 && boundary < maxsegsz) - maxsegsz = boundary; - - /* Return a NULL tag on failure */ - *dmat = NULL; - - newtag = (bus_dma_tag_t)malloc(sizeof(*newtag), M_DEVBUF, M_NOWAIT); - if (newtag == NULL) - return (ENOMEM); - - newtag->parent = parent; - newtag->alignment = alignment; - newtag->boundary = boundary; - newtag->lowaddr = trunc_page(lowaddr) + (PAGE_SIZE - 1); - newtag->highaddr = trunc_page(highaddr) + (PAGE_SIZE - 1); - newtag->filter = filter; - newtag->filterarg = filterarg; - newtag->maxsize = maxsize; - newtag->nsegments = nsegments; - newtag->maxsegsz = maxsegsz; - newtag->flags = flags; - newtag->ref_count = 1; /* Count ourself */ - newtag->map_count = 0; - if (lockfunc != NULL) { - newtag->lockfunc = lockfunc; - newtag->lockfuncarg = lockfuncarg; - } else { - newtag->lockfunc = dflt_lock; - newtag->lockfuncarg = NULL; - } - newtag->segments = NULL; - - /* Take into account any restrictions imposed by our parent tag */ - if (parent != NULL) { - newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr); - newtag->highaddr = MAX(parent->highaddr, newtag->highaddr); - if (newtag->boundary == 0) - newtag->boundary = parent->boundary; - else if (parent->boundary != 0) - newtag->boundary = MIN(parent->boundary, - newtag->boundary); - if (newtag->filter == NULL) { - /* - * Short circuit looking at our parent directly - * since we have encapsulated all of its information - */ - newtag->filter = parent->filter; - newtag->filterarg = parent->filterarg; - newtag->parent = parent->parent; - } - if (newtag->parent != NULL) - atomic_add_int(&parent->ref_count, 1); - } - - if (newtag->lowaddr < paddr_max && (flags & BUS_DMA_ALLOCNOW) != 0) { - /* Must bounce */ - - if (ptoa(total_bpages) < maxsize) { - int pages; - - pages = atop(maxsize) - total_bpages; - - /* Add pages to our bounce pool */ - if (alloc_bounce_pages(newtag, pages) < pages) - error = ENOMEM; - } - /* Performed initial allocation */ - newtag->flags |= BUS_DMA_MIN_ALLOC_COMP; - } - - if (error != 0) { - free(newtag, M_DEVBUF); - } else { - *dmat = newtag; - } - return (error); -} - -int -bus_dma_tag_destroy(bus_dma_tag_t dmat) -{ - if (dmat != NULL) { - - if (dmat->map_count != 0) - return (EBUSY); - - while (dmat != NULL) { - bus_dma_tag_t parent; - - parent = dmat->parent; - atomic_subtract_int(&dmat->ref_count, 1); - if (dmat->ref_count == 0) { - if (dmat->segments != NULL) - free(dmat->segments, M_DEVBUF); - free(dmat, M_DEVBUF); - /* - * Last reference count, so - * release our reference - * count on our parent. - */ - dmat = parent; - } else - dmat = NULL; - } - } - return (0); -} - -/* - * Allocate a handle for mapping from kva/uva/physical - * address space into bus device space. - */ -int -bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) -{ - int error; - - error = 0; - - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - M_NOWAIT); - if (dmat->segments == NULL) - return (ENOMEM); - } - - /* - * Bouncing might be required if the driver asks for an active - * exclusion region, a data alignment that is stricter than 1, and/or - * an active address boundary. - */ - if (dmat->lowaddr < paddr_max) { - /* Must bounce */ - int maxpages; - - *mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (*mapp == NULL) - return (ENOMEM); - - /* Initialize the new map */ - STAILQ_INIT(&((*mapp)->bpages)); - - /* - * Attempt to add pages to our pool on a per-instance - * basis up to a sane limit. - */ - maxpages = MIN(MAX_BPAGES, atop(paddr_max - dmat->lowaddr)); - if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 - || (dmat->map_count > 0 && total_bpages < maxpages)) { - int pages; - - pages = MAX(atop(dmat->maxsize), 1); - pages = MIN(maxpages - total_bpages, pages); - if (alloc_bounce_pages(dmat, pages) < pages) - error = ENOMEM; - - if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0) { - if (error == 0) - dmat->flags |= BUS_DMA_MIN_ALLOC_COMP; - } else { - error = 0; - } - } - } else { - *mapp = NULL; - } - if (error == 0) - dmat->map_count++; - return (error); -} - -/* - * Destroy a handle for mapping from kva/uva/physical - * address space into bus device space. - */ -int -bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) -{ - - if (map != NULL && map != &nobounce_dmamap) { - if (STAILQ_FIRST(&map->bpages) != NULL) - return (EBUSY); - free(map, M_DEVBUF); - } - dmat->map_count--; - return (0); -} - - -/* - * Allocate a piece of memory that can be efficiently mapped into - * bus device space based on the constraints lited in the dma tag. - * A dmamap to for use with dmamap_load is also allocated. - */ -int -bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, - bus_dmamap_t *mapp) -{ - int mflags; - - if (flags & BUS_DMA_NOWAIT) - mflags = M_NOWAIT; - else - mflags = M_WAITOK; - - /* If we succeed, no mapping/bouncing will be required */ - *mapp = NULL; - - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - mflags); - if (dmat->segments == NULL) - return (ENOMEM); - } - if (flags & BUS_DMA_ZERO) - mflags |= M_ZERO; - - /* - * XXX: - * (dmat->alignment < dmat->maxsize) is just a quick hack; the exact - * alignment guarantees of malloc need to be nailed down, and the - * code below should be rewritten to take that into account. - * - * In the meantime, we'll warn the user if malloc gets it wrong. - */ - if ((dmat->maxsize <= PAGE_SIZE) && - (dmat->alignment < dmat->maxsize) && - dmat->lowaddr >= paddr_max) { - *vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags); - } else { - /* - * XXX Use Contigmalloc until it is merged into this facility - * and handles multi-seg allocations. Nobody is doing - * multi-seg allocations yet though. - * XXX Certain AGP hardware does. - */ - *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags, - 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, - dmat->boundary); - } - if (*vaddr == NULL) - return (ENOMEM); - else if (vtophys(*vaddr) & (dmat->alignment - 1)) - printf("bus_dmamem_alloc failed to align memory properly.\n"); - return (0); -} - -/* - * Free a piece of memory and it's allociated dmamap, that was allocated - * via bus_dmamem_alloc. Make the same choice for free/contigfree. - */ -void -bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) -{ - /* - * dmamem does not need to be bounced, so the map should be - * NULL - */ - if (map != NULL) - panic("bus_dmamem_free: Invalid map freed\n"); - if ((dmat->maxsize <= PAGE_SIZE) && - (dmat->alignment < dmat->maxsize) && - dmat->lowaddr >= paddr_max) - free(vaddr, M_DEVBUF); - else { - contigfree(vaddr, dmat->maxsize, M_DEVBUF); - } -} - -static void -_bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t buf, - bus_size_t buflen, int flags) -{ - bus_addr_t curaddr; - bus_size_t sgsize; - - if ((dmat->lowaddr < paddr_max || dmat->boundary > 0 || - dmat->alignment > 1) && map != &nobounce_dmamap && - map->pagesneeded == 0) { - /* - * Count the number of bounce pages - * needed in order to complete this transfer - */ - curaddr = buf; - while (buflen != 0) { - sgsize = MIN(buflen, dmat->maxsegsz); - if (run_filter(dmat, curaddr, 0) != 0) { - sgsize = MIN(sgsize, PAGE_SIZE); - map->pagesneeded++; - } - curaddr += sgsize; - buflen -= sgsize; - } - } -} - -static void -_bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap, - void *buf, bus_size_t buflen, int flags) -{ - vm_offset_t vaddr; - vm_offset_t vendaddr; - bus_addr_t paddr; - - if ((dmat->lowaddr < paddr_max || dmat->boundary > 0 || - dmat->alignment > 1) && map != &nobounce_dmamap && - map->pagesneeded == 0) { - /* - * Count the number of bounce pages - * needed in order to complete this transfer - */ - vaddr = trunc_page((vm_offset_t)buf); - vendaddr = (vm_offset_t)buf + buflen; - - while (vaddr < vendaddr) { - if (pmap == kernel_pmap) - paddr = pmap_kextract(vaddr); - else - paddr = pmap_extract(pmap, vaddr); - if (run_filter(dmat, paddr, 0) != 0) - map->pagesneeded++; - vaddr += PAGE_SIZE; - } - } -} - -static int -_bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmamap_t map, int flags) -{ - - /* Reserve Necessary Bounce Pages */ - mtx_lock(&bounce_lock); - if (flags & BUS_DMA_NOWAIT) { - if (reserve_bounce_pages(dmat, map, 0) != 0) { - mtx_unlock(&bounce_lock); - return (ENOMEM); - } - } else { - if (reserve_bounce_pages(dmat, map, 1) != 0) { - /* Queue us for resources */ - STAILQ_INSERT_TAIL(&bounce_map_waitinglist, - map, links); - mtx_unlock(&bounce_lock); - return (EINPROGRESS); - } - } - mtx_unlock(&bounce_lock); - - return (0); -} - -/* - * Add a single contiguous physical range to the segment list. - */ -static int -_bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t curaddr, - bus_size_t sgsize, bus_dma_segment_t *segs, int *segp) -{ - bus_addr_t baddr, bmask; - int seg; - - /* - * Make sure we don't cross any boundaries. - */ - bmask = ~(dmat->boundary - 1); - if (dmat->boundary > 0) { - baddr = (curaddr + dmat->boundary) & bmask; - if (sgsize > (baddr - curaddr)) - sgsize = (baddr - curaddr); - } - - /* - * Insert chunk into a segment, coalescing with - * previous segment if possible. - */ - seg = *segp; - if (seg == -1) { - seg = 0; - segs[seg].ds_addr = curaddr; - segs[seg].ds_len = sgsize; - } else { - if (curaddr == segs[seg].ds_addr + segs[seg].ds_len && - (segs[seg].ds_len + sgsize) <= dmat->maxsegsz && - (dmat->boundary == 0 || - (segs[seg].ds_addr & bmask) == (curaddr & bmask))) - segs[seg].ds_len += sgsize; - else { - if (++seg >= dmat->nsegments) - return (0); - segs[seg].ds_addr = curaddr; - segs[seg].ds_len = sgsize; - } - } - *segp = seg; - return (sgsize); -} - -/* - * Utility function to load a physical buffer. segp contains - * the starting segment on entrace, and the ending segment on exit. - */ -int -_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmamap_t map, - vm_paddr_t buf, bus_size_t buflen, int flags, bus_dma_segment_t *segs, - int *segp) -{ - bus_addr_t curaddr; - bus_size_t sgsize; - int error; - - if (map == NULL) - map = &nobounce_dmamap; - - if (segs == NULL) - segs = dmat->segments; - - if (map != &nobounce_dmamap) { - _bus_dmamap_count_phys(dmat, map, buf, buflen, flags); - if (map->pagesneeded != 0) { - error = _bus_dmamap_reserve_pages(dmat, map, flags); - if (error) - return (error); - } - } - - while (buflen > 0) { - curaddr = buf; - sgsize = MIN(buflen, dmat->maxsegsz); - if (map->pagesneeded != 0 && - run_filter(dmat, curaddr, sgsize)) { - sgsize = MIN(sgsize, PAGE_SIZE); - curaddr = add_bounce_page(dmat, map, 0, curaddr, - sgsize); - } - sgsize = _bus_dmamap_addseg(dmat, map, curaddr, sgsize, segs, - segp); - if (sgsize == 0) - break; - buf += sgsize; - buflen -= sgsize; - } - - /* - * Did we fit? - */ - return (buflen != 0 ? EFBIG : 0); /* XXX better return value here? */ -} - -int -_bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map, - struct vm_page **ma, bus_size_t tlen, int ma_offs, int flags, - bus_dma_segment_t *segs, int *segp) -{ - - return (bus_dmamap_load_ma_triv(dmat, map, ma, tlen, ma_offs, flags, - segs, segp)); -} - -/* - * Utility function to load a linear buffer. segp contains - * the starting segment on entrace, and the ending segment on exit. - */ -int -_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, - bus_size_t buflen, pmap_t pmap, int flags, - bus_dma_segment_t *segs, int *segp) -{ - bus_size_t sgsize; - bus_addr_t curaddr; - vm_offset_t vaddr; - int error; - - if (map == NULL) - map = &nobounce_dmamap; - - if (segs == NULL) - segs = dmat->segments; - - if (map != &nobounce_dmamap) { - _bus_dmamap_count_pages(dmat, map, pmap, buf, buflen, flags); - if (map->pagesneeded != 0) { - error = _bus_dmamap_reserve_pages(dmat, map, flags); - if (error) - return (error); - } - } - - vaddr = (vm_offset_t)buf; - - while (buflen > 0) { - /* - * Get the physical address for this segment. - */ - if (pmap == kernel_pmap) - curaddr = pmap_kextract(vaddr); - else - curaddr = pmap_extract(pmap, vaddr); - - /* - * Compute the segment size, and adjust counts. - */ - sgsize = PAGE_SIZE - ((u_long)curaddr & PAGE_MASK); - if (sgsize > dmat->maxsegsz) - sgsize = dmat->maxsegsz; - if (buflen < sgsize) - sgsize = buflen; - - if (map->pagesneeded != 0 && run_filter(dmat, curaddr, sgsize)) - curaddr = add_bounce_page(dmat, map, vaddr, curaddr, - sgsize); - - sgsize = _bus_dmamap_addseg(dmat, map, curaddr, sgsize, segs, - segp); - if (sgsize == 0) - break; - - vaddr += sgsize; - buflen -= sgsize; - } - - /* - * Did we fit? - */ - return (buflen != 0 ? EFBIG : 0); /* XXX better return value here? */ -} - - -void -__bus_dmamap_waitok(bus_dma_tag_t dmat, bus_dmamap_t map, - struct memdesc *mem, bus_dmamap_callback_t *callback, void *callback_arg) -{ - if (map != NULL) { - map->dmat = dmat; - map->mem = *mem; - map->callback = callback; - map->callback_arg = callback_arg; - } -} - -bus_dma_segment_t * -_bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t map, - bus_dma_segment_t *segs, int nsegs, int error) -{ - - if (segs == NULL) - segs = dmat->segments; - return (segs); -} - -/* - * Release the mapping held by map. - */ -void -_bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map) -{ - struct bounce_page *bpage; - - while ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) { - STAILQ_REMOVE_HEAD(&map->bpages, links); - free_bounce_page(dmat, bpage); - } -} - -void -_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op) -{ - struct bounce_page *bpage; - - if ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) { - /* - * Handle data bouncing. We might also - * want to add support for invalidating - * the caches on broken hardware - */ - - if (op & BUS_DMASYNC_PREWRITE) { - while (bpage != NULL) { - if (bpage->datavaddr != 0) - bcopy((void *)bpage->datavaddr, - (void *)bpage->vaddr, - bpage->datacount); - else - physcopyout(bpage->dataaddr, - (void *)bpage->vaddr, - bpage->datacount); - bpage = STAILQ_NEXT(bpage, links); - } - total_bounced++; - } - - if (op & BUS_DMASYNC_POSTREAD) { - while (bpage != NULL) { - if (bpage->datavaddr != 0) - bcopy((void *)bpage->vaddr, - (void *)bpage->datavaddr, - bpage->datacount); - else - physcopyin((void *)bpage->vaddr, - bpage->dataaddr, - bpage->datacount); - bpage = STAILQ_NEXT(bpage, links); - } - total_bounced++; - } - } -} - -static void -init_bounce_pages(void *dummy __unused) -{ - - free_bpages = 0; - reserved_bpages = 0; - active_bpages = 0; - total_bpages = 0; - STAILQ_INIT(&bounce_page_list); - STAILQ_INIT(&bounce_map_waitinglist); - STAILQ_INIT(&bounce_map_callbacklist); - mtx_init(&bounce_lock, "bounce pages lock", NULL, MTX_DEF); -} -SYSINIT(bpages, SI_SUB_LOCK, SI_ORDER_ANY, init_bounce_pages, NULL); - -static int -alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages) -{ - int count; - - count = 0; - while (numpages > 0) { - struct bounce_page *bpage; - - bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (bpage == NULL) - break; - bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_DEVBUF, - M_NOWAIT, 0ul, dmat->lowaddr, PAGE_SIZE, dmat->boundary); - if (bpage->vaddr == 0) { - free(bpage, M_DEVBUF); - break; - } - bpage->busaddr = pmap_kextract(bpage->vaddr); - mtx_lock(&bounce_lock); - STAILQ_INSERT_TAIL(&bounce_page_list, bpage, links); - total_bpages++; - free_bpages++; - mtx_unlock(&bounce_lock); - count++; - numpages--; - } - return (count); -} - -static int -reserve_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t map, int commit) -{ - int pages; - - mtx_assert(&bounce_lock, MA_OWNED); - pages = MIN(free_bpages, map->pagesneeded - map->pagesreserved); - if (commit == 0 && map->pagesneeded > (map->pagesreserved + pages)) - return (map->pagesneeded - (map->pagesreserved + pages)); - free_bpages -= pages; - reserved_bpages += pages; - map->pagesreserved += pages; - pages = map->pagesneeded - map->pagesreserved; - - return (pages); -} - -static bus_addr_t -add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr, - bus_addr_t addr, bus_size_t size) -{ - struct bounce_page *bpage; - - KASSERT(map != NULL && map != &nobounce_dmamap, - ("add_bounce_page: bad map %p", map)); - - if (map->pagesneeded == 0) - panic("add_bounce_page: map doesn't need any pages"); - map->pagesneeded--; - - if (map->pagesreserved == 0) - panic("add_bounce_page: map doesn't need any pages"); - map->pagesreserved--; - - mtx_lock(&bounce_lock); - bpage = STAILQ_FIRST(&bounce_page_list); - if (bpage == NULL) - panic("add_bounce_page: free page list is empty"); - - STAILQ_REMOVE_HEAD(&bounce_page_list, links); - reserved_bpages--; - active_bpages++; - mtx_unlock(&bounce_lock); - - if (dmat->flags & BUS_DMA_KEEP_PG_OFFSET) { - /* Page offset needs to be preserved. */ - bpage->vaddr |= vaddr & PAGE_MASK; - bpage->busaddr |= vaddr & PAGE_MASK; - } - bpage->datavaddr = vaddr; - bpage->dataaddr = addr; - bpage->datacount = size; - STAILQ_INSERT_TAIL(&(map->bpages), bpage, links); - return (bpage->busaddr); -} - -static void -free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage) -{ - struct bus_dmamap *map; - - bpage->datavaddr = 0; - bpage->datacount = 0; - if (dmat->flags & BUS_DMA_KEEP_PG_OFFSET) { - /* - * Reset the bounce page to start at offset 0. Other uses - * of this bounce page may need to store a full page of - * data and/or assume it starts on a page boundary. - */ - bpage->vaddr &= ~PAGE_MASK; - bpage->busaddr &= ~PAGE_MASK; - } - - mtx_lock(&bounce_lock); - STAILQ_INSERT_HEAD(&bounce_page_list, bpage, links); - free_bpages++; - active_bpages--; - if ((map = STAILQ_FIRST(&bounce_map_waitinglist)) != NULL) { - if (reserve_bounce_pages(map->dmat, map, 1) == 0) { - STAILQ_REMOVE_HEAD(&bounce_map_waitinglist, links); - STAILQ_INSERT_TAIL(&bounce_map_callbacklist, map, - links); - busdma_swi_pending = 1; - total_deferred++; - swi_sched(vm_ih, 0); - } - } - mtx_unlock(&bounce_lock); -} - -void -busdma_swi(void) -{ - bus_dma_tag_t dmat; - struct bus_dmamap *map; - - mtx_lock(&bounce_lock); - while ((map = STAILQ_FIRST(&bounce_map_callbacklist)) != NULL) { - STAILQ_REMOVE_HEAD(&bounce_map_callbacklist, links); - mtx_unlock(&bounce_lock); - dmat = map->dmat; - (dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_LOCK); - bus_dmamap_load_mem(map->dmat, map, &map->mem, map->callback, - map->callback_arg, BUS_DMA_WAITOK); - (dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_UNLOCK); - mtx_lock(&bounce_lock); - } - mtx_unlock(&bounce_lock); -} diff --git a/sys/ia64/ia64/clock.c b/sys/ia64/ia64/clock.c deleted file mode 100644 index 4a672be..0000000 --- a/sys/ia64/ia64/clock.c +++ /dev/null @@ -1,199 +0,0 @@ -/*- - * Copyright (c) 2005, 2009-2011 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/bus.h> -#include <sys/efi.h> -#include <sys/interrupt.h> -#include <sys/priority.h> -#include <sys/proc.h> -#include <sys/queue.h> -#include <sys/sysctl.h> -#include <sys/systm.h> -#include <sys/timeet.h> -#include <sys/timetc.h> -#include <sys/pcpu.h> - -#include <machine/cpu.h> -#include <machine/intr.h> -#include <machine/intrcnt.h> -#include <machine/md_var.h> -#include <machine/smp.h> - -#define CLOCK_ET_OFF 0 -#define CLOCK_ET_PERIODIC 1 -#define CLOCK_ET_ONESHOT 2 - -static struct eventtimer ia64_clock_et; -static u_int ia64_clock_xiv; - -#ifndef SMP -static timecounter_get_t ia64_get_timecount; - -static struct timecounter ia64_timecounter = { - ia64_get_timecount, /* get_timecount */ - 0, /* no poll_pps */ - ~0u, /* counter_mask */ - 0, /* frequency */ - "ITC" /* name */ -}; - -static u_int -ia64_get_timecount(struct timecounter* tc) -{ - return ia64_get_itc(); -} -#endif - -static u_int -ia64_ih_clock(struct thread *td, u_int xiv, struct trapframe *tf) -{ - struct eventtimer *et; - struct trapframe *stf; - uint64_t itc, load; - uint32_t mode; - - PCPU_INC(md.stats.pcs_nclks); - intrcnt[INTRCNT_CLOCK]++; - - itc = ia64_get_itc(); - PCPU_SET(md.clock, itc); - - mode = PCPU_GET(md.clock_mode); - if (mode == CLOCK_ET_PERIODIC) { - load = PCPU_GET(md.clock_load); - ia64_set_itm(itc + load); - } else - ia64_set_itv((1 << 16) | xiv); - - ia64_set_eoi(0); - ia64_srlz_d(); - - et = &ia64_clock_et; - if (et->et_active) { - stf = td->td_intr_frame; - td->td_intr_frame = tf; - et->et_event_cb(et, et->et_arg); - td->td_intr_frame = stf; - } - return (1); -} - -/* - * Event timer start method. - */ -static int -ia64_clock_start(struct eventtimer *et, sbintime_t first, sbintime_t period) -{ - u_long itc, load; - register_t is; - - if (period != 0) { - PCPU_SET(md.clock_mode, CLOCK_ET_PERIODIC); - load = (et->et_frequency * period) >> 32; - } else { - PCPU_SET(md.clock_mode, CLOCK_ET_ONESHOT); - load = 0; - } - - PCPU_SET(md.clock_load, load); - - if (first != 0) - load = (et->et_frequency * first) >> 32; - - is = intr_disable(); - itc = ia64_get_itc(); - ia64_set_itm(itc + load); - ia64_set_itv(ia64_clock_xiv); - ia64_srlz_d(); - intr_restore(is); - return (0); -} - -/* - * Event timer stop method. - */ -static int -ia64_clock_stop(struct eventtimer *et) -{ - - ia64_set_itv((1 << 16) | ia64_clock_xiv); - ia64_srlz_d(); - PCPU_SET(md.clock_mode, CLOCK_ET_OFF); - PCPU_SET(md.clock_load, 0); - return (0); -} - -/* - * We call cpu_initclocks() on the APs as well. It allows us to - * group common initialization in the same function. - */ -void -cpu_initclocks() -{ - - ia64_clock_stop(NULL); - if (PCPU_GET(cpuid) == 0) - cpu_initclocks_bsp(); - else - cpu_initclocks_ap(); -} - -static void -clock_configure(void *dummy) -{ - struct eventtimer *et; - u_long itc_freq; - - ia64_clock_xiv = ia64_xiv_alloc(PI_REALTIME, IA64_XIV_IPI, - ia64_ih_clock); - if (ia64_clock_xiv == 0) - panic("No XIV for clock interrupts"); - - itc_freq = (u_long)ia64_itc_freq() * 1000000ul; - - et = &ia64_clock_et; - et->et_name = "ITC"; - et->et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU; - et->et_quality = 1000; - et->et_frequency = itc_freq; - et->et_min_period = SBT_1S / (10 * hz); - et->et_max_period = (0xfffffffeul << 32) / itc_freq; - et->et_start = ia64_clock_start; - et->et_stop = ia64_clock_stop; - et->et_priv = NULL; - et_register(et); - -#ifndef SMP - ia64_timecounter.tc_frequency = itc_freq; - tc_init(&ia64_timecounter); -#endif -} -SYSINIT(clkcfg, SI_SUB_CONFIGURE, SI_ORDER_SECOND, clock_configure, NULL); diff --git a/sys/ia64/ia64/context.S b/sys/ia64/ia64/context.S deleted file mode 100644 index 84d8fd1..0000000 --- a/sys/ia64/ia64/context.S +++ /dev/null @@ -1,804 +0,0 @@ -/*- - * Copyright (c) 2003 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <machine/asm.h> -#include <assym.s> - - .text - -/* - * void restorectx(struct pcb *) - */ -ENTRY(restorectx, 1) -{ .mmi - invala - mov ar.rsc=0 - add r31=8,r32 - ;; -} -{ .mmi - ld8 r12=[r32] // sp - ld8 r16=[r31],16 // unat (before) - add r30=16,r32 - ;; -} -{ .mmi - ld8 r17=[r30],16 // rp - ld8 r18=[r31],16 // pr - add r14=SIZEOF_SPECIAL,r32 - ;; -} -{ .mmi - ld8 r19=[r30],16 // pfs - ld8 r20=[r31],16 // bspstore - mov rp=r17 - ;; -} -{ .mmi - loadrs - ld8 r21=[r30],16 // rnat - mov pr=r18,0x1fffe - ;; -} -{ .mmi - ld8 r17=[r14],8 // unat (after) - mov ar.bspstore=r20 - mov ar.pfs=r19 - ;; -} -{ .mmi - mov ar.unat=r17 - mov ar.rnat=r21 - add r15=8,r14 - ;; -} -{ .mmi - ld8.fill r4=[r14],16 // r4 - ld8.fill r5=[r15],16 // r5 - nop 0 - ;; -} -{ .mmi - ld8.fill r6=[r14],16 // r6 - ld8.fill r7=[r15],16 // r7 - nop 0 - ;; -} -{ .mmi - mov ar.unat=r16 - mov ar.rsc=3 - nop 0 -} -{ .mmi - ld8 r17=[r14],16 // b1 - ld8 r18=[r15],16 // b2 - nop 0 - ;; -} -{ .mmi - ld8 r19=[r14],16 // b3 - ld8 r20=[r15],16 // b4 - mov b1=r17 - ;; -} -{ .mmi - ld8 r16=[r14],24 // b5 - ld8 r17=[r15],32 // lc - mov b2=r18 - ;; -} -{ .mmi - ldf.fill f2=[r14],32 - ldf.fill f3=[r15],32 - mov b3=r19 - ;; -} -{ .mmi - ldf.fill f4=[r14],32 - ldf.fill f5=[r15],32 - mov b4=r20 - ;; -} -{ .mmi - ldf.fill f16=[r14],32 - ldf.fill f17=[r15],32 - mov b5=r16 - ;; -} -{ .mmi - ldf.fill f18=[r14],32 - ldf.fill f19=[r15],32 - mov ar.lc=r17 - ;; -} - ldf.fill f20=[r14],32 - ldf.fill f21=[r15],32 - ;; - ldf.fill f22=[r14],32 - ldf.fill f23=[r15],32 - ;; - ldf.fill f24=[r14],32 - ldf.fill f25=[r15],32 - ;; - ldf.fill f26=[r14],32 - ldf.fill f27=[r15],32 - ;; -{ .mmi - ldf.fill f28=[r14],32 - ldf.fill f29=[r15],32 - add r8=1,r0 - ;; -} -{ .mmb - ldf.fill f30=[r14] - ldf.fill f31=[r15] - br.ret.sptk rp - ;; -} -END(restorectx) - -/* - * void swapctx(struct pcb *old, struct pcb *new) - */ - -ENTRY(swapctx, 2) -{ .mmi - mov ar.rsc=0 - mov r16=ar.unat - add r31=8,r32 - ;; -} -{ .mmi - flushrs - st8 [r32]=sp,16 // sp - mov r17=rp - ;; -} -{ .mmi - st8 [r31]=r16,16 // unat (before) - st8 [r32]=r17,16 // rp - mov r16=pr - ;; -} -{ .mmi - st8 [r31]=r16,16 // pr - mov r17=ar.bsp - mov r16=ar.pfs - ;; -} -{ .mmi - st8 [r32]=r16,16 // pfs - st8 [r31]=r17,16 // bspstore - cmp.eq p15,p0=0,r33 - ;; -} -{ .mmi - mov r16=ar.rnat -(p15) mov ar.rsc=3 - add r30=SIZEOF_SPECIAL-(6*8),r32 - ;; -} -{ .mmi - st8 [r32]=r16,SIZEOF_SPECIAL-(4*8) // rnat - st8 [r31]=r0,SIZEOF_SPECIAL-(6*8) // __spare - mov r16=b1 - ;; -} - /* callee_saved */ -{ .mmi - .mem.offset 8,0 - st8.spill [r31]=r4,16 // r4 - .mem.offset 16,0 - st8.spill [r32]=r5,16 // r5 - mov r17=b2 - ;; -} -{ .mmi - .mem.offset 24,0 - st8.spill [r31]=r6,16 // r6 - .mem.offset 32,0 - st8.spill [r32]=r7,16 // r7 - mov r18=b3 - ;; -} -{ .mmi - st8 [r31]=r16,16 // b1 - mov r16=ar.unat - mov r19=b4 - ;; -} -{ .mmi - st8 [r30]=r16 // unat (after) - st8 [r32]=r17,16 // b2 - mov r16=b5 - ;; -} -{ .mmi - st8 [r31]=r18,16 // b3 - st8 [r32]=r19,16 // b4 - mov r17=ar.lc - ;; -} - st8 [r31]=r16,16 // b5 - st8 [r32]=r17,16 // lc - ;; - st8 [r31]=r0,24 // __spare - stf.spill [r32]=f2,32 - ;; - stf.spill [r31]=f3,32 - stf.spill [r32]=f4,32 - ;; - stf.spill [r31]=f5,32 - stf.spill [r32]=f16,32 - ;; - stf.spill [r31]=f17,32 - stf.spill [r32]=f18,32 - ;; - stf.spill [r31]=f19,32 - stf.spill [r32]=f20,32 - ;; - stf.spill [r31]=f21,32 - stf.spill [r32]=f22,32 - ;; - stf.spill [r31]=f23,32 - stf.spill [r32]=f24,32 - ;; - stf.spill [r31]=f25,32 - stf.spill [r32]=f26,32 - ;; - stf.spill [r31]=f27,32 - stf.spill [r32]=f28,32 - ;; -{ .mmi - stf.spill [r31]=f29,32 - stf.spill [r32]=f30 -(p15) add r8=0,r0 - ;; -} -{ .mmb - stf.spill [r31]=f31 - mf -(p15) br.ret.sptk rp - ;; -} -{ .mib - mov r32=r33 - nop 0 - br.sptk restorectx - ;; -} -END(swapctx) - -/* - * save_callee_saved(struct _callee_saved *) - */ -ENTRY(save_callee_saved, 1) -{ .mii - nop 0 - add r14=8,r32 - add r15=16,r32 - ;; -} -{ .mmi - .mem.offset 8,0 - st8.spill [r14]=r4,16 // r4 - .mem.offset 16,0 - st8.spill [r15]=r5,16 // r5 - mov r16=b1 - ;; -} -{ .mmi - .mem.offset 24,0 - st8.spill [r14]=r6,16 // r6 - .mem.offset 32,0 - st8.spill [r15]=r7,16 // r7 - mov r17=b2 - ;; -} -{ .mmi - st8 [r14]=r16,16 // b1 - mov r18=ar.unat - mov r19=b3 - ;; -} -{ .mmi - st8 [r32]=r18 // nat (after) - st8 [r15]=r17,16 // b2 - mov r16=b4 - ;; -} -{ .mmi - st8 [r14]=r19,16 // b3 - st8 [r15]=r16,16 // b4 - mov r17=b5 - ;; -} -{ .mii - st8 [r14]=r17,16 // b5 - mov r16=ar.lc - nop 0 - ;; -} -{ .mmb - st8 [r15]=r16 // ar.lc - st8 [r14]=r0 // __spare - br.ret.sptk rp - ;; -} -END(save_callee_saved) - -/* - * restore_callee_saved(struct _callee_saved *) - */ -ENTRY(restore_callee_saved, 1) -{ .mmi - ld8 r30=[r32],16 // nat (after) - ;; - mov ar.unat=r30 - add r31=-8,r32 - ;; -} -{ .mmi - ld8.fill r4=[r31],16 // r4 - ld8.fill r5=[r32],16 // r5 - nop 0 - ;; -} -{ .mmi - ld8.fill r6=[r31],16 // r6 - ld8.fill r7=[r32],16 // r7 - nop 0 - ;; -} -{ .mmi - ld8 r30=[r31],16 // b1 - ld8 r29=[r32],16 // b2 - nop 0 - ;; -} -{ .mmi - ld8 r28=[r31],16 // b3 - ld8 r27=[r32],16 // b4 - mov b1=r30 - ;; -} -{ .mii - ld8 r26=[r31] // b5 - mov b2=r29 - mov b3=r28 - ;; -} -{ .mii - ld8 r25=[r32] // lc - mov b4=r27 - mov b5=r26 - ;; -} -{ .mib - nop 0 - mov ar.lc=r25 - br.ret.sptk rp - ;; -} -END(restore_callee_saved) - -/* - * save_callee_saved_fp(struct _callee_saved_fp *) - */ -ENTRY(save_callee_saved_fp, 1) - add r31=16,r32 - stf.spill [r32]=f2,32 - ;; - stf.spill [r31]=f3,32 - stf.spill [r32]=f4,32 - ;; - stf.spill [r31]=f5,32 - stf.spill [r32]=f16,32 - ;; - stf.spill [r31]=f17,32 - stf.spill [r32]=f18,32 - ;; - stf.spill [r31]=f19,32 - stf.spill [r32]=f20,32 - ;; - stf.spill [r31]=f21,32 - stf.spill [r32]=f22,32 - ;; - stf.spill [r31]=f23,32 - stf.spill [r32]=f24,32 - ;; - stf.spill [r31]=f25,32 - stf.spill [r32]=f26,32 - ;; - stf.spill [r31]=f27,32 - stf.spill [r32]=f28,32 - ;; - stf.spill [r31]=f29,32 - stf.spill [r32]=f30 - ;; - stf.spill [r31]=f31 - br.ret.sptk rp - ;; -END(save_callee_saved_fp) - -/* - * restore_callee_saved_fp(struct _callee_saved_fp *) - */ -ENTRY(restore_callee_saved_fp, 1) - add r31=16,r32 - ldf.fill f2=[r32],32 - ;; - ldf.fill f3=[r31],32 - ldf.fill f4=[r32],32 - ;; - ldf.fill f5=[r31],32 - ldf.fill f16=[r32],32 - ;; - ldf.fill f17=[r31],32 - ldf.fill f18=[r32],32 - ;; - ldf.fill f19=[r31],32 - ldf.fill f20=[r32],32 - ;; - ldf.fill f21=[r31],32 - ldf.fill f22=[r32],32 - ;; - ldf.fill f23=[r31],32 - ldf.fill f24=[r32],32 - ;; - ldf.fill f25=[r31],32 - ldf.fill f26=[r32],32 - ;; - ldf.fill f27=[r31],32 - ldf.fill f28=[r32],32 - ;; - ldf.fill f29=[r31],32 - ldf.fill f30=[r32] - ;; - ldf.fill f31=[r31] - br.ret.sptk rp - ;; -END(restore_callee_saved_fp) - -/* - * save_high_fp(struct _high_fp *) - */ -ENTRY(save_high_fp, 1) - rsm psr.dfh - ;; - srlz.d - add r31=16,r32 - stf.spill [r32]=f32,32 - ;; - stf.spill [r31]=f33,32 - stf.spill [r32]=f34,32 - ;; - stf.spill [r31]=f35,32 - stf.spill [r32]=f36,32 - ;; - stf.spill [r31]=f37,32 - stf.spill [r32]=f38,32 - ;; - stf.spill [r31]=f39,32 - stf.spill [r32]=f40,32 - ;; - stf.spill [r31]=f41,32 - stf.spill [r32]=f42,32 - ;; - stf.spill [r31]=f43,32 - stf.spill [r32]=f44,32 - ;; - stf.spill [r31]=f45,32 - stf.spill [r32]=f46,32 - ;; - stf.spill [r31]=f47,32 - stf.spill [r32]=f48,32 - ;; - stf.spill [r31]=f49,32 - stf.spill [r32]=f50,32 - ;; - stf.spill [r31]=f51,32 - stf.spill [r32]=f52,32 - ;; - stf.spill [r31]=f53,32 - stf.spill [r32]=f54,32 - ;; - stf.spill [r31]=f55,32 - stf.spill [r32]=f56,32 - ;; - stf.spill [r31]=f57,32 - stf.spill [r32]=f58,32 - ;; - stf.spill [r31]=f59,32 - stf.spill [r32]=f60,32 - ;; - stf.spill [r31]=f61,32 - stf.spill [r32]=f62,32 - ;; - stf.spill [r31]=f63,32 - stf.spill [r32]=f64,32 - ;; - stf.spill [r31]=f65,32 - stf.spill [r32]=f66,32 - ;; - stf.spill [r31]=f67,32 - stf.spill [r32]=f68,32 - ;; - stf.spill [r31]=f69,32 - stf.spill [r32]=f70,32 - ;; - stf.spill [r31]=f71,32 - stf.spill [r32]=f72,32 - ;; - stf.spill [r31]=f73,32 - stf.spill [r32]=f74,32 - ;; - stf.spill [r31]=f75,32 - stf.spill [r32]=f76,32 - ;; - stf.spill [r31]=f77,32 - stf.spill [r32]=f78,32 - ;; - stf.spill [r31]=f79,32 - stf.spill [r32]=f80,32 - ;; - stf.spill [r31]=f81,32 - stf.spill [r32]=f82,32 - ;; - stf.spill [r31]=f83,32 - stf.spill [r32]=f84,32 - ;; - stf.spill [r31]=f85,32 - stf.spill [r32]=f86,32 - ;; - stf.spill [r31]=f87,32 - stf.spill [r32]=f88,32 - ;; - stf.spill [r31]=f89,32 - stf.spill [r32]=f90,32 - ;; - stf.spill [r31]=f91,32 - stf.spill [r32]=f92,32 - ;; - stf.spill [r31]=f93,32 - stf.spill [r32]=f94,32 - ;; - stf.spill [r31]=f95,32 - stf.spill [r32]=f96,32 - ;; - stf.spill [r31]=f97,32 - stf.spill [r32]=f98,32 - ;; - stf.spill [r31]=f99,32 - stf.spill [r32]=f100,32 - ;; - stf.spill [r31]=f101,32 - stf.spill [r32]=f102,32 - ;; - stf.spill [r31]=f103,32 - stf.spill [r32]=f104,32 - ;; - stf.spill [r31]=f105,32 - stf.spill [r32]=f106,32 - ;; - stf.spill [r31]=f107,32 - stf.spill [r32]=f108,32 - ;; - stf.spill [r31]=f109,32 - stf.spill [r32]=f110,32 - ;; - stf.spill [r31]=f111,32 - stf.spill [r32]=f112,32 - ;; - stf.spill [r31]=f113,32 - stf.spill [r32]=f114,32 - ;; - stf.spill [r31]=f115,32 - stf.spill [r32]=f116,32 - ;; - stf.spill [r31]=f117,32 - stf.spill [r32]=f118,32 - ;; - stf.spill [r31]=f119,32 - stf.spill [r32]=f120,32 - ;; - stf.spill [r31]=f121,32 - stf.spill [r32]=f122,32 - ;; - stf.spill [r31]=f123,32 - stf.spill [r32]=f124,32 - ;; - stf.spill [r31]=f125,32 - stf.spill [r32]=f126 - ;; - stf.spill [r31]=f127 - ssm psr.dfh - ;; - srlz.d - br.ret.sptk rp - ;; -END(save_high_fp) - -/* - * restore_high_fp(struct _high_fp *) - */ -ENTRY(restore_high_fp, 1) - rsm psr.dfh - ;; - srlz.d - add r31=16,r32 - ldf.fill f32=[r32],32 - ;; - ldf.fill f33=[r31],32 - ldf.fill f34=[r32],32 - ;; - ldf.fill f35=[r31],32 - ldf.fill f36=[r32],32 - ;; - ldf.fill f37=[r31],32 - ldf.fill f38=[r32],32 - ;; - ldf.fill f39=[r31],32 - ldf.fill f40=[r32],32 - ;; - ldf.fill f41=[r31],32 - ldf.fill f42=[r32],32 - ;; - ldf.fill f43=[r31],32 - ldf.fill f44=[r32],32 - ;; - ldf.fill f45=[r31],32 - ldf.fill f46=[r32],32 - ;; - ldf.fill f47=[r31],32 - ldf.fill f48=[r32],32 - ;; - ldf.fill f49=[r31],32 - ldf.fill f50=[r32],32 - ;; - ldf.fill f51=[r31],32 - ldf.fill f52=[r32],32 - ;; - ldf.fill f53=[r31],32 - ldf.fill f54=[r32],32 - ;; - ldf.fill f55=[r31],32 - ldf.fill f56=[r32],32 - ;; - ldf.fill f57=[r31],32 - ldf.fill f58=[r32],32 - ;; - ldf.fill f59=[r31],32 - ldf.fill f60=[r32],32 - ;; - ldf.fill f61=[r31],32 - ldf.fill f62=[r32],32 - ;; - ldf.fill f63=[r31],32 - ldf.fill f64=[r32],32 - ;; - ldf.fill f65=[r31],32 - ldf.fill f66=[r32],32 - ;; - ldf.fill f67=[r31],32 - ldf.fill f68=[r32],32 - ;; - ldf.fill f69=[r31],32 - ldf.fill f70=[r32],32 - ;; - ldf.fill f71=[r31],32 - ldf.fill f72=[r32],32 - ;; - ldf.fill f73=[r31],32 - ldf.fill f74=[r32],32 - ;; - ldf.fill f75=[r31],32 - ldf.fill f76=[r32],32 - ;; - ldf.fill f77=[r31],32 - ldf.fill f78=[r32],32 - ;; - ldf.fill f79=[r31],32 - ldf.fill f80=[r32],32 - ;; - ldf.fill f81=[r31],32 - ldf.fill f82=[r32],32 - ;; - ldf.fill f83=[r31],32 - ldf.fill f84=[r32],32 - ;; - ldf.fill f85=[r31],32 - ldf.fill f86=[r32],32 - ;; - ldf.fill f87=[r31],32 - ldf.fill f88=[r32],32 - ;; - ldf.fill f89=[r31],32 - ldf.fill f90=[r32],32 - ;; - ldf.fill f91=[r31],32 - ldf.fill f92=[r32],32 - ;; - ldf.fill f93=[r31],32 - ldf.fill f94=[r32],32 - ;; - ldf.fill f95=[r31],32 - ldf.fill f96=[r32],32 - ;; - ldf.fill f97=[r31],32 - ldf.fill f98=[r32],32 - ;; - ldf.fill f99=[r31],32 - ldf.fill f100=[r32],32 - ;; - ldf.fill f101=[r31],32 - ldf.fill f102=[r32],32 - ;; - ldf.fill f103=[r31],32 - ldf.fill f104=[r32],32 - ;; - ldf.fill f105=[r31],32 - ldf.fill f106=[r32],32 - ;; - ldf.fill f107=[r31],32 - ldf.fill f108=[r32],32 - ;; - ldf.fill f109=[r31],32 - ldf.fill f110=[r32],32 - ;; - ldf.fill f111=[r31],32 - ldf.fill f112=[r32],32 - ;; - ldf.fill f113=[r31],32 - ldf.fill f114=[r32],32 - ;; - ldf.fill f115=[r31],32 - ldf.fill f116=[r32],32 - ;; - ldf.fill f117=[r31],32 - ldf.fill f118=[r32],32 - ;; - ldf.fill f119=[r31],32 - ldf.fill f120=[r32],32 - ;; - ldf.fill f121=[r31],32 - ldf.fill f122=[r32],32 - ;; - ldf.fill f123=[r31],32 - ldf.fill f124=[r32],32 - ;; - ldf.fill f125=[r31],32 - ldf.fill f126=[r32] - ;; - ldf.fill f127=[r31] - ssm psr.dfh - ;; - srlz.d - br.ret.sptk rp - ;; -END(restore_high_fp) diff --git a/sys/ia64/ia64/db_machdep.c b/sys/ia64/ia64/db_machdep.c deleted file mode 100644 index 3befbd8..0000000 --- a/sys/ia64/ia64/db_machdep.c +++ /dev/null @@ -1,610 +0,0 @@ -/*- - * Copyright (c) 2003-2005 Marcel Moolenaar - * Copyright (c) 2000-2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "opt_xtrace.h" - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/cons.h> -#include <sys/kdb.h> -#include <sys/ktr.h> -#include <sys/kernel.h> -#include <sys/proc.h> -#include <sys/reboot.h> -#include <sys/smp.h> -#include <sys/stack.h> - -#include <vm/vm.h> - -#include <machine/db_machdep.h> -#include <machine/frame.h> -#include <machine/kdb.h> -#include <machine/md_var.h> -#include <machine/pcb.h> -#include <machine/setjmp.h> -#include <machine/unwind.h> -#include <machine/vmparam.h> - -#include <ddb/ddb.h> -#include <ddb/db_access.h> -#include <ddb/db_output.h> -#include <ddb/db_sym.h> -#include <ddb/db_variables.h> - -#include <ia64/disasm/disasm.h> - -#define TMPL_BITS 5 -#define TMPL_MASK ((1 << TMPL_BITS) - 1) -#define SLOT_BITS 41 -#define SLOT_COUNT 3 -#define SLOT_MASK ((1ULL << SLOT_BITS) - 1ULL) -#define SLOT_SHIFT(i) (TMPL_BITS+((i)<<3)+(i)) - -typedef db_expr_t __db_f(db_expr_t, db_expr_t, db_expr_t, db_expr_t, db_expr_t, - db_expr_t, db_expr_t, db_expr_t); - -register uint64_t __db_gp __asm__("gp"); - -static db_varfcn_t db_frame; -static db_varfcn_t db_getip; -static db_varfcn_t db_getrse; - -#define DB_OFFSET(x) (db_expr_t *)offsetof(struct trapframe, x) -struct db_variable db_regs[] = { - {"ip", NULL, db_getip}, - {"cr.ifs", DB_OFFSET(tf_special.cfm), db_frame}, - {"cr.ifa", DB_OFFSET(tf_special.ifa), db_frame}, - {"ar.bspstore", DB_OFFSET(tf_special.bspstore), db_frame}, - {"ndirty", DB_OFFSET(tf_special.ndirty), db_frame}, - {"rp", DB_OFFSET(tf_special.rp), db_frame}, - {"ar.pfs", DB_OFFSET(tf_special.pfs), db_frame}, - {"psr", DB_OFFSET(tf_special.psr), db_frame}, - {"cr.isr", DB_OFFSET(tf_special.isr), db_frame}, - {"pr", DB_OFFSET(tf_special.pr), db_frame}, - {"ar.rsc", DB_OFFSET(tf_special.rsc), db_frame}, - {"ar.rnat", DB_OFFSET(tf_special.rnat), db_frame}, - {"ar.unat", DB_OFFSET(tf_special.unat), db_frame}, - {"ar.fpsr", DB_OFFSET(tf_special.fpsr), db_frame}, - {"gp", DB_OFFSET(tf_special.gp), db_frame}, - {"sp", DB_OFFSET(tf_special.sp), db_frame}, - {"tp", DB_OFFSET(tf_special.tp), db_frame}, - {"b6", DB_OFFSET(tf_scratch.br6), db_frame}, - {"b7", DB_OFFSET(tf_scratch.br7), db_frame}, - {"r2", DB_OFFSET(tf_scratch.gr2), db_frame}, - {"r3", DB_OFFSET(tf_scratch.gr3), db_frame}, - {"r8", DB_OFFSET(tf_scratch.gr8), db_frame}, - {"r9", DB_OFFSET(tf_scratch.gr9), db_frame}, - {"r10", DB_OFFSET(tf_scratch.gr10), db_frame}, - {"r11", DB_OFFSET(tf_scratch.gr11), db_frame}, - {"r14", DB_OFFSET(tf_scratch.gr14), db_frame}, - {"r15", DB_OFFSET(tf_scratch.gr15), db_frame}, - {"r16", DB_OFFSET(tf_scratch.gr16), db_frame}, - {"r17", DB_OFFSET(tf_scratch.gr17), db_frame}, - {"r18", DB_OFFSET(tf_scratch.gr18), db_frame}, - {"r19", DB_OFFSET(tf_scratch.gr19), db_frame}, - {"r20", DB_OFFSET(tf_scratch.gr20), db_frame}, - {"r21", DB_OFFSET(tf_scratch.gr21), db_frame}, - {"r22", DB_OFFSET(tf_scratch.gr22), db_frame}, - {"r23", DB_OFFSET(tf_scratch.gr23), db_frame}, - {"r24", DB_OFFSET(tf_scratch.gr24), db_frame}, - {"r25", DB_OFFSET(tf_scratch.gr25), db_frame}, - {"r26", DB_OFFSET(tf_scratch.gr26), db_frame}, - {"r27", DB_OFFSET(tf_scratch.gr27), db_frame}, - {"r28", DB_OFFSET(tf_scratch.gr28), db_frame}, - {"r29", DB_OFFSET(tf_scratch.gr29), db_frame}, - {"r30", DB_OFFSET(tf_scratch.gr30), db_frame}, - {"r31", DB_OFFSET(tf_scratch.gr31), db_frame}, - {"r32", (db_expr_t*)0, db_getrse}, - {"r33", (db_expr_t*)1, db_getrse}, - {"r34", (db_expr_t*)2, db_getrse}, - {"r35", (db_expr_t*)3, db_getrse}, - {"r36", (db_expr_t*)4, db_getrse}, - {"r37", (db_expr_t*)5, db_getrse}, - {"r38", (db_expr_t*)6, db_getrse}, - {"r39", (db_expr_t*)7, db_getrse}, - {"r40", (db_expr_t*)8, db_getrse}, - {"r41", (db_expr_t*)9, db_getrse}, - {"r42", (db_expr_t*)10, db_getrse}, - {"r43", (db_expr_t*)11, db_getrse}, - {"r44", (db_expr_t*)12, db_getrse}, - {"r45", (db_expr_t*)13, db_getrse}, - {"r46", (db_expr_t*)14, db_getrse}, - {"r47", (db_expr_t*)15, db_getrse}, - {"r48", (db_expr_t*)16, db_getrse}, - {"r49", (db_expr_t*)17, db_getrse}, - {"r50", (db_expr_t*)18, db_getrse}, - {"r51", (db_expr_t*)19, db_getrse}, - {"r52", (db_expr_t*)20, db_getrse}, - {"r53", (db_expr_t*)21, db_getrse}, - {"r54", (db_expr_t*)22, db_getrse}, - {"r55", (db_expr_t*)23, db_getrse}, - {"r56", (db_expr_t*)24, db_getrse}, - {"r57", (db_expr_t*)25, db_getrse}, - {"r58", (db_expr_t*)26, db_getrse}, - {"r59", (db_expr_t*)27, db_getrse}, - {"r60", (db_expr_t*)28, db_getrse}, - {"r61", (db_expr_t*)29, db_getrse}, - {"r62", (db_expr_t*)30, db_getrse}, - {"r63", (db_expr_t*)31, db_getrse}, - {"r64", (db_expr_t*)32, db_getrse}, - {"r65", (db_expr_t*)33, db_getrse}, - {"r66", (db_expr_t*)34, db_getrse}, - {"r67", (db_expr_t*)35, db_getrse}, - {"r68", (db_expr_t*)36, db_getrse}, - {"r69", (db_expr_t*)37, db_getrse}, - {"r70", (db_expr_t*)38, db_getrse}, - {"r71", (db_expr_t*)39, db_getrse}, - {"r72", (db_expr_t*)40, db_getrse}, - {"r73", (db_expr_t*)41, db_getrse}, - {"r74", (db_expr_t*)42, db_getrse}, - {"r75", (db_expr_t*)43, db_getrse}, - {"r76", (db_expr_t*)44, db_getrse}, - {"r77", (db_expr_t*)45, db_getrse}, - {"r78", (db_expr_t*)46, db_getrse}, - {"r79", (db_expr_t*)47, db_getrse}, - {"r80", (db_expr_t*)48, db_getrse}, - {"r81", (db_expr_t*)49, db_getrse}, - {"r82", (db_expr_t*)50, db_getrse}, - {"r83", (db_expr_t*)51, db_getrse}, - {"r84", (db_expr_t*)52, db_getrse}, - {"r85", (db_expr_t*)53, db_getrse}, - {"r86", (db_expr_t*)54, db_getrse}, - {"r87", (db_expr_t*)55, db_getrse}, - {"r88", (db_expr_t*)56, db_getrse}, - {"r89", (db_expr_t*)57, db_getrse}, - {"r90", (db_expr_t*)58, db_getrse}, - {"r91", (db_expr_t*)59, db_getrse}, - {"r92", (db_expr_t*)60, db_getrse}, - {"r93", (db_expr_t*)61, db_getrse}, - {"r94", (db_expr_t*)62, db_getrse}, - {"r95", (db_expr_t*)63, db_getrse}, - {"r96", (db_expr_t*)64, db_getrse}, - {"r97", (db_expr_t*)65, db_getrse}, - {"r98", (db_expr_t*)66, db_getrse}, - {"r99", (db_expr_t*)67, db_getrse}, - {"r100", (db_expr_t*)68, db_getrse}, - {"r101", (db_expr_t*)69, db_getrse}, - {"r102", (db_expr_t*)70, db_getrse}, - {"r103", (db_expr_t*)71, db_getrse}, - {"r104", (db_expr_t*)72, db_getrse}, - {"r105", (db_expr_t*)73, db_getrse}, - {"r106", (db_expr_t*)74, db_getrse}, - {"r107", (db_expr_t*)75, db_getrse}, - {"r108", (db_expr_t*)76, db_getrse}, - {"r109", (db_expr_t*)77, db_getrse}, - {"r110", (db_expr_t*)78, db_getrse}, - {"r111", (db_expr_t*)79, db_getrse}, - {"r112", (db_expr_t*)80, db_getrse}, - {"r113", (db_expr_t*)81, db_getrse}, - {"r114", (db_expr_t*)82, db_getrse}, - {"r115", (db_expr_t*)83, db_getrse}, - {"r116", (db_expr_t*)84, db_getrse}, - {"r117", (db_expr_t*)85, db_getrse}, - {"r118", (db_expr_t*)86, db_getrse}, - {"r119", (db_expr_t*)87, db_getrse}, - {"r120", (db_expr_t*)88, db_getrse}, - {"r121", (db_expr_t*)89, db_getrse}, - {"r122", (db_expr_t*)90, db_getrse}, - {"r123", (db_expr_t*)91, db_getrse}, - {"r124", (db_expr_t*)92, db_getrse}, - {"r125", (db_expr_t*)93, db_getrse}, - {"r126", (db_expr_t*)94, db_getrse}, - {"r127", (db_expr_t*)95, db_getrse}, -}; -struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); - -static int -db_backtrace(struct thread *td, struct pcb *pcb, int count) -{ - struct unw_regstate rs; - struct trapframe *tf; - const char *name; - db_expr_t offset; - uint64_t bsp, cfm, ip, pfs, reg, sp; - c_db_sym_t sym; - int args, error, i; - - error = unw_create_from_pcb(&rs, pcb); - while (!error && count-- && !db_pager_quit) { - error = unw_get_cfm(&rs, &cfm); - if (!error) - error = unw_get_bsp(&rs, &bsp); - if (!error) - error = unw_get_ip(&rs, &ip); - if (!error) - error = unw_get_sp(&rs, &sp); - if (error) - break; - - args = IA64_CFM_SOL(cfm); - if (args > 8) - args = 8; - - error = unw_step(&rs); - if (!error) { - if (!unw_get_cfm(&rs, &pfs)) { - i = IA64_CFM_SOF(pfs) - IA64_CFM_SOL(pfs); - if (args > i) - args = i; - } - } - - sym = db_search_symbol(ip, DB_STGY_ANY, &offset); - db_symbol_values(sym, &name, NULL); - db_printf("%s(", name); - if (bsp >= VM_MAXUSER_ADDRESS) { - for (i = 0; i < args; i++) { - if ((bsp & 0x1ff) == 0x1f8) - bsp += 8; - db_read_bytes(bsp, sizeof(reg), (void*)®); - if (i > 0) - db_printf(", "); - db_printf("0x%lx", reg); - bsp += 8; - } - } else - db_printf("..."); - db_printf(") at "); - - db_printsym(ip, DB_STGY_PROC); - db_printf("\n"); - - if (error != ERESTART) - continue; - if (sp < VM_MAXUSER_ADDRESS) - break; - - tf = (struct trapframe *)(sp + 16); - if ((tf->tf_flags & FRAME_SYSCALL) != 0 || - tf->tf_special.iip < VM_MAXUSER_ADDRESS) - break; - - /* XXX ask if we should unwind across the trapframe. */ - db_printf("--- trapframe at %p\n", tf); - unw_delete(&rs); - error = unw_create_from_frame(&rs, tf); - } - - unw_delete(&rs); - /* - * EJUSTRETURN and ERESTART signal the end of a trace and - * are not really errors. - */ - return ((error > 0) ? error : 0); -} - -void -db_bkpt_clear(db_addr_t addr, BKPT_INST_TYPE *storage) -{ - BKPT_INST_TYPE tmp; - db_addr_t loc; - int slot; - - slot = addr & 0xfUL; - if (slot >= SLOT_COUNT) - return; - loc = (addr & ~0xfUL) + (slot << 2); - - db_read_bytes(loc, sizeof(BKPT_INST_TYPE), (char *)&tmp); - tmp &= ~(SLOT_MASK << SLOT_SHIFT(slot)); - tmp |= *storage << SLOT_SHIFT(slot); - db_write_bytes(loc, sizeof(BKPT_INST_TYPE), (char *)&tmp); -} - -void -db_bkpt_skip(void) -{ - - if (kdb_frame == NULL) - return; - - kdb_frame->tf_special.psr += IA64_PSR_RI_1; - if ((kdb_frame->tf_special.psr & IA64_PSR_RI) > IA64_PSR_RI_2) { - kdb_frame->tf_special.psr &= ~IA64_PSR_RI; - kdb_frame->tf_special.iip += 16; - } -} - -void -db_bkpt_write(db_addr_t addr, BKPT_INST_TYPE *storage) -{ - BKPT_INST_TYPE tmp; - db_addr_t loc; - int slot; - - slot = addr & 0xfUL; - if (slot >= SLOT_COUNT) - return; - loc = (addr & ~0xfUL) + (slot << 2); - - db_read_bytes(loc, sizeof(BKPT_INST_TYPE), (char *)&tmp); - *storage = (tmp >> SLOT_SHIFT(slot)) & SLOT_MASK; - - tmp &= ~(SLOT_MASK << SLOT_SHIFT(slot)); - tmp |= (0x84000 << 6) << SLOT_SHIFT(slot); - db_write_bytes(loc, sizeof(BKPT_INST_TYPE), (char *)&tmp); -} - -db_addr_t -db_disasm(db_addr_t loc, boolean_t altfmt) -{ - char buf[32]; - struct asm_bundle bundle; - const struct asm_inst *i; - const char *tmpl; - int n, slot; - - slot = loc & 0xf; - loc &= ~0xful; - db_read_bytes(loc, 16, buf); - if (asm_decode((uintptr_t)buf, &bundle)) { - i = bundle.b_inst + slot; - tmpl = bundle.b_templ + slot; - if (*tmpl == ';' || (slot == 2 && bundle.b_templ[1] == ';')) - tmpl++; - if (*tmpl == 'L' || i->i_op == ASM_OP_NONE) { - db_printf("\n"); - goto out; - } - - /* Unit + slot. */ - db_printf("[%c%d] ", *tmpl, slot); - - /* Predicate. */ - if (i->i_oper[0].o_value != 0) { - asm_operand(i->i_oper+0, buf, loc); - db_printf("(%s) ", buf); - } else - db_printf(" "); - - /* Mnemonic & completers. */ - asm_mnemonic(i->i_op, buf); - db_printf(buf); - n = 0; - while (n < i->i_ncmpltrs) { - asm_completer(i->i_cmpltr + n, buf); - db_printf(buf); - n++; - } - db_printf(" "); - - /* Operands. */ - n = 1; - while (n < 7 && i->i_oper[n].o_type != ASM_OPER_NONE) { - if (n > 1) { - if (n == i->i_srcidx) - db_printf("="); - else - db_printf(","); - } - asm_operand(i->i_oper + n, buf, loc); - db_printf(buf); - n++; - } - if (tmpl[1] == ';') - db_printf(" ;;"); - } else { - tmpl = NULL; - slot = 2; - } - db_printf("\n"); - -out: - slot++; - if (slot == 1 && tmpl[1] == 'L') - slot++; - if (slot > 2) - slot = 16; - return (loc + slot); -} - -int -db_fncall_ia64(db_expr_t addr, db_expr_t *rv, int nargs, db_expr_t args[]) -{ - struct ia64_fdesc fdesc; - __db_f *f; - - f = (__db_f *)&fdesc; - fdesc.func = addr; - fdesc.gp = __db_gp; /* XXX doesn't work for modules. */ - *rv = (*f)(args[0], args[1], args[2], args[3], args[4], args[5], - args[6], args[7]); - return (1); -} - -static int -db_frame(struct db_variable *vp, db_expr_t *valuep, int op) -{ - uint64_t *reg; - - if (kdb_frame == NULL) - return (0); - reg = (uint64_t*)((uintptr_t)kdb_frame + (uintptr_t)vp->valuep); - if (op == DB_VAR_GET) - *valuep = *reg; - else - *reg = *valuep; - return (1); -} - -static int -db_getip(struct db_variable *vp, db_expr_t *valuep, int op) -{ - u_long iip, slot; - - if (kdb_frame == NULL) - return (0); - - if (op == DB_VAR_GET) { - iip = kdb_frame->tf_special.iip; - slot = (kdb_frame->tf_special.psr >> 41) & 3; - *valuep = iip + slot; - } else { - iip = *valuep & ~0xf; - slot = *valuep & 0xf; - if (slot > 2) - return (0); - kdb_frame->tf_special.iip = iip; - kdb_frame->tf_special.psr &= ~IA64_PSR_RI; - kdb_frame->tf_special.psr |= slot << 41; - } - return (1); -} - -static int -db_getrse(struct db_variable *vp, db_expr_t *valuep, int op) -{ - u_int64_t *reg; - uint64_t bsp; - int nats, regno, sof; - - if (kdb_frame == NULL) - return (0); - - regno = (int)(intptr_t)valuep; - bsp = kdb_frame->tf_special.bspstore + kdb_frame->tf_special.ndirty; - sof = (int)(kdb_frame->tf_special.cfm & 0x7f); - - if (regno >= sof) - return (0); - - nats = (sof - regno + 63 - ((int)(bsp >> 3) & 0x3f)) / 63; - reg = (void*)(bsp - ((sof - regno + nats) << 3)); - if (op == DB_VAR_GET) - *valuep = *reg; - else - *reg = *valuep; - return (1); -} - -int -db_md_clr_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (-1); -} - -void -db_md_list_watchpoints() -{ - - return; -} - -int -db_md_set_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (-1); -} - -/* - * Read bytes from kernel address space for debugger. - */ -int -db_read_bytes(vm_offset_t addr, size_t size, char *data) -{ - jmp_buf jb; - void *prev_jb; - char *src; - int ret; - - prev_jb = kdb_jmpbuf(jb); - ret = setjmp(jb); - if (ret == 0) { - src = (char *)addr; - while (size-- > 0) - *data++ = *src++; - } - (void)kdb_jmpbuf(prev_jb); - return (ret); -} - -/* - * Write bytes to kernel address space for debugger. - */ -int -db_write_bytes(vm_offset_t addr, size_t size, char *data) -{ - jmp_buf jb; - void *prev_jb; - size_t cnt; - char *dst; - int ret; - - prev_jb = kdb_jmpbuf(jb); - ret = setjmp(jb); - if (ret == 0) { - dst = (char *)addr; - cnt = size; - while (cnt-- > 0) - *dst++ = *data++; - kdb_cpu_sync_icache((void *)addr, size); - } - (void)kdb_jmpbuf(prev_jb); - return (ret); -} - -void -db_show_mdpcpu(struct pcpu *pc) -{ - struct pcpu_md *md = &pc->pc_md; - - db_printf("MD: vhpt = %#lx\n", md->vhpt); - db_printf("MD: lid = %#lx\n", md->lid); - db_printf("MD: clock = %#lx\n", md->clock); - db_printf("MD: clock_mode = %u\n", md->clock_mode); - db_printf("MD: clock_load = %#lx\n", md->clock_load); - db_printf("MD: stats = %p\n", &md->stats); - db_printf("MD: pmap = %p\n", md->current_pmap); -#ifdef XTRACE - db_printf("MD: xtrace_buffer = %p\n", md->xtrace_buffer); - db_printf("MD: xtrace_tail = %#lx\n", md->xtrace_tail); -#endif -} - -void -db_trace_self(void) -{ - struct pcb pcb; - - savectx(&pcb); - db_backtrace(curthread, &pcb, -1); -} - -int -db_trace_thread(struct thread *td, int count) -{ - struct pcb *ctx; - - ctx = kdb_thr_ctx(td); - return (db_backtrace(td, ctx, count)); -} diff --git a/sys/ia64/ia64/dump_machdep.c b/sys/ia64/ia64/dump_machdep.c deleted file mode 100644 index d6d9d04..0000000 --- a/sys/ia64/ia64/dump_machdep.c +++ /dev/null @@ -1,439 +0,0 @@ -/*- - * Copyright (c) 2002 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_watchdog.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/cons.h> -#include <sys/efi.h> -#include <sys/kernel.h> -#include <sys/kerneldump.h> -#ifdef SW_WATCHDOG -#include <sys/watchdog.h> -#endif -#include <vm/vm.h> -#include <vm/pmap.h> -#include <machine/bootinfo.h> -#include <machine/elf.h> -#include <machine/md_var.h> - -CTASSERT(sizeof(struct kerneldumpheader) == 512); - -/* - * Don't touch the first SIZEOF_METADATA bytes on the dump device. This - * is to protect us from metadata and to protect metadata from us. - */ -#define SIZEOF_METADATA (64*1024) - -#define MD_ALIGN(x) (((off_t)(x) + EFI_PAGE_MASK) & ~EFI_PAGE_MASK) -#define DEV_ALIGN(x) (((off_t)(x) + (DEV_BSIZE-1)) & ~(DEV_BSIZE-1)) - -static int minidump = 0; -SYSCTL_INT(_debug, OID_AUTO, minidump, CTLFLAG_RWTUN, &minidump, 0, - "Enable mini crash dumps"); - -static struct kerneldumpheader kdh; -static off_t dumplo, fileofs; - -/* Handle buffered writes. */ -static char buffer[DEV_BSIZE]; -static size_t fragsz; - -static int -buf_write(struct dumperinfo *di, char *ptr, size_t sz) -{ - size_t len; - int error; - - while (sz) { - len = DEV_BSIZE - fragsz; - if (len > sz) - len = sz; - bcopy(ptr, buffer + fragsz, len); - fragsz += len; - ptr += len; - sz -= len; - if (fragsz == DEV_BSIZE) { - error = dump_write(di, buffer, 0, dumplo, - DEV_BSIZE); - if (error) - return (error); - dumplo += DEV_BSIZE; - fragsz = 0; - } - } - - return (0); -} - -static int -buf_flush(struct dumperinfo *di) -{ - int error; - - if (fragsz == 0) - return (0); - - error = dump_write(di, buffer, 0, dumplo, DEV_BSIZE); - dumplo += DEV_BSIZE; - fragsz = 0; - return (error); -} - -/* - * Physical dump support - */ - -typedef int phys_callback_t(struct efi_md*, int, void*); - -static int -phys_cb_dumpdata(struct efi_md *mdp, int seqnr, void *arg) -{ - struct dumperinfo *di = (struct dumperinfo*)arg; - vm_offset_t pa; - uint64_t pgs; - size_t counter, sz; - int c, error, twiddle; - - error = 0; /* catch case in which mdp->md_pages is 0 */ - counter = 0; /* Update twiddle every 16MB */ - twiddle = 0; - pgs = mdp->md_pages; - pa = IA64_PHYS_TO_RR7(mdp->md_phys); - - printf(" chunk %d: %ld pages ", seqnr, (long)pgs); - - while (pgs) { - sz = (pgs > (DFLTPHYS >> EFI_PAGE_SHIFT)) - ? DFLTPHYS : pgs << EFI_PAGE_SHIFT; - counter += sz; - if (counter >> 24) { - printf("%c\b", "|/-\\"[twiddle++ & 3]); - counter &= (1<<24) - 1; - } -#ifdef SW_WATCHDOG - wdog_kern_pat(WD_LASTVAL); -#endif - error = dump_write(di, (void*)pa, 0, dumplo, sz); - if (error) - break; - dumplo += sz; - pgs -= sz >> EFI_PAGE_SHIFT; - pa += sz; - - /* Check for user abort. */ - c = cncheckc(); - if (c == 0x03) - return (ECANCELED); - if (c != -1) - printf("(CTRL-C to abort) "); - } - printf("... %s\n", (error) ? "fail" : "ok"); - return (error); -} - -static int -phys_cb_dumphdr(struct efi_md *mdp, int seqnr, void *arg) -{ - struct dumperinfo *di = (struct dumperinfo*)arg; - Elf64_Phdr phdr; - int error; - - bzero(&phdr, sizeof(phdr)); - phdr.p_type = PT_LOAD; - phdr.p_flags = PF_R; /* XXX */ - phdr.p_offset = fileofs; - phdr.p_vaddr = (uintptr_t)mdp->md_virt; /* XXX probably bogus. */ - phdr.p_paddr = mdp->md_phys; - phdr.p_filesz = mdp->md_pages << EFI_PAGE_SHIFT; - phdr.p_memsz = mdp->md_pages << EFI_PAGE_SHIFT; - phdr.p_align = EFI_PAGE_SIZE; - - error = buf_write(di, (char*)&phdr, sizeof(phdr)); - fileofs += phdr.p_filesz; - return (error); -} - -static int -phys_cb_size(struct efi_md *mdp, int seqnr, void *arg) -{ - uint64_t *sz = (uint64_t*)arg; - - *sz += (uint64_t)mdp->md_pages << EFI_PAGE_SHIFT; - return (0); -} - -static int -phys_foreach(phys_callback_t cb, void *arg) -{ - struct efi_md *mdp; - int error, seqnr; - - seqnr = 0; - mdp = efi_md_first(); - while (mdp != NULL) { - if (mdp->md_type == EFI_MD_TYPE_FREE || - mdp->md_type == EFI_MD_TYPE_DATA || - mdp->md_type == EFI_MD_TYPE_CODE || - mdp->md_type == EFI_MD_TYPE_BS_DATA || - mdp->md_type == EFI_MD_TYPE_BS_CODE) { - error = (*cb)(mdp, seqnr++, arg); - if (error) - return (-error); - } - mdp = efi_md_next(mdp); - } - return (seqnr); -} - -/* - * Virtual dump (aka minidump) support - */ - -typedef int virt_callback_t(vm_offset_t, vm_size_t, int, void*); - -static int -virt_cb_size(vm_offset_t va, vm_size_t sz, int seqnr, void *arg) -{ - uint64_t *dumpsize = (uint64_t *)arg; - - *dumpsize += sz; - return (0); -} - -static int -virt_cb_dumphdr(vm_offset_t va, vm_size_t sz, int seqnr, void *arg) -{ - struct dumperinfo *di = (struct dumperinfo *)arg; - Elf64_Phdr phdr; - int error; - - bzero(&phdr, sizeof(phdr)); - phdr.p_type = PT_LOAD; - phdr.p_flags = PF_R; /* XXX */ - phdr.p_offset = fileofs; - phdr.p_vaddr = va; - phdr.p_paddr = ~0UL; - phdr.p_filesz = sz; - phdr.p_memsz = sz; - phdr.p_align = PAGE_SIZE; - - error = buf_write(di, (char*)&phdr, sizeof(phdr)); - fileofs += phdr.p_filesz; - return (error); -} - -static int -virt_cb_dumpdata(vm_offset_t va, vm_size_t sz, int seqnr, void *arg) -{ - struct dumperinfo *di = (struct dumperinfo *)arg; - size_t counter, iosz; - int c, error, twiddle; - - error = 0; /* catch case in which pgs is 0 */ - counter = 0; /* Update twiddle every 16MB */ - twiddle = 0; - - printf(" chunk %d: %ld pages ", seqnr, atop(sz)); - - while (sz) { - iosz = (sz > DFLTPHYS) ? DFLTPHYS : sz; - counter += iosz; - if (counter >> 24) { - printf("%c\b", "|/-\\"[twiddle++ & 3]); - counter &= (1<<24) - 1; - } -#ifdef SW_WATCHDOG - wdog_kern_pat(WD_LASTVAL); -#endif - error = dump_write(di, (void*)va, 0, dumplo, iosz); - if (error) - break; - dumplo += iosz; - sz -= iosz; - va += iosz; - - /* Check for user abort. */ - c = cncheckc(); - if (c == 0x03) - return (ECANCELED); - if (c != -1) - printf("(CTRL-C to abort) "); - } - printf("... %s\n", (error) ? "fail" : "ok"); - return (error); -} - -static int -virt_foreach(virt_callback_t cb, void *arg) -{ - vm_offset_t va; - vm_size_t sz; - int error, seqnr; - - seqnr = 0; - while (1) { - switch (seqnr) { - case 0: - va = IA64_PBVM_BASE; - sz = round_page(bootinfo->bi_kernend) - va; - break; - default: - va = 0; - sz = 0; - break; - } - if (va == 0 && sz == 0) - break; - error = (*cb)(va, sz, seqnr, arg); - if (error) - return (-error); - seqnr++; - } - return (seqnr); -} - -/* - * main entry point. - */ - -void -dumpsys(struct dumperinfo *di) -{ - Elf64_Ehdr ehdr; - uint64_t dumpsize; - off_t hdrgap; - size_t hdrsz; - int error, status; - - bzero(&ehdr, sizeof(ehdr)); - ehdr.e_ident[EI_MAG0] = ELFMAG0; - ehdr.e_ident[EI_MAG1] = ELFMAG1; - ehdr.e_ident[EI_MAG2] = ELFMAG2; - ehdr.e_ident[EI_MAG3] = ELFMAG3; - ehdr.e_ident[EI_CLASS] = ELFCLASS64; -#if BYTE_ORDER == LITTLE_ENDIAN - ehdr.e_ident[EI_DATA] = ELFDATA2LSB; -#else - ehdr.e_ident[EI_DATA] = ELFDATA2MSB; -#endif - ehdr.e_ident[EI_VERSION] = EV_CURRENT; - ehdr.e_ident[EI_OSABI] = ELFOSABI_STANDALONE; /* XXX big picture? */ - ehdr.e_type = ET_CORE; - ehdr.e_machine = EM_IA_64; - ehdr.e_entry = (minidump) ? (uintptr_t)bootinfo : - ia64_tpa((uintptr_t)bootinfo); - ehdr.e_phoff = sizeof(ehdr); - ehdr.e_flags = (minidump) ? 0 : EF_IA_64_ABSOLUTE; /* XXX misuse? */ - ehdr.e_ehsize = sizeof(ehdr); - ehdr.e_phentsize = sizeof(Elf64_Phdr); - ehdr.e_shentsize = sizeof(Elf64_Shdr); - - /* Calculate dump size. */ - dumpsize = 0L; - status = (minidump) ? virt_foreach(virt_cb_size, &dumpsize) : - phys_foreach(phys_cb_size, &dumpsize); - if (status < 0) { - error = -status; - goto fail; - } - ehdr.e_phnum = status; - hdrsz = ehdr.e_phoff + ehdr.e_phnum * ehdr.e_phentsize; - fileofs = (minidump) ? round_page(hdrsz) : MD_ALIGN(hdrsz); - dumpsize += fileofs; - hdrgap = fileofs - DEV_ALIGN(hdrsz); - - /* Determine dump offset on device. */ - if (di->mediasize < SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2) { - error = ENOSPC; - goto fail; - } - dumplo = di->mediaoffset + di->mediasize - dumpsize; - dumplo -= sizeof(kdh) * 2; - - mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_IA64_VERSION, dumpsize, di->blocksize); - - printf("Dumping %llu MB (%d chunks)\n", (long long)dumpsize >> 20, - ehdr.e_phnum); - - /* Dump leader */ - error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); - if (error) - goto fail; - dumplo += sizeof(kdh); - - /* Dump ELF header */ - error = buf_write(di, (char*)&ehdr, sizeof(ehdr)); - if (error) - goto fail; - - /* Dump program headers */ - status = (minidump) ? virt_foreach(virt_cb_dumphdr, di) : - phys_foreach(phys_cb_dumphdr, di); - if (status < 0) { - error = -status; - goto fail; - } - buf_flush(di); - - /* - * All headers are written using blocked I/O, so we know the - * current offset is (still) block aligned. Skip the alignment - * in the file to have the segment contents aligned at page - * boundary. For physical dumps, it's the EFI page size (= 4K). - * For minidumps it's the kernel's page size (= 8K). - */ - dumplo += hdrgap; - - /* Dump memory chunks (updates dumplo) */ - status = (minidump) ? virt_foreach(virt_cb_dumpdata, di) : - phys_foreach(phys_cb_dumpdata, di); - if (status < 0) { - error = -status; - goto fail; - } - - /* Dump trailer */ - error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); - if (error) - goto fail; - - /* Signal completion, signoff and exit stage left. */ - dump_write(di, NULL, 0, 0, 0); - printf("\nDump complete\n"); - return; - - fail: - if (error == ECANCELED) - printf("\nDump aborted\n"); - else - printf("\n** DUMP FAILED (ERROR %d) **\n", error); -} diff --git a/sys/ia64/ia64/efi.c b/sys/ia64/ia64/efi.c deleted file mode 100644 index 55adb67..0000000 --- a/sys/ia64/ia64/efi.c +++ /dev/null @@ -1,270 +0,0 @@ -/*- - * Copyright (c) 2004 Marcel Moolenaar - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/efi.h> -#include <sys/systm.h> -#include <machine/bootinfo.h> -#include <machine/md_var.h> -#include <machine/sal.h> -#include <vm/vm.h> -#include <vm/pmap.h> - -static struct efi_systbl *efi_systbl; -static struct efi_cfgtbl *efi_cfgtbl; -static struct efi_rt *efi_runtime; - -static int efi_status2err[25] = { - 0, /* EFI_SUCCESS */ - ENOEXEC, /* EFI_LOAD_ERROR */ - EINVAL, /* EFI_INVALID_PARAMETER */ - ENOSYS, /* EFI_UNSUPPORTED */ - EMSGSIZE, /* EFI_BAD_BUFFER_SIZE */ - EOVERFLOW, /* EFI_BUFFER_TOO_SMALL */ - EBUSY, /* EFI_NOT_READY */ - EIO, /* EFI_DEVICE_ERROR */ - EROFS, /* EFI_WRITE_PROTECTED */ - EAGAIN, /* EFI_OUT_OF_RESOURCES */ - EIO, /* EFI_VOLUME_CORRUPTED */ - ENOSPC, /* EFI_VOLUME_FULL */ - ENXIO, /* EFI_NO_MEDIA */ - ESTALE, /* EFI_MEDIA_CHANGED */ - ENOENT, /* EFI_NOT_FOUND */ - EACCES, /* EFI_ACCESS_DENIED */ - ETIMEDOUT, /* EFI_NO_RESPONSE */ - EADDRNOTAVAIL, /* EFI_NO_MAPPING */ - ETIMEDOUT, /* EFI_TIMEOUT */ - EDOOFUS, /* EFI_NOT_STARTED */ - EALREADY, /* EFI_ALREADY_STARTED */ - ECANCELED, /* EFI_ABORTED */ - EPROTO, /* EFI_ICMP_ERROR */ - EPROTO, /* EFI_TFTP_ERROR */ - EPROTO /* EFI_PROTOCOL_ERROR */ -}; - -static int -efi_status_to_errno(efi_status status) -{ - u_long code; - int error; - - code = status & 0x3ffffffffffffffful; - error = (code < 25) ? efi_status2err[code] : EDOOFUS; - return (error); -} - -void -efi_boot_finish(void) -{ -} - -/* - * Collect the entry points for PAL and SAL. Be extra careful about NULL - * pointer values. We're running pre-console, so it's better to return - * error values than to cause panics, machine checks and other traps and - * faults. Keep this minimal... - */ -int -efi_boot_minimal(uint64_t systbl) -{ - ia64_efi_f setvirt; - struct efi_md *md; - efi_status status; - - if (systbl == 0) - return (EINVAL); - efi_systbl = (struct efi_systbl *)IA64_PHYS_TO_RR7(systbl); - if (efi_systbl->st_hdr.th_sig != EFI_SYSTBL_SIG) { - efi_systbl = NULL; - return (EFAULT); - } - efi_cfgtbl = (efi_systbl->st_cfgtbl == 0) ? NULL : - (struct efi_cfgtbl *)IA64_PHYS_TO_RR7(efi_systbl->st_cfgtbl); - if (efi_cfgtbl == NULL) - return (ENOENT); - efi_runtime = (efi_systbl->st_rt == 0) ? NULL : - (struct efi_rt *)IA64_PHYS_TO_RR7(efi_systbl->st_rt); - if (efi_runtime == NULL) - return (ENOENT); - - /* - * Relocate runtime memory segments for firmware. - */ - md = efi_md_first(); - while (md != NULL) { - if (md->md_attr & EFI_MD_ATTR_RT) { - md->md_virt = (md->md_attr & EFI_MD_ATTR_WB) ? - (void *)IA64_PHYS_TO_RR7(md->md_phys) : - (void *)IA64_PHYS_TO_RR6(md->md_phys); - } - md = efi_md_next(md); - } - setvirt = (void *)IA64_PHYS_TO_RR7((u_long)efi_runtime->rt_setvirtual); - status = ia64_efi_physical(setvirt, bootinfo->bi_memmap_size, - bootinfo->bi_memdesc_size, bootinfo->bi_memdesc_version, - ia64_tpa(bootinfo->bi_memmap)); - return ((status < 0) ? EFAULT : 0); -} - -void * -efi_get_table(struct uuid *uuid) -{ - struct efi_cfgtbl *ct; - u_long count; - - if (efi_cfgtbl == NULL) - return (NULL); - count = efi_systbl->st_entries; - ct = efi_cfgtbl; - while (count--) { - if (!bcmp(&ct->ct_uuid, uuid, sizeof(*uuid))) - return ((void *)IA64_PHYS_TO_RR7(ct->ct_data)); - ct++; - } - return (NULL); -} - -void -efi_get_time(struct efi_tm *tm) -{ - - efi_runtime->rt_gettime(tm, NULL); -} - -struct efi_md * -efi_md_first(void) -{ - struct efi_md *md; - - if (bootinfo->bi_memmap == 0) - return (NULL); - md = (struct efi_md *)bootinfo->bi_memmap; - return (md); -} - -struct efi_md * -efi_md_last(void) -{ - struct efi_md *md; - - if (bootinfo->bi_memmap == 0) - return (NULL); - md = (struct efi_md *)(bootinfo->bi_memmap + bootinfo->bi_memmap_size - - bootinfo->bi_memdesc_size); - return (md); -} - -struct efi_md * -efi_md_next(struct efi_md *md) -{ - struct efi_md *lim; - - lim = efi_md_last(); - md = (struct efi_md *)((uintptr_t)md + bootinfo->bi_memdesc_size); - return ((md > lim) ? NULL : md); -} - -struct efi_md * -efi_md_prev(struct efi_md *md) -{ - struct efi_md *lim; - - lim = efi_md_first(); - md = (struct efi_md *)((uintptr_t)md - bootinfo->bi_memdesc_size); - return ((md < lim) ? NULL : md); -} - -struct efi_md * -efi_md_find(vm_paddr_t pa) -{ - static struct efi_md *last = NULL; - struct efi_md *md, *p0, *p1; - - md = (last != NULL) ? last : efi_md_first(); - p1 = p0 = NULL; - while (md != NULL && md != p1) { - if (pa >= md->md_phys && - pa < md->md_phys + md->md_pages * EFI_PAGE_SIZE) { - last = md; - return (md); - } - - p1 = p0; - p0 = md; - md = (pa < md->md_phys) ? efi_md_prev(md) : efi_md_next(md); - } - - return (NULL); -} - -void -efi_reset_system(void) -{ - - if (efi_runtime != NULL) - efi_runtime->rt_reset(EFI_RESET_WARM, 0, 0, NULL); - panic("%s: unable to reset the machine", __func__); -} - -int -efi_set_time(struct efi_tm *tm) -{ - - return (efi_status_to_errno(efi_runtime->rt_settime(tm))); -} - -int -efi_var_get(efi_char *name, struct uuid *vendor, uint32_t *attrib, - size_t *datasize, void *data) -{ - efi_status status; - - status = efi_runtime->rt_getvar(name, vendor, attrib, datasize, data); - return (efi_status_to_errno(status)); -} - -int -efi_var_nextname(size_t *namesize, efi_char *name, struct uuid *vendor) -{ - efi_status status; - - status = efi_runtime->rt_scanvar(namesize, name, vendor); - return (efi_status_to_errno(status)); -} - -int -efi_var_set(efi_char *name, struct uuid *vendor, uint32_t attrib, - size_t datasize, void *data) -{ - efi_status status; - - status = efi_runtime->rt_setvar(name, vendor, attrib, datasize, data); - return (efi_status_to_errno(status)); -} diff --git a/sys/ia64/ia64/elf_machdep.c b/sys/ia64/ia64/elf_machdep.c deleted file mode 100644 index 05cb641..0000000 --- a/sys/ia64/ia64/elf_machdep.c +++ /dev/null @@ -1,323 +0,0 @@ -/*- - * Copyright 1996-1998 John D. Polstra. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/exec.h> -#include <sys/imgact.h> -#include <sys/malloc.h> -#include <sys/proc.h> -#include <sys/namei.h> -#include <sys/fcntl.h> -#include <sys/vnode.h> -#include <sys/linker.h> -#include <sys/sysent.h> -#include <sys/imgact_elf.h> -#include <sys/syscall.h> -#include <sys/signalvar.h> - -#include <vm/vm.h> -#include <vm/vm_param.h> - -#include <machine/elf.h> -#include <machine/frame.h> -#include <machine/md_var.h> -#include <machine/unwind.h> - -Elf_Addr link_elf_get_gp(linker_file_t); - -extern Elf_Addr fptr_storage[]; - -struct sysentvec elf64_freebsd_sysvec = { - .sv_size = SYS_MAXSYSCALL, - .sv_table = sysent, - .sv_mask = 0, - .sv_sigsize = 0, - .sv_sigtbl = NULL, - .sv_errsize = 0, - .sv_errtbl = NULL, - .sv_transtrap = NULL, - .sv_fixup = __elfN(freebsd_fixup), - .sv_sendsig = sendsig, - .sv_sigcode = NULL, - .sv_szsigcode = NULL, - .sv_prepsyscall = NULL, - .sv_name = "FreeBSD ELF64", - .sv_coredump = __elfN(coredump), - .sv_imgact_try = NULL, - .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize = PAGE_SIZE, - .sv_minuser = VM_MIN_ADDRESS, - .sv_maxuser = VM_MAXUSER_ADDRESS, - .sv_usrstack = USRSTACK, - .sv_psstrings = PS_STRINGS, - .sv_stackprot = VM_PROT_READ|VM_PROT_WRITE, - .sv_copyout_strings = exec_copyout_strings, - .sv_setregs = exec_setregs, - .sv_fixlimit = NULL, - .sv_maxssiz = NULL, - .sv_flags = SV_ABI_FREEBSD | SV_LP64, - .sv_set_syscall_retval = cpu_set_syscall_retval, - .sv_fetch_syscall_args = cpu_fetch_syscall_args, - .sv_syscallnames = syscallnames, - .sv_schedtail = NULL, -}; - -static Elf64_Brandinfo freebsd_brand_info = { - .brand = ELFOSABI_FREEBSD, - .machine = EM_IA_64, - .compat_3_brand = "FreeBSD", - .emul_path = NULL, - .interp_path = "/libexec/ld-elf.so.1", - .sysvec = &elf64_freebsd_sysvec, - .interp_newpath = NULL, - .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE -}; -SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST, - (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_info); - -static Elf64_Brandinfo freebsd_brand_oinfo = { - .brand = ELFOSABI_FREEBSD, - .machine = EM_IA_64, - .compat_3_brand = "FreeBSD", - .emul_path = NULL, - .interp_path = "/usr/libexec/ld-elf.so.1", - .sysvec = &elf64_freebsd_sysvec, - .interp_newpath = NULL, - .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE -}; -SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY, - (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_oinfo); - - -void -elf64_dump_thread(struct thread *td, void *dst, size_t *off __unused) -{ - - /* Flush the dirty registers onto the backingstore. */ - if (dst == NULL) - ia64_flush_dirty(td, &td->td_frame->tf_special); -} - - -static Elf_Addr -lookup_fdesc(linker_file_t lf, Elf_Size symidx, elf_lookup_fn lookup) -{ - linker_file_t top; - Elf_Addr addr; - const char *symname; - int i; - static int eot = 0; - - addr = lookup(lf, symidx, 0); - if (addr == 0) { - top = lf; - symname = elf_get_symname(top, symidx); - for (i = 0; i < top->ndeps; i++) { - lf = top->deps[i]; - addr = (Elf_Addr)linker_file_lookup_symbol(lf, - symname, 0); - if (addr != 0) - break; - } - if (addr == 0) - return (0); - } - - if (eot) - return (0); - - /* - * Lookup and/or construct OPD - */ - for (i = 0; i < 8192; i += 2) { - if (fptr_storage[i] == addr) - return (Elf_Addr)(fptr_storage + i); - - if (fptr_storage[i] == 0) { - fptr_storage[i] = addr; - fptr_storage[i+1] = link_elf_get_gp(lf); - return (Elf_Addr)(fptr_storage + i); - } - } - - printf("%s: fptr table full\n", __func__); - eot = 1; - - return (0); -} - -/* Process one elf relocation with addend. */ -static int -elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data, - int type, int local, elf_lookup_fn lookup) -{ - Elf_Addr *where; - Elf_Addr addend, addr; - Elf_Size rtype, symidx; - const Elf_Rel *rel; - const Elf_Rela *rela; - - switch (type) { - case ELF_RELOC_REL: - rel = (const Elf_Rel *)data; - where = (Elf_Addr *)(relocbase + rel->r_offset); - rtype = ELF_R_TYPE(rel->r_info); - symidx = ELF_R_SYM(rel->r_info); - switch (rtype) { - case R_IA_64_DIR64LSB: - case R_IA_64_FPTR64LSB: - case R_IA_64_REL64LSB: - addend = *where; - break; - default: - addend = 0; - break; - } - break; - case ELF_RELOC_RELA: - rela = (const Elf_Rela *)data; - where = (Elf_Addr *)(relocbase + rela->r_offset); - rtype = ELF_R_TYPE(rela->r_info); - symidx = ELF_R_SYM(rela->r_info); - addend = rela->r_addend; - break; - default: - panic("%s: invalid ELF relocation (0x%x)\n", __func__, type); - } - - if (local) { - if (rtype == R_IA_64_REL64LSB) - *where = elf_relocaddr(lf, relocbase + addend); - return (0); - } - - switch (rtype) { - case R_IA_64_NONE: - break; - case R_IA_64_DIR64LSB: /* word64 LSB S + A */ - addr = lookup(lf, symidx, 1); - if (addr == 0) - return (-1); - *where = addr + addend; - break; - case R_IA_64_FPTR64LSB: /* word64 LSB @fptr(S + A) */ - if (addend != 0) { - printf("%s: addend ignored for OPD relocation\n", - __func__); - } - addr = lookup_fdesc(lf, symidx, lookup); - if (addr == 0) - return (-1); - *where = addr; - break; - case R_IA_64_REL64LSB: /* word64 LSB BD + A */ - break; - case R_IA_64_IPLTLSB: - addr = lookup_fdesc(lf, symidx, lookup); - if (addr == 0) - return (-1); - where[0] = *((Elf_Addr*)addr) + addend; - where[1] = *((Elf_Addr*)addr + 1); - break; - default: - printf("%s: unknown relocation (0x%x)\n", __func__, - (int)rtype); - return -1; - } - - return (0); -} - -int -elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type, - elf_lookup_fn lookup) -{ - - return (elf_reloc_internal(lf, relocbase, data, type, 0, lookup)); -} - -int -elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data, - int type, elf_lookup_fn lookup) -{ - - return (elf_reloc_internal(lf, relocbase, data, type, 1, lookup)); -} - -int -elf_cpu_load_file(linker_file_t lf) -{ - Elf_Ehdr *hdr; - Elf_Phdr *ph, *phlim; - Elf_Addr reloc, vaddr; - - hdr = (Elf_Ehdr *)(lf->address); - if (!IS_ELF(*hdr)) { - printf("Missing or corrupted ELF header at %p\n", hdr); - return (EFTYPE); - } - - /* - * Iterate over the segments and register the unwind table if - * we come across it. - */ - ph = (Elf_Phdr *)(lf->address + hdr->e_phoff); - phlim = ph + hdr->e_phnum; - reloc = ~0ULL; - while (ph < phlim) { - if (ph->p_type == PT_LOAD && reloc == ~0ULL) - reloc = (Elf_Addr)lf->address - ph->p_vaddr; - - if (ph->p_type == PT_IA_64_UNWIND) { - vaddr = ph->p_vaddr + reloc; - unw_table_add((vm_offset_t)lf->address, vaddr, - vaddr + ph->p_memsz); - } - ++ph; - } - - /* - * Make the I-cache coherent, but don't worry obout the kernel - * itself because the loader needs to do that. - */ - if (lf->id != 1) - ia64_sync_icache((uintptr_t)lf->address, lf->size); - - return (0); -} - -int -elf_cpu_unload_file(linker_file_t lf) -{ - - unw_table_remove((vm_offset_t)lf->address); - return (0); -} diff --git a/sys/ia64/ia64/emulate.c b/sys/ia64/ia64/emulate.c deleted file mode 100644 index 37fcf55..0000000 --- a/sys/ia64/ia64/emulate.c +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * Copyright (c) 2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> - -#include <machine/frame.h> -#include <machine/md_var.h> - -#include <ia64/disasm/disasm.h> - -int -ia64_emulate(struct trapframe *tf, struct thread *td) -{ - struct asm_bundle bundle; - struct asm_inst *i; - int slot; - - if (!asm_decode(tf->tf_special.iip, &bundle)) - return (SIGILL); - - slot = ((tf->tf_special.psr & IA64_PSR_RI) == IA64_PSR_RI_0) ? 0 : - ((tf->tf_special.psr & IA64_PSR_RI) == IA64_PSR_RI_1) ? 1 : 2; - if (slot == 1 && bundle.b_templ[slot] == 'L') - slot++; - - i = bundle.b_inst + slot; - switch (i->i_op) { - case ASM_OP_BRL: - /* - * We get the fault even if the predicate is false, so we - * need to check the predicate first and simply advance to - * the next bundle in that case. - */ - if (!(tf->tf_special.pr & (1UL << i->i_oper[0].o_value))) { - tf->tf_special.psr &= ~IA64_PSR_RI; - tf->tf_special.iip += 16; - return (0); - } - /* - * The brl.cond is the simplest form. We only have to set - * the IP to the address in the instruction and return. - */ - if (i->i_cmpltr[0].c_type == ASM_CT_COND) { - tf->tf_special.psr &= ~IA64_PSR_RI; - tf->tf_special.iip += i->i_oper[1].o_value; - return (0); - } - /* Sanity check... */ - if (i->i_cmpltr[0].c_type != ASM_CT_CALL) - break; - /* - * The brl.call is more difficult as we need to set-up the - * call properly. - */ - break; - default: - break; - } - - return (SIGILL); -} diff --git a/sys/ia64/ia64/exception.S b/sys/ia64/ia64/exception.S deleted file mode 100644 index 4a927e7..0000000 --- a/sys/ia64/ia64/exception.S +++ /dev/null @@ -1,1758 +0,0 @@ -/*- - * Copyright (c) 2003,2004 Marcel Moolenaar - * Copyright (c) 2000 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <machine/asm.h> -__FBSDID("$FreeBSD$"); - -#include "opt_xtrace.h" - -#include <machine/pte.h> -#include <assym.s> - -/* - * Nested TLB restart tokens. These are used by the - * nested TLB handler for jumping back to the code - * where the nested TLB was caused. - */ -#define NTLBRT_SAVE 0x12c12c -#define NTLBRT_RESTORE 0x12c12d - -/* - * ar.k7 = kernel memory stack - * ar.k6 = kernel register stack - * ar.k5 = EPC gateway page - * ar.k4 = PCPU data - */ - - .section .ivt.data, "aw" - - .align 8 - .global ia64_kptdir - .size ia64_kptdir, 8 -ia64_kptdir: data8 0 - -#ifdef XTRACE - - .align 8 - .global ia64_xtrace_mask - .size ia64_xtrace_mask, 8 -ia64_xtrace_mask: data8 0 - - .align 4 - .global ia64_xtrace_enabled - .size ia64_xtrace_enabled, 4 -ia64_xtrace_enabled: data4 0 - -#define XTRACE_HOOK(offset) \ -{ .mii ; \ - nop 0 ; \ - mov r31 = b7 ; \ - mov r28 = pr ; \ -} ; \ -{ .mib ; \ - nop 0 ; \ - mov r25 = ip ; \ - br.sptk ia64_xtrace_write ;; \ -} ; \ -{ .mii ; \ - nop 0 ; \ - mov b7 = r31 ; \ - mov pr = r28, 0x1ffff ;; \ -} - - .section .ivt.text, "ax" - -// We can only use r25, r26 & r27 -ENTRY_NOPROFILE(ia64_xtrace_write, 0) -{ .mlx - add r25 = 16, r25 - movl r26 = ia64_xtrace_enabled - ;; -} -{ .mmi - mov r27 = ar.k3 - ld4 r26 = [r26] - mov b7 = r25 - ;; -} -{ .mib - add r25 = -32, r25 - cmp.eq p15,p0 = r0, r26 -(p15) br.dptk.few b7 - ;; -} -{ .mib - nop 0 - cmp.eq p15,p0 = r0, r27 -(p15) br.dptk.few b7 - ;; -} -{ .mmi - st8 [r27] = r25, 8 // 0x00 IVT - mov r26 = ar.itc - nop 0 - ;; -} -{ .mmi - st8 [r27] = r26, 8 // 0x08 ITC - mov r25 = cr.iip - nop 0 - ;; -} -{ .mmi - st8 [r27] = r25, 8 // 0x10 IIP - mov r26 = cr.ifa - nop 0 - ;; -} -{ .mmi - st8 [r27] = r26, 8 // 0x18 IFA - mov r25 = cr.isr - nop 0 - ;; -} -{ .mmi - st8 [r27] = r25, 8 // 0x20 ISR - mov r26 = cr.ipsr - nop 0 - ;; -} -{ .mmi - st8 [r27] = r26, 8 // 0x28 IPSR - mov r25 = cr.itir - nop 0 - ;; -} -{ .mmi - st8 [r27] = r25, 8 // 0x30 ITIR - mov r26 = cr.iipa - nop 0 - ;; -} -{ .mmi - st8 [r27] = r26, 8 // 0x38 IIPA - mov r25 = cr.ifs - nop 0 - ;; -} -{ .mmi - st8 [r27] = r25, 8 // 0x40 IFS - mov r26 = cr.iim - nop 0 - ;; -} -{ .mmi - st8 [r27] = r26, 8 // 0x48 IIM - mov r25 = cr.iha - nop 0 - ;; -} -{ .mmi - st8 [r27] = r25, 8 // 0x50 IHA - mov r26 = ar.unat - nop 0 - ;; -} -{ .mmi - st8 [r27] = r26, 8 // 0x58 UNAT - mov r25 = ar.rsc - nop 0 - ;; -} -{ .mmi - st8 [r27] = r25, 8 // 0x60 RSC - mov r26 = ar.bsp - nop 0 - ;; -} -{ .mmi - st8 [r27] = r26, 8 // 0x68 BSP - mov r25 = r13 - nop 0 - ;; -} -{ .mmi - st8 [r27] = r25, 8 // 0x70 PCPU/TLS - mov r26 = r12 - nop 0 - ;; -} -{ .mlx - st8 [r27] = r26, 8 // 0x78 SP - movl r25 = ia64_xtrace_mask - ;; -} -{ .mmi - ld8 r26 = [r25] - ;; - and r25 = r27, r26 - nop 0 - ;; -} -{ .mib - mov ar.k3 = r25 - nop 0 - br.sptk b7 - ;; -} -END(ia64_xtrace_write) - -#else /* XTRACE */ - -#define XTRACE_HOOK(offset) - - .section .ivt.text, "ax" - -#endif /* XTRACE */ - -/* - * exception_save: save interrupted state - * - * Arguments: - * r16 address of bundle that contains the branch. The - * return address will be the next bundle. - * r17 the value to save as ifa in the trapframe. This - * normally is cr.ifa, but some interruptions set - * set cr.iim and not cr.ifa. - * - * Returns: - * p15 interrupted from user stack - * p14 interrupted from kernel stack - * p13 interrupted from user backing store - * p12 interrupted from kernel backing store - * p11 interrupts were enabled - * p10 interrupts were disabled - */ -ENTRY_NOPROFILE(exception_save, 0) -{ .mii - mov r20=ar.unat - extr.u r31=sp,61,3 - mov r18=pr - ;; -} -{ .mmi - cmp.le p14,p15=IA64_VM_MINKERN_REGION,r31 - ;; -(p15) mov r23=ar.k7 // kernel memory stack -(p14) mov r23=sp - ;; -} -{ .mii - mov r21=ar.rsc - add r30=-SIZEOF_TRAPFRAME,r23 - ;; - dep r30=0,r30,0,10 - ;; -} -{ .mmi - mov ar.rsc=0 - mov r22=cr.iip - addl r29=NTLBRT_SAVE,r0 // 22-bit restart token. - ;; -} - - /* - * We have a 1KB aligned trapframe, pointed to by r30. We can't - * reliably write to the trapframe using virtual addressing, due - * to the fact that TC entries we depend on can be removed by: - * 1. ptc.g instructions issued by other threads/cores/CPUs, or - * 2. TC modifications in another thread on the same core. - * When our TC entry gets removed, we get nested TLB faults and - * since no state is saved, we can only deal with those when - * explicitly coded and expected. - * As such, we switch to physical addressing and account for the - * fact that the tpa instruction can cause a nested TLB fault. - * Since the data nested TLB fault does not preserve any state, - * we have to be careful what we clobber. Consequently, we have - * to be careful what we use here. Below a list of registers that - * are considered alive: - * r16,r17=arguments - * r18=pr, r19=length, r20=unat, r21=rsc, r22=iip, r23=TOS - * r29=restart token - * r30=trapframe pointers - * p14,p15=memory stack switch - */ -exception_save_restart: - tpa r24=r30 // Nested TLB fault possible - sub r19=r23,r30 - nop 0 - ;; - - rsm psr.dt - add r29=16,r19 // Clobber restart token - mov r30=r24 - ;; - srlz.d - add r31=8,r24 - ;; - - // r18=pr, r19=length, r20=unat, r21=rsc, r22=iip, r23=TOS - // r29=delta -{ .mmi - st8 [r30]=r19,16 // length - st8 [r31]=r0,16 // flags - ;; -} -{ .mmi - st8.spill [r30]=sp,16 // sp - st8 [r31]=r20,16 // unat - sub sp=r23,r29 - ;; -} -{ .mmi - mov r19=ar.rnat - mov r20=ar.bspstore - mov r23=rp - ;; -} - // r18=pr, r19=rnat, r20=bspstore, r21=rsc, r22=iip, r23=rp - // r24=pfs -{ .mmi - st8 [r30]=r23,16 // rp - st8 [r31]=r18,16 // pr - mov r24=ar.pfs - ;; -} -{ .mmb - st8 [r30]=r24,16 // pfs - st8 [r31]=r20,16 // bspstore - cover - ;; -} -{ .mmi - mov r18=ar.fpsr - mov r23=cr.ipsr - extr.u r24=r20,61,3 - ;; -} - // r18=fpsr, r19=rnat, r20=bspstore, r21=rsc, r22=iip, r23=ipsr -{ .mmi - st8 [r30]=r19,16 // rnat - st8 [r31]=r0,16 // __spare - cmp.le p12,p13=IA64_VM_MINKERN_REGION,r24 - ;; -} -{ .mmi - st8.spill [r30]=r13,16 // tp - st8 [r31]=r21,16 // rsc - tbit.nz p11,p10=r23,14 // p11=interrupts enabled - ;; -} -{ .mmi -(p13) mov r21=ar.k6 // kernel register stack - ;; - st8 [r30]=r18,16 // fpsr -(p13) dep r20=r20,r21,0,9 // align dirty registers - ;; -} - // r19=rnat, r20=bspstore, r22=iip, r23=ipsr -{ .mmi - st8 [r31]=r23,16 // psr -(p13) mov ar.bspstore=r20 - nop 0 - ;; -} -{ .mmi -(p13) mov ar.rnat=r19 - mov r18=ar.bsp - nop 0 - ;; -} -{ .mmi - mov r19=cr.ifs - st8.spill [r30]=gp,16 // gp - sub r18=r18,r20 - ;; -} - // r18=ndirty, r19=ifs, r22=iip -{ .mmi - st8 [r31]=r18,16 // ndirty - st8 [r30]=r19,16 // cfm - nop 0 - ;; -} -{ .mmi - mov r18=cr.isr - st8 [r31]=r22,16 // iip - add r29=16,r30 - ;; -} -{ .mmi - st8 [r30]=r17,24 // ifa - st8 [r31]=r18,24 // isr - nop 0 - ;; -} -{ .mmi - .mem.offset 0,0 - st8.spill [r30]=r2,16 // r2 - .mem.offset 8,0 - st8.spill [r31]=r3,16 // r3 - add r2=9*8,r29 - ;; -} -{ .mmi - .mem.offset 0,0 - st8.spill [r30]=r8,16 // r8 - .mem.offset 8,0 - st8.spill [r31]=r9,16 // r9 - add r3=8,r2 - ;; -} -{ .mmi - .mem.offset 0,0 - st8.spill [r30]=r10,16 // r10 - .mem.offset 8,0 - st8.spill [r31]=r11,16 // r11 - add r8=16,r16 - ;; -} -{ .mmi - .mem.offset 0,0 - st8.spill [r30]=r14 // r14 - .mem.offset 8,0 - st8.spill [r31]=r15 // r15 - mov r9=r29 -} -{ .mmb - mov r10=ar.csd - mov r11=ar.ssd - bsw.1 - ;; -} -{ .mmi - .mem.offset 0,0 - st8.spill [r2]=r16,16 // r16 - .mem.offset 8,0 - st8.spill [r3]=r17,16 // r17 - mov r14=b6 - ;; -} -{ .mmi - .mem.offset 0,0 - st8.spill [r2]=r18,16 // r18 - .mem.offset 8,0 - st8.spill [r3]=r19,16 // r19 - mov r15=b7 - ;; -} -{ .mmi - .mem.offset 0,0 - st8.spill [r2]=r20,16 // r20 - .mem.offset 8,0 - st8.spill [r3]=r21,16 // r21 - mov b7=r8 - ;; -} -{ .mmi - .mem.offset 0,0 - st8.spill [r2]=r22,16 // r22 - .mem.offset 8,0 - st8.spill [r3]=r23,16 // r23 - ;; -} - - .mem.offset 0,0 - st8.spill [r2]=r24,16 // r24 - .mem.offset 8,0 - st8.spill [r3]=r25,16 // r25 - ;; - .mem.offset 0,0 - st8.spill [r2]=r26,16 // r26 - .mem.offset 8,0 - st8.spill [r3]=r27,16 // r27 - ;; - .mem.offset 0,0 - st8.spill [r2]=r28,16 // r28 - .mem.offset 8,0 - st8.spill [r3]=r29,16 // r29 - ;; - .mem.offset 0,0 - st8.spill [r2]=r30,16 // r30 - .mem.offset 8,0 - st8.spill [r3]=r31,16 // r31 - ;; - -{ .mmi - st8 [r2]=r14,16 // b6 - mov r17=ar.unat - nop 0 - ;; -} -{ .mmi - st8 [r3]=r15,16 // b7 - mov r16=ar.ccv - nop 0 - ;; -} -{ .mmi - st8 [r2]=r16,16 // ccv - st8 [r3]=r10,16 // csd - nop 0 - ;; -} -{ .mmi - st8 [r2]=r11,24 // ssd - st8 [r9]=r17 - nop 0 - ;; -} - - stf.spill [r3]=f6,32 // f6 - stf.spill [r2]=f7,32 // f7 - ;; - stf.spill [r3]=f8,32 // f8 - stf.spill [r2]=f9,32 // f9 - ;; - stf.spill [r3]=f10,32 // f10 - stf.spill [r2]=f11,32 // f11 - ;; - stf.spill [r3]=f12,32 // f12 - stf.spill [r2]=f13,32 // f13 - ;; - stf.spill [r3]=f14 // f14 - stf.spill [r2]=f15 // f15 - ;; -{ .mmi - mov ar.rsc=3 - mov r13=ar.k4 - nop 0 - ;; -} -{ .mlx - ssm psr.dt|psr.ic|psr.dfh - movl gp=__gp - ;; -} -{ .mib - srlz.d - nop 0 - br.sptk b7 - ;; -} -END(exception_save) - -/* - * exception_restore: restore interrupted state - * - * Arguments: - * sp+16 trapframe pointer - */ -ENTRY_NOPROFILE(exception_restore, 0) -{ .mmi - rsm psr.i - add sp=16,sp - nop 0 - ;; -} - - // The next instruction can fault. Let it be... - tpa r9=sp - ;; - rsm psr.dt|psr.ic - add r8=SIZEOF_SPECIAL+16,r9 - ;; - srlz.d - add r2=SIZEOF_TRAPFRAME-16,r9 - add r3=SIZEOF_TRAPFRAME-32,r9 - ;; - -{ .mmi - ldf.fill f15=[r2],-32 // f15 - ldf.fill f14=[r3],-32 // f14 - nop 0 - ;; -} -{ .mmi - ldf.fill f13=[r2],-32 // f13 - ldf.fill f12=[r3],-32 // f12 - nop 0 - ;; -} -{ .mmi - ldf.fill f11=[r2],-32 // f11 - ldf.fill f10=[r3],-32 // f10 - nop 0 - ;; -} -{ .mmi - ldf.fill f9=[r2],-32 // f9 - ldf.fill f8=[r3],-32 // f8 - nop 0 - ;; -} -{ .mmi - ldf.fill f7=[r2],-24 // f7 - ldf.fill f6=[r3],-16 // f6 - nop 0 - ;; -} -{ .mmi - ld8 r8=[r8] // unat (after) - ;; - mov ar.unat=r8 - nop 0 - ;; -} - - ld8 r10=[r2],-16 // ssd - ld8 r11=[r3],-16 // csd - ;; - mov ar.ssd=r10 - mov ar.csd=r11 - - ld8 r14=[r2],-16 // ccv - ld8 r15=[r3],-16 // b7 - ;; - -{ .mmi - mov ar.ccv=r14 - ld8 r8=[r2],-16 // b6 - mov b7=r15 - ;; -} -{ .mmi - ld8.fill r31=[r3],-16 // r31 - ld8.fill r30=[r2],-16 // r30 - mov b6=r8 - ;; -} - - ld8.fill r29=[r3],-16 // r29 - ld8.fill r28=[r2],-16 // r28 - ;; - ld8.fill r27=[r3],-16 // r27 - ld8.fill r26=[r2],-16 // r26 - ;; - ld8.fill r25=[r3],-16 // r25 - ld8.fill r24=[r2],-16 // r24 - ;; - ld8.fill r23=[r3],-16 // r23 - ld8.fill r22=[r2],-16 // r22 - ;; - ld8.fill r21=[r3],-16 // r21 - ld8.fill r20=[r2],-16 // r20 - ;; - ld8.fill r19=[r3],-16 // r19 - ld8.fill r18=[r2],-16 // r18 - ;; - -{ .mmb - ld8.fill r17=[r3],-16 // r17 - ld8.fill r16=[r2],-16 // r16 - bsw.0 - ;; -} -{ .mii - ld8 r16=[r9] // tf_length - add r31=16,r9 - add r30=24,r9 -} -{ .mmi - ld8.fill r15=[r3],-16 // r15 - ld8.fill r14=[r2],-16 // r14 - nop 0 - ;; -} -{ .mmi - ld8.fill r11=[r3],-16 // r11 - ld8.fill r10=[r2],-16 // r10 - add r16=r16,sp // ar.k7 - ;; -} -{ .mmi - ld8.fill r9=[r3],-16 // r9 - ld8.fill r8=[r2],-16 // r8 - nop 0 - ;; -} -{ .mmi - ld8.fill r3=[r3] // r3 - ld8.fill r2=[r2] // r2 - nop 0 - ;; -} - - ld8.fill sp=[r31],16 // sp - ld8 r17=[r30],16 // unat - ;; - ld8 r29=[r31],16 // rp - ld8 r18=[r30],16 // pr - ;; - ld8 r28=[r31],16 // pfs - ld8 r20=[r30],24 // bspstore - mov rp=r29 - ;; - ld8 r21=[r31],24 // rnat - mov ar.pfs=r28 - ;; - ld8.fill r26=[r30],16 // tp - ld8 r22=[r31],16 // rsc - ;; - -{ .mmi - ld8 r23=[r30],16 // fpsr - ld8 r24=[r31],16 // psr - extr.u r28=r20,61,3 - ;; -} -{ .mmi - ld8.fill r1=[r30],16 // gp - ld8 r27=[r31],16 // ndirty - cmp.le p14,p15=IA64_VM_MINKERN_REGION,r28 - ;; -} -{ .mmi - ld8 r25=[r30] // cfm - ld8 r19=[r31] // ip - nop 0 - ;; -} -{ .mii - // Switch register stack - alloc r30=ar.pfs,0,0,0,0 // discard current frame - shl r31=r27,16 // value for ar.rsc -(p15) mov r13=r26 - ;; -} - // The loadrs can fault if the backing store is not currently - // mapped. We assured forward progress by getting everything we - // need from the trapframe so that we don't care if the CPU - // purges that translation when it needs to insert a new one for - // the backing store. -{ .mmi - mov ar.rsc=r31 // setup for loadrs - mov ar.k7=r16 - addl r29=NTLBRT_RESTORE,r0 // 22-bit restart token - ;; -} - - ssm psr.dt - ;; - srlz.d - mov r16 = r25 - -exception_restore_restart: -{ .mmi - mov r30=ar.bspstore - ;; - loadrs // load user regs - mov r29=0 // Clobber restart token - ;; -} -{ .mmi - mov r31=ar.bspstore - ;; - mov ar.bspstore=r20 - dep r31=0,r31,0,13 // 8KB aligned - ;; -} -{ .mmi - mov cr.ifs=r16 - mov ar.k6=r31 - mov pr=r18,0x1ffff - ;; -} -{ .mmi - mov cr.iip=r19 - mov ar.unat=r17 - nop 0 - ;; -} -{ .mmi - mov cr.ipsr=r24 - mov ar.rnat=r21 - nop 0 - ;; -} -{ .mmb - mov ar.rsc=r22 - mov ar.fpsr=r23 - rfi - ;; -} -END(exception_restore) - -/* - * Call exception_save_regs to preserve the interrupted state in a - * trapframe. Note that we don't use a call instruction because we - * must be careful not to lose track of the RSE state. We then call - * trap() with the value of _n_ as an argument to handle the - * exception. We arrange for trap() to return to exception_restore - * which will restore the interrupted state before executing an rfi to - * resume it. - */ -#define CALL(_func_, _n_, _ifa_) \ -{ .mib ; \ - mov r17=_ifa_ ; \ - mov r16=ip ; \ - br.sptk exception_save ;; \ -} ; \ -{ .mmi ; \ - alloc r15=ar.pfs,0,0,2,0 ;; \ -(p11) ssm psr.i ; \ - mov out0=_n_ ;; \ -} ; \ -{ .mib ; \ -(p11) srlz.d ; \ - add out1=16,sp ; \ - br.call.sptk rp=_func_ ;; \ -} ; \ -{ .mib ; \ - nop 0 ; \ - nop 0 ; \ - br.sptk exception_restore ;; \ -} - -#define IVT_ENTRY(name, offset) \ - .org ia64_vector_table + offset; \ - .global ivt_##name; \ - .proc ivt_##name; \ - .prologue; \ - .unwabi @svr4, 'I'; \ - .save rp, r0; \ - .body; \ -ivt_##name: \ - XTRACE_HOOK(offset) - -#define IVT_END(name) \ - .endp ivt_##name - -#ifdef COMPAT_FREEBSD32 -#define IA32_TRAP ia32_trap -#else -#define IA32_TRAP trap -#endif - -/* - * The IA64 Interrupt Vector Table (IVT) contains 20 slots with 64 - * bundles per vector and 48 slots with 16 bundles per vector. - */ - - .section .ivt, "ax" - - .align 32768 - .global ia64_vector_table - .size ia64_vector_table, 32768 -ia64_vector_table: - -IVT_ENTRY(VHPT_Translation, 0x0000) - CALL(trap, 0, cr.ifa) -IVT_END(VHPT_Translation) - -IVT_ENTRY(Instruction_TLB, 0x0400) - mov r16=cr.ifa - mov r17=pr - ;; - thash r18=r16 - ttag r19=r16 - ;; - add r21=16,r18 // tag - add r20=24,r18 // collision chain - ;; - ld8 r21=[r21] // check VHPT tag - ld8 r20=[r20] // bucket head - ;; - cmp.ne p15,p0=r21,r19 -(p15) br.dpnt.few 1f - ;; - ld8 r21=[r18] // read pte - ;; - itc.i r21 // insert pte - mov pr=r17,0x1ffff - ;; - rfi // done - ;; -1: rsm psr.dt // turn off data translations - dep r20=0,r20,61,3 // convert vhpt ptr to physical - ;; - srlz.d // serialize - ld8 r20=[r20] // first entry - ;; -2: cmp.eq p15,p0=r0,r20 // done? -(p15) br.cond.spnt.few 9f // bail if done - ;; - add r21=16,r20 // tag location - ;; - ld8 r21=[r21] // read tag - ;; - cmp.ne p15,p0=r21,r19 // compare tags -(p15) br.cond.sptk.few 3f // if not, read next in chain - ;; - ld8 r21=[r20] // read pte - mov r22=PTE_ACCESSED - ;; - or r21=r21,r22 - ;; - st8 [r20]=r21,8 - ;; - ld8 r22=[r20] // read rest of pte - ;; - dep r18=0,r18,61,3 // convert vhpt ptr to physical - ;; - add r20=16,r18 // address of tag - ;; - ld8.acq r23=[r20] // read old tag - ;; - dep r23=-1,r23,63,1 // set ti bit - ;; - st8.rel [r20]=r23 // store old tag + ti - ;; - mf // make sure everyone sees - ;; - st8 [r18]=r21,8 // store pte - ;; - st8 [r18]=r22,8 - ;; - st8.rel [r18]=r19 // store new tag - ;; - itc.i r21 // and place in TLB - ssm psr.dt - ;; - srlz.d - mov pr=r17,0x1ffff // restore predicates - rfi - ;; -3: add r20=24,r20 // next in chain - ;; - ld8 r20=[r20] // read chain - br.sptk 2b // loop - ;; -9: ssm psr.dt - mov pr=r17,0x1ffff // restore predicates - ;; - srlz.d - ;; - CALL(trap, 20, cr.ifa) // Page Not Present trap -IVT_END(Instruction_TLB) - -IVT_ENTRY(Data_TLB, 0x0800) - mov r16=cr.ifa - mov r17=pr - ;; - thash r18=r16 - ttag r19=r16 - ;; - add r21=16,r18 // tag - add r20=24,r18 // collision chain - ;; - ld8 r21=[r21] // check VHPT tag - ld8 r20=[r20] // bucket head - ;; - cmp.ne p15,p0=r21,r19 -(p15) br.dpnt.few 1f - ;; - ld8 r21=[r18] // read pte - ;; - itc.d r21 // insert pte - mov pr=r17,0x1ffff - ;; - rfi // done - ;; -1: rsm psr.dt // turn off data translations - dep r20=0,r20,61,3 // convert vhpt ptr to physical - ;; - srlz.d // serialize - ld8 r20=[r20] // first entry - ;; -2: cmp.eq p15,p0=r0,r20 // done? -(p15) br.cond.spnt.few 9f // bail if done - ;; - add r21=16,r20 // tag location - ;; - ld8 r21=[r21] // read tag - ;; - cmp.ne p15,p0=r21,r19 // compare tags -(p15) br.cond.sptk.few 3f // if not, read next in chain - ;; - ld8 r21=[r20] // read pte - mov r22=PTE_ACCESSED - ;; - or r21=r21,r22 - ;; - st8 [r20]=r21,8 - ;; - ld8 r22=[r20] // read rest of pte - ;; - dep r18=0,r18,61,3 // convert vhpt ptr to physical - ;; - add r20=16,r18 // address of tag - ;; - ld8.acq r23=[r20] // read old tag - ;; - dep r23=-1,r23,63,1 // set ti bit - ;; - st8.rel [r20]=r23 // store old tag + ti - ;; - mf // make sure everyone sees - ;; - st8 [r18]=r21,8 // store pte - ;; - st8 [r18]=r22,8 - ;; - st8.rel [r18]=r19 // store new tag - ;; - itc.d r21 // and place in TLB - ssm psr.dt - ;; - srlz.d - mov pr=r17,0x1ffff // restore predicates - rfi - ;; -3: add r20=24,r20 // next in chain - ;; - ld8 r20=[r20] // read chain - br.sptk 2b // loop - ;; -9: ssm psr.dt - mov pr=r17,0x1ffff // restore predicates - ;; - srlz.d - ;; - CALL(trap, 20, cr.ifa) // Page Not Present trap -IVT_END(Data_TLB) - -IVT_ENTRY(Alternate_Instruction_TLB, 0x0c00) - mov r16=cr.ifa // where did it happen - mov r18=pr // save predicates - ;; - extr.u r17=r16,61,3 // get region number - mov r19=PTE_PRESENT+PTE_ACCESSED+PTE_DIRTY+PTE_PL_KERN+PTE_AR_RWX - ;; - cmp.eq p13,p0=IA64_PBVM_RR,r17 // RR4? -(p13) br.cond.sptk.few 4f - ;; - cmp.ge p13,p0=5,r17 // RR0-RR5? - cmp.eq p14,p15=7,r17 // RR7? -(p13) br.cond.spnt.few 9f - ;; -(p14) add r19=PTE_MA_WB,r19 -(p15) add r19=PTE_MA_UC,r19 - dep r17=0,r16,50,14 // clear bits above PPN - ;; -1: dep r16=r19,r17,0,12 // put pte bits in 0..11 - ;; - itc.i r16 - mov pr=r18,0x1ffff // restore predicates - ;; - rfi - ;; -4: - add r19=PTE_MA_WB,r19 - movl r17=IA64_PBVM_BASE - ;; - sub r17=r16,r17 - movl r16=IA64_PBVM_PGTBL - ;; - extr.u r17=r17,IA64_PBVM_PAGE_SHIFT,61-IA64_PBVM_PAGE_SHIFT - ;; - shladd r16=r17,3,r16 - ;; - ld8 r17=[r16] - br.sptk 1b - ;; -9: mov pr=r18,0x1ffff // restore predicates - CALL(trap, 3, cr.ifa) -IVT_END(Alternate_Instruction_TLB) - -IVT_ENTRY(Alternate_Data_TLB, 0x1000) - mov r16=cr.ifa // where did it happen - mov r18=pr // save predicates - ;; - extr.u r17=r16,61,3 // get region number - mov r19=PTE_PRESENT+PTE_ACCESSED+PTE_DIRTY+PTE_PL_KERN+PTE_AR_RWX - ;; - cmp.eq p13,p0=IA64_PBVM_RR,r17 // RR4? -(p13) br.cond.sptk.few 4f - ;; - cmp.ge p13,p0=5,r17 // RR0-RR5? - cmp.eq p14,p15=7,r17 // RR7? -(p13) br.cond.spnt.few 9f - ;; -(p14) add r19=PTE_MA_WB,r19 -(p15) add r19=PTE_MA_UC,r19 - dep r17=0,r16,50,14 // clear bits above PPN - ;; -1: dep r16=r19,r17,0,12 // put pte bits in 0..11 - ;; - itc.d r16 - mov pr=r18,0x1ffff // restore predicates - ;; - rfi - ;; -4: - add r19=PTE_MA_WB,r19 - movl r17=IA64_PBVM_BASE - ;; - sub r17=r16,r17 - movl r16=IA64_PBVM_PGTBL - ;; - extr.u r17=r17,IA64_PBVM_PAGE_SHIFT,61-IA64_PBVM_PAGE_SHIFT - ;; - shladd r16=r17,3,r16 - ;; - ld8 r17=[r16] - br.sptk 1b - ;; -9: mov pr=r18,0x1ffff // restore predicates - CALL(trap, 4, cr.ifa) -IVT_END(Alternate_Data_TLB) - -IVT_ENTRY(Data_Nested_TLB, 0x1400) - // See exception_save_restart and exception_restore_restart for the - // contexts that may cause a data nested TLB. We can only use the - // banked general registers and predicates, but don't use: - // p14 & p15 - Set in exception save - // r16 & r17 - Arguments to exception save - // r30 - Faulting address (modulo page size) - // We assume r30 has the virtual addresses that relate to the data - // nested TLB fault. The address does not have to be exact, as long - // as it's in the same page. We use physical addressing to avoid - // double nested faults. Since all virtual addresses we encounter - // here are direct mapped region 7 addresses, we have no problem - // constructing physical addresses. - -{ .mmi - mov cr.ifa=r30 - mov r26=rr[r30] - extr.u r27=r30,61,3 - ;; -} -{ .mii - nop 0 - dep r26=0,r26,0,2 - cmp.eq p12,p13=7,r27 - ;; -} -{ .mii - mov cr.itir=r26 -(p12) dep r28=0,r30,0,12 -(p13) extr.u r28=r30,3*PAGE_SHIFT-8, PAGE_SHIFT-3 // dir L0 index - ;; -} -{ .mlx -(p12) add r28=PTE_PRESENT+PTE_ACCESSED+PTE_DIRTY+PTE_PL_KERN+PTE_AR_RWX+PTE_MA_WB,r28 -(p13) movl r27=ia64_kptdir - ;; -} -{ .mib -(p13) ld8 r27=[r27] -(p13) extr.u r26=r30,2*PAGE_SHIFT-5, PAGE_SHIFT-3 // dir L1 index -(p12) br.cond.spnt.few 1f - ;; -} -{ .mmi - rsm psr.dt - ;; - srlz.d - dep r27=0,r27,61,3 - ;; -} -{ .mmi - shladd r27=r28,3,r27 - ;; - ld8 r27=[r27] // dir L1 page - extr.u r28=r30,PAGE_SHIFT,PAGE_SHIFT-5 // pte index - ;; -} -{ .mii - shladd r27=r26,3,r27 - shl r28=r28,5 - ;; - dep r27=0,r27,61,3 - ;; -} - ld8 r27=[r27] // pte page - ;; - add r27=r28,r27 - ;; - dep r27=0,r27,61,3 - ;; - ld8 r28=[r27] // pte - ;; - or r28=PTE_DIRTY+PTE_ACCESSED,r28 - ;; - st8 [r27]=r28 - ;; - ssm psr.dt - ;; -1: -{ .mmi - itc.d r28 - ;; - addl r26=NTLBRT_SAVE,r0 - addl r27=NTLBRT_RESTORE,r0 - ;; -} -{ .mmi - srlz.d - cmp.eq p12,p0=r29,r26 - cmp.eq p13,p0=r29,r27 - ;; -} -{ .mbb - nop 0 -(p12) br.cond.sptk.few exception_save_restart -(p13) br.cond.sptk.few exception_restore_restart - ;; -} - -{ .mlx - mov r26=ar.bsp - movl r29=kstack - ;; -} -{ .mlx - mov r28=sp - movl r27=kstack_top - ;; -} -{ .mmi - add sp=-16,r27 - ;; - mov r27=ar.bspstore - nop 0 - ;; -} - mov ar.rsc=0 - dep r29=r27,r29,0,9 - ;; - mov ar.bspstore=r29 - ;; - CALL(trap, 5, r30) -IVT_END(Data_Nested_TLB) - -IVT_ENTRY(Instruction_Key_Miss, 0x1800) - CALL(trap, 6, cr.ifa) -IVT_END(Instruction_Key_Miss) - -IVT_ENTRY(Data_Key_Miss, 0x1c00) - CALL(trap, 7, cr.ifa) -IVT_END(Data_Key_Miss) - -IVT_ENTRY(Dirty_Bit, 0x2000) - mov r16=cr.ifa - mov r17=pr - ;; - thash r18=r16 - ;; - ttag r19=r16 - add r20=24,r18 // collision chain - ;; - ld8 r20=[r20] // bucket head - ;; - rsm psr.dt // turn off data translations - dep r20=0,r20,61,3 // convert vhpt ptr to physical - ;; - srlz.d // serialize - ld8 r20=[r20] // first entry - ;; -1: cmp.eq p15,p0=r0,r20 // done? -(p15) br.cond.spnt.few 9f // bail if done - ;; - add r21=16,r20 // tag location - ;; - ld8 r21=[r21] // read tag - ;; - cmp.ne p15,p0=r21,r19 // compare tags -(p15) br.cond.sptk.few 2f // if not, read next in chain - ;; - ld8 r21=[r20] // read pte - mov r22=PTE_DIRTY+PTE_ACCESSED - ;; - or r21=r22,r21 // set dirty & access bit - ;; - st8 [r20]=r21,8 // store back - ;; - ld8 r22=[r20] // read rest of pte - ;; - dep r18=0,r18,61,3 // convert vhpt ptr to physical - ;; - add r20=16,r18 // address of tag - ;; - ld8.acq r23=[r20] // read old tag - ;; - dep r23=-1,r23,63,1 // set ti bit - ;; - st8.rel [r20]=r23 // store old tag + ti - ;; - mf // make sure everyone sees - ;; - st8 [r18]=r21,8 // store pte - ;; - st8 [r18]=r22,8 - ;; - st8.rel [r18]=r19 // store new tag - ;; - itc.d r21 // and place in TLB - ssm psr.dt - ;; - srlz.d - mov pr=r17,0x1ffff // restore predicates - rfi - ;; -2: add r20=24,r20 // next in chain - ;; - ld8 r20=[r20] // read chain - br.sptk 1b // loop - ;; -9: ssm psr.dt - mov pr=r17,0x1ffff // restore predicates - ;; - srlz.d - ;; - CALL(trap, 8, cr.ifa) // die horribly -IVT_END(Dirty_Bit) - -IVT_ENTRY(Instruction_Access_Bit, 0x2400) - mov r16=cr.ifa - mov r17=pr - ;; - thash r18=r16 - ;; - ttag r19=r16 - add r20=24,r18 // collision chain - ;; - ld8 r20=[r20] // bucket head - ;; - rsm psr.dt // turn off data translations - dep r20=0,r20,61,3 // convert vhpt ptr to physical - ;; - srlz.d // serialize - ld8 r20=[r20] // first entry - ;; -1: cmp.eq p15,p0=r0,r20 // done? -(p15) br.cond.spnt.few 9f // bail if done - ;; - add r21=16,r20 // tag location - ;; - ld8 r21=[r21] // read tag - ;; - cmp.ne p15,p0=r21,r19 // compare tags -(p15) br.cond.sptk.few 2f // if not, read next in chain - ;; - ld8 r21=[r20] // read pte - mov r22=PTE_ACCESSED - ;; - or r21=r22,r21 // set accessed bit - ;; - st8 [r20]=r21,8 // store back - ;; - ld8 r22=[r20] // read rest of pte - ;; - dep r18=0,r18,61,3 // convert vhpt ptr to physical - ;; - add r20=16,r18 // address of tag - ;; - ld8.acq r23=[r20] // read old tag - ;; - dep r23=-1,r23,63,1 // set ti bit - ;; - st8.rel [r20]=r23 // store old tag + ti - ;; - mf // make sure everyone sees - ;; - st8 [r18]=r21,8 // store pte - ;; - st8 [r18]=r22,8 - ;; - st8.rel [r18]=r19 // store new tag - ;; - itc.i r21 // and place in TLB - ssm psr.dt - ;; - srlz.d - mov pr=r17,0x1ffff // restore predicates - rfi // walker will retry the access - ;; -2: add r20=24,r20 // next in chain - ;; - ld8 r20=[r20] // read chain - br.sptk 1b // loop - ;; -9: ssm psr.dt - mov pr=r17,0x1ffff // restore predicates - ;; - srlz.d - ;; - CALL(trap, 9, cr.ifa) -IVT_END(Instruction_Access_Bit) - -IVT_ENTRY(Data_Access_Bit, 0x2800) - mov r16=cr.ifa - mov r17=pr - ;; - thash r18=r16 - ;; - ttag r19=r16 - add r20=24,r18 // collision chain - ;; - ld8 r20=[r20] // bucket head - ;; - rsm psr.dt // turn off data translations - dep r20=0,r20,61,3 // convert vhpt ptr to physical - ;; - srlz.d // serialize - ld8 r20=[r20] // first entry - ;; -1: cmp.eq p15,p0=r0,r20 // done? -(p15) br.cond.spnt.few 9f // bail if done - ;; - add r21=16,r20 // tag location - ;; - ld8 r21=[r21] // read tag - ;; - cmp.ne p15,p0=r21,r19 // compare tags -(p15) br.cond.sptk.few 2f // if not, read next in chain - ;; - ld8 r21=[r20] // read pte - mov r22=PTE_ACCESSED - ;; - or r21=r22,r21 // set accessed bit - ;; - st8 [r20]=r21,8 // store back - ;; - ld8 r22=[r20] // read rest of pte - ;; - dep r18=0,r18,61,3 // convert vhpt ptr to physical - ;; - add r20=16,r18 // address of tag - ;; - ld8.acq r23=[r20] // read old tag - ;; - dep r23=-1,r23,63,1 // set ti bit - ;; - st8.rel [r20]=r23 // store old tag + ti - ;; - mf // make sure everyone sees - ;; - st8 [r18]=r21,8 // store pte - ;; - st8 [r18]=r22,8 - ;; - st8.rel [r18]=r19 // store new tag - ;; - itc.d r21 // and place in TLB - ssm psr.dt - ;; - srlz.d - mov pr=r17,0x1ffff // restore predicates - rfi // walker will retry the access - ;; -2: add r20=24,r20 // next in chain - ;; - ld8 r20=[r20] // read chain - br.sptk 1b // loop - ;; -9: ssm psr.dt - mov pr=r17,0x1ffff // restore predicates - ;; - srlz.d - ;; - CALL(trap, 10, cr.ifa) -IVT_END(Data_Access_Bit) - -IVT_ENTRY(Break_Instruction, 0x2c00) -{ .mib - mov r17=cr.iim - mov r16=ip - br.sptk exception_save - ;; -} -{ .mmi - alloc r15=ar.pfs,0,0,2,0 - ;; -(p11) ssm psr.i - mov out0=11 - ;; -} -{ .mmi - flushrs - ;; -(p11) srlz.d - add out1=16,sp -} -{ .mib - nop 0 - nop 0 - br.call.sptk rp=trap - ;; -} -{ .mib - nop 0 - nop 0 - br.sptk exception_restore - ;; -} -IVT_END(Break_Instruction) - -IVT_ENTRY(External_Interrupt, 0x3000) -{ .mib - mov r17=0 - mov r16=ip - br.sptk exception_save - ;; -} -{ .mmi - alloc r15=ar.pfs,0,0,1,0 - nop 0 - nop 0 - ;; -} -{ .mib - add out0=16,sp - nop 0 - br.call.sptk rp=ia64_handle_intr - ;; -} -{ .mib - nop 0 - nop 0 - br.sptk exception_restore - ;; -} -IVT_END(External_Interrupt) - -IVT_ENTRY(Reserved_3400, 0x3400) - CALL(trap, 13, cr.ifa) -IVT_END(Reserved_3400) - -IVT_ENTRY(Reserved_3800, 0x3800) - CALL(trap, 14, cr.ifa) -IVT_END(Reserved_3800) - -IVT_ENTRY(Reserved_3c00, 0x3c00) - CALL(trap, 15, cr.ifa) -IVT_END(Reserved_3c00) - -IVT_ENTRY(Reserved_4000, 0x4000) - CALL(trap, 16, cr.ifa) -IVT_END(Reserved_4000) - -IVT_ENTRY(Reserved_4400, 0x4400) - CALL(trap, 17, cr.ifa) -IVT_END(Reserved_4400) - -IVT_ENTRY(Reserved_4800, 0x4800) - CALL(trap, 18, cr.ifa) -IVT_END(Reserved_4800) - -IVT_ENTRY(Reserved_4c00, 0x4c00) - CALL(trap, 19, cr.ifa) -IVT_END(Reserved_4c00) - -IVT_ENTRY(Page_Not_Present, 0x5000) - CALL(trap, 20, cr.ifa) -IVT_END(Page_Not_Present) - -IVT_ENTRY(Key_Permission, 0x5100) - CALL(trap, 21, cr.ifa) -IVT_END(Key_Permission) - -IVT_ENTRY(Instruction_Access_Rights, 0x5200) - CALL(trap, 22, cr.ifa) -IVT_END(Instruction_Access_Rights) - -IVT_ENTRY(Data_Access_Rights, 0x5300) - CALL(trap, 23, cr.ifa) -IVT_END(Data_Access_Rights) - -IVT_ENTRY(General_Exception, 0x5400) - CALL(trap, 24, cr.ifa) -IVT_END(General_Exception) - -IVT_ENTRY(Disabled_FP_Register, 0x5500) - CALL(trap, 25, cr.ifa) -IVT_END(Disabled_FP_Register) - -IVT_ENTRY(NaT_Consumption, 0x5600) - CALL(trap, 26, cr.ifa) -IVT_END(NaT_Consumption) - -IVT_ENTRY(Speculation, 0x5700) - CALL(trap, 27, cr.iim) -IVT_END(Speculation) - -IVT_ENTRY(Reserved_5800, 0x5800) - CALL(trap, 28, cr.ifa) -IVT_END(Reserved_5800) - -IVT_ENTRY(Debug, 0x5900) - CALL(trap, 29, cr.ifa) -IVT_END(Debug) - -IVT_ENTRY(Unaligned_Reference, 0x5a00) - CALL(trap, 30, cr.ifa) -IVT_END(Unaligned_Reference) - -IVT_ENTRY(Unsupported_Data_Reference, 0x5b00) - CALL(trap, 31, cr.ifa) -IVT_END(Unsupported_Data_Reference) - -IVT_ENTRY(Floating_Point_Fault, 0x5c00) - CALL(trap, 32, cr.ifa) -IVT_END(Floating_Point_Fault) - -IVT_ENTRY(Floating_Point_Trap, 0x5d00) - CALL(trap, 33, cr.ifa) -IVT_END(Floating_Point_Trap) - -IVT_ENTRY(Lower_Privilege_Transfer_Trap, 0x5e00) - CALL(trap, 34, cr.ifa) -IVT_END(Lower_Privilege_Transfer_Trap) - -IVT_ENTRY(Taken_Branch_Trap, 0x5f00) - CALL(trap, 35, cr.ifa) -IVT_END(Taken_Branch_Trap) - -IVT_ENTRY(Single_Step_Trap, 0x6000) - CALL(trap, 36, cr.ifa) -IVT_END(Single_Step_Trap) - -IVT_ENTRY(Reserved_6100, 0x6100) - CALL(trap, 37, cr.ifa) -IVT_END(Reserved_6100) - -IVT_ENTRY(Reserved_6200, 0x6200) - CALL(trap, 38, cr.ifa) -IVT_END(Reserved_6200) - -IVT_ENTRY(Reserved_6300, 0x6300) - CALL(trap, 39, cr.ifa) -IVT_END(Reserved_6300) - -IVT_ENTRY(Reserved_6400, 0x6400) - CALL(trap, 40, cr.ifa) -IVT_END(Reserved_6400) - -IVT_ENTRY(Reserved_6500, 0x6500) - CALL(trap, 41, cr.ifa) -IVT_END(Reserved_6500) - -IVT_ENTRY(Reserved_6600, 0x6600) - CALL(trap, 42, cr.ifa) -IVT_END(Reserved_6600) - -IVT_ENTRY(Reserved_6700, 0x6700) - CALL(trap, 43, cr.ifa) -IVT_END(Reserved_6700) - -IVT_ENTRY(Reserved_6800, 0x6800) - CALL(trap, 44, cr.ifa) -IVT_END(Reserved_6800) - -IVT_ENTRY(IA_32_Exception, 0x6900) - CALL(IA32_TRAP, 45, cr.ifa) -IVT_END(IA_32_Exception) - -IVT_ENTRY(IA_32_Intercept, 0x6a00) - CALL(IA32_TRAP, 46, cr.iim) -IVT_END(IA_32_Intercept) - -IVT_ENTRY(IA_32_Interrupt, 0x6b00) - CALL(IA32_TRAP, 47, cr.ifa) -IVT_END(IA_32_Interrupt) - -IVT_ENTRY(Reserved_6c00, 0x6c00) - CALL(trap, 48, cr.ifa) -IVT_END(Reserved_6c00) - -IVT_ENTRY(Reserved_6d00, 0x6d00) - CALL(trap, 49, cr.ifa) -IVT_END(Reserved_6d00) - -IVT_ENTRY(Reserved_6e00, 0x6e00) - CALL(trap, 50, cr.ifa) -IVT_END(Reserved_6e00) - -IVT_ENTRY(Reserved_6f00, 0x6f00) - CALL(trap, 51, cr.ifa) -IVT_END(Reserved_6f00) - -IVT_ENTRY(Reserved_7000, 0x7000) - CALL(trap, 52, cr.ifa) -IVT_END(Reserved_7000) - -IVT_ENTRY(Reserved_7100, 0x7100) - CALL(trap, 53, cr.ifa) -IVT_END(Reserved_7100) - -IVT_ENTRY(Reserved_7200, 0x7200) - CALL(trap, 54, cr.ifa) -IVT_END(Reserved_7200) - -IVT_ENTRY(Reserved_7300, 0x7300) - CALL(trap, 55, cr.ifa) -IVT_END(Reserved_7300) - -IVT_ENTRY(Reserved_7400, 0x7400) - CALL(trap, 56, cr.ifa) -IVT_END(Reserved_7400) - -IVT_ENTRY(Reserved_7500, 0x7500) - CALL(trap, 57, cr.ifa) -IVT_END(Reserved_7500) - -IVT_ENTRY(Reserved_7600, 0x7600) - CALL(trap, 58, cr.ifa) -IVT_END(Reserved_7600) - -IVT_ENTRY(Reserved_7700, 0x7700) - CALL(trap, 59, cr.ifa) -IVT_END(Reserved_7700) - -IVT_ENTRY(Reserved_7800, 0x7800) - CALL(trap, 60, cr.ifa) -IVT_END(Reserved_7800) - -IVT_ENTRY(Reserved_7900, 0x7900) - CALL(trap, 61, cr.ifa) -IVT_END(Reserved_7900) - -IVT_ENTRY(Reserved_7a00, 0x7a00) - CALL(trap, 62, cr.ifa) -IVT_END(Reserved_7a00) - -IVT_ENTRY(Reserved_7b00, 0x7b00) - CALL(trap, 63, cr.ifa) -IVT_END(Reserved_7b00) - -IVT_ENTRY(Reserved_7c00, 0x7c00) - CALL(trap, 64, cr.ifa) -IVT_END(Reserved_7c00) - -IVT_ENTRY(Reserved_7d00, 0x7d00) - CALL(trap, 65, cr.ifa) -IVT_END(Reserved_7d00) - -IVT_ENTRY(Reserved_7e00, 0x7e00) - CALL(trap, 66, cr.ifa) -IVT_END(Reserved_7e00) - -IVT_ENTRY(Reserved_7f00, 0x7f00) - CALL(trap, 67, cr.ifa) -IVT_END(Reserved_7f00) diff --git a/sys/ia64/ia64/gdb_machdep.c b/sys/ia64/ia64/gdb_machdep.c deleted file mode 100644 index 54d27d9..0000000 --- a/sys/ia64/ia64/gdb_machdep.c +++ /dev/null @@ -1,187 +0,0 @@ -/*- - * Copyright (c) 2004 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kdb.h> -#include <sys/kernel.h> -#include <sys/proc.h> -#include <sys/signal.h> - -#include <machine/gdb_machdep.h> -#include <machine/md_var.h> -#include <machine/pcb.h> -#include <machine/reg.h> - -#include <gdb/gdb.h> -#include <gdb/gdb_int.h> - -void * -gdb_cpu_getreg(int regnum, size_t *regsz) -{ - static uint64_t synth; - uint64_t cfm; - - *regsz = gdb_cpu_regsz(regnum); - switch (regnum) { - /* Registers 0-127: general registers. */ - case 1: return (&kdb_thrctx->pcb_special.gp); - case 4: return (&kdb_thrctx->pcb_preserved.gr4); - case 5: return (&kdb_thrctx->pcb_preserved.gr5); - case 6: return (&kdb_thrctx->pcb_preserved.gr6); - case 7: return (&kdb_thrctx->pcb_preserved.gr7); - case 12: return (&kdb_thrctx->pcb_special.sp); - case 13: return (&kdb_thrctx->pcb_special.tp); - /* Registers 128-255: floating-point registers. */ - case 130: return (&kdb_thrctx->pcb_preserved_fp.fr2); - case 131: return (&kdb_thrctx->pcb_preserved_fp.fr3); - case 132: return (&kdb_thrctx->pcb_preserved_fp.fr4); - case 133: return (&kdb_thrctx->pcb_preserved_fp.fr5); - case 144: return (&kdb_thrctx->pcb_preserved_fp.fr16); - case 145: return (&kdb_thrctx->pcb_preserved_fp.fr17); - case 146: return (&kdb_thrctx->pcb_preserved_fp.fr18); - case 147: return (&kdb_thrctx->pcb_preserved_fp.fr19); - case 148: return (&kdb_thrctx->pcb_preserved_fp.fr20); - case 149: return (&kdb_thrctx->pcb_preserved_fp.fr21); - case 150: return (&kdb_thrctx->pcb_preserved_fp.fr22); - case 151: return (&kdb_thrctx->pcb_preserved_fp.fr23); - case 152: return (&kdb_thrctx->pcb_preserved_fp.fr24); - case 153: return (&kdb_thrctx->pcb_preserved_fp.fr25); - case 154: return (&kdb_thrctx->pcb_preserved_fp.fr26); - case 155: return (&kdb_thrctx->pcb_preserved_fp.fr27); - case 156: return (&kdb_thrctx->pcb_preserved_fp.fr28); - case 157: return (&kdb_thrctx->pcb_preserved_fp.fr29); - case 158: return (&kdb_thrctx->pcb_preserved_fp.fr30); - case 159: return (&kdb_thrctx->pcb_preserved_fp.fr31); - /* Registers 320-327: branch registers. */ - case 320: - if (kdb_thrctx->pcb_special.__spare == ~0UL) - return (&kdb_thrctx->pcb_special.rp); - break; - case 321: return (&kdb_thrctx->pcb_preserved.br1); - case 322: return (&kdb_thrctx->pcb_preserved.br2); - case 323: return (&kdb_thrctx->pcb_preserved.br3); - case 324: return (&kdb_thrctx->pcb_preserved.br4); - case 325: return (&kdb_thrctx->pcb_preserved.br5); - /* Registers 328-333: misc. other registers. */ - case 330: return (&kdb_thrctx->pcb_special.pr); - case 331: - if (kdb_thrctx->pcb_special.__spare == ~0UL) { - synth = kdb_thrctx->pcb_special.iip; - synth += (kdb_thrctx->pcb_special.psr >> 41) & 3; - return (&synth); - } - return (&kdb_thrctx->pcb_special.rp); - case 333: - if (kdb_thrctx->pcb_special.__spare == ~0UL) - return (&kdb_thrctx->pcb_special.cfm); - return (&kdb_thrctx->pcb_special.pfs); - /* Registers 334-461: application registers. */ - case 350: return (&kdb_thrctx->pcb_special.rsc); - case 351: /* bsp */ - case 352: /* bspstore. */ - synth = kdb_thrctx->pcb_special.bspstore; - if (kdb_thrctx->pcb_special.__spare == ~0UL) { - synth += kdb_thrctx->pcb_special.ndirty; - } else { - cfm = kdb_thrctx->pcb_special.pfs; - synth = ia64_bsp_adjust(synth, - IA64_CFM_SOF(cfm) - IA64_CFM_SOL(cfm)); - } - return (&synth); - case 353: return (&kdb_thrctx->pcb_special.rnat); - case 370: return (&kdb_thrctx->pcb_special.unat); - case 374: return (&kdb_thrctx->pcb_special.fpsr); - case 398: - if (kdb_thrctx->pcb_special.__spare == ~0UL) - return (&kdb_thrctx->pcb_special.pfs); - break; - case 399: return (&kdb_thrctx->pcb_preserved.lc); - } - return (NULL); -} - -void -gdb_cpu_setreg(int regnum, void *val) -{ - - switch (regnum) { - case GDB_REG_PC: break; - } -} - -int -gdb_cpu_signal(int vector, int dummy __unused) -{ - - if (vector == IA64_VEC_BREAK || vector == IA64_VEC_SINGLE_STEP_TRAP) - return (SIGTRAP); - /* Add 100 so GDB won't translate the vector into signal names. */ - return (vector + 100); -} - -int -gdb_cpu_query(void) -{ -#if 0 - uint64_t bspstore, *kstack; -#endif - uintmax_t slot; - - if (!gdb_rx_equal("Part:dirty:read::")) - return (0); - - if (gdb_rx_varhex(&slot) < 0) { - gdb_tx_err(EINVAL); - return (-1); - } - - gdb_tx_err(EINVAL); - return (-1); - -#if 0 - /* slot is unsigned. No need to test for negative values. */ - if (slot >= (kdb_frame->tf_special.ndirty >> 3)) { - return (-1); - } - - /* - * If the trapframe describes a kernel entry, bspstore holds - * the address of the user backing store. Calculate the right - * kernel stack address. See also ptrace_machdep(). - */ - bspstore = kdb_frame->tf_special.bspstore; - kstack = (bspstore >= VM_MAXUSER_ADDRESS) ? (uint64_t*)bspstore : - (uint64_t*)(kdb_thread->td_kstack + (bspstore & 0x1ffUL)); - gdb_tx_begin('\0'); - gdb_tx_mem((void*)(kstack + slot), 8); - gdb_tx_end(); - return (1); -#endif -} diff --git a/sys/ia64/ia64/genassym.c b/sys/ia64/ia64/genassym.c deleted file mode 100644 index 10ba5ab..0000000 --- a/sys/ia64/ia64/genassym.c +++ /dev/null @@ -1,123 +0,0 @@ -/*- - * Copyright (c) 1982, 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, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "opt_compat.h" -#include "opt_kstack_pages.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/assym.h> -#include <sys/proc.h> -#include <sys/bio.h> -#include <sys/buf.h> -#include <sys/errno.h> -#include <sys/proc.h> -#include <sys/mount.h> -#include <sys/socket.h> -#include <sys/resource.h> -#include <sys/resourcevar.h> -#include <sys/ucontext.h> -#include <machine/frame.h> -#include <machine/elf.h> -#include <machine/pal.h> -#include <machine/pcb.h> -#include <sys/vmmeter.h> -#include <vm/vm.h> -#include <vm/vm_param.h> -#include <vm/pmap.h> -#include <vm/vm_map.h> -#include <net/if.h> -#include <netinet/in.h> - -#ifdef COMPAT_FREEBSD32 -ASSYM(COMPAT_FREEBSD32, COMPAT_FREEBSD32); -#endif - -ASSYM(DT_NULL, DT_NULL); -ASSYM(DT_RELA, DT_RELA); -ASSYM(DT_RELAENT, DT_RELAENT); -ASSYM(DT_RELASZ, DT_RELASZ); -ASSYM(DT_SYMTAB, DT_SYMTAB); -ASSYM(DT_SYMENT, DT_SYMENT); - -ASSYM(EFAULT, EFAULT); -ASSYM(ENAMETOOLONG, ENAMETOOLONG); -ASSYM(ERESTART, ERESTART); - -ASSYM(FRAME_SYSCALL, FRAME_SYSCALL); - -ASSYM(IA64_PBVM_BASE, IA64_PBVM_BASE); -ASSYM(IA64_PBVM_PAGE_SHIFT, IA64_PBVM_PAGE_SHIFT); -ASSYM(IA64_PBVM_PGTBL, IA64_PBVM_PGTBL); -ASSYM(IA64_PBVM_RR, IA64_PBVM_RR); - -ASSYM(IA64_VM_MINKERN_REGION, IA64_VM_MINKERN_REGION); - -ASSYM(KSTACK_PAGES, KSTACK_PAGES); - -ASSYM(MC_PRESERVED, offsetof(mcontext_t, mc_preserved)); -ASSYM(MC_PRESERVED_FP, offsetof(mcontext_t, mc_preserved_fp)); -ASSYM(MC_SPECIAL, offsetof(mcontext_t, mc_special)); -ASSYM(MC_SPECIAL_BSPSTORE, offsetof(mcontext_t, mc_special.bspstore)); -ASSYM(MC_SPECIAL_RNAT, offsetof(mcontext_t, mc_special.rnat)); - -ASSYM(PAGE_SHIFT, PAGE_SHIFT); -ASSYM(PAGE_SIZE, PAGE_SIZE); - -ASSYM(PC_CURRENT_PMAP, offsetof(struct pcpu, pc_md.current_pmap)); -ASSYM(PC_IDLETHREAD, offsetof(struct pcpu, pc_idlethread)); - -ASSYM(PCB_CURRENT_PMAP, offsetof(struct pcb, pcb_current_pmap)); -ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); -ASSYM(PCB_SPECIAL_RP, offsetof(struct pcb, pcb_special.rp)); - -ASSYM(R_IA_64_DIR64LSB, R_IA_64_DIR64LSB); -ASSYM(R_IA_64_FPTR64LSB, R_IA_64_FPTR64LSB); -ASSYM(R_IA_64_NONE, R_IA_64_NONE); -ASSYM(R_IA_64_REL64LSB, R_IA_64_REL64LSB); - -ASSYM(SIZEOF_PCB, sizeof(struct pcb)); -ASSYM(SIZEOF_SPECIAL, sizeof(struct _special)); -ASSYM(SIZEOF_TRAPFRAME, sizeof(struct trapframe)); - -ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); -ASSYM(TD_KSTACK, offsetof(struct thread, td_kstack)); -ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); - -ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); -ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); - -ASSYM(UC_MCONTEXT, offsetof(ucontext_t, uc_mcontext)); - -ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS); diff --git a/sys/ia64/ia64/highfp.c b/sys/ia64/ia64/highfp.c deleted file mode 100644 index f18773b..0000000 --- a/sys/ia64/ia64/highfp.c +++ /dev/null @@ -1,179 +0,0 @@ -/*- - * Copyright (c) 2009 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/proc.h> - -#include <machine/frame.h> -#include <machine/md_var.h> -#include <machine/smp.h> - -static struct mtx ia64_highfp_mtx; - -static void -ia64_highfp_init(void *_) -{ - mtx_init(&ia64_highfp_mtx, "High FP lock", NULL, MTX_SPIN); -} -SYSINIT(ia64_highfp_init, SI_SUB_LOCK, SI_ORDER_ANY, ia64_highfp_init, NULL); - -#ifdef SMP -static int -ia64_highfp_ipi(struct pcpu *cpu) -{ - int error; - - ipi_send(cpu, ia64_ipi_highfp); - error = msleep_spin(&cpu->pc_fpcurthread, &ia64_highfp_mtx, - "High FP", 0); - return (error); -} -#endif - -int -ia64_highfp_drop(struct thread *td) -{ - struct pcb *pcb; - struct pcpu *cpu; - - pcb = td->td_pcb; - - mtx_lock_spin(&ia64_highfp_mtx); - cpu = pcb->pcb_fpcpu; - if (cpu != NULL) { - KASSERT(cpu->pc_fpcurthread == td, - ("cpu->pc_fpcurthread != td")); - td->td_frame->tf_special.psr |= IA64_PSR_DFH; - pcb->pcb_fpcpu = NULL; - cpu->pc_fpcurthread = NULL; - } - mtx_unlock_spin(&ia64_highfp_mtx); - - return ((cpu != NULL) ? 1 : 0); -} - -int -ia64_highfp_enable(struct thread *td, struct trapframe *tf) -{ - struct pcb *pcb; - struct pcpu *cpu; - struct thread *td1; - - pcb = td->td_pcb; - - mtx_lock_spin(&ia64_highfp_mtx); - cpu = pcb->pcb_fpcpu; -#ifdef SMP - if (cpu != NULL && cpu != pcpup) { - KASSERT(cpu->pc_fpcurthread == td, - ("cpu->pc_fpcurthread != td")); - ia64_highfp_ipi(cpu); - } -#endif - td1 = PCPU_GET(fpcurthread); - if (td1 != NULL && td1 != td) { - KASSERT(td1->td_pcb->pcb_fpcpu == pcpup, - ("td1->td_pcb->pcb_fpcpu != pcpup")); - save_high_fp(&td1->td_pcb->pcb_high_fp); - td1->td_frame->tf_special.psr |= IA64_PSR_DFH; - td1->td_pcb->pcb_fpcpu = NULL; - PCPU_SET(fpcurthread, NULL); - td1 = NULL; - } - if (td1 == NULL) { - KASSERT(pcb->pcb_fpcpu == NULL, ("pcb->pcb_fpcpu != NULL")); - KASSERT(PCPU_GET(fpcurthread) == NULL, - ("PCPU_GET(fpcurthread) != NULL")); - restore_high_fp(&pcb->pcb_high_fp); - PCPU_SET(fpcurthread, td); - pcb->pcb_fpcpu = pcpup; - tf->tf_special.psr &= ~IA64_PSR_MFH; - } - tf->tf_special.psr &= ~IA64_PSR_DFH; - mtx_unlock_spin(&ia64_highfp_mtx); - - return ((td1 != NULL) ? 1 : 0); -} - -int -ia64_highfp_save(struct thread *td) -{ - struct pcb *pcb; - struct pcpu *cpu; - - pcb = td->td_pcb; - - mtx_lock_spin(&ia64_highfp_mtx); - cpu = pcb->pcb_fpcpu; -#ifdef SMP - if (cpu != NULL && cpu != pcpup) { - KASSERT(cpu->pc_fpcurthread == td, - ("cpu->pc_fpcurthread != td")); - ia64_highfp_ipi(cpu); - } else -#endif - if (cpu != NULL) { - KASSERT(cpu->pc_fpcurthread == td, - ("cpu->pc_fpcurthread != td")); - save_high_fp(&pcb->pcb_high_fp); - td->td_frame->tf_special.psr |= IA64_PSR_DFH; - pcb->pcb_fpcpu = NULL; - cpu->pc_fpcurthread = NULL; - } - mtx_unlock_spin(&ia64_highfp_mtx); - - return ((cpu != NULL) ? 1 : 0); -} - -#ifdef SMP -int -ia64_highfp_save_ipi(void) -{ - struct thread *td; - - mtx_lock_spin(&ia64_highfp_mtx); - td = PCPU_GET(fpcurthread); - if (td != NULL) { - KASSERT(td->td_pcb->pcb_fpcpu == pcpup, - ("td->td_pcb->pcb_fpcpu != pcpup")); - save_high_fp(&td->td_pcb->pcb_high_fp); - td->td_frame->tf_special.psr |= IA64_PSR_DFH; - td->td_pcb->pcb_fpcpu = NULL; - PCPU_SET(fpcurthread, NULL); - } - mtx_unlock_spin(&ia64_highfp_mtx); - wakeup(&PCPU_GET(fpcurthread)); - - return ((td != NULL) ? 1 : 0); -} -#endif diff --git a/sys/ia64/ia64/in_cksum.c b/sys/ia64/ia64/in_cksum.c deleted file mode 100644 index 6c9959f..0000000 --- a/sys/ia64/ia64/in_cksum.c +++ /dev/null @@ -1,241 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: in_cksum.c,v 1.7 1997/09/02 13:18:15 thorpej Exp $ */ - -/*- - * Copyright (c) 1988, 1992, 1993 - * The Regents of the University of California. All rights reserved. - * Copyright (c) 1996 - * Matt Thomas <matt@3am-software.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)in_cksum.c 8.1 (Berkeley) 6/10/93 - */ - -#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ - -#include <sys/param.h> -#include <sys/mbuf.h> -#include <sys/systm.h> -#include <netinet/in_systm.h> -#include <netinet/in.h> -#include <netinet/ip.h> -#include <machine/in_cksum.h> - -/* - * Checksum routine for Internet Protocol family headers - * (Portable Alpha version). - * - * This routine is very heavily used in the network - * code and should be modified for each CPU to be as fast as possible. - */ - -#define ADDCARRY(x) (x > 65535 ? x -= 65535 : x) -#define REDUCE32 \ - { \ - q_util.q = sum; \ - sum = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ - } -#define REDUCE16 \ - { \ - q_util.q = sum; \ - l_util.l = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ - sum = l_util.s[0] + l_util.s[1]; \ - ADDCARRY(sum); \ - } - -static const u_int32_t in_masks[] = { - /*0 bytes*/ /*1 byte*/ /*2 bytes*/ /*3 bytes*/ - 0x00000000, 0x000000FF, 0x0000FFFF, 0x00FFFFFF, /* offset 0 */ - 0x00000000, 0x0000FF00, 0x00FFFF00, 0xFFFFFF00, /* offset 1 */ - 0x00000000, 0x00FF0000, 0xFFFF0000, 0xFFFF0000, /* offset 2 */ - 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, /* offset 3 */ -}; - -union l_util { - u_int16_t s[2]; - u_int32_t l; -}; -union q_util { - u_int16_t s[4]; - u_int32_t l[2]; - u_int64_t q; -}; - -static u_int64_t -in_cksumdata(const void *buf, int len) -{ - const u_int32_t *lw = (const u_int32_t *) buf; - u_int64_t sum = 0; - u_int64_t prefilled; - int offset; - union q_util q_util; - - if ((3 & (long) lw) == 0 && len == 20) { - sum = (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3] + lw[4]; - REDUCE32; - return sum; - } - - if ((offset = 3 & (long) lw) != 0) { - const u_int32_t *masks = in_masks + (offset << 2); - lw = (u_int32_t *) (((long) lw) - offset); - sum = *lw++ & masks[len >= 3 ? 3 : len]; - len -= 4 - offset; - if (len <= 0) { - REDUCE32; - return sum; - } - } -#if 0 - /* - * Force to cache line boundary. - */ - offset = 32 - (0x1f & (long) lw); - if (offset < 32 && len > offset) { - len -= offset; - if (4 & offset) { - sum += (u_int64_t) lw[0]; - lw += 1; - } - if (8 & offset) { - sum += (u_int64_t) lw[0] + lw[1]; - lw += 2; - } - if (16 & offset) { - sum += (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3]; - lw += 4; - } - } -#endif - /* - * access prefilling to start load of next cache line. - * then add current cache line - * save result of prefilling for loop iteration. - */ - prefilled = lw[0]; - while ((len -= 32) >= 4) { - u_int64_t prefilling = lw[8]; - sum += prefilled + lw[1] + lw[2] + lw[3] - + lw[4] + lw[5] + lw[6] + lw[7]; - lw += 8; - prefilled = prefilling; - } - if (len >= 0) { - sum += prefilled + lw[1] + lw[2] + lw[3] - + lw[4] + lw[5] + lw[6] + lw[7]; - lw += 8; - } else { - len += 32; - } - while ((len -= 16) >= 0) { - sum += (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3]; - lw += 4; - } - len += 16; - while ((len -= 4) >= 0) { - sum += (u_int64_t) *lw++; - } - len += 4; - if (len > 0) - sum += (u_int64_t) (in_masks[len] & *lw); - REDUCE32; - return sum; -} - -u_short -in_addword(u_short a, u_short b) -{ - u_int64_t sum = a + b; - - ADDCARRY(sum); - return (sum); -} - -u_short -in_pseudo(u_int32_t a, u_int32_t b, u_int32_t c) -{ - u_int64_t sum; - union q_util q_util; - union l_util l_util; - - sum = (u_int64_t) a + b + c; - REDUCE16; - return (sum); -} - -u_short -in_cksum_skip(struct mbuf *m, int len, int skip) -{ - u_int64_t sum = 0; - int mlen = 0; - int clen = 0; - caddr_t addr; - union q_util q_util; - union l_util l_util; - - len -= skip; - for (; skip && m; m = m->m_next) { - if (m->m_len > skip) { - mlen = m->m_len - skip; - addr = mtod(m, caddr_t) + skip; - goto skip_start; - } else { - skip -= m->m_len; - } - } - - for (; m && len; m = m->m_next) { - if (m->m_len == 0) - continue; - mlen = m->m_len; - addr = mtod(m, caddr_t); -skip_start: - if (len < mlen) - mlen = len; - if ((clen ^ (long) addr) & 1) - sum += in_cksumdata(addr, mlen) << 8; - else - sum += in_cksumdata(addr, mlen); - - clen += mlen; - len -= mlen; - } - REDUCE16; - return (~sum & 0xffff); -} - -u_int in_cksum_hdr(const struct ip *ip) -{ - u_int64_t sum = in_cksumdata(ip, sizeof(struct ip)); - union q_util q_util; - union l_util l_util; - REDUCE16; - return (~sum & 0xffff); -} diff --git a/sys/ia64/ia64/interrupt.c b/sys/ia64/ia64/interrupt.c deleted file mode 100644 index 2d80c09..0000000 --- a/sys/ia64/ia64/interrupt.c +++ /dev/null @@ -1,411 +0,0 @@ -/*- - * Copyright (c) 2010-2011 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "opt_ddb.h" -#include "opt_xtrace.h" - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/proc.h> -#include <sys/vmmeter.h> -#include <sys/bus.h> -#include <sys/interrupt.h> -#include <sys/malloc.h> -#include <sys/ktr.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/sched.h> -#include <sys/smp.h> -#include <sys/sysctl.h> -#include <sys/syslog.h> - -#include <machine/cpu.h> -#include <machine/fpu.h> -#include <machine/frame.h> -#include <machine/intr.h> -#include <machine/intrcnt.h> -#include <machine/md_var.h> -#include <machine/pcb.h> -#include <machine/reg.h> -#include <machine/smp.h> - -#ifdef DDB -#include <ddb/ddb.h> -#endif - -struct ia64_intr { - struct intr_event *event; /* interrupt event */ - volatile long *cntp; /* interrupt counter */ - struct sapic *sapic; - u_int irq; -}; - -ia64_ihtype *ia64_handler[IA64_NXIVS]; - -static enum ia64_xiv_use ia64_xiv[IA64_NXIVS]; -static struct ia64_intr *ia64_intrs[IA64_NXIVS]; - -static ia64_ihtype ia64_ih_invalid; -static ia64_ihtype ia64_ih_irq; - -void -ia64_xiv_init(void) -{ - u_int xiv; - - for (xiv = 0; xiv < IA64_NXIVS; xiv++) { - ia64_handler[xiv] = ia64_ih_invalid; - ia64_xiv[xiv] = IA64_XIV_FREE; - ia64_intrs[xiv] = NULL; - } - (void)ia64_xiv_reserve(15, IA64_XIV_ARCH, NULL); -} - -int -ia64_xiv_free(u_int xiv, enum ia64_xiv_use what) -{ - - if (xiv >= IA64_NXIVS) - return (EINVAL); - if (what == IA64_XIV_FREE || what == IA64_XIV_ARCH) - return (EINVAL); - if (ia64_xiv[xiv] != what) - return (ENXIO); - ia64_xiv[xiv] = IA64_XIV_FREE; - ia64_handler[xiv] = ia64_ih_invalid; - return (0); -} - -int -ia64_xiv_reserve(u_int xiv, enum ia64_xiv_use what, ia64_ihtype ih) -{ - - if (xiv >= IA64_NXIVS) - return (EINVAL); - if (what == IA64_XIV_FREE) - return (EINVAL); - if (ia64_xiv[xiv] != IA64_XIV_FREE) - return (EBUSY); - ia64_xiv[xiv] = what; - ia64_handler[xiv] = (ih == NULL) ? ia64_ih_invalid: ih; - if (bootverbose) - printf("XIV %u: use=%u, IH=%p\n", xiv, what, ih); - return (0); -} - -u_int -ia64_xiv_alloc(u_int prio, enum ia64_xiv_use what, ia64_ihtype ih) -{ - u_int hwprio; - u_int xiv0, xiv; - - hwprio = prio >> 2; - if (hwprio > IA64_MAX_HWPRIO) - hwprio = IA64_MAX_HWPRIO; - - xiv0 = IA64_NXIVS - (hwprio + 1) * 16; - - KASSERT(xiv0 >= IA64_MIN_XIV, ("%s: min XIV", __func__)); - KASSERT(xiv0 < IA64_NXIVS, ("%s: max XIV", __func__)); - - xiv = xiv0; - while (xiv < IA64_NXIVS && ia64_xiv_reserve(xiv, what, ih)) - xiv++; - - if (xiv < IA64_NXIVS) - return (xiv); - - xiv = xiv0; - while (xiv >= IA64_MIN_XIV && ia64_xiv_reserve(xiv, what, ih)) - xiv--; - - return ((xiv >= IA64_MIN_XIV) ? xiv : 0); -} - -static void -ia64_intr_eoi(void *arg) -{ - u_int xiv = (uintptr_t)arg; - struct ia64_intr *i; - - i = ia64_intrs[xiv]; - KASSERT(i != NULL, ("%s", __func__)); - sapic_eoi(i->sapic, xiv); -} - -static void -ia64_intr_mask(void *arg) -{ - u_int xiv = (uintptr_t)arg; - struct ia64_intr *i; - - i = ia64_intrs[xiv]; - KASSERT(i != NULL, ("%s", __func__)); - sapic_mask(i->sapic, i->irq); - sapic_eoi(i->sapic, xiv); -} - -static void -ia64_intr_unmask(void *arg) -{ - u_int xiv = (uintptr_t)arg; - struct ia64_intr *i; - - i = ia64_intrs[xiv]; - KASSERT(i != NULL, ("%s", __func__)); - sapic_unmask(i->sapic, i->irq); -} - -int -ia64_setup_intr(const char *name, int irq, driver_filter_t filter, - driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep) -{ - struct ia64_intr *i; - struct sapic *sa; - char *intrname; - u_int prio, xiv; - int error; - - prio = intr_priority(flags); - if (prio > PRI_MAX_ITHD) - return (EINVAL); - - /* XXX lock */ - - /* Get the I/O SAPIC and XIV that corresponds to the IRQ. */ - sa = sapic_lookup(irq, &xiv); - if (sa == NULL) { - /* XXX unlock */ - return (EINVAL); - } - - if (xiv == 0) { - /* XXX unlock */ - i = malloc(sizeof(struct ia64_intr), M_DEVBUF, - M_ZERO | M_WAITOK); - /* XXX lock */ - sa = sapic_lookup(irq, &xiv); - KASSERT(sa != NULL, ("sapic_lookup")); - if (xiv != 0) - free(i, M_DEVBUF); - } - - /* - * If the IRQ has no XIV assigned to it yet, assign one based - * on the priority. - */ - if (xiv == 0) { - xiv = ia64_xiv_alloc(prio, IA64_XIV_IRQ, ia64_ih_irq); - if (xiv == 0) { - /* XXX unlock */ - free(i, M_DEVBUF); - return (ENOSPC); - } - - error = intr_event_create(&i->event, (void *)(uintptr_t)xiv, - 0, irq, ia64_intr_mask, ia64_intr_unmask, ia64_intr_eoi, - NULL, "irq%u:", irq); - if (error) { - ia64_xiv_free(xiv, IA64_XIV_IRQ); - /* XXX unlock */ - free(i, M_DEVBUF); - return (error); - } - - i->sapic = sa; - i->irq = irq; - i->cntp = intrcnt + xiv; - ia64_intrs[xiv] = i; - - /* XXX unlock */ - - sapic_enable(sa, irq, xiv); - - if (name != NULL && *name != '\0') { - /* XXX needs abstraction. Too error prone. */ - intrname = intrnames + xiv * INTRNAME_LEN; - memset(intrname, ' ', INTRNAME_LEN - 1); - bcopy(name, intrname, strlen(name)); - } - } else { - i = ia64_intrs[xiv]; - /* XXX unlock */ - } - - KASSERT(i != NULL, ("XIV mapping bug")); - - error = intr_event_add_handler(i->event, name, filter, handler, arg, - prio, flags, cookiep); - return (error); -} - -int -ia64_teardown_intr(void *cookie) -{ - - return (intr_event_remove_handler(cookie)); -} - -void -ia64_bind_intr(void) -{ - struct ia64_intr *i; - struct pcpu *pc; - u_int xiv; - int cpu; - - cpu = MAXCPU; - for (xiv = IA64_NXIVS - 1; xiv >= IA64_MIN_XIV; xiv--) { - if (ia64_xiv[xiv] != IA64_XIV_IRQ) - continue; - i = ia64_intrs[xiv]; - do { - cpu = (cpu == 0) ? MAXCPU - 1 : cpu - 1; - pc = cpuid_to_pcpu[cpu]; - } while (pc == NULL || !pc->pc_md.awake); - sapic_bind_intr(i->irq, pc); - } -} - -/* - * Interrupt handlers. - */ - -void -ia64_handle_intr(struct trapframe *tf) -{ - struct thread *td; - u_int xiv; - - td = curthread; - ia64_set_fpsr(IA64_FPSR_DEFAULT); - -#ifdef XTRACE - ia64_xtrace_save(); -#endif - - PCPU_INC(cnt.v_intr); - - xiv = ia64_get_ivr(); - ia64_srlz_d(); - if (xiv == 15) { - PCPU_INC(md.stats.pcs_nstrays); - goto out; - } - - critical_enter(); - do { - CTR3(KTR_INTR, "INTR: XIV=%u, #%u: frame=%p", xiv, - PCPU_GET(cnt.v_intr), tf); - if (!(ia64_handler[xiv])(td, xiv, tf)) { - ia64_set_eoi(0); - ia64_srlz_d(); - } - xiv = ia64_get_ivr(); - ia64_srlz_d(); - } while (xiv != 15); - critical_exit(); - - out: - if (TRAPF_USERMODE(tf)) { - while (td->td_flags & (TDF_ASTPENDING|TDF_NEEDRESCHED)) { - ia64_enable_intr(); - ast(tf); - ia64_disable_intr(); - } - } -} - -static u_int -ia64_ih_invalid(struct thread *td, u_int xiv, struct trapframe *tf) -{ - - panic("invalid XIV: %u", xiv); - return (0); -} - -static u_int -ia64_ih_irq(struct thread *td, u_int xiv, struct trapframe *tf) -{ - struct ia64_intr *i; - struct intr_event *ie; /* our interrupt event */ - - PCPU_INC(md.stats.pcs_nhwints); - - /* Find the interrupt thread for this XIV. */ - i = ia64_intrs[xiv]; - KASSERT(i != NULL, ("%s: unassigned XIV", __func__)); - - (*i->cntp)++; - - ie = i->event; - KASSERT(ie != NULL, ("%s: interrupt without event", __func__)); - - if (intr_event_handle(ie, tf) != 0) { - ia64_intr_mask((void *)(uintptr_t)xiv); - log(LOG_ERR, "stray irq%u\n", i->irq); - } - - return (0); -} - -#ifdef DDB - -static void -db_print_xiv(u_int xiv, int always) -{ - struct ia64_intr *i; - - i = ia64_intrs[xiv]; - if (i != NULL) { - db_printf("XIV %u (%p): ", xiv, i); - sapic_print(i->sapic, i->irq); - } else if (always) - db_printf("XIV %u: unassigned\n", xiv); -} - -DB_SHOW_COMMAND(xiv, db_show_xiv) -{ - u_int xiv; - - if (have_addr) { - xiv = ((addr >> 4) % 16) * 10 + (addr % 16); - if (xiv >= IA64_NXIVS) - db_printf("error: XIV %u not in range [0..%u]\n", - xiv, IA64_NXIVS - 1); - else - db_print_xiv(xiv, 1); - } else { - for (xiv = 0; xiv < IA64_NXIVS; xiv++) - db_print_xiv(xiv, 0); - } -} - -#endif diff --git a/sys/ia64/ia64/iodev_machdep.c b/sys/ia64/ia64/iodev_machdep.c deleted file mode 100644 index a5aaf9f..0000000 --- a/sys/ia64/ia64/iodev_machdep.c +++ /dev/null @@ -1,208 +0,0 @@ -/*- - * Copyright (c) 2010 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/conf.h> -#include <sys/efi.h> -#include <sys/fcntl.h> -#include <sys/ioccom.h> -#include <sys/malloc.h> -#include <sys/priv.h> -#include <sys/proc.h> -#include <sys/systm.h> - -#include <machine/bus.h> -#include <machine/iodev.h> - -static int iodev_efivar_getvar(struct iodev_efivar_req *req); -static int iodev_efivar_nextname(struct iodev_efivar_req *req); -static int iodev_efivar_setvar(struct iodev_efivar_req *req); - -/* ARGSUSED */ -int -iodev_open(struct thread *td __unused) -{ - - return (0); -} - -/* ARGSUSED */ -int -iodev_close(struct thread *td __unused) -{ - - return (0); -} - -int -iodev_ioctl(u_long cmd, caddr_t data) -{ - struct iodev_efivar_req *efivar_req; - int error; - - switch (cmd) { - case IODEV_EFIVAR: - efivar_req = (struct iodev_efivar_req *)data; - efivar_req->result = 0; /* So it's well-defined */ - switch (efivar_req->access) { - case IODEV_EFIVAR_GETVAR: - error = iodev_efivar_getvar(efivar_req); - break; - case IODEV_EFIVAR_NEXTNAME: - error = iodev_efivar_nextname(efivar_req); - break; - case IODEV_EFIVAR_SETVAR: - error = iodev_efivar_setvar(efivar_req); - break; - default: - error = EINVAL; - break; - } - break; - default: - error = ENOIOCTL; - } - - return (error); -} - -static int -iodev_efivar_getvar(struct iodev_efivar_req *req) -{ - void *data; - efi_char *name; - int error; - - if ((req->namesize & 1) != 0 || req->namesize < 4) - return (EINVAL); - if (req->datasize == 0) - return (EINVAL); - - /* - * Pre-zero the allocated memory and don't copy the last 2 bytes - * of the name. That should be the closing nul character (ucs-2) - * and if not, then we ensured a nul-terminating string. This is - * to protect the firmware and thus ourselves. - */ - name = malloc(req->namesize, M_TEMP, M_WAITOK | M_ZERO); - error = copyin(req->name, name, req->namesize - 2); - if (error) { - free(name, M_TEMP); - return (error); - } - - data = malloc(req->datasize, M_TEMP, M_WAITOK); - error = efi_var_get(name, &req->vendor, &req->attrib, &req->datasize, - data); - if (error == EOVERFLOW || error == ENOENT) { - req->result = error; - error = 0; - } - if (!error && !req->result) - error = copyout(data, req->data, req->datasize); - - free(data, M_TEMP); - free(name, M_TEMP); - return (error); -} - -static int -iodev_efivar_nextname(struct iodev_efivar_req *req) -{ - efi_char *name; - int error; - - /* Enforce a reasonable minimum size of the name buffer. */ - if (req->namesize < 4) - return (EINVAL); - - name = malloc(req->namesize, M_TEMP, M_WAITOK); - error = copyin(req->name, name, req->namesize); - if (error) { - free(name, M_TEMP); - return (error); - } - - error = efi_var_nextname(&req->namesize, name, &req->vendor); - if (error == EOVERFLOW || error == ENOENT) { - req->result = error; - error = 0; - } - if (!error && !req->result) - error = copyout(name, req->name, req->namesize); - - free(name, M_TEMP); - return (error); -} - -static int -iodev_efivar_setvar(struct iodev_efivar_req *req) -{ - void *data; - efi_char *name; - int error; - - if ((req->namesize & 1) != 0 || req->namesize < 4) - return (EINVAL); - - /* - * Pre-zero the allocated memory and don't copy the last 2 bytes - * of the name. That should be the closing nul character (ucs-2) - * and if not, then we ensured a nul-terminating string. This is - * to protect the firmware and thus ourselves. - */ - name = malloc(req->namesize, M_TEMP, M_WAITOK | M_ZERO); - error = copyin(req->name, name, req->namesize - 2); - if (error) { - free(name, M_TEMP); - return (error); - } - - if (req->datasize) { - data = malloc(req->datasize, M_TEMP, M_WAITOK); - error = copyin(req->data, data, req->datasize); - if (error) { - free(data, M_TEMP); - free(name, M_TEMP); - return (error); - } - } else - data = NULL; - - error = efi_var_set(name, &req->vendor, req->attrib, req->datasize, - data); - if (error == EAGAIN || error == ENOENT) { - req->result = error; - error = 0; - } - - free(data, M_TEMP); - free(name, M_TEMP); - return (error); -} diff --git a/sys/ia64/ia64/locore.S b/sys/ia64/ia64/locore.S deleted file mode 100644 index f79ca68..0000000 --- a/sys/ia64/ia64/locore.S +++ /dev/null @@ -1,361 +0,0 @@ -/*- - * Copyright (c) 2001-2011 Marcel Moolenaar - * Copyright (c) 1998 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <machine/asm.h> -#include <machine/ia64_cpu.h> -#include <machine/intrcnt.h> -#include <machine/pte.h> -#include <assym.s> - -/* - * The Altix 350 needs more than the architected 16KB (8KB for stack and - * 8KB for RSE backing store) when calling EFI to setup virtual mode. - */ -#define FW_STACK_SIZE 3*PAGE_SIZE - - .section .ivt.data, "aw" - .align PAGE_SIZE - .global kstack -kstack: .space FW_STACK_SIZE - .global kstack_top -kstack_top: - - .text - -/* - * Not really a leaf but we can't return. - * The EFI loader passes the physical address of the bootinfo block in - * register r8. - */ -ENTRY_NOPROFILE(__start, 1) - .prologue - .save rp,r0 - .body -{ .mlx - mov ar.rsc=0 - movl r16=ia64_vector_table // set up IVT early - ;; -} -{ .mlx - mov cr.iva=r16 - movl r16=kstack - ;; -} -{ .mmi - srlz.i - ;; - ssm IA64_PSR_DFH - mov r17=FW_STACK_SIZE-16 - ;; -} -{ .mlx - add sp=r16,r17 // proc0's stack - movl gp=__gp // find kernel globals - ;; -} -{ .mlx - mov ar.bspstore=r16 // switch backing store - movl r16=bootinfo - ;; -} -{ .mmi - st8 [r16]=r8 // save the PA of the bootinfo block - loadrs // invalidate regs - mov r17=IA64_DCR_DEFAULT - ;; -} -{ .mmi - mov cr.dcr=r17 - mov ar.rsc=3 // turn rse back on - nop 0 - ;; -} -{ .mmi - srlz.d - alloc r16=ar.pfs,0,0,1,0 - mov out0=r0 // we are linked at the right address - ;; // we just need to process fptrs -} -{ .mib - nop 0 - nop 0 - br.call.sptk.many rp=_reloc - ;; -} -{ .mib - nop 0 - nop 0 - br.call.sptk.many rp=ia64_init - ;; -} - // We have the new bspstore in r8 and the new sp in r9. - // Switch onto the new stack and call mi_startup(). -{ .mmi - mov ar.rsc = 0 - ;; - mov ar.bspstore = r8 - mov sp = r9 - ;; -} -{ .mmi - loadrs - ;; - mov ar.rsc = 3 - nop 0 - ;; -} -{ .mib - nop 0 - nop 0 - br.call.sptk.many rp=mi_startup - ;; -} - /* NOTREACHED */ -1: br.cond.sptk.few 1b -END(__start) - -/* - * fork_trampoline() - * - * Arrange for a function to be invoked neatly, after a cpu_switch(). - * - * Invokes fork_exit() passing in three arguments: a callout function, an - * argument to the callout, and a trapframe pointer. For child processes - * returning from fork(2), the argument is a pointer to the child process. - * - * The callout function and its argument is in the trapframe in scratch - * registers r2 and r3. - */ -ENTRY(fork_trampoline, 0) - .prologue - .save rp,r0 - .body -{ .mmi - alloc r14=ar.pfs,0,0,3,0 - add r15=32+SIZEOF_SPECIAL+8,sp - add r16=32+SIZEOF_SPECIAL+16,sp - ;; -} -{ .mmi - ld8 out0=[r15] - ld8 out1=[r16] - nop 0 -} -{ .mib - add out2=16,sp - nop 0 - br.call.sptk rp=fork_exit - ;; -} - // If we get back here, it means we're a user space process that's - // the immediate result of fork(2). - .global enter_userland - .type enter_userland, @function -enter_userland: -{ .mib - nop 0 - nop 0 - br.sptk epc_syscall_return - ;; -} -END(fork_trampoline) - -/* - * Create a default interrupt name table. The first entry (vector 0) is - * hardwaired to the clock interrupt. - */ - .data - .align 8 -EXPORT(intrnames) - .ascii "clock" - .fill INTRNAME_LEN - 5 - 1, 1, ' ' - .byte 0 -intr_n = 1 -.rept INTRCNT_COUNT - 1 - .ascii "#" - .byte intr_n / 100 + '0' - .byte (intr_n % 100) / 10 + '0' - .byte intr_n % 10 + '0' - .fill INTRNAME_LEN - 1 - 3 - 1, 1, ' ' - .byte 0 - intr_n = intr_n + 1 -.endr -EXPORT(sintrnames) - data8 INTRCNT_COUNT * INTRNAME_LEN - - .align 8 -EXPORT(intrcnt) - .fill INTRCNT_COUNT, 8, 0 -EXPORT(sintrcnt) - data8 INTRCNT_COUNT * 8 - - .text - // in0: image base -STATIC_ENTRY(_reloc, 1) - alloc loc0=ar.pfs,1,2,0,0 - mov loc1=rp - ;; - movl r15=@gprel(_DYNAMIC) // find _DYNAMIC etc. - movl r2=@gprel(fptr_storage) - movl r3=@gprel(fptr_storage_end) - ;; - add r15=r15,gp // relocate _DYNAMIC etc. - add r2=r2,gp - add r3=r3,gp - ;; -1: ld8 r16=[r15],8 // read r15->d_tag - ;; - ld8 r17=[r15],8 // and r15->d_val - ;; - cmp.eq p6,p0=DT_NULL,r16 // done? -(p6) br.cond.dpnt.few 2f - ;; - cmp.eq p6,p0=DT_RELA,r16 - ;; -(p6) add r18=r17,in0 // found rela section - ;; - cmp.eq p6,p0=DT_RELASZ,r16 - ;; -(p6) mov r19=r17 // found rela size - ;; - cmp.eq p6,p0=DT_SYMTAB,r16 - ;; -(p6) add r20=r17,in0 // found symbol table - ;; -(p6) setf.sig f8=r20 - ;; - cmp.eq p6,p0=DT_SYMENT,r16 - ;; -(p6) setf.sig f9=r17 // found symbol entry size - ;; - cmp.eq p6,p0=DT_RELAENT,r16 - ;; -(p6) mov r22=r17 // found rela entry size - ;; - br.sptk.few 1b - -2: - ld8 r15=[r18],8 // read r_offset - ;; - ld8 r16=[r18],8 // read r_info - add r15=r15,in0 // relocate r_offset - ;; - ld8 r17=[r18],8 // read r_addend - sub r19=r19,r22 // update relasz - - extr.u r23=r16,0,32 // ELF64_R_TYPE(r16) - ;; - cmp.eq p6,p0=R_IA_64_NONE,r23 -(p6) br.cond.dpnt.few 3f - ;; - cmp.eq p6,p0=R_IA_64_REL64LSB,r23 -(p6) br.cond.dptk.few 4f - ;; - - extr.u r16=r16,32,32 // ELF64_R_SYM(r16) - ;; - setf.sig f10=r16 // so we can multiply - ;; - xma.lu f10=f10,f9,f8 // f10=symtab + r_sym*syment - ;; - getf.sig r16=f10 - ;; - add r16=8,r16 // address of st_value - ;; - ld8 r16=[r16] // read symbol value - ;; - add r16=r16,in0 // relocate symbol value - ;; - - cmp.eq p6,p0=R_IA_64_DIR64LSB,r23 -(p6) br.cond.dptk.few 5f - ;; - cmp.eq p6,p0=R_IA_64_FPTR64LSB,r23 -(p6) br.cond.dptk.few 6f - ;; - -3: - cmp.ltu p6,p0=0,r19 // more? -(p6) br.cond.dptk.few 2b // loop - mov r8=0 // success return value - br.cond.sptk.few 9f // done - -4: - add r16=in0,r17 // BD + A - ;; - st8 [r15]=r16 // word64 (LSB) - br.cond.sptk.few 3b - -5: - add r16=r16,r17 // S + A - ;; - st8 [r15]=r16 // word64 (LSB) - br.cond.sptk.few 3b - -6: - movl r17=@gprel(fptr_storage) - ;; - add r17=r17,gp // start of fptrs - ;; -7: cmp.geu p6,p0=r17,r2 // end of fptrs? -(p6) br.cond.dpnt.few 8f // can't find existing fptr - ld8 r20=[r17] // read function from fptr - ;; - cmp.eq p6,p0=r16,r20 // same function? - ;; -(p6) st8 [r15]=r17 // reuse fptr -(p6) br.cond.sptk.few 3b // done - add r17=16,r17 // next fptr - br.cond.sptk.few 7b - -8: // allocate new fptr - mov r8=1 // failure return value - cmp.geu p6,p0=r2,r3 // space left? -(p6) br.cond.dpnt.few 9f // bail out - - st8 [r15]=r2 // install fptr - st8 [r2]=r16,8 // write fptr address - ;; - st8 [r2]=gp,8 // write fptr gp - br.cond.sptk.few 3b - -9: - mov ar.pfs=loc0 - mov rp=loc1 - ;; - br.ret.sptk.few rp - -END(_reloc) - - .data - .align 16 - .global fptr_storage -fptr_storage: - .space 4096*16 // XXX -fptr_storage_end: diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c deleted file mode 100644 index eaa82a8..0000000 --- a/sys/ia64/ia64/machdep.c +++ /dev/null @@ -1,1540 +0,0 @@ -/*- - * Copyright (c) 2003,2004 Marcel Moolenaar - * Copyright (c) 2000,2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_compat.h" -#include "opt_ddb.h" -#include "opt_kstack_pages.h" -#include "opt_sched.h" -#include "opt_xtrace.h" - -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/bio.h> -#include <sys/buf.h> -#include <sys/bus.h> -#include <sys/cons.h> -#include <sys/cpu.h> -#include <sys/efi.h> -#include <sys/eventhandler.h> -#include <sys/exec.h> -#include <sys/imgact.h> -#include <sys/kdb.h> -#include <sys/kernel.h> -#include <sys/linker.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/mbuf.h> -#include <sys/msgbuf.h> -#include <sys/pcpu.h> -#include <sys/ptrace.h> -#include <sys/random.h> -#include <sys/reboot.h> -#include <sys/rwlock.h> -#include <sys/sched.h> -#include <sys/signalvar.h> -#include <sys/syscall.h> -#include <sys/syscallsubr.h> -#include <sys/sysctl.h> -#include <sys/sysproto.h> -#include <sys/ucontext.h> -#include <sys/uio.h> -#include <sys/uuid.h> -#include <sys/vmmeter.h> -#include <sys/vnode.h> - -#include <ddb/ddb.h> - -#include <net/netisr.h> - -#include <vm/vm.h> -#include <vm/vm_extern.h> -#include <vm/vm_kern.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> -#include <vm/vm_object.h> -#include <vm/vm_pager.h> - -#include <machine/bootinfo.h> -#include <machine/cpu.h> -#include <machine/elf.h> -#include <machine/fpu.h> -#include <machine/intr.h> -#include <machine/kdb.h> -#include <machine/mca.h> -#include <machine/md_var.h> -#include <machine/pal.h> -#include <machine/pcb.h> -#include <machine/reg.h> -#include <machine/sal.h> -#include <machine/sigframe.h> -#ifdef SMP -#include <machine/smp.h> -#endif -#include <machine/unwind.h> -#include <machine/vmparam.h> - -/* - * For atomicity reasons, we demand that pc_curthread is the first - * field in the struct pcpu. It allows us to read the pointer with - * a single atomic instruction: - * ld8 %curthread = [r13] - * Otherwise we would first have to calculate the load address and - * store the result in a temporary register and that for the load: - * add %temp = %offsetof(struct pcpu), r13 - * ld8 %curthread = [%temp] - * A context switch inbetween the add and the ld8 could have the - * thread migrate to a different core. In that case, %curthread - * would be the thread running on the original core and not actually - * the current thread. - */ -CTASSERT(offsetof(struct pcpu, pc_curthread) == 0); - -static SYSCTL_NODE(_hw, OID_AUTO, freq, CTLFLAG_RD, 0, ""); -static SYSCTL_NODE(_machdep, OID_AUTO, cpu, CTLFLAG_RD, 0, ""); - -static u_int bus_freq; -SYSCTL_UINT(_hw_freq, OID_AUTO, bus, CTLFLAG_RD, &bus_freq, 0, - "Bus clock frequency"); - -static u_int cpu_freq; -SYSCTL_UINT(_hw_freq, OID_AUTO, cpu, CTLFLAG_RD, &cpu_freq, 0, - "CPU clock frequency"); - -static u_int itc_freq; -SYSCTL_UINT(_hw_freq, OID_AUTO, itc, CTLFLAG_RD, &itc_freq, 0, - "ITC frequency"); - -int cold = 1; -int unmapped_buf_allowed = 0; - -struct bootinfo *bootinfo; - -struct pcpu pcpu0; - -extern u_int64_t kernel_text[], _end[]; - -extern u_int64_t ia64_gateway_page[]; -extern u_int64_t break_sigtramp[]; -extern u_int64_t epc_sigtramp[]; - -struct fpswa_iface *fpswa_iface; - -vm_size_t ia64_pal_size; -vm_paddr_t ia64_pal_base; -vm_offset_t ia64_port_base; - -u_int64_t ia64_lapic_addr = PAL_PIB_DEFAULT_ADDR; - -struct ia64_pib *ia64_pib; - -static int ia64_sync_icache_needed; - -char machine[] = MACHINE; -SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, ""); - -static char cpu_model[64]; -SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, cpu_model, 0, - "The CPU model name"); - -static char cpu_family[64]; -SYSCTL_STRING(_hw, OID_AUTO, family, CTLFLAG_RD, cpu_family, 0, - "The CPU family name"); - -#ifdef DDB -extern vm_offset_t ksym_start, ksym_end; -#endif - -struct msgbuf *msgbufp = NULL; - -/* Other subsystems (e.g., ACPI) can hook this later. */ -void (*cpu_idle_hook)(sbintime_t) = NULL; - -struct kva_md_info kmi; - -static void -identifycpu(void) -{ - char vendor[17]; - char *family_name, *model_name; - u_int64_t features, tmp; - int number, revision, model, family, archrev; - - /* - * Assumes little-endian. - */ - *(u_int64_t *) &vendor[0] = ia64_get_cpuid(0); - *(u_int64_t *) &vendor[8] = ia64_get_cpuid(1); - vendor[16] = '\0'; - - tmp = ia64_get_cpuid(3); - number = (tmp >> 0) & 0xff; - revision = (tmp >> 8) & 0xff; - model = (tmp >> 16) & 0xff; - family = (tmp >> 24) & 0xff; - archrev = (tmp >> 32) & 0xff; - - family_name = model_name = "unknown"; - switch (family) { - case 0x07: - family_name = "Itanium"; - model_name = "Merced"; - break; - case 0x1f: - family_name = "Itanium 2"; - switch (model) { - case 0x00: - model_name = "McKinley"; - break; - case 0x01: - /* - * Deerfield is a low-voltage variant based on the - * Madison core. We need circumstantial evidence - * (i.e. the clock frequency) to identify those. - * Allow for roughly 1% error margin. - */ - if (cpu_freq > 990 && cpu_freq < 1010) - model_name = "Deerfield"; - else - model_name = "Madison"; - break; - case 0x02: - model_name = "Madison II"; - break; - } - break; - case 0x20: - ia64_sync_icache_needed = 1; - - family_name = "Itanium 2"; - switch (model) { - case 0x00: - model_name = "Montecito"; - break; - case 0x01: - model_name = "Montvale"; - break; - } - break; - } - snprintf(cpu_family, sizeof(cpu_family), "%s", family_name); - snprintf(cpu_model, sizeof(cpu_model), "%s", model_name); - - features = ia64_get_cpuid(4); - - printf("CPU: %s (", model_name); - if (cpu_freq) - printf("%u MHz ", cpu_freq); - printf("%s)\n", family_name); - printf(" Origin = \"%s\" Revision = %d\n", vendor, revision); - printf(" Features = 0x%b\n", (u_int32_t) features, - "\020" - "\001LB" /* long branch (brl) instruction. */ - "\002SD" /* Spontaneous deferral. */ - "\003AO" /* 16-byte atomic operations (ld, st, cmpxchg). */ ); -} - -static void -cpu_startup(void *dummy) -{ - char nodename[16]; - struct pcpu *pc; - struct pcpu_stats *pcs; - - /* - * Good {morning,afternoon,evening,night}. - */ - identifycpu(); - -#ifdef PERFMON - perfmon_init(); -#endif - printf("real memory = %ld (%ld MB)\n", ptoa(realmem), - ptoa(realmem) / 1048576); - - vm_ksubmap_init(&kmi); - - printf("avail memory = %ld (%ld MB)\n", ptoa(vm_cnt.v_free_count), - ptoa(vm_cnt.v_free_count) / 1048576); - - if (fpswa_iface == NULL) - printf("Warning: no FPSWA package supplied\n"); - else - printf("FPSWA Revision = 0x%lx, Entry = %p\n", - (long)fpswa_iface->if_rev, (void *)fpswa_iface->if_fpswa); - - /* - * Set up buffers, so they can be used to read disk labels. - */ - bufinit(); - vm_pager_bufferinit(); - - /* - * Traverse the MADT to discover IOSAPIC and Local SAPIC - * information. - */ - ia64_probe_sapics(); - ia64_pib = pmap_mapdev(ia64_lapic_addr, sizeof(*ia64_pib)); - - ia64_mca_init(); - - /* - * Create sysctl tree for per-CPU information. - */ - STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { - snprintf(nodename, sizeof(nodename), "%u", pc->pc_cpuid); - sysctl_ctx_init(&pc->pc_md.sysctl_ctx); - pc->pc_md.sysctl_tree = SYSCTL_ADD_NODE(&pc->pc_md.sysctl_ctx, - SYSCTL_STATIC_CHILDREN(_machdep_cpu), OID_AUTO, nodename, - CTLFLAG_RD, NULL, ""); - if (pc->pc_md.sysctl_tree == NULL) - continue; - - pcs = &pc->pc_md.stats; - - SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, - SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, - "nasts", CTLFLAG_RD, &pcs->pcs_nasts, - "Number of IPI_AST interrupts"); - - SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, - SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, - "nclks", CTLFLAG_RD, &pcs->pcs_nclks, - "Number of clock interrupts"); - - SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, - SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, - "nextints", CTLFLAG_RD, &pcs->pcs_nextints, - "Number of ExtINT interrupts"); - - SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, - SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, - "nhardclocks", CTLFLAG_RD, &pcs->pcs_nhardclocks, - "Number of IPI_HARDCLOCK interrupts"); - - SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, - SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, - "nhighfps", CTLFLAG_RD, &pcs->pcs_nhighfps, - "Number of IPI_HIGH_FP interrupts"); - - SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, - SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, - "nhwints", CTLFLAG_RD, &pcs->pcs_nhwints, - "Number of hardware (device) interrupts"); - - SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, - SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, - "npreempts", CTLFLAG_RD, &pcs->pcs_npreempts, - "Number of IPI_PREEMPT interrupts"); - - SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, - SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, - "nrdvs", CTLFLAG_RD, &pcs->pcs_nrdvs, - "Number of IPI_RENDEZVOUS interrupts"); - - SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, - SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, - "nstops", CTLFLAG_RD, &pcs->pcs_nstops, - "Number of IPI_STOP interrupts"); - - SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, - SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, - "nstrays", CTLFLAG_RD, &pcs->pcs_nstrays, - "Number of stray interrupts"); - } -} -SYSINIT(cpu_startup, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); - -void -cpu_flush_dcache(void *ptr, size_t len) -{ - vm_offset_t lim, va; - - va = (uintptr_t)ptr & ~31; - lim = (uintptr_t)ptr + len; - while (va < lim) { - ia64_fc(va); - va += 32; - } - - ia64_srlz_d(); -} - -/* Get current clock frequency for the given cpu id. */ -int -cpu_est_clockrate(int cpu_id, uint64_t *rate) -{ - - if (pcpu_find(cpu_id) == NULL || rate == NULL) - return (EINVAL); - *rate = (u_long)cpu_freq * 1000000ul; - return (0); -} - -void -cpu_halt() -{ - - efi_reset_system(); -} - -void -cpu_idle(int busy) -{ - register_t ie; - sbintime_t sbt = -1; - - if (!busy) { - critical_enter(); - sbt = cpu_idleclock(); - } - - ie = intr_disable(); - KASSERT(ie != 0, ("%s called with interrupts disabled\n", __func__)); - - if (sched_runnable()) - ia64_enable_intr(); - else if (cpu_idle_hook != NULL) { - (*cpu_idle_hook)(sbt); - /* The hook must enable interrupts! */ - } else { - ia64_call_pal_static(PAL_HALT_LIGHT, 0, 0, 0); - ia64_enable_intr(); - } - - if (!busy) { - cpu_activeclock(); - critical_exit(); - } -} - -int -cpu_idle_wakeup(int cpu) -{ - - return (0); -} - -void -cpu_reset() -{ - - efi_reset_system(); -} - -void -cpu_switch(struct thread *old, struct thread *new, struct mtx *mtx) -{ - struct pcb *oldpcb, *newpcb; - - oldpcb = old->td_pcb; -#ifdef COMPAT_FREEBSD32 - ia32_savectx(oldpcb); -#endif - if (PCPU_GET(fpcurthread) == old) - old->td_frame->tf_special.psr |= IA64_PSR_DFH; - if (!savectx(oldpcb)) { - newpcb = new->td_pcb; - oldpcb->pcb_current_pmap = - pmap_switch(newpcb->pcb_current_pmap); - - atomic_store_rel_ptr(&old->td_lock, mtx); - -#if defined(SCHED_ULE) && defined(SMP) - while (atomic_load_acq_ptr(&new->td_lock) == &blocked_lock) - cpu_spinwait(); -#endif - - PCPU_SET(curthread, new); - -#ifdef COMPAT_FREEBSD32 - ia32_restorectx(newpcb); -#endif - - if (PCPU_GET(fpcurthread) == new) - new->td_frame->tf_special.psr &= ~IA64_PSR_DFH; - restorectx(newpcb); - /* We should not get here. */ - panic("cpu_switch: restorectx() returned"); - /* NOTREACHED */ - } -} - -void -cpu_throw(struct thread *old __unused, struct thread *new) -{ - struct pcb *newpcb; - - newpcb = new->td_pcb; - (void)pmap_switch(newpcb->pcb_current_pmap); - -#if defined(SCHED_ULE) && defined(SMP) - while (atomic_load_acq_ptr(&new->td_lock) == &blocked_lock) - cpu_spinwait(); -#endif - - PCPU_SET(curthread, new); - -#ifdef COMPAT_FREEBSD32 - ia32_restorectx(newpcb); -#endif - - restorectx(newpcb); - /* We should not get here. */ - panic("cpu_throw: restorectx() returned"); - /* NOTREACHED */ -} - -void -cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size) -{ - - /* - * Set pc_acpi_id to "uninitialized". - * See sys/dev/acpica/acpi_cpu.c - */ - pcpu->pc_acpi_id = 0xffffffff; -} - -void -cpu_pcpu_setup(struct pcpu *pc, u_int acpi_id, u_int sapic_id) -{ - - pc->pc_acpi_id = acpi_id; - pc->pc_md.lid = IA64_LID_SET_SAPIC_ID(sapic_id); -} - -void -spinlock_enter(void) -{ - struct thread *td; - int intr; - - td = curthread; - if (td->td_md.md_spinlock_count == 0) { - intr = intr_disable(); - td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_intr = intr; - } else - td->td_md.md_spinlock_count++; - critical_enter(); -} - -void -spinlock_exit(void) -{ - struct thread *td; - int intr; - - td = curthread; - critical_exit(); - intr = td->td_md.md_saved_intr; - td->td_md.md_spinlock_count--; - if (td->td_md.md_spinlock_count == 0) - intr_restore(intr); -} - -void -kdb_cpu_trap(int vector, int code __unused) -{ - -#ifdef XTRACE - ia64_xtrace_stop(); -#endif - __asm __volatile("flushrs;;"); - - /* Restart after the break instruction. */ - if (vector == IA64_VEC_BREAK && - kdb_frame->tf_special.ifa == IA64_FIXED_BREAK) - kdb_frame->tf_special.psr += IA64_PSR_RI_1; -} - -void -map_vhpt(uintptr_t vhpt) -{ - pt_entry_t pte; - uint64_t psr; - - pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY | - PTE_PL_KERN | PTE_AR_RW; - pte |= vhpt & PTE_PPN_MASK; - - __asm __volatile("ptr.d %0,%1" :: "r"(vhpt), - "r"(pmap_vhpt_log2size << 2)); - - __asm __volatile("mov %0=psr" : "=r"(psr)); - __asm __volatile("rsm psr.ic|psr.i"); - ia64_srlz_i(); - ia64_set_ifa(vhpt); - ia64_set_itir(pmap_vhpt_log2size << 2); - ia64_srlz_d(); - __asm __volatile("itr.d dtr[%0]=%1" :: "r"(3), "r"(pte)); - __asm __volatile("mov psr.l=%0" :: "r" (psr)); - ia64_srlz_i(); -} - -void -map_pal_code(void) -{ - pt_entry_t pte; - vm_offset_t va; - vm_size_t sz; - uint64_t psr; - u_int shft; - - if (ia64_pal_size == 0) - return; - - va = IA64_PHYS_TO_RR7(ia64_pal_base); - - sz = ia64_pal_size; - shft = 0; - while (sz > 1) { - shft++; - sz >>= 1; - } - - pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY | - PTE_PL_KERN | PTE_AR_RWX; - pte |= ia64_pal_base & PTE_PPN_MASK; - - __asm __volatile("ptr.d %0,%1; ptr.i %0,%1" :: "r"(va), "r"(shft<<2)); - - __asm __volatile("mov %0=psr" : "=r"(psr)); - __asm __volatile("rsm psr.ic|psr.i"); - ia64_srlz_i(); - ia64_set_ifa(va); - ia64_set_itir(shft << 2); - ia64_srlz_d(); - __asm __volatile("itr.d dtr[%0]=%1" :: "r"(4), "r"(pte)); - ia64_srlz_d(); - __asm __volatile("itr.i itr[%0]=%1" :: "r"(1), "r"(pte)); - __asm __volatile("mov psr.l=%0" :: "r" (psr)); - ia64_srlz_i(); -} - -void -map_gateway_page(void) -{ - pt_entry_t pte; - uint64_t psr; - - pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY | - PTE_PL_KERN | PTE_AR_X_RX; - pte |= ia64_tpa((uint64_t)ia64_gateway_page) & PTE_PPN_MASK; - - __asm __volatile("ptr.d %0,%1; ptr.i %0,%1" :: - "r"(VM_MAXUSER_ADDRESS), "r"(PAGE_SHIFT << 2)); - - __asm __volatile("mov %0=psr" : "=r"(psr)); - __asm __volatile("rsm psr.ic|psr.i"); - ia64_srlz_i(); - ia64_set_ifa(VM_MAXUSER_ADDRESS); - ia64_set_itir(PAGE_SHIFT << 2); - ia64_srlz_d(); - __asm __volatile("itr.d dtr[%0]=%1" :: "r"(5), "r"(pte)); - ia64_srlz_d(); - __asm __volatile("itr.i itr[%0]=%1" :: "r"(2), "r"(pte)); - __asm __volatile("mov psr.l=%0" :: "r" (psr)); - ia64_srlz_i(); - - /* Expose the mapping to userland in ar.k5 */ - ia64_set_k5(VM_MAXUSER_ADDRESS); -} - -static u_int -freq_ratio(u_long base, u_long ratio) -{ - u_long f; - - f = (base * (ratio >> 32)) / (ratio & 0xfffffffful); - return ((f + 500000) / 1000000); -} - -static void -calculate_frequencies(void) -{ - struct ia64_sal_result sal; - struct ia64_pal_result pal; - register_t ie; - - ie = intr_disable(); - sal = ia64_sal_entry(SAL_FREQ_BASE, 0, 0, 0, 0, 0, 0, 0); - pal = ia64_call_pal_static(PAL_FREQ_RATIOS, 0, 0, 0); - intr_restore(ie); - - if (sal.sal_status == 0 && pal.pal_status == 0) { - if (bootverbose) { - printf("Platform clock frequency %ld Hz\n", - sal.sal_result[0]); - printf("Processor ratio %ld/%ld, Bus ratio %ld/%ld, " - "ITC ratio %ld/%ld\n", - pal.pal_result[0] >> 32, - pal.pal_result[0] & ((1L << 32) - 1), - pal.pal_result[1] >> 32, - pal.pal_result[1] & ((1L << 32) - 1), - pal.pal_result[2] >> 32, - pal.pal_result[2] & ((1L << 32) - 1)); - } - cpu_freq = freq_ratio(sal.sal_result[0], pal.pal_result[0]); - bus_freq = freq_ratio(sal.sal_result[0], pal.pal_result[1]); - itc_freq = freq_ratio(sal.sal_result[0], pal.pal_result[2]); - } -} - -struct ia64_init_return -ia64_init(void) -{ - struct ia64_init_return ret; - struct efi_md *md; - pt_entry_t *pbvm_pgtbl_ent, *pbvm_pgtbl_lim; - char *p; - vm_size_t mdlen; - int metadata_missing; - - /* - * NO OUTPUT ALLOWED UNTIL FURTHER NOTICE. - */ - - ia64_set_fpsr(IA64_FPSR_DEFAULT); - - /* - * Region 6 is direct mapped UC and region 7 is direct mapped - * WC. The details of this is controlled by the Alt {I,D}TLB - * handlers. Here we just make sure that they have the largest - * possible page size to minimise TLB usage. - */ - ia64_set_rr(IA64_RR_BASE(6), (6 << 8) | (LOG2_ID_PAGE_SIZE << 2)); - ia64_set_rr(IA64_RR_BASE(7), (7 << 8) | (LOG2_ID_PAGE_SIZE << 2)); - ia64_srlz_d(); - - /* Initialize/setup physical memory datastructures */ - ia64_physmem_init(); - - /* - * Process the memory map. This gives us the PAL locations, - * the I/O port base address, the available memory regions - * for initializing the physical memory map. - */ - for (md = efi_md_first(); md != NULL; md = efi_md_next(md)) { - mdlen = md->md_pages * EFI_PAGE_SIZE; - switch (md->md_type) { - case EFI_MD_TYPE_IOPORT: - ia64_port_base = pmap_mapdev_priv(md->md_phys, - mdlen, VM_MEMATTR_UNCACHEABLE); - break; - case EFI_MD_TYPE_PALCODE: - ia64_pal_base = md->md_phys; - ia64_pal_size = mdlen; - /*FALLTHROUGH*/ - case EFI_MD_TYPE_BAD: - case EFI_MD_TYPE_FIRMWARE: - case EFI_MD_TYPE_RECLAIM: - case EFI_MD_TYPE_RT_CODE: - case EFI_MD_TYPE_RT_DATA: - /* Don't use these memory regions. */ - ia64_physmem_track(md->md_phys, mdlen); - break; - case EFI_MD_TYPE_BS_CODE: - case EFI_MD_TYPE_BS_DATA: - case EFI_MD_TYPE_CODE: - case EFI_MD_TYPE_DATA: - case EFI_MD_TYPE_FREE: - /* These are ok to use. */ - ia64_physmem_add(md->md_phys, mdlen); - break; - } - } - - /* - * Remove the PBVM and its page table from phys_avail. The loader - * passes the physical address of the page table to us. The virtual - * address of the page table is fixed. - * Track and the PBVM limit for later use. - */ - ia64_physmem_delete(bootinfo->bi_pbvm_pgtbl, bootinfo->bi_pbvm_pgtblsz); - pbvm_pgtbl_ent = (void *)IA64_PBVM_PGTBL; - pbvm_pgtbl_lim = (void *)(IA64_PBVM_PGTBL + bootinfo->bi_pbvm_pgtblsz); - while (pbvm_pgtbl_ent < pbvm_pgtbl_lim) { - if ((*pbvm_pgtbl_ent & PTE_PRESENT) == 0) - break; - ia64_physmem_delete(*pbvm_pgtbl_ent & PTE_PPN_MASK, - IA64_PBVM_PAGE_SIZE); - pbvm_pgtbl_ent++; - } - - /* Finalize physical memory datastructures */ - ia64_physmem_fini(); - - metadata_missing = 0; - if (bootinfo->bi_modulep) - preload_metadata = (caddr_t)bootinfo->bi_modulep; - else - metadata_missing = 1; - - if (envmode == 0 && bootinfo->bi_envp) - kern_envp = (caddr_t)bootinfo->bi_envp; - else - kern_envp = static_env; - - /* - * Look at arguments passed to us and compute boothowto. - */ - boothowto = bootinfo->bi_boothowto; - - if (boothowto & RB_VERBOSE) - bootverbose = 1; - - /* - * Wire things up so we can call the firmware. - */ - map_pal_code(); - efi_boot_minimal(bootinfo->bi_systab); - ia64_xiv_init(); - ia64_sal_init(); - calculate_frequencies(); - - set_cputicker(ia64_get_itc, (u_long)itc_freq * 1000000, 0); - - /* - * Setup the PCPU data for the bootstrap processor. It is needed - * by printf(). Also, since printf() has critical sections, we - * need to initialize at least pc_curthread. - */ - pcpup = &pcpu0; - ia64_set_k4((u_int64_t)pcpup); - pcpu_init(pcpup, 0, sizeof(pcpu0)); - dpcpu_init(ia64_physmem_alloc(DPCPU_SIZE, PAGE_SIZE), 0); - cpu_pcpu_setup(pcpup, ~0U, ia64_get_lid()); - PCPU_SET(curthread, &thread0); - - /* - * Initialize the console before we print anything out. - */ - cninit(); - - /* OUTPUT NOW ALLOWED */ - - if (metadata_missing) - printf("WARNING: loader(8) metadata is missing!\n"); - - /* Get FPSWA interface */ - fpswa_iface = (bootinfo->bi_fpswa == 0) ? NULL : - (struct fpswa_iface *)IA64_PHYS_TO_RR7(bootinfo->bi_fpswa); - - /* Init basic tunables, including hz */ - init_param1(); - - p = getenv("kernelname"); - if (p != NULL) { - strlcpy(kernelname, p, sizeof(kernelname)); - freeenv(p); - } - - init_param2(physmem); - - /* - * Initialize error message buffer (at end of core). - */ - msgbufp = ia64_physmem_alloc(msgbufsize, PAGE_SIZE); - msgbufinit(msgbufp, msgbufsize); - - proc_linkup0(&proc0, &thread0); - /* - * Init mapping for kernel stack for proc 0 - */ - p = ia64_physmem_alloc(KSTACK_PAGES * PAGE_SIZE, PAGE_SIZE); - thread0.td_kstack = (uintptr_t)p; - thread0.td_kstack_pages = KSTACK_PAGES; - - mutex_init(); - - /* - * Initialize the rest of proc 0's PCB. - * - * Set the kernel sp, reserving space for an (empty) trapframe, - * and make proc0's trapframe pointer point to it for sanity. - * Initialise proc0's backing store to start after u area. - */ - cpu_thread_alloc(&thread0); - thread0.td_frame->tf_flags = FRAME_SYSCALL; - thread0.td_pcb->pcb_special.sp = - (u_int64_t)thread0.td_frame - 16; - thread0.td_pcb->pcb_special.bspstore = thread0.td_kstack; - - /* - * Initialize the virtual memory system. - */ - pmap_bootstrap(); - -#ifdef XTRACE - ia64_xtrace_init_bsp(); -#endif - - /* - * Initialize debuggers, and break into them if appropriate. - */ -#ifdef DDB - ksym_start = bootinfo->bi_symtab; - ksym_end = bootinfo->bi_esymtab; -#endif - - kdb_init(); - -#ifdef KDB - if (boothowto & RB_KDB) - kdb_enter(KDB_WHY_BOOTFLAGS, - "Boot flags requested debugger\n"); -#endif - - ia64_set_tpr(0); - ia64_srlz_d(); - - ret.bspstore = thread0.td_pcb->pcb_special.bspstore; - ret.sp = thread0.td_pcb->pcb_special.sp; - return (ret); -} - -uint64_t -ia64_get_hcdp(void) -{ - - return (bootinfo->bi_hcdp); -} - -void -bzero(void *buf, size_t len) -{ - caddr_t p = buf; - - while (((vm_offset_t) p & (sizeof(u_long) - 1)) && len) { - *p++ = 0; - len--; - } - while (len >= sizeof(u_long) * 8) { - *(u_long*) p = 0; - *((u_long*) p + 1) = 0; - *((u_long*) p + 2) = 0; - *((u_long*) p + 3) = 0; - len -= sizeof(u_long) * 8; - *((u_long*) p + 4) = 0; - *((u_long*) p + 5) = 0; - *((u_long*) p + 6) = 0; - *((u_long*) p + 7) = 0; - p += sizeof(u_long) * 8; - } - while (len >= sizeof(u_long)) { - *(u_long*) p = 0; - len -= sizeof(u_long); - p += sizeof(u_long); - } - while (len) { - *p++ = 0; - len--; - } -} - -u_int -ia64_itc_freq(void) -{ - - return (itc_freq); -} - -void -DELAY(int n) -{ - u_int64_t start, end, now; - - sched_pin(); - - start = ia64_get_itc(); - end = start + itc_freq * n; - /* printf("DELAY from 0x%lx to 0x%lx\n", start, end); */ - do { - now = ia64_get_itc(); - } while (now < end || (now > start && end < start)); - - sched_unpin(); -} - -/* - * Send an interrupt (signal) to a process. - */ -void -sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) -{ - struct proc *p; - struct thread *td; - struct trapframe *tf; - struct sigacts *psp; - struct sigframe sf, *sfp; - u_int64_t sbs, sp; - int oonstack; - int sig; - u_long code; - - td = curthread; - p = td->td_proc; - PROC_LOCK_ASSERT(p, MA_OWNED); - sig = ksi->ksi_signo; - code = ksi->ksi_code; - psp = p->p_sigacts; - mtx_assert(&psp->ps_mtx, MA_OWNED); - tf = td->td_frame; - sp = tf->tf_special.sp; - oonstack = sigonstack(sp); - sbs = 0; - - /* save user context */ - bzero(&sf, sizeof(struct sigframe)); - sf.sf_uc.uc_sigmask = *mask; - sf.sf_uc.uc_stack = td->td_sigstk; - sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) - ? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE; - - /* - * Allocate and validate space for the signal handler - * context. Note that if the stack is in P0 space, the - * call to grow() is a nop, and the useracc() check - * will fail if the process has not already allocated - * the space with a `brk'. - */ - if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && - SIGISMEMBER(psp->ps_sigonstack, sig)) { - sbs = (u_int64_t)td->td_sigstk.ss_sp; - sbs = (sbs + 15) & ~15; - sfp = (struct sigframe *)(sbs + td->td_sigstk.ss_size); -#if defined(COMPAT_43) - td->td_sigstk.ss_flags |= SS_ONSTACK; -#endif - } else - sfp = (struct sigframe *)sp; - sfp = (struct sigframe *)((u_int64_t)(sfp - 1) & ~15); - - /* Fill in the siginfo structure for POSIX handlers. */ - if (SIGISMEMBER(psp->ps_siginfo, sig)) { - sf.sf_si = ksi->ksi_info; - sf.sf_si.si_signo = sig; - /* - * XXX this shouldn't be here after code in trap.c - * is fixed - */ - sf.sf_si.si_addr = (void*)tf->tf_special.ifa; - code = (u_int64_t)&sfp->sf_si; - } - - mtx_unlock(&psp->ps_mtx); - PROC_UNLOCK(p); - - get_mcontext(td, &sf.sf_uc.uc_mcontext, 0); - - /* Copy the frame out to userland. */ - if (copyout(&sf, sfp, sizeof(sf)) != 0) { - /* - * Process has trashed its stack; give it an illegal - * instruction to halt it in its tracks. - */ - PROC_LOCK(p); - sigexit(td, SIGILL); - return; - } - - if ((tf->tf_flags & FRAME_SYSCALL) == 0) { - tf->tf_special.psr &= ~IA64_PSR_RI; - tf->tf_special.iip = ia64_get_k5() + - ((uint64_t)break_sigtramp - (uint64_t)ia64_gateway_page); - } else - tf->tf_special.iip = ia64_get_k5() + - ((uint64_t)epc_sigtramp - (uint64_t)ia64_gateway_page); - - /* - * Setup the trapframe to return to the signal trampoline. We pass - * information to the trampoline in the following registers: - * - * gp new backing store or NULL - * r8 signal number - * r9 signal code or siginfo pointer - * r10 signal handler (function descriptor) - */ - tf->tf_special.sp = (u_int64_t)sfp - 16; - tf->tf_special.gp = sbs; - tf->tf_special.bspstore = sf.sf_uc.uc_mcontext.mc_special.bspstore; - tf->tf_special.ndirty = 0; - tf->tf_special.rnat = sf.sf_uc.uc_mcontext.mc_special.rnat; - tf->tf_scratch.gr8 = sig; - tf->tf_scratch.gr9 = code; - tf->tf_scratch.gr10 = (u_int64_t)catcher; - - PROC_LOCK(p); - mtx_lock(&psp->ps_mtx); -} - -/* - * System call to cleanup state after a signal - * has been taken. Reset signal mask and - * stack state from context left by sendsig (above). - * Return to previous pc and psl as specified by - * context left by sendsig. Check carefully to - * make sure that the user has not modified the - * state to gain improper privileges. - * - * MPSAFE - */ -int -sys_sigreturn(struct thread *td, - struct sigreturn_args /* { - ucontext_t *sigcntxp; - } */ *uap) -{ - ucontext_t uc; - struct trapframe *tf; - struct pcb *pcb; - - tf = td->td_frame; - pcb = td->td_pcb; - - /* - * Fetch the entire context structure at once for speed. - * We don't use a normal argument to simplify RSE handling. - */ - if (copyin(uap->sigcntxp, (caddr_t)&uc, sizeof(uc))) - return (EFAULT); - - set_mcontext(td, &uc.uc_mcontext); - -#if defined(COMPAT_43) - if (sigonstack(tf->tf_special.sp)) - td->td_sigstk.ss_flags |= SS_ONSTACK; - else - td->td_sigstk.ss_flags &= ~SS_ONSTACK; -#endif - kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); - - return (EJUSTRETURN); -} - -#ifdef COMPAT_FREEBSD4 -int -freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap) -{ - - return sys_sigreturn(td, (struct sigreturn_args *)uap); -} -#endif - -/* - * Construct a PCB from a trapframe. This is called from kdb_trap() where - * we want to start a backtrace from the function that caused us to enter - * the debugger. We have the context in the trapframe, but base the trace - * on the PCB. The PCB doesn't have to be perfect, as long as it contains - * enough for a backtrace. - */ -void -makectx(struct trapframe *tf, struct pcb *pcb) -{ - - pcb->pcb_special = tf->tf_special; - pcb->pcb_special.__spare = ~0UL; /* XXX see unwind.c */ - save_callee_saved(&pcb->pcb_preserved); - save_callee_saved_fp(&pcb->pcb_preserved_fp); -} - -int -ia64_flush_dirty(struct thread *td, struct _special *r) -{ - struct iovec iov; - struct uio uio; - uint64_t bspst, kstk, rnat; - int error, locked; - - if (r->ndirty == 0) - return (0); - - kstk = td->td_kstack + (r->bspstore & 0x1ffUL); - if (td == curthread) { - __asm __volatile("mov ar.rsc=0;;"); - __asm __volatile("mov %0=ar.bspstore" : "=r"(bspst)); - /* Make sure we have all the user registers written out. */ - if (bspst - kstk < r->ndirty) { - __asm __volatile("flushrs;;"); - __asm __volatile("mov %0=ar.bspstore" : "=r"(bspst)); - } - __asm __volatile("mov %0=ar.rnat;;" : "=r"(rnat)); - __asm __volatile("mov ar.rsc=3"); - error = copyout((void*)kstk, (void*)r->bspstore, r->ndirty); - kstk += r->ndirty; - r->rnat = (bspst > kstk && (bspst & 0x1ffL) < (kstk & 0x1ffL)) - ? *(uint64_t*)(kstk | 0x1f8L) : rnat; - } else { - locked = PROC_LOCKED(td->td_proc); - if (!locked) - PHOLD(td->td_proc); - iov.iov_base = (void*)(uintptr_t)kstk; - iov.iov_len = r->ndirty; - uio.uio_iov = &iov; - uio.uio_iovcnt = 1; - uio.uio_offset = r->bspstore; - uio.uio_resid = r->ndirty; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_rw = UIO_WRITE; - uio.uio_td = td; - error = proc_rwmem(td->td_proc, &uio); - /* - * XXX proc_rwmem() doesn't currently return ENOSPC, - * so I think it can bogusly return 0. Neither do - * we allow short writes. - */ - if (uio.uio_resid != 0 && error == 0) - error = ENOSPC; - if (!locked) - PRELE(td->td_proc); - } - - r->bspstore += r->ndirty; - r->ndirty = 0; - return (error); -} - -int -get_mcontext(struct thread *td, mcontext_t *mc, int flags) -{ - struct trapframe *tf; - int error; - - tf = td->td_frame; - bzero(mc, sizeof(*mc)); - mc->mc_special = tf->tf_special; - error = ia64_flush_dirty(td, &mc->mc_special); - if (tf->tf_flags & FRAME_SYSCALL) { - mc->mc_flags |= _MC_FLAGS_SYSCALL_CONTEXT; - mc->mc_scratch = tf->tf_scratch; - if (flags & GET_MC_CLEAR_RET) { - mc->mc_scratch.gr8 = 0; - mc->mc_scratch.gr9 = 0; - mc->mc_scratch.gr10 = 0; - mc->mc_scratch.gr11 = 0; - } - } else { - mc->mc_flags |= _MC_FLAGS_ASYNC_CONTEXT; - mc->mc_scratch = tf->tf_scratch; - mc->mc_scratch_fp = tf->tf_scratch_fp; - /* - * XXX If the thread never used the high FP registers, we - * probably shouldn't waste time saving them. - */ - ia64_highfp_save(td); - mc->mc_flags |= _MC_FLAGS_HIGHFP_VALID; - mc->mc_high_fp = td->td_pcb->pcb_high_fp; - } - save_callee_saved(&mc->mc_preserved); - save_callee_saved_fp(&mc->mc_preserved_fp); - return (error); -} - -int -set_mcontext(struct thread *td, const mcontext_t *mc) -{ - struct _special s; - struct trapframe *tf; - uint64_t psrmask; - - tf = td->td_frame; - - KASSERT((tf->tf_special.ndirty & ~PAGE_MASK) == 0, - ("Whoa there! We have more than 8KB of dirty registers!")); - - s = mc->mc_special; - /* - * Only copy the user mask and the restart instruction bit from - * the new context. - */ - psrmask = IA64_PSR_BE | IA64_PSR_UP | IA64_PSR_AC | IA64_PSR_MFL | - IA64_PSR_MFH | IA64_PSR_RI; - s.psr = (tf->tf_special.psr & ~psrmask) | (s.psr & psrmask); - /* We don't have any dirty registers of the new context. */ - s.ndirty = 0; - if (mc->mc_flags & _MC_FLAGS_ASYNC_CONTEXT) { - /* - * We can get an async context passed to us while we - * entered the kernel through a syscall: sigreturn(2) - * takes contexts that could previously be the result of - * a trap or interrupt. - * Hence, we cannot assert that the trapframe is not - * a syscall frame, but we can assert that it's at - * least an expected syscall. - */ - if (tf->tf_flags & FRAME_SYSCALL) { - KASSERT(tf->tf_scratch.gr15 == SYS_sigreturn, ("foo")); - tf->tf_flags &= ~FRAME_SYSCALL; - } - tf->tf_scratch = mc->mc_scratch; - tf->tf_scratch_fp = mc->mc_scratch_fp; - if (mc->mc_flags & _MC_FLAGS_HIGHFP_VALID) - td->td_pcb->pcb_high_fp = mc->mc_high_fp; - } else { - KASSERT((tf->tf_flags & FRAME_SYSCALL) != 0, ("foo")); - if ((mc->mc_flags & _MC_FLAGS_SYSCALL_CONTEXT) == 0) { - s.cfm = tf->tf_special.cfm; - s.iip = tf->tf_special.iip; - tf->tf_scratch.gr15 = 0; /* Clear syscall nr. */ - } else - tf->tf_scratch = mc->mc_scratch; - } - tf->tf_special = s; - restore_callee_saved(&mc->mc_preserved); - restore_callee_saved_fp(&mc->mc_preserved_fp); - - return (0); -} - -/* - * Clear registers on exec. - */ -void -exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) -{ - struct trapframe *tf; - uint64_t *ksttop, *kst; - - tf = td->td_frame; - ksttop = (uint64_t*)(td->td_kstack + tf->tf_special.ndirty + - (tf->tf_special.bspstore & 0x1ffUL)); - - /* - * We can ignore up to 8KB of dirty registers by masking off the - * lower 13 bits in exception_restore() or epc_syscall(). This - * should be enough for a couple of years, but if there are more - * than 8KB of dirty registers, we lose track of the bottom of - * the kernel stack. The solution is to copy the active part of - * the kernel stack down 1 page (or 2, but not more than that) - * so that we always have less than 8KB of dirty registers. - */ - KASSERT((tf->tf_special.ndirty & ~PAGE_MASK) == 0, - ("Whoa there! We have more than 8KB of dirty registers!")); - - bzero(&tf->tf_special, sizeof(tf->tf_special)); - if ((tf->tf_flags & FRAME_SYSCALL) == 0) { /* break syscalls. */ - bzero(&tf->tf_scratch, sizeof(tf->tf_scratch)); - bzero(&tf->tf_scratch_fp, sizeof(tf->tf_scratch_fp)); - tf->tf_special.cfm = (1UL<<63) | (3UL<<7) | 3UL; - tf->tf_special.bspstore = IA64_BACKINGSTORE; - /* - * Copy the arguments onto the kernel register stack so that - * they get loaded by the loadrs instruction. Skip over the - * NaT collection points. - */ - kst = ksttop - 1; - if (((uintptr_t)kst & 0x1ff) == 0x1f8) - *kst-- = 0; - *kst-- = 0; - if (((uintptr_t)kst & 0x1ff) == 0x1f8) - *kst-- = 0; - *kst-- = imgp->ps_strings; - if (((uintptr_t)kst & 0x1ff) == 0x1f8) - *kst-- = 0; - *kst = stack; - tf->tf_special.ndirty = (ksttop - kst) << 3; - } else { /* epc syscalls (default). */ - tf->tf_special.cfm = (3UL<<62) | (3UL<<7) | 3UL; - tf->tf_special.bspstore = IA64_BACKINGSTORE + 24; - /* - * Write values for out0, out1 and out2 to the user's backing - * store and arrange for them to be restored into the user's - * initial register frame. - * Assumes that (bspstore & 0x1f8) < 0x1e0. - */ - suword((caddr_t)tf->tf_special.bspstore - 24, stack); - suword((caddr_t)tf->tf_special.bspstore - 16, imgp->ps_strings); - suword((caddr_t)tf->tf_special.bspstore - 8, 0); - } - - tf->tf_special.iip = imgp->entry_addr; - tf->tf_special.sp = (stack & ~15) - 16; - tf->tf_special.rsc = 0xf; - tf->tf_special.fpsr = IA64_FPSR_DEFAULT; - tf->tf_special.psr = IA64_PSR_IC | IA64_PSR_I | IA64_PSR_IT | - IA64_PSR_DT | IA64_PSR_RT | IA64_PSR_DFH | IA64_PSR_BN | - IA64_PSR_CPL_USER; -} - -int -ptrace_set_pc(struct thread *td, unsigned long addr) -{ - uint64_t slot; - - switch (addr & 0xFUL) { - case 0: - slot = IA64_PSR_RI_0; - break; - case 1: - /* XXX we need to deal with MLX bundles here */ - slot = IA64_PSR_RI_1; - break; - case 2: - slot = IA64_PSR_RI_2; - break; - default: - return (EINVAL); - } - - td->td_frame->tf_special.iip = addr & ~0x0FULL; - td->td_frame->tf_special.psr = - (td->td_frame->tf_special.psr & ~IA64_PSR_RI) | slot; - return (0); -} - -int -ptrace_single_step(struct thread *td) -{ - struct trapframe *tf; - - /* - * There's no way to set single stepping when we're leaving the - * kernel through the EPC syscall path. The way we solve this is - * by enabling the lower-privilege trap so that we re-enter the - * kernel as soon as the privilege level changes. See trap.c for - * how we proceed from there. - */ - tf = td->td_frame; - if (tf->tf_flags & FRAME_SYSCALL) - tf->tf_special.psr |= IA64_PSR_LP; - else - tf->tf_special.psr |= IA64_PSR_SS; - return (0); -} - -int -ptrace_clear_single_step(struct thread *td) -{ - struct trapframe *tf; - - /* - * Clear any and all status bits we may use to implement single - * stepping. - */ - tf = td->td_frame; - tf->tf_special.psr &= ~IA64_PSR_SS; - tf->tf_special.psr &= ~IA64_PSR_LP; - tf->tf_special.psr &= ~IA64_PSR_TB; - return (0); -} - -int -fill_regs(struct thread *td, struct reg *regs) -{ - struct trapframe *tf; - - tf = td->td_frame; - regs->r_special = tf->tf_special; - regs->r_scratch = tf->tf_scratch; - save_callee_saved(®s->r_preserved); - return (0); -} - -int -set_regs(struct thread *td, struct reg *regs) -{ - struct trapframe *tf; - int error; - - tf = td->td_frame; - error = ia64_flush_dirty(td, &tf->tf_special); - if (!error) { - tf->tf_special = regs->r_special; - tf->tf_special.bspstore += tf->tf_special.ndirty; - tf->tf_special.ndirty = 0; - tf->tf_scratch = regs->r_scratch; - restore_callee_saved(®s->r_preserved); - } - return (error); -} - -int -fill_dbregs(struct thread *td, struct dbreg *dbregs) -{ - - return (ENOSYS); -} - -int -set_dbregs(struct thread *td, struct dbreg *dbregs) -{ - - return (ENOSYS); -} - -int -fill_fpregs(struct thread *td, struct fpreg *fpregs) -{ - struct trapframe *frame = td->td_frame; - struct pcb *pcb = td->td_pcb; - - /* Save the high FP registers. */ - ia64_highfp_save(td); - - fpregs->fpr_scratch = frame->tf_scratch_fp; - save_callee_saved_fp(&fpregs->fpr_preserved); - fpregs->fpr_high = pcb->pcb_high_fp; - return (0); -} - -int -set_fpregs(struct thread *td, struct fpreg *fpregs) -{ - struct trapframe *frame = td->td_frame; - struct pcb *pcb = td->td_pcb; - - /* Throw away the high FP registers (should be redundant). */ - ia64_highfp_drop(td); - - frame->tf_scratch_fp = fpregs->fpr_scratch; - restore_callee_saved_fp(&fpregs->fpr_preserved); - pcb->pcb_high_fp = fpregs->fpr_high; - return (0); -} - -void -ia64_sync_icache(vm_offset_t va, vm_offset_t sz) -{ - vm_offset_t lim; - - if (!ia64_sync_icache_needed) - return; - - lim = va + sz; - while (va < lim) { - ia64_fc_i(va); - va += 32; /* XXX */ - } - - ia64_sync_i(); - ia64_srlz_i(); -} diff --git a/sys/ia64/ia64/mca.c b/sys/ia64/ia64/mca.c deleted file mode 100644 index dd0b9c3..0000000 --- a/sys/ia64/ia64/mca.c +++ /dev/null @@ -1,331 +0,0 @@ -/*- - * Copyright (c) 2002-2010 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/bus.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/mutex.h> -#include <sys/sysctl.h> -#include <sys/uuid.h> -#include <vm/vm.h> -#include <vm/vm_kern.h> -#include <machine/intr.h> -#include <machine/mca.h> -#include <machine/pal.h> -#include <machine/sal.h> -#include <machine/smp.h> - -static MALLOC_DEFINE(M_MCA, "MCA", "Machine Check Architecture"); - -struct mca_info { - STAILQ_ENTRY(mca_info) mi_link; - u_long mi_seqnr; - u_int mi_cpuid; - size_t mi_recsz; - char mi_record[0]; -}; - -STAILQ_HEAD(mca_info_list, mca_info); - -static int64_t mca_info_size[SAL_INFO_TYPES]; -static vm_offset_t mca_info_block; -static struct mtx mca_info_block_lock; - -static SYSCTL_NODE(_hw, OID_AUTO, mca, CTLFLAG_RW, NULL, "MCA container"); - -static int mca_count; /* Number of records stored. */ -static int mca_first; /* First (lowest) record ID. */ -static int mca_last; /* Last (highest) record ID. */ - -SYSCTL_INT(_hw_mca, OID_AUTO, count, CTLFLAG_RD, &mca_count, 0, - "Record count"); -SYSCTL_INT(_hw_mca, OID_AUTO, first, CTLFLAG_RD, &mca_first, 0, - "First record id"); -SYSCTL_INT(_hw_mca, OID_AUTO, last, CTLFLAG_RD, &mca_last, 0, - "Last record id"); - -static struct mtx mca_sysctl_lock; - -static u_int mca_xiv_cmc; - -static int -mca_sysctl_inject(SYSCTL_HANDLER_ARGS) -{ - struct ia64_pal_result res; - u_int val; - int error; - - val = 0; - error = sysctl_wire_old_buffer(req, sizeof(u_int)); - if (!error) - error = sysctl_handle_int(oidp, &val, 0, req); - - if (error != 0 || req->newptr == NULL) - return (error); - - /* - * Example values for injecting PAL determined machine checks: - * corrected 9 - * recoverable 73 - * fatal 137 - */ - res = ia64_call_pal_stacked(PAL_MC_ERROR_INJECT, val, 0, 0); - printf("%s: %#lx, %#lx, %#lx, %#lx\n", __func__, res.pal_status, - res.pal_result[0], res.pal_result[1], res.pal_result[2]); - return (0); -} -SYSCTL_PROC(_hw_mca, OID_AUTO, inject, CTLTYPE_INT | CTLFLAG_RW, NULL, 0, - mca_sysctl_inject, "I", "set to trigger a MCA"); - -static int -mca_sysctl_handler(SYSCTL_HANDLER_ARGS) -{ - int error = 0; - - if (!arg1) - return (EINVAL); - error = SYSCTL_OUT(req, arg1, arg2); - - if (error || !req->newptr) - return (error); - - error = SYSCTL_IN(req, arg1, arg2); - return (error); -} - -static void -ia64_mca_collect_state(int type, struct mca_info_list *reclst) -{ - struct ia64_sal_result result; - struct mca_record_header *hdr; - struct mca_info *rec; - uint64_t seqnr; - size_t recsz; - - /* - * Don't try to get the state if we couldn't get the size of - * the state information previously. - */ - if (mca_info_size[type] == -1) - return; - - if (mca_info_block == 0) - return; - - while (1) { - mtx_lock_spin(&mca_info_block_lock); - result = ia64_sal_entry(SAL_GET_STATE_INFO, type, 0, - mca_info_block, 0, 0, 0, 0); - if (result.sal_status < 0) { - mtx_unlock_spin(&mca_info_block_lock); - break; - } - - hdr = (struct mca_record_header *)mca_info_block; - recsz = hdr->rh_length; - seqnr = hdr->rh_seqnr; - - mtx_unlock_spin(&mca_info_block_lock); - - rec = malloc(sizeof(struct mca_info) + recsz, M_MCA, - M_NOWAIT | M_ZERO); - if (rec == NULL) - /* XXX: Not sure what to do. */ - break; - - rec->mi_seqnr = seqnr; - rec->mi_cpuid = PCPU_GET(cpuid); - - mtx_lock_spin(&mca_info_block_lock); - - /* - * If the info block doesn't have our record anymore because - * we temporarily unlocked it, get it again from SAL. I assume - * that it's possible that we could get a different record. - * I expect this to happen in a SMP configuration where the - * record has been cleared by a different processor. So, if - * we get a different record we simply abort with this record - * and start over. - */ - if (seqnr != hdr->rh_seqnr) { - result = ia64_sal_entry(SAL_GET_STATE_INFO, type, 0, - mca_info_block, 0, 0, 0, 0); - if (seqnr != hdr->rh_seqnr) { - mtx_unlock_spin(&mca_info_block_lock); - free(rec, M_MCA); - continue; - } - } - - rec->mi_recsz = recsz; - bcopy((char*)mca_info_block, rec->mi_record, recsz); - - /* - * Clear the state so that we get any other records when - * they exist. - */ - result = ia64_sal_entry(SAL_CLEAR_STATE_INFO, type, 0, 0, 0, - 0, 0, 0); - - mtx_unlock_spin(&mca_info_block_lock); - - STAILQ_INSERT_TAIL(reclst, rec, mi_link); - } -} - -void -ia64_mca_save_state(int type) -{ - char name[64]; - struct mca_info_list reclst = STAILQ_HEAD_INITIALIZER(reclst); - struct mca_info *rec; - struct sysctl_oid *oid; - - ia64_mca_collect_state(type, &reclst); - - STAILQ_FOREACH(rec, &reclst, mi_link) { - sprintf(name, "%lu", rec->mi_seqnr); - oid = SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), - OID_AUTO, name, CTLFLAG_RW, NULL, name); - if (oid == NULL) - continue; - - mtx_lock(&mca_sysctl_lock); - if (mca_count > 0) { - if (rec->mi_seqnr < mca_first) - mca_first = rec->mi_seqnr; - else if (rec->mi_seqnr > mca_last) - mca_last = rec->mi_seqnr; - } else - mca_first = mca_last = rec->mi_seqnr; - mca_count++; - mtx_unlock(&mca_sysctl_lock); - - sprintf(name, "%u", rec->mi_cpuid); - SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(oid), rec->mi_cpuid, - name, CTLTYPE_OPAQUE | CTLFLAG_RD, rec->mi_record, - rec->mi_recsz, mca_sysctl_handler, "S,MCA", "MCA record"); - } -} - -static u_int -ia64_mca_intr(struct thread *td, u_int xiv, struct trapframe *tf) -{ - - if (xiv == mca_xiv_cmc) { - printf("MCA: corrected machine check (CMC) interrupt\n"); - return (0); - } - - return (0); -} - -void -ia64_mca_init_ap(void) -{ - - if (mca_xiv_cmc != 0) - ia64_set_cmcv(mca_xiv_cmc); -} - -void -ia64_mca_init(void) -{ - struct ia64_sal_result result; - uint64_t max_size; - char *p; - int i; - - /* - * Get the sizes of the state information we can get from SAL and - * allocate a common block (forgive me my Fortran :-) for use by - * support functions. We create a region 7 address to make it - * easy on the OS_MCA or OS_INIT handlers to get the state info - * under unreliable conditions. - */ - max_size = 0; - for (i = 0; i < SAL_INFO_TYPES; i++) { - result = ia64_sal_entry(SAL_GET_STATE_INFO_SIZE, i, 0, 0, 0, - 0, 0, 0); - if (result.sal_status == 0) { - mca_info_size[i] = result.sal_result[0]; - if (mca_info_size[i] > max_size) - max_size = mca_info_size[i]; - } else - mca_info_size[i] = -1; - } - max_size = round_page(max_size); - - p = (max_size) ? contigmalloc(max_size, M_TEMP, M_NOWAIT, 0ul, ~0ul, - PAGE_SIZE, 256*1024*1024) : NULL; - if (p != NULL) { - mca_info_block = IA64_PHYS_TO_RR7(ia64_tpa((u_int64_t)p)); - - if (bootverbose) - printf("MCA: allocated %ld bytes for state info.\n", - max_size); - } - - /* - * Initialize the spin lock used to protect the info block. When APs - * get launched, there's a short moment of contention, but in all other - * cases it's not a hot spot. I think it's possible to have the MCA - * handler be called on multiple processors at the same time, but that - * should be rare. On top of that, performance is not an issue when - * dealing with machine checks... - */ - mtx_init(&mca_info_block_lock, "MCA info lock", NULL, MTX_SPIN); - - /* - * Serialize sysctl operations with a sleep lock. Note that this - * implies that we update the sysctl tree in a context that allows - * sleeping. - */ - mtx_init(&mca_sysctl_lock, "MCA sysctl lock", NULL, MTX_DEF); - - /* - * Get and save any processor and platfom error records. Note that in - * a SMP configuration the processor records are for the BSP only. We - * let the APs get and save their own records when we wake them up. - */ - for (i = 0; i < SAL_INFO_TYPES; i++) - ia64_mca_save_state(i); - - /* - * Allocate a XIV for CMC interrupts, so that we can collect and save - * the corrected processor checks. - */ - mca_xiv_cmc = ia64_xiv_alloc(PI_SOFT, IA64_XIV_PLAT, ia64_mca_intr); - if (mca_xiv_cmc != 0) - ia64_set_cmcv(mca_xiv_cmc); - else - printf("MCA: CMC vector could not be allocated\n"); -} diff --git a/sys/ia64/ia64/mem.c b/sys/ia64/ia64/mem.c deleted file mode 100644 index 6faf437..0000000 --- a/sys/ia64/ia64/mem.c +++ /dev/null @@ -1,179 +0,0 @@ -/*- - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department, and code derived from software contributed to - * Berkeley by William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah $Hdr: mem.c 1.13 89/10/08$ - * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -/* - * Memory special file - */ - -#include <sys/param.h> -#include <sys/conf.h> -#include <sys/efi.h> -#include <sys/fcntl.h> -#include <sys/kernel.h> -#include <sys/malloc.h> -#include <sys/memrange.h> -#include <sys/systm.h> -#include <sys/uio.h> - -#include <vm/vm.h> -#include <vm/pmap.h> -#include <vm/vm_extern.h> - -#include <machine/memdev.h> - -struct mem_range_softc mem_range_softc; - -static int -mem_phys2virt(vm_offset_t offset, int prot, void **ptr, u_long *limit) -{ - struct efi_md *md; - - if (prot & ~(VM_PROT_READ | VM_PROT_WRITE)) - return (EPERM); - - md = efi_md_find(offset); - if (md == NULL) - return (EFAULT); - - if (md->md_type == EFI_MD_TYPE_BAD) - return (EIO); - - *ptr = (void *)((md->md_attr & EFI_MD_ATTR_WB) - ? IA64_PHYS_TO_RR7(offset) : IA64_PHYS_TO_RR6(offset)); - *limit = (md->md_pages * EFI_PAGE_SIZE) - (offset - md->md_phys); - return (0); -} - -/* ARGSUSED */ -int -memrw(struct cdev *dev, struct uio *uio, int flags) -{ - struct iovec *iov; - off_t ofs; - vm_offset_t addr; - void *ptr; - u_long limit; - int count, error, phys, rw; - - error = 0; - rw = (uio->uio_rw == UIO_READ) ? VM_PROT_READ : VM_PROT_WRITE; - - while (uio->uio_resid > 0 && !error) { - iov = uio->uio_iov; - if (iov->iov_len == 0) { - uio->uio_iov++; - uio->uio_iovcnt--; - if (uio->uio_iovcnt < 0) - panic("memrw"); - continue; - } - - ofs = uio->uio_offset; - - phys = (dev2unit(dev) == CDEV_MINOR_MEM) ? 1 : 0; - if (phys == 0 && ofs >= IA64_RR_BASE(6)) { - ofs = IA64_RR_MASK(ofs); - phys++; - } - - if (phys) { - error = mem_phys2virt(ofs, rw, &ptr, &limit); - if (error) - return (error); - - count = min(uio->uio_resid, limit); - error = uiomove(ptr, count, uio); - } else { - ptr = (void *)ofs; - count = iov->iov_len; - - /* - * Make sure that all of the pages are currently - * resident so that we don't create any zero-fill - * pages. - */ - limit = round_page(ofs + count); - addr = trunc_page(ofs); - if (addr < VM_MAXUSER_ADDRESS) - return (EINVAL); - for (; addr < limit; addr += PAGE_SIZE) { - if (pmap_kextract(addr) == 0) - return (EFAULT); - } - if (!kernacc(ptr, count, rw)) - return (EFAULT); - error = uiomove(ptr, count, uio); - } - /* else panic! */ - } - return (error); -} - -/* - * allow user processes to MMAP some memory sections - * instead of going through read/write - */ -int -memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, - int prot, vm_memattr_t *memattr) -{ - void *ptr; - u_long limit; - int error; - - /* - * /dev/mem is the only one that makes sense through this - * interface. For /dev/kmem any physaddr we return here - * could be transient and hence incorrect or invalid at - * a later time. - */ - if (dev2unit(dev) != CDEV_MINOR_MEM) - return (ENXIO); - - error = mem_phys2virt(offset, prot, &ptr, &limit); - if (error) - return (error); - - *paddr = offset; - *memattr = ((uintptr_t)ptr >= IA64_RR_BASE(7)) ? - VM_MEMATTR_WRITE_BACK : VM_MEMATTR_UNCACHEABLE; - return (0); -} diff --git a/sys/ia64/ia64/mp_locore.S b/sys/ia64/ia64/mp_locore.S deleted file mode 100644 index 75f75a9..0000000 --- a/sys/ia64/ia64/mp_locore.S +++ /dev/null @@ -1,275 +0,0 @@ -/*- - * Copyright (c) 2011 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <machine/asm.h> -#include <machine/ia64_cpu.h> -#include <machine/pte.h> -#include <assym.s> - -/* - * AP wake-up entry point. The handoff state is similar as for the BSP, - * as described on page 3-9 of the IPF SAL Specification. The difference - * lies in the contents of register b0. For APs this register holds the - * return address into the SAL rendezvous routine. - * - * Note that we're responsible for clearing the IRR bit by reading cr.ivr - * and issuing the EOI to the local SAPIC. - */ - .align 32 -ENTRY_NOPROFILE(os_boot_rendez,0) -{ .mmi - st8 [gp] = gp // trace = 0x00 - mov r8 = cr.ivr // clear IRR bit - add r2 = 8, gp - ;; -} -{ .mmi - srlz.d - mov cr.eoi = r0 // ACK the wake-up - add r3 = 16, gp - ;; -} -{ .mmi - srlz.d - rsm IA64_PSR_IC | IA64_PSR_I - mov r16 = (IA64_PBVM_RR << 8) | (IA64_PBVM_PAGE_SHIFT << 2) - ;; -} -{ .mmi - srlz.d - st8 [gp] = r2 // trace = 0x08 - dep.z r17 = IA64_PBVM_RR, 61, 3 - ;; -} -{ .mlx - mov rr[r17] = r16 - movl r18 = IA64_PBVM_PGTBL - ;; -} -{ .mmi - srlz.i - ;; - st8 [gp] = r3 // trace = 0x10 - nop 0 - ;; -} -{ .mmi - ld8 r16 = [r2], 16 // as_pgtbl_pte - ld8 r17 = [r3], 16 // as_pgtbl_itir - nop 0 - ;; -} -{ .mmi - mov cr.itir = r17 - mov cr.ifa = r18 - nop 0 - ;; -} -{ .mmi - srlz.d - ptr.d r18, r17 - nop 0 - ;; -} -{ .mmi - srlz.d - st8 [gp] = r2 // trace = 0x18 - mov r8 = r0 - ;; -} -{ .mmi - itr.d dtr[r8] = r16 - ;; - srlz.d - mov r9 = r0 - ;; -} -{ .mmi - ld8 r16 = [r2], 16 // as_text_va - st8 [gp] = r3 // trace = 0x20 - add r8 = 1, r8 - ;; -} -{ .mmi - ld8 r17 = [r3], 16 // as_text_pte - ld8 r18 = [r2], 16 // as_text_itir - nop 0 - ;; -} -{ .mmi - mov cr.ifa = r16 - mov cr.itir = r18 - nop 0 - ;; -} -{ .mmi - srlz.d - ptr.d r16, r18 - nop 0 - ;; -} -{ .mmi - srlz.d - st8 [gp] = r3 // trace = 0x30 - nop 0 - ;; -} -{ .mmi - itr.d dtr[r8] = r17 - ;; - srlz.d - nop 0 -} -{ .mmi - st8 [gp] = r2 // trace = 0x38 - ptr.i r16, r18 - add r8 = 1, r8 - ;; -} -{ .mmi - srlz.i - ;; - itr.i itr[r9] = r17 - nop 0 - ;; -} -{ .mmi - srlz.i - ;; - ld8 r16 = [r3], 16 // as_data_va - add r9 = 1, r9 - ;; -} -{ .mmi - st8 [gp] = r3 // trace = 0x40 - ld8 r17 = [r2], 16 // as_data_pte - nop 0 - ;; -} -{ .mmi - mov cr.ifa = r16 - ld8 r18 = [r3], 16 // as_data_itir - nop 0 - ;; -} -{ .mmi - mov cr.itir = r18 - ;; - srlz.d - nop 0 - ;; -} -{ .mmi - ptr.d r16, r18 - ;; - srlz.d - mov r19 = IA64_DCR_DEFAULT - ;; -} -{ .mmi - itr.d dtr[r8] = r17 - ;; - srlz.d - add r8 = 1, r8 - ;; -} -{ .mmi - st8 [gp] = r2 // trace = 0x48 - ;; - ld8 r16 = [r2], 16 // as_kstack - nop 0 -} -{ .mmi - ld8 r17 = [r3], 16 // as_kstack_top - mov cr.dcr = r19 - nop 0 - ;; -} -{ .mlx - srlz.i - movl r18 = IA64_PSR_BN | IA64_PSR_IT | IA64_PSR_DT | IA64_PSR_IC | \ - IA64_PSR_RT | IA64_PSR_DFH - ;; -} -{ .mlx - mov cr.ipsr = r18 - movl r19 = ia64_vector_table // set up IVT early - ;; -} -{ .mlx - mov cr.iva = r19 - movl r18 = 1f - ;; -} -{ .mmi - mov cr.iip = r18 - mov cr.ifs = r0 - nop 0 - ;; -} -{ .mmb - srlz.d - st8 [gp] = r2 // trace = 0x58 - rfi - ;; -} - - .align 32 -1: -{ .mlx - mov ar.bspstore = r16 - movl gp = __gp - ;; -} -{ .mmi - loadrs - add sp = -16, r17 - nop 0 - ;; -} -{ .mmi - mov ar.rsc = 3 - ;; - alloc r18 = ar.pfs, 0, 0, 0, 0 - ;; -} -{ .mib - nop 0 - nop 0 - br.call.sptk.few rp = ia64_ap_startup - ;; -} - /* NOT REACHED */ -9: -{ .mib - nop 0 - nop 0 - br.sptk 9b - ;; -} -END(os_boot_rendez) diff --git a/sys/ia64/ia64/mp_machdep.c b/sys/ia64/ia64/mp_machdep.c deleted file mode 100644 index 4e7ffb8..0000000 --- a/sys/ia64/ia64/mp_machdep.c +++ /dev/null @@ -1,543 +0,0 @@ -/*- - * Copyright (c) 2001-2005 Marcel Moolenaar - * Copyright (c) 2000 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_kstack_pages.h" -#include "opt_xtrace.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/ktr.h> -#include <sys/proc.h> -#include <sys/bus.h> -#include <sys/kthread.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/mutex.h> -#include <sys/kernel.h> -#include <sys/pcpu.h> -#include <sys/sched.h> -#include <sys/smp.h> -#include <sys/sysctl.h> -#include <sys/uuid.h> - -#include <machine/atomic.h> -#include <machine/bootinfo.h> -#include <machine/cpu.h> -#include <machine/fpu.h> -#include <machine/intr.h> -#include <machine/mca.h> -#include <machine/md_var.h> -#include <machine/pal.h> -#include <machine/pcb.h> -#include <machine/sal.h> -#include <machine/smp.h> - -#include <vm/vm.h> -#include <vm/pmap.h> -#include <vm/vm_extern.h> -#include <vm/vm_kern.h> - -extern uint64_t bdata[]; - -extern int smp_disabled; - -MALLOC_DEFINE(M_SMP, "SMP", "SMP related allocations"); - -void ia64_ap_startup(void); - -#define SAPIC_ID_GET_ID(x) ((u_int)((x) >> 8) & 0xff) -#define SAPIC_ID_GET_EID(x) ((u_int)(x) & 0xff) -#define SAPIC_ID_SET(id, eid) ((u_int)(((id) & 0xff) << 8) | ((eid) & 0xff)) - -/* State used to wake and bootstrap APs. */ -struct ia64_ap_state ia64_ap_state; - -int ia64_ipi_ast; -int ia64_ipi_hardclock; -int ia64_ipi_highfp; -int ia64_ipi_nmi; -int ia64_ipi_preempt; -int ia64_ipi_rndzvs; -int ia64_ipi_stop; - -static u_int -sz2shft(uint64_t sz) -{ - uint64_t s; - u_int shft; - - shft = 12; /* Start with 4K */ - s = 1 << shft; - while (s < sz) { - shft++; - s <<= 1; - } - return (shft); -} - -static u_int -ia64_ih_ast(struct thread *td, u_int xiv, struct trapframe *tf) -{ - - PCPU_INC(md.stats.pcs_nasts); - CTR1(KTR_SMP, "IPI_AST, cpuid=%d", PCPU_GET(cpuid)); - return (0); -} - -static u_int -ia64_ih_hardclock(struct thread *td, u_int xiv, struct trapframe *tf) -{ - struct trapframe *stf; - - PCPU_INC(md.stats.pcs_nhardclocks); - CTR1(KTR_SMP, "IPI_HARDCLOCK, cpuid=%d", PCPU_GET(cpuid)); - stf = td->td_intr_frame; - td->td_intr_frame = tf; - hardclockintr(); - td->td_intr_frame = stf; - return (0); -} - -static u_int -ia64_ih_highfp(struct thread *td, u_int xiv, struct trapframe *tf) -{ - - PCPU_INC(md.stats.pcs_nhighfps); - ia64_highfp_save_ipi(); - return (0); -} - -static u_int -ia64_ih_preempt(struct thread *td, u_int xiv, struct trapframe *tf) -{ - - PCPU_INC(md.stats.pcs_npreempts); - CTR1(KTR_SMP, "IPI_PREEMPT, cpuid=%d", PCPU_GET(cpuid)); - sched_preempt(curthread); - return (0); -} - -static u_int -ia64_ih_rndzvs(struct thread *td, u_int xiv, struct trapframe *tf) -{ - - PCPU_INC(md.stats.pcs_nrdvs); - CTR1(KTR_SMP, "IPI_RENDEZVOUS, cpuid=%d", PCPU_GET(cpuid)); - smp_rendezvous_action(); - return (0); -} - -static u_int -ia64_ih_stop(struct thread *td, u_int xiv, struct trapframe *tf) -{ - u_int cpuid; - - PCPU_INC(md.stats.pcs_nstops); - cpuid = PCPU_GET(cpuid); - - savectx(PCPU_PTR(md.pcb)); - - CPU_SET_ATOMIC(cpuid, &stopped_cpus); - while (!CPU_ISSET(cpuid, &started_cpus)) - cpu_spinwait(); - CPU_CLR_ATOMIC(cpuid, &started_cpus); - CPU_CLR_ATOMIC(cpuid, &stopped_cpus); - return (0); -} - -struct cpu_group * -cpu_topo(void) -{ - - return smp_topo_none(); -} - -static void -ia64_store_mca_state(void* arg) -{ - struct pcpu *pc = arg; - struct thread *td = curthread; - - /* - * ia64_mca_save_state() is CPU-sensitive, so bind ourself to our - * target CPU. - */ - thread_lock(td); - sched_bind(td, pc->pc_cpuid); - thread_unlock(td); - - ia64_mca_init_ap(); - - /* - * Get and save the CPU specific MCA records. Should we get the - * MCA state for each processor, or just the CMC state? - */ - ia64_mca_save_state(SAL_INFO_MCA); - ia64_mca_save_state(SAL_INFO_CMC); - - kproc_exit(0); -} - -void -ia64_ap_startup(void) -{ - uint64_t vhpt; - - ia64_ap_state.as_trace = 0x100; - - ia64_set_rr(IA64_RR_BASE(5), (5 << 8) | (PAGE_SHIFT << 2) | 1); - ia64_set_rr(IA64_RR_BASE(6), (6 << 8) | (LOG2_ID_PAGE_SIZE << 2)); - ia64_set_rr(IA64_RR_BASE(7), (7 << 8) | (LOG2_ID_PAGE_SIZE << 2)); - ia64_srlz_d(); - - pcpup = ia64_ap_state.as_pcpu; - ia64_set_k4((intptr_t)pcpup); - - ia64_ap_state.as_trace = 0x108; - - vhpt = PCPU_GET(md.vhpt); - map_vhpt(vhpt); - ia64_set_pta(vhpt + (1 << 8) + (pmap_vhpt_log2size << 2) + 1); - ia64_srlz_i(); - - ia64_ap_state.as_trace = 0x110; - - ia64_ap_state.as_awake = 1; - ia64_ap_state.as_delay = 0; - - map_pal_code(); - map_gateway_page(); - - ia64_set_fpsr(IA64_FPSR_DEFAULT); - -#ifdef XTRACE - ia64_xtrace_init_ap(ia64_ap_state.as_xtrace_buffer); -#endif - - /* Wait until it's time for us to be unleashed */ - while (ia64_ap_state.as_spin) - cpu_spinwait(); - - /* Initialize curthread. */ - KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); - PCPU_SET(curthread, PCPU_GET(idlethread)); - - pmap_invalidate_all(); - - atomic_add_int(&ia64_ap_state.as_awake, 1); - while (!smp_started) - cpu_spinwait(); - - CTR1(KTR_SMP, "SMP: cpu%d launched", PCPU_GET(cpuid)); - - cpu_initclocks(); - - ia64_set_tpr(0); - ia64_srlz_d(); - - sched_throw(NULL); - /* NOTREACHED */ -} - -void -cpu_mp_setmaxid(void) -{ - - /* - * Count the number of processors in the system by walking the ACPI - * tables. Note that we record the actual number of processors, even - * if this is larger than MAXCPU. We only activate MAXCPU processors. - */ - mp_ncpus = ia64_count_cpus(); - - /* - * Set the largest cpuid we're going to use. This is necessary for - * VM initialization. - */ - mp_maxid = min(mp_ncpus, MAXCPU) - 1; -} - -int -cpu_mp_probe(void) -{ - - /* - * If there's only 1 processor, or we don't have a wake-up vector, - * we're not going to enable SMP. Note that no wake-up vector can - * also mean that the wake-up mechanism is not supported. In this - * case we can have multiple processors, but we simply can't wake - * them up... - */ - return (mp_ncpus > 1 && ia64_ipi_wakeup != 0); -} - -void -cpu_mp_add(u_int acpi_id, u_int id, u_int eid) -{ - struct pcpu *pc; - void *dpcpu; - u_int cpuid, sapic_id; - - if (smp_disabled) - return; - - sapic_id = SAPIC_ID_SET(id, eid); - cpuid = (IA64_LID_GET_SAPIC_ID(ia64_get_lid()) == sapic_id) - ? 0 : smp_cpus++; - - KASSERT(!CPU_ISSET(cpuid, &all_cpus), - ("%s: cpu%d already in CPU map", __func__, acpi_id)); - - if (cpuid != 0) { - pc = (struct pcpu *)malloc(sizeof(*pc), M_SMP, M_WAITOK); - pcpu_init(pc, cpuid, sizeof(*pc)); - dpcpu = (void *)kmem_malloc(kernel_arena, DPCPU_SIZE, - M_WAITOK | M_ZERO); - dpcpu_init(dpcpu, cpuid); - } else - pc = pcpup; - - cpu_pcpu_setup(pc, acpi_id, sapic_id); - - CPU_SET(pc->pc_cpuid, &all_cpus); -} - -void -cpu_mp_announce() -{ - struct pcpu *pc; - uint32_t sapic_id; - int i; - - for (i = 0; i <= mp_maxid; i++) { - pc = pcpu_find(i); - if (pc != NULL) { - sapic_id = IA64_LID_GET_SAPIC_ID(pc->pc_md.lid); - printf("cpu%d: ACPI Id=%x, SAPIC Id=%x, SAPIC Eid=%x", - i, pc->pc_acpi_id, SAPIC_ID_GET_ID(sapic_id), - SAPIC_ID_GET_EID(sapic_id)); - if (i == 0) - printf(" (BSP)\n"); - else - printf("\n"); - } - } -} - -void -cpu_mp_start() -{ - struct ia64_sal_result result; - struct ia64_fdesc *fd; - struct pcpu *pc; - uintptr_t state; - u_char *stp; - - state = ia64_tpa((uintptr_t)&ia64_ap_state); - fd = (struct ia64_fdesc *) os_boot_rendez; - result = ia64_sal_entry(SAL_SET_VECTORS, SAL_OS_BOOT_RENDEZ, - ia64_tpa(fd->func), state, 0, 0, 0, 0); - - ia64_ap_state.as_pgtbl_pte = PTE_PRESENT | PTE_MA_WB | - PTE_ACCESSED | PTE_DIRTY | PTE_PL_KERN | PTE_AR_RW | - (bootinfo->bi_pbvm_pgtbl & PTE_PPN_MASK); - ia64_ap_state.as_pgtbl_itir = sz2shft(bootinfo->bi_pbvm_pgtblsz) << 2; - ia64_ap_state.as_text_va = IA64_PBVM_BASE; - ia64_ap_state.as_text_pte = PTE_PRESENT | PTE_MA_WB | - PTE_ACCESSED | PTE_DIRTY | PTE_PL_KERN | PTE_AR_RX | - (ia64_tpa(IA64_PBVM_BASE) & PTE_PPN_MASK); - ia64_ap_state.as_text_itir = bootinfo->bi_text_mapped << 2; - ia64_ap_state.as_data_va = (uintptr_t)bdata; - ia64_ap_state.as_data_pte = PTE_PRESENT | PTE_MA_WB | - PTE_ACCESSED | PTE_DIRTY | PTE_PL_KERN | PTE_AR_RW | - (ia64_tpa((uintptr_t)bdata) & PTE_PPN_MASK); - ia64_ap_state.as_data_itir = bootinfo->bi_data_mapped << 2; - - /* Keep 'em spinning until we unleash them... */ - ia64_ap_state.as_spin = 1; - - STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { - pc->pc_md.current_pmap = kernel_pmap; - /* The BSP is obviously running already. */ - if (pc->pc_cpuid == 0) { - pc->pc_md.awake = 1; - continue; - } - - ia64_ap_state.as_pcpu = pc; - pc->pc_md.vhpt = pmap_alloc_vhpt(); - if (pc->pc_md.vhpt == 0) { - printf("SMP: WARNING: unable to allocate VHPT" - " for cpu%d", pc->pc_cpuid); - continue; - } - - stp = malloc(KSTACK_PAGES * PAGE_SIZE, M_SMP, M_WAITOK); - ia64_ap_state.as_kstack = stp; - ia64_ap_state.as_kstack_top = stp + KSTACK_PAGES * PAGE_SIZE; - -#ifdef XTRACE - ia64_ap_state.as_xtrace_buffer = ia64_xtrace_alloc(); -#endif - - ia64_ap_state.as_trace = 0; - ia64_ap_state.as_delay = 2000; - ia64_ap_state.as_awake = 0; - - if (bootverbose) - printf("SMP: waking up cpu%d\n", pc->pc_cpuid); - - /* Here she goes... */ - ipi_send(pc, ia64_ipi_wakeup); - do { - DELAY(1000); - } while (--ia64_ap_state.as_delay > 0); - - pc->pc_md.awake = ia64_ap_state.as_awake; - - if (!ia64_ap_state.as_awake) { - printf("SMP: WARNING: cpu%d did not wake up (code " - "%#lx)\n", pc->pc_cpuid, - ia64_ap_state.as_trace - state); - } - } -} - -static void -cpu_mp_unleash(void *dummy) -{ - struct pcpu *pc; - int cpus; - - if (mp_ncpus <= 1) - return; - - /* Allocate XIVs for IPIs */ - ia64_ipi_ast = ia64_xiv_alloc(PI_DULL, IA64_XIV_IPI, ia64_ih_ast); - ia64_ipi_hardclock = ia64_xiv_alloc(PI_REALTIME, IA64_XIV_IPI, - ia64_ih_hardclock); - ia64_ipi_highfp = ia64_xiv_alloc(PI_AV, IA64_XIV_IPI, ia64_ih_highfp); - ia64_ipi_preempt = ia64_xiv_alloc(PI_SOFT, IA64_XIV_IPI, - ia64_ih_preempt); - ia64_ipi_rndzvs = ia64_xiv_alloc(PI_AV, IA64_XIV_IPI, ia64_ih_rndzvs); - ia64_ipi_stop = ia64_xiv_alloc(PI_REALTIME, IA64_XIV_IPI, ia64_ih_stop); - - /* Reserve the NMI vector for IPI_STOP_HARD if possible */ - ia64_ipi_nmi = (ia64_xiv_reserve(2, IA64_XIV_IPI, ia64_ih_stop) != 0) - ? ia64_ipi_stop : 0x400; /* DM=NMI, Vector=n/a */ - - cpus = 0; - smp_cpus = 0; - STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { - cpus++; - if (pc->pc_md.awake) { - kproc_create(ia64_store_mca_state, pc, NULL, 0, 0, - "mca %u", pc->pc_cpuid); - smp_cpus++; - } - } - - ia64_ap_state.as_awake = 1; - ia64_ap_state.as_spin = 0; - - while (ia64_ap_state.as_awake != smp_cpus) - cpu_spinwait(); - - if (smp_cpus != cpus || cpus != mp_ncpus) { - printf("SMP: %d CPUs found; %d CPUs usable; %d CPUs woken\n", - mp_ncpus, cpus, smp_cpus); - } - - /* XXX Atomic set operation? */ - smp_started = 1; - - /* - * Now that all CPUs are up and running, bind interrupts to each of - * them. - */ - ia64_bind_intr(); -} -SYSINIT(start_aps, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, cpu_mp_unleash, NULL); - -/* - * send an IPI to a set of cpus. - */ -void -ipi_selected(cpuset_t cpus, int ipi) -{ - struct pcpu *pc; - - STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { - if (CPU_ISSET(pc->pc_cpuid, &cpus)) - ipi_send(pc, ipi); - } -} - -/* - * send an IPI to a specific CPU. - */ -void -ipi_cpu(int cpu, u_int ipi) -{ - - ipi_send(cpuid_to_pcpu[cpu], ipi); -} - -/* - * send an IPI to all CPUs EXCEPT myself. - */ -void -ipi_all_but_self(int ipi) -{ - struct pcpu *pc; - - STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { - if (pc != pcpup) - ipi_send(pc, ipi); - } -} - -/* - * Send an IPI to the specified processor. - */ -void -ipi_send(struct pcpu *cpu, int xiv) -{ - u_int sapic_id; - - KASSERT(xiv != 0, ("ipi_send")); - - sapic_id = IA64_LID_GET_SAPIC_ID(cpu->pc_md.lid); - - ia64_mf(); - ia64_st8(&(ia64_pib->ib_ipi[sapic_id][0]), xiv); - ia64_mf_a(); - CTR3(KTR_SMP, "ipi_send(%p, %d): cpuid=%d", cpu, xiv, PCPU_GET(cpuid)); -} diff --git a/sys/ia64/ia64/nexus.c b/sys/ia64/ia64/nexus.c deleted file mode 100644 index a4d3e24..0000000 --- a/sys/ia64/ia64/nexus.c +++ /dev/null @@ -1,530 +0,0 @@ -/*- - * Copyright 1998 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that both the above copyright notice and this - * permission notice appear in all copies, that both the above - * copyright notice and this permission notice appear in all - * supporting documentation, and that the name of M.I.T. not be used - * in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. M.I.T. makes - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT - * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * This code implements a `root nexus' for Intel Architecture - * machines. The function of the root nexus is to serve as an - * attachment point for both processors and buses, and to manage - * resources which are common to all of them. In particular, - * this code implements the core resource managers for interrupt - * requests, DMA requests (which rightfully should be a part of the - * ISA code but it's easier to do it here for now), I/O port addresses, - * and I/O memory address space. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/bus.h> -#include <sys/clock.h> -#include <sys/efi.h> -#include <sys/kernel.h> -#include <sys/malloc.h> -#include <sys/module.h> -#include <machine/bus.h> -#include <sys/rman.h> -#include <sys/interrupt.h> -#include <sys/pcpu.h> - -#include <vm/vm.h> -#include <vm/pmap.h> - -#include <machine/intr.h> -#include <machine/pmap.h> -#include <machine/resource.h> -#include <machine/vmparam.h> - -#include <contrib/dev/acpica/include/acpi.h> - -#include <dev/acpica/acpivar.h> - -#include "clock_if.h" - -static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device"); -struct nexus_device { - struct resource_list nx_resources; -}; - -#define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) - -static struct rman irq_rman, port_rman, mem_rman; - -static int nexus_probe(device_t); -static int nexus_attach(device_t); -static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, u_int order, const char *name, - int unit); -static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); -static int nexus_adjust_resource(device_t, device_t, int, struct resource *, - u_long, u_long); -static int nexus_activate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_deactivate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_release_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_setup_intr(device_t, device_t, struct resource *, int flags, - driver_filter_t filter, void (*)(void *), void *, - void **); -static int nexus_teardown_intr(device_t, device_t, struct resource *, - void *); -static struct resource_list *nexus_get_reslist(device_t dev, device_t child); -static int nexus_set_resource(device_t, device_t, int, int, u_long, u_long); -static int nexus_get_resource(device_t, device_t, int, int, u_long *, - u_long *); -static void nexus_delete_resource(device_t, device_t, int, int); -static int nexus_bind_intr(device_t, device_t, struct resource *, int); -static int nexus_config_intr(device_t, int, enum intr_trigger, - enum intr_polarity); - -static int nexus_gettime(device_t, struct timespec *); -static int nexus_settime(device_t, struct timespec *); - -static device_method_t nexus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, nexus_probe), - DEVMETHOD(device_attach, nexus_attach), - DEVMETHOD(device_detach, bus_generic_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, nexus_print_child), - DEVMETHOD(bus_add_child, nexus_add_child), - DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), - DEVMETHOD(bus_adjust_resource, nexus_adjust_resource), - DEVMETHOD(bus_release_resource, nexus_release_resource), - DEVMETHOD(bus_activate_resource, nexus_activate_resource), - DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), - DEVMETHOD(bus_setup_intr, nexus_setup_intr), - DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), - DEVMETHOD(bus_get_resource_list, nexus_get_reslist), - DEVMETHOD(bus_set_resource, nexus_set_resource), - DEVMETHOD(bus_get_resource, nexus_get_resource), - DEVMETHOD(bus_delete_resource, nexus_delete_resource), - DEVMETHOD(bus_bind_intr, nexus_bind_intr), - DEVMETHOD(bus_config_intr, nexus_config_intr), - - /* Clock interface */ - DEVMETHOD(clock_gettime, nexus_gettime), - DEVMETHOD(clock_settime, nexus_settime), - - { 0, 0 } -}; - -static driver_t nexus_driver = { - "nexus", - nexus_methods, - 1, /* no softc */ -}; -static devclass_t nexus_devclass; - -DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0); - -static int -nexus_probe(device_t dev) -{ - - device_quiet(dev); /* suppress attach message for neatness */ - - irq_rman.rm_type = RMAN_ARRAY; - irq_rman.rm_descr = "Interrupt request lines"; - irq_rman.rm_start = 0; - irq_rman.rm_end = IA64_NXIVS - 1; - if (rman_init(&irq_rman) - || rman_manage_region(&irq_rman, - irq_rman.rm_start, irq_rman.rm_end)) - panic("nexus_probe irq_rman"); - - port_rman.rm_start = 0; - port_rman.rm_end = 0xffff; - port_rman.rm_type = RMAN_ARRAY; - port_rman.rm_descr = "I/O ports"; - if (rman_init(&port_rman) - || rman_manage_region(&port_rman, 0, 0xffff)) - panic("nexus_probe port_rman"); - - mem_rman.rm_start = 0; - mem_rman.rm_end = ~0ul; - mem_rman.rm_type = RMAN_ARRAY; - mem_rman.rm_descr = "I/O memory addresses"; - if (rman_init(&mem_rman) - || rman_manage_region(&mem_rman, 0, ~0)) - panic("nexus_probe mem_rman"); - - return bus_generic_probe(dev); -} - -static int -nexus_attach(device_t dev) -{ - - if (acpi_identify() == 0) - BUS_ADD_CHILD(dev, 10, "acpi", 0); - clock_register(dev, 1000); - bus_generic_attach(dev); - return 0; -} - -static int -nexus_print_child(device_t bus, device_t child) -{ - struct nexus_device *ndev = DEVTONX(child); - struct resource_list *rl = &ndev->nx_resources; - int retval = 0; - - retval += bus_print_child_header(bus, child); - retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#lx"); - retval += resource_list_print_type(rl, "iomem", SYS_RES_MEMORY, "%#lx"); - retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld"); - if (device_get_flags(child)) - retval += printf(" flags %#x", device_get_flags(child)); - retval += printf(" on motherboard\n"); /* XXX "motherboard", ick */ - - return (retval); -} - -static device_t -nexus_add_child(device_t bus, u_int order, const char *name, int unit) -{ - device_t child; - struct nexus_device *ndev; - - ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO); - if (!ndev) - return(0); - resource_list_init(&ndev->nx_resources); - - child = device_add_child_ordered(bus, order, name, unit); - - /* should we free this in nexus_child_detached? */ - device_set_ivars(child, ndev); - - return(child); -} - -static struct rman * -nexus_rman(int type) -{ - switch (type) { - case SYS_RES_IRQ: - return (&irq_rman); - case SYS_RES_IOPORT: - return (&port_rman); - case SYS_RES_MEMORY: - return (&mem_rman); - default: - return (NULL); - } -} - -/* - * Allocate a resource on behalf of child. NB: child is usually going to be a - * child of one of our descendants, not a direct child of nexus0. - * (Exceptions include npx.) - */ -static struct resource * -nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) -{ - struct nexus_device *ndev = DEVTONX(child); - struct resource *rv; - struct resource_list_entry *rle; - struct rman *rm; - int needactivate = flags & RF_ACTIVE; - - /* - * If this is an allocation of the "default" range for a given RID, and - * we know what the resources for this device are (ie. they aren't maintained - * by a child bus), then work out the start/end values. - */ - if ((start == 0UL) && (end == ~0UL) && (count == 1)) { - if (ndev == NULL) - return(NULL); - rle = resource_list_find(&ndev->nx_resources, type, *rid); - if (rle == NULL) - return(NULL); - start = rle->start; - end = rle->end; - count = rle->count; - } - - flags &= ~RF_ACTIVE; - rm = nexus_rman(type); - if (rm == NULL) - return (NULL); - - rv = rman_reserve_resource(rm, start, end, count, flags, child); - if (rv == 0) - return 0; - rman_set_rid(rv, *rid); - - if (needactivate) { - if (bus_activate_resource(child, type, *rid, rv)) { - rman_release_resource(rv); - return 0; - } - } - - return rv; -} - -static int -nexus_adjust_resource(device_t bus, device_t child, int type, - struct resource *r, u_long start, u_long end) -{ - struct rman *rm; - - rm = nexus_rman(type); - if (rm == NULL) - return (ENXIO); - if (!rman_is_region_manager(r, rm)) - return (EINVAL); - return (rman_adjust_resource(r, start, end)); -} - -static int -nexus_activate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - vm_paddr_t paddr; - void *vaddr; - - paddr = rman_get_start(r); - - switch (type) { - case SYS_RES_IOPORT: - rman_set_bustag(r, IA64_BUS_SPACE_IO); - rman_set_bushandle(r, paddr); - break; - case SYS_RES_MEMORY: - vaddr = pmap_mapdev(paddr, rman_get_size(r)); - rman_set_bustag(r, IA64_BUS_SPACE_MEM); - rman_set_bushandle(r, (bus_space_handle_t) vaddr); - rman_set_virtual(r, vaddr); - break; - } - return (rman_activate_resource(r)); -} - -static int -nexus_deactivate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - - return (rman_deactivate_resource(r)); -} - -static int -nexus_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - if (rman_get_flags(r) & RF_ACTIVE) { - int error = bus_deactivate_resource(child, type, rid, r); - if (error) - return error; - } - return (rman_release_resource(r)); -} - -/* - * Currently this uses the really grody interface from kern/kern_intr.c - * (which really doesn't belong in kern/anything.c). Eventually, all of - * the code in kern_intr.c and machdep_intr.c should get moved here, since - * this is going to be the official interface. - */ -static int -nexus_setup_intr(device_t bus, device_t child, struct resource *irq, - int flags, driver_filter_t filter, void (*ihand)(void *), - void *arg, void **cookiep) -{ - driver_t *driver; - int error; - - /* somebody tried to setup an irq that failed to allocate! */ - if (irq == NULL) - panic("nexus_setup_intr: NULL irq resource!"); - - *cookiep = 0; - if ((rman_get_flags(irq) & RF_SHAREABLE) == 0) - flags |= INTR_EXCL; - - driver = device_get_driver(child); - - /* - * We depend here on rman_activate_resource() being idempotent. - */ - error = rman_activate_resource(irq); - if (error) - return (error); - - error = ia64_setup_intr(device_get_nameunit(child), - rman_get_start(irq), filter, ihand, arg, flags, cookiep); - - return (error); -} - -static int -nexus_teardown_intr(device_t dev, device_t child, struct resource *ires, - void *cookie) -{ - - return (ia64_teardown_intr(cookie)); -} - -static struct resource_list * -nexus_get_reslist(device_t dev, device_t child) -{ - struct nexus_device *ndev = DEVTONX(child); - - return (&ndev->nx_resources); -} - -static int -nexus_set_resource(device_t dev, device_t child, int type, int rid, - u_long start, u_long count) -{ - struct nexus_device *ndev = DEVTONX(child); - struct resource_list *rl = &ndev->nx_resources; - - if (type == SYS_RES_IOPORT && start > (0x10000 - count)) { - /* - * Work around a firmware bug in the HP rx2660, where in ACPI - * an I/O port is really a memory mapped I/O address. The bug - * is in the GAS that describes the address and in particular - * the SpaceId field. The field should not say the address is - * an I/O port when it is in fact an I/O memory address. - */ - if (bootverbose) - printf("%s: invalid port range (%#lx-%#lx); " - "assuming I/O memory range.\n", __func__, start, - start + count - 1); - type = SYS_RES_MEMORY; - } - - /* XXX this should return a success/failure indicator */ - resource_list_add(rl, type, rid, start, start + count - 1, count); - return(0); -} - -static int -nexus_get_resource(device_t dev, device_t child, int type, int rid, u_long *startp, u_long *countp) -{ - struct nexus_device *ndev = DEVTONX(child); - struct resource_list *rl = &ndev->nx_resources; - struct resource_list_entry *rle; - - rle = resource_list_find(rl, type, rid); - device_printf(child, "type %d rid %d startp %p countp %p - got %p\n", - type, rid, startp, countp, rle); - if (!rle) - return(ENOENT); - if (startp) - *startp = rle->start; - if (countp) - *countp = rle->count; - return(0); -} - -static void -nexus_delete_resource(device_t dev, device_t child, int type, int rid) -{ - struct nexus_device *ndev = DEVTONX(child); - struct resource_list *rl = &ndev->nx_resources; - - resource_list_delete(rl, type, rid); -} - -static int -nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, - enum intr_polarity pol) -{ - - return (sapic_config_intr(irq, trig, pol)); -} - -static int -nexus_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu) -{ - struct pcpu *pc; - - pc = cpuid_to_pcpu[cpu]; - if (pc == NULL) - return (EINVAL); - return (sapic_bind_intr(rman_get_start(irq), pc)); -} - -static int -nexus_gettime(device_t dev, struct timespec *ts) -{ - struct clocktime ct; - struct efi_tm tm; - - efi_get_time(&tm); - - /* - * This code was written in 2005, so logically EFI cannot return - * a year smaller than that. Assume the EFI clock is out of whack - * in that case and reset the EFI clock. - */ - if (tm.tm_year < 2005) - return (EINVAL); - - ct.nsec = tm.tm_nsec; - ct.sec = tm.tm_sec; - ct.min = tm.tm_min; - ct.hour = tm.tm_hour; - ct.day = tm.tm_mday; - ct.mon = tm.tm_mon; - ct.year = tm.tm_year; - ct.dow = -1; - return (clock_ct_to_ts(&ct, ts)); -} - -static int -nexus_settime(device_t dev, struct timespec *ts) -{ - struct clocktime ct; - struct efi_tm tm; - - efi_get_time(&tm); - - clock_ts_to_ct(ts, &ct); - tm.tm_nsec = ts->tv_nsec; - tm.tm_sec = ct.sec; - tm.tm_min = ct.min; - tm.tm_hour = ct.hour; - tm.tm_year = ct.year; - tm.tm_mon = ct.mon; - tm.tm_mday = ct.day; - return (efi_set_time(&tm)); -} diff --git a/sys/ia64/ia64/pal.S b/sys/ia64/ia64/pal.S deleted file mode 100644 index 2e3f4cd..0000000 --- a/sys/ia64/ia64/pal.S +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * Copyright (c) 2000-2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <machine/asm.h> - - .data - .global ia64_pal_entry -ia64_pal_entry: .quad 0 - .text - -/* - * struct ia64_pal_result ia64_call_pal_static(u_int64_t proc, - * u_int64_t arg1, u_int64_t arg2, u_int64_t arg3) - */ -ENTRY(ia64_call_pal_static, 4) - - .regstk 4,4,0,0 -palret = loc0 -entry = loc1 -rpsave = loc2 -pfssave = loc3 - - alloc pfssave=ar.pfs,4,4,0,0 - ;; - mov rpsave=rp - movl entry=@gprel(ia64_pal_entry) - -1: mov palret=ip // for return address - ;; - add entry=entry,gp - add palret=2f-1b,palret // calculate return address - mov r28=in0 // procedure number - mov r29=in1 // copy arguments - mov r30=in2 - mov r31=in3 - ;; - ld8 entry=[entry] // read entry point - mov b0=palret - ;; - mov b6=entry - ;; - br.cond.sptk b6 // call into firmware - ;; -2: - mov rp=rpsave - mov ar.pfs=pfssave - ;; - br.ret.sptk rp - ;; -END(ia64_call_pal_static) - -/* - * struct ia64_pal_result ia64_call_pal_stacked(u_int64_t proc, - * u_int64_t arg1, u_int64_t arg2, u_int64_t arg3) - */ -ENTRY(ia64_call_pal_stacked, 4) - - .regstk 4,4,4,0 -entry = loc0 -rpsave = loc1 -pfssave = loc2 -psrsave = loc3 - - alloc pfssave=ar.pfs,4,4,4,0 - ;; - mov rpsave=rp - movl entry=@gprel(ia64_pal_entry) - ;; - add entry=entry,gp - mov psrsave=psr - mov r28=in0 // procedure number - mov out0=in0 - ;; - ld8 entry=[entry] // read entry point - mov out1=in1 // copy arguments - mov out2=in2 - mov out3=in3 - ;; - mov b6=entry - ;; - rsm psr.i // disable interrupts - ;; - br.call.sptk.many rp=b6 // call into firmware - mov psr.l=psrsave - mov rp=rpsave - mov ar.pfs=pfssave - ;; - srlz.d - br.ret.sptk rp - -END(ia64_call_pal_stacked) diff --git a/sys/ia64/ia64/physical.S b/sys/ia64/ia64/physical.S deleted file mode 100644 index 1dd5b36..0000000 --- a/sys/ia64/ia64/physical.S +++ /dev/null @@ -1,258 +0,0 @@ -/*- - * Copyright (c) 2011 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <machine/asm.h> -#include <machine/ia64_cpu.h> - - .text - -/* - * u_long ia64_efi_physical(ia64_efi_f, u_long, u_long, u_long, u_long) - * - * loc0 = ar.pfs - * loc1 = rp - * loc2 = psr - * loc3 = sp - * loc4 = bsp - * loc5 = gp - */ -ENTRY(ia64_efi_physical, 5) - .prologue - .regstk 5,6,4,0 - .save ar.pfs,loc0 - alloc loc0=ar.pfs,5,6,4,0 - ;; - .save rp,loc1 - mov loc1=rp - ;; - .body - mov loc2=psr // save psr - movl r16=IA64_PSR_I | IA64_PSR_IT | IA64_PSR_DT | \ - IA64_PSR_RT | IA64_PSR_DFL | IA64_PSR_DFH - ;; - andcm r14=loc2,r16 - movl r15=IA64_PSR_BN - ;; - rsm psr.i - mov r17=ar.rsc - or r16=r14,r15 // new psr - ;; - mov ar.rsc=0 - or loc2=loc2,r15 - ;; - flushrs - mov loc3=sp // save sp - ;; - mov loc4=ar.bsp // save ar.bsp - mov r18=ar.rnat - ;; - tpa r19=loc4 // new bspstore - mov loc5=gp - ;; - tpa r20=loc3 // new sp - ld8 r21=[in0],8 - ;; -1: - mov r14=ip - ;; - ld8 r22=[in0] - add r15=2f-1b,r14 - ;; - tpa r14=r15 - ;; - rsm psr.ic - ;; - srlz.i - ;; - mov cr.iip=r14 - mov cr.ifs=r0 - mov cr.ipsr=r16 - ;; - rfi -2: - mov ar.bspstore=r19 - mov sp=r20 - ;; - mov ar.rnat=r18 - mov ar.rsc=r17 - ;; - mov b6=r21 - mov gp=r22 - mov out0=in1 - mov out1=in2 - mov out2=in3 - mov out3=in4 - ;; - br.call.sptk.many rp=b6 - mov gp=loc5 - ;; - rsm psr.i | psr.ic - mov r16=ar.rsc - ;; - srlz.i - mov ar.rsc=0 - ;; - flushrs - ;; - mov r17=ar.rnat - movl r18=3f - ;; - mov cr.iip=r18 - mov cr.ifs=r0 - mov cr.ipsr=loc2 - ;; - rfi -3: - mov ar.bspstore=loc4 - mov sp=loc3 - ;; - mov ar.rnat=r17 - mov ar.rsc=r16 - ;; - mov rp=loc1 - mov ar.pfs=loc0 - ;; - br.ret.sptk.many rp -END(ia64_efi_physical) - - -/* - * ia64_pal_ret ia64_pal_physical(ia64_fw_f, u_long, u_long, u_long, u_long) - * - * loc0 = ar.pfs - * loc1 = rp - * loc2 = psr - * loc3 = sp - * loc4 = bsp - * loc5 = gp - */ -ENTRY(ia64_pal_physical, 5) - .prologue - .regstk 5,6,4,0 - .save ar.pfs,loc0 - alloc loc0=ar.pfs,5,6,4,0 - ;; - .save rp,loc1 - mov loc1=rp - ;; - .body - mov loc2=psr // save psr - movl r16=IA64_PSR_I | IA64_PSR_IT | IA64_PSR_DT | \ - IA64_PSR_RT | IA64_PSR_DFL | IA64_PSR_DFH - ;; - andcm r14=loc2,r16 - movl r15=IA64_PSR_BN - ;; - rsm psr.i - mov r17=ar.rsc - or r16=r14,r15 // new psr - ;; - mov ar.rsc=0 - or loc2=loc2,r15 - ;; - flushrs - mov loc3=sp // save sp - ;; - mov loc4=ar.bsp // save ar.bsp - mov r18=ar.rnat - ;; - mov loc5=gp - movl r14=kstack - ;; - tpa r19=r14 // new bspstore - movl r15=kstack_top - ;; - tpa r20=r15 // new sp - movl r21=ia64_pal_entry - ;; -1: - mov r14=ip - ld8 r22=[r21] - ;; - tpa r21=r22 - add r15=2f-1b,r14 - ;; - tpa r14=r15 - ;; - rsm psr.ic - ;; - srlz.i - ;; - mov cr.iip=r14 - mov cr.ifs=r0 - mov cr.ipsr=r16 - ;; - rfi -2: - mov ar.bspstore=r19 - add sp=-16,r20 - ;; - mov ar.rnat=r18 - mov ar.rsc=r17 - ;; - mov b6=r21 - mov out0=in0 - mov out1=in1 - mov out2=in2 - mov out3=in3 - // PAL static calls - mov r28=in0 - mov r29=in1 - mov r30=in2 - mov r31=in3 - br.call.sptk.many rp=b6 - mov gp=loc5 - ;; - rsm psr.i | psr.ic - mov r16=ar.rsc - ;; - srlz.i - mov ar.rsc=0 - ;; - flushrs - ;; - mov r17=ar.rnat - movl r18=3f - ;; - mov cr.iip=r18 - mov cr.ifs=r0 - mov cr.ipsr=loc2 - ;; - rfi -3: - mov ar.bspstore=loc4 - mov sp=loc3 - ;; - mov ar.rnat=r17 - mov ar.rsc=r16 - ;; - mov rp=loc1 - mov ar.pfs=loc0 - ;; - br.ret.sptk.many rp -END(ia64_pal_physical) diff --git a/sys/ia64/ia64/physmem.c b/sys/ia64/ia64/physmem.c deleted file mode 100644 index 11ee840..0000000 --- a/sys/ia64/ia64/physmem.c +++ /dev/null @@ -1,258 +0,0 @@ -/*- - * Copyright (c) 2012 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> - -#include <machine/md_var.h> -#include <machine/vmparam.h> - -static u_int phys_avail_segs; - -vm_paddr_t phys_avail[2 * VM_PHYSSEG_MAX + 2]; - -vm_paddr_t paddr_max; - -long realmem; - -static u_int -ia64_physmem_find(vm_paddr_t base, vm_paddr_t lim) -{ - u_int idx; - - for (idx = 0; phys_avail[idx + 1] != 0; idx += 2) { - if (phys_avail[idx] >= lim || - phys_avail[idx + 1] > base) - break; - } - return (idx); -} - -static int -ia64_physmem_insert(u_int idx, vm_paddr_t base, vm_paddr_t lim) -{ - u_int ridx; - - if (phys_avail_segs == VM_PHYSSEG_MAX) - return (ENOMEM); - - ridx = phys_avail_segs * 2; - while (idx < ridx) { - phys_avail[ridx + 1] = phys_avail[ridx - 1]; - phys_avail[ridx] = phys_avail[ridx - 2]; - ridx -= 2; - } - phys_avail[idx] = base; - phys_avail[idx + 1] = lim; - phys_avail_segs++; - return (0); -} - -static int -ia64_physmem_remove(u_int idx) -{ - - if (phys_avail_segs == 0) - return (ENOENT); - do { - phys_avail[idx] = phys_avail[idx + 2]; - phys_avail[idx + 1] = phys_avail[idx + 3]; - idx += 2; - } while (phys_avail[idx + 1] != 0); - phys_avail_segs--; - return (0); -} - -int -ia64_physmem_add(vm_paddr_t base, vm_size_t len) -{ - vm_paddr_t lim; - u_int idx; - - realmem += len; - - lim = base + len; - idx = ia64_physmem_find(base, lim); - if (phys_avail[idx] == lim) { - phys_avail[idx] = base; - return (0); - } - if (idx > 0 && phys_avail[idx - 1] == base) { - phys_avail[idx - 1] = lim; - return (0); - } - return (ia64_physmem_insert(idx, base, lim)); -} - -int -ia64_physmem_delete(vm_paddr_t base, vm_size_t len) -{ - vm_paddr_t lim; - u_int idx; - - lim = base + len; - idx = ia64_physmem_find(base, lim); - if (phys_avail[idx] >= lim || phys_avail[idx + 1] == 0) - return (ENOENT); - if (phys_avail[idx] < base && phys_avail[idx + 1] > lim) { - len = phys_avail[idx + 1] - lim; - phys_avail[idx + 1] = base; - base = lim; - lim = base + len; - return (ia64_physmem_insert(idx + 2, base, lim)); - } else { - if (phys_avail[idx] == base) - phys_avail[idx] = lim; - if (phys_avail[idx + 1] == lim) - phys_avail[idx + 1] = base; - if (phys_avail[idx] >= phys_avail[idx + 1]) - return (ia64_physmem_remove(idx)); - } - return (0); -} - -int -ia64_physmem_fini(void) -{ - vm_paddr_t base, lim, size; - u_int idx; - - idx = 0; - while (phys_avail[idx + 1] != 0) { - base = round_page(phys_avail[idx]); - lim = trunc_page(phys_avail[idx + 1]); - if (base < lim) { - phys_avail[idx] = base; - phys_avail[idx + 1] = lim; - size = lim - base; - physmem += atop(size); - paddr_max = lim; - idx += 2; - } else - ia64_physmem_remove(idx); - } - - /* - * Round realmem to a multple of 128MB. Hopefully that compensates - * for any loss of DRAM that isn't accounted for in the memory map. - * I'm thinking legacy BIOS or VGA here. In any case, it's ok if - * we got it wrong, because we don't actually use realmem. It's - * just for show... - */ - size = 1U << 27; - realmem = (realmem + size - 1) & ~(size - 1); - realmem = atop(realmem); - return (0); -} - -int -ia64_physmem_init(void) -{ - - /* Nothing to do just yet. */ - return (0); -} - -int -ia64_physmem_track(vm_paddr_t base, vm_size_t len) -{ - - realmem += len; - return (0); -} - -void * -ia64_physmem_alloc(vm_size_t len, vm_size_t align) -{ - vm_paddr_t base, lim, pa; - void *ptr; - u_int idx; - - if (phys_avail_segs == 0) - return (NULL); - - len = round_page(len); - - /* - * Try and allocate with least effort. - */ - idx = phys_avail_segs * 2; - while (idx > 0) { - idx -= 2; - base = phys_avail[idx]; - lim = phys_avail[idx + 1]; - - if (lim - base < len) - continue; - - /* First try from the end. */ - pa = lim - len; - if ((pa & (align - 1)) == 0) { - if (pa == base) - ia64_physmem_remove(idx); - else - phys_avail[idx + 1] = pa; - goto gotit; - } - - /* Try from the start next. */ - pa = base; - if ((pa & (align - 1)) == 0) { - if (pa + len == lim) - ia64_physmem_remove(idx); - else - phys_avail[idx] += len; - goto gotit; - } - } - - /* - * Find a good segment and split it up. - */ - idx = phys_avail_segs * 2; - while (idx > 0) { - idx -= 2; - base = phys_avail[idx]; - lim = phys_avail[idx + 1]; - - pa = (base + align - 1) & ~(align - 1); - if (pa + len <= lim) { - ia64_physmem_delete(pa, len); - goto gotit; - } - } - - /* Out of luck. */ - return (NULL); - - gotit: - ptr = (void *)IA64_PHYS_TO_RR7(pa); - bzero(ptr, len); - return (ptr); -} diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c deleted file mode 100644 index 307ccfd..0000000 --- a/sys/ia64/ia64/pmap.c +++ /dev/null @@ -1,2923 +0,0 @@ -/*- - * Copyright (c) 1991 Regents of the University of California. - * All rights reserved. - * Copyright (c) 1994 John S. Dyson - * All rights reserved. - * Copyright (c) 1994 David Greenman - * All rights reserved. - * Copyright (c) 1998,2000 Doug Rabson - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and William Jolitz of UUNET Technologies Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * from: i386 Id: pmap.c,v 1.193 1998/04/19 15:22:48 bde Exp - * with some ideas from NetBSD's alpha pmap - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_pmap.h" - -#include <sys/param.h> -#include <sys/efi.h> -#include <sys/kernel.h> -#include <sys/ktr.h> -#include <sys/lock.h> -#include <sys/mman.h> -#include <sys/mutex.h> -#include <sys/proc.h> -#include <sys/rwlock.h> -#include <sys/smp.h> -#include <sys/sysctl.h> -#include <sys/systm.h> - -#include <vm/vm.h> -#include <vm/vm_param.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> -#include <vm/vm_object.h> -#include <vm/vm_pageout.h> -#include <vm/uma.h> - -#include <machine/bootinfo.h> -#include <machine/md_var.h> -#include <machine/pal.h> - -/* - * Manages physical address maps. - * - * Since the information managed by this module is - * also stored by the logical address mapping module, - * this module may throw away valid virtual-to-physical - * mappings at almost any time. However, invalidations - * of virtual-to-physical mappings must be done as - * requested. - * - * In order to cope with hardware architectures which - * make virtual-to-physical map invalidates expensive, - * this module may delay invalidate or reduced protection - * operations until such time as they are actually - * necessary. This module is given full information as - * to which processors are currently using which maps, - * and to when physical maps must be made correct. - */ - -/* - * Following the Linux model, region IDs are allocated in groups of - * eight so that a single region ID can be used for as many RRs as we - * want by encoding the RR number into the low bits of the ID. - * - * We reserve region ID 0 for the kernel and allocate the remaining - * IDs for user pmaps. - * - * Region 0-3: User virtually mapped - * Region 4: PBVM and special mappings - * Region 5: Kernel virtual memory - * Region 6: Direct-mapped uncacheable - * Region 7: Direct-mapped cacheable - */ - -/* XXX move to a header. */ -extern uint64_t ia64_gateway_page[]; - -#if !defined(DIAGNOSTIC) -#define PMAP_INLINE __inline -#else -#define PMAP_INLINE -#endif - -#ifdef PV_STATS -#define PV_STAT(x) do { x ; } while (0) -#else -#define PV_STAT(x) do { } while (0) -#endif - -#define pmap_accessed(lpte) ((lpte)->pte & PTE_ACCESSED) -#define pmap_dirty(lpte) ((lpte)->pte & PTE_DIRTY) -#define pmap_exec(lpte) ((lpte)->pte & PTE_AR_RX) -#define pmap_managed(lpte) ((lpte)->pte & PTE_MANAGED) -#define pmap_ppn(lpte) ((lpte)->pte & PTE_PPN_MASK) -#define pmap_present(lpte) ((lpte)->pte & PTE_PRESENT) -#define pmap_prot(lpte) (((lpte)->pte & PTE_PROT_MASK) >> 56) -#define pmap_wired(lpte) ((lpte)->pte & PTE_WIRED) - -#define pmap_clear_accessed(lpte) (lpte)->pte &= ~PTE_ACCESSED -#define pmap_clear_dirty(lpte) (lpte)->pte &= ~PTE_DIRTY -#define pmap_clear_present(lpte) (lpte)->pte &= ~PTE_PRESENT -#define pmap_clear_wired(lpte) (lpte)->pte &= ~PTE_WIRED - -#define pmap_set_wired(lpte) (lpte)->pte |= PTE_WIRED - -/* - * Individual PV entries are stored in per-pmap chunks. This saves - * space by eliminating the need to record the pmap within every PV - * entry. - */ -#if PAGE_SIZE == 8192 -#define _NPCM 6 -#define _NPCPV 337 -#define _NPCS 2 -#elif PAGE_SIZE == 16384 -#define _NPCM 11 -#define _NPCPV 677 -#define _NPCS 1 -#endif -struct pv_chunk { - pmap_t pc_pmap; - TAILQ_ENTRY(pv_chunk) pc_list; - u_long pc_map[_NPCM]; /* bitmap; 1 = free */ - TAILQ_ENTRY(pv_chunk) pc_lru; - u_long pc_spare[_NPCS]; - struct pv_entry pc_pventry[_NPCPV]; -}; - -/* - * The VHPT bucket head structure. - */ -struct ia64_bucket { - uint64_t chain; - struct mtx mutex; - u_int length; -}; - -/* - * Statically allocated kernel pmap - */ -struct pmap kernel_pmap_store; - -vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */ -vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */ - -/* - * Kernel virtual memory management. - */ -static int nkpt; -extern struct ia64_lpte ***ia64_kptdir; - -#define KPTE_DIR0_INDEX(va) \ - (((va) >> (3*PAGE_SHIFT-8)) & ((1<<(PAGE_SHIFT-3))-1)) -#define KPTE_DIR1_INDEX(va) \ - (((va) >> (2*PAGE_SHIFT-5)) & ((1<<(PAGE_SHIFT-3))-1)) -#define KPTE_PTE_INDEX(va) \ - (((va) >> PAGE_SHIFT) & ((1<<(PAGE_SHIFT-5))-1)) -#define NKPTEPG (PAGE_SIZE / sizeof(struct ia64_lpte)) - -vm_offset_t kernel_vm_end; - -/* Defaults for ptc.e. */ -static uint64_t pmap_ptc_e_base = 0; -static uint32_t pmap_ptc_e_count1 = 1; -static uint32_t pmap_ptc_e_count2 = 1; -static uint32_t pmap_ptc_e_stride1 = 0; -static uint32_t pmap_ptc_e_stride2 = 0; - -struct mtx pmap_ptc_mutex; - -/* - * Data for the RID allocator - */ -static int pmap_ridcount; -static int pmap_rididx; -static int pmap_ridmapsz; -static int pmap_ridmax; -static uint64_t *pmap_ridmap; -struct mtx pmap_ridmutex; - -static struct rwlock_padalign pvh_global_lock; - -/* - * Data for the pv entry allocation mechanism - */ -static TAILQ_HEAD(pch, pv_chunk) pv_chunks = TAILQ_HEAD_INITIALIZER(pv_chunks); -static int pv_entry_count; - -/* - * Data for allocating PTEs for user processes. - */ -static uma_zone_t ptezone; - -/* - * Virtual Hash Page Table (VHPT) data. - */ -/* SYSCTL_DECL(_machdep); */ -static SYSCTL_NODE(_machdep, OID_AUTO, vhpt, CTLFLAG_RD, 0, ""); - -struct ia64_bucket *pmap_vhpt_bucket; - -int pmap_vhpt_nbuckets; -SYSCTL_INT(_machdep_vhpt, OID_AUTO, nbuckets, CTLFLAG_RD, - &pmap_vhpt_nbuckets, 0, ""); - -int pmap_vhpt_log2size; -SYSCTL_INT(_machdep_vhpt, OID_AUTO, log2size, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, - &pmap_vhpt_log2size, 0, ""); - -static int pmap_vhpt_inserts; -SYSCTL_INT(_machdep_vhpt, OID_AUTO, inserts, CTLFLAG_RD, - &pmap_vhpt_inserts, 0, ""); - -static int pmap_vhpt_population(SYSCTL_HANDLER_ARGS); -SYSCTL_PROC(_machdep_vhpt, OID_AUTO, population, CTLTYPE_INT | CTLFLAG_RD, - NULL, 0, pmap_vhpt_population, "I", ""); - -static struct ia64_lpte *pmap_find_vhpt(vm_offset_t va); - -static void free_pv_chunk(struct pv_chunk *pc); -static void free_pv_entry(pmap_t pmap, pv_entry_t pv); -static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try); -static vm_page_t pmap_pv_reclaim(pmap_t locked_pmap); - -static void pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, - vm_page_t m, vm_prot_t prot); -static void pmap_free_pte(struct ia64_lpte *pte, vm_offset_t va); -static int pmap_remove_pte(pmap_t pmap, struct ia64_lpte *pte, - vm_offset_t va, pv_entry_t pv, int freepte); -static int pmap_remove_vhpt(vm_offset_t va); -static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, - vm_page_t m); - -static void -pmap_initialize_vhpt(vm_offset_t vhpt) -{ - struct ia64_lpte *pte; - u_int i; - - pte = (struct ia64_lpte *)vhpt; - for (i = 0; i < pmap_vhpt_nbuckets; i++) { - pte[i].pte = 0; - pte[i].itir = 0; - pte[i].tag = 1UL << 63; /* Invalid tag */ - pte[i].chain = (uintptr_t)(pmap_vhpt_bucket + i); - } -} - -#ifdef SMP -vm_offset_t -pmap_alloc_vhpt(void) -{ - vm_offset_t vhpt; - vm_page_t m; - vm_size_t size; - - size = 1UL << pmap_vhpt_log2size; - m = vm_page_alloc_contig(NULL, 0, VM_ALLOC_SYSTEM | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED, atop(size), 0UL, ~0UL, size, 0UL, - VM_MEMATTR_DEFAULT); - if (m != NULL) { - vhpt = IA64_PHYS_TO_RR7(VM_PAGE_TO_PHYS(m)); - pmap_initialize_vhpt(vhpt); - return (vhpt); - } - return (0); -} -#endif - -/* - * Bootstrap the system enough to run with virtual memory. - */ -void -pmap_bootstrap() -{ - struct ia64_pal_result res; - vm_offset_t base; - size_t size; - int i, ridbits; - - /* - * Query the PAL Code to find the loop parameters for the - * ptc.e instruction. - */ - res = ia64_call_pal_static(PAL_PTCE_INFO, 0, 0, 0); - if (res.pal_status != 0) - panic("Can't configure ptc.e parameters"); - pmap_ptc_e_base = res.pal_result[0]; - pmap_ptc_e_count1 = res.pal_result[1] >> 32; - pmap_ptc_e_count2 = res.pal_result[1]; - pmap_ptc_e_stride1 = res.pal_result[2] >> 32; - pmap_ptc_e_stride2 = res.pal_result[2]; - if (bootverbose) - printf("ptc.e base=0x%lx, count1=%u, count2=%u, " - "stride1=0x%x, stride2=0x%x\n", - pmap_ptc_e_base, - pmap_ptc_e_count1, - pmap_ptc_e_count2, - pmap_ptc_e_stride1, - pmap_ptc_e_stride2); - - mtx_init(&pmap_ptc_mutex, "PTC.G mutex", NULL, MTX_SPIN); - - /* - * Setup RIDs. RIDs 0..7 are reserved for the kernel. - * - * We currently need at least 19 bits in the RID because PID_MAX - * can only be encoded in 17 bits and we need RIDs for 4 regions - * per process. With PID_MAX equalling 99999 this means that we - * need to be able to encode 399996 (=4*PID_MAX). - * The Itanium processor only has 18 bits and the architected - * minimum is exactly that. So, we cannot use a PID based scheme - * in those cases. Enter pmap_ridmap... - * We should avoid the map when running on a processor that has - * implemented enough bits. This means that we should pass the - * process/thread ID to pmap. This we currently don't do, so we - * use the map anyway. However, we don't want to allocate a map - * that is large enough to cover the range dictated by the number - * of bits in the RID, because that may result in a RID map of - * 2MB in size for a 24-bit RID. A 64KB map is enough. - * The bottomline: we create a 32KB map when the processor only - * implements 18 bits (or when we can't figure it out). Otherwise - * we create a 64KB map. - */ - res = ia64_call_pal_static(PAL_VM_SUMMARY, 0, 0, 0); - if (res.pal_status != 0) { - if (bootverbose) - printf("Can't read VM Summary - assuming 18 Region ID bits\n"); - ridbits = 18; /* guaranteed minimum */ - } else { - ridbits = (res.pal_result[1] >> 8) & 0xff; - if (bootverbose) - printf("Processor supports %d Region ID bits\n", - ridbits); - } - if (ridbits > 19) - ridbits = 19; - - pmap_ridmax = (1 << ridbits); - pmap_ridmapsz = pmap_ridmax / 64; - pmap_ridmap = ia64_physmem_alloc(pmap_ridmax / 8, PAGE_SIZE); - pmap_ridmap[0] |= 0xff; - pmap_rididx = 0; - pmap_ridcount = 8; - mtx_init(&pmap_ridmutex, "RID allocator lock", NULL, MTX_DEF); - - /* - * Allocate some memory for initial kernel 'page tables'. - */ - ia64_kptdir = ia64_physmem_alloc(PAGE_SIZE, PAGE_SIZE); - nkpt = 0; - kernel_vm_end = VM_INIT_KERNEL_ADDRESS; - - /* - * Determine a valid (mappable) VHPT size. - */ - TUNABLE_INT_FETCH("machdep.vhpt.log2size", &pmap_vhpt_log2size); - if (pmap_vhpt_log2size == 0) - pmap_vhpt_log2size = 20; - else if (pmap_vhpt_log2size < 16) - pmap_vhpt_log2size = 16; - else if (pmap_vhpt_log2size > 28) - pmap_vhpt_log2size = 28; - if (pmap_vhpt_log2size & 1) - pmap_vhpt_log2size--; - - size = 1UL << pmap_vhpt_log2size; - base = (uintptr_t)ia64_physmem_alloc(size, size); - if (base == 0) - panic("Unable to allocate VHPT"); - - PCPU_SET(md.vhpt, base); - if (bootverbose) - printf("VHPT: address=%#lx, size=%#lx\n", base, size); - - pmap_vhpt_nbuckets = size / sizeof(struct ia64_lpte); - pmap_vhpt_bucket = ia64_physmem_alloc(pmap_vhpt_nbuckets * - sizeof(struct ia64_bucket), PAGE_SIZE); - for (i = 0; i < pmap_vhpt_nbuckets; i++) { - /* Stolen memory is zeroed. */ - mtx_init(&pmap_vhpt_bucket[i].mutex, "VHPT bucket lock", NULL, - MTX_NOWITNESS | MTX_SPIN); - } - - pmap_initialize_vhpt(base); - map_vhpt(base); - ia64_set_pta(base + (1 << 8) + (pmap_vhpt_log2size << 2) + 1); - ia64_srlz_i(); - - virtual_avail = VM_INIT_KERNEL_ADDRESS; - virtual_end = VM_MAX_KERNEL_ADDRESS; - - /* - * Initialize the kernel pmap (which is statically allocated). - */ - PMAP_LOCK_INIT(kernel_pmap); - for (i = 0; i < IA64_VM_MINKERN_REGION; i++) - kernel_pmap->pm_rid[i] = 0; - TAILQ_INIT(&kernel_pmap->pm_pvchunk); - PCPU_SET(md.current_pmap, kernel_pmap); - - /* - * Initialize the global pv list lock. - */ - rw_init(&pvh_global_lock, "pmap pv global"); - - /* Region 5 is mapped via the VHPT. */ - ia64_set_rr(IA64_RR_BASE(5), (5 << 8) | (PAGE_SHIFT << 2) | 1); - - /* - * Clear out any random TLB entries left over from booting. - */ - pmap_invalidate_all(); - - map_gateway_page(); -} - -static int -pmap_vhpt_population(SYSCTL_HANDLER_ARGS) -{ - int count, error, i; - - count = 0; - for (i = 0; i < pmap_vhpt_nbuckets; i++) - count += pmap_vhpt_bucket[i].length; - - error = SYSCTL_OUT(req, &count, sizeof(count)); - return (error); -} - -vm_offset_t -pmap_page_to_va(vm_page_t m) -{ - vm_paddr_t pa; - vm_offset_t va; - - pa = VM_PAGE_TO_PHYS(m); - va = (m->md.memattr == VM_MEMATTR_UNCACHEABLE) ? IA64_PHYS_TO_RR6(pa) : - IA64_PHYS_TO_RR7(pa); - return (va); -} - -/* - * Initialize a vm_page's machine-dependent fields. - */ -void -pmap_page_init(vm_page_t m) -{ - - CTR2(KTR_PMAP, "%s(m=%p)", __func__, m); - - TAILQ_INIT(&m->md.pv_list); - m->md.memattr = VM_MEMATTR_DEFAULT; -} - -/* - * Initialize the pmap module. - * Called by vm_init, to initialize any structures that the pmap - * system needs to map virtual memory. - */ -void -pmap_init(void) -{ - - CTR1(KTR_PMAP, "%s()", __func__); - - ptezone = uma_zcreate("PT ENTRY", sizeof (struct ia64_lpte), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM|UMA_ZONE_NOFREE); -} - - -/*************************************************** - * Manipulate TLBs for a pmap - ***************************************************/ - -static void -pmap_invalidate_page(vm_offset_t va) -{ - struct ia64_lpte *pte; - struct pcpu *pc; - uint64_t tag; - u_int vhpt_ofs; - - critical_enter(); - - vhpt_ofs = ia64_thash(va) - PCPU_GET(md.vhpt); - tag = ia64_ttag(va); - STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { - pte = (struct ia64_lpte *)(pc->pc_md.vhpt + vhpt_ofs); - atomic_cmpset_64(&pte->tag, tag, 1UL << 63); - } - - mtx_lock_spin(&pmap_ptc_mutex); - - ia64_ptc_ga(va, PAGE_SHIFT << 2); - ia64_mf(); - ia64_srlz_i(); - - mtx_unlock_spin(&pmap_ptc_mutex); - - ia64_invala(); - - critical_exit(); -} - -void -pmap_invalidate_all(void) -{ - uint64_t addr; - int i, j; - - addr = pmap_ptc_e_base; - for (i = 0; i < pmap_ptc_e_count1; i++) { - for (j = 0; j < pmap_ptc_e_count2; j++) { - ia64_ptc_e(addr); - addr += pmap_ptc_e_stride2; - } - addr += pmap_ptc_e_stride1; - } - ia64_srlz_i(); -} - -static uint32_t -pmap_allocate_rid(void) -{ - uint64_t bit, bits; - int rid; - - mtx_lock(&pmap_ridmutex); - if (pmap_ridcount == pmap_ridmax) - panic("pmap_allocate_rid: All Region IDs used"); - - /* Find an index with a free bit. */ - while ((bits = pmap_ridmap[pmap_rididx]) == ~0UL) { - pmap_rididx++; - if (pmap_rididx == pmap_ridmapsz) - pmap_rididx = 0; - } - rid = pmap_rididx * 64; - - /* Find a free bit. */ - bit = 1UL; - while (bits & bit) { - rid++; - bit <<= 1; - } - - pmap_ridmap[pmap_rididx] |= bit; - pmap_ridcount++; - mtx_unlock(&pmap_ridmutex); - - return rid; -} - -static void -pmap_free_rid(uint32_t rid) -{ - uint64_t bit; - int idx; - - idx = rid / 64; - bit = ~(1UL << (rid & 63)); - - mtx_lock(&pmap_ridmutex); - pmap_ridmap[idx] &= bit; - pmap_ridcount--; - mtx_unlock(&pmap_ridmutex); -} - -/*************************************************** - * Page table page management routines..... - ***************************************************/ - -static void -pmap_pinit_common(pmap_t pmap) -{ - int i; - - for (i = 0; i < IA64_VM_MINKERN_REGION; i++) - pmap->pm_rid[i] = pmap_allocate_rid(); - TAILQ_INIT(&pmap->pm_pvchunk); - bzero(&pmap->pm_stats, sizeof pmap->pm_stats); -} - -void -pmap_pinit0(pmap_t pmap) -{ - - CTR2(KTR_PMAP, "%s(pm=%p)", __func__, pmap); - - PMAP_LOCK_INIT(pmap); - pmap_pinit_common(pmap); -} - -/* - * Initialize a preallocated and zeroed pmap structure, - * such as one in a vmspace structure. - */ -int -pmap_pinit(pmap_t pmap) -{ - - CTR2(KTR_PMAP, "%s(pm=%p)", __func__, pmap); - - pmap_pinit_common(pmap); - return (1); -} - -/*************************************************** - * Pmap allocation/deallocation routines. - ***************************************************/ - -/* - * Release any resources held by the given physical map. - * Called when a pmap initialized by pmap_pinit is being released. - * Should only be called if the map contains no valid mappings. - */ -void -pmap_release(pmap_t pmap) -{ - int i; - - CTR2(KTR_PMAP, "%s(pm=%p)", __func__, pmap); - - for (i = 0; i < IA64_VM_MINKERN_REGION; i++) - if (pmap->pm_rid[i]) - pmap_free_rid(pmap->pm_rid[i]); -} - -/* - * grow the number of kernel page table entries, if needed - */ -void -pmap_growkernel(vm_offset_t addr) -{ - struct ia64_lpte **dir1; - struct ia64_lpte *leaf; - vm_page_t nkpg; - - CTR2(KTR_PMAP, "%s(va=%#lx)", __func__, addr); - - while (kernel_vm_end <= addr) { - if (nkpt == PAGE_SIZE/8 + PAGE_SIZE*PAGE_SIZE/64) - panic("%s: out of kernel address space", __func__); - - dir1 = ia64_kptdir[KPTE_DIR0_INDEX(kernel_vm_end)]; - if (dir1 == NULL) { - nkpg = vm_page_alloc(NULL, nkpt++, - VM_ALLOC_NOOBJ|VM_ALLOC_INTERRUPT|VM_ALLOC_WIRED); - if (!nkpg) - panic("%s: cannot add dir. page", __func__); - - dir1 = (struct ia64_lpte **)pmap_page_to_va(nkpg); - bzero(dir1, PAGE_SIZE); - ia64_kptdir[KPTE_DIR0_INDEX(kernel_vm_end)] = dir1; - } - - nkpg = vm_page_alloc(NULL, nkpt++, - VM_ALLOC_NOOBJ|VM_ALLOC_INTERRUPT|VM_ALLOC_WIRED); - if (!nkpg) - panic("%s: cannot add PTE page", __func__); - - leaf = (struct ia64_lpte *)pmap_page_to_va(nkpg); - bzero(leaf, PAGE_SIZE); - dir1[KPTE_DIR1_INDEX(kernel_vm_end)] = leaf; - - kernel_vm_end += PAGE_SIZE * NKPTEPG; - } -} - -/*************************************************** - * page management routines. - ***************************************************/ - -CTASSERT(sizeof(struct pv_chunk) == PAGE_SIZE); - -static __inline struct pv_chunk * -pv_to_chunk(pv_entry_t pv) -{ - - return ((struct pv_chunk *)((uintptr_t)pv & ~(uintptr_t)PAGE_MASK)); -} - -#define PV_PMAP(pv) (pv_to_chunk(pv)->pc_pmap) - -#define PC_FREE_FULL 0xfffffffffffffffful -#define PC_FREE_PARTIAL \ - ((1UL << (_NPCPV - sizeof(u_long) * 8 * (_NPCM - 1))) - 1) - -#if PAGE_SIZE == 8192 -static const u_long pc_freemask[_NPCM] = { - PC_FREE_FULL, PC_FREE_FULL, PC_FREE_FULL, - PC_FREE_FULL, PC_FREE_FULL, PC_FREE_PARTIAL -}; -#elif PAGE_SIZE == 16384 -static const u_long pc_freemask[_NPCM] = { - PC_FREE_FULL, PC_FREE_FULL, PC_FREE_FULL, - PC_FREE_FULL, PC_FREE_FULL, PC_FREE_FULL, - PC_FREE_FULL, PC_FREE_FULL, PC_FREE_FULL, - PC_FREE_FULL, PC_FREE_PARTIAL -}; -#endif - -static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); - -SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0, - "Current number of pv entries"); - -#ifdef PV_STATS -static int pc_chunk_count, pc_chunk_allocs, pc_chunk_frees, pc_chunk_tryfail; - -SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_count, CTLFLAG_RD, &pc_chunk_count, 0, - "Current number of pv entry chunks"); -SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_allocs, CTLFLAG_RD, &pc_chunk_allocs, 0, - "Current number of pv entry chunks allocated"); -SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_frees, CTLFLAG_RD, &pc_chunk_frees, 0, - "Current number of pv entry chunks frees"); -SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_tryfail, CTLFLAG_RD, &pc_chunk_tryfail, 0, - "Number of times tried to get a chunk page but failed."); - -static long pv_entry_frees, pv_entry_allocs; -static int pv_entry_spare; - -SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_frees, CTLFLAG_RD, &pv_entry_frees, 0, - "Current number of pv entry frees"); -SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_allocs, CTLFLAG_RD, &pv_entry_allocs, 0, - "Current number of pv entry allocs"); -SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG_RD, &pv_entry_spare, 0, - "Current number of spare pv entries"); -#endif - -/* - * We are in a serious low memory condition. Resort to - * drastic measures to free some pages so we can allocate - * another pv entry chunk. - */ -static vm_page_t -pmap_pv_reclaim(pmap_t locked_pmap) -{ - struct pch newtail; - struct pv_chunk *pc; - struct ia64_lpte *pte; - pmap_t pmap; - pv_entry_t pv; - vm_offset_t va; - vm_page_t m, m_pc; - u_long inuse; - int bit, field, freed, idx; - - PMAP_LOCK_ASSERT(locked_pmap, MA_OWNED); - pmap = NULL; - m_pc = NULL; - TAILQ_INIT(&newtail); - while ((pc = TAILQ_FIRST(&pv_chunks)) != NULL) { - TAILQ_REMOVE(&pv_chunks, pc, pc_lru); - if (pmap != pc->pc_pmap) { - if (pmap != NULL) { - if (pmap != locked_pmap) { - pmap_switch(locked_pmap); - PMAP_UNLOCK(pmap); - } - } - pmap = pc->pc_pmap; - /* Avoid deadlock and lock recursion. */ - if (pmap > locked_pmap) - PMAP_LOCK(pmap); - else if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap)) { - pmap = NULL; - TAILQ_INSERT_TAIL(&newtail, pc, pc_lru); - continue; - } - pmap_switch(pmap); - } - - /* - * Destroy every non-wired, 8 KB page mapping in the chunk. - */ - freed = 0; - for (field = 0; field < _NPCM; field++) { - for (inuse = ~pc->pc_map[field] & pc_freemask[field]; - inuse != 0; inuse &= ~(1UL << bit)) { - bit = ffsl(inuse) - 1; - idx = field * sizeof(inuse) * NBBY + bit; - pv = &pc->pc_pventry[idx]; - va = pv->pv_va; - pte = pmap_find_vhpt(va); - KASSERT(pte != NULL, ("pte")); - if (pmap_wired(pte)) - continue; - pmap_remove_vhpt(va); - pmap_invalidate_page(va); - m = PHYS_TO_VM_PAGE(pmap_ppn(pte)); - if (pmap_accessed(pte)) - vm_page_aflag_set(m, PGA_REFERENCED); - if (pmap_dirty(pte)) - vm_page_dirty(m); - pmap_free_pte(pte, va); - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_aflag_clear(m, PGA_WRITEABLE); - pc->pc_map[field] |= 1UL << bit; - freed++; - } - } - if (freed == 0) { - TAILQ_INSERT_TAIL(&newtail, pc, pc_lru); - continue; - } - /* Every freed mapping is for a 8 KB page. */ - pmap->pm_stats.resident_count -= freed; - PV_STAT(pv_entry_frees += freed); - PV_STAT(pv_entry_spare += freed); - pv_entry_count -= freed; - TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); - for (field = 0; field < _NPCM; field++) - if (pc->pc_map[field] != pc_freemask[field]) { - TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, - pc_list); - TAILQ_INSERT_TAIL(&newtail, pc, pc_lru); - - /* - * One freed pv entry in locked_pmap is - * sufficient. - */ - if (pmap == locked_pmap) - goto out; - break; - } - if (field == _NPCM) { - PV_STAT(pv_entry_spare -= _NPCPV); - PV_STAT(pc_chunk_count--); - PV_STAT(pc_chunk_frees++); - /* Entire chunk is free; return it. */ - m_pc = PHYS_TO_VM_PAGE(IA64_RR_MASK((vm_offset_t)pc)); - break; - } - } -out: - TAILQ_CONCAT(&pv_chunks, &newtail, pc_lru); - if (pmap != NULL) { - if (pmap != locked_pmap) { - pmap_switch(locked_pmap); - PMAP_UNLOCK(pmap); - } - } - return (m_pc); -} - -/* - * free the pv_entry back to the free list - */ -static void -free_pv_entry(pmap_t pmap, pv_entry_t pv) -{ - struct pv_chunk *pc; - int bit, field, idx; - - rw_assert(&pvh_global_lock, RA_WLOCKED); - PMAP_LOCK_ASSERT(pmap, MA_OWNED); - PV_STAT(pv_entry_frees++); - PV_STAT(pv_entry_spare++); - pv_entry_count--; - pc = pv_to_chunk(pv); - idx = pv - &pc->pc_pventry[0]; - field = idx / (sizeof(u_long) * NBBY); - bit = idx % (sizeof(u_long) * NBBY); - pc->pc_map[field] |= 1ul << bit; - for (idx = 0; idx < _NPCM; idx++) - if (pc->pc_map[idx] != pc_freemask[idx]) { - /* - * 98% of the time, pc is already at the head of the - * list. If it isn't already, move it to the head. - */ - if (__predict_false(TAILQ_FIRST(&pmap->pm_pvchunk) != - pc)) { - TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); - TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, - pc_list); - } - return; - } - TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); - free_pv_chunk(pc); -} - -static void -free_pv_chunk(struct pv_chunk *pc) -{ - vm_page_t m; - - TAILQ_REMOVE(&pv_chunks, pc, pc_lru); - PV_STAT(pv_entry_spare -= _NPCPV); - PV_STAT(pc_chunk_count--); - PV_STAT(pc_chunk_frees++); - /* entire chunk is free, return it */ - m = PHYS_TO_VM_PAGE(IA64_RR_MASK((vm_offset_t)pc)); - vm_page_unwire(m, PQ_INACTIVE); - vm_page_free(m); -} - -/* - * get a new pv_entry, allocating a block from the system - * when needed. - */ -static pv_entry_t -get_pv_entry(pmap_t pmap, boolean_t try) -{ - struct pv_chunk *pc; - pv_entry_t pv; - vm_page_t m; - int bit, field, idx; - - rw_assert(&pvh_global_lock, RA_WLOCKED); - PMAP_LOCK_ASSERT(pmap, MA_OWNED); - PV_STAT(pv_entry_allocs++); - pv_entry_count++; -retry: - pc = TAILQ_FIRST(&pmap->pm_pvchunk); - if (pc != NULL) { - for (field = 0; field < _NPCM; field++) { - if (pc->pc_map[field]) { - bit = ffsl(pc->pc_map[field]) - 1; - break; - } - } - if (field < _NPCM) { - idx = field * sizeof(pc->pc_map[field]) * NBBY + bit; - pv = &pc->pc_pventry[idx]; - pc->pc_map[field] &= ~(1ul << bit); - /* If this was the last item, move it to tail */ - for (field = 0; field < _NPCM; field++) - if (pc->pc_map[field] != 0) { - PV_STAT(pv_entry_spare--); - return (pv); /* not full, return */ - } - TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); - TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); - PV_STAT(pv_entry_spare--); - return (pv); - } - } - /* No free items, allocate another chunk */ - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); - if (m == NULL) { - if (try) { - pv_entry_count--; - PV_STAT(pc_chunk_tryfail++); - return (NULL); - } - m = pmap_pv_reclaim(pmap); - if (m == NULL) - goto retry; - } - PV_STAT(pc_chunk_count++); - PV_STAT(pc_chunk_allocs++); - pc = (struct pv_chunk *)IA64_PHYS_TO_RR7(VM_PAGE_TO_PHYS(m)); - pc->pc_pmap = pmap; - pc->pc_map[0] = pc_freemask[0] & ~1ul; /* preallocated bit 0 */ - for (field = 1; field < _NPCM; field++) - pc->pc_map[field] = pc_freemask[field]; - TAILQ_INSERT_TAIL(&pv_chunks, pc, pc_lru); - pv = &pc->pc_pventry[0]; - TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); - PV_STAT(pv_entry_spare += _NPCPV - 1); - return (pv); -} - -/* - * Conditionally create a pv entry. - */ -static boolean_t -pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m) -{ - pv_entry_t pv; - - PMAP_LOCK_ASSERT(pmap, MA_OWNED); - rw_assert(&pvh_global_lock, RA_WLOCKED); - if ((pv = get_pv_entry(pmap, TRUE)) != NULL) { - pv->pv_va = va; - TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); - return (TRUE); - } else - return (FALSE); -} - -/* - * Add an ia64_lpte to the VHPT. - */ -static void -pmap_enter_vhpt(struct ia64_lpte *pte, vm_offset_t va) -{ - struct ia64_bucket *bckt; - struct ia64_lpte *vhpte; - uint64_t pte_pa; - - /* Can fault, so get it out of the way. */ - pte_pa = ia64_tpa((vm_offset_t)pte); - - vhpte = (struct ia64_lpte *)ia64_thash(va); - bckt = (struct ia64_bucket *)vhpte->chain; - - mtx_lock_spin(&bckt->mutex); - pte->chain = bckt->chain; - ia64_mf(); - bckt->chain = pte_pa; - - pmap_vhpt_inserts++; - bckt->length++; - mtx_unlock_spin(&bckt->mutex); -} - -/* - * Remove the ia64_lpte matching va from the VHPT. Return zero if it - * worked or an appropriate error code otherwise. - */ -static int -pmap_remove_vhpt(vm_offset_t va) -{ - struct ia64_bucket *bckt; - struct ia64_lpte *pte; - struct ia64_lpte *lpte; - struct ia64_lpte *vhpte; - uint64_t chain, tag; - - tag = ia64_ttag(va); - vhpte = (struct ia64_lpte *)ia64_thash(va); - bckt = (struct ia64_bucket *)vhpte->chain; - - lpte = NULL; - mtx_lock_spin(&bckt->mutex); - chain = bckt->chain; - pte = (struct ia64_lpte *)IA64_PHYS_TO_RR7(chain); - while (chain != 0 && pte->tag != tag) { - lpte = pte; - chain = pte->chain; - pte = (struct ia64_lpte *)IA64_PHYS_TO_RR7(chain); - } - if (chain == 0) { - mtx_unlock_spin(&bckt->mutex); - return (ENOENT); - } - - /* Snip this pv_entry out of the collision chain. */ - if (lpte == NULL) - bckt->chain = pte->chain; - else - lpte->chain = pte->chain; - ia64_mf(); - - bckt->length--; - mtx_unlock_spin(&bckt->mutex); - return (0); -} - -/* - * Find the ia64_lpte for the given va, if any. - */ -static struct ia64_lpte * -pmap_find_vhpt(vm_offset_t va) -{ - struct ia64_bucket *bckt; - struct ia64_lpte *pte; - uint64_t chain, tag; - - tag = ia64_ttag(va); - pte = (struct ia64_lpte *)ia64_thash(va); - bckt = (struct ia64_bucket *)pte->chain; - - mtx_lock_spin(&bckt->mutex); - chain = bckt->chain; - pte = (struct ia64_lpte *)IA64_PHYS_TO_RR7(chain); - while (chain != 0 && pte->tag != tag) { - chain = pte->chain; - pte = (struct ia64_lpte *)IA64_PHYS_TO_RR7(chain); - } - mtx_unlock_spin(&bckt->mutex); - return ((chain != 0) ? pte : NULL); -} - -/* - * Remove an entry from the list of managed mappings. - */ -static int -pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va, pv_entry_t pv) -{ - - rw_assert(&pvh_global_lock, RA_WLOCKED); - if (!pv) { - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - if (pmap == PV_PMAP(pv) && va == pv->pv_va) - break; - } - } - - if (pv) { - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_FIRST(&m->md.pv_list) == NULL) - vm_page_aflag_clear(m, PGA_WRITEABLE); - - free_pv_entry(pmap, pv); - return 0; - } else { - return ENOENT; - } -} - -/* - * Create a pv entry for page at pa for - * (pmap, va). - */ -static void -pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m) -{ - pv_entry_t pv; - - rw_assert(&pvh_global_lock, RA_WLOCKED); - pv = get_pv_entry(pmap, FALSE); - pv->pv_va = va; - TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); -} - -/* - * Routine: pmap_extract - * Function: - * Extract the physical page address associated - * with the given map/virtual_address pair. - */ -vm_paddr_t -pmap_extract(pmap_t pmap, vm_offset_t va) -{ - struct ia64_lpte *pte; - pmap_t oldpmap; - vm_paddr_t pa; - - CTR3(KTR_PMAP, "%s(pm=%p, va=%#lx)", __func__, pmap, va); - - pa = 0; - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - pte = pmap_find_vhpt(va); - if (pte != NULL && pmap_present(pte)) - pa = pmap_ppn(pte); - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); - return (pa); -} - -/* - * Routine: pmap_extract_and_hold - * Function: - * Atomically extract and hold the physical page - * with the given pmap and virtual address pair - * if that mapping permits the given protection. - */ -vm_page_t -pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot) -{ - struct ia64_lpte *pte; - pmap_t oldpmap; - vm_page_t m; - vm_paddr_t pa; - - CTR4(KTR_PMAP, "%s(pm=%p, va=%#lx, prot=%#x)", __func__, pmap, va, - prot); - - pa = 0; - m = NULL; - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); -retry: - pte = pmap_find_vhpt(va); - if (pte != NULL && pmap_present(pte) && - (pmap_prot(pte) & prot) == prot) { - m = PHYS_TO_VM_PAGE(pmap_ppn(pte)); - if (vm_page_pa_tryrelock(pmap, pmap_ppn(pte), &pa)) - goto retry; - vm_page_hold(m); - } - PA_UNLOCK_COND(pa); - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); - return (m); -} - -/*************************************************** - * Low level mapping routines..... - ***************************************************/ - -/* - * Find the kernel lpte for mapping the given virtual address, which - * must be in the part of region 5 which we can cover with our kernel - * 'page tables'. - */ -static struct ia64_lpte * -pmap_find_kpte(vm_offset_t va) -{ - struct ia64_lpte **dir1; - struct ia64_lpte *leaf; - - KASSERT((va >> 61) == 5, - ("kernel mapping 0x%lx not in region 5", va)); - KASSERT(va < kernel_vm_end, - ("kernel mapping 0x%lx out of range", va)); - - dir1 = ia64_kptdir[KPTE_DIR0_INDEX(va)]; - leaf = dir1[KPTE_DIR1_INDEX(va)]; - return (&leaf[KPTE_PTE_INDEX(va)]); -} - -/* - * Find a pte suitable for mapping a user-space address. If one exists - * in the VHPT, that one will be returned, otherwise a new pte is - * allocated. - */ -static struct ia64_lpte * -pmap_find_pte(vm_offset_t va) -{ - struct ia64_lpte *pte; - - if (va >= VM_MAXUSER_ADDRESS) - return pmap_find_kpte(va); - - pte = pmap_find_vhpt(va); - if (pte == NULL) { - pte = uma_zalloc(ptezone, M_NOWAIT | M_ZERO); - pte->tag = 1UL << 63; - } - return (pte); -} - -/* - * Free a pte which is now unused. This simply returns it to the zone - * allocator if it is a user mapping. For kernel mappings, clear the - * valid bit to make it clear that the mapping is not currently used. - */ -static void -pmap_free_pte(struct ia64_lpte *pte, vm_offset_t va) -{ - if (va < VM_MAXUSER_ADDRESS) - uma_zfree(ptezone, pte); - else - pmap_clear_present(pte); -} - -static PMAP_INLINE void -pmap_pte_prot(pmap_t pm, struct ia64_lpte *pte, vm_prot_t prot) -{ - static long prot2ar[4] = { - PTE_AR_R, /* VM_PROT_NONE */ - PTE_AR_RW, /* VM_PROT_WRITE */ - PTE_AR_RX|PTE_ED, /* VM_PROT_EXECUTE */ - PTE_AR_RWX|PTE_ED /* VM_PROT_WRITE|VM_PROT_EXECUTE */ - }; - - pte->pte &= ~(PTE_PROT_MASK | PTE_PL_MASK | PTE_AR_MASK | PTE_ED); - pte->pte |= (uint64_t)(prot & VM_PROT_ALL) << 56; - pte->pte |= (prot == VM_PROT_NONE || pm == kernel_pmap) - ? PTE_PL_KERN : PTE_PL_USER; - pte->pte |= prot2ar[(prot & VM_PROT_ALL) >> 1]; -} - -static PMAP_INLINE void -pmap_pte_attr(struct ia64_lpte *pte, vm_memattr_t ma) -{ - - pte->pte &= ~PTE_MA_MASK; - pte->pte |= (ma & PTE_MA_MASK); -} - -/* - * Set a pte to contain a valid mapping and enter it in the VHPT. If - * the pte was orginally valid, then its assumed to already be in the - * VHPT. - * This functions does not set the protection bits. It's expected - * that those have been set correctly prior to calling this function. - */ -static void -pmap_set_pte(struct ia64_lpte *pte, vm_offset_t va, vm_offset_t pa, - boolean_t wired, boolean_t managed) -{ - - pte->pte &= PTE_PROT_MASK | PTE_MA_MASK | PTE_PL_MASK | - PTE_AR_MASK | PTE_ED; - pte->pte |= PTE_PRESENT; - pte->pte |= (managed) ? PTE_MANAGED : (PTE_DIRTY | PTE_ACCESSED); - pte->pte |= (wired) ? PTE_WIRED : 0; - pte->pte |= pa & PTE_PPN_MASK; - - pte->itir = PAGE_SHIFT << 2; - - ia64_mf(); - - pte->tag = ia64_ttag(va); -} - -/* - * Remove the (possibly managed) mapping represented by pte from the - * given pmap. - */ -static int -pmap_remove_pte(pmap_t pmap, struct ia64_lpte *pte, vm_offset_t va, - pv_entry_t pv, int freepte) -{ - int error; - vm_page_t m; - - /* - * First remove from the VHPT. - */ - error = pmap_remove_vhpt(va); - KASSERT(error == 0, ("%s: pmap_remove_vhpt returned %d", - __func__, error)); - - pmap_invalidate_page(va); - - if (pmap_wired(pte)) - pmap->pm_stats.wired_count -= 1; - - pmap->pm_stats.resident_count -= 1; - if (pmap_managed(pte)) { - m = PHYS_TO_VM_PAGE(pmap_ppn(pte)); - if (pmap_dirty(pte)) - vm_page_dirty(m); - if (pmap_accessed(pte)) - vm_page_aflag_set(m, PGA_REFERENCED); - - error = pmap_remove_entry(pmap, m, va, pv); - } - if (freepte) - pmap_free_pte(pte, va); - - return (error); -} - -/* - * Extract the physical page address associated with a kernel - * virtual address. - */ -vm_paddr_t -pmap_kextract(vm_offset_t va) -{ - struct ia64_lpte *pte; - uint64_t *pbvm_pgtbl; - vm_paddr_t pa; - u_int idx; - - CTR2(KTR_PMAP, "%s(va=%#lx)", __func__, va); - - KASSERT(va >= VM_MAXUSER_ADDRESS, ("Must be kernel VA")); - - /* Regions 6 and 7 are direct mapped. */ - if (va >= IA64_RR_BASE(6)) { - pa = IA64_RR_MASK(va); - goto out; - } - - /* Region 5 is our KVA. Bail out if the VA is beyond our limits. */ - if (va >= kernel_vm_end) - goto err_out; - if (va >= VM_INIT_KERNEL_ADDRESS) { - pte = pmap_find_kpte(va); - pa = pmap_present(pte) ? pmap_ppn(pte) | (va & PAGE_MASK) : 0; - goto out; - } - - /* The PBVM page table. */ - if (va >= IA64_PBVM_PGTBL + bootinfo->bi_pbvm_pgtblsz) - goto err_out; - if (va >= IA64_PBVM_PGTBL) { - pa = (va - IA64_PBVM_PGTBL) + bootinfo->bi_pbvm_pgtbl; - goto out; - } - - /* The PBVM itself. */ - if (va >= IA64_PBVM_BASE) { - pbvm_pgtbl = (void *)IA64_PBVM_PGTBL; - idx = (va - IA64_PBVM_BASE) >> IA64_PBVM_PAGE_SHIFT; - if (idx >= (bootinfo->bi_pbvm_pgtblsz >> 3)) - goto err_out; - if ((pbvm_pgtbl[idx] & PTE_PRESENT) == 0) - goto err_out; - pa = (pbvm_pgtbl[idx] & PTE_PPN_MASK) + - (va & IA64_PBVM_PAGE_MASK); - goto out; - } - - err_out: - printf("XXX: %s: va=%#lx is invalid\n", __func__, va); - pa = 0; - /* FALLTHROUGH */ - - out: - return (pa); -} - -/* - * Add a list of wired pages to the kva this routine is only used for - * temporary kernel mappings that do not need to have page modification - * or references recorded. Note that old mappings are simply written - * over. The page is effectively wired, but it's customary to not have - * the PTE reflect that, nor update statistics. - */ -void -pmap_qenter(vm_offset_t va, vm_page_t *m, int count) -{ - struct ia64_lpte *pte; - int i; - - CTR4(KTR_PMAP, "%s(va=%#lx, m_p=%p, cnt=%d)", __func__, va, m, count); - - for (i = 0; i < count; i++) { - pte = pmap_find_kpte(va); - if (pmap_present(pte)) - pmap_invalidate_page(va); - else - pmap_enter_vhpt(pte, va); - pmap_pte_prot(kernel_pmap, pte, VM_PROT_ALL); - pmap_pte_attr(pte, m[i]->md.memattr); - pmap_set_pte(pte, va, VM_PAGE_TO_PHYS(m[i]), FALSE, FALSE); - va += PAGE_SIZE; - } -} - -/* - * this routine jerks page mappings from the - * kernel -- it is meant only for temporary mappings. - */ -void -pmap_qremove(vm_offset_t va, int count) -{ - struct ia64_lpte *pte; - int i; - - CTR3(KTR_PMAP, "%s(va=%#lx, cnt=%d)", __func__, va, count); - - for (i = 0; i < count; i++) { - pte = pmap_find_kpte(va); - if (pmap_present(pte)) { - pmap_remove_vhpt(va); - pmap_invalidate_page(va); - pmap_clear_present(pte); - } - va += PAGE_SIZE; - } -} - -/* - * Add a wired page to the kva. As for pmap_qenter(), it's customary - * to not have the PTE reflect that, nor update statistics. - */ -void -pmap_kenter(vm_offset_t va, vm_paddr_t pa) -{ - struct ia64_lpte *pte; - - CTR3(KTR_PMAP, "%s(va=%#lx, pa=%#lx)", __func__, va, pa); - - pte = pmap_find_kpte(va); - if (pmap_present(pte)) - pmap_invalidate_page(va); - else - pmap_enter_vhpt(pte, va); - pmap_pte_prot(kernel_pmap, pte, VM_PROT_ALL); - pmap_pte_attr(pte, VM_MEMATTR_DEFAULT); - pmap_set_pte(pte, va, pa, FALSE, FALSE); -} - -/* - * Remove a page from the kva - */ -void -pmap_kremove(vm_offset_t va) -{ - struct ia64_lpte *pte; - - CTR2(KTR_PMAP, "%s(va=%#lx)", __func__, va); - - pte = pmap_find_kpte(va); - if (pmap_present(pte)) { - pmap_remove_vhpt(va); - pmap_invalidate_page(va); - pmap_clear_present(pte); - } -} - -/* - * Used to map a range of physical addresses into kernel - * virtual address space. - * - * The value passed in '*virt' is a suggested virtual address for - * the mapping. Architectures which can support a direct-mapped - * physical to virtual region can return the appropriate address - * within that region, leaving '*virt' unchanged. Other - * architectures should map the pages starting at '*virt' and - * update '*virt' with the first usable address after the mapped - * region. - */ -vm_offset_t -pmap_map(vm_offset_t *virt, vm_offset_t start, vm_offset_t end, int prot) -{ - - CTR5(KTR_PMAP, "%s(va_p=%p, sva=%#lx, eva=%#lx, prot=%#x)", __func__, - virt, start, end, prot); - - return IA64_PHYS_TO_RR7(start); -} - -/* - * Remove the given range of addresses from the specified map. - * - * It is assumed that the start and end are properly - * rounded to the page size. - * - * Sparsely used ranges are inefficiently removed. The VHPT is - * probed for every page within the range. XXX - */ -void -pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) -{ - pmap_t oldpmap; - vm_offset_t va; - struct ia64_lpte *pte; - - CTR4(KTR_PMAP, "%s(pm=%p, sva=%#lx, eva=%#lx)", __func__, pmap, sva, - eva); - - /* - * Perform an unsynchronized read. This is, however, safe. - */ - if (pmap->pm_stats.resident_count == 0) - return; - - rw_wlock(&pvh_global_lock); - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - for (va = sva; va < eva; va += PAGE_SIZE) { - pte = pmap_find_vhpt(va); - if (pte != NULL) - pmap_remove_pte(pmap, pte, va, 0, 1); - } - rw_wunlock(&pvh_global_lock); - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); -} - -/* - * Routine: pmap_remove_all - * Function: - * Removes this physical page from - * all physical maps in which it resides. - * Reflects back modify bits to the pager. - * - * Notes: - * Original versions of this routine were very - * inefficient because they iteratively called - * pmap_remove (slow...) - */ -void -pmap_remove_all(vm_page_t m) -{ - pmap_t oldpmap; - pv_entry_t pv; - - CTR2(KTR_PMAP, "%s(m=%p)", __func__, m); - - KASSERT((m->oflags & VPO_UNMANAGED) == 0, - ("pmap_remove_all: page %p is not managed", m)); - rw_wlock(&pvh_global_lock); - while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { - struct ia64_lpte *pte; - pmap_t pmap = PV_PMAP(pv); - vm_offset_t va = pv->pv_va; - - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - pte = pmap_find_vhpt(va); - KASSERT(pte != NULL, ("pte")); - if (pmap_ppn(pte) != VM_PAGE_TO_PHYS(m)) - panic("pmap_remove_all: pv_table for %lx is inconsistent", VM_PAGE_TO_PHYS(m)); - pmap_remove_pte(pmap, pte, va, pv, 1); - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); - } - vm_page_aflag_clear(m, PGA_WRITEABLE); - rw_wunlock(&pvh_global_lock); -} - -/* - * Set the physical protection on the - * specified range of this map as requested. - */ -void -pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) -{ - pmap_t oldpmap; - struct ia64_lpte *pte; - - CTR5(KTR_PMAP, "%s(pm=%p, sva=%#lx, eva=%#lx, prot=%#x)", __func__, - pmap, sva, eva, prot); - - if ((prot & VM_PROT_READ) == VM_PROT_NONE) { - pmap_remove(pmap, sva, eva); - return; - } - - if ((prot & (VM_PROT_WRITE|VM_PROT_EXECUTE)) == - (VM_PROT_WRITE|VM_PROT_EXECUTE)) - return; - - if ((sva & PAGE_MASK) || (eva & PAGE_MASK)) - panic("pmap_protect: unaligned addresses"); - - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - for ( ; sva < eva; sva += PAGE_SIZE) { - /* If page is invalid, skip this page */ - pte = pmap_find_vhpt(sva); - if (pte == NULL) - continue; - - /* If there's no change, skip it too */ - if (pmap_prot(pte) == prot) - continue; - - if ((prot & VM_PROT_WRITE) == 0 && - pmap_managed(pte) && pmap_dirty(pte)) { - vm_paddr_t pa = pmap_ppn(pte); - vm_page_t m = PHYS_TO_VM_PAGE(pa); - - vm_page_dirty(m); - pmap_clear_dirty(pte); - } - - if (prot & VM_PROT_EXECUTE) - ia64_sync_icache(sva, PAGE_SIZE); - - pmap_pte_prot(pmap, pte, prot); - pmap_invalidate_page(sva); - } - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); -} - -/* - * Insert the given physical page (p) at - * the specified virtual address (v) in the - * target physical map with the protection requested. - * - * If specified, the page will be wired down, meaning - * that the related pte can not be reclaimed. - * - * NB: This is the only routine which MAY NOT lazy-evaluate - * or lose information. That is, this routine must actually - * insert this page into the given map NOW. - */ -void -pmap_enter(pmap_t pmap, vm_offset_t va, vm_prot_t access, vm_page_t m, - vm_prot_t prot, boolean_t wired) -{ - pmap_t oldpmap; - vm_offset_t pa; - vm_offset_t opa; - struct ia64_lpte origpte; - struct ia64_lpte *pte; - boolean_t icache_inval, managed; - - CTR6(KTR_PMAP, "pmap_enter(pm=%p, va=%#lx, acc=%#x, m=%p, prot=%#x, " - "wired=%u)", pmap, va, access, m, prot, wired); - - rw_wlock(&pvh_global_lock); - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - - va &= ~PAGE_MASK; - KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig")); - KASSERT((m->oflags & VPO_UNMANAGED) != 0 || vm_page_xbusied(m), - ("pmap_enter: page %p is not busy", m)); - - /* - * Find (or create) a pte for the given mapping. - */ - while ((pte = pmap_find_pte(va)) == NULL) { - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); - rw_wunlock(&pvh_global_lock); - VM_WAIT; - rw_wlock(&pvh_global_lock); - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - } - origpte = *pte; - if (!pmap_present(pte)) { - opa = ~0UL; - pmap_enter_vhpt(pte, va); - } else - opa = pmap_ppn(pte); - managed = FALSE; - pa = VM_PAGE_TO_PHYS(m); - - icache_inval = (prot & VM_PROT_EXECUTE) ? TRUE : FALSE; - - /* - * Mapping has not changed, must be protection or wiring change. - */ - if (opa == pa) { - /* - * Wiring change, just update stats. We don't worry about - * wiring PT pages as they remain resident as long as there - * are valid mappings in them. Hence, if a user page is wired, - * the PT page will be also. - */ - if (wired && !pmap_wired(&origpte)) - pmap->pm_stats.wired_count++; - else if (!wired && pmap_wired(&origpte)) - pmap->pm_stats.wired_count--; - - managed = (pmap_managed(&origpte)) ? TRUE : FALSE; - - /* - * We might be turning off write access to the page, - * so we go ahead and sense modify status. Otherwise, - * we can avoid I-cache invalidation if the page - * already allowed execution. - */ - if (managed && pmap_dirty(&origpte)) - vm_page_dirty(m); - else if (pmap_exec(&origpte)) - icache_inval = FALSE; - - pmap_invalidate_page(va); - goto validate; - } - - /* - * Mapping has changed, invalidate old range and fall - * through to handle validating new mapping. - */ - if (opa != ~0UL) { - pmap_remove_pte(pmap, pte, va, 0, 0); - pmap_enter_vhpt(pte, va); - } - - /* - * Enter on the PV list if part of our managed memory. - */ - if ((m->oflags & VPO_UNMANAGED) == 0) { - KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva, - ("pmap_enter: managed mapping within the clean submap")); - pmap_insert_entry(pmap, va, m); - managed = TRUE; - } - - /* - * Increment counters - */ - pmap->pm_stats.resident_count++; - if (wired) - pmap->pm_stats.wired_count++; - -validate: - - /* - * Now validate mapping with desired protection/wiring. This - * adds the pte to the VHPT if necessary. - */ - pmap_pte_prot(pmap, pte, prot); - pmap_pte_attr(pte, m->md.memattr); - pmap_set_pte(pte, va, pa, wired, managed); - - /* Invalidate the I-cache when needed. */ - if (icache_inval) - ia64_sync_icache(va, PAGE_SIZE); - - if ((prot & VM_PROT_WRITE) != 0 && managed) - vm_page_aflag_set(m, PGA_WRITEABLE); - rw_wunlock(&pvh_global_lock); - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); -} - -/* - * Maps a sequence of resident pages belonging to the same object. - * The sequence begins with the given page m_start. This page is - * mapped at the given virtual address start. Each subsequent page is - * mapped at a virtual address that is offset from start by the same - * amount as the page is offset from m_start within the object. The - * last page in the sequence is the page with the largest offset from - * m_start that can be mapped at a virtual address less than the given - * virtual address end. Not every virtual page between start and end - * is mapped; only those for which a resident page exists with the - * corresponding offset from m_start are mapped. - */ -void -pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end, - vm_page_t m_start, vm_prot_t prot) -{ - pmap_t oldpmap; - vm_page_t m; - vm_pindex_t diff, psize; - - CTR6(KTR_PMAP, "%s(pm=%p, sva=%#lx, eva=%#lx, m=%p, prot=%#x)", - __func__, pmap, start, end, m_start, prot); - - VM_OBJECT_ASSERT_LOCKED(m_start->object); - - psize = atop(end - start); - m = m_start; - rw_wlock(&pvh_global_lock); - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { - pmap_enter_quick_locked(pmap, start + ptoa(diff), m, prot); - m = TAILQ_NEXT(m, listq); - } - rw_wunlock(&pvh_global_lock); - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); -} - -/* - * this code makes some *MAJOR* assumptions: - * 1. Current pmap & pmap exists. - * 2. Not wired. - * 3. Read access. - * 4. No page table pages. - * but is *MUCH* faster than pmap_enter... - */ -void -pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) -{ - pmap_t oldpmap; - - CTR5(KTR_PMAP, "%s(pm=%p, va=%#lx, m=%p, prot=%#x)", __func__, pmap, - va, m, prot); - - rw_wlock(&pvh_global_lock); - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - pmap_enter_quick_locked(pmap, va, m, prot); - rw_wunlock(&pvh_global_lock); - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); -} - -static void -pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, - vm_prot_t prot) -{ - struct ia64_lpte *pte; - boolean_t managed; - - KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || - (m->oflags & VPO_UNMANAGED) != 0, - ("pmap_enter_quick_locked: managed mapping within the clean submap")); - rw_assert(&pvh_global_lock, RA_WLOCKED); - PMAP_LOCK_ASSERT(pmap, MA_OWNED); - - if ((pte = pmap_find_pte(va)) == NULL) - return; - - if (!pmap_present(pte)) { - /* Enter on the PV list if the page is managed. */ - if ((m->oflags & VPO_UNMANAGED) == 0) { - if (!pmap_try_insert_pv_entry(pmap, va, m)) { - pmap_free_pte(pte, va); - return; - } - managed = TRUE; - } else - managed = FALSE; - - /* Increment counters. */ - pmap->pm_stats.resident_count++; - - /* Initialise with R/O protection and enter into VHPT. */ - pmap_enter_vhpt(pte, va); - pmap_pte_prot(pmap, pte, - prot & (VM_PROT_READ | VM_PROT_EXECUTE)); - pmap_pte_attr(pte, m->md.memattr); - pmap_set_pte(pte, va, VM_PAGE_TO_PHYS(m), FALSE, managed); - - if (prot & VM_PROT_EXECUTE) - ia64_sync_icache(va, PAGE_SIZE); - } -} - -/* - * pmap_object_init_pt preloads the ptes for a given object - * into the specified pmap. This eliminates the blast of soft - * faults on process startup and immediately after an mmap. - */ -void -pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_object_t object, - vm_pindex_t pindex, vm_size_t size) -{ - - CTR6(KTR_PMAP, "%s(pm=%p, va=%#lx, obj=%p, idx=%lu, sz=%#lx)", - __func__, pmap, addr, object, pindex, size); - - VM_OBJECT_ASSERT_WLOCKED(object); - KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG, - ("pmap_object_init_pt: non-device object")); -} - -/* - * Routine: pmap_change_wiring - * Function: Change the wiring attribute for a map/virtual-address - * pair. - * In/out conditions: - * The mapping must already exist in the pmap. - */ -void -pmap_change_wiring(pmap_t pmap, vm_offset_t va, boolean_t wired) -{ - pmap_t oldpmap; - struct ia64_lpte *pte; - - CTR4(KTR_PMAP, "%s(pm=%p, va=%#lx, wired=%u)", __func__, pmap, va, - wired); - - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - - pte = pmap_find_vhpt(va); - KASSERT(pte != NULL, ("pte")); - if (wired && !pmap_wired(pte)) { - pmap->pm_stats.wired_count++; - pmap_set_wired(pte); - } else if (!wired && pmap_wired(pte)) { - pmap->pm_stats.wired_count--; - pmap_clear_wired(pte); - } - - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); -} - -/* - * Clear the wired attribute from the mappings for the specified range of - * addresses in the given pmap. Every valid mapping within that range - * must have the wired attribute set. In contrast, invalid mappings - * cannot have the wired attribute set, so they are ignored. - * - * The wired attribute of the page table entry is not a hardware feature, - * so there is no need to invalidate any TLB entries. - */ -void -pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) -{ - pmap_t oldpmap; - struct ia64_lpte *pte; - - CTR4(KTR_PMAP, "%s(%p, %#x, %#x)", __func__, pmap, sva, eva); - - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - for (; sva < eva; sva += PAGE_SIZE) { - pte = pmap_find_vhpt(sva); - if (pte == NULL) - continue; - if (!pmap_wired(pte)) - panic("pmap_unwire: pte %p isn't wired", pte); - pmap->pm_stats.wired_count--; - pmap_clear_wired(pte); - } - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); -} - -/* - * Copy the range specified by src_addr/len - * from the source map to the range dst_addr/len - * in the destination map. - * - * This routine is only advisory and need not do anything. - */ -void -pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_va, vm_size_t len, - vm_offset_t src_va) -{ - - CTR6(KTR_PMAP, "%s(dpm=%p, spm=%p, dva=%#lx, sz=%#lx, sva=%#lx)", - __func__, dst_pmap, src_pmap, dst_va, len, src_va); -} - -/* - * pmap_zero_page zeros the specified hardware page by - * mapping it into virtual memory and using bzero to clear - * its contents. - */ -void -pmap_zero_page(vm_page_t m) -{ - void *p; - - CTR2(KTR_PMAP, "%s(m=%p)", __func__, m); - - p = (void *)pmap_page_to_va(m); - bzero(p, PAGE_SIZE); -} - -/* - * pmap_zero_page_area zeros the specified hardware page by - * mapping it into virtual memory and using bzero to clear - * its contents. - * - * off and size must reside within a single page. - */ -void -pmap_zero_page_area(vm_page_t m, int off, int size) -{ - char *p; - - CTR4(KTR_PMAP, "%s(m=%p, ofs=%d, len=%d)", __func__, m, off, size); - - p = (void *)pmap_page_to_va(m); - bzero(p + off, size); -} - -/* - * pmap_zero_page_idle zeros the specified hardware page by - * mapping it into virtual memory and using bzero to clear - * its contents. This is for the vm_idlezero process. - */ -void -pmap_zero_page_idle(vm_page_t m) -{ - void *p; - - CTR2(KTR_PMAP, "%s(m=%p)", __func__, m); - - p = (void *)pmap_page_to_va(m); - bzero(p, PAGE_SIZE); -} - -/* - * pmap_copy_page copies the specified (machine independent) - * page by mapping the page into virtual memory and using - * bcopy to copy the page, one machine dependent page at a - * time. - */ -void -pmap_copy_page(vm_page_t msrc, vm_page_t mdst) -{ - void *dst, *src; - - CTR3(KTR_PMAP, "%s(sm=%p, dm=%p)", __func__, msrc, mdst); - - src = (void *)pmap_page_to_va(msrc); - dst = (void *)pmap_page_to_va(mdst); - bcopy(src, dst, PAGE_SIZE); -} - -void -pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], - vm_offset_t b_offset, int xfersize) -{ - void *a_cp, *b_cp; - vm_offset_t a_pg_offset, b_pg_offset; - int cnt; - - CTR6(KTR_PMAP, "%s(m0=%p, va0=%#lx, m1=%p, va1=%#lx, sz=%#x)", - __func__, ma, a_offset, mb, b_offset, xfersize); - - while (xfersize > 0) { - a_pg_offset = a_offset & PAGE_MASK; - cnt = min(xfersize, PAGE_SIZE - a_pg_offset); - a_cp = (char *)pmap_page_to_va(ma[a_offset >> PAGE_SHIFT]) + - a_pg_offset; - b_pg_offset = b_offset & PAGE_MASK; - cnt = min(cnt, PAGE_SIZE - b_pg_offset); - b_cp = (char *)pmap_page_to_va(mb[b_offset >> PAGE_SHIFT]) + - b_pg_offset; - bcopy(a_cp, b_cp, cnt); - a_offset += cnt; - b_offset += cnt; - xfersize -= cnt; - } -} - -/* - * Returns true if the pmap's pv is one of the first - * 16 pvs linked to from this page. This count may - * be changed upwards or downwards in the future; it - * is only necessary that true be returned for a small - * subset of pmaps for proper page aging. - */ -boolean_t -pmap_page_exists_quick(pmap_t pmap, vm_page_t m) -{ - pv_entry_t pv; - int loops = 0; - boolean_t rv; - - CTR3(KTR_PMAP, "%s(pm=%p, m=%p)", __func__, pmap, m); - - KASSERT((m->oflags & VPO_UNMANAGED) == 0, - ("pmap_page_exists_quick: page %p is not managed", m)); - rv = FALSE; - rw_wlock(&pvh_global_lock); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - if (PV_PMAP(pv) == pmap) { - rv = TRUE; - break; - } - loops++; - if (loops >= 16) - break; - } - rw_wunlock(&pvh_global_lock); - return (rv); -} - -/* - * pmap_page_wired_mappings: - * - * Return the number of managed mappings to the given physical page - * that are wired. - */ -int -pmap_page_wired_mappings(vm_page_t m) -{ - struct ia64_lpte *pte; - pmap_t oldpmap, pmap; - pv_entry_t pv; - int count; - - CTR2(KTR_PMAP, "%s(m=%p)", __func__, m); - - count = 0; - if ((m->oflags & VPO_UNMANAGED) != 0) - return (count); - rw_wlock(&pvh_global_lock); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - pmap = PV_PMAP(pv); - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - pte = pmap_find_vhpt(pv->pv_va); - KASSERT(pte != NULL, ("pte")); - if (pmap_wired(pte)) - count++; - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); - } - rw_wunlock(&pvh_global_lock); - return (count); -} - -/* - * Remove all pages from specified address space - * this aids process exit speeds. Also, this code - * is special cased for current process only, but - * can have the more generic (and slightly slower) - * mode enabled. This is much faster than pmap_remove - * in the case of running down an entire address space. - */ -void -pmap_remove_pages(pmap_t pmap) -{ - struct pv_chunk *pc, *npc; - struct ia64_lpte *pte; - pmap_t oldpmap; - pv_entry_t pv; - vm_offset_t va; - vm_page_t m; - u_long inuse, bitmask; - int allfree, bit, field, idx; - - CTR2(KTR_PMAP, "%s(pm=%p)", __func__, pmap); - - rw_wlock(&pvh_global_lock); - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - TAILQ_FOREACH_SAFE(pc, &pmap->pm_pvchunk, pc_list, npc) { - allfree = 1; - for (field = 0; field < _NPCM; field++) { - inuse = ~pc->pc_map[field] & pc_freemask[field]; - while (inuse != 0) { - bit = ffsl(inuse) - 1; - bitmask = 1UL << bit; - idx = field * sizeof(inuse) * NBBY + bit; - pv = &pc->pc_pventry[idx]; - inuse &= ~bitmask; - va = pv->pv_va; - pte = pmap_find_vhpt(va); - KASSERT(pte != NULL, ("pte")); - if (pmap_wired(pte)) { - allfree = 0; - continue; - } - pmap_remove_vhpt(va); - pmap_invalidate_page(va); - m = PHYS_TO_VM_PAGE(pmap_ppn(pte)); - if (pmap_dirty(pte)) - vm_page_dirty(m); - pmap_free_pte(pte, va); - /* Mark free */ - PV_STAT(pv_entry_frees++); - PV_STAT(pv_entry_spare++); - pv_entry_count--; - pc->pc_map[field] |= bitmask; - pmap->pm_stats.resident_count--; - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_aflag_clear(m, PGA_WRITEABLE); - } - } - if (allfree) { - TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); - free_pv_chunk(pc); - } - } - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); - rw_wunlock(&pvh_global_lock); -} - -/* - * pmap_ts_referenced: - * - * Return a count of reference bits for a page, clearing those bits. - * It is not necessary for every reference bit to be cleared, but it - * is necessary that 0 only be returned when there are truly no - * reference bits set. - * - * XXX: The exact number of bits to check and clear is a matter that - * should be tested and standardized at some point in the future for - * optimal aging of shared pages. - */ -int -pmap_ts_referenced(vm_page_t m) -{ - struct ia64_lpte *pte; - pmap_t oldpmap, pmap; - pv_entry_t pv; - int count = 0; - - CTR2(KTR_PMAP, "%s(m=%p)", __func__, m); - - KASSERT((m->oflags & VPO_UNMANAGED) == 0, - ("pmap_ts_referenced: page %p is not managed", m)); - rw_wlock(&pvh_global_lock); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - pmap = PV_PMAP(pv); - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - pte = pmap_find_vhpt(pv->pv_va); - KASSERT(pte != NULL, ("pte")); - if (pmap_accessed(pte)) { - count++; - pmap_clear_accessed(pte); - pmap_invalidate_page(pv->pv_va); - } - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); - } - rw_wunlock(&pvh_global_lock); - return (count); -} - -/* - * pmap_is_modified: - * - * Return whether or not the specified physical page was modified - * in any physical maps. - */ -boolean_t -pmap_is_modified(vm_page_t m) -{ - struct ia64_lpte *pte; - pmap_t oldpmap, pmap; - pv_entry_t pv; - boolean_t rv; - - CTR2(KTR_PMAP, "%s(m=%p)", __func__, m); - - KASSERT((m->oflags & VPO_UNMANAGED) == 0, - ("pmap_is_modified: page %p is not managed", m)); - rv = FALSE; - - /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PGA_WRITEABLE - * is clear, no PTEs can be dirty. - */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) - return (rv); - rw_wlock(&pvh_global_lock); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - pmap = PV_PMAP(pv); - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - pte = pmap_find_vhpt(pv->pv_va); - pmap_switch(oldpmap); - KASSERT(pte != NULL, ("pte")); - rv = pmap_dirty(pte) ? TRUE : FALSE; - PMAP_UNLOCK(pmap); - if (rv) - break; - } - rw_wunlock(&pvh_global_lock); - return (rv); -} - -/* - * pmap_is_prefaultable: - * - * Return whether or not the specified virtual address is elgible - * for prefault. - */ -boolean_t -pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr) -{ - struct ia64_lpte *pte; - - CTR3(KTR_PMAP, "%s(pm=%p, va=%#lx)", __func__, pmap, addr); - - pte = pmap_find_vhpt(addr); - if (pte != NULL && pmap_present(pte)) - return (FALSE); - return (TRUE); -} - -/* - * pmap_is_referenced: - * - * Return whether or not the specified physical page was referenced - * in any physical maps. - */ -boolean_t -pmap_is_referenced(vm_page_t m) -{ - struct ia64_lpte *pte; - pmap_t oldpmap, pmap; - pv_entry_t pv; - boolean_t rv; - - CTR2(KTR_PMAP, "%s(m=%p)", __func__, m); - - KASSERT((m->oflags & VPO_UNMANAGED) == 0, - ("pmap_is_referenced: page %p is not managed", m)); - rv = FALSE; - rw_wlock(&pvh_global_lock); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - pmap = PV_PMAP(pv); - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - pte = pmap_find_vhpt(pv->pv_va); - pmap_switch(oldpmap); - KASSERT(pte != NULL, ("pte")); - rv = pmap_accessed(pte) ? TRUE : FALSE; - PMAP_UNLOCK(pmap); - if (rv) - break; - } - rw_wunlock(&pvh_global_lock); - return (rv); -} - -/* - * Apply the given advice to the specified range of addresses within the - * given pmap. Depending on the advice, clear the referenced and/or - * modified flags in each mapping and set the mapped page's dirty field. - */ -void -pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int advice) -{ - struct ia64_lpte *pte; - pmap_t oldpmap; - vm_page_t m; - - CTR5(KTR_PMAP, "%s(pm=%p, sva=%#lx, eva=%#lx, adv=%d)", __func__, - pmap, sva, eva, advice); - - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - for (; sva < eva; sva += PAGE_SIZE) { - /* If page is invalid, skip this page. */ - pte = pmap_find_vhpt(sva); - if (pte == NULL) - continue; - - /* If it isn't managed, skip it too. */ - if (!pmap_managed(pte)) - continue; - - /* Clear its modified and referenced bits. */ - if (pmap_dirty(pte)) { - if (advice == MADV_DONTNEED) { - /* - * Future calls to pmap_is_modified() can be - * avoided by making the page dirty now. - */ - m = PHYS_TO_VM_PAGE(pmap_ppn(pte)); - vm_page_dirty(m); - } - pmap_clear_dirty(pte); - } else if (!pmap_accessed(pte)) - continue; - pmap_clear_accessed(pte); - pmap_invalidate_page(sva); - } - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); -} - -/* - * Clear the modify bits on the specified physical page. - */ -void -pmap_clear_modify(vm_page_t m) -{ - struct ia64_lpte *pte; - pmap_t oldpmap, pmap; - pv_entry_t pv; - - CTR2(KTR_PMAP, "%s(m=%p)", __func__, m); - - KASSERT((m->oflags & VPO_UNMANAGED) == 0, - ("pmap_clear_modify: page %p is not managed", m)); - VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT(!vm_page_xbusied(m), - ("pmap_clear_modify: page %p is exclusive busied", m)); - - /* - * If the page is not PGA_WRITEABLE, then no PTEs can be modified. - * If the object containing the page is locked and the page is not - * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. - */ - if ((m->aflags & PGA_WRITEABLE) == 0) - return; - rw_wlock(&pvh_global_lock); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - pmap = PV_PMAP(pv); - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - pte = pmap_find_vhpt(pv->pv_va); - KASSERT(pte != NULL, ("pte")); - if (pmap_dirty(pte)) { - pmap_clear_dirty(pte); - pmap_invalidate_page(pv->pv_va); - } - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); - } - rw_wunlock(&pvh_global_lock); -} - -/* - * Clear the write and modified bits in each of the given page's mappings. - */ -void -pmap_remove_write(vm_page_t m) -{ - struct ia64_lpte *pte; - pmap_t oldpmap, pmap; - pv_entry_t pv; - vm_prot_t prot; - - CTR2(KTR_PMAP, "%s(m=%p)", __func__, m); - - KASSERT((m->oflags & VPO_UNMANAGED) == 0, - ("pmap_remove_write: page %p is not managed", m)); - - /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * set by another thread while the object is locked. Thus, - * if PGA_WRITEABLE is clear, no page table entries need updating. - */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) - return; - rw_wlock(&pvh_global_lock); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - pmap = PV_PMAP(pv); - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - pte = pmap_find_vhpt(pv->pv_va); - KASSERT(pte != NULL, ("pte")); - prot = pmap_prot(pte); - if ((prot & VM_PROT_WRITE) != 0) { - if (pmap_dirty(pte)) { - vm_page_dirty(m); - pmap_clear_dirty(pte); - } - prot &= ~VM_PROT_WRITE; - pmap_pte_prot(pmap, pte, prot); - pmap_pte_attr(pte, m->md.memattr); - pmap_invalidate_page(pv->pv_va); - } - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); - } - vm_page_aflag_clear(m, PGA_WRITEABLE); - rw_wunlock(&pvh_global_lock); -} - -vm_offset_t -pmap_mapdev_priv(vm_paddr_t pa, vm_size_t sz, vm_memattr_t attr) -{ - static vm_offset_t last_va = 0; - static vm_paddr_t last_pa = ~0UL; - static vm_size_t last_sz = 0; - struct efi_md *md; - - if (pa == last_pa && sz == last_sz) - return (last_va); - - md = efi_md_find(pa); - if (md == NULL) { - printf("%s: [%#lx..%#lx] not covered by memory descriptor\n", - __func__, pa, pa + sz - 1); - return (IA64_PHYS_TO_RR6(pa)); - } - - if (md->md_type == EFI_MD_TYPE_FREE) { - printf("%s: [%#lx..%#lx] is in DRAM\n", __func__, pa, - pa + sz - 1); - return (0); - } - - last_va = (md->md_attr & EFI_MD_ATTR_WB) ? IA64_PHYS_TO_RR7(pa) : - IA64_PHYS_TO_RR6(pa); - last_pa = pa; - last_sz = sz; - return (last_va); -} - -/* - * Map a set of physical memory pages into the kernel virtual - * address space. Return a pointer to where it is mapped. This - * routine is intended to be used for mapping device memory, - * NOT real memory. - */ -void * -pmap_mapdev_attr(vm_paddr_t pa, vm_size_t sz, vm_memattr_t attr) -{ - vm_offset_t va; - - CTR4(KTR_PMAP, "%s(pa=%#lx, sz=%#lx, attr=%#x)", __func__, pa, sz, - attr); - - va = pmap_mapdev_priv(pa, sz, attr); - return ((void *)(uintptr_t)va); -} - -/* - * 'Unmap' a range mapped by pmap_mapdev_attr(). - */ -void -pmap_unmapdev(vm_offset_t va, vm_size_t size) -{ - - CTR3(KTR_PMAP, "%s(va=%#lx, sz=%#lx)", __func__, va, size); -} - -/* - * Sets the memory attribute for the specified page. - */ -static void -pmap_page_set_memattr_1(void *arg) -{ - struct ia64_pal_result res; - register_t is; - uintptr_t pp = (uintptr_t)arg; - - is = intr_disable(); - res = ia64_call_pal_static(pp, 0, 0, 0); - intr_restore(is); -} - -void -pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) -{ - struct ia64_lpte *pte; - pmap_t oldpmap, pmap; - pv_entry_t pv; - void *va; - - CTR3(KTR_PMAP, "%s(m=%p, attr=%#x)", __func__, m, ma); - - rw_wlock(&pvh_global_lock); - m->md.memattr = ma; - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - pmap = PV_PMAP(pv); - PMAP_LOCK(pmap); - oldpmap = pmap_switch(pmap); - pte = pmap_find_vhpt(pv->pv_va); - KASSERT(pte != NULL, ("pte")); - pmap_pte_attr(pte, ma); - pmap_invalidate_page(pv->pv_va); - pmap_switch(oldpmap); - PMAP_UNLOCK(pmap); - } - rw_wunlock(&pvh_global_lock); - - if (ma == VM_MEMATTR_UNCACHEABLE) { -#ifdef SMP - smp_rendezvous(NULL, pmap_page_set_memattr_1, NULL, - (void *)PAL_PREFETCH_VISIBILITY); -#else - pmap_page_set_memattr_1((void *)PAL_PREFETCH_VISIBILITY); -#endif - va = (void *)pmap_page_to_va(m); - critical_enter(); - cpu_flush_dcache(va, PAGE_SIZE); - critical_exit(); -#ifdef SMP - smp_rendezvous(NULL, pmap_page_set_memattr_1, NULL, - (void *)PAL_MC_DRAIN); -#else - pmap_page_set_memattr_1((void *)PAL_MC_DRAIN); -#endif - } -} - -/* - * perform the pmap work for mincore - */ -int -pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) -{ - pmap_t oldpmap; - struct ia64_lpte *pte, tpte; - vm_paddr_t pa; - int val; - - CTR4(KTR_PMAP, "%s(pm=%p, va=%#lx, pa_p=%p)", __func__, pmap, addr, - locked_pa); - - PMAP_LOCK(pmap); -retry: - oldpmap = pmap_switch(pmap); - pte = pmap_find_vhpt(addr); - if (pte != NULL) { - tpte = *pte; - pte = &tpte; - } - pmap_switch(oldpmap); - if (pte == NULL || !pmap_present(pte)) { - val = 0; - goto out; - } - val = MINCORE_INCORE; - if (pmap_dirty(pte)) - val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; - if (pmap_accessed(pte)) - val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; - if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != - (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && - pmap_managed(pte)) { - pa = pmap_ppn(pte); - /* Ensure that "PHYS_TO_VM_PAGE(pa)->object" doesn't change. */ - if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) - goto retry; - } else -out: - PA_UNLOCK_COND(*locked_pa); - PMAP_UNLOCK(pmap); - return (val); -} - -/* - * - */ -void -pmap_activate(struct thread *td) -{ - - CTR2(KTR_PMAP, "%s(td=%p)", __func__, td); - - pmap_switch(vmspace_pmap(td->td_proc->p_vmspace)); -} - -pmap_t -pmap_switch(pmap_t pm) -{ - pmap_t prevpm; - int i; - - critical_enter(); - prevpm = PCPU_GET(md.current_pmap); - if (prevpm == pm) - goto out; - if (pm == NULL) { - for (i = 0; i < IA64_VM_MINKERN_REGION; i++) { - ia64_set_rr(IA64_RR_BASE(i), - (i << 8)|(PAGE_SHIFT << 2)|1); - } - } else { - for (i = 0; i < IA64_VM_MINKERN_REGION; i++) { - ia64_set_rr(IA64_RR_BASE(i), - (pm->pm_rid[i] << 8)|(PAGE_SHIFT << 2)|1); - } - } - PCPU_SET(md.current_pmap, pm); - ia64_srlz_d(); - -out: - critical_exit(); - return (prevpm); -} - -/* - * - */ -void -pmap_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz) -{ - pmap_t oldpm; - struct ia64_lpte *pte; - vm_offset_t lim; - vm_size_t len; - - CTR4(KTR_PMAP, "%s(pm=%p, va=%#lx, sz=%#lx)", __func__, pm, va, sz); - - sz += va & 31; - va &= ~31; - sz = (sz + 31) & ~31; - - PMAP_LOCK(pm); - oldpm = pmap_switch(pm); - while (sz > 0) { - lim = round_page(va); - len = MIN(lim - va, sz); - pte = pmap_find_vhpt(va); - if (pte != NULL && pmap_present(pte)) - ia64_sync_icache(va, len); - va += len; - sz -= len; - } - pmap_switch(oldpm); - PMAP_UNLOCK(pm); -} - -/* - * Increase the starting virtual address of the given mapping if a - * different alignment might result in more superpage mappings. - */ -void -pmap_align_superpage(vm_object_t object, vm_ooffset_t offset, - vm_offset_t *addr, vm_size_t size) -{ - - CTR5(KTR_PMAP, "%s(obj=%p, ofs=%#lx, va_p=%p, sz=%#lx)", __func__, - object, offset, addr, size); -} - -#include "opt_ddb.h" - -#ifdef DDB - -#include <ddb/ddb.h> - -static const char* psnames[] = { - "1B", "2B", "4B", "8B", - "16B", "32B", "64B", "128B", - "256B", "512B", "1K", "2K", - "4K", "8K", "16K", "32K", - "64K", "128K", "256K", "512K", - "1M", "2M", "4M", "8M", - "16M", "32M", "64M", "128M", - "256M", "512M", "1G", "2G" -}; - -static void -print_trs(int type) -{ - struct ia64_pal_result res; - int i, maxtr; - struct { - pt_entry_t pte; - uint64_t itir; - uint64_t ifa; - struct ia64_rr rr; - } buf; - static const char *manames[] = { - "WB", "bad", "bad", "bad", - "UC", "UCE", "WC", "NaT", - }; - - res = ia64_call_pal_static(PAL_VM_SUMMARY, 0, 0, 0); - if (res.pal_status != 0) { - db_printf("Can't get VM summary\n"); - return; - } - - if (type == 0) - maxtr = (res.pal_result[0] >> 40) & 0xff; - else - maxtr = (res.pal_result[0] >> 32) & 0xff; - - db_printf("V RID Virtual Page Physical Page PgSz ED AR PL D A MA P KEY\n"); - for (i = 0; i <= maxtr; i++) { - bzero(&buf, sizeof(buf)); - res = ia64_pal_physical(PAL_VM_TR_READ, i, type, - ia64_tpa((uint64_t)&buf)); - if (!(res.pal_result[0] & 1)) - buf.pte &= ~PTE_AR_MASK; - if (!(res.pal_result[0] & 2)) - buf.pte &= ~PTE_PL_MASK; - if (!(res.pal_result[0] & 4)) - pmap_clear_dirty(&buf); - if (!(res.pal_result[0] & 8)) - buf.pte &= ~PTE_MA_MASK; - db_printf("%d %06x %013lx %013lx %4s %d %d %d %d %d %-3s " - "%d %06x\n", (int)buf.ifa & 1, buf.rr.rr_rid, - buf.ifa >> 12, (buf.pte & PTE_PPN_MASK) >> 12, - psnames[(buf.itir & ITIR_PS_MASK) >> 2], - (buf.pte & PTE_ED) ? 1 : 0, - (int)(buf.pte & PTE_AR_MASK) >> 9, - (int)(buf.pte & PTE_PL_MASK) >> 7, - (pmap_dirty(&buf)) ? 1 : 0, - (pmap_accessed(&buf)) ? 1 : 0, - manames[(buf.pte & PTE_MA_MASK) >> 2], - (pmap_present(&buf)) ? 1 : 0, - (int)((buf.itir & ITIR_KEY_MASK) >> 8)); - } -} - -DB_COMMAND(itr, db_itr) -{ - print_trs(0); -} - -DB_COMMAND(dtr, db_dtr) -{ - print_trs(1); -} - -DB_COMMAND(rr, db_rr) -{ - int i; - uint64_t t; - struct ia64_rr rr; - - printf("RR RID PgSz VE\n"); - for (i = 0; i < 8; i++) { - __asm __volatile ("mov %0=rr[%1]" - : "=r"(t) - : "r"(IA64_RR_BASE(i))); - *(uint64_t *) &rr = t; - printf("%d %06x %4s %d\n", - i, rr.rr_rid, psnames[rr.rr_ps], rr.rr_ve); - } -} - -DB_COMMAND(thash, db_thash) -{ - if (!have_addr) - return; - - db_printf("%p\n", (void *) ia64_thash(addr)); -} - -DB_COMMAND(ttag, db_ttag) -{ - if (!have_addr) - return; - - db_printf("0x%lx\n", ia64_ttag(addr)); -} - -DB_COMMAND(kpte, db_kpte) -{ - struct ia64_lpte *pte; - - if (!have_addr) { - db_printf("usage: kpte <kva>\n"); - return; - } - if (addr < VM_INIT_KERNEL_ADDRESS) { - db_printf("kpte: error: invalid <kva>\n"); - return; - } - pte = pmap_find_kpte(addr); - db_printf("kpte at %p:\n", pte); - db_printf(" pte =%016lx\n", pte->pte); - db_printf(" itir =%016lx\n", pte->itir); - db_printf(" tag =%016lx\n", pte->tag); - db_printf(" chain=%016lx\n", pte->chain); -} - -#endif diff --git a/sys/ia64/ia64/ptrace_machdep.c b/sys/ia64/ia64/ptrace_machdep.c deleted file mode 100644 index c7c5104..0000000 --- a/sys/ia64/ia64/ptrace_machdep.c +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * Copyright (c) 2003 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <sys/ptrace.h> -#include <machine/frame.h> - -int -cpu_ptrace(struct thread *td, int req, void *addr, int data) -{ - struct trapframe *tf; - uint64_t *kstack; - int error; - - error = EINVAL; - tf = td->td_frame; - - switch (req) { - case PT_GETKSTACK: - if (data >= 0 && data < (tf->tf_special.ndirty >> 3)) { - kstack = (uint64_t*)(td->td_kstack + - (tf->tf_special.bspstore & 0x1ffUL)); - error = copyout(kstack + data, addr, 8); - } - break; - case PT_SETKSTACK: - if (data >= 0 && data < (tf->tf_special.ndirty >> 3)) { - kstack = (uint64_t*)(td->td_kstack + - (tf->tf_special.bspstore & 0x1ffUL)); - error = copyin(addr, kstack + data, 8); - } - break; - } - - return (error); -} diff --git a/sys/ia64/ia64/sal.c b/sys/ia64/ia64/sal.c deleted file mode 100644 index b0fe070..0000000 --- a/sys/ia64/ia64/sal.c +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/bus.h> -#include <sys/efi.h> -#include <sys/kernel.h> -#include <sys/malloc.h> -#include <vm/vm.h> -#include <vm/vm_kern.h> -#include <machine/intr.h> -#include <machine/md_var.h> -#include <machine/sal.h> -#include <machine/smp.h> - -int ia64_ipi_wakeup; - -static struct ia64_fdesc sal_fdesc; -static sal_entry_t fake_sal; - -extern u_int64_t ia64_pal_entry; -sal_entry_t *ia64_sal_entry = fake_sal; - -static struct uuid sal_table = EFI_TABLE_SAL; -static struct sal_system_table *sal_systbl; - -static struct ia64_sal_result -fake_sal(u_int64_t a1, u_int64_t a2, u_int64_t a3, u_int64_t a4, - u_int64_t a5, u_int64_t a6, u_int64_t a7, u_int64_t a8) -{ - struct ia64_sal_result res; - res.sal_status = -3; - res.sal_result[0] = 0; - res.sal_result[1] = 0; - res.sal_result[2] = 0; - return res; -} - -void -ia64_sal_init(void) -{ - static int sizes[6] = { - 48, 32, 16, 32, 16, 16 - }; - u_int8_t *p; - int error, i; - - sal_systbl = efi_get_table(&sal_table); - if (sal_systbl == NULL) - return; - - if (bcmp(sal_systbl->sal_signature, SAL_SIGNATURE, 4)) { - printf("Bad signature for SAL System Table\n"); - return; - } - - p = (u_int8_t *) (sal_systbl + 1); - for (i = 0; i < sal_systbl->sal_entry_count; i++) { - switch (*p) { - case 0: { - struct sal_entrypoint_descriptor *dp; - - dp = (struct sal_entrypoint_descriptor*)p; - ia64_pal_entry = IA64_PHYS_TO_RR7(dp->sale_pal_proc); - if (bootverbose) - printf("PAL Proc at 0x%lx\n", ia64_pal_entry); - sal_fdesc.func = IA64_PHYS_TO_RR7(dp->sale_sal_proc); - sal_fdesc.gp = IA64_PHYS_TO_RR7(dp->sale_sal_gp); - if (bootverbose) - printf("SAL Proc at 0x%lx, GP at 0x%lx\n", - sal_fdesc.func, sal_fdesc.gp); - ia64_sal_entry = (sal_entry_t *) &sal_fdesc; - break; - } - case 5: { - struct sal_ap_wakeup_descriptor *dp; - - dp = (struct sal_ap_wakeup_descriptor*)p; - if (dp->sale_mechanism != 0) { - printf("SAL: unsupported AP wake-up mechanism " - "(%d)\n", dp->sale_mechanism); - break; - } - - /* Reserve the XIV so that we won't use it. */ - error = ia64_xiv_reserve(dp->sale_vector, - IA64_XIV_PLAT, NULL); - if (error) { - printf("SAL: invalid AP wake-up XIV (%#lx)\n", - dp->sale_vector); - break; - } - - ia64_ipi_wakeup = dp->sale_vector; - if (bootverbose) - printf("SAL: AP wake-up XIV: %#x\n", - ia64_ipi_wakeup); - break; - } - } - p += sizes[*p]; - } -} diff --git a/sys/ia64/ia64/sapic.c b/sys/ia64/ia64/sapic.c deleted file mode 100644 index 58c3426..0000000 --- a/sys/ia64/ia64/sapic.c +++ /dev/null @@ -1,381 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "opt_ddb.h" - -#include <sys/param.h> -#include <sys/malloc.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/bus.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/pcpu.h> -#include <sys/sysctl.h> - -#include <machine/intr.h> -#include <machine/pal.h> - -#include <vm/vm.h> -#include <vm/pmap.h> - -/* - * Offsets from the SAPIC base in memory. Most registers are accessed - * by indexing using the SAPIC_IO_SELECT register. - */ -#define SAPIC_IO_SELECT 0x00 -#define SAPIC_IO_WINDOW 0x10 -#define SAPIC_APIC_EOI 0x40 - -/* - * Indexed registers. - */ -#define SAPIC_ID 0x00 -#define SAPIC_VERSION 0x01 -#define SAPIC_ARBITRATION_ID 0x02 -#define SAPIC_RTE_BASE 0x10 - -/* Interrupt polarity. */ -#define SAPIC_POLARITY_HIGH 0 -#define SAPIC_POLARITY_LOW 1 - -/* Interrupt trigger. */ -#define SAPIC_TRIGGER_EDGE 0 -#define SAPIC_TRIGGER_LEVEL 1 - -/* Interrupt delivery mode. */ -#define SAPIC_DELMODE_FIXED 0 -#define SAPIC_DELMODE_LOWPRI 1 -#define SAPIC_DELMODE_PMI 2 -#define SAPIC_DELMODE_NMI 4 -#define SAPIC_DELMODE_INIT 5 -#define SAPIC_DELMODE_EXTINT 7 - -struct sapic { - struct mtx sa_mtx; - uint64_t sa_registers; /* virtual address of sapic */ - u_int sa_id; /* I/O SAPIC Id */ - u_int sa_base; /* ACPI vector base */ - u_int sa_limit; /* last ACPI vector handled here */ -}; - -struct sapic_rte { - uint64_t rte_vector :8; - uint64_t rte_delivery_mode :3; - uint64_t rte_destination_mode :1; - uint64_t rte_delivery_status :1; - uint64_t rte_polarity :1; - uint64_t rte_rirr :1; - uint64_t rte_trigger_mode :1; - uint64_t rte_mask :1; - uint64_t rte_flushen :1; - uint64_t rte_reserved :30; - uint64_t rte_destination_eid :8; - uint64_t rte_destination_id :8; -}; - -static MALLOC_DEFINE(M_SAPIC, "sapic", "I/O SAPIC devices"); - -struct sapic *ia64_sapics[16]; /* XXX make this resizable */ -int ia64_sapic_count; - -static int sysctl_machdep_apic(SYSCTL_HANDLER_ARGS); - -SYSCTL_OID(_machdep, OID_AUTO, apic, CTLTYPE_STRING|CTLFLAG_RD, - NULL, 0, sysctl_machdep_apic, "A", "(x)APIC redirection table entries"); - -static __inline uint32_t -sapic_read(struct sapic *sa, int which) -{ - uint32_t value; - - ia64_st4((void *)(sa->sa_registers + SAPIC_IO_SELECT), which); - ia64_mf_a(); - value = ia64_ld4((void *)(sa->sa_registers + SAPIC_IO_WINDOW)); - return (value); -} - -static __inline void -sapic_write(struct sapic *sa, int which, uint32_t value) -{ - - ia64_st4((void *)(sa->sa_registers + SAPIC_IO_SELECT), which); - ia64_mf_a(); - ia64_st4((void *)(sa->sa_registers + SAPIC_IO_WINDOW), value); - ia64_mf_a(); -} - -static __inline void -sapic_read_rte(struct sapic *sa, int which, struct sapic_rte *rte) -{ - uint32_t *p = (uint32_t *) rte; - - p[0] = sapic_read(sa, SAPIC_RTE_BASE + 2 * which); - p[1] = sapic_read(sa, SAPIC_RTE_BASE + 2 * which + 1); -} - -static __inline void -sapic_write_rte(struct sapic *sa, int which, struct sapic_rte *rte) -{ - uint32_t *p = (uint32_t *) rte; - - sapic_write(sa, SAPIC_RTE_BASE + 2 * which, p[0]); - sapic_write(sa, SAPIC_RTE_BASE + 2 * which + 1, p[1]); -} - -struct sapic * -sapic_lookup(u_int irq, u_int *vecp) -{ - struct sapic_rte rte; - struct sapic *sa; - int i; - - for (i = 0; i < ia64_sapic_count; i++) { - sa = ia64_sapics[i]; - if (irq >= sa->sa_base && irq <= sa->sa_limit) { - if (vecp != NULL) { - mtx_lock_spin(&sa->sa_mtx); - sapic_read_rte(sa, irq - sa->sa_base, &rte); - mtx_unlock_spin(&sa->sa_mtx); - *vecp = rte.rte_vector; - } - return (sa); - } - } - - return (NULL); -} - - -int -sapic_bind_intr(u_int irq, struct pcpu *pc) -{ - struct sapic_rte rte; - struct sapic *sa; - - sa = sapic_lookup(irq, NULL); - if (sa == NULL) - return (EINVAL); - - mtx_lock_spin(&sa->sa_mtx); - sapic_read_rte(sa, irq - sa->sa_base, &rte); - rte.rte_destination_id = (pc->pc_md.lid >> 24) & 255; - rte.rte_destination_eid = (pc->pc_md.lid >> 16) & 255; - rte.rte_delivery_mode = SAPIC_DELMODE_FIXED; - sapic_write_rte(sa, irq - sa->sa_base, &rte); - mtx_unlock_spin(&sa->sa_mtx); - return (0); -} - -int -sapic_config_intr(u_int irq, enum intr_trigger trig, enum intr_polarity pol) -{ - struct sapic_rte rte; - struct sapic *sa; - - sa = sapic_lookup(irq, NULL); - if (sa == NULL) - return (EINVAL); - - mtx_lock_spin(&sa->sa_mtx); - sapic_read_rte(sa, irq - sa->sa_base, &rte); - if (trig != INTR_TRIGGER_CONFORM) - rte.rte_trigger_mode = (trig == INTR_TRIGGER_EDGE) ? - SAPIC_TRIGGER_EDGE : SAPIC_TRIGGER_LEVEL; - else - rte.rte_trigger_mode = (irq < 16) ? SAPIC_TRIGGER_EDGE : - SAPIC_TRIGGER_LEVEL; - if (pol != INTR_POLARITY_CONFORM) - rte.rte_polarity = (pol == INTR_POLARITY_HIGH) ? - SAPIC_POLARITY_HIGH : SAPIC_POLARITY_LOW; - else - rte.rte_polarity = (irq < 16) ? SAPIC_POLARITY_HIGH : - SAPIC_POLARITY_LOW; - sapic_write_rte(sa, irq - sa->sa_base, &rte); - mtx_unlock_spin(&sa->sa_mtx); - return (0); -} - -struct sapic * -sapic_create(u_int id, u_int base, uint64_t address) -{ - struct sapic_rte rte; - struct sapic *sa; - u_int i, max; - - sa = malloc(sizeof(struct sapic), M_SAPIC, M_ZERO | M_NOWAIT); - if (sa == NULL) - return (NULL); - - sa->sa_id = id; - sa->sa_base = base; - sa->sa_registers = (uintptr_t)pmap_mapdev(address, 1048576); - - mtx_init(&sa->sa_mtx, "I/O SAPIC lock", NULL, MTX_SPIN); - - max = (sapic_read(sa, SAPIC_VERSION) >> 16) & 0xff; - sa->sa_limit = base + max; - - ia64_sapics[ia64_sapic_count++] = sa; - - /* - * Initialize all RTEs with a default trigger mode and polarity. - * This may be changed later by calling sapic_config_intr(). We - * mask all interrupts by default. - */ - bzero(&rte, sizeof(rte)); - rte.rte_mask = 1; - for (i = base; i <= sa->sa_limit; i++) { - rte.rte_trigger_mode = (i < 16) ? SAPIC_TRIGGER_EDGE : - SAPIC_TRIGGER_LEVEL; - rte.rte_polarity = (i < 16) ? SAPIC_POLARITY_HIGH : - SAPIC_POLARITY_LOW; - sapic_write_rte(sa, i - base, &rte); - } - - return (sa); -} - -int -sapic_enable(struct sapic *sa, u_int irq, u_int vector) -{ - struct sapic_rte rte; - uint64_t lid = ia64_get_lid(); - - mtx_lock_spin(&sa->sa_mtx); - sapic_read_rte(sa, irq - sa->sa_base, &rte); - rte.rte_destination_id = (lid >> 24) & 255; - rte.rte_destination_eid = (lid >> 16) & 255; - rte.rte_delivery_mode = SAPIC_DELMODE_FIXED; - rte.rte_vector = vector; - rte.rte_mask = 0; - sapic_write_rte(sa, irq - sa->sa_base, &rte); - mtx_unlock_spin(&sa->sa_mtx); - return (0); -} - -void -sapic_eoi(struct sapic *sa, u_int vector) -{ - - ia64_st4((void *)(sa->sa_registers + SAPIC_APIC_EOI), vector); - ia64_mf_a(); -} - -/* Expected to be called with interrupts disabled. */ -void -sapic_mask(struct sapic *sa, u_int irq) -{ - struct sapic_rte rte; - - mtx_lock_spin(&sa->sa_mtx); - sapic_read_rte(sa, irq - sa->sa_base, &rte); - rte.rte_mask = 1; - sapic_write_rte(sa, irq - sa->sa_base, &rte); - mtx_unlock_spin(&sa->sa_mtx); -} - -/* Expected to be called with interrupts disabled. */ -void -sapic_unmask(struct sapic *sa, u_int irq) -{ - struct sapic_rte rte; - - mtx_lock_spin(&sa->sa_mtx); - sapic_read_rte(sa, irq - sa->sa_base, &rte); - rte.rte_mask = 0; - sapic_write_rte(sa, irq - sa->sa_base, &rte); - mtx_unlock_spin(&sa->sa_mtx); -} - -static int -sysctl_machdep_apic(SYSCTL_HANDLER_ARGS) -{ - char buf[80]; - struct sapic_rte rte; - struct sapic *sa; - int apic, count, error, index, len; - - len = sprintf(buf, "\n APIC Idx: Id,EId : RTE\n"); - error = SYSCTL_OUT(req, buf, len); - if (error) - return (error); - - for (apic = 0; apic < ia64_sapic_count; apic++) { - sa = ia64_sapics[apic]; - count = sa->sa_limit - sa->sa_base + 1; - for (index = 0; index < count; index++) { - mtx_lock_spin(&sa->sa_mtx); - sapic_read_rte(sa, index, &rte); - mtx_unlock_spin(&sa->sa_mtx); - if (rte.rte_vector == 0) - continue; - len = sprintf(buf, - " 0x%02x %3d: (%02x,%02x): %3d %d %d %s %s %s %s %s\n", - sa->sa_id, index, - rte.rte_destination_id, rte.rte_destination_eid, - rte.rte_vector, rte.rte_delivery_mode, - rte.rte_destination_mode, - rte.rte_delivery_status ? "DS" : " ", - rte.rte_polarity ? "low-active " : "high-active", - rte.rte_rirr ? "RIRR" : " ", - rte.rte_trigger_mode ? "level" : "edge ", - rte.rte_flushen ? "F" : " "); - error = SYSCTL_OUT(req, buf, len); - if (error) - return (error); - } - } - - return (0); -} - -#ifdef DDB - -#include <ddb/ddb.h> - -void -sapic_print(struct sapic *sa, u_int irq) -{ - struct sapic_rte rte; - - db_printf("sapic=%u, irq=%u: ", sa->sa_id, irq); - sapic_read_rte(sa, irq - sa->sa_base, &rte); - db_printf("%3d %x->%x:%x %d %s %s %s %s %s %s\n", rte.rte_vector, - rte.rte_delivery_mode, - rte.rte_destination_id, rte.rte_destination_eid, - rte.rte_destination_mode, - rte.rte_delivery_status ? "DS" : " ", - rte.rte_polarity ? "low-active " : "high-active", - rte.rte_rirr ? "RIRR" : " ", - rte.rte_trigger_mode ? "level" : "edge ", - rte.rte_flushen ? "F" : " ", - rte.rte_mask ? "(masked)" : ""); -} - -#endif diff --git a/sys/ia64/ia64/setjmp.S b/sys/ia64/ia64/setjmp.S deleted file mode 100644 index 82d0219..0000000 --- a/sys/ia64/ia64/setjmp.S +++ /dev/null @@ -1,349 +0,0 @@ -// $FreeBSD$ - -//- -// Copyright (c) 1999, 2000 -// Intel Corporation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. All advertising materials mentioning features or use of this software -// must display the following acknowledgement: -// -// This product includes software developed by Intel Corporation and -// its contributors. -// -// 4. Neither the name of Intel Corporation or its contributors may be -// used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION AND CONTRIBUTORS ``AS IS'' -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -// THE POSSIBILITY OF SUCH DAMAGE. -// -// - -// -// Module Name: -// -// setjmp.s -// -// Abstract: -// -// Contains an implementation of setjmp and longjmp for the -// IA-64 architecture. - - .file "setjmp.s" - -#include <machine/asm.h> -#include <machine/setjmp.h> - -// int setjmp(struct jmp_buffer *) -// -// Setup a non-local goto. -// -// Description: -// -// SetJump stores the current register set in the area pointed to -// by "save". It returns zero. Subsequent calls to "LongJump" will -// restore the registers and return non-zero to the same location. -// -// On entry, r32 contains the pointer to the jmp_buffer -// - -ENTRY(setjmp, 1) - // - // Make sure buffer is aligned at 16byte boundary - // - add r10 = -0x10,r0 ;; // mask the lower 4 bits - and r32 = r32, r10;; - add r32 = 0x10, r32;; // move to next 16 byte boundary - - add r10 = J_PREDS, r32 // skip Unats & pfs save area - add r11 = J_BSP, r32 - // - // save immediate context - // - mov r2 = ar.bsp // save backing store pointer - mov r3 = pr // save predicates - flushrs - ;; - // - // save user Unat register - // - mov r16 = ar.lc // save loop count register - mov r14 = ar.unat // save user Unat register - - st8 [r10] = r3, J_LC-J_PREDS - st8 [r11] = r2, J_R4-J_BSP - ;; - st8 [r10] = r16, J_R5-J_LC - st8 [r32] = r14, J_NATS // Note: Unat at the - // beginning of the save area - mov r15 = ar.pfs - ;; - // - // save preserved general registers & NaT's - // - st8.spill [r11] = r4, J_R6-J_R4 - ;; - st8.spill [r10] = r5, J_R7-J_R5 - ;; - st8.spill [r11] = r6, J_SP-J_R6 - ;; - st8.spill [r10] = r7, J_F3-J_R7 - ;; - st8.spill [r11] = sp, J_F2-J_SP - ;; - // - // save spilled Unat and pfs registers - // - mov r2 = ar.unat // save Unat register after spill - ;; - st8 [r32] = r2, J_PFS-J_NATS // save unat for spilled regs - ;; - st8 [r32] = r15 // save pfs - // - // save floating registers - // - stf.spill [r11] = f2, J_F4-J_F2 - stf.spill [r10] = f3, J_F5-J_F3 - ;; - stf.spill [r11] = f4, J_F16-J_F4 - stf.spill [r10] = f5, J_F17-J_F5 - ;; - stf.spill [r11] = f16, J_F18-J_F16 - stf.spill [r10] = f17, J_F19-J_F17 - ;; - stf.spill [r11] = f18, J_F20-J_F18 - stf.spill [r10] = f19, J_F21-J_F19 - ;; - stf.spill [r11] = f20, J_F22-J_F20 - stf.spill [r10] = f21, J_F23-J_F21 - ;; - stf.spill [r11] = f22, J_F24-J_F22 - stf.spill [r10] = f23, J_F25-J_F23 - ;; - stf.spill [r11] = f24, J_F26-J_F24 - stf.spill [r10] = f25, J_F27-J_F25 - ;; - stf.spill [r11] = f26, J_F28-J_F26 - stf.spill [r10] = f27, J_F29-J_F27 - ;; - stf.spill [r11] = f28, J_F30-J_F28 - stf.spill [r10] = f29, J_F31-J_F29 - ;; - stf.spill [r11] = f30, J_FPSR-J_F30 - stf.spill [r10] = f31, J_B0-J_F31 // size of f31 + fpsr - // - // save FPSR register & branch registers - // - mov r2 = ar.fpsr // save fpsr register - mov r3 = b0 - ;; - st8 [r11] = r2, J_B1-J_FPSR - st8 [r10] = r3, J_B2-J_B0 - mov r2 = b1 - mov r3 = b2 - ;; - st8 [r11] = r2, J_B3-J_B1 - st8 [r10] = r3, J_B4-J_B2 - mov r2 = b3 - mov r3 = b4 - ;; - st8 [r11] = r2, J_B5-J_B3 - st8 [r10] = r3 - mov r2 = b5 - ;; - st8 [r11] = r2 - ;; - // - // return - // - mov r8 = r0 // return 0 from setjmp - mov ar.unat = r14 // restore unat - br.ret.sptk b0 - -END(setjmp) - - -// -// void longjmp(struct jmp_buffer *, int val) -// -// Perform a non-local goto. -// -// Description: -// -// LongJump initializes the register set to the values saved by a -// previous 'SetJump' and jumps to the return location saved by that -// 'SetJump'. This has the effect of unwinding the stack and returning -// for a second time to the 'SetJump'. -// - -ENTRY(longjmp, 2) - // - // Make sure buffer is aligned at 16byte boundary - // - add r10 = -0x10,r0 ;; // mask the lower 4 bits - and r32 = r32, r10;; - add r32 = 0x10, r32;; // move to next 16 byte boundary - - // - // caching the return value as we do invala in the end - // - mov r8 = r33 // return value - - // - // get immediate context - // - mov r14 = ar.rsc // get user RSC conf - add r10 = J_PFS, r32 // get address of pfs - add r11 = J_NATS, r32 - ;; - ld8 r15 = [r10], J_BSP-J_PFS // get pfs - ld8 r2 = [r11], J_LC-J_NATS // get unat for spilled regs - ;; - mov ar.unat = r2 - ;; - ld8 r16 = [r10], J_PREDS-J_BSP // get backing store pointer - mov ar.rsc = r0 // put RSE in enforced lazy - mov ar.pfs = r15 - ;; - - // - // while returning from longjmp the BSPSTORE and BSP needs to be - // same and discard all the registers allocated after we did - // setjmp. Also, we need to generate the RNAT register since we - // did not flushed the RSE on setjmp. - // - mov r17 = ar.bspstore // get current BSPSTORE - ;; - cmp.ltu p6,p7 = r17, r16 // is it less than BSP of -(p6) br.spnt.few .flush_rse - mov r19 = ar.rnat // get current RNAT - ;; - loadrs // invalidate dirty regs - br.sptk.many .restore_rnat // restore RNAT - -.flush_rse: - flushrs - ;; - mov r19 = ar.rnat // get current RNAT - mov r17 = r16 // current BSPSTORE - ;; -.restore_rnat: - // - // check if RNAT is saved between saved BSP and curr BSPSTORE - // - mov r18 = 0x3f - ;; - dep r18 = r18,r16,3,6 // get RNAT address - ;; - cmp.ltu p8,p9 = r18, r17 // RNAT saved on RSE - ;; -(p8) ld8 r19 = [r18] // get RNAT from RSE - ;; - mov ar.bspstore = r16 // set new BSPSTORE - ;; - mov ar.rnat = r19 // restore RNAT - mov ar.rsc = r14 // restore RSC conf - - - ld8 r3 = [r11], J_R4-J_LC // get lc register - ld8 r2 = [r10], J_R5-J_PREDS // get predicates - ;; - mov pr = r2, -1 - mov ar.lc = r3 - // - // restore preserved general registers & NaT's - // - ld8.fill r4 = [r11], J_R6-J_R4 - ;; - ld8.fill r5 = [r10], J_R7-J_R5 - ld8.fill r6 = [r11], J_SP-J_R6 - ;; - ld8.fill r7 = [r10], J_F2-J_R7 - ld8.fill sp = [r11], J_F3-J_SP - ;; - // - // restore floating registers - // - ldf.fill f2 = [r10], J_F4-J_F2 - ldf.fill f3 = [r11], J_F5-J_F3 - ;; - ldf.fill f4 = [r10], J_F16-J_F4 - ldf.fill f5 = [r11], J_F17-J_F5 - ;; - ldf.fill f16 = [r10], J_F18-J_F16 - ldf.fill f17 = [r11], J_F19-J_F17 - ;; - ldf.fill f18 = [r10], J_F20-J_F18 - ldf.fill f19 = [r11], J_F21-J_F19 - ;; - ldf.fill f20 = [r10], J_F22-J_F20 - ldf.fill f21 = [r11], J_F23-J_F21 - ;; - ldf.fill f22 = [r10], J_F24-J_F22 - ldf.fill f23 = [r11], J_F25-J_F23 - ;; - ldf.fill f24 = [r10], J_F26-J_F24 - ldf.fill f25 = [r11], J_F27-J_F25 - ;; - ldf.fill f26 = [r10], J_F28-J_F26 - ldf.fill f27 = [r11], J_F29-J_F27 - ;; - ldf.fill f28 = [r10], J_F30-J_F28 - ldf.fill f29 = [r11], J_F31-J_F29 - ;; - ldf.fill f30 = [r10], J_FPSR-J_F30 - ldf.fill f31 = [r11], J_B0-J_F31 ;; - - // - // restore branch registers and fpsr - // - ld8 r16 = [r10], J_B1-J_FPSR // get fpsr - ld8 r17 = [r11], J_B2-J_B0 // get return pointer - ;; - mov ar.fpsr = r16 - mov b0 = r17 - ld8 r2 = [r10], J_B3-J_B1 - ld8 r3 = [r11], J_B4-J_B2 - ;; - mov b1 = r2 - mov b2 = r3 - ld8 r2 = [r10], J_B5-J_B3 - ld8 r3 = [r11] - ;; - mov b3 = r2 - mov b4 = r3 - ld8 r2 = [r10] - ld8 r21 = [r32] // get user unat - ;; - mov b5 = r2 - mov ar.unat = r21 - - // - // invalidate ALAT - // - invala ;; - - br.ret.sptk b0 - -END(longjmp) diff --git a/sys/ia64/ia64/stack_machdep.c b/sys/ia64/ia64/stack_machdep.c deleted file mode 100644 index 5e513ea..0000000 --- a/sys/ia64/ia64/stack_machdep.c +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 2005 Antoine Brodin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <sys/stack.h> - -void -stack_save_td(struct stack *st, struct thread *td) -{ - - if (TD_IS_SWAPPED(td)) - panic("stack_save_td: swapped"); - if (TD_IS_RUNNING(td)) - panic("stack_save_td: running"); - - stack_zero(st); -} - -void -stack_save(struct stack *st) -{ - - stack_zero(st); - /* - * Nothing for now. - * Is libuwx reentrant? - * Can unw_create* sleep? - */ -} diff --git a/sys/ia64/ia64/support.S b/sys/ia64/ia64/support.S deleted file mode 100644 index 46e5972..0000000 --- a/sys/ia64/ia64/support.S +++ /dev/null @@ -1,843 +0,0 @@ -/*- - * Copyright (c) 1998 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 the - * rights to redistribute these changes. - */ - -#include <machine/asm.h> -#include <machine/ia64_cpu.h> -#include <assym.s> - - .text - -ENTRY(fusufault, 0) -{ .mib - st8.rel [r15]=r0 // Clear onfault. - add ret0=-1,r0 - br.ret.sptk rp - ;; -} -END(fusufault) - -/* - * casuword(u_long *p, u_long old, u_long new) - * Perform a compare-exchange in user space. - */ -ENTRY(casuword, 3) -{ .mlx - ld8.acq r15=[r13] // r15 = curthread - movl r14=VM_MAXUSER_ADDRESS - ;; -} -{ .mib - add r15=TD_PCB,r15 - cmp.geu p6,p0=in0,r14 -(p6) br.dpnt.few 1f - ;; -} -{ .mlx - ld8 r15=[r15] // r15 = PCB - movl r14=fusufault - ;; -} -{ .mmi - mov ar.ccv=in1 - add r15=PCB_ONFAULT,r15 - nop 0 - ;; -} -{ .mmi - st8 [r15]=r14 // Set onfault - ;; - cmpxchg8.rel ret0=[in0],in2,ar.ccv - nop 0 - ;; -} -{ .mib - st8.rel [r15]=r0 // Clear onfault - nop 0 - br.ret.sptk rp - ;; -} -1: -{ .mib - add ret0=-1,r0 - nop 0 - br.ret.sptk rp - ;; -} -END(casuword) - -/* - * casuword32(uint32_t *p, uint32_t old, uint32_t new) - * Perform a 32-bit compare-exchange in user space. - */ -ENTRY(casuword32, 3) -{ .mlx - movl r14=VM_MAXUSER_ADDRESS - ;; -} -{ .mib - ld8.acq r15=[r13] // r15 = curthread - cmp.geu p6,p0=in0,r14 -(p6) br.dpnt.few 1f - ;; -} -{ .mlx - add r15=TD_PCB,r15 - movl r14=fusufault - ;; -} -{ .mmi - ld8 r15=[r15] // r15 = PCB - ;; - mov ar.ccv=in1 - add r15=PCB_ONFAULT,r15 - ;; -} -{ .mmi - st8 [r15]=r14 // Set onfault - ;; - cmpxchg4.rel ret0=[in0],in2,ar.ccv - nop 0 - ;; -} -{ .mib - st8.rel [r15]=r0 // Clear onfault - nop 0 - br.ret.sptk rp - ;; -} -1: -{ .mib - add ret0=-1,r0 - nop 0 - br.ret.sptk rp - ;; -} -END(casuword32) - -/* - * subyte(void *addr, int byte) - * suword16(void *addr, int word) - * suword32(void *addr, int word) - * suword64|suword(void *addr, long word) - * Store in user space - */ - -ENTRY(subyte, 2) -{ .mlx - movl r14=VM_MAXUSER_ADDRESS - ;; -} -{ .mib - ld8.acq r15=[r13] // r15 = curthread - cmp.geu p6,p0=in0,r14 -(p6) br.dpnt.few 1f - ;; -} -{ .mlx - add r15=TD_PCB,r15 - movl r14=fusufault - ;; -} -{ .mmi - ld8 r15=[r15] // r15 = PCB - ;; - nop 0 - add r15=PCB_ONFAULT,r15 - ;; -} -{ .mmi - st8 [r15]=r14 // Set onfault - ;; - st1.rel [in0]=in1 - nop 0 - ;; -} -{ .mib - st8.rel [r15]=r0 // Clear onfault - mov ret0=r0 - br.ret.sptk rp - ;; -} -1: -{ .mib - add ret0=-1,r0 - nop 0 - br.ret.sptk rp - ;; -} -END(subyte) - -ENTRY(suword16, 2) -{ .mlx - movl r14=VM_MAXUSER_ADDRESS - ;; -} -{ .mib - ld8.acq r15=[r13] // r15 = curthread - cmp.geu p6,p0=in0,r14 -(p6) br.dpnt.few 1f - ;; -} -{ .mlx - add r15=TD_PCB,r15 - movl r14=fusufault - ;; -} -{ .mmi - ld8 r15=[r15] // r15 = PCB - ;; - nop 0 - add r15=PCB_ONFAULT,r15 - ;; -} -{ .mmi - st8 [r15]=r14 // Set onfault - ;; - st2.rel [in0]=in1 - nop 0 - ;; -} -{ .mib - st8.rel [r15]=r0 // Clear onfault - mov ret0=r0 - br.ret.sptk rp - ;; -} -1: -{ .mib - add ret0=-1,r0 - nop 0 - br.ret.sptk rp - ;; -} -END(suword16) - -ENTRY(suword32, 2) -{ .mlx - movl r14=VM_MAXUSER_ADDRESS - ;; -} -{ .mib - ld8.acq r15=[r13] // r15 = curthread - cmp.geu p6,p0=in0,r14 -(p6) br.dpnt.few 1f - ;; -} -{ .mlx - add r15=TD_PCB,r15 - movl r14=fusufault - ;; -} -{ .mmi - ld8 r15=[r15] // r15 = PCB - ;; - nop 0 - add r15=PCB_ONFAULT,r15 - ;; -} -{ .mmi - st8 [r15]=r14 // Set onfault - ;; - st4.rel [in0]=in1 - nop 0 - ;; -} -{ .mib - st8.rel [r15]=r0 // Clear onfault - mov ret0=r0 - br.ret.sptk rp - ;; -} -1: -{ .mib - add ret0=-1,r0 - nop 0 - br.ret.sptk rp - ;; -} -END(suword32) - -ENTRY(suword64, 2) -XENTRY(suword) -{ .mlx - movl r14=VM_MAXUSER_ADDRESS - ;; -} -{ .mib - ld8.acq r15=[r13] // r15 = curthread - cmp.geu p6,p0=in0,r14 -(p6) br.dpnt.few 1f - ;; -} -{ .mlx - add r15=TD_PCB,r15 - movl r14=fusufault - ;; -} -{ .mmi - ld8 r15=[r15] // r15 = PCB - ;; - nop 0 - add r15=PCB_ONFAULT,r15 - ;; -} -{ .mmi - st8 [r15]=r14 // Set onfault - ;; - st8.rel [in0]=in1 - nop 0 - ;; -} -{ .mib - st8.rel [r15]=r0 // Clear onfault - mov ret0=r0 - br.ret.sptk rp - ;; -} -1: -{ .mib - add ret0=-1,r0 - nop 0 - br.ret.sptk rp - ;; -} -END(suword64) - -/* - * fubyte(void *addr, int byte) - * fuword16(void *addr, int word) - * fuword32(void *addr, int word) - * fuword64|fuword(void *addr, long word) - * Fetch from user space - */ - -ENTRY(fubyte, 1) -{ .mlx - movl r14=VM_MAXUSER_ADDRESS - ;; -} -{ .mib - ld8.acq r15=[r13] // r15 = curthread - cmp.geu p6,p0=in0,r14 -(p6) br.dpnt.few 1f - ;; -} -{ .mlx - add r15=TD_PCB,r15 - movl r14=fusufault - ;; -} -{ .mmi - ld8 r15=[r15] // r15 = PCB - ;; - nop 0 - add r15=PCB_ONFAULT,r15 - ;; -} -{ .mmi - st8 [r15]=r14 // Set onfault - ;; - mf - nop 0 - ;; -} -{ .mmb - ld1 ret0=[in0] - st8.rel [r15]=r0 // Clear onfault - br.ret.sptk rp - ;; -} -1: -{ .mib - add ret0=-1,r0 - nop 0 - br.ret.sptk rp - ;; -} -END(fubyte) - -ENTRY(fuword16, 2) -{ .mlx - movl r14=VM_MAXUSER_ADDRESS - ;; -} -{ .mib - ld8.acq r15=[r13] // r15 = curthread - cmp.geu p6,p0=in0,r14 -(p6) br.dpnt.few 1f - ;; -} -{ .mlx - add r15=TD_PCB,r15 - movl r14=fusufault - ;; -} -{ .mmi - ld8 r15=[r15] // r15 = PCB - ;; - nop 0 - add r15=PCB_ONFAULT,r15 - ;; -} -{ .mmi - st8 [r15]=r14 // Set onfault - ;; - mf - nop 0 - ;; -} -{ .mmb - ld2 ret0=[in0] - st8.rel [r15]=r0 // Clear onfault - br.ret.sptk rp - ;; -} -1: -{ .mib - add ret0=-1,r0 - nop 0 - br.ret.sptk rp - ;; -} -END(fuword16) - -ENTRY(fuword32, 2) -{ .mlx - movl r14=VM_MAXUSER_ADDRESS - ;; -} -{ .mib - ld8.acq r15=[r13] // r15 = curthread - cmp.geu p6,p0=in0,r14 -(p6) br.dpnt.few 1f - ;; -} -{ .mlx - add r15=TD_PCB,r15 - movl r14=fusufault - ;; -} -{ .mmi - ld8 r15=[r15] // r15 = PCB - ;; - nop 0 - add r15=PCB_ONFAULT,r15 - ;; -} -{ .mmi - st8 [r15]=r14 // Set onfault - ;; - mf - nop 0 - ;; -} -{ .mmb - ld4 ret0=[in0] - st8.rel [r15]=r0 // Clear onfault - br.ret.sptk rp - ;; -} -1: -{ .mib - add ret0=-1,r0 - nop 0 - br.ret.sptk rp - ;; -} -END(fuword32) - -ENTRY(fuword64, 2) -XENTRY(fuword) -{ .mlx - movl r14=VM_MAXUSER_ADDRESS - ;; -} -{ .mib - ld8.acq r15=[r13] // r15 = curthread - cmp.geu p6,p0=in0,r14 -(p6) br.dpnt.few 1f - ;; -} -{ .mlx - add r15=TD_PCB,r15 - movl r14=fusufault - ;; -} -{ .mmi - ld8 r15=[r15] // r15 = PCB - ;; - nop 0 - add r15=PCB_ONFAULT,r15 - ;; -} -{ .mmi - st8 [r15]=r14 // Set onfault - ;; - mf - nop 0 - ;; -} -{ .mmb - ld8 ret0=[in0] - st8.rel [r15]=r0 // Clear onfault - br.ret.sptk rp - ;; -} -1: -{ .mib - add ret0=-1,r0 - nop 0 - br.ret.sptk rp - ;; -} -END(fuword64) - -/* - * fuswintr(void *addr) - * suswintr(void *addr) - */ - -ENTRY(fuswintr, 1) -{ .mib - add ret0=-1,r0 - nop 0 - br.ret.sptk rp - ;; -} -END(fuswintr) - -ENTRY(suswintr, 0) -{ .mib - add ret0=-1,r0 - nop 0 - br.ret.sptk rp - ;; -} -END(suswintr) - -/**************************************************************************/ - -/* - * Copy a null-terminated string within the kernel's address space. - * If lenp is not NULL, store the number of chars copied in *lenp - * - * int copystr(char *from, char *to, size_t len, size_t *lenp); - */ -ENTRY(copystr, 4) - mov r14=in2 // r14 = i = len - cmp.eq p6,p0=r0,in2 -(p6) br.cond.spnt.few 2f // if (len == 0), bail out - -1: ld1 r15=[in0],1 // read one byte - ;; - st1 [in1]=r15,1 // write that byte - add in2=-1,in2 // len-- - ;; - cmp.eq p6,p0=r0,r15 - cmp.ne p7,p0=r0,in2 - ;; -(p6) br.cond.spnt.few 2f // if (*from == 0), bail out -(p7) br.cond.sptk.few 1b // if (len != 0) copy more - -2: cmp.eq p6,p0=r0,in3 -(p6) br.cond.dpnt.few 3f // if (lenp != NULL) - sub r14=r14,in2 // *lenp = (i - len) - ;; - st8 [in3]=r14 - -3: cmp.eq p6,p0=r0,r15 -(p6) br.cond.spnt.few 4f // *from == '\0'; leave quietly - - mov ret0=ENAMETOOLONG // *from != '\0'; error. - br.ret.sptk.few rp - -4: mov ret0=0 // return 0. - br.ret.sptk.few rp -END(copystr) - -ENTRY(copyinstr, 4) - .prologue - .regstk 4, 3, 4, 0 - .save ar.pfs,loc0 - alloc loc0=ar.pfs,4,3,4,0 - .save rp,loc1 - mov loc1=rp - .body - - movl loc2=VM_MAXUSER_ADDRESS // make sure that src addr - ;; - cmp.geu p6,p0=in0,loc2 // is in user space. - ;; -(p6) br.cond.spnt.few copyerr // if it's not, error out. - ld8.acq r15=[r13] - movl r14=copyerr // set up fault handler. - ;; - add r15=TD_PCB,r15 // find pcb - ;; - ld8 r15=[r15] - ;; - add loc2=PCB_ONFAULT,r15 - ;; - st8 [loc2]=r14 - ;; - mov out0=in0 - mov out1=in1 - mov out2=in2 - mov out3=in3 - ;; - br.call.sptk.few rp=copystr // do the copy. - st8 [loc2]=r0 // kill the fault handler. - mov ar.pfs=loc0 // restore ar.pfs - mov rp=loc1 // restore ra. - br.ret.sptk.few rp // ret0 left over from copystr -END(copyinstr) - -/* - * Not the fastest bcopy in the world. - */ -ENTRY(bcopy, 3) - mov ret0=r0 // return zero for copy{in,out} - ;; - cmp.le p6,p0=in2,r0 // bail if len <= 0 -(p6) br.ret.spnt.few rp - - sub r14=in1,in0 ;; // check for overlap - cmp.ltu p6,p0=r14,in2 // dst-src < len -(p6) br.cond.spnt.few 5f - - extr.u r14=in0,0,3 // src & 7 - extr.u r15=in1,0,3 ;; // dst & 7 - cmp.eq p6,p0=r14,r15 // different alignment? -(p6) br.cond.spnt.few 2f // branch if same alignment - -1: ld1 r14=[in0],1 ;; // copy bytewise - st1 [in1]=r14,1 - add in2=-1,in2 ;; // len-- - cmp.ne p6,p0=r0,in2 -(p6) br.cond.dptk.few 1b // loop - br.ret.sptk.few rp // done - -2: cmp.eq p6,p0=r14,r0 // aligned? -(p6) br.cond.sptk.few 4f - -3: ld1 r14=[in0],1 ;; // copy bytewise - st1 [in1]=r14,1 - extr.u r15=in0,0,3 // src & 7 - add in2=-1,in2 ;; // len-- - cmp.eq p6,p0=r0,in2 // done? - cmp.eq p7,p0=r0,r15 ;; // aligned now? -(p6) br.ret.spnt.few rp // return if done -(p7) br.cond.spnt.few 4f // go to main copy - br.cond.sptk.few 3b // more bytes to copy - - // At this point, in2 is non-zero - -4: mov r14=8 ;; - cmp.ltu p6,p0=in2,r14 ;; // len < 8? -(p6) br.cond.spnt.few 1b // byte copy the end - ld8 r15=[in0],8 ;; // copy word - st8 [in1]=r15,8 - add in2=-8,in2 ;; // len -= 8 - cmp.ne p6,p0=r0,in2 // done? -(p6) br.cond.spnt.few 4b // again - - br.ret.sptk.few rp // return - - // Don't bother optimising overlap case - -5: add in0=in0,in2 - add in1=in1,in2 ;; - add in0=-1,in0 - add in1=-1,in1 ;; - -6: ld1 r14=[in0],-1 ;; - st1 [in1]=r14,-1 - add in2=-1,in2 ;; - cmp.ne p6,p0=r0,in2 -(p6) br.cond.spnt.few 6b - - br.ret.sptk.few rp -END(bcopy) - -ENTRY(memcpy,3) - mov r14=in0 ;; - mov in0=in1 ;; - mov in1=r14 - br.cond.sptk.few bcopy -END(memcpy) - -ENTRY(copyin, 3) - .prologue - .regstk 3, 3, 3, 0 - .save ar.pfs,loc0 - alloc loc0=ar.pfs,3,3,3,0 - .save rp,loc1 - mov loc1=rp - .body - - movl loc2=VM_MAXUSER_ADDRESS // make sure that src addr - ;; - cmp.geu p6,p0=in0,loc2 // is in user space. - ;; -(p6) br.cond.spnt.few copyerr // if it's not, error out. - ld8.acq r15=[r13] - movl r14=copyerr // set up fault handler. - ;; - add r15=TD_PCB,r15 // find pcb - ;; - ld8 r15=[r15] - ;; - add loc2=PCB_ONFAULT,r15 - ;; - st8 [loc2]=r14 - ;; - mov out0=in0 - mov out1=in1 - mov out2=in2 - ;; - br.call.sptk.few rp=bcopy // do the copy. - st8 [loc2]=r0 // kill the fault handler. - mov ar.pfs=loc0 // restore ar.pfs - mov rp=loc1 // restore ra. - br.ret.sptk.few rp // ret0 left over from bcopy -END(copyin) - -ENTRY(copyout, 3) - .prologue - .regstk 3, 3, 3, 0 - .save ar.pfs,loc0 - alloc loc0=ar.pfs,3,3,3,0 - .save rp,loc1 - mov loc1=rp - .body - - movl loc2=VM_MAXUSER_ADDRESS // make sure that dest addr - ;; - cmp.geu p6,p0=in1,loc2 // is in user space. - ;; -(p6) br.cond.spnt.few copyerr // if it's not, error out. - ld8.acq r15=[r13] - movl r14=copyerr // set up fault handler. - ;; - add r15=TD_PCB,r15 // find pcb - ;; - ld8 r15=[r15] - ;; - add loc2=PCB_ONFAULT,r15 - ;; - st8 [loc2]=r14 - ;; - mov out0=in0 - mov out1=in1 - mov out2=in2 - ;; - br.call.sptk.few rp=bcopy // do the copy. - st8 [loc2]=r0 // kill the fault handler. - mov ar.pfs=loc0 // restore ar.pfs - mov rp=loc1 // restore ra. - br.ret.sptk.few rp // ret0 left over from bcopy -END(copyout) - -ENTRY(copyerr, 0) - ld8.acq r14=[r13] ;; - add r14=TD_PCB,r14 ;; // curthread->td_addr - ld8 r14=[r14] ;; - add r14=PCB_ONFAULT,r14 ;; // &curthread->td_pcb->pcb_onfault - st8 [r14]=r0 // reset fault handler - - mov ret0=EFAULT // return EFAULT - br.ret.sptk.few rp -END(copyerr) - -#if defined(GPROF) -/* - * Important registers: - * r8 structure return address - * rp our return address - * in0 caller's ar.pfs - * in1 caller's gp - * in2 caller's rp - * in3 GOT entry - * ar.pfs our pfs - */ -ENTRY_NOPROFILE(_mcount, 4) - alloc loc0 = ar.pfs, 4, 3, 2, 0 - mov loc1 = r8 - mov loc2 = rp - ;; - mov out0 = in2 - mov out1 = rp - br.call.sptk rp = __mcount - ;; -1: - mov gp = in1 - mov r14 = ip - mov b7 = loc2 - ;; - add r14 = 2f - 1b, r14 - mov ar.pfs = loc0 - mov rp = in2 - ;; - mov b7 = r14 - mov b6 = loc2 - mov r8 = loc1 - mov r14 = in0 - br.ret.sptk b7 - ;; -2: - mov ar.pfs = r14 - br.sptk b6 - ;; -END(_mcount) -#endif diff --git a/sys/ia64/ia64/sys_machdep.c b/sys/ia64/ia64/sys_machdep.c deleted file mode 100644 index 764df2e..0000000 --- a/sys/ia64/ia64/sys_machdep.c +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sysproto.h> -#include <sys/sysent.h> - -#include <machine/bus.h> -#include <machine/cpu.h> -#include <machine/sysarch.h> - -#ifndef _SYS_SYSPROTO_H_ -struct sysarch_args { - int op; - char *parms; -}; -#endif - -int -sysarch(struct thread *td, struct sysarch_args *uap) -{ - int error; - - switch(uap->op) { - default: - error = EINVAL; - break; - } - return (error); -} diff --git a/sys/ia64/ia64/syscall.S b/sys/ia64/ia64/syscall.S deleted file mode 100644 index 84a03da..0000000 --- a/sys/ia64/ia64/syscall.S +++ /dev/null @@ -1,569 +0,0 @@ -/*- - * Copyright (c) 2002, 2003 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/syscall.h> -#include <machine/asm.h> -#include <assym.s> - -/* - * A process performs a syscall by performing an indirect call to the - * address stored in ar.k5. The contents of ar.pfs and rp should be - * saved prior to the syscall in r9 and r10 respectively. The kernel - * will restore these values on return. The value of gp is preserved - * across the call. This allows for small enough syscall stubs without - * getting too weird. - * The address in ar.k5 is the start of the EPC gateway page and also - * the syscall entry point. The syscall code in the gateway page is - * primarily responsible for increasing the privilege level, but will - * also make sure we have a reliable psr. - * - * A process defines: - * r8 - syscall number - * r9 - copy of ar.pfs - * r10 - copy of rp - * in0-in7 - syscall arguments - * - * A syscall returns: - * r8+r9 - syscall return value(s) - * r10 - syscall error flag - * ar.pfs - restored from r9 - * rp - restored from r10 - * gp - preserved - * - * The EPC syscall code defines: - * r11 - copy of psr.l - * r14 - Kernel memory stack - * r15 - Kernel register stack - * - * Also in the gateway page are the signal trampolines. As such, stacks - * don't have to be made executable per se. Since debuggers have a need - * to know about trampolines, we probably need to define a table of - * vectors or something along those lines so that debuggers can get the - * information they need and we have the freedom to move code around. - */ - - .section .text.gateway, "ax" - .align PAGE_SIZE - .global ia64_gateway_page -ia64_gateway_page: -{ .mmb - mov r14=ar.k7 // Memory stack - mov r15=ar.k6 // Register stack - epc - ;; -} -{ .mlx - mov r11=psr - movl r31=epc_syscall - ;; -} -{ .mib - rum psr.be - mov b7=r31 - br b7 - ;; -} -gw_ret: -{ .mmi - mov ar.rnat=r22 - ;; - mov ar.rsc=r24 - mov ar.pfs=r20 -} -{ .mib - mov ar.fpsr=r25 - mov b0=r18 - br.sptk b6 - ;; -} -gw_ret_ia32: -{ .mmi - flushrs - nop 0 - nop 0 - ;; -} -{ .mib - nop 0 - nop 0 - br.ia.sptk b6 - ;; -} - - -ENTRY_NOPROFILE(break_sigtramp, 0) -{ .mib - mov ar.rsc=0 - cmp.ne p15,p0=0,gp - cover - ;; -} -{ .mmi - flushrs -(p15) invala - add r16=16+UC_MCONTEXT+MC_SPECIAL,sp - ;; -} -{ .mmi - mov r17=ar.bsp - mov r18=ar.rnat - add r14=40,r16 - ;; -} -{ .mmi - st8 [r14]=r17,64 // bspstore -(p15) mov ar.bspstore=gp - add r15=48,r16 - ;; -} -{ .mmi - st8 [r15]=r18 // rnat - st8 [r14]=r0 // ndirty - nop 0 - ;; -} -{ .mmi - alloc r14=ar.pfs, 0, 0, 3, 0 - mov ar.rsc=15 - mov out0=r8 - ;; -} -{ .mmi - ld8 r16=[r10],8 // function address - ;; - ld8 gp=[r10] // function's gp value - mov b7=r16 - ;; -} -{ .mib - mov out1=r9 - add out2=16,sp - br.call.sptk rp=b7 - ;; -} -{ .mmi - mov r15=SYS_sigreturn - add out0=16,sp - break 0x100000 - ;; -} -{ .mmi - mov r15=SYS_exit - mov out0=ret0 - break 0x100000 - ;; -} -END(break_sigtramp) - -ENTRY_NOPROFILE(epc_sigtramp, 0) -{ .mmi - ld8 r16=[r10],8 // function address - mov ar.rsc=0 - cmp.ne p15,p0=0,gp - ;; -} -{ .mmi -(p15) invala -(p15) mov ar.bspstore=gp - mov b7=r16 - ;; -} -{ .mmi - alloc r14=ar.pfs, 0, 0, 3, 0 - mov ar.rsc=15 - nop 0 - ;; -} -{ .mii - ld8 gp=[r10] // function's gp value - mov out0=r8 - mov out1=r9 -} -{ .mib - add out2=16,sp - nop 0 - br.call.sptk rp=b7 - ;; -} - add out0=16,sp - CALLSYS_NOERROR(sigreturn) - mov out0=ret0 - CALLSYS_NOERROR(exit) -END(epc_sigtramp) - - .align PAGE_SIZE - - .text - -ENTRY_NOPROFILE(epc_syscall, 8) - .prologue - .unwabi @svr4, 'E' - .save rp, r0 - .body -{ .mmi - mov r16=ar.rsc - mov ar.rsc=0 - nop 0 - ;; -} -{ .mmi - mov r18=ar.bspstore - ;; - mov r19=ar.rnat - dep r15=r18,r15,0,9 - ;; -} -{ .mmi - mov r21=ar.unat - add r30=-SIZEOF_TRAPFRAME,r14 - mov r20=sp - ;; -} -{ .mii - mov r17=r13 - dep r30=0,r30,0,10 - ;; - add sp=-16,r30 - ;; -} -{ .mmi - mov ar.bspstore=r15 - ;; - mov ar.rnat=r19 - add r31=8,r30 - ;; -} -{ .mmi - mov r13=ar.k4 - mov r22=ar.fpsr - sub r29=r14,r30 -} -{ .mmi - mov r23=ar.bsp - mov ar.rsc=3 - add r28=FRAME_SYSCALL,r0 - ;; -} -{ .mmi - st8 [r30]=r29,16 // tf_length - st8 [r31]=r28,16 // tf_flags - mov r24=rp - ;; -} -{ .mmi - st8 [r30]=r20,16 // sp - st8 [r31]=r21,16 // unat - mov r25=pr - ;; -} -{ .mmi - st8 [r30]=r10,16 // rp (syscall caller) - st8 [r31]=r25,16 // pr - mov r26=ar.pfs - ;; -} -{ .mmi - st8 [r30]=r9,16 // pfs (syscall caller) - st8 [r31]=r18,16 // bspstore - sub r27=r23,r15 - ;; -} -{ .mmi - st8 [r30]=r19,16 // rnat - st8 [r31]=r0,16 // __spare - nop 0 - ;; -} -{ .mmi - st8 [r30]=r17,16 // tp - st8 [r31]=r16,16 // rsc - dep r11=-1,r11,32,2 // Set psr.cpl=3 - ;; -} -{ .mmi - st8 [r30]=r22,16 // fpsr - st8 [r31]=r11,16 // psr - nop 0 - ;; -} -{ .mmi - st8 [r30]=r1,16 // gp - st8 [r31]=r27,16 // ndirty - nop 0 - ;; -} -{ .mmi - st8 [r30]=r26,16 // pfs (syscall stub) - st8 [r31]=r24,16 // rp (syscall stub) - nop 0 - ;; -} -{ .mmi - st8 [r30]=r0,80 // ifa - st8 [r31]=r0,80 // isr - nop 0 - ;; -} -{ .mmi - alloc r14=ar.pfs,0,0,8,0 - st8 [r30]=r8,16 // syscall number (=r15) - nop 0 - ;; -} -{ .mmi - .mem.offset 0,0 - st8.spill [r31]=r32,16 // arg0 (=r16) - .mem.offset 8,0 - st8.spill [r30]=r33,16 // arg1 (=r17) - nop 0 - ;; -} -{ .mmi - .mem.offset 16,0 - st8.spill [r31]=r34,16 // arg2 (=r18) - .mem.offset 24,0 - st8.spill [r30]=r35,16 // arg3 (=r19) - nop 0 - ;; -} -{ .mmi - .mem.offset 32,0 - st8.spill [r31]=r36,16 // arg4 (=r20) - .mem.offset 40,0 - st8.spill [r30]=r37,16 // arg5 (=r21) - nop 0 - ;; -} -{ .mmi - .mem.offset 48,0 - st8.spill [r31]=r38 // arg6 (=r22) - .mem.offset 56,0 - st8.spill [r30]=r39 // arg7 (=r23) - nop 0 - ;; -} -{ .mlx - ssm psr.dfh|psr.ac - movl gp=__gp - ;; -} -1: -{ .mib - srlz.d - add out0=16,sp - br.call.sptk rp=syscall - ;; -} - .global epc_syscall_return -epc_syscall_return: -{ .mib - add out0=16,sp - nop 0 - br.call.sptk rp=do_ast - ;; -} -{ .mib - cmp4.eq p15,p0=ERESTART,r8 - add r14=24,sp -(p15) br.spnt 1b // restart syscall - ;; -} -{ .mmi - ld8 r14=[r14] // tf_flags - nop 0 - nop 0 - ;; -} -{ .mib - nop 0 - tbit.z p15,p0=r14,0 -(p15) br.spnt exception_restore - ;; -} -{ .mmi - alloc r31=ar.pfs,0,0,0,0 - add r14=32,sp - add r15=16,sp - ;; -} -{ .mmi - ld8 r31=[r15],24 // tf_length - ld8 r16=[r14],16 // sp - add sp=16,sp - ;; -} -{ .mmi - ld8 r17=[r15],16 // unat (before) - ld8 r18=[r14],16 // rp (syscall caller) - add r31=r31,sp - ;; -} -{ .mmi - ld8 r19=[r15],16 // pr - ld8 r20=[r14],16 // pfs (syscall caller) - nop 0 - ;; -} -{ .mmi - ld8 r21=[r15],24 // bspstore - ld8 r22=[r14],24 // rnat - mov pr=r19,0x1fffe - ;; -} -{ .mmi - ld8 r23=[r15],16 // tp - ld8 r24=[r14],16 // rsc - nop 0 - ;; -} -{ .mmi - ld8 r25=[r15],16 // fpsr - ld8 r26=[r14],16 // psr - nop 0 - ;; -} -{ .mmi - ld8 gp=[r15],16 // gp - ld8 r27=[r14],16 // ndirty - tbit.z p14,p15=r26,34 // p14=ia64, p15=ia32 - ;; -} -{ .mmi - ld8 r28=[r15],56 // pfs (syscall stub) - ld8 r29=[r14],56 // rp (syscall stub) - shl r27=r27,16 - ;; -} -{ .mmi - ld8 r8=[r15],16 // r8 - mov ar.rsc=r27 - mov b6=r29 - ;; -} -{ .mmb - ld8 r9=[r14],40 // r9 - ld8 r10=[r15],40 // r10 -(p15) br.spnt epc_syscall_setup_ia32 - ;; -} -{ .mmi - loadrs - mov ar.k7=r31 - mov sp=r16 - ;; -} -{ .mmi - mov r30=ar.bspstore - mov r14=ar.k5 - mov ar.pfs=r28 - ;; -} -{ .mmi - mov ar.bspstore=r21 - add r14=gw_ret-ia64_gateway_page,r14 - dep r30=0,r30,0,13 // 8KB aligned. - ;; -} -{ .mii - mov ar.k6=r30 - mov r13=r23 - nop 0 -} -{ .mmi - mov psr.l=r26 - mov ar.unat=r17 - nop 0 - ;; -} -{ .mib - srlz.d - mov b7=r14 - br.ret.sptk b7 - ;; -} -epc_syscall_setup_ia32: -{ .mmi - loadrs - mov ar.k7=r31 - mov sp=r16 - ;; -} -{ .mmi - mov r30=ar.bspstore - ;; - mov ar.unat=r17 - dep r30=0,r30,0,13 // 8KB aligned - ;; -} -{ .mmi - mov ar.k6=r30 - mov ar.bspstore=r21 - mov r11=r0 - ;; -} -{ .mmi - ld8 r16=[r14],64 - ld8 r17=[r15],80 - mov r13=r0 - ;; -} - - ld8 r24=[r14],32 - ld8 r27=[r15],16 - ;; - ld8 r28=[r14],16 - ld8 r29=[r15],16 - ;; - ld8 r30=[r14],40 - ld8 r31=[r15],40 - ;; - -{ .mmi - ld8 r2=[r14] - ld8 r3=[r15] - mov r14=r0 - ;; -} -{ .mmi - mov ar.csd=r2 - mov ar.ssd=r3 - mov r15=r0 - ;; -} - - mov r2=ar.k5 - mov psr.l=r26 - ;; - srlz.d - add r2=gw_ret_ia32-ia64_gateway_page,r2 - ;; - mov ar.rsc=0 - mov b7=r2 - br.ret.sptk b7 - ;; -END(epc_syscall) diff --git a/sys/ia64/ia64/trap.c b/sys/ia64/ia64/trap.c deleted file mode 100644 index 987b144d..0000000 --- a/sys/ia64/ia64/trap.c +++ /dev/null @@ -1,962 +0,0 @@ -/*- - * Copyright (c) 2005 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_ddb.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kdb.h> -#include <sys/ktr.h> -#include <sys/sysproto.h> -#include <sys/kernel.h> -#include <sys/proc.h> -#include <sys/efi.h> -#include <sys/exec.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/sched.h> -#include <sys/smp.h> -#include <sys/vmmeter.h> -#include <sys/sysent.h> -#include <sys/signalvar.h> -#include <sys/syscall.h> -#include <sys/pioctl.h> -#include <sys/ptrace.h> -#include <sys/sysctl.h> -#include <vm/vm.h> -#include <vm/vm_kern.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> -#include <vm/vm_extern.h> -#include <vm/vm_param.h> -#include <sys/ptrace.h> -#include <machine/cpu.h> -#include <machine/md_var.h> -#include <machine/reg.h> -#include <machine/pal.h> -#include <machine/fpu.h> -#include <machine/pcb.h> -#ifdef SMP -#include <machine/smp.h> -#endif - -#include <security/audit/audit.h> - -#include <ia64/disasm/disasm.h> - -static int print_usertrap = 0; -SYSCTL_INT(_machdep, OID_AUTO, print_usertrap, - CTLFLAG_RW, &print_usertrap, 0, ""); - -static void break_syscall(struct trapframe *tf); - -/* - * EFI-Provided FPSWA interface (Floating Point SoftWare Assist) - */ -extern struct fpswa_iface *fpswa_iface; - -static const char *ia64_vector_names[] = { - "VHPT Translation", /* 0 */ - "Instruction TLB", /* 1 */ - "Data TLB", /* 2 */ - "Alternate Instruction TLB", /* 3 */ - "Alternate Data TLB", /* 4 */ - "Data Nested TLB", /* 5 */ - "Instruction Key Miss", /* 6 */ - "Data Key Miss", /* 7 */ - "Dirty-Bit", /* 8 */ - "Instruction Access-Bit", /* 9 */ - "Data Access-Bit", /* 10 */ - "Break Instruction", /* 11 */ - "External Interrupt", /* 12 */ - "Reserved 13", /* 13 */ - "Reserved 14", /* 14 */ - "Reserved 15", /* 15 */ - "Reserved 16", /* 16 */ - "Reserved 17", /* 17 */ - "Reserved 18", /* 18 */ - "Reserved 19", /* 19 */ - "Page Not Present", /* 20 */ - "Key Permission", /* 21 */ - "Instruction Access Rights", /* 22 */ - "Data Access Rights", /* 23 */ - "General Exception", /* 24 */ - "Disabled FP-Register", /* 25 */ - "NaT Consumption", /* 26 */ - "Speculation", /* 27 */ - "Reserved 28", /* 28 */ - "Debug", /* 29 */ - "Unaligned Reference", /* 30 */ - "Unsupported Data Reference", /* 31 */ - "Floating-point Fault", /* 32 */ - "Floating-point Trap", /* 33 */ - "Lower-Privilege Transfer Trap", /* 34 */ - "Taken Branch Trap", /* 35 */ - "Single Step Trap", /* 36 */ - "Reserved 37", /* 37 */ - "Reserved 38", /* 38 */ - "Reserved 39", /* 39 */ - "Reserved 40", /* 40 */ - "Reserved 41", /* 41 */ - "Reserved 42", /* 42 */ - "Reserved 43", /* 43 */ - "Reserved 44", /* 44 */ - "IA-32 Exception", /* 45 */ - "IA-32 Intercept", /* 46 */ - "IA-32 Interrupt", /* 47 */ - "Reserved 48", /* 48 */ - "Reserved 49", /* 49 */ - "Reserved 50", /* 50 */ - "Reserved 51", /* 51 */ - "Reserved 52", /* 52 */ - "Reserved 53", /* 53 */ - "Reserved 54", /* 54 */ - "Reserved 55", /* 55 */ - "Reserved 56", /* 56 */ - "Reserved 57", /* 57 */ - "Reserved 58", /* 58 */ - "Reserved 59", /* 59 */ - "Reserved 60", /* 60 */ - "Reserved 61", /* 61 */ - "Reserved 62", /* 62 */ - "Reserved 63", /* 63 */ - "Reserved 64", /* 64 */ - "Reserved 65", /* 65 */ - "Reserved 66", /* 66 */ - "Reserved 67", /* 67 */ -}; - -struct bitname { - uint64_t mask; - const char* name; -}; - -static void -printbits(uint64_t mask, struct bitname *bn, int count) -{ - int i, first = 1; - uint64_t bit; - - for (i = 0; i < count; i++) { - /* - * Handle fields wider than one bit. - */ - bit = bn[i].mask & ~(bn[i].mask - 1); - if (bn[i].mask > bit) { - if (first) - first = 0; - else - printf(","); - printf("%s=%ld", bn[i].name, - (mask & bn[i].mask) / bit); - } else if (mask & bit) { - if (first) - first = 0; - else - printf(","); - printf("%s", bn[i].name); - } - } -} - -struct bitname psr_bits[] = { - {IA64_PSR_BE, "be"}, - {IA64_PSR_UP, "up"}, - {IA64_PSR_AC, "ac"}, - {IA64_PSR_MFL, "mfl"}, - {IA64_PSR_MFH, "mfh"}, - {IA64_PSR_IC, "ic"}, - {IA64_PSR_I, "i"}, - {IA64_PSR_PK, "pk"}, - {IA64_PSR_DT, "dt"}, - {IA64_PSR_DFL, "dfl"}, - {IA64_PSR_DFH, "dfh"}, - {IA64_PSR_SP, "sp"}, - {IA64_PSR_PP, "pp"}, - {IA64_PSR_DI, "di"}, - {IA64_PSR_SI, "si"}, - {IA64_PSR_DB, "db"}, - {IA64_PSR_LP, "lp"}, - {IA64_PSR_TB, "tb"}, - {IA64_PSR_RT, "rt"}, - {IA64_PSR_CPL, "cpl"}, - {IA64_PSR_IS, "is"}, - {IA64_PSR_MC, "mc"}, - {IA64_PSR_IT, "it"}, - {IA64_PSR_ID, "id"}, - {IA64_PSR_DA, "da"}, - {IA64_PSR_DD, "dd"}, - {IA64_PSR_SS, "ss"}, - {IA64_PSR_RI, "ri"}, - {IA64_PSR_ED, "ed"}, - {IA64_PSR_BN, "bn"}, - {IA64_PSR_IA, "ia"}, -}; - -static void -printpsr(uint64_t psr) -{ - printbits(psr, psr_bits, sizeof(psr_bits)/sizeof(psr_bits[0])); -} - -struct bitname isr_bits[] = { - {IA64_ISR_CODE, "code"}, - {IA64_ISR_VECTOR, "vector"}, - {IA64_ISR_X, "x"}, - {IA64_ISR_W, "w"}, - {IA64_ISR_R, "r"}, - {IA64_ISR_NA, "na"}, - {IA64_ISR_SP, "sp"}, - {IA64_ISR_RS, "rs"}, - {IA64_ISR_IR, "ir"}, - {IA64_ISR_NI, "ni"}, - {IA64_ISR_SO, "so"}, - {IA64_ISR_EI, "ei"}, - {IA64_ISR_ED, "ed"}, -}; - -static void printisr(uint64_t isr) -{ - printbits(isr, isr_bits, sizeof(isr_bits)/sizeof(isr_bits[0])); -} - -static void -printtrap(int vector, struct trapframe *tf, int isfatal, int user) -{ - printf("\n"); - printf("%s %s trap (cpu %d):\n", isfatal? "fatal" : "handled", - user ? "user" : "kernel", PCPU_GET(cpuid)); - printf("\n"); - printf(" trap vector = 0x%x (%s)\n", - vector, ia64_vector_names[vector]); - printf(" cr.iip = 0x%lx\n", tf->tf_special.iip); - printf(" cr.ipsr = 0x%lx (", tf->tf_special.psr); - printpsr(tf->tf_special.psr); - printf(")\n"); - printf(" cr.isr = 0x%lx (", tf->tf_special.isr); - printisr(tf->tf_special.isr); - printf(")\n"); - printf(" cr.ifa = 0x%lx\n", tf->tf_special.ifa); - if (tf->tf_special.psr & IA64_PSR_IS) { - printf(" ar.cflg = 0x%lx\n", ia64_get_cflg()); - printf(" ar.csd = 0x%lx\n", ia64_get_csd()); - printf(" ar.ssd = 0x%lx\n", ia64_get_ssd()); - } - printf(" curthread = %p\n", curthread); - if (curthread != NULL) - printf(" pid = %d, comm = %s\n", - curthread->td_proc->p_pid, curthread->td_name); - printf("\n"); -} - -/* - * We got a trap caused by a break instruction and the immediate was 0. - * This indicates that we may have a break.b with some non-zero immediate. - * The break.b doesn't cause the immediate to be put in cr.iim. Hence, - * we need to disassemble the bundle and return the immediate found there. - * This may be a 0 value anyway. Return 0 for any error condition. This - * will result in a SIGILL, which is pretty much the best thing to do. - */ -static uint64_t -trap_decode_break(struct trapframe *tf) -{ - struct asm_bundle bundle; - struct asm_inst *inst; - int slot; - - if (!asm_decode(tf->tf_special.iip, &bundle)) - return (0); - - slot = ((tf->tf_special.psr & IA64_PSR_RI) == IA64_PSR_RI_0) ? 0 : - ((tf->tf_special.psr & IA64_PSR_RI) == IA64_PSR_RI_1) ? 1 : 2; - inst = bundle.b_inst + slot; - - /* - * Sanity checking: It must be a break instruction and the operand - * that has the break value must be an immediate. - */ - if (inst->i_op != ASM_OP_BREAK || - inst->i_oper[1].o_type != ASM_OPER_IMM) - return (0); - - return (inst->i_oper[1].o_value); -} - -void -trap_panic(int vector, struct trapframe *tf) -{ - - printtrap(vector, tf, 1, TRAPF_USERMODE(tf)); -#ifdef KDB - kdb_trap(vector, 0, tf); -#endif - panic("trap"); -} - -/* - * - */ -int -do_ast(struct trapframe *tf) -{ - - ia64_disable_intr(); - while (curthread->td_flags & (TDF_ASTPENDING|TDF_NEEDRESCHED)) { - ia64_enable_intr(); - ast(tf); - ia64_disable_intr(); - } - /* - * Keep interrupts disabled. We return r10 as a favor to the EPC - * syscall code so that it can quicky determine if the syscall - * needs to be restarted or not. - */ - return (tf->tf_scratch.gr10); -} - -/* - * Trap is called from exception.s to handle most types of processor traps. - */ -/*ARGSUSED*/ -void -trap(int vector, struct trapframe *tf) -{ - struct proc *p; - struct thread *td; - uint64_t ucode; - int error, sig, user; - ksiginfo_t ksi; - - user = TRAPF_USERMODE(tf) ? 1 : 0; - if (user) - ia64_set_fpsr(IA64_FPSR_DEFAULT); - -#ifdef XTRACE - ia64_xtrace_save(); -#endif - - PCPU_INC(cnt.v_trap); - - td = curthread; - p = td->td_proc; - ucode = 0; - - if (user) { - td->td_pticks = 0; - td->td_frame = tf; - if (td->td_ucred != p->p_ucred) - cred_update_thread(td); - } else { - KASSERT(cold || td->td_ucred != NULL, - ("kernel trap doesn't have ucred")); -#ifdef KDB - if (kdb_active) - kdb_reenter(); -#endif - } - - sig = 0; - switch (vector) { - case IA64_VEC_VHPT: - /* - * This one is tricky. We should hardwire the VHPT, but - * don't at this time. I think we're mostly lucky that - * the VHPT is mapped. - */ - trap_panic(vector, tf); - break; - - case IA64_VEC_ITLB: - case IA64_VEC_DTLB: - case IA64_VEC_EXT_INTR: - /* We never call trap() with these vectors. */ - trap_panic(vector, tf); - break; - - case IA64_VEC_ALT_ITLB: - case IA64_VEC_ALT_DTLB: - /* - * These should never happen, because regions 0-4 use the - * VHPT. If we get one of these it means we didn't program - * the region registers correctly. - */ - trap_panic(vector, tf); - break; - - case IA64_VEC_NESTED_DTLB: - /* - * When the nested TLB handler encounters an unexpected - * condition, it'll switch to the backup stack and transfer - * here. All we need to do is panic. - */ - trap_panic(vector, tf); - break; - - case IA64_VEC_IKEY_MISS: - case IA64_VEC_DKEY_MISS: - case IA64_VEC_KEY_PERMISSION: - /* - * We don't use protection keys, so we should never get - * these faults. - */ - trap_panic(vector, tf); - break; - - case IA64_VEC_DIRTY_BIT: - case IA64_VEC_INST_ACCESS: - case IA64_VEC_DATA_ACCESS: - /* - * We get here if we read or write to a page of which the - * PTE does not have the access bit or dirty bit set and - * we can not find the PTE in our datastructures. This - * either means we have a stale PTE in the TLB, or we lost - * the PTE in our datastructures. - */ - trap_panic(vector, tf); - break; - - case IA64_VEC_BREAK: - if (user) { - ucode = (int)tf->tf_special.ifa & 0x1FFFFF; - if (ucode == 0) { - /* - * A break.b doesn't cause the immediate to be - * stored in cr.iim (and saved in the TF in - * tf_special.ifa). We need to decode the - * instruction to find out what the immediate - * was. Note that if the break instruction - * didn't happen to be a break.b, but any - * other break with an immediate of 0, we - * will do unnecessary work to get the value - * we already had. Not an issue, because a - * break 0 is invalid. - */ - ucode = trap_decode_break(tf); - } - if (ucode < 0x80000) { - /* Software interrupts. */ - switch (ucode) { - case 0: /* Unknown error. */ - sig = SIGILL; - break; - case 1: /* Integer divide by zero. */ - sig = SIGFPE; - ucode = FPE_INTDIV; - break; - case 2: /* Integer overflow. */ - sig = SIGFPE; - ucode = FPE_INTOVF; - break; - case 3: /* Range check/bounds check. */ - sig = SIGFPE; - ucode = FPE_FLTSUB; - break; - case 6: /* Decimal overflow. */ - case 7: /* Decimal divide by zero. */ - case 8: /* Packed decimal error. */ - case 9: /* Invalid ASCII digit. */ - case 10: /* Invalid decimal digit. */ - sig = SIGFPE; - ucode = FPE_FLTINV; - break; - case 4: /* Null pointer dereference. */ - case 5: /* Misaligned data. */ - case 11: /* Paragraph stack overflow. */ - sig = SIGSEGV; - break; - default: - sig = SIGILL; - break; - } - } else if (ucode < 0x100000) { - /* Debugger breakpoint. */ - tf->tf_special.psr &= ~IA64_PSR_SS; - sig = SIGTRAP; - } else if (ucode == 0x100000) { - break_syscall(tf); - return; /* do_ast() already called. */ - } else if (ucode == 0x180000) { - mcontext_t mc; - - error = copyin((void*)tf->tf_scratch.gr8, - &mc, sizeof(mc)); - if (!error) { - set_mcontext(td, &mc); - return; /* Don't call do_ast()!!! */ - } - sig = SIGSEGV; - ucode = tf->tf_scratch.gr8; - } else - sig = SIGILL; - } else { -#ifdef KDB - if (kdb_trap(vector, 0, tf)) - return; - panic("trap"); -#else - trap_panic(vector, tf); -#endif - } - break; - - case IA64_VEC_PAGE_NOT_PRESENT: - case IA64_VEC_INST_ACCESS_RIGHTS: - case IA64_VEC_DATA_ACCESS_RIGHTS: { - vm_offset_t va; - struct vmspace *vm; - vm_map_t map; - vm_prot_t ftype; - int rv; - - rv = 0; - va = trunc_page(tf->tf_special.ifa); - - if (va >= VM_MAXUSER_ADDRESS) { - /* - * Don't allow user-mode faults for kernel virtual - * addresses, including the gateway page. - */ - if (user) - goto no_fault_in; - map = kernel_map; - } else { - vm = (p != NULL) ? p->p_vmspace : NULL; - if (vm == NULL) - goto no_fault_in; - map = &vm->vm_map; - } - - if (tf->tf_special.isr & IA64_ISR_X) - ftype = VM_PROT_EXECUTE; - else if (tf->tf_special.isr & IA64_ISR_W) - ftype = VM_PROT_WRITE; - else - ftype = VM_PROT_READ; - - if (map != kernel_map) { - /* - * Keep swapout from messing with us during this - * critical time. - */ - PROC_LOCK(p); - ++p->p_lock; - PROC_UNLOCK(p); - - /* Fault in the user page: */ - rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - - PROC_LOCK(p); - --p->p_lock; - PROC_UNLOCK(p); - } else { - /* - * Don't have to worry about process locking or - * stacks in the kernel. - */ - rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - } - - if (rv == KERN_SUCCESS) - goto out; - - no_fault_in: - if (!user) { - /* Check for copyin/copyout fault. */ - if (td != NULL && td->td_pcb->pcb_onfault != 0) { - tf->tf_special.iip = - td->td_pcb->pcb_onfault; - tf->tf_special.psr &= ~IA64_PSR_RI; - td->td_pcb->pcb_onfault = 0; - goto out; - } - trap_panic(vector, tf); - } - ucode = va; - sig = (rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV; - break; - } - - case IA64_VEC_GENERAL_EXCEPTION: { - int code; - - if (!user) - trap_panic(vector, tf); - - code = tf->tf_special.isr & (IA64_ISR_CODE & 0xf0ull); - switch (code) { - case 0x0: /* Illegal Operation Fault. */ - sig = ia64_emulate(tf, td); - break; - default: - sig = SIGILL; - break; - } - if (sig == 0) - goto out; - ucode = vector; - break; - } - - case IA64_VEC_SPECULATION: - /* - * The branching behaviour of the chk instruction is not - * implemented by the processor. All we need to do is - * compute the target address of the branch and make sure - * that control is transfered to that address. - * We should do this in the IVT table and not by entring - * the kernel... - */ - tf->tf_special.iip += tf->tf_special.ifa << 4; - tf->tf_special.psr &= ~IA64_PSR_RI; - goto out; - - case IA64_VEC_NAT_CONSUMPTION: - case IA64_VEC_UNSUPP_DATA_REFERENCE: - if (user) { - ucode = vector; - sig = SIGILL; - } else - trap_panic(vector, tf); - break; - - case IA64_VEC_DISABLED_FP: { - if (user) - ia64_highfp_enable(td, tf); - else - trap_panic(vector, tf); - goto out; - } - - case IA64_VEC_DEBUG: - case IA64_VEC_SINGLE_STEP_TRAP: - tf->tf_special.psr &= ~IA64_PSR_SS; - if (!user) { -#ifdef KDB - if (kdb_trap(vector, 0, tf)) - return; - panic("trap"); -#else - trap_panic(vector, tf); -#endif - } - sig = SIGTRAP; - break; - - case IA64_VEC_UNALIGNED_REFERENCE: - /* - * If user-land, do whatever fixups, printing, and - * signalling is appropriate (based on system-wide - * and per-process unaligned-access-handling flags). - */ - if (user) { - sig = unaligned_fixup(tf, td); - if (sig == 0) - goto out; - ucode = tf->tf_special.ifa; /* VA */ - } else { - /* Check for copyin/copyout fault. */ - if (td != NULL && td->td_pcb->pcb_onfault != 0) { - tf->tf_special.iip = - td->td_pcb->pcb_onfault; - tf->tf_special.psr &= ~IA64_PSR_RI; - td->td_pcb->pcb_onfault = 0; - goto out; - } - trap_panic(vector, tf); - } - break; - - case IA64_VEC_FLOATING_POINT_FAULT: - case IA64_VEC_FLOATING_POINT_TRAP: { - struct fpswa_bundle bundle; - struct fpswa_fpctx fpctx; - struct fpswa_ret ret; - char *ip; - u_long fault; - - /* Always fatal in kernel. Should never happen. */ - if (!user) - trap_panic(vector, tf); - - if (fpswa_iface == NULL) { - sig = SIGFPE; - ucode = 0; - break; - } - - ip = (char *)tf->tf_special.iip; - if (vector == IA64_VEC_FLOATING_POINT_TRAP && - (tf->tf_special.psr & IA64_PSR_RI) == 0) - ip -= 16; - error = copyin(ip, &bundle, sizeof(bundle)); - if (error) { - sig = SIGBUS; /* EFAULT, basically */ - ucode = 0; /* exception summary */ - break; - } - - /* f6-f15 are saved in exception_save */ - fpctx.mask_low = 0xffc0; /* bits 6 - 15 */ - fpctx.mask_high = 0; - fpctx.fp_low_preserved = NULL; - fpctx.fp_low_volatile = &tf->tf_scratch_fp.fr6; - fpctx.fp_high_preserved = NULL; - fpctx.fp_high_volatile = NULL; - - fault = (vector == IA64_VEC_FLOATING_POINT_FAULT) ? 1 : 0; - - /* - * We have the high FP registers disabled while in the - * kernel. Enable them for the FPSWA handler only. - */ - ia64_enable_highfp(); - - /* The docs are unclear. Is Fpswa reentrant? */ - ret = fpswa_iface->if_fpswa(fault, &bundle, - &tf->tf_special.psr, &tf->tf_special.fpsr, - &tf->tf_special.isr, &tf->tf_special.pr, - &tf->tf_special.cfm, &fpctx); - - ia64_disable_highfp(); - - /* - * Update ipsr and iip to next instruction. We only - * have to do that for faults. - */ - if (fault && (ret.status == 0 || (ret.status & 2))) { - int ei; - - ei = (tf->tf_special.isr >> 41) & 0x03; - if (ei == 0) { /* no template for this case */ - tf->tf_special.psr &= ~IA64_ISR_EI; - tf->tf_special.psr |= IA64_ISR_EI_1; - } else if (ei == 1) { /* MFI or MFB */ - tf->tf_special.psr &= ~IA64_ISR_EI; - tf->tf_special.psr |= IA64_ISR_EI_2; - } else if (ei == 2) { /* MMF */ - tf->tf_special.psr &= ~IA64_ISR_EI; - tf->tf_special.iip += 0x10; - } - } - - if (ret.status == 0) { - goto out; - } else if (ret.status == -1) { - printf("FATAL: FPSWA err1 %lx, err2 %lx, err3 %lx\n", - ret.err1, ret.err2, ret.err3); - panic("fpswa fatal error on fp fault"); - } else { - sig = SIGFPE; - ucode = 0; /* XXX exception summary */ - break; - } - } - - case IA64_VEC_LOWER_PRIVILEGE_TRANSFER: - /* - * The lower-privilege transfer trap is used by the EPC - * syscall code to trigger re-entry into the kernel when the - * process should be single stepped. The problem is that - * there's no way to set single stepping directly without - * using the rfi instruction. So instead we enable the - * lower-privilege transfer trap and when we get here we - * know that the process is about to enter userland (and - * has already lowered its privilege). - * However, there's another gotcha. When the process has - * lowered it's privilege it's still running in the gateway - * page. If we enable single stepping, we'll be stepping - * the code in the gateway page. In and by itself this is - * not a problem, but it's an address debuggers won't know - * anything about. Hence, it can only cause confusion. - * We know that we need to branch to get out of the gateway - * page, so what we do here is enable the taken branch - * trap and just let the process continue. When we branch - * out of the gateway page we'll get back into the kernel - * and then we enable single stepping. - * Since this a rather round-about way of enabling single - * stepping, don't make things even more complicated by - * calling userret() and do_ast(). We do that later... - */ - tf->tf_special.psr &= ~IA64_PSR_LP; - tf->tf_special.psr |= IA64_PSR_TB; - return; - - case IA64_VEC_TAKEN_BRANCH_TRAP: - /* - * Don't assume there aren't any branches other than the - * branch that takes us out of the gateway page. Check the - * iip and enable single stepping only when it's an user - * address. - */ - if (tf->tf_special.iip >= VM_MAXUSER_ADDRESS) - return; - tf->tf_special.psr &= ~IA64_PSR_TB; - tf->tf_special.psr |= IA64_PSR_SS; - return; - - case IA64_VEC_IA32_EXCEPTION: - case IA64_VEC_IA32_INTERCEPT: - case IA64_VEC_IA32_INTERRUPT: - sig = SIGEMT; - ucode = tf->tf_special.iip; - break; - - default: - /* Reserved vectors get here. Should never happen of course. */ - trap_panic(vector, tf); - break; - } - - KASSERT(sig != 0, ("foo")); - - if (print_usertrap) - printtrap(vector, tf, 1, user); - - ksiginfo_init(&ksi); - ksi.ksi_signo = sig; - ksi.ksi_code = ucode; - trapsignal(td, &ksi); - -out: - if (user) { - userret(td, tf); - do_ast(tf); - } - return; -} - -/* - * Handle break instruction based system calls. - */ -void -break_syscall(struct trapframe *tf) -{ - uint64_t *bsp, *tfp; - uint64_t iip, psr; - int error, nargs; - - /* Save address of break instruction. */ - iip = tf->tf_special.iip; - psr = tf->tf_special.psr; - - /* Advance to the next instruction. */ - tf->tf_special.psr += IA64_PSR_RI_1; - if ((tf->tf_special.psr & IA64_PSR_RI) > IA64_PSR_RI_2) { - tf->tf_special.iip += 16; - tf->tf_special.psr &= ~IA64_PSR_RI; - } - - /* - * Copy the arguments on the register stack into the trapframe - * to avoid having interleaved NaT collections. - */ - tfp = &tf->tf_scratch.gr16; - nargs = tf->tf_special.cfm & 0x7f; - bsp = (uint64_t*)(curthread->td_kstack + tf->tf_special.ndirty + - (tf->tf_special.bspstore & 0x1ffUL)); - bsp -= (((uintptr_t)bsp & 0x1ff) < (nargs << 3)) ? (nargs + 1): nargs; - while (nargs--) { - *tfp++ = *bsp++; - if (((uintptr_t)bsp & 0x1ff) == 0x1f8) - bsp++; - } - error = syscall(tf); - if (error == ERESTART) { - tf->tf_special.iip = iip; - tf->tf_special.psr = psr; - } - - do_ast(tf); -} - -int -cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa) -{ - struct proc *p; - struct trapframe *tf; - - p = td->td_proc; - tf = td->td_frame; - - sa->code = tf->tf_scratch.gr15; - sa->args = &tf->tf_scratch.gr16; - - /* - * syscall() and __syscall() are handled the same on - * the ia64, as everything is 64-bit aligned, anyway. - */ - if (sa->code == SYS_syscall || sa->code == SYS___syscall) { - /* - * Code is first argument, followed by actual args. - */ - sa->code = sa->args[0]; - sa->args++; - } - - if (p->p_sysent->sv_mask) - sa->code &= p->p_sysent->sv_mask; - if (sa->code >= p->p_sysent->sv_size) - sa->callp = &p->p_sysent->sv_table[0]; - else - sa->callp = &p->p_sysent->sv_table[sa->code]; - sa->narg = sa->callp->sy_narg; - - td->td_retval[0] = 0; - td->td_retval[1] = 0; - - return (0); -} - -#include "../../kern/subr_syscall.c" - -/* - * Process a system call. - * - * See syscall.s for details as to how we get here. In order to support - * the ERESTART case, we return the error to our caller. They deal with - * the hairy details. - */ -int -syscall(struct trapframe *tf) -{ - struct syscall_args sa; - struct thread *td; - int error; - - td = curthread; - td->td_frame = tf; - - ia64_set_fpsr(IA64_FPSR_DEFAULT); - tf->tf_scratch.gr10 = EJUSTRETURN; - - error = syscallenter(td, &sa); - syscallret(td, error, &sa); - - return (error); -} diff --git a/sys/ia64/ia64/uio_machdep.c b/sys/ia64/ia64/uio_machdep.c deleted file mode 100644 index 35a4d42..0000000 --- a/sys/ia64/ia64/uio_machdep.c +++ /dev/null @@ -1,120 +0,0 @@ -/*- - * Copyright (c) 2004 Alan L. Cox <alc@cs.rice.edu> - * Copyright (c) 1982, 1986, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)kern_subr.c 8.3 (Berkeley) 1/21/94 - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/uio.h> - -#include <vm/vm.h> -#include <vm/vm_page.h> - -#include <machine/vmparam.h> - -/* - * Implement uiomove(9) from physical memory using the direct map to - * avoid the creation and destruction of ephemeral mappings. - */ -int -uiomove_fromphys(vm_page_t ma[], vm_offset_t offset, int n, struct uio *uio) -{ - struct thread *td = curthread; - struct iovec *iov; - void *cp; - vm_offset_t page_offset; - size_t cnt; - int error = 0; - int save = 0; - - KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE, - ("uiomove_fromphys: mode")); - KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == curthread, - ("uiomove_fromphys proc")); - save = td->td_pflags & TDP_DEADLKTREAT; - td->td_pflags |= TDP_DEADLKTREAT; - while (n > 0 && uio->uio_resid) { - iov = uio->uio_iov; - cnt = iov->iov_len; - if (cnt == 0) { - uio->uio_iov++; - uio->uio_iovcnt--; - continue; - } - if (cnt > n) - cnt = n; - page_offset = offset & PAGE_MASK; - cnt = min(cnt, PAGE_SIZE - page_offset); - cp = (char *) - IA64_PHYS_TO_RR7(ma[offset >> PAGE_SHIFT]->phys_addr) + - page_offset; - switch (uio->uio_segflg) { - case UIO_USERSPACE: - maybe_yield(); - if (uio->uio_rw == UIO_READ) - error = copyout(cp, iov->iov_base, cnt); - else - error = copyin(iov->iov_base, cp, cnt); - if (error) - goto out; - break; - case UIO_SYSSPACE: - if (uio->uio_rw == UIO_READ) - bcopy(cp, iov->iov_base, cnt); - else - bcopy(iov->iov_base, cp, cnt); - break; - case UIO_NOCOPY: - break; - } - iov->iov_base = (char *)iov->iov_base + cnt; - iov->iov_len -= cnt; - uio->uio_resid -= cnt; - uio->uio_offset += cnt; - offset += cnt; - n -= cnt; - } -out: - if (save == 0) - td->td_pflags &= ~TDP_DEADLKTREAT; - return (error); -} diff --git a/sys/ia64/ia64/uma_machdep.c b/sys/ia64/ia64/uma_machdep.c deleted file mode 100644 index 29a45ea..0000000 --- a/sys/ia64/ia64/uma_machdep.c +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * Copyright (c) 2003 The FreeBSD Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/mutex.h> -#include <sys/systm.h> -#include <vm/vm.h> -#include <vm/vm_page.h> -#include <vm/vm_pageout.h> -#include <vm/uma.h> -#include <vm/uma_int.h> -#include <machine/vmparam.h> - -void * -uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) -{ - void *va; - vm_page_t m; - int pflags; - - *flags = UMA_SLAB_PRIV; - pflags = malloc2vm_flags(wait) | VM_ALLOC_WIRED; - - for (;;) { - m = vm_page_alloc(NULL, 0, pflags | VM_ALLOC_NOOBJ); - if (m == NULL) { - if (wait & M_NOWAIT) - return (NULL); - VM_WAIT; - } else - break; - } - - va = (void *)IA64_PHYS_TO_RR7(VM_PAGE_TO_PHYS(m)); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero(va, PAGE_SIZE); - return (va); -} - -void -uma_small_free(void *mem, int size, u_int8_t flags) -{ - vm_page_t m; - - m = PHYS_TO_VM_PAGE(IA64_RR_MASK((u_int64_t)mem)); - m->wire_count--; - vm_page_free(m); - atomic_subtract_int(&vm_cnt.v_wire_count, 1); -} diff --git a/sys/ia64/ia64/unaligned.c b/sys/ia64/ia64/unaligned.c deleted file mode 100644 index d4478f2..0000000 --- a/sys/ia64/ia64/unaligned.c +++ /dev/null @@ -1,307 +0,0 @@ -/*- - * Copyright (c) 2003 Marcel Moolenaar - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/proc.h> -#include <sys/sysctl.h> -#include <vm/vm.h> -#include <vm/vm_extern.h> -#include <machine/frame.h> -#include <machine/md_var.h> -#include <ia64/disasm/disasm.h> - -static int ia64_unaligned_print = 0; -SYSCTL_INT(_debug, OID_AUTO, unaligned_print, CTLFLAG_RW, - &ia64_unaligned_print, 0, "warn about unaligned accesses"); - -static int ia64_unaligned_test = 0; -SYSCTL_INT(_debug, OID_AUTO, unaligned_test, CTLFLAG_RW, - &ia64_unaligned_test, 0, "test emulation when PSR.ac is set"); - -static void * -fpreg_ptr(mcontext_t *mc, int fr) -{ - union _ia64_fpreg *p; - - if (fr <= 1 || fr >= 128) - return (NULL); - if (fr >= 32) { - p = &mc->mc_high_fp.fr32; - fr -= 32; - } else if (fr >= 16) { - p = &mc->mc_preserved_fp.fr16; - fr -= 16; - } else if (fr >= 6) { - p = &mc->mc_scratch_fp.fr6; - fr -= 6; - } else { - p = &mc->mc_preserved_fp.fr2; - fr -= 2; - } - return ((void*)(p + fr)); -} - -static void * -greg_ptr(mcontext_t *mc, int gr) -{ - uint64_t *p; - int nslots; - - if (gr <= 0 || gr >= 32 + (mc->mc_special.cfm & 0x7f)) - return (NULL); - if (gr >= 32) { - nslots = IA64_CFM_SOF(mc->mc_special.cfm) - gr + 32; - p = (void *)ia64_bsp_adjust(mc->mc_special.bspstore, -nslots); - gr = 0; - } else if (gr >= 14) { - p = &mc->mc_scratch.gr14; - gr -= 14; - } else if (gr == 13) { - p = &mc->mc_special.tp; - gr = 0; - } else if (gr == 12) { - p = &mc->mc_special.sp; - gr = 0; - } else if (gr >= 8) { - p = &mc->mc_scratch.gr8; - gr -= 8; - } else if (gr >= 4) { - p = &mc->mc_preserved.gr4; - gr -= 4; - } else if (gr >= 2) { - p = &mc->mc_scratch.gr2; - gr -= 2; - } else { - p = &mc->mc_special.gp; - gr = 0; - } - return ((void*)(p + gr)); -} - -static uint64_t -rdreg(uint64_t *addr) -{ - if ((uintptr_t)addr < VM_MAXUSER_ADDRESS) - return (fuword(addr)); - return (*addr); -} - -static void -wrreg(uint64_t *addr, uint64_t val) -{ - if ((uintptr_t)addr < VM_MAXUSER_ADDRESS) - suword(addr, val); - else - *addr = val; -} - -static int -fixup(struct asm_inst *i, mcontext_t *mc, uint64_t va) -{ - union { - double d; - long double e; - uint64_t i; - float s; - } buf; - void *reg; - uint64_t postinc; - - switch (i->i_op) { - case ASM_OP_LD2: - copyin((void*)va, (void*)&buf.i, 2); - reg = greg_ptr(mc, (int)i->i_oper[1].o_value); - if (reg == NULL) - return (EINVAL); - wrreg(reg, buf.i & 0xffffU); - break; - case ASM_OP_LD4: - copyin((void*)va, (void*)&buf.i, 4); - reg = greg_ptr(mc, (int)i->i_oper[1].o_value); - if (reg == NULL) - return (EINVAL); - wrreg(reg, buf.i & 0xffffffffU); - break; - case ASM_OP_LD8: - copyin((void*)va, (void*)&buf.i, 8); - reg = greg_ptr(mc, (int)i->i_oper[1].o_value); - if (reg == NULL) - return (EINVAL); - wrreg(reg, buf.i); - break; - case ASM_OP_LDFD: - copyin((void*)va, (void*)&buf.d, sizeof(buf.d)); - reg = fpreg_ptr(mc, (int)i->i_oper[1].o_value); - if (reg == NULL) - return (EINVAL); - __asm("ldfd f6=%1;; stf.spill %0=f6" : "=m"(*(double *)reg) : - "m"(buf.d) : "f6"); - break; - case ASM_OP_LDFE: - copyin((void*)va, (void*)&buf.e, sizeof(buf.e)); - reg = fpreg_ptr(mc, (int)i->i_oper[1].o_value); - if (reg == NULL) - return (EINVAL); - __asm("ldfe f6=%1;; stf.spill %0=f6" : - "=m"(*(long double *)reg) : "m"(buf.e) : "f6"); - break; - case ASM_OP_LDFS: - copyin((void*)va, (void*)&buf.s, sizeof(buf.s)); - reg = fpreg_ptr(mc, (int)i->i_oper[1].o_value); - if (reg == NULL) - return (EINVAL); - __asm("ldfs f6=%1;; stf.spill %0=f6" : "=m"(*(float *)reg) : - "m"(buf.s) : "f6"); - break; - case ASM_OP_ST2: - reg = greg_ptr(mc, (int)i->i_oper[2].o_value); - if (reg == NULL) - return (EINVAL); - buf.i = rdreg(reg); - copyout((void*)&buf.i, (void*)va, 2); - break; - case ASM_OP_ST4: - reg = greg_ptr(mc, (int)i->i_oper[2].o_value); - if (reg == NULL) - return (EINVAL); - buf.i = rdreg(reg); - copyout((void*)&buf.i, (void*)va, 4); - break; - case ASM_OP_ST8: - reg = greg_ptr(mc, (int)i->i_oper[2].o_value); - if (reg == NULL) - return (EINVAL); - buf.i = rdreg(reg); - copyout((void*)&buf.i, (void*)va, 8); - break; - case ASM_OP_STFD: - reg = fpreg_ptr(mc, (int)i->i_oper[2].o_value); - if (reg == NULL) - return (EINVAL); - __asm("ldf.fill f6=%1;; stfd %0=f6" : "=m"(buf.d) : - "m"(*(double *)reg) : "f6"); - copyout((void*)&buf.d, (void*)va, sizeof(buf.d)); - break; - case ASM_OP_STFE: - reg = fpreg_ptr(mc, (int)i->i_oper[2].o_value); - if (reg == NULL) - return (EINVAL); - __asm("ldf.fill f6=%1;; stfe %0=f6" : "=m"(buf.e) : - "m"(*(long double *)reg) : "f6"); - copyout((void*)&buf.e, (void*)va, sizeof(buf.e)); - break; - case ASM_OP_STFS: - reg = fpreg_ptr(mc, (int)i->i_oper[2].o_value); - if (reg == NULL) - return (EINVAL); - __asm("ldf.fill f6=%1;; stfs %0=f6" : "=m"(buf.s) : - "m"(*(float *)reg) : "f6"); - copyout((void*)&buf.s, (void*)va, sizeof(buf.s)); - break; - default: - return (ENOENT); - } - - /* Handle post-increment. */ - if (i->i_oper[3].o_type == ASM_OPER_GREG) { - reg = greg_ptr(mc, (int)i->i_oper[3].o_value); - if (reg == NULL) - return (EINVAL); - postinc = rdreg(reg); - } else - postinc = (i->i_oper[3].o_type == ASM_OPER_IMM) - ? i->i_oper[3].o_value : 0; - if (postinc != 0) { - if (i->i_oper[1].o_type == ASM_OPER_MEM) - reg = greg_ptr(mc, (int)i->i_oper[1].o_value); - else - reg = greg_ptr(mc, (int)i->i_oper[2].o_value); - if (reg == NULL) - return (EINVAL); - postinc += rdreg(reg); - wrreg(reg, postinc); - } - return (0); -} - -int -unaligned_fixup(struct trapframe *tf, struct thread *td) -{ - mcontext_t context; - struct asm_bundle bundle; - int error, slot; - - slot = ((tf->tf_special.psr & IA64_PSR_RI) == IA64_PSR_RI_0) ? 0 : - ((tf->tf_special.psr & IA64_PSR_RI) == IA64_PSR_RI_1) ? 1 : 2; - - if (ia64_unaligned_print) { - uprintf("pid %d (%s): unaligned access: va=0x%lx, pc=0x%lx\n", - td->td_proc->p_pid, td->td_proc->p_comm, - tf->tf_special.ifa, tf->tf_special.iip + slot); - } - - /* - * If PSR.ac is set, the process wants to be signalled about mis- - * aligned loads and stores. Send it a SIGBUS. In order for us to - * test the emulation of misaligned loads and stores, we have a - * sysctl that tells us that we must emulate the load or store, - * instead of sending the signal. We need the sysctl because if - * PSR.ac is not set, the CPU may (and likely will) deal with the - * misaligned load or store itself. As such, we won't get the - * exception. - */ - if ((tf->tf_special.psr & IA64_PSR_AC) && !ia64_unaligned_test) - return (SIGBUS); - - if (!asm_decode(tf->tf_special.iip, &bundle)) - return (SIGILL); - - get_mcontext(td, &context, 0); - - error = fixup(bundle.b_inst + slot, &context, tf->tf_special.ifa); - if (error == ENOENT) { - printf("unhandled misaligned memory access:\n\t"); - asm_print_inst(&bundle, slot, tf->tf_special.iip); - return (SIGILL); - } else if (error != 0) - return (SIGBUS); - - set_mcontext(td, &context); - - /* Advance to the next instruction. */ - if (slot == 2) { - tf->tf_special.psr &= ~IA64_PSR_RI; - tf->tf_special.iip += 16; - } else - tf->tf_special.psr += IA64_PSR_RI_1; - - return (0); -} diff --git a/sys/ia64/ia64/unwind.c b/sys/ia64/ia64/unwind.c deleted file mode 100644 index 7b4c6d2..0000000 --- a/sys/ia64/ia64/unwind.c +++ /dev/null @@ -1,483 +0,0 @@ -/*- - * Copyright (c) 2003, 2004 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/kdb.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/malloc.h> -#include <sys/queue.h> - -#include <machine/frame.h> -#include <machine/md_var.h> -#include <machine/pcb.h> -#include <machine/unwind.h> - -#include <uwx.h> - -static MALLOC_DEFINE(M_UNWIND, "Unwind", "Unwind information"); - -struct unw_entry { - uint64_t ue_start; /* procedure start */ - uint64_t ue_end; /* procedure end */ - uint64_t ue_info; /* offset to procedure descriptors */ -}; - -struct unw_table { - LIST_ENTRY(unw_table) ut_link; - uint64_t ut_base; - uint64_t ut_limit; - struct unw_entry *ut_start; - struct unw_entry *ut_end; -}; - -LIST_HEAD(unw_table_list, unw_table); - -static struct unw_table_list unw_tables; - -#ifdef KDB -#define KDBHEAPSZ 8192 - -struct mhdr { - uint32_t sig; -#define MSIG_FREE 0x65657246 /* "Free". */ -#define MSIG_USED 0x64657355 /* "Used". */ - uint32_t size; - int32_t next; - int32_t prev; -}; - -static struct mhdr *kdbheap; -#endif /* KDB */ - -static void * -unw_alloc(size_t sz) -{ -#ifdef KDB - struct mhdr *hdr, *hfree; - - if (kdb_active) { - sz = (sz + 15) >> 4; - hdr = kdbheap; - while (hdr->sig != MSIG_FREE || hdr->size < sz) { - if (hdr->next == -1) - return (NULL); - hdr = kdbheap + hdr->next; - } - if (hdr->size > sz + 1) { - hfree = hdr + sz + 1; - hfree->sig = MSIG_FREE; - hfree->size = hdr->size - sz - 1; - hfree->prev = hdr - kdbheap; - hfree->next = hdr->next; - hdr->size = sz; - hdr->next = hfree - kdbheap; - if (hfree->next >= 0) { - hfree = kdbheap + hfree->next; - hfree->prev = hdr->next; - } - } - hdr->sig = MSIG_USED; - return (void*)(hdr + 1); - } -#endif - return (malloc(sz, M_UNWIND, M_NOWAIT)); -} - -static void -unw_free(void *p) -{ -#ifdef KDB - struct mhdr *hdr, *hfree; - - if (kdb_active) { - hdr = (struct mhdr*)p - 1; - if (hdr->sig != MSIG_USED) - return; - hdr->sig = MSIG_FREE; - if (hdr->prev >= 0 && kdbheap[hdr->prev].sig == MSIG_FREE) { - hfree = kdbheap + hdr->prev; - hfree->size += hdr->size + 1; - hfree->next = hdr->next; - if (hdr->next >= 0) { - hfree = kdbheap + hdr->next; - hfree->prev = hdr->prev; - } - } else if (hdr->next >= 0 && - kdbheap[hdr->next].sig == MSIG_FREE) { - hfree = kdbheap + hdr->next; - hdr->size += hfree->size + 1; - hdr->next = hfree->next; - if (hdr->next >= 0) { - hfree = kdbheap + hdr->next; - hfree->prev = hdr - kdbheap; - } - } - return; - } -#endif - free(p, M_UNWIND); -} - -static struct unw_table * -unw_table_lookup(uint64_t ip) -{ - struct unw_table *ut; - - LIST_FOREACH(ut, &unw_tables, ut_link) { - if (ip >= ut->ut_base && ip < ut->ut_limit) - return (ut); - } - return (NULL); -} - -static uint64_t -unw_copyin_from_frame(struct trapframe *tf, uint64_t from) -{ - uint64_t val; - int reg; - - if (from == UWX_REG_AR_PFS) - val = tf->tf_special.pfs; - else if (from == UWX_REG_PREDS) - val = tf->tf_special.pr; - else if (from == UWX_REG_AR_RNAT) - val = tf->tf_special.rnat; - else if (from == UWX_REG_AR_UNAT) - val = tf->tf_special.unat; - else if (from >= UWX_REG_GR(0) && from <= UWX_REG_GR(127)) { - reg = from - UWX_REG_GR(0); - if (reg == 1) - val = tf->tf_special.gp; - else if (reg == 12) - val = tf->tf_special.sp; - else if (reg == 13) - val = tf->tf_special.tp; - else if (reg >= 2 && reg <= 3) - val = (&tf->tf_scratch.gr2)[reg - 2]; - else if (reg >= 8 && reg <= 11) - val = (&tf->tf_scratch.gr8)[reg - 8]; - else if (reg >= 14 && reg <= 31) - val = (&tf->tf_scratch.gr14)[reg - 14]; - else - goto oops; - } else if (from >= UWX_REG_BR(0) && from <= UWX_REG_BR(7)) { - reg = from - UWX_REG_BR(0); - if (reg == 0) - val = tf->tf_special.rp; - else if (reg >= 6 && reg <= 7) - val = (&tf->tf_scratch.br6)[reg - 6]; - else - goto oops; - } else - goto oops; - return (val); - - oops: - printf("UNW: %s(%p, %lx)\n", __func__, tf, from); - return (0UL); -} - -static uint64_t -unw_copyin_from_pcb(struct pcb *pcb, uint64_t from) -{ - uint64_t val; - int reg; - - if (from == UWX_REG_AR_PFS) - val = pcb->pcb_special.pfs; - else if (from == UWX_REG_PREDS) - val = pcb->pcb_special.pr; - else if (from == UWX_REG_AR_RNAT) - val = pcb->pcb_special.rnat; - else if (from == UWX_REG_AR_UNAT) - val = pcb->pcb_special.unat; - else if (from >= UWX_REG_GR(0) && from <= UWX_REG_GR(127)) { - reg = from - UWX_REG_GR(0); - if (reg == 1) - val = pcb->pcb_special.gp; - else if (reg == 12) - val = pcb->pcb_special.sp; - else if (reg == 13) - val = pcb->pcb_special.tp; - else if (reg >= 4 && reg <= 7) - val = (&pcb->pcb_preserved.gr4)[reg - 4]; - else - goto oops; - } else if (from >= UWX_REG_BR(0) && from <= UWX_REG_BR(7)) { - reg = from - UWX_REG_BR(0); - if (reg == 0) - val = pcb->pcb_special.rp; - else if (reg >= 1 && reg <= 5) - val = (&pcb->pcb_preserved.br1)[reg - 1]; - else - goto oops; - } else - goto oops; - return (val); - - oops: - printf("UNW: %s(%p, %lx)\n", __func__, pcb, from); - return (0UL); -} - -static int -unw_cb_copyin(int req, char *to, uint64_t from, int len, intptr_t tok) -{ - struct unw_regstate *rs = (void*)tok; - uint64_t val; - - switch (req) { - case UWX_COPYIN_UINFO: - break; - case UWX_COPYIN_MSTACK: - *((uint64_t*)to) = *((uint64_t*)from); - return (8); - case UWX_COPYIN_RSTACK: - *((uint64_t*)to) = *((uint64_t*)from); - return (8); - case UWX_COPYIN_REG: - if (rs->frame != NULL) - val = unw_copyin_from_frame(rs->frame, from); - else if (rs->pcb != NULL) - val = unw_copyin_from_pcb(rs->pcb, from); - else - goto oops; - *((uint64_t*)to) = val; - return (len); - } - - oops: - printf("UNW: %s(%d, %p, %lx, %d, %lx)\n", __func__, req, to, from, - len, tok); - return (0); -} - -static int -unw_cb_lookup(int req, uint64_t ip, intptr_t tok, uint64_t **vec) -{ - struct unw_regstate *rs = (void*)tok; - struct unw_table *ut; - - switch (req) { - case UWX_LKUP_LOOKUP: - ut = unw_table_lookup(ip); - if (ut == NULL) - return (UWX_LKUP_NOTFOUND); - rs->keyval[0] = UWX_KEY_TBASE; - rs->keyval[1] = ut->ut_base; - rs->keyval[2] = UWX_KEY_USTART; - rs->keyval[3] = (intptr_t)ut->ut_start; - rs->keyval[4] = UWX_KEY_UEND; - rs->keyval[5] = (intptr_t)ut->ut_end; - rs->keyval[6] = 0; - rs->keyval[7] = 0; - *vec = rs->keyval; - return (UWX_LKUP_UTABLE); - case UWX_LKUP_FREE: - return (0); - } - - return (UWX_LKUP_ERR); -} - -int -unw_create_from_frame(struct unw_regstate *rs, struct trapframe *tf) -{ - uint64_t bsp, ip; - int uwxerr; - - rs->frame = tf; - rs->pcb = NULL; - rs->env = uwx_init(); - if (rs->env == NULL) - return (ENOMEM); - - uwxerr = uwx_register_callbacks(rs->env, (intptr_t)rs, - unw_cb_copyin, unw_cb_lookup); - if (uwxerr) - return (EINVAL); /* XXX */ - - bsp = tf->tf_special.bspstore + tf->tf_special.ndirty; - bsp = ia64_bsp_adjust(bsp, -IA64_CFM_SOF(tf->tf_special.cfm)); - ip = tf->tf_special.iip + ((tf->tf_special.psr >> 41) & 3); - - uwxerr = uwx_init_context(rs->env, ip, tf->tf_special.sp, bsp, - tf->tf_special.cfm); - - return ((uwxerr) ? EINVAL : 0); /* XXX */ -} - -int -unw_create_from_pcb(struct unw_regstate *rs, struct pcb *pcb) -{ - uint64_t bsp, cfm, ip; - int uwxerr; - - rs->frame = NULL; - rs->pcb = pcb; - rs->env = uwx_init(); - if (rs->env == NULL) - return (ENOMEM); - - uwxerr = uwx_register_callbacks(rs->env, (intptr_t)rs, - unw_cb_copyin, unw_cb_lookup); - if (uwxerr) - return (EINVAL); /* XXX */ - - bsp = pcb->pcb_special.bspstore; - if (pcb->pcb_special.__spare == ~0UL) { - ip = pcb->pcb_special.iip + ((pcb->pcb_special.psr >> 41) & 3); - cfm = pcb->pcb_special.cfm; - bsp += pcb->pcb_special.ndirty; - bsp = ia64_bsp_adjust(bsp, -IA64_CFM_SOF(cfm)); - } else { - ip = pcb->pcb_special.rp; - cfm = pcb->pcb_special.pfs; - bsp = ia64_bsp_adjust(bsp, -IA64_CFM_SOL(cfm)); - } - uwxerr = uwx_init_context(rs->env, ip, pcb->pcb_special.sp, bsp, cfm); - - return ((uwxerr) ? EINVAL : 0); /* XXX */ -} - -void -unw_delete(struct unw_regstate *rs) -{ - - if (rs->env != NULL) - uwx_free(rs->env); -} - -int -unw_step(struct unw_regstate *rs) -{ - int err; - - switch (uwx_step(rs->env)) { - case UWX_ABI_FRAME: - err = ERESTART; - break; - case UWX_BOTTOM: - err = EJUSTRETURN; - break; - case UWX_OK: - err = 0; - break; - default: - err = EINVAL; /* XXX */ - break; - } - return (err); -} - -int -unw_get_bsp(struct unw_regstate *s, uint64_t *r) -{ - int uwxerr; - - uwxerr = uwx_get_reg(s->env, UWX_REG_BSP, r); - return ((uwxerr) ? EINVAL : 0); /* XXX */ -} - -int -unw_get_cfm(struct unw_regstate *s, uint64_t *r) -{ - int uwxerr; - - uwxerr = uwx_get_reg(s->env, UWX_REG_CFM, r); - return ((uwxerr) ? EINVAL : 0); /* XXX */ -} - -int -unw_get_ip(struct unw_regstate *s, uint64_t *r) -{ - int uwxerr; - - uwxerr = uwx_get_reg(s->env, UWX_REG_IP, r); - return ((uwxerr) ? EINVAL : 0); /* XXX */ -} - -int -unw_get_sp(struct unw_regstate *s, uint64_t *r) -{ - int uwxerr; - - uwxerr = uwx_get_reg(s->env, UWX_REG_SP, r); - return ((uwxerr) ? EINVAL : 0); /* XXX */ -} - -int -unw_table_add(uint64_t base, uint64_t start, uint64_t end) -{ - struct unw_table *ut; - - ut = malloc(sizeof(struct unw_table), M_UNWIND, M_WAITOK); - ut->ut_base = base; - ut->ut_start = (struct unw_entry*)start; - ut->ut_end = (struct unw_entry*)end; - ut->ut_limit = base + ut->ut_end[-1].ue_end; - LIST_INSERT_HEAD(&unw_tables, ut, ut_link); - - if (bootverbose) - printf("UNWIND: table added: base=%lx, start=%lx, end=%lx\n", - base, start, end); - - return (0); -} - -void -unw_table_remove(uint64_t base) -{ - struct unw_table *ut; - - ut = unw_table_lookup(base); - if (ut != NULL) { - LIST_REMOVE(ut, ut_link); - free(ut, M_UNWIND); - if (bootverbose) - printf("UNWIND: table removed: base=%lx\n", base); - } -} - -static void -unw_initialize(void *dummy __unused) -{ - - LIST_INIT(&unw_tables); - uwx_register_alloc_cb(unw_alloc, unw_free); -#ifdef KDB - kdbheap = malloc(KDBHEAPSZ, M_UNWIND, M_WAITOK); - kdbheap->sig = MSIG_FREE; - kdbheap->size = (KDBHEAPSZ - sizeof(struct mhdr)) >> 4; - kdbheap->next = -1; - kdbheap->prev = -1; -#endif -} -SYSINIT(unwind, SI_SUB_KMEM, SI_ORDER_ANY, unw_initialize, 0); diff --git a/sys/ia64/ia64/vm_machdep.c b/sys/ia64/ia64/vm_machdep.c deleted file mode 100644 index 186897b..0000000 --- a/sys/ia64/ia64/vm_machdep.c +++ /dev/null @@ -1,363 +0,0 @@ -/*- - * Copyright (c) 1982, 1986 The Regents of the University of California. - * Copyright (c) 1989, 1990 William Jolitz - * Copyright (c) 1994 John Dyson - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department, and William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 - * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $FreeBSD$ - */ -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 the - * rights to redistribute these changes. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/bio.h> -#include <sys/buf.h> -#include <sys/sysent.h> -#include <sys/vnode.h> -#include <sys/vmmeter.h> -#include <sys/kernel.h> -#include <sys/mbuf.h> -#include <sys/sysctl.h> -#include <sys/unistd.h> - -#include <machine/cpu.h> -#include <machine/fpu.h> -#include <machine/md_var.h> -#include <machine/pcb.h> - -#include <vm/vm.h> -#include <vm/vm_param.h> -#include <vm/vm_kern.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> -#include <vm/vm_extern.h> - -void -cpu_thread_exit(struct thread *td) -{ - - /* Throw away the high FP registers. */ - ia64_highfp_drop(td); -} - -void -cpu_thread_clean(struct thread *td) -{ -} - -void -cpu_thread_alloc(struct thread *td) -{ - intptr_t sp; - - sp = td->td_kstack + td->td_kstack_pages * PAGE_SIZE; - sp -= sizeof(struct pcb); - td->td_pcb = (struct pcb *)sp; - sp -= sizeof(struct trapframe); - td->td_frame = (struct trapframe *)sp; - td->td_frame->tf_length = sizeof(struct trapframe); -} - -void -cpu_thread_free(struct thread *td) -{ -} - -void -cpu_thread_swapin(struct thread *td) -{ -} - -void -cpu_thread_swapout(struct thread *td) -{ - - ia64_highfp_save(td); -} - -void -cpu_set_syscall_retval(struct thread *td, int error) -{ - struct proc *p; - struct trapframe *tf; - - if (error == EJUSTRETURN) - return; - - tf = td->td_frame; - - /* - * Save the "raw" error code in r10. We use this to handle - * syscall restarts (see do_ast()). - */ - tf->tf_scratch.gr10 = error; - if (error == 0) { - tf->tf_scratch.gr8 = td->td_retval[0]; - tf->tf_scratch.gr9 = td->td_retval[1]; - } else if (error != ERESTART) { - p = td->td_proc; - if (error < p->p_sysent->sv_errsize) - error = p->p_sysent->sv_errtbl[error]; - /* - * Translated error codes are returned in r8. User - */ - tf->tf_scratch.gr8 = error; - } -} - -void -cpu_set_upcall(struct thread *td, struct thread *td0) -{ - struct pcb *pcb; - struct trapframe *tf; - - ia64_highfp_save(td0); - - tf = td->td_frame; - KASSERT(tf != NULL, ("foo")); - bcopy(td0->td_frame, tf, sizeof(*tf)); - tf->tf_length = sizeof(struct trapframe); - tf->tf_flags = FRAME_SYSCALL; - tf->tf_special.ndirty = 0; - tf->tf_special.bspstore &= ~0x1ffUL; - tf->tf_scratch.gr8 = 0; - tf->tf_scratch.gr9 = 1; - tf->tf_scratch.gr10 = 0; - - pcb = td->td_pcb; - KASSERT(pcb != NULL, ("foo")); - bcopy(td0->td_pcb, pcb, sizeof(*pcb)); - pcb->pcb_special.bspstore = td->td_kstack; - pcb->pcb_special.pfs = 0; - pcb->pcb_current_pmap = vmspace_pmap(td0->td_proc->p_vmspace); - pcb->pcb_special.sp = (uintptr_t)tf - 16; - pcb->pcb_special.rp = FDESC_FUNC(fork_trampoline); - cpu_set_fork_handler(td, (void (*)(void*))fork_return, td); - - /* Setup to release the spin count in fork_exit(). */ - td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_intr = 1; -} - -void -cpu_set_upcall_kse(struct thread *td, void (*entry)(void *), void *arg, - stack_t *stack) -{ - struct ia64_fdesc *fd; - struct trapframe *tf; - uint64_t ndirty, sp; - - tf = td->td_frame; - ndirty = tf->tf_special.ndirty + (tf->tf_special.bspstore & 0x1ffUL); - - KASSERT((ndirty & ~PAGE_MASK) == 0, - ("Whoa there! We have more than 8KB of dirty registers!")); - - fd = (struct ia64_fdesc *)entry; - sp = (uint64_t)stack->ss_sp; - - bzero(&tf->tf_special, sizeof(tf->tf_special)); - tf->tf_special.iip = fuword(&fd->func); - tf->tf_special.gp = fuword(&fd->gp); - tf->tf_special.sp = (sp + stack->ss_size - 16) & ~15; - tf->tf_special.rsc = 0xf; - tf->tf_special.fpsr = IA64_FPSR_DEFAULT; - tf->tf_special.psr = IA64_PSR_IC | IA64_PSR_I | IA64_PSR_IT | - IA64_PSR_DT | IA64_PSR_RT | IA64_PSR_DFH | IA64_PSR_BN | - IA64_PSR_CPL_USER; - - if (tf->tf_flags & FRAME_SYSCALL) { - tf->tf_special.cfm = (3UL<<62) | (1UL<<7) | 1UL; - tf->tf_special.bspstore = sp + 8; - suword((caddr_t)sp, (uint64_t)arg); - } else { - tf->tf_special.cfm = (1UL<<63) | (1UL<<7) | 1UL; - tf->tf_special.bspstore = sp; - tf->tf_special.ndirty = 8; - sp = td->td_kstack + ndirty - 8; - if ((sp & 0x1ff) == 0x1f8) { - *(uint64_t*)sp = 0; - tf->tf_special.ndirty += 8; - sp -= 8; - } - *(uint64_t*)sp = (uint64_t)arg; - } -} - -int -cpu_set_user_tls(struct thread *td, void *tls_base) -{ - td->td_frame->tf_special.tp = (unsigned long)tls_base; - return (0); -} - -/* - * Finish a fork operation, with process p2 nearly set up. - * Copy and update the pcb, set up the stack so that the child - * ready to run and return to user mode. - */ -void -cpu_fork(struct thread *td1, struct proc *p2 __unused, struct thread *td2, - int flags) -{ - char *stackp; - uint64_t ndirty; - - KASSERT(td1 == curthread || td1 == &thread0, - ("cpu_fork: td1 not curthread and not thread0")); - - if ((flags & RFPROC) == 0) - return; - - /* - * Save the preserved registers and the high FP registers in the - * PCB if we're the parent (ie td1 == curthread) so that we have - * a valid PCB. This also causes a RSE flush. We don't have to - * do that otherwise, because there wouldn't be anything important - * to save. - */ - if (td1 == curthread) { - if (savectx(td1->td_pcb) != 0) - panic("unexpected return from savectx()"); - ia64_highfp_save(td1); - } - - /* - * create the child's kernel stack and backing store. We basicly - * create an image of the parent's stack and backing store and - * adjust where necessary. - */ - stackp = (char *)(td2->td_kstack + td2->td_kstack_pages * PAGE_SIZE); - - stackp -= sizeof(struct pcb); - td2->td_pcb = (struct pcb *)stackp; - bcopy(td1->td_pcb, td2->td_pcb, sizeof(struct pcb)); - - stackp -= sizeof(struct trapframe); - td2->td_frame = (struct trapframe *)stackp; - bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe)); - td2->td_frame->tf_length = sizeof(struct trapframe); - ndirty = td2->td_frame->tf_special.ndirty + - (td2->td_frame->tf_special.bspstore & 0x1ffUL); - bcopy((void*)td1->td_kstack, (void*)td2->td_kstack, ndirty); - - /* Set-up the return values as expected by the fork() libc stub. */ - if (td2->td_frame->tf_special.psr & IA64_PSR_IS) { - td2->td_frame->tf_scratch.gr8 = 0; - td2->td_frame->tf_scratch.gr10 = 1; - } else { - td2->td_frame->tf_scratch.gr8 = 0; - td2->td_frame->tf_scratch.gr9 = 1; - td2->td_frame->tf_scratch.gr10 = 0; - } - - td2->td_pcb->pcb_special.bspstore = td2->td_kstack + ndirty; - td2->td_pcb->pcb_special.pfs = 0; - td2->td_pcb->pcb_current_pmap = vmspace_pmap(td2->td_proc->p_vmspace); - - td2->td_pcb->pcb_special.sp = (uintptr_t)stackp - 16; - td2->td_pcb->pcb_special.rp = FDESC_FUNC(fork_trampoline); - cpu_set_fork_handler(td2, (void (*)(void*))fork_return, td2); - - /* Setup to release the spin count in fork_exit(). */ - td2->td_md.md_spinlock_count = 1; - td2->td_md.md_saved_intr = 1; -} - -/* - * Intercept the return address from a freshly forked process that has NOT - * been scheduled yet. - * - * This is needed to make kernel threads stay in kernel mode. - */ -void -cpu_set_fork_handler(td, func, arg) - struct thread *td; - void (*func)(void *); - void *arg; -{ - td->td_frame->tf_scratch.gr2 = (u_int64_t)func; - td->td_frame->tf_scratch.gr3 = (u_int64_t)arg; -} - -/* - * cpu_exit is called as the last action during exit. - * We drop the fp state (if we have it) and switch to a live one. - */ -void -cpu_exit(struct thread *td) -{ -} - -/* - * Software interrupt handler for queued VM system processing. - */ -void -swi_vm(void *dummy) -{ - - if (busdma_swi_pending != 0) - busdma_swi(); -} diff --git a/sys/ia64/ia64/xtrace.c b/sys/ia64/ia64/xtrace.c deleted file mode 100644 index 486c091..0000000 --- a/sys/ia64/ia64/xtrace.c +++ /dev/null @@ -1,220 +0,0 @@ -/*- - * Copyright (c) 2014 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "opt_ddb.h" -#include "opt_xtrace.h" - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/ktr.h> -#include <sys/malloc.h> -#include <sys/pcpu.h> -#include <machine/md_var.h> -#include <machine/pte.h> -#include <vm/vm.h> -#include <vm/vm_extern.h> -#include <vm/vm_kern.h> - -#define XTRACE_LOG2SZ 14 /* 16KB trace buffers */ - -struct ia64_xtrace_record { - uint64_t ivt; - uint64_t itc; - uint64_t iip; - uint64_t ifa; - uint64_t isr; - uint64_t ipsr; - uint64_t itir; - uint64_t iipa; - - uint64_t ifs; - uint64_t iim; - uint64_t iha; - uint64_t unat; - uint64_t rsc; - uint64_t bsp; - uint64_t tp; - uint64_t sp; -}; - -extern uint32_t ia64_xtrace_enabled; -extern uint64_t ia64_xtrace_mask; - -static uint64_t ia64_xtrace_base; - -static void -ia64_xtrace_init_common(vm_paddr_t pa) -{ - uint64_t psr; - pt_entry_t pte; - - pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY | - PTE_PL_KERN | PTE_AR_RW; - pte |= pa & PTE_PPN_MASK; - - __asm __volatile("ptr.d %0,%1" :: "r"(ia64_xtrace_base), - "r"(XTRACE_LOG2SZ << 2)); - - __asm __volatile("mov %0=psr" : "=r"(psr)); - __asm __volatile("rsm psr.ic|psr.i"); - ia64_srlz_i(); - - ia64_set_ifa(ia64_xtrace_base); - ia64_set_itir(XTRACE_LOG2SZ << 2); - ia64_srlz_d(); - __asm __volatile("itr.d dtr[%0]=%1" :: "r"(6), "r"(pte)); - - __asm __volatile("mov psr.l=%0" :: "r" (psr)); - ia64_srlz_i(); - - PCPU_SET(md.xtrace_tail, ia64_xtrace_base); - ia64_set_k3(ia64_xtrace_base); -} - -void * -ia64_xtrace_alloc(void) -{ - uintptr_t buf; - size_t sz; - - sz = 1UL << XTRACE_LOG2SZ; - buf = kmem_alloc_contig(kernel_arena, sz, M_WAITOK | M_ZERO, - 0UL, ~0UL, sz, 0, VM_MEMATTR_DEFAULT); - return ((void *)buf); -} - -void -ia64_xtrace_init_ap(void *buf) -{ - vm_paddr_t pa; - - if (buf == NULL) { - ia64_set_k3(0); - return; - } - PCPU_SET(md.xtrace_buffer, buf); - pa = ia64_tpa((uintptr_t)buf); - ia64_xtrace_init_common(pa); -} - -void -ia64_xtrace_init_bsp(void) -{ - void *buf; - vm_paddr_t pa; - size_t sz; - - sz = 1UL << XTRACE_LOG2SZ; - ia64_xtrace_base = VM_MIN_KERNEL_ADDRESS + (sz << 1); - ia64_xtrace_mask = ~sz; - - buf = ia64_physmem_alloc(sz, sz); - if (buf == NULL) { - ia64_set_k3(0); - return; - } - PCPU_SET(md.xtrace_buffer, buf); - pa = IA64_RR_MASK((uintptr_t)buf); - ia64_xtrace_init_common(pa); -} - -static void -ia64_xtrace_init(void *dummy __unused) -{ - - TUNABLE_INT_FETCH("machdep.xtrace.enabled", &ia64_xtrace_enabled); -} -SYSINIT(xtrace, SI_SUB_CPU, SI_ORDER_ANY, ia64_xtrace_init, NULL); - -void -ia64_xtrace_save(void) -{ - struct ia64_xtrace_record *rec; - uint64_t head, tail; - - critical_enter(); - head = ia64_get_k3(); - tail = PCPU_GET(md.xtrace_tail); - if (head == 0 || tail == 0) { - critical_exit(); - return; - } - while (head != tail) { - rec = (void *)(uintptr_t)tail; - CTR6(KTR_TRAP, "XTRACE: itc=%lu, ticks=%d: " - "IVT=%#lx, IIP=%#lx, IFA=%#lx, ISR=%#lx", - rec->itc, ticks, - rec->ivt, rec->iip, rec->ifa, rec->isr); - tail += sizeof(*rec); - tail &= ia64_xtrace_mask; - } - PCPU_SET(md.xtrace_tail, tail); - critical_exit(); -} - -void -ia64_xtrace_stop(void) -{ - ia64_xtrace_enabled = 0; -} - -#if 0 -#ifdef DDB - -#include <ddb/ddb.h> - -DB_SHOW_COMMAND(xtrace, db_xtrace) -{ - struct ia64_xtrace_record *p, *r; - - p = (ia64_xtptr == 0) ? ia64_xtptr1 : ia64_xtptr; - if (p == 0) { - db_printf("Exception trace buffer not allocated\n"); - return; - } - - r = (p->ivt == 0) ? ia64_xtbase : p; - if (r->ivt == 0) { - db_printf("No exception trace records written\n"); - return; - } - - db_printf("IVT\t\t ITC\t\t IIP\t\t IFA\n"); - do { - db_printf("%016lx %016lx %016lx %016lx\n", - r->ivt, r->itc, r->iip, r->ifa); - r++; - if (r == ia64_xtlim) - r = ia64_xtbase; - } while (r != p); -} - -#endif /* DDB */ -#endif diff --git a/sys/ia64/include/_align.h b/sys/ia64/include/_align.h deleted file mode 100644 index 26df35b..0000000 --- a/sys/ia64/include/_align.h +++ /dev/null @@ -1,53 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: param.h,v 1.20 1997/09/19 13:52:53 leo Exp */ - -/*- - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah $Hdr: machparam.h 1.11 89/08/14$ - * - * @(#)param.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _IA64_INCLUDE__ALIGN_H_ -#define _IA64_INCLUDE__ALIGN_H_ - -/* - * Round p (pointer or byte index) up to a correctly-aligned value for all - * data types (int, long, ...). The result is u_long and must be cast to - * any desired pointer type. - */ -#define _ALIGNBYTES 15 -#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) - -#endif /* !_IA64_INCLUDE__ALIGN_H_ */ diff --git a/sys/ia64/include/_bus.h b/sys/ia64/include/_bus.h deleted file mode 100644 index 95d94b4..0000000 --- a/sys/ia64/include/_bus.h +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * Copyright (c) 2005 M. Warner Losh. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification, immediately at the beginning of the file. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef IA64_INCLUDE__BUS_H -#define IA64_INCLUDE__BUS_H - -/* - * Bus address and size types - */ -typedef u_long bus_addr_t; -typedef u_long bus_size_t; - -/* - * Access methods for bus resources and address space. - */ -typedef int bus_space_tag_t; -typedef u_long bus_space_handle_t; - -#endif /* IA64_INCLUDE__BUS_H */ diff --git a/sys/ia64/include/_inttypes.h b/sys/ia64/include/_inttypes.h deleted file mode 100644 index a7cbea5..0000000 --- a/sys/ia64/include/_inttypes.h +++ /dev/null @@ -1,213 +0,0 @@ -/*- - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Klaus Klein. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * From: $NetBSD: int_fmtio.h,v 1.2 2001/04/26 16:25:21 kleink Exp $ - * $FreeBSD$ - */ - -#ifndef _MACHINE_INTTYPES_H_ -#define _MACHINE_INTTYPES_H_ - -/* - * Macros for format specifiers. - */ - -/* fprintf(3) macros for signed integers. */ - -#define PRId8 "d" /* int8_t */ -#define PRId16 "d" /* int16_t */ -#define PRId32 "d" /* int32_t */ -#define PRId64 "ld" /* int64_t */ -#define PRIdLEAST8 "d" /* int_least8_t */ -#define PRIdLEAST16 "d" /* int_least16_t */ -#define PRIdLEAST32 "d" /* int_least32_t */ -#define PRIdLEAST64 "ld" /* int_least64_t */ -#define PRIdFAST8 "d" /* int_fast8_t */ -#define PRIdFAST16 "d" /* int_fast16_t */ -#define PRIdFAST32 "d" /* int_fast32_t */ -#define PRIdFAST64 "ld" /* int_fast64_t */ -#define PRIdMAX "jd" /* intmax_t */ -#define PRIdPTR "ld" /* intptr_t */ - -#define PRIi8 "i" /* int8_t */ -#define PRIi16 "i" /* int16_t */ -#define PRIi32 "i" /* int32_t */ -#define PRIi64 "li" /* int64_t */ -#define PRIiLEAST8 "i" /* int_least8_t */ -#define PRIiLEAST16 "i" /* int_least16_t */ -#define PRIiLEAST32 "i" /* int_least32_t */ -#define PRIiLEAST64 "li" /* int_least64_t */ -#define PRIiFAST8 "i" /* int_fast8_t */ -#define PRIiFAST16 "i" /* int_fast16_t */ -#define PRIiFAST32 "i" /* int_fast32_t */ -#define PRIiFAST64 "li" /* int_fast64_t */ -#define PRIiMAX "ji" /* intmax_t */ -#define PRIiPTR "li" /* intptr_t */ - -/* fprintf(3) macros for unsigned integers. */ - -#define PRIo8 "o" /* uint8_t */ -#define PRIo16 "o" /* uint16_t */ -#define PRIo32 "o" /* uint32_t */ -#define PRIo64 "lo" /* uint64_t */ -#define PRIoLEAST8 "o" /* uint_least8_t */ -#define PRIoLEAST16 "o" /* uint_least16_t */ -#define PRIoLEAST32 "o" /* uint_least32_t */ -#define PRIoLEAST64 "lo" /* uint_least64_t */ -#define PRIoFAST8 "o" /* uint_fast8_t */ -#define PRIoFAST16 "o" /* uint_fast16_t */ -#define PRIoFAST32 "o" /* uint_fast32_t */ -#define PRIoFAST64 "lo" /* uint_fast64_t */ -#define PRIoMAX "jo" /* uintmax_t */ -#define PRIoPTR "lo" /* uintptr_t */ - -#define PRIu8 "u" /* uint8_t */ -#define PRIu16 "u" /* uint16_t */ -#define PRIu32 "u" /* uint32_t */ -#define PRIu64 "lu" /* uint64_t */ -#define PRIuLEAST8 "u" /* uint_least8_t */ -#define PRIuLEAST16 "u" /* uint_least16_t */ -#define PRIuLEAST32 "u" /* uint_least32_t */ -#define PRIuLEAST64 "lu" /* uint_least64_t */ -#define PRIuFAST8 "u" /* uint_fast8_t */ -#define PRIuFAST16 "u" /* uint_fast16_t */ -#define PRIuFAST32 "u" /* uint_fast32_t */ -#define PRIuFAST64 "lu" /* uint_fast64_t */ -#define PRIuMAX "ju" /* uintmax_t */ -#define PRIuPTR "lu" /* uintptr_t */ - -#define PRIx8 "x" /* uint8_t */ -#define PRIx16 "x" /* uint16_t */ -#define PRIx32 "x" /* uint32_t */ -#define PRIx64 "lx" /* uint64_t */ -#define PRIxLEAST8 "x" /* uint_least8_t */ -#define PRIxLEAST16 "x" /* uint_least16_t */ -#define PRIxLEAST32 "x" /* uint_least32_t */ -#define PRIxLEAST64 "lx" /* uint_least64_t */ -#define PRIxFAST8 "x" /* uint_fast8_t */ -#define PRIxFAST16 "x" /* uint_fast16_t */ -#define PRIxFAST32 "x" /* uint_fast32_t */ -#define PRIxFAST64 "lx" /* uint_fast64_t */ -#define PRIxMAX "jx" /* uintmax_t */ -#define PRIxPTR "lx" /* uintptr_t */ - -#define PRIX8 "X" /* uint8_t */ -#define PRIX16 "X" /* uint16_t */ -#define PRIX32 "X" /* uint32_t */ -#define PRIX64 "lX" /* uint64_t */ -#define PRIXLEAST8 "X" /* uint_least8_t */ -#define PRIXLEAST16 "X" /* uint_least16_t */ -#define PRIXLEAST32 "X" /* uint_least32_t */ -#define PRIXLEAST64 "lX" /* uint_least64_t */ -#define PRIXFAST8 "X" /* uint_fast8_t */ -#define PRIXFAST16 "X" /* uint_fast16_t */ -#define PRIXFAST32 "X" /* uint_fast32_t */ -#define PRIXFAST64 "lX" /* uint_fast64_t */ -#define PRIXMAX "jX" /* uintmax_t */ -#define PRIXPTR "lX" /* uintptr_t */ - -/* fscanf(3) macros for signed integers. */ - -#define SCNd8 "hhd" /* int8_t */ -#define SCNd16 "hd" /* int16_t */ -#define SCNd32 "d" /* int32_t */ -#define SCNd64 "ld" /* int64_t */ -#define SCNdLEAST8 "hhd" /* int_least8_t */ -#define SCNdLEAST16 "hd" /* int_least16_t */ -#define SCNdLEAST32 "d" /* int_least32_t */ -#define SCNdLEAST64 "ld" /* int_least64_t */ -#define SCNdFAST8 "d" /* int_fast8_t */ -#define SCNdFAST16 "d" /* int_fast16_t */ -#define SCNdFAST32 "d" /* int_fast32_t */ -#define SCNdFAST64 "ld" /* int_fast64_t */ -#define SCNdMAX "jd" /* intmax_t */ -#define SCNdPTR "ld" /* intptr_t */ - -#define SCNi8 "hhi" /* int8_t */ -#define SCNi16 "hi" /* int16_t */ -#define SCNi32 "i" /* int32_t */ -#define SCNi64 "li" /* int64_t */ -#define SCNiLEAST8 "hhi" /* int_least8_t */ -#define SCNiLEAST16 "hi" /* int_least16_t */ -#define SCNiLEAST32 "i" /* int_least32_t */ -#define SCNiLEAST64 "li" /* int_least64_t */ -#define SCNiFAST8 "i" /* int_fast8_t */ -#define SCNiFAST16 "i" /* int_fast16_t */ -#define SCNiFAST32 "i" /* int_fast32_t */ -#define SCNiFAST64 "li" /* int_fast64_t */ -#define SCNiMAX "ji" /* intmax_t */ -#define SCNiPTR "li" /* intptr_t */ - -/* fscanf(3) macros for unsigned integers. */ - -#define SCNo8 "hho" /* uint8_t */ -#define SCNo16 "ho" /* uint16_t */ -#define SCNo32 "o" /* uint32_t */ -#define SCNo64 "lo" /* uint64_t */ -#define SCNoLEAST8 "hho" /* uint_least8_t */ -#define SCNoLEAST16 "ho" /* uint_least16_t */ -#define SCNoLEAST32 "o" /* uint_least32_t */ -#define SCNoLEAST64 "lo" /* uint_least64_t */ -#define SCNoFAST8 "o" /* uint_fast8_t */ -#define SCNoFAST16 "o" /* uint_fast16_t */ -#define SCNoFAST32 "o" /* uint_fast32_t */ -#define SCNoFAST64 "lo" /* uint_fast64_t */ -#define SCNoMAX "jo" /* uintmax_t */ -#define SCNoPTR "lo" /* uintptr_t */ - -#define SCNu8 "hhu" /* uint8_t */ -#define SCNu16 "hu" /* uint16_t */ -#define SCNu32 "u" /* uint32_t */ -#define SCNu64 "lu" /* uint64_t */ -#define SCNuLEAST8 "hhu" /* uint_least8_t */ -#define SCNuLEAST16 "hu" /* uint_least16_t */ -#define SCNuLEAST32 "u" /* uint_least32_t */ -#define SCNuLEAST64 "lu" /* uint_least64_t */ -#define SCNuFAST8 "u" /* uint_fast8_t */ -#define SCNuFAST16 "u" /* uint_fast16_t */ -#define SCNuFAST32 "u" /* uint_fast32_t */ -#define SCNuFAST64 "lu" /* uint_fast64_t */ -#define SCNuMAX "ju" /* uintmax_t */ -#define SCNuPTR "lu" /* uintptr_t */ - -#define SCNx8 "hhx" /* uint8_t */ -#define SCNx16 "hx" /* uint16_t */ -#define SCNx32 "x" /* uint32_t */ -#define SCNx64 "lx" /* uint64_t */ -#define SCNxLEAST8 "hhx" /* uint_least8_t */ -#define SCNxLEAST16 "hx" /* uint_least16_t */ -#define SCNxLEAST32 "x" /* uint_least32_t */ -#define SCNxLEAST64 "lx" /* uint_least64_t */ -#define SCNxFAST8 "x" /* uint_fast8_t */ -#define SCNxFAST16 "x" /* uint_fast16_t */ -#define SCNxFAST32 "x" /* uint_fast32_t */ -#define SCNxFAST64 "lx" /* uint_fast64_t */ -#define SCNxMAX "jx" /* uintmax_t */ -#define SCNxPTR "lx" /* uintptr_t */ - -#endif /* !_MACHINE_INTTYPES_H_ */ diff --git a/sys/ia64/include/_limits.h b/sys/ia64/include/_limits.h deleted file mode 100644 index 938412f..0000000 --- a/sys/ia64/include/_limits.h +++ /dev/null @@ -1,90 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: limits.h,v 1.3 1997/04/06 08:47:31 cgd Exp */ - -/*- - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)limits.h 8.3 (Berkeley) 1/4/94 - */ - -#ifndef _MACHINE__LIMITS_H_ -#define _MACHINE__LIMITS_H_ - -/* - * According to ANSI (section 2.2.4.2), the values below must be usable by - * #if preprocessing directives. Additionally, the expression must have the - * same type as would an expression that is an object of the corresponding - * type converted according to the integral promotions. The subtraction for - * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an - * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). - */ - -#define __CHAR_BIT 8 /* number of bits in a char */ - -#define __SCHAR_MAX 0x7f /* max value for a signed char */ -#define __SCHAR_MIN (-0x7f-1) /* min value for a signed char */ - -#define __UCHAR_MAX 0xff /* max value for an unsigned char */ - -#define __USHRT_MAX 0xffff /* max value for an unsigned short */ -#define __SHRT_MAX 0x7fff /* max value for a short */ -#define __SHRT_MIN (-0x7fff-1) /* min value for a short */ - -#define __UINT_MAX 0xffffffff /* max value for an unsigned int */ -#define __INT_MAX 0x7fffffff /* max value for an int */ -#define __INT_MIN (-0x7fffffff-1) /* min value for an int */ - -#define __ULONG_MAX 0xffffffffffffffff /* max for an unsigned long */ -#define __LONG_MAX 0x7fffffffffffffff /* max for a long */ -#define __LONG_MIN (-0x7fffffffffffffff-1) /* min for a long */ - -/* Long longs have the same size but not the same type as longs. */ - /* max for an unsigned long long */ -#define __ULLONG_MAX 0xffffffffffffffffULL -#define __LLONG_MAX 0x7fffffffffffffffLL /* max for a long long */ -#define __LLONG_MIN (-0x7fffffffffffffffLL-1) /* min for a long long */ - -#define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ - -#define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */ - -#define __OFF_MAX __LONG_MAX /* max value for an off_t */ -#define __OFF_MIN __LONG_MIN /* min value for an off_t */ - -/* Quads and longs are the same. Ensure they stay in sync. */ -#define __UQUAD_MAX (__ULONG_MAX) /* max value for a uquad_t */ -#define __QUAD_MAX (__LONG_MAX) /* max value for a quad_t */ -#define __QUAD_MIN (__LONG_MIN) /* min value for a quad_t */ - -#define __LONG_BIT 64 -#define __WORD_BIT 32 - -/* Minimum signal stack size. */ -#define __MINSIGSTKSZ (3072 * 4) - -#endif /* !_MACHINE__LIMITS_H_ */ diff --git a/sys/ia64/include/_regset.h b/sys/ia64/include/_regset.h deleted file mode 100644 index 1abe2ab..0000000 --- a/sys/ia64/include/_regset.h +++ /dev/null @@ -1,275 +0,0 @@ -/*- - * Copyright (c) 2002, 2003 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_REGSET_H_ -#define _MACHINE_REGSET_H_ - -/* - * Create register sets, based on the runtime specification. This allows - * us to better reuse code and to copy sets around more efficiently. - * Contexts are defined in terms of these sets. These include trapframe, - * sigframe, pcb, mcontext, reg and fpreg. Other candidates are unwind - * and coredump related contexts. - * - * Notes: - * o Constant registers (r0, f0 and f1) are not accounted for, - * o The stacked registers (r32-r127) are not accounted for, - * o Predicates are not split across sets. - */ - -/* A single FP register. */ -union _ia64_fpreg { - unsigned char fpr_bits[16]; - long double fpr_flt; -}; - -/* - * Special registers. - */ -struct _special { - unsigned long sp; - unsigned long unat; /* NaT before spilling */ - unsigned long rp; - unsigned long pr; - unsigned long pfs; - unsigned long bspstore; - unsigned long rnat; - unsigned long __spare; - /* Userland context and syscalls */ - unsigned long tp; - unsigned long rsc; - unsigned long fpsr; - unsigned long psr; - /* ASYNC: Interrupt specific */ - unsigned long gp; - unsigned long ndirty; - unsigned long cfm; - unsigned long iip; - unsigned long ifa; - unsigned long isr; -}; - -struct _high_fp { - union _ia64_fpreg fr32; - union _ia64_fpreg fr33; - union _ia64_fpreg fr34; - union _ia64_fpreg fr35; - union _ia64_fpreg fr36; - union _ia64_fpreg fr37; - union _ia64_fpreg fr38; - union _ia64_fpreg fr39; - union _ia64_fpreg fr40; - union _ia64_fpreg fr41; - union _ia64_fpreg fr42; - union _ia64_fpreg fr43; - union _ia64_fpreg fr44; - union _ia64_fpreg fr45; - union _ia64_fpreg fr46; - union _ia64_fpreg fr47; - union _ia64_fpreg fr48; - union _ia64_fpreg fr49; - union _ia64_fpreg fr50; - union _ia64_fpreg fr51; - union _ia64_fpreg fr52; - union _ia64_fpreg fr53; - union _ia64_fpreg fr54; - union _ia64_fpreg fr55; - union _ia64_fpreg fr56; - union _ia64_fpreg fr57; - union _ia64_fpreg fr58; - union _ia64_fpreg fr59; - union _ia64_fpreg fr60; - union _ia64_fpreg fr61; - union _ia64_fpreg fr62; - union _ia64_fpreg fr63; - union _ia64_fpreg fr64; - union _ia64_fpreg fr65; - union _ia64_fpreg fr66; - union _ia64_fpreg fr67; - union _ia64_fpreg fr68; - union _ia64_fpreg fr69; - union _ia64_fpreg fr70; - union _ia64_fpreg fr71; - union _ia64_fpreg fr72; - union _ia64_fpreg fr73; - union _ia64_fpreg fr74; - union _ia64_fpreg fr75; - union _ia64_fpreg fr76; - union _ia64_fpreg fr77; - union _ia64_fpreg fr78; - union _ia64_fpreg fr79; - union _ia64_fpreg fr80; - union _ia64_fpreg fr81; - union _ia64_fpreg fr82; - union _ia64_fpreg fr83; - union _ia64_fpreg fr84; - union _ia64_fpreg fr85; - union _ia64_fpreg fr86; - union _ia64_fpreg fr87; - union _ia64_fpreg fr88; - union _ia64_fpreg fr89; - union _ia64_fpreg fr90; - union _ia64_fpreg fr91; - union _ia64_fpreg fr92; - union _ia64_fpreg fr93; - union _ia64_fpreg fr94; - union _ia64_fpreg fr95; - union _ia64_fpreg fr96; - union _ia64_fpreg fr97; - union _ia64_fpreg fr98; - union _ia64_fpreg fr99; - union _ia64_fpreg fr100; - union _ia64_fpreg fr101; - union _ia64_fpreg fr102; - union _ia64_fpreg fr103; - union _ia64_fpreg fr104; - union _ia64_fpreg fr105; - union _ia64_fpreg fr106; - union _ia64_fpreg fr107; - union _ia64_fpreg fr108; - union _ia64_fpreg fr109; - union _ia64_fpreg fr110; - union _ia64_fpreg fr111; - union _ia64_fpreg fr112; - union _ia64_fpreg fr113; - union _ia64_fpreg fr114; - union _ia64_fpreg fr115; - union _ia64_fpreg fr116; - union _ia64_fpreg fr117; - union _ia64_fpreg fr118; - union _ia64_fpreg fr119; - union _ia64_fpreg fr120; - union _ia64_fpreg fr121; - union _ia64_fpreg fr122; - union _ia64_fpreg fr123; - union _ia64_fpreg fr124; - union _ia64_fpreg fr125; - union _ia64_fpreg fr126; - union _ia64_fpreg fr127; -}; - -/* - * Preserved registers. - */ -struct _callee_saved { - unsigned long unat; /* NaT after spilling. */ - unsigned long gr4; - unsigned long gr5; - unsigned long gr6; - unsigned long gr7; - unsigned long br1; - unsigned long br2; - unsigned long br3; - unsigned long br4; - unsigned long br5; - unsigned long lc; - unsigned long __spare; -}; - -struct _callee_saved_fp { - union _ia64_fpreg fr2; - union _ia64_fpreg fr3; - union _ia64_fpreg fr4; - union _ia64_fpreg fr5; - union _ia64_fpreg fr16; - union _ia64_fpreg fr17; - union _ia64_fpreg fr18; - union _ia64_fpreg fr19; - union _ia64_fpreg fr20; - union _ia64_fpreg fr21; - union _ia64_fpreg fr22; - union _ia64_fpreg fr23; - union _ia64_fpreg fr24; - union _ia64_fpreg fr25; - union _ia64_fpreg fr26; - union _ia64_fpreg fr27; - union _ia64_fpreg fr28; - union _ia64_fpreg fr29; - union _ia64_fpreg fr30; - union _ia64_fpreg fr31; -}; - -/* - * Scratch registers. - */ -struct _caller_saved { - unsigned long unat; /* NaT after spilling. */ - unsigned long gr2; - unsigned long gr3; - unsigned long gr8; - unsigned long gr9; - unsigned long gr10; - unsigned long gr11; - unsigned long gr14; - unsigned long gr15; - unsigned long gr16; - unsigned long gr17; - unsigned long gr18; - unsigned long gr19; - unsigned long gr20; - unsigned long gr21; - unsigned long gr22; - unsigned long gr23; - unsigned long gr24; - unsigned long gr25; - unsigned long gr26; - unsigned long gr27; - unsigned long gr28; - unsigned long gr29; - unsigned long gr30; - unsigned long gr31; - unsigned long br6; - unsigned long br7; - unsigned long ccv; - unsigned long csd; - unsigned long ssd; -}; - -struct _caller_saved_fp { - union _ia64_fpreg fr6; - union _ia64_fpreg fr7; - union _ia64_fpreg fr8; - union _ia64_fpreg fr9; - union _ia64_fpreg fr10; - union _ia64_fpreg fr11; - union _ia64_fpreg fr12; - union _ia64_fpreg fr13; - union _ia64_fpreg fr14; - union _ia64_fpreg fr15; -}; - -#ifdef _KERNEL -void restore_callee_saved(const struct _callee_saved *); -void restore_callee_saved_fp(const struct _callee_saved_fp *); -void restore_high_fp(const struct _high_fp *); -void save_callee_saved(struct _callee_saved *); -void save_callee_saved_fp(struct _callee_saved_fp *); -void save_high_fp(struct _high_fp *); -#endif - -#endif /* _MACHINE_REGSET_H_ */ diff --git a/sys/ia64/include/_stdint.h b/sys/ia64/include/_stdint.h deleted file mode 100644 index cb3b1a2..0000000 --- a/sys/ia64/include/_stdint.h +++ /dev/null @@ -1,158 +0,0 @@ -/*- - * Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org> - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Klaus Klein. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE__STDINT_H_ -#define _MACHINE__STDINT_H_ - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) - -#define INT8_C(c) (c) -#define INT16_C(c) (c) -#define INT32_C(c) (c) -#define INT64_C(c) (c ## L) - -#define UINT8_C(c) (c) -#define UINT16_C(c) (c) -#define UINT32_C(c) (c ## U) -#define UINT64_C(c) (c ## UL) - -#define INTMAX_C(c) INT64_C(c) -#define UINTMAX_C(c) UINT64_C(c) - -#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) - -/* - * ISO/IEC 9899:1999 - * 7.18.2.1 Limits of exact-width integer types - */ -/* Minimum values of exact-width signed integer types. */ -#define INT8_MIN (-0x7f-1) -#define INT16_MIN (-0x7fff-1) -#define INT32_MIN (-0x7fffffff-1) -#define INT64_MIN (-0x7fffffffffffffffL-1) - -/* Maximum values of exact-width signed integer types. */ -#define INT8_MAX 0x7f -#define INT16_MAX 0x7fff -#define INT32_MAX 0x7fffffff -#define INT64_MAX 0x7fffffffffffffffL - -/* Maximum values of exact-width unsigned integer types. */ -#define UINT8_MAX 0xff -#define UINT16_MAX 0xffff -#define UINT32_MAX 0xffffffffU -#define UINT64_MAX 0xffffffffffffffffUL - -/* - * ISO/IEC 9899:1999 - * 7.18.2.2 Limits of minimum-width integer types - */ -/* Minimum values of minimum-width signed integer types. */ -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST64_MIN INT64_MIN - -/* Maximum values of minimum-width signed integer types. */ -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MAX INT64_MAX - -/* Maximum values of minimum-width unsigned integer types. */ -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.3 Limits of fastest minimum-width integer types - */ -/* Minimum values of fastest minimum-width signed integer types. */ -#define INT_FAST8_MIN INT32_MIN -#define INT_FAST16_MIN INT32_MIN -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST64_MIN INT64_MIN - -/* Maximum values of fastest minimum-width signed integer types. */ -#define INT_FAST8_MAX INT32_MAX -#define INT_FAST16_MAX INT32_MAX -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MAX INT64_MAX - -/* Maximum values of fastest minimum-width unsigned integer types. */ -#define UINT_FAST8_MAX UINT32_MAX -#define UINT_FAST16_MAX UINT32_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.4 Limits of integer types capable of holding object pointers - */ -#define INTPTR_MIN INT64_MIN -#define INTPTR_MAX INT64_MAX -#define UINTPTR_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.5 Limits of greatest-width integer types - */ -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.3 Limits of other integer types - */ -/* Limits of ptrdiff_t. */ -#define PTRDIFF_MIN INT64_MIN -#define PTRDIFF_MAX INT64_MAX - -/* Limits of sig_atomic_t. */ -#define SIG_ATOMIC_MIN INT32_MIN -#define SIG_ATOMIC_MAX INT32_MAX - -/* Limit of size_t. */ -#define SIZE_MAX UINT64_MAX - -/* Limits of wint_t. */ -#define WINT_MIN INT32_MIN -#define WINT_MAX INT32_MAX - -#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ - -#endif /* !_MACHINE__STDINT_H_ */ diff --git a/sys/ia64/include/_types.h b/sys/ia64/include/_types.h deleted file mode 100644 index 572b969..0000000 --- a/sys/ia64/include/_types.h +++ /dev/null @@ -1,122 +0,0 @@ -/*- - * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 - * From: @(#)types.h 8.3 (Berkeley) 1/5/94 - * $FreeBSD$ - */ - -#ifndef _MACHINE__TYPES_H_ -#define _MACHINE__TYPES_H_ - -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - -/* - * Basic types upon which most other types are built. - */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -typedef long __int64_t; -typedef unsigned long __uint64_t; - -/* - * Standard type definitions. - */ -typedef __int32_t __clock_t; /* clock()... */ -typedef __int64_t __critical_t; -typedef double __double_t; -typedef float __float_t; -typedef __int64_t __intfptr_t; -typedef __int64_t __intmax_t; -typedef __int64_t __intptr_t; -typedef __int32_t __int_fast8_t; -typedef __int32_t __int_fast16_t; -typedef __int32_t __int_fast32_t; -typedef __int64_t __int_fast64_t; -typedef __int8_t __int_least8_t; -typedef __int16_t __int_least16_t; -typedef __int32_t __int_least32_t; -typedef __int64_t __int_least64_t; -typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ -typedef __int64_t __register_t; -typedef __int64_t __segsz_t; /* segment size (in pages) */ -typedef __uint64_t __size_t; /* sizeof() */ -typedef __int64_t __ssize_t; /* byte count or error */ -typedef __int64_t __time_t; /* time()... */ -typedef __uint64_t __uintfptr_t; -typedef __uint64_t __uintmax_t; -typedef __uint64_t __uintptr_t; -typedef __uint32_t __uint_fast8_t; -typedef __uint32_t __uint_fast16_t; -typedef __uint32_t __uint_fast32_t; -typedef __uint64_t __uint_fast64_t; -typedef __uint8_t __uint_least8_t; -typedef __uint16_t __uint_least16_t; -typedef __uint32_t __uint_least32_t; -typedef __uint64_t __uint_least64_t; -typedef __uint64_t __u_register_t; -typedef __uint64_t __vm_offset_t; -typedef __int64_t __vm_ooffset_t; -typedef __uint64_t __vm_paddr_t; -typedef __uint64_t __vm_pindex_t; -typedef __uint64_t __vm_size_t; -typedef int ___wchar_t; - -#define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ -#define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ - -/* - * Unusual type definitions. - */ -#ifdef __GNUCLIKE_BUILTIN_VARARGS -typedef __builtin_va_list __va_list; /* internally known to gcc */ -#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \ - && !defined(__NO_GNUC_VA_LIST) -#define __GNUC_VA_LIST -typedef __va_list __gnuc_va_list; /* compat. with GNU headers */ -#endif -#else -#ifdef lint -typedef char * __va_list; /* non-functional */ -#else -#error Must add va_list support for this non-GCC compiler. -#endif /* lint */ -#endif /* __GNUCLIKE_BUILTIN_VARARGS */ - -#endif /* !_MACHINE__TYPES_H_ */ diff --git a/sys/ia64/include/acpica_machdep.h b/sys/ia64/include/acpica_machdep.h deleted file mode 100644 index 2f861e8..0000000 --- a/sys/ia64/include/acpica_machdep.h +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * Copyright (c) 2002 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/****************************************************************************** - * - * Name: acpica_machdep.h - arch-specific defines, etc. - * $Revision$ - * - *****************************************************************************/ - -#ifndef __ACPICA_MACHDEP_H__ -#define __ACPICA_MACHDEP_H__ - -#ifdef _KERNEL - -/* - * Calling conventions: - * - * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) - * ACPI_EXTERNAL_XFACE - External ACPI interfaces - * ACPI_INTERNAL_XFACE - Internal ACPI interfaces - * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces - */ -#define ACPI_SYSTEM_XFACE -#define ACPI_EXTERNAL_XFACE -#define ACPI_INTERNAL_XFACE -#define ACPI_INTERNAL_VAR_XFACE - -/* Asm macros */ - -#define ACPI_ASM_MACROS -#define BREAKPOINT3 -#define ACPI_DISABLE_IRQS() ia64_disable_intr() -#define ACPI_ENABLE_IRQS() ia64_enable_intr() - -#define ACPI_FLUSH_CPU_CACHE() /* XXX ia64_fc()? */ - -/* Section 5.2.10.1: global lock acquire/release functions */ -int acpi_acquire_global_lock(volatile uint32_t *); -int acpi_release_global_lock(volatile uint32_t *); -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) do { \ - (Acq) = acpi_acquire_global_lock(&((GLptr)->GlobalLock)); \ -} while (0) -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) do { \ - (Acq) = acpi_release_global_lock(&((GLptr)->GlobalLock)); \ -} while (0) - -void acpi_cpu_c1(void); - -#endif /* _KERNEL */ - -#endif /* __ACPICA_MACHDEP_H__ */ diff --git a/sys/ia64/include/asm.h b/sys/ia64/include/asm.h deleted file mode 100644 index 4b4236d..0000000 --- a/sys/ia64/include/asm.h +++ /dev/null @@ -1,192 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: asm.h,v 1.18 1997/11/03 04:22:06 ross Exp */ - -/*- - * Copyright (c) 1991,1990,1989,1994,1995,1996 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. - */ - -/* - * Assembly coding style - * - * This file contains macros and register defines to - * aid in writing more readable assembly code. - * Some rules to make assembly code understandable by - * a debugger are also noted. - */ - -/* - * Macro to make a local label name. - */ -#define LLABEL(name,num) L ## name ## num - -/* - * MCOUNT - */ -#if defined(PROF) || (defined(_KERNEL) && defined(GPROF)) -#define MCOUNT \ - alloc out0 = ar.pfs, 8, 0, 4, 0; \ - mov out1 = r1; \ - mov out2 = b0;; \ - mov out3 = r0; \ - br.call.sptk b0 = _mcount;; -#else -#define MCOUNT /* nothing */ -#endif - -/* - * ENTRY - * Declare a global leaf function. - * A leaf function does not call other functions. - */ -#define ENTRY(_name_, _n_args_) \ - .global _name_; \ - .align 32; \ - .proc _name_; \ -_name_:; \ - .regstk _n_args_, 0, 0, 0; \ - MCOUNT - -#define ENTRY_NOPROFILE(_name_, _n_args_) \ - .global _name_; \ - .align 32; \ - .proc _name_; \ -_name_:; \ - .regstk _n_args_, 0, 0, 0 - -/* - * STATIC_ENTRY - * Declare a local leaf function. - */ -#define STATIC_ENTRY(_name_, _n_args_) \ - .align 32; \ - .proc _name_; \ -_name_:; \ - .regstk _n_args_, 0, 0, 0 \ - MCOUNT -/* - * XENTRY - * Global alias for a leaf function, or alternate entry point - */ -#define XENTRY(_name_) \ - .globl _name_; \ -_name_: - -/* - * STATIC_XENTRY - * Local alias for a leaf function, or alternate entry point - */ -#define STATIC_XENTRY(_name_) \ -_name_: - - -/* - * END - * Function delimiter - */ -#define END(_name_) \ - .endp _name_ - - -/* - * EXPORT - * Export a symbol - */ -#define EXPORT(_name_) \ - .global _name_; \ -_name_: - - -/* - * IMPORT - * Make an external name visible, typecheck the size - */ -#define IMPORT(_name_, _size_) \ - /* .extern _name_,_size_ */ - - -/* - * ABS - * Define an absolute symbol - */ -#define ABS(_name_, _value_) \ - .globl _name_; \ -_name_ = _value_ - - -/* - * BSS - * Allocate un-initialized space for a global symbol - */ -#define BSS(_name_,_numbytes_) \ - .comm _name_,_numbytes_ - - -/* - * MSG - * Allocate space for a message (a read-only ascii string) - */ -#define ASCIZ .asciz -#define MSG(msg,reg,label) \ - addl reg,@ltoff(label),gp;; \ - ld8 reg=[reg];; \ - .data; \ -label: ASCIZ msg; \ - .text; - - -/* - * System call glue. - */ -#define SYSCALLNUM(name) SYS_ ## name - -#define CALLSYS_NOERROR(name) \ - .prologue ; \ - .unwabi @svr4, 'S' ; \ - .save rp, r0 ; \ - .body ; \ -{ .mmi ; \ - alloc r9 = ar.pfs, 0, 0, 8, 0 ; \ - mov r31 = ar.k5 ; \ - mov r10 = b0 ;; } \ -{ .mib ; \ - mov r8 = SYSCALLNUM(name) ; \ - mov b7 = r31 ; \ - br.call.sptk b0 = b7 ;; } - - -/* - * WEAK_ALIAS: create a weak alias (ELF only). - */ -#define WEAK_ALIAS(alias,sym) \ - .weak alias; \ - alias = sym - -/* - * ID tag macros - */ -#if !defined(lint) && !defined(STRIP_FBSDID) -#define __FBSDID(s) .ident s -#else -#define __FBSDID(s) /* nothing */ -#endif /* not lint and not STRIP_FBSDID */ diff --git a/sys/ia64/include/atomic.h b/sys/ia64/include/atomic.h deleted file mode 100644 index e8ac7a7..0000000 --- a/sys/ia64/include/atomic.h +++ /dev/null @@ -1,417 +0,0 @@ -/*- - * Copyright (c) 1998 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_ATOMIC_H_ -#define _MACHINE_ATOMIC_H_ - -#define mb() __asm __volatile("mf") -#define wmb() mb() -#define rmb() mb() - -/* - * Various simple arithmetic on memory which is atomic in the presence - * of interrupts and SMP safe. - */ - -/* - * Everything is built out of cmpxchg. - */ -#define IA64_CMPXCHG(sz, sem, p, cmpval, newval, ret) \ - __asm __volatile ( \ - "mov ar.ccv=%2;;\n\t" \ - "cmpxchg" #sz "." #sem " %0=%4,%3,ar.ccv\n\t" \ - : "=r" (ret), "=m" (*p) \ - : "r" ((uint64_t)cmpval), "r" (newval), "m" (*p) \ - : "memory") - -/* - * Some common forms of cmpxch. - */ -static __inline uint32_t -ia64_cmpxchg_acq_32(volatile uint32_t* p, uint32_t cmpval, uint32_t newval) -{ - uint32_t ret; - IA64_CMPXCHG(4, acq, p, cmpval, newval, ret); - return (ret); -} - -static __inline uint32_t -ia64_cmpxchg_rel_32(volatile uint32_t* p, uint32_t cmpval, uint32_t newval) -{ - uint32_t ret; - IA64_CMPXCHG(4, rel, p, cmpval, newval, ret); - return (ret); -} - -static __inline uint64_t -ia64_cmpxchg_acq_64(volatile uint64_t* p, uint64_t cmpval, uint64_t newval) -{ - uint64_t ret; - IA64_CMPXCHG(8, acq, p, cmpval, newval, ret); - return (ret); -} - -static __inline uint64_t -ia64_cmpxchg_rel_64(volatile uint64_t* p, uint64_t cmpval, uint64_t newval) -{ - uint64_t ret; - IA64_CMPXCHG(8, rel, p, cmpval, newval, ret); - return (ret); -} - -#define ATOMIC_STORE_LOAD(type, width, size) \ - static __inline uint##width##_t \ - ia64_ld_acq_##width(volatile uint##width##_t* p) \ - { \ - uint##width##_t v; \ - __asm __volatile ("ld" size ".acq %0=%1" : "=r" (v) \ - : "m" (*p) : "memory"); \ - return (v); \ - } \ - \ - static __inline uint##width##_t \ - atomic_load_acq_##width(volatile uint##width##_t* p) \ - { \ - uint##width##_t v; \ - __asm __volatile ("ld" size ".acq %0=%1" : "=r" (v) \ - : "m" (*p) : "memory"); \ - return (v); \ - } \ - \ - static __inline uint##width##_t \ - atomic_load_acq_##type(volatile uint##width##_t* p) \ - { \ - uint##width##_t v; \ - __asm __volatile ("ld" size ".acq %0=%1" : "=r" (v) \ - : "m" (*p) : "memory"); \ - return (v); \ - } \ - \ - static __inline void \ - ia64_st_rel_##width(volatile uint##width##_t* p, uint##width##_t v) \ - { \ - __asm __volatile ("st" size ".rel %0=%1" : "=m" (*p) \ - : "r" (v) : "memory"); \ - } \ - \ - static __inline void \ - atomic_store_rel_##width(volatile uint##width##_t* p, \ - uint##width##_t v) \ - { \ - __asm __volatile ("st" size ".rel %0=%1" : "=m" (*p) \ - : "r" (v) : "memory"); \ - } \ - \ - static __inline void \ - atomic_store_rel_##type(volatile uint##width##_t* p, \ - uint##width##_t v) \ - { \ - __asm __volatile ("st" size ".rel %0=%1" : "=m" (*p) \ - : "r" (v) : "memory"); \ - } - -ATOMIC_STORE_LOAD(char, 8, "1") -ATOMIC_STORE_LOAD(short, 16, "2") -ATOMIC_STORE_LOAD(int, 32, "4") -ATOMIC_STORE_LOAD(long, 64, "8") - -#undef ATOMIC_STORE_LOAD - -#define atomic_load_acq_ptr(p) \ - ((void *)atomic_load_acq_64((volatile uint64_t *)p)) - -#define atomic_store_rel_ptr(p, v) \ - atomic_store_rel_64((volatile uint64_t *)p, (uint64_t)v) - -#define IA64_ATOMIC(sz, type, name, width, op) \ - static __inline type \ - atomic_##name##_acq_##width(volatile type *p, type v) \ - { \ - type old, ret; \ - do { \ - old = *p; \ - IA64_CMPXCHG(sz, acq, p, old, old op v, ret); \ - } while (ret != old); \ - return (old); \ - } \ - \ - static __inline type \ - atomic_##name##_rel_##width(volatile type *p, type v) \ - { \ - type old, ret; \ - do { \ - old = *p; \ - IA64_CMPXCHG(sz, rel, p, old, old op v, ret); \ - } while (ret != old); \ - return (old); \ - } - -IA64_ATOMIC(1, uint8_t, set, 8, |) -IA64_ATOMIC(2, uint16_t, set, 16, |) -IA64_ATOMIC(4, uint32_t, set, 32, |) -IA64_ATOMIC(8, uint64_t, set, 64, |) - -IA64_ATOMIC(1, uint8_t, clear, 8, &~) -IA64_ATOMIC(2, uint16_t, clear, 16, &~) -IA64_ATOMIC(4, uint32_t, clear, 32, &~) -IA64_ATOMIC(8, uint64_t, clear, 64, &~) - -IA64_ATOMIC(1, uint8_t, add, 8, +) -IA64_ATOMIC(2, uint16_t, add, 16, +) -IA64_ATOMIC(4, uint32_t, add, 32, +) -IA64_ATOMIC(8, uint64_t, add, 64, +) - -IA64_ATOMIC(1, uint8_t, subtract, 8, -) -IA64_ATOMIC(2, uint16_t, subtract, 16, -) -IA64_ATOMIC(4, uint32_t, subtract, 32, -) -IA64_ATOMIC(8, uint64_t, subtract, 64, -) - -#undef IA64_ATOMIC - -#define atomic_set_8 atomic_set_acq_8 -#define atomic_clear_8 atomic_clear_acq_8 -#define atomic_add_8 atomic_add_acq_8 -#define atomic_subtract_8 atomic_subtract_acq_8 - -#define atomic_set_16 atomic_set_acq_16 -#define atomic_clear_16 atomic_clear_acq_16 -#define atomic_add_16 atomic_add_acq_16 -#define atomic_subtract_16 atomic_subtract_acq_16 - -#define atomic_set_32 atomic_set_acq_32 -#define atomic_clear_32 atomic_clear_acq_32 -#define atomic_add_32 atomic_add_acq_32 -#define atomic_subtract_32 atomic_subtract_acq_32 - -#define atomic_set_64 atomic_set_acq_64 -#define atomic_clear_64 atomic_clear_acq_64 -#define atomic_add_64 atomic_add_acq_64 -#define atomic_subtract_64 atomic_subtract_acq_64 - -#define atomic_set_char atomic_set_8 -#define atomic_clear_char atomic_clear_8 -#define atomic_add_char atomic_add_8 -#define atomic_subtract_char atomic_subtract_8 -#define atomic_set_acq_char atomic_set_acq_8 -#define atomic_clear_acq_char atomic_clear_acq_8 -#define atomic_add_acq_char atomic_add_acq_8 -#define atomic_subtract_acq_char atomic_subtract_acq_8 -#define atomic_set_rel_char atomic_set_rel_8 -#define atomic_clear_rel_char atomic_clear_rel_8 -#define atomic_add_rel_char atomic_add_rel_8 -#define atomic_subtract_rel_char atomic_subtract_rel_8 - -#define atomic_set_short atomic_set_16 -#define atomic_clear_short atomic_clear_16 -#define atomic_add_short atomic_add_16 -#define atomic_subtract_short atomic_subtract_16 -#define atomic_set_acq_short atomic_set_acq_16 -#define atomic_clear_acq_short atomic_clear_acq_16 -#define atomic_add_acq_short atomic_add_acq_16 -#define atomic_subtract_acq_short atomic_subtract_acq_16 -#define atomic_set_rel_short atomic_set_rel_16 -#define atomic_clear_rel_short atomic_clear_rel_16 -#define atomic_add_rel_short atomic_add_rel_16 -#define atomic_subtract_rel_short atomic_subtract_rel_16 - -#define atomic_set_int atomic_set_32 -#define atomic_clear_int atomic_clear_32 -#define atomic_add_int atomic_add_32 -#define atomic_subtract_int atomic_subtract_32 -#define atomic_set_acq_int atomic_set_acq_32 -#define atomic_clear_acq_int atomic_clear_acq_32 -#define atomic_add_acq_int atomic_add_acq_32 -#define atomic_subtract_acq_int atomic_subtract_acq_32 -#define atomic_set_rel_int atomic_set_rel_32 -#define atomic_clear_rel_int atomic_clear_rel_32 -#define atomic_add_rel_int atomic_add_rel_32 -#define atomic_subtract_rel_int atomic_subtract_rel_32 - -#define atomic_set_long atomic_set_64 -#define atomic_clear_long atomic_clear_64 -#define atomic_add_long atomic_add_64 -#define atomic_subtract_long atomic_subtract_64 -#define atomic_set_acq_long atomic_set_acq_64 -#define atomic_clear_acq_long atomic_clear_acq_64 -#define atomic_add_acq_long atomic_add_acq_64 -#define atomic_subtract_acq_long atomic_subtract_acq_64 -#define atomic_set_rel_long atomic_set_rel_64 -#define atomic_clear_rel_long atomic_clear_rel_64 -#define atomic_add_rel_long atomic_add_rel_64 -#define atomic_subtract_rel_long atomic_subtract_rel_64 - -/* XXX Needs casting. */ -#define atomic_set_ptr atomic_set_64 -#define atomic_clear_ptr atomic_clear_64 -#define atomic_add_ptr atomic_add_64 -#define atomic_subtract_ptr atomic_subtract_64 -#define atomic_set_acq_ptr atomic_set_acq_64 -#define atomic_clear_acq_ptr atomic_clear_acq_64 -#define atomic_add_acq_ptr atomic_add_acq_64 -#define atomic_subtract_acq_ptr atomic_subtract_acq_64 -#define atomic_set_rel_ptr atomic_set_rel_64 -#define atomic_clear_rel_ptr atomic_clear_rel_64 -#define atomic_add_rel_ptr atomic_add_rel_64 -#define atomic_subtract_rel_ptr atomic_subtract_rel_64 - -#undef IA64_CMPXCHG - -/* - * Atomically compare the value stored at *p with cmpval and if the - * two values are equal, update the value of *p with newval. Returns - * zero if the compare failed, nonzero otherwise. - */ -static __inline int -atomic_cmpset_acq_32(volatile uint32_t* p, uint32_t cmpval, uint32_t newval) -{ - return (ia64_cmpxchg_acq_32(p, cmpval, newval) == cmpval); -} - -static __inline int -atomic_cmpset_rel_32(volatile uint32_t* p, uint32_t cmpval, uint32_t newval) -{ - return (ia64_cmpxchg_rel_32(p, cmpval, newval) == cmpval); -} - -/* - * Atomically compare the value stored at *p with cmpval and if the - * two values are equal, update the value of *p with newval. Returns - * zero if the compare failed, nonzero otherwise. - */ -static __inline int -atomic_cmpset_acq_64(volatile uint64_t* p, uint64_t cmpval, uint64_t newval) -{ - return (ia64_cmpxchg_acq_64(p, cmpval, newval) == cmpval); -} - -static __inline int -atomic_cmpset_rel_64(volatile uint64_t* p, uint64_t cmpval, uint64_t newval) -{ - return (ia64_cmpxchg_rel_64(p, cmpval, newval) == cmpval); -} - -#define atomic_cmpset_32 atomic_cmpset_acq_32 -#define atomic_cmpset_64 atomic_cmpset_acq_64 -#define atomic_cmpset_int atomic_cmpset_32 -#define atomic_cmpset_long atomic_cmpset_64 -#define atomic_cmpset_acq_int atomic_cmpset_acq_32 -#define atomic_cmpset_rel_int atomic_cmpset_rel_32 -#define atomic_cmpset_acq_long atomic_cmpset_acq_64 -#define atomic_cmpset_rel_long atomic_cmpset_rel_64 - -#define atomic_cmpset_acq_ptr(p, o, n) \ - (atomic_cmpset_acq_64((volatile uint64_t *)p, (uint64_t)o, (uint64_t)n)) - -#define atomic_cmpset_ptr atomic_cmpset_acq_ptr - -#define atomic_cmpset_rel_ptr(p, o, n) \ - (atomic_cmpset_rel_64((volatile uint64_t *)p, (uint64_t)o, (uint64_t)n)) - -static __inline uint32_t -atomic_readandclear_32(volatile uint32_t* p) -{ - uint32_t val; - do { - val = *p; - } while (!atomic_cmpset_32(p, val, 0)); - return (val); -} - -static __inline uint64_t -atomic_readandclear_64(volatile uint64_t* p) -{ - uint64_t val; - do { - val = *p; - } while (!atomic_cmpset_64(p, val, 0)); - return (val); -} - -#define atomic_readandclear_int atomic_readandclear_32 -#define atomic_readandclear_long atomic_readandclear_64 -#define atomic_readandclear_ptr atomic_readandclear_64 - -/* - * Atomically add the value of v to the integer pointed to by p and return - * the previous value of *p. - * - * XXX: Should we use the fetchadd instruction here? - */ -static __inline uint32_t -atomic_fetchadd_32(volatile uint32_t *p, uint32_t v) -{ - uint32_t value; - - do { - value = *p; - } while (!atomic_cmpset_32(p, value, value + v)); - return (value); -} - -#define atomic_fetchadd_int atomic_fetchadd_32 - -static __inline u_long -atomic_fetchadd_long(volatile u_long *p, u_long v) -{ - u_long value; - - do { - value = *p; - } while (!atomic_cmpset_64(p, value, value + v)); - return (value); -} - -/* - * <type> atomic_swap_<type>(volatile <type> *p, <type> v); - */ - -static __inline uint32_t -atomic_swap_32(volatile uint32_t *p, uint32_t v) -{ - uint32_t r; - - __asm __volatile ("xchg4 %0 = %3, %2;;" : "=r"(r), "=m"(*p) : - "r"(v), "m"(*p) : "memory"); - return (r); -} - -static __inline uint64_t -atomic_swap_64(volatile uint64_t *p, uint64_t v) -{ - uint64_t r; - - __asm __volatile ("xchg8 %0 = %3, %2;;" : "=r"(r), "=m"(*p) : - "r"(v), "m"(*p) : "memory"); - return (r); -} - -#define atomic_swap_int atomic_swap_32 -#define atomic_swap_long atomic_swap_64 -#define atomic_swap_ptr atomic_swap_64 - -#endif /* ! _MACHINE_ATOMIC_H_ */ diff --git a/sys/ia64/include/bootinfo.h b/sys/ia64/include/bootinfo.h deleted file mode 100644 index ed3accd..0000000 --- a/sys/ia64/include/bootinfo.h +++ /dev/null @@ -1,55 +0,0 @@ -/* $FreeBSD$ */ -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 the - * rights to redistribute these changes. - */ - -struct bootinfo { - uint64_t bi_magic; /* BOOTINFO_MAGIC */ -#define BOOTINFO_MAGIC 0xdeadbeeffeedface - uint64_t bi_version; /* version 1 */ - uint64_t bi_spare[3]; /* was: name of booted kernel */ - uint32_t bi_itr_used; /* Number of ITR and DTR ... */ - uint32_t bi_dtr_used; /* ... entries used. */ - uint32_t bi_text_mapped; /* Size of text mapped. */ - uint32_t bi_data_mapped; /* Size of data mapped. */ - uint64_t bi_pbvm_pgtbl; /* PA of PBVM page table. */ - uint64_t bi_hcdp; /* DIG64 HCDP table */ - uint64_t bi_fpswa; /* FPSWA interface */ - uint64_t bi_boothowto; /* value for boothowto */ - uint64_t bi_systab; /* pa of EFI system table */ - uint64_t bi_memmap; /* pa of EFI memory map */ - uint64_t bi_memmap_size; /* size of EFI memory map */ - uint64_t bi_memdesc_size; /* sizeof EFI memory desc */ - uint32_t bi_memdesc_version; /* EFI memory desc version */ - uint32_t bi_pbvm_pgtblsz; /* PBVM page table size. */ - uint64_t bi_symtab; /* start of kernel sym table */ - uint64_t bi_esymtab; /* end of kernel sym table */ - uint64_t bi_kernend; /* end of kernel space */ - uint64_t bi_envp; /* environment */ - uint64_t bi_modulep; /* preloaded modules */ -}; - -extern struct bootinfo *bootinfo; diff --git a/sys/ia64/include/bus.h b/sys/ia64/include/bus.h deleted file mode 100644 index 966a75d3..0000000 --- a/sys/ia64/include/bus.h +++ /dev/null @@ -1,820 +0,0 @@ -/*- - * Copyright (c) 2009 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $ */ - -/*- - * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/*- - * Copyright (c) 1996 Charles M. Hannum. All rights reserved. - * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou - * for the NetBSD Project. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* $FreeBSD$ */ - -#ifndef _MACHINE_BUS_H_ -#define _MACHINE_BUS_H_ - -#include <machine/_bus.h> -#include <machine/cpufunc.h> - -/* - * I/O port reads with ia32 semantics. - */ -#define inb bus_space_read_io_1 -#define inw bus_space_read_io_2 -#define inl bus_space_read_io_4 - -#define outb bus_space_write_io_1 -#define outw bus_space_write_io_2 -#define outl bus_space_write_io_4 - -/* - * Values for the ia64 bus space tag, not to be used directly by MI code. - */ -#define IA64_BUS_SPACE_IO 0 /* space is i/o space */ -#define IA64_BUS_SPACE_MEM 1 /* space is mem space */ - -#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ -#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ - -#define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF -#define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF -#define BUS_SPACE_MAXSIZE 0xFFFFFFFFFFFFFFFF -#define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF -#define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF -#define BUS_SPACE_MAXADDR 0xFFFFFFFFFFFFFFFF - -#define BUS_SPACE_UNRESTRICTED (~0) - - -/* - * Map and unmap a region of device bus space into CPU virtual address space. - */ -int -bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, - bus_space_handle_t *); - -void -bus_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t size); - -/* - * Get a new handle for a subregion of an already-mapped area of bus space. - */ -static __inline int -bus_space_subregion(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, bus_size_t size __unused, bus_space_handle_t *nbshp) -{ - *nbshp = bsh + ofs; - return (0); -} - - -/* - * Allocate a region of memory that is accessible to devices in bus space. - */ -int -bus_space_alloc(bus_space_tag_t bst, bus_addr_t rstart, bus_addr_t rend, - bus_size_t size, bus_size_t align, bus_size_t boundary, int flags, - bus_addr_t *addrp, bus_space_handle_t *bshp); - - -/* - * Free a region of bus space accessible memory. - */ -void -bus_space_free(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t size); - - -/* - * Bus read/write barrier method. - */ -static __inline void -bus_space_barrier(bus_space_tag_t bst __unused, bus_space_handle_t bsh __unused, - bus_size_t ofs __unused, bus_size_t size __unused, int flags __unused) -{ - ia64_mf_a(); - ia64_mf(); -} - - -/* - * Read 1 unit of data from bus space described by the tag, handle and ofs - * tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The - * data is returned. - */ -uint8_t bus_space_read_io_1(u_long); -uint16_t bus_space_read_io_2(u_long); -uint32_t bus_space_read_io_4(u_long); -uint64_t bus_space_read_io_8(u_long); - -static __inline uint8_t -bus_space_read_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs) -{ - uint8_t val; - - val = (__predict_false(bst == IA64_BUS_SPACE_IO)) - ? bus_space_read_io_1(bsh + ofs) - : ia64_ld1((void *)(bsh + ofs)); - return (val); -} - -static __inline uint16_t -bus_space_read_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs) -{ - uint16_t val; - - val = (__predict_false(bst == IA64_BUS_SPACE_IO)) - ? bus_space_read_io_2(bsh + ofs) - : ia64_ld2((void *)(bsh + ofs)); - return (val); -} - -static __inline uint32_t -bus_space_read_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs) -{ - uint32_t val; - - val = (__predict_false(bst == IA64_BUS_SPACE_IO)) - ? bus_space_read_io_4(bsh + ofs) - : ia64_ld4((void *)(bsh + ofs)); - return (val); -} - -static __inline uint64_t -bus_space_read_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs) -{ - uint64_t val; - - val = (__predict_false(bst == IA64_BUS_SPACE_IO)) - ? bus_space_read_io_8(bsh + ofs) - : ia64_ld8((void *)(bsh + ofs)); - return (val); -} - - -/* - * Write 1 unit of data to bus space described by the tag, handle and ofs - * tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The - * data is passed by value. - */ -void bus_space_write_io_1(u_long, uint8_t); -void bus_space_write_io_2(u_long, uint16_t); -void bus_space_write_io_4(u_long, uint32_t); -void bus_space_write_io_8(u_long, uint64_t); - -static __inline void -bus_space_write_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, - uint8_t val) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_write_io_1(bsh + ofs, val); - else - ia64_st1((void *)(bsh + ofs), val); -} - -static __inline void -bus_space_write_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, - uint16_t val) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_write_io_2(bsh + ofs, val); - else - ia64_st2((void *)(bsh + ofs), val); -} - -static __inline void -bus_space_write_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, - uint32_t val) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_write_io_4(bsh + ofs, val); - else - ia64_st4((void *)(bsh + ofs), val); -} - -static __inline void -bus_space_write_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, - uint64_t val) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_write_io_8(bsh + ofs, val); - else - ia64_st8((void *)(bsh + ofs), val); -} - - -/* - * Read count units of data from bus space described by the tag, handle and - * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The - * data is returned in the buffer passed by reference. - */ -void bus_space_read_multi_io_1(u_long, uint8_t *, size_t); -void bus_space_read_multi_io_2(u_long, uint16_t *, size_t); -void bus_space_read_multi_io_4(u_long, uint32_t *, size_t); -void bus_space_read_multi_io_8(u_long, uint64_t *, size_t); - -static __inline void -bus_space_read_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint8_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_read_multi_io_1(bsh + ofs, bufp, count); - else { - while (count-- > 0) - *bufp++ = ia64_ld1((void *)(bsh + ofs)); - } -} - -static __inline void -bus_space_read_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint16_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_read_multi_io_2(bsh + ofs, bufp, count); - else { - while (count-- > 0) - *bufp++ = ia64_ld2((void *)(bsh + ofs)); - } -} - -static __inline void -bus_space_read_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint32_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_read_multi_io_4(bsh + ofs, bufp, count); - else { - while (count-- > 0) - *bufp++ = ia64_ld4((void *)(bsh + ofs)); - } -} - -static __inline void -bus_space_read_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint64_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_read_multi_io_8(bsh + ofs, bufp, count); - else { - while (count-- > 0) - *bufp++ = ia64_ld8((void *)(bsh + ofs)); - } -} - - -/* - * Write count units of data to bus space described by the tag, handle and - * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The - * data is read from the buffer passed by reference. - */ -void bus_space_write_multi_io_1(u_long, const uint8_t *, size_t); -void bus_space_write_multi_io_2(u_long, const uint16_t *, size_t); -void bus_space_write_multi_io_4(u_long, const uint32_t *, size_t); -void bus_space_write_multi_io_8(u_long, const uint64_t *, size_t); - -static __inline void -bus_space_write_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, const uint8_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_write_multi_io_1(bsh + ofs, bufp, count); - else { - while (count-- > 0) - ia64_st1((void *)(bsh + ofs), *bufp++); - } -} - -static __inline void -bus_space_write_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, const uint16_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_write_multi_io_2(bsh + ofs, bufp, count); - else { - while (count-- > 0) - ia64_st2((void *)(bsh + ofs), *bufp++); - } -} - -static __inline void -bus_space_write_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, const uint32_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_write_multi_io_4(bsh + ofs, bufp, count); - else { - while (count-- > 0) - ia64_st4((void *)(bsh + ofs), *bufp++); - } -} - -static __inline void -bus_space_write_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, const uint64_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_write_multi_io_8(bsh + ofs, bufp, count); - else { - while (count-- > 0) - ia64_st8((void *)(bsh + ofs), *bufp++); - } -} - - -/* - * Read count units of data from bus space described by the tag, handle and - * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The - * data is written to the buffer passed by reference and read from successive - * bus space addresses. Access is unordered. - */ -void bus_space_read_region_io_1(u_long, uint8_t *, size_t); -void bus_space_read_region_io_2(u_long, uint16_t *, size_t); -void bus_space_read_region_io_4(u_long, uint32_t *, size_t); -void bus_space_read_region_io_8(u_long, uint64_t *, size_t); - -static __inline void -bus_space_read_region_1(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint8_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_read_region_io_1(bsh + ofs, bufp, count); - else { - uint8_t *bsp = (void *)(bsh + ofs); - while (count-- > 0) - *bufp++ = ia64_ld1(bsp++); - } -} - -static __inline void -bus_space_read_region_2(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint16_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_read_region_io_2(bsh + ofs, bufp, count); - else { - uint16_t *bsp = (void *)(bsh + ofs); - while (count-- > 0) - *bufp++ = ia64_ld2(bsp++); - } -} - -static __inline void -bus_space_read_region_4(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint32_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_read_region_io_4(bsh + ofs, bufp, count); - else { - uint32_t *bsp = (void *)(bsh + ofs); - while (count-- > 0) - *bufp++ = ia64_ld4(bsp++); - } -} - -static __inline void -bus_space_read_region_8(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint64_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_read_region_io_8(bsh + ofs, bufp, count); - else { - uint64_t *bsp = (void *)(bsh + ofs); - while (count-- > 0) - *bufp++ = ia64_ld8(bsp++); - } -} - - -/* - * Write count units of data from bus space described by the tag, handle and - * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The - * data is read from the buffer passed by reference and written to successive - * bus space addresses. Access is unordered. - */ -void bus_space_write_region_io_1(u_long, const uint8_t *, size_t); -void bus_space_write_region_io_2(u_long, const uint16_t *, size_t); -void bus_space_write_region_io_4(u_long, const uint32_t *, size_t); -void bus_space_write_region_io_8(u_long, const uint64_t *, size_t); - -static __inline void -bus_space_write_region_1(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, const uint8_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_write_region_io_1(bsh + ofs, bufp, count); - else { - uint8_t *bsp = (void *)(bsh + ofs); - while (count-- > 0) - ia64_st1(bsp++, *bufp++); - } -} - -static __inline void -bus_space_write_region_2(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, const uint16_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_write_region_io_2(bsh + ofs, bufp, count); - else { - uint16_t *bsp = (void *)(bsh + ofs); - while (count-- > 0) - ia64_st2(bsp++, *bufp++); - } -} - -static __inline void -bus_space_write_region_4(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, const uint32_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_write_region_io_4(bsh + ofs, bufp, count); - else { - uint32_t *bsp = (void *)(bsh + ofs); - while (count-- > 0) - ia64_st4(bsp++, *bufp++); - } -} - -static __inline void -bus_space_write_region_8(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, const uint64_t *bufp, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_write_region_io_8(bsh + ofs, bufp, count); - else { - uint64_t *bsp = (void *)(bsh + ofs); - while (count-- > 0) - ia64_st8(bsp++, *bufp++); - } -} - - -/* - * Write count units of data from bus space described by the tag, handle and - * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The - * data is passed by value. Writes are unordered. - */ -static __inline void -bus_space_set_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint8_t val, size_t count) -{ - - while (count-- > 0) - bus_space_write_1(bst, bsh, ofs, val); -} - -static __inline void -bus_space_set_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint16_t val, size_t count) -{ - - while (count-- > 0) - bus_space_write_2(bst, bsh, ofs, val); -} - -static __inline void -bus_space_set_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint32_t val, size_t count) -{ - - while (count-- > 0) - bus_space_write_4(bst, bsh, ofs, val); -} - -static __inline void -bus_space_set_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint64_t val, size_t count) -{ - - while (count-- > 0) - bus_space_write_8(bst, bsh, ofs, val); -} - - -/* - * Write count units of data from bus space described by the tag, handle and - * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The - * data is passed by value and written to successive bus space addresses. - * Writes are unordered. - */ -void bus_space_set_region_io_1(u_long, uint8_t, size_t); -void bus_space_set_region_io_2(u_long, uint16_t, size_t); -void bus_space_set_region_io_4(u_long, uint32_t, size_t); -void bus_space_set_region_io_8(u_long, uint64_t, size_t); - -static __inline void -bus_space_set_region_1(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint8_t val, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_set_region_io_1(bsh + ofs, val, count); - else { - uint8_t *bsp = (void *)(bsh + ofs); - while (count-- > 0) - ia64_st1(bsp++, val); - } -} - -static __inline void -bus_space_set_region_2(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint16_t val, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_set_region_io_2(bsh + ofs, val, count); - else { - uint16_t *bsp = (void *)(bsh + ofs); - while (count-- > 0) - ia64_st2(bsp++, val); - } -} - -static __inline void -bus_space_set_region_4(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint32_t val, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_set_region_io_4(bsh + ofs, val, count); - else { - uint32_t *bsp = (void *)(bsh + ofs); - while (count-- > 0) - ia64_st4(bsp++, val); - } -} - -static __inline void -bus_space_set_region_8(bus_space_tag_t bst, bus_space_handle_t bsh, - bus_size_t ofs, uint64_t val, size_t count) -{ - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) - bus_space_set_region_io_4(bsh + ofs, val, count); - else { - uint64_t *bsp = (void *)(bsh + ofs); - while (count-- > 0) - ia64_st8(bsp++, val); - } -} - - -/* - * Copy count units of data from bus space described by the tag and the first - * handle and ofs pair to bus space described by the tag and the second handle - * and ofs pair. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. - * The data is read from successive bus space addresses and also written to - * successive bus space addresses. Both reads and writes are unordered. - */ -void bus_space_copy_region_io_1(u_long, u_long, size_t); -void bus_space_copy_region_io_2(u_long, u_long, size_t); -void bus_space_copy_region_io_4(u_long, u_long, size_t); -void bus_space_copy_region_io_8(u_long, u_long, size_t); - -static __inline void -bus_space_copy_region_1(bus_space_tag_t bst, bus_space_handle_t sbsh, - bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count) -{ - uint8_t *dst, *src; - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) { - bus_space_copy_region_io_1(sbsh + sofs, dbsh + dofs, count); - return; - } - - src = (void *)(sbsh + sofs); - dst = (void *)(dbsh + dofs); - if (src < dst) { - src += count - 1; - dst += count - 1; - while (count-- > 0) - ia64_st1(dst--, ia64_ld1(src--)); - } else { - while (count-- > 0) - ia64_st1(dst++, ia64_ld1(src++)); - } -} - -static __inline void -bus_space_copy_region_2(bus_space_tag_t bst, bus_space_handle_t sbsh, - bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count) -{ - uint16_t *dst, *src; - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) { - bus_space_copy_region_io_2(sbsh + sofs, dbsh + dofs, count); - return; - } - - src = (void *)(sbsh + sofs); - dst = (void *)(dbsh + dofs); - if (src < dst) { - src += count - 1; - dst += count - 1; - while (count-- > 0) - ia64_st2(dst--, ia64_ld2(src--)); - } else { - while (count-- > 0) - ia64_st2(dst++, ia64_ld2(src++)); - } -} - -static __inline void -bus_space_copy_region_4(bus_space_tag_t bst, bus_space_handle_t sbsh, - bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count) -{ - uint32_t *dst, *src; - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) { - bus_space_copy_region_io_4(sbsh + sofs, dbsh + dofs, count); - return; - } - - src = (void *)(sbsh + sofs); - dst = (void *)(dbsh + dofs); - if (src < dst) { - src += count - 1; - dst += count - 1; - while (count-- > 0) - ia64_st4(dst--, ia64_ld4(src--)); - } else { - while (count-- > 0) - ia64_st4(dst++, ia64_ld4(src++)); - } -} - -static __inline void -bus_space_copy_region_8(bus_space_tag_t bst, bus_space_handle_t sbsh, - bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count) -{ - uint64_t *dst, *src; - - if (__predict_false(bst == IA64_BUS_SPACE_IO)) { - bus_space_copy_region_io_8(sbsh + sofs, dbsh + dofs, count); - return; - } - - src = (void *)(sbsh + sofs); - dst = (void *)(dbsh + dofs); - if (src < dst) { - src += count - 1; - dst += count - 1; - while (count-- > 0) - ia64_st8(dst--, ia64_ld8(src--)); - } else { - while (count-- > 0) - ia64_st8(dst++, ia64_ld8(src++)); - } -} - - -/* - * Stream accesses are the same as normal accesses on ia64; there are no - * supported bus systems with an endianess different from the host one. - */ - -#define bus_space_read_stream_1 bus_space_read_1 -#define bus_space_read_stream_2 bus_space_read_2 -#define bus_space_read_stream_4 bus_space_read_4 -#define bus_space_read_stream_8 bus_space_read_8 - -#define bus_space_write_stream_1 bus_space_write_1 -#define bus_space_write_stream_2 bus_space_write_2 -#define bus_space_write_stream_4 bus_space_write_4 -#define bus_space_write_stream_8 bus_space_write_8 - -#define bus_space_read_multi_stream_1 bus_space_read_multi_1 -#define bus_space_read_multi_stream_2 bus_space_read_multi_2 -#define bus_space_read_multi_stream_4 bus_space_read_multi_4 -#define bus_space_read_multi_stream_8 bus_space_read_multi_8 - -#define bus_space_write_multi_stream_1 bus_space_write_multi_1 -#define bus_space_write_multi_stream_2 bus_space_write_multi_2 -#define bus_space_write_multi_stream_4 bus_space_write_multi_4 -#define bus_space_write_multi_stream_8 bus_space_write_multi_8 - -#define bus_space_read_region_stream_1 bus_space_read_region_1 -#define bus_space_read_region_stream_2 bus_space_read_region_2 -#define bus_space_read_region_stream_4 bus_space_read_region_4 -#define bus_space_read_region_stream_8 bus_space_read_region_8 - -#define bus_space_write_region_stream_1 bus_space_write_region_1 -#define bus_space_write_region_stream_2 bus_space_write_region_2 -#define bus_space_write_region_stream_4 bus_space_write_region_4 -#define bus_space_write_region_stream_8 bus_space_write_region_8 - -#define bus_space_set_multi_stream_1 bus_space_set_multi_1 -#define bus_space_set_multi_stream_2 bus_space_set_multi_2 -#define bus_space_set_multi_stream_4 bus_space_set_multi_4 -#define bus_space_set_multi_stream_8 bus_space_set_multi_8 - -#define bus_space_set_region_stream_1 bus_space_set_region_1 -#define bus_space_set_region_stream_2 bus_space_set_region_2 -#define bus_space_set_region_stream_4 bus_space_set_region_4 -#define bus_space_set_region_stream_8 bus_space_set_region_8 - -#define bus_space_copy_region_stream_1 bus_space_copy_region_1 -#define bus_space_copy_region_stream_2 bus_space_copy_region_2 -#define bus_space_copy_region_stream_4 bus_space_copy_region_4 -#define bus_space_copy_region_stream_8 bus_space_copy_region_8 - -#include <machine/bus_dma.h> - -#endif /* _MACHINE_BUS_H_ */ diff --git a/sys/ia64/include/bus_dma.h b/sys/ia64/include/bus_dma.h deleted file mode 100644 index 0a80f2f..0000000 --- a/sys/ia64/include/bus_dma.h +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * Copyright (c) 2005 Scott Long - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* $FreeBSD$ */ - -#ifndef _IA64_BUS_DMA_H_ -#define _IA64_BUS_DMA_H_ - -#include <sys/bus_dma.h> - -#endif /* _IA64_BUS_DMA_H_ */ diff --git a/sys/ia64/include/clock.h b/sys/ia64/include/clock.h deleted file mode 100644 index 6b87a89..0000000 --- a/sys/ia64/include/clock.h +++ /dev/null @@ -1,12 +0,0 @@ -/*- - * Kernel interface to machine-dependent clock driver. - * Garrett Wollman, September 1994. - * This file is in the public domain. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_CLOCK_H_ -#define _MACHINE_CLOCK_H_ - -#endif /* !_MACHINE_CLOCK_H_ */ diff --git a/sys/ia64/include/counter.h b/sys/ia64/include/counter.h deleted file mode 100644 index a3fe871..0000000 --- a/sys/ia64/include/counter.h +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef __MACHINE_COUNTER_H__ -#define __MACHINE_COUNTER_H__ - -#include <sys/pcpu.h> -#ifdef INVARIANTS -#include <sys/proc.h> -#endif - -#define counter_enter() critical_enter() -#define counter_exit() critical_exit() - -#ifdef IN_SUBR_COUNTER_C -static inline uint64_t -counter_u64_read_one(uint64_t *p, int cpu) -{ - - return (*(uint64_t *)((char *)p + sizeof(struct pcpu) * cpu)); -} - -static inline uint64_t -counter_u64_fetch_inline(uint64_t *p) -{ - uint64_t r; - int i; - - r = 0; - for (i = 0; i < mp_ncpus; i++) - r += counter_u64_read_one((uint64_t *)p, i); - - return (r); -} - -/* XXXKIB might interrupt increment */ -static void -counter_u64_zero_one_cpu(void *arg) -{ - - *((uint64_t *)((char *)arg + sizeof(struct pcpu) * - PCPU_GET(cpuid))) = 0; -} - -static inline void -counter_u64_zero_inline(counter_u64_t c) -{ - - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); -} -#endif - -#define counter_u64_add_protected(c, inc) do { \ - CRITICAL_ASSERT(curthread); \ - *(uint64_t *)zpcpu_get(c) += (inc); \ -} while (0) - -static inline void -counter_u64_add(counter_u64_t c, int64_t inc) -{ - - counter_enter(); - counter_u64_add_protected(c, inc); - counter_exit(); -} - -#endif /* ! __MACHINE_COUNTER_H__ */ diff --git a/sys/ia64/include/cpu.h b/sys/ia64/include/cpu.h deleted file mode 100644 index 9d7a936..0000000 --- a/sys/ia64/include/cpu.h +++ /dev/null @@ -1,75 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */ - -/*- - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1982, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah $Hdr: cpu.h 1.16 91/03/25$ - * - * @(#)cpu.h 8.4 (Berkeley) 1/5/94 - */ - -#ifndef _MACHINE_CPU_H_ -#define _MACHINE_CPU_H_ - -#include <machine/frame.h> - -#define TRAPF_PC(tf) ((tf)->tf_special.iip) -#define TRAPF_CPL(tf) ((tf)->tf_special.psr & IA64_PSR_CPL) -#define TRAPF_USERMODE(tf) (TRAPF_CPL(tf) != IA64_PSR_CPL_KERN) - -#ifdef _KERNEL - -#ifdef GPROF -extern char btext[]; -extern char etext[]; -#endif - -/* - * Return contents of in-cpu fast counter as a sort of "bogo-time" - * for non-critical timing. - */ -#define get_cyclecount ia64_get_itc - -/* Used by signaling code. */ -#define cpu_getstack(td) ((td)->td_frame->tf_special.sp) -#define cpu_spinwait() /* nothing */ - -void cpu_halt(void); -void cpu_reset(void); -void fork_trampoline(void); /* MAGIC */ -void swi_vm(void *); - -#endif /* _KERNEL */ - -#endif /* _MACHINE_CPU_H_ */ diff --git a/sys/ia64/include/cpufunc.h b/sys/ia64/include/cpufunc.h deleted file mode 100644 index 925d4ba..0000000 --- a/sys/ia64/include/cpufunc.h +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * Copyright (c) 1998 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_CPUFUNC_H_ -#define _MACHINE_CPUFUNC_H_ - -#ifdef _KERNEL - -#include <sys/types.h> -#include <machine/ia64_cpu.h> -#include <machine/vmparam.h> - -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - -struct thread; - -#define IA64_FIXED_BREAK 0x84B5D - -#ifdef __GNUCLIKE_ASM - -static __inline void -breakpoint(void) -{ - __asm __volatile("break.m %0" :: "i"(IA64_FIXED_BREAK)); -} - -#define HAVE_INLINE_FFS -#define ffs(x) __builtin_ffs(x) - - -static __inline void -ia64_disable_intr(void) -{ - __asm __volatile ("rsm psr.i"); -} - -static __inline void -ia64_enable_intr(void) -{ - __asm __volatile ("ssm psr.i;; srlz.d"); -} - -static __inline register_t -intr_disable(void) -{ - register_t psr; - - __asm __volatile ("mov %0=psr;;" : "=r"(psr)); - ia64_disable_intr(); - return ((psr & IA64_PSR_I) ? 1 : 0); -} - -static __inline void -intr_restore(register_t ie) -{ - if (ie) - ia64_enable_intr(); -} - -#endif /* __GNUCLIKE_ASM */ - -#endif /* _KERNEL */ - -#endif /* !_MACHINE_CPUFUNC_H_ */ diff --git a/sys/ia64/include/db_machdep.h b/sys/ia64/include/db_machdep.h deleted file mode 100644 index cbf01a7..0000000 --- a/sys/ia64/include/db_machdep.h +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * Copyright (c) 2004 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_DB_MACHDEP_H_ -#define _MACHINE_DB_MACHDEP_H_ - -#include <machine/ia64_cpu.h> - -/* We define some of our own commands. */ -#define DB_MACHINE_COMMANDS - -/* We use Elf64 symbols in DDB. */ -#define DB_ELFSIZE 64 - -/* Pretty arbitrary. */ -#define DB_SMALL_VALUE_MAX 0x7fffffff -#define DB_SMALL_VALUE_MIN (-0x400001) - -typedef vm_offset_t db_addr_t; /* address - unsigned */ -typedef long db_expr_t; /* expression - signed */ - -#define PC_REGS() ((kdb_thrctx->pcb_special.__spare == 0) ? \ - kdb_thrctx->pcb_special.rp : \ - kdb_thrctx->pcb_special.iip + ((kdb_thrctx->pcb_special.psr>>41) & 3)) - -#define BKPT_WRITE(addr, storage) db_bkpt_write(addr, storage) -#define BKPT_CLEAR(addr, storage) db_bkpt_clear(addr, storage) -#define BKPT_SKIP db_bkpt_skip() -#define BKPT_INST_TYPE uint64_t - -void db_bkpt_write(db_addr_t, BKPT_INST_TYPE *storage); -void db_bkpt_clear(db_addr_t, uint64_t *storage); -void db_bkpt_skip(void); - -#define db_clear_single_step kdb_cpu_clear_singlestep -#define db_set_single_step kdb_cpu_set_singlestep - -#define IS_BREAKPOINT_TRAP(type, code) (type == IA64_VEC_BREAK) -#define IS_WATCHPOINT_TRAP(type, code) 0 - -#define inst_trap_return(ins) (ins & 0) -#define inst_return(ins) (ins & 0) -#define inst_call(ins) (ins & 0) -#define inst_branch(ins) (ins & 0) -#define inst_load(ins) (ins & 0) -#define inst_store(ins) (ins & 0) -#define inst_unconditional_flow_transfer(ins) (ins & 0) - -#define branch_taken(ins, pc, regs) pc - -/* Function call support. */ -#define DB_MAXARGS 8 /* Only support arguments in registers. */ -#define DB_CALL db_fncall_ia64 - -#endif /* _MACHINE_DB_MACHDEP_H_ */ diff --git a/sys/ia64/include/dig64.h b/sys/ia64/include/dig64.h deleted file mode 100644 index e8362ad..0000000 --- a/sys/ia64/include/dig64.h +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * Copyright (c) 2002 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_DIG64_H_ -#define _MACHINE_DIG64_H_ - -struct dig64_gas { - uint8_t addr_space; - uint8_t bit_width; - uint8_t bit_offset; - uint8_t _reserved_; - /* - * XXX using a 64-bit type for the address would cause padding and - * using __packed would cause unaligned accesses... - */ - uint32_t addr_low; - uint32_t addr_high; -}; - -struct dig64_hcdp_entry { - uint8_t type; -#define DIG64_HCDP_CONSOLE 0 -#define DIG64_HCDP_DBGPORT 1 - uint8_t databits; - uint8_t parity; - uint8_t stopbits; - uint8_t pci_segment; - uint8_t pci_bus; - uint8_t pci_device:5; - uint8_t _reserved1_:3; - uint8_t pci_function:3; - uint8_t _reserved2_:3; - uint8_t interrupt:1; - uint8_t pci_flag:1; - /* - * XXX using a 64-bit type for the baudrate would cause padding and - * using __packed would cause unaligned accesses... - */ - uint32_t baud_low; - uint32_t baud_high; - struct dig64_gas address; - uint16_t pci_devid; - uint16_t pci_vendor; - uint32_t irq; - uint32_t pclock; - uint8_t pci_interface; - uint8_t _reserved3_[7]; -}; - -struct dig64_hcdp_table { - char signature[4]; -#define HCDP_SIGNATURE "HCDP" - uint32_t length; - uint8_t revision; - uint8_t checksum; - char oem_id[6]; - char oem_tbl_id[8]; - uint32_t oem_rev; - char creator_id[4]; - uint32_t creator_rev; - uint32_t entries; - struct dig64_hcdp_entry entry[1]; -}; - -#endif diff --git a/sys/ia64/include/elf.h b/sys/ia64/include/elf.h deleted file mode 100644 index 34135ac..0000000 --- a/sys/ia64/include/elf.h +++ /dev/null @@ -1,155 +0,0 @@ -/*- - * Copyright (c) 1996-1997 John D. Polstra. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_ELF_H_ -#define _MACHINE_ELF_H_ 1 - -/* - * ELF definitions for the IA-64 architecture. - */ - -#ifndef __ELF_WORD_SIZE -#define __ELF_WORD_SIZE 64 -#endif - -#include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */ -#include <sys/elf32.h> /* Definitions common to all 32 bit architectures. */ - -#include <sys/elf_generic.h> - -#define ELF_ARCH EM_IA_64 -#define ELF_ARCH32 EM_386 - -#define ELF_MACHINE_OK(x) ((x) == EM_IA_64) - -/* - * Auxiliary vector entries for passing information to the interpreter. - * - * The i386 supplement to the SVR4 ABI specification names this "auxv_t", - * but POSIX lays claim to all symbols ending with "_t". - */ - -typedef struct { /* Auxiliary vector entry on initial stack */ - int a_type; /* Entry type. */ - union { - int a_val; /* Integer value. */ - } a_un; -} Elf32_Auxinfo; - -typedef struct { /* Auxiliary vector entry on initial stack */ - int a_type; /* Entry type. */ - union { - long a_val; /* Integer value. */ - void *a_ptr; /* Address. */ - void (*a_fcn)(void); /* Function pointer (not used). */ - } a_un; -} Elf64_Auxinfo; - -__ElfType(Auxinfo); - -/* Values for a_type. */ -#define AT_NULL 0 /* Terminates the vector. */ -#define AT_IGNORE 1 /* Ignored entry. */ -#define AT_EXECFD 2 /* File descriptor of program to load. */ -#define AT_PHDR 3 /* Program header of program already loaded. */ -#define AT_PHENT 4 /* Size of each program header entry. */ -#define AT_PHNUM 5 /* Number of program header entries. */ -#define AT_PAGESZ 6 /* Page size in bytes. */ -#define AT_BASE 7 /* Interpreter's base address. */ -#define AT_FLAGS 8 /* Flags (unused for i386). */ -#define AT_ENTRY 9 /* Where interpreter should transfer control. */ -#define AT_NOTELF 10 /* Program is not ELF ?? */ -#define AT_UID 11 /* Real uid. */ -#define AT_EUID 12 /* Effective uid. */ -#define AT_GID 13 /* Real gid. */ -#define AT_EGID 14 /* Effective gid. */ -#define AT_EXECPATH 15 /* Path to the executable. */ -#define AT_CANARY 16 /* Canary for SSP */ -#define AT_CANARYLEN 17 /* Length of the canary. */ -#define AT_OSRELDATE 18 /* OSRELDATE. */ -#define AT_NCPUS 19 /* Number of CPUs. */ -#define AT_PAGESIZES 20 /* Pagesizes. */ -#define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ -#define AT_TIMEKEEP 22 /* Pointer to timehands. */ -#define AT_STACKPROT 23 /* Initial stack protection. */ - -#define AT_COUNT 24 /* Count of defined aux entry types. */ - -/* - * Values for e_flags. - */ -#define EF_IA_64_MASKOS 0x00ff000f -#define EF_IA_64_ABI64 0x00000010 -#define EF_IA_64_REDUCEDFP 0x00000020 -#define EF_IA_64_CONS_GP 0x00000040 -#define EF_IA_64_NOFUNCDESC_CONS_GP 0x00000080 -#define EF_IA_64_ABSOLUTE 0x00000100 -#define EF_IA_64_ARCH 0xff000000 - -/* - * Segment types. - */ -#define PT_IA_64_ARCHEXT 0x70000000 -#define PT_IA_64_UNWIND 0x70000001 - -/* - * Segment attributes. - */ -#define PF_IA_64_NORECOV 0x80000000 - -/* - * Section types. - */ -#define SHT_IA_64_EXT 0x70000000 -#define SHT_IA_64_UNWIND 0x70000001 -#define SHT_IA_64_LOPSREG 0x78000000 -#define SHT_IA_64_HIPSREG 0x7fffffff - -/* - * Section attribute flags. - */ -#define SHF_IA_64_SHORT 0x10000000 -#define SHF_IA_64_NORECOV 0x20000000 - -/* Define "machine" characteristics */ -#if __ELF_WORD_SIZE == 32 -#define ELF_TARG_CLASS ELFCLASS32 -#else -#define ELF_TARG_CLASS ELFCLASS64 -#endif -#define ELF_TARG_DATA ELFDATA2LSB -#define ELF_TARG_MACH EM_IA_64 -#define ELF_TARG_VER 1 - -/* Processor specific dynmamic section tags. */ - -#define DT_IA_64_PLT_RESERVE 0x70000000 - -#define ET_DYN_LOAD_ADDR 0x2500000000000000 - -#endif /* !_MACHINE_ELF_H_ */ diff --git a/sys/ia64/include/endian.h b/sys/ia64/include/endian.h deleted file mode 100644 index 5b3d978..0000000 --- a/sys/ia64/include/endian.h +++ /dev/null @@ -1,109 +0,0 @@ -/*- - * Copyright (c) 1987, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)endian.h 8.1 (Berkeley) 6/10/93 - * $NetBSD: endian.h,v 1.5 1997/10/09 15:42:19 bouyer Exp $ - * $FreeBSD$ - */ - -#ifndef _MACHINE_ENDIAN_H_ -#define _MACHINE_ENDIAN_H_ - -#include <sys/cdefs.h> -#include <sys/_types.h> - -/* - * Define the order of 32-bit words in 64-bit words. - */ -#define _QUAD_HIGHWORD 1 -#define _QUAD_LOWWORD 0 - -/* - * Definitions for byte order, according to byte significance from low - * address to high. - */ -#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ -#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ -#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ - -#define _BYTE_ORDER _LITTLE_ENDIAN - -/* - * Deprecated variants that don't have enough underscores to be useful in more - * strict namespaces. - */ -#if __BSD_VISIBLE -#define LITTLE_ENDIAN _LITTLE_ENDIAN -#define BIG_ENDIAN _BIG_ENDIAN -#define PDP_ENDIAN _PDP_ENDIAN -#define BYTE_ORDER _BYTE_ORDER -#endif - -#if defined(__CC_SUPPORTS___INLINE) && defined(__GNUCLIKE_ASM) - -static __inline __uint64_t -__bswap64(__uint64_t _x) -{ - __uint64_t __r; - - __asm __volatile("mux1 %0=%1,@rev" - : "=r" (__r) : "r"(_x)); - return __r; -} - -static __inline __uint32_t -__bswap32(__uint32_t _x) -{ - - return (__bswap64(_x) >> 32); -} - -static __inline __uint16_t -__bswap16(__uint16_t _x) -{ - - return (__bswap64(_x) >> 48); -} - -#define __htonl(x) __bswap32(x) -#define __htons(x) __bswap16(x) -#define __ntohl(x) __bswap32(x) -#define __ntohs(x) __bswap16(x) - -#else /* !(__CC_SUPPORTS___INLINE && __GNUCLIKE_ASM) */ - -/* - * No optimizations are available for this compiler. Fall back to - * non-optimized functions by defining the constant usually used to prevent - * redefinition. - */ -#define _BYTEORDER_FUNC_DEFINED - -#endif /* __CC_SUPPORTS___INLINE && __GNUCLIKE_ASM */ - -#endif /* !_MACHINE_ENDIAN_H_ */ diff --git a/sys/ia64/include/exec.h b/sys/ia64/include/exec.h deleted file mode 100644 index 0386728..0000000 --- a/sys/ia64/include/exec.h +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_EXEC_H_ -#define _MACHINE_EXEC_H_ - -#define __LDPGSZ 4096 - -#endif /* !_MACHINE_EXEC_H_ */ diff --git a/sys/ia64/include/float.h b/sys/ia64/include/float.h deleted file mode 100644 index 171be6b..0000000 --- a/sys/ia64/include/float.h +++ /dev/null @@ -1,94 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: float.h,v 1.6 1997/07/17 21:36:03 thorpej Exp */ - -/*- - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_FLOAT_H_ -#define _MACHINE_FLOAT_H_ - -#include <sys/cdefs.h> - -__BEGIN_DECLS -extern int __flt_rounds(void); -__END_DECLS - -#define FLT_RADIX 2 /* b */ -#define FLT_ROUNDS __flt_rounds() -#if __ISO_C_VISIBLE >= 1999 -#define FLT_EVAL_METHOD 0 /* no promotions */ -#define DECIMAL_DIG 21 /* max precision in decimal digits */ -#endif - -#define FLT_MANT_DIG 24 /* p */ -#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ -#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */ -#define FLT_MIN_EXP (-125) /* emin */ -#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */ -#define FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */ -#define FLT_MAX_EXP 128 /* emax */ -#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */ -#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */ -#if __ISO_C_VISIBLE >= 2011 -#define FLT_TRUE_MIN 1.40129846E-45F /* b**(emin-p) */ -#define FLT_DECIMAL_DIG 9 /* ceil(1+p*log10(b)) */ -#define FLT_HAS_SUBNORM 1 -#endif /* __ISO_C_VISIBLE >= 2011 */ - -#define DBL_MANT_DIG 53 -#define DBL_EPSILON 2.2204460492503131E-16 -#define DBL_DIG 15 -#define DBL_MIN_EXP (-1021) -#define DBL_MIN 2.2250738585072014E-308 -#define DBL_MIN_10_EXP (-307) -#define DBL_MAX_EXP 1024 -#define DBL_MAX 1.7976931348623157E+308 -#define DBL_MAX_10_EXP 308 -#if __ISO_C_VISIBLE >= 2011 -#define DBL_TRUE_MIN 4.9406564584124654E-324 -#define DBL_DECIMAL_DIG 17 -#define DBL_HAS_SUBNORM 1 -#endif /* __ISO_C_VISIBLE >= 2011 */ - -#define LDBL_MANT_DIG 64 -#define LDBL_EPSILON 1.0842021724855044340E-19L -#define LDBL_DIG 18 -#define LDBL_MIN_EXP (-16381) -#define LDBL_MIN 3.3621031431120935063E-4932L -#define LDBL_MIN_10_EXP (-4931) -#define LDBL_MAX_EXP 16384 -#define LDBL_MAX 1.1897314953572317650E+4932L -#define LDBL_MAX_10_EXP 4932 -#if __ISO_C_VISIBLE >= 2011 -#define LDBL_TRUE_MIN 3.6451995318824746025E-4951L -#define LDBL_DECIMAL_DIG 21 -#define LDBL_HAS_SUBNORM 1 -#endif /* __ISO_C_VISIBLE >= 2011 */ - -#endif /* _MACHINE_FLOAT_H_ */ diff --git a/sys/ia64/include/floatingpoint.h b/sys/ia64/include/floatingpoint.h deleted file mode 100644 index 22be759..0000000 --- a/sys/ia64/include/floatingpoint.h +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <machine/ieeefp.h> diff --git a/sys/ia64/include/fpu.h b/sys/ia64/include/fpu.h deleted file mode 100644 index 7a068dd..0000000 --- a/sys/ia64/include/fpu.h +++ /dev/null @@ -1,109 +0,0 @@ -/*- - * Copyright (c) 1998 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_FPU_H_ -#define _MACHINE_FPU_H_ - -/* - * Floating point status register bits. - */ - -#define IA64_FPSR_TRAP_VD 0x0000000000000001L -#define IA64_FPSR_TRAP_DD 0x0000000000000002L -#define IA64_FPSR_TRAP_ZD 0x0000000000000004L -#define IA64_FPSR_TRAP_OD 0x0000000000000008L -#define IA64_FPSR_TRAP_UD 0x0000000000000010L -#define IA64_FPSR_TRAP_ID 0x0000000000000020L -#define IA64_FPSR_SF(i,v) ((v) << ((i)*13+6)) - -#define IA64_SF_FTZ 0x0001L -#define IA64_SF_WRE 0x0002L -#define IA64_SF_PC 0x000cL -#define IA64_SF_PC_0 0x0000L -#define IA64_SF_PC_1 0x0004L -#define IA64_SF_PC_2 0x0008L -#define IA64_SF_PC_3 0x000cL -#define IA64_SF_RC 0x0030L -#define IA64_SF_RC_NEAREST 0x0000L -#define IA64_SF_RC_NEGINF 0x0010L -#define IA64_SF_RC_POSINF 0x0020L -#define IA64_SF_RC_TRUNC 0x0030L -#define IA64_SF_TD 0x0040L -#define IA64_SF_V 0x0080L -#define IA64_SF_D 0x0100L -#define IA64_SF_Z 0x0200L -#define IA64_SF_O 0x0400L -#define IA64_SF_U 0x0800L -#define IA64_SF_I 0x1000L - -#define IA64_SF_DEFAULT (IA64_SF_PC_3 | IA64_SF_RC_NEAREST) - -#define IA64_FPSR_DEFAULT (IA64_FPSR_TRAP_VD \ - | IA64_FPSR_TRAP_DD \ - | IA64_FPSR_TRAP_ZD \ - | IA64_FPSR_TRAP_OD \ - | IA64_FPSR_TRAP_UD \ - | IA64_FPSR_TRAP_ID \ - | IA64_FPSR_SF(0, IA64_SF_DEFAULT) \ - | IA64_FPSR_SF(1, (IA64_SF_DEFAULT \ - | IA64_SF_TD \ - | IA64_SF_WRE)) \ - | IA64_FPSR_SF(2, (IA64_SF_DEFAULT \ - | IA64_SF_TD)) \ - | IA64_FPSR_SF(3, (IA64_SF_DEFAULT \ - | IA64_SF_TD))) - -struct fpswa_ret { - unsigned long status; - unsigned long err1; - unsigned long err2; - unsigned long err3; -}; - -struct fpswa_bundle { - long double bits; /* Force 16-byte alignment. */ -}; - -struct fpswa_fpctx { - unsigned long mask_low; /* f63 - f2 */ - unsigned long mask_high; /* f127 - f64 */ - union _ia64_fpreg *fp_low_preserved; /* f2 - f5 */ - union _ia64_fpreg *fp_low_volatile; /* f6 - f15 */ - union _ia64_fpreg *fp_high_preserved; /* f16 - f31 */ - union _ia64_fpreg *fp_high_volatile; /* f32 - f127 */ -}; - -struct fpswa_iface { - unsigned int if_rev; - unsigned int __res; - struct fpswa_ret (*if_fpswa)(unsigned long, struct fpswa_bundle *, - unsigned long *, unsigned long *, unsigned long *, unsigned long *, - unsigned long *, struct fpswa_fpctx *); -}; - -#endif /* ! _MACHINE_FPU_H_ */ diff --git a/sys/ia64/include/frame.h b/sys/ia64/include/frame.h deleted file mode 100644 index 683d164..0000000 --- a/sys/ia64/include/frame.h +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_FRAME_H_ -#define _MACHINE_FRAME_H_ - -#ifndef _MACHINE_REGSET_H_ -#include <machine/_regset.h> -#endif - -/* - * Software trap, exception, and syscall frame. - */ -struct trapframe { - uint64_t tf_length; - uint64_t tf_flags; -#define FRAME_SYSCALL 1 /* syscalls use a partial trapframe */ - struct _special tf_special; - struct _caller_saved tf_scratch; - struct _caller_saved_fp tf_scratch_fp; -}; - -#endif /* _MACHINE_FRAME_H_ */ diff --git a/sys/ia64/include/gdb_machdep.h b/sys/ia64/include/gdb_machdep.h deleted file mode 100644 index bc6ec4c..0000000 --- a/sys/ia64/include/gdb_machdep.h +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * Copyright (c) 2004 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_GDB_MACHDEP_H_ -#define _MACHINE_GDB_MACHDEP_H_ - -#define GDB_NREGS 462 -#define GDB_REG_PC 331 - -#define GDB_BUFSZ (GDB_NREGS*16+128*16) - -static __inline size_t -gdb_cpu_regsz(int regnum) -{ - return ((regnum >= 128 && regnum < 256) ? 16 : 8); -} - -void *gdb_cpu_getreg(int, size_t *); -void gdb_cpu_setreg(int, void *); -int gdb_cpu_signal(int, int); -int gdb_cpu_query(void); - -#endif /* !_MACHINE_GDB_MACHDEP_H_ */ diff --git a/sys/ia64/include/ia64_cpu.h b/sys/ia64/include/ia64_cpu.h deleted file mode 100644 index 74e649b..0000000 --- a/sys/ia64/include/ia64_cpu.h +++ /dev/null @@ -1,532 +0,0 @@ -/*- - * Copyright (c) 2007 Marcel Moolenaar - * Copyright (c) 2000 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_IA64_CPU_H_ -#define _MACHINE_IA64_CPU_H_ - -/* - * Local Interrupt ID. - */ -#define IA64_LID_GET_SAPIC_ID(x) ((u_int)((x) >> 16) & 0xffff) -#define IA64_LID_SET_SAPIC_ID(x) ((u_int)((x) & 0xffff) << 16) - -/* - * Definition of DCR bits. - */ -#define IA64_DCR_PP 0x0000000000000001 -#define IA64_DCR_BE 0x0000000000000002 -#define IA64_DCR_LC 0x0000000000000004 -#define IA64_DCR_DM 0x0000000000000100 -#define IA64_DCR_DP 0x0000000000000200 -#define IA64_DCR_DK 0x0000000000000400 -#define IA64_DCR_DX 0x0000000000000800 -#define IA64_DCR_DR 0x0000000000001000 -#define IA64_DCR_DA 0x0000000000002000 -#define IA64_DCR_DD 0x0000000000004000 - -#define IA64_DCR_DEFAULT \ - (IA64_DCR_DM | IA64_DCR_DP | IA64_DCR_DK | IA64_DCR_DX | \ - IA64_DCR_DR | IA64_DCR_DA | IA64_DCR_DD) - -/* - * Definition of PSR and IPSR bits. - */ -#define IA64_PSR_BE 0x0000000000000002 -#define IA64_PSR_UP 0x0000000000000004 -#define IA64_PSR_AC 0x0000000000000008 -#define IA64_PSR_MFL 0x0000000000000010 -#define IA64_PSR_MFH 0x0000000000000020 -#define IA64_PSR_IC 0x0000000000002000 -#define IA64_PSR_I 0x0000000000004000 -#define IA64_PSR_PK 0x0000000000008000 -#define IA64_PSR_DT 0x0000000000020000 -#define IA64_PSR_DFL 0x0000000000040000 -#define IA64_PSR_DFH 0x0000000000080000 -#define IA64_PSR_SP 0x0000000000100000 -#define IA64_PSR_PP 0x0000000000200000 -#define IA64_PSR_DI 0x0000000000400000 -#define IA64_PSR_SI 0x0000000000800000 -#define IA64_PSR_DB 0x0000000001000000 -#define IA64_PSR_LP 0x0000000002000000 -#define IA64_PSR_TB 0x0000000004000000 -#define IA64_PSR_RT 0x0000000008000000 -#define IA64_PSR_CPL 0x0000000300000000 -#define IA64_PSR_CPL_KERN 0x0000000000000000 -#define IA64_PSR_CPL_1 0x0000000100000000 -#define IA64_PSR_CPL_2 0x0000000200000000 -#define IA64_PSR_CPL_USER 0x0000000300000000 -#define IA64_PSR_IS 0x0000000400000000 -#define IA64_PSR_MC 0x0000000800000000 -#define IA64_PSR_IT 0x0000001000000000 -#define IA64_PSR_ID 0x0000002000000000 -#define IA64_PSR_DA 0x0000004000000000 -#define IA64_PSR_DD 0x0000008000000000 -#define IA64_PSR_SS 0x0000010000000000 -#define IA64_PSR_RI 0x0000060000000000 -#define IA64_PSR_RI_0 0x0000000000000000 -#define IA64_PSR_RI_1 0x0000020000000000 -#define IA64_PSR_RI_2 0x0000040000000000 -#define IA64_PSR_ED 0x0000080000000000 -#define IA64_PSR_BN 0x0000100000000000 -#define IA64_PSR_IA 0x0000200000000000 - -/* - * Definition of ISR bits. - */ -#define IA64_ISR_CODE 0x000000000000ffff -#define IA64_ISR_VECTOR 0x0000000000ff0000 -#define IA64_ISR_X 0x0000000100000000 -#define IA64_ISR_W 0x0000000200000000 -#define IA64_ISR_R 0x0000000400000000 -#define IA64_ISR_NA 0x0000000800000000 -#define IA64_ISR_SP 0x0000001000000000 -#define IA64_ISR_RS 0x0000002000000000 -#define IA64_ISR_IR 0x0000004000000000 -#define IA64_ISR_NI 0x0000008000000000 -#define IA64_ISR_SO 0x0000010000000000 -#define IA64_ISR_EI 0x0000060000000000 -#define IA64_ISR_EI_0 0x0000000000000000 -#define IA64_ISR_EI_1 0x0000020000000000 -#define IA64_ISR_EI_2 0x0000040000000000 -#define IA64_ISR_ED 0x0000080000000000 - -/* - * Vector numbers for various ia64 interrupts. - */ -#define IA64_VEC_VHPT 0 -#define IA64_VEC_ITLB 1 -#define IA64_VEC_DTLB 2 -#define IA64_VEC_ALT_ITLB 3 -#define IA64_VEC_ALT_DTLB 4 -#define IA64_VEC_NESTED_DTLB 5 -#define IA64_VEC_IKEY_MISS 6 -#define IA64_VEC_DKEY_MISS 7 -#define IA64_VEC_DIRTY_BIT 8 -#define IA64_VEC_INST_ACCESS 9 -#define IA64_VEC_DATA_ACCESS 10 -#define IA64_VEC_BREAK 11 -#define IA64_VEC_EXT_INTR 12 -#define IA64_VEC_PAGE_NOT_PRESENT 20 -#define IA64_VEC_KEY_PERMISSION 21 -#define IA64_VEC_INST_ACCESS_RIGHTS 22 -#define IA64_VEC_DATA_ACCESS_RIGHTS 23 -#define IA64_VEC_GENERAL_EXCEPTION 24 -#define IA64_VEC_DISABLED_FP 25 -#define IA64_VEC_NAT_CONSUMPTION 26 -#define IA64_VEC_SPECULATION 27 -#define IA64_VEC_DEBUG 29 -#define IA64_VEC_UNALIGNED_REFERENCE 30 -#define IA64_VEC_UNSUPP_DATA_REFERENCE 31 -#define IA64_VEC_FLOATING_POINT_FAULT 32 -#define IA64_VEC_FLOATING_POINT_TRAP 33 -#define IA64_VEC_LOWER_PRIVILEGE_TRANSFER 34 -#define IA64_VEC_TAKEN_BRANCH_TRAP 35 -#define IA64_VEC_SINGLE_STEP_TRAP 36 -#define IA64_VEC_IA32_EXCEPTION 45 -#define IA64_VEC_IA32_INTERCEPT 46 -#define IA64_VEC_IA32_INTERRUPT 47 - -/* - * IA-32 exceptions. - */ -#define IA32_EXCEPTION_DIVIDE 0 -#define IA32_EXCEPTION_DEBUG 1 -#define IA32_EXCEPTION_BREAK 3 -#define IA32_EXCEPTION_OVERFLOW 4 -#define IA32_EXCEPTION_BOUND 5 -#define IA32_EXCEPTION_DNA 7 -#define IA32_EXCEPTION_NOT_PRESENT 11 -#define IA32_EXCEPTION_STACK_FAULT 12 -#define IA32_EXCEPTION_GPFAULT 13 -#define IA32_EXCEPTION_FPERROR 16 -#define IA32_EXCEPTION_ALIGNMENT_CHECK 17 -#define IA32_EXCEPTION_STREAMING_SIMD 19 - -#define IA32_INTERCEPT_INSTRUCTION 0 -#define IA32_INTERCEPT_GATE 1 -#define IA32_INTERCEPT_SYSTEM_FLAG 2 -#define IA32_INTERCEPT_LOCK 4 - -#ifndef LOCORE - -/* - * Various special ia64 instructions. - */ - -/* - * Memory Fence. - */ -static __inline void -ia64_mf(void) -{ - __asm __volatile("mf"); -} - -static __inline void -ia64_mf_a(void) -{ - __asm __volatile("mf.a"); -} - -/* - * Flush Cache. - */ -static __inline void -ia64_fc(uint64_t va) -{ - __asm __volatile("fc %0" :: "r"(va)); -} - -static __inline void -ia64_fc_i(uint64_t va) -{ - __asm __volatile("fc.i %0" :: "r"(va)); -} - -/* - * Sync instruction stream. - */ -static __inline void -ia64_sync_i(void) -{ - __asm __volatile("sync.i"); -} - -/* - * Calculate address in VHPT for va. - */ -static __inline uint64_t -ia64_thash(uint64_t va) -{ - uint64_t result; - __asm __volatile("thash %0=%1" : "=r" (result) : "r" (va)); - return result; -} - -/* - * Calculate VHPT tag for va. - */ -static __inline uint64_t -ia64_ttag(uint64_t va) -{ - uint64_t result; - __asm __volatile("ttag %0=%1" : "=r" (result) : "r" (va)); - return result; -} - -/* - * Convert virtual address to physical. - */ -static __inline uint64_t -ia64_tpa(uint64_t va) -{ - uint64_t result; - __asm __volatile("tpa %0=%1" : "=r" (result) : "r" (va)); - return result; -} - -/* - * Generate a ptc.e instruction. - */ -static __inline void -ia64_ptc_e(uint64_t v) -{ - __asm __volatile("ptc.e %0;; srlz.i;;" :: "r"(v)); -} - -/* - * Generate a ptc.g instruction. - */ -static __inline void -ia64_ptc_g(uint64_t va, uint64_t log2size) -{ - __asm __volatile("ptc.g %0,%1;;" :: "r"(va), "r"(log2size)); -} - -/* - * Generate a ptc.ga instruction. - */ -static __inline void -ia64_ptc_ga(uint64_t va, uint64_t log2size) -{ - __asm __volatile("ptc.ga %0,%1;;" :: "r"(va), "r"(log2size)); -} - -/* - * Generate a ptc.l instruction. - */ -static __inline void -ia64_ptc_l(uint64_t va, uint64_t log2size) -{ - __asm __volatile("ptc.l %0,%1;; srlz.i;;" :: "r"(va), "r"(log2size)); -} - -/* - * Invalidate the ALAT on the local processor. - */ -static __inline void -ia64_invala(void) -{ - __asm __volatile("invala;;"); -} - -/* - * Unordered memory load. - */ - -static __inline uint8_t -ia64_ld1(uint8_t *p) -{ - uint8_t v; - - __asm __volatile("ld1 %0=[%1];;" : "=r"(v) : "r"(p)); - return (v); -} - -static __inline uint16_t -ia64_ld2(uint16_t *p) -{ - uint16_t v; - - __asm __volatile("ld2 %0=[%1];;" : "=r"(v) : "r"(p)); - return (v); -} - -static __inline uint32_t -ia64_ld4(uint32_t *p) -{ - uint32_t v; - - __asm __volatile("ld4 %0=[%1];;" : "=r"(v) : "r"(p)); - return (v); -} - -static __inline uint64_t -ia64_ld8(uint64_t *p) -{ - uint64_t v; - - __asm __volatile("ld8 %0=[%1];;" : "=r"(v) : "r"(p)); - return (v); -} - -/* - * Unordered memory store. - */ - -static __inline void -ia64_st1(uint8_t *p, uint8_t v) -{ - __asm __volatile("st1 [%0]=%1;;" :: "r"(p), "r"(v)); -} - -static __inline void -ia64_st2(uint16_t *p, uint16_t v) -{ - __asm __volatile("st2 [%0]=%1;;" :: "r"(p), "r"(v)); -} - -static __inline void -ia64_st4(uint32_t *p, uint32_t v) -{ - __asm __volatile("st4 [%0]=%1;;" :: "r"(p), "r"(v)); -} - -static __inline void -ia64_st8(uint64_t *p, uint64_t v) -{ - __asm __volatile("st8 [%0]=%1;;" :: "r"(p), "r"(v)); -} - -/* - * Read the value of psr. - */ -static __inline uint64_t -ia64_get_psr(void) -{ - uint64_t result; - __asm __volatile("mov %0=psr;;" : "=r" (result)); - return result; -} - -/* - * Define accessors for application registers. - */ - -#define IA64_AR(name) \ - \ -static __inline uint64_t \ -ia64_get_##name(void) \ -{ \ - uint64_t result; \ - __asm __volatile("mov %0=ar." #name : "=r" (result)); \ - return result; \ -} \ - \ -static __inline void \ -ia64_set_##name(uint64_t v) \ -{ \ - __asm __volatile("mov ar." #name "=%0;;" :: "r" (v)); \ -} - -IA64_AR(k0) -IA64_AR(k1) -IA64_AR(k2) -IA64_AR(k3) -IA64_AR(k4) -IA64_AR(k5) -IA64_AR(k6) -IA64_AR(k7) - -IA64_AR(rsc) -IA64_AR(bsp) -IA64_AR(bspstore) -IA64_AR(rnat) - -IA64_AR(fcr) - -IA64_AR(eflag) -IA64_AR(csd) -IA64_AR(ssd) -IA64_AR(cflg) -IA64_AR(fsr) -IA64_AR(fir) -IA64_AR(fdr) - -IA64_AR(ccv) - -IA64_AR(unat) - -IA64_AR(fpsr) - -IA64_AR(itc) - -IA64_AR(pfs) -IA64_AR(lc) -IA64_AR(ec) - -/* - * Define accessors for control registers. - */ - -#define IA64_CR(name) \ - \ -static __inline uint64_t \ -ia64_get_##name(void) \ -{ \ - uint64_t result; \ - __asm __volatile("mov %0=cr." #name : "=r" (result)); \ - return result; \ -} \ - \ -static __inline void \ -ia64_set_##name(uint64_t v) \ -{ \ - __asm __volatile("mov cr." #name "=%0;;" :: "r" (v)); \ -} - -IA64_CR(dcr) -IA64_CR(itm) -IA64_CR(iva) - -IA64_CR(pta) - -IA64_CR(ipsr) -IA64_CR(isr) - -IA64_CR(iip) -IA64_CR(ifa) -IA64_CR(itir) -IA64_CR(iipa) -IA64_CR(ifs) -IA64_CR(iim) -IA64_CR(iha) - -IA64_CR(lid) -IA64_CR(ivr) -IA64_CR(tpr) -IA64_CR(eoi) -IA64_CR(irr0) -IA64_CR(irr1) -IA64_CR(irr2) -IA64_CR(irr3) -IA64_CR(itv) -IA64_CR(pmv) -IA64_CR(cmcv) - -IA64_CR(lrr0) -IA64_CR(lrr1) - -/* - * Write a region register. - */ -static __inline void -ia64_set_rr(uint64_t rrbase, uint64_t v) -{ - __asm __volatile("mov rr[%0]=%1" - :: "r"(rrbase), "r"(v) : "memory"); -} - -/* - * Read a CPUID register. - */ -static __inline uint64_t -ia64_get_cpuid(int i) -{ - uint64_t result; - __asm __volatile("mov %0=cpuid[%1]" - : "=r" (result) : "r"(i)); - return result; -} - -static __inline void -ia64_disable_highfp(void) -{ - __asm __volatile("ssm psr.dfh;; srlz.d"); -} - -static __inline void -ia64_enable_highfp(void) -{ - __asm __volatile("rsm psr.dfh;; srlz.d"); -} - -/* - * Avoid inline functions for the following so that they still work - * correctly when inlining is not enabled (e.g. -O0). Function calls - * need data serialization after setting psr, which results in a - * hazard. - */ -#define ia64_srlz_d() __asm __volatile("srlz.d") -#define ia64_srlz_i() __asm __volatile("srlz.i;;") - -#endif /* !LOCORE */ - -#endif /* _MACHINE_IA64_CPU_H_ */ - diff --git a/sys/ia64/include/ieee.h b/sys/ia64/include/ieee.h deleted file mode 100644 index 0b1f631..0000000 --- a/sys/ia64/include/ieee.h +++ /dev/null @@ -1,115 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: ieee.h,v 1.2 1997/04/06 08:47:27 cgd Exp */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ieee.h 8.1 (Berkeley) 6/11/93 - * - * from: Header: ieee.h,v 1.7 92/11/26 02:04:37 torek Exp - */ - -/* - * ieee.h defines the machine-dependent layout of the machine's IEEE - * floating point. It does *not* define (yet?) any of the rounding - * mode bits, exceptions, and so forth. - */ - -/* - * Define the number of bits in each fraction and exponent. - * - * k k+1 - * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented - * - * (-exp_bias+1) - * as fractions that look like 0.fffff x 2 . This means that - * - * -126 - * the number 0.10000 x 2 , for instance, is the same as the normalized - * - * -127 -128 - * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero - * - * -129 - * in the fraction; to represent 2 , we need two, and so on. This - * - * (-exp_bias-fracbits+1) - * implies that the smallest denormalized number is 2 - * - * for whichever format we are talking about: for single precision, for - * - * -126 -149 - * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and - * - * -149 == -127 - 23 + 1. - */ -#define SNG_EXPBITS 8 -#define SNG_FRACBITS 23 - -#define DBL_EXPBITS 11 -#define DBL_FRACBITS 52 - -struct ieee_single { - u_int sng_frac:23; - u_int sng_exp:8; - u_int sng_sign:1; -}; - -struct ieee_double { - u_int dbl_fracl; - u_int dbl_frach:20; - u_int dbl_exp:11; - u_int dbl_sign:1; -}; - -/* - * Floats whose exponent is in [1..INFNAN) (of whatever type) are - * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. - * Floats whose exponent is zero are either zero (iff all fraction - * bits are zero) or subnormal values. - * - * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its - * high fraction; if the bit is set, it is a `quiet NaN'. - */ -#define SNG_EXP_INFNAN 255 -#define DBL_EXP_INFNAN 2047 - -#if 0 -#define SNG_QUIETNAN (1 << 22) -#define DBL_QUIETNAN (1 << 19) -#endif - -/* - * Exponent biases. - */ -#define SNG_EXP_BIAS 127 -#define DBL_EXP_BIAS 1023 diff --git a/sys/ia64/include/ieeefp.h b/sys/ia64/include/ieeefp.h deleted file mode 100644 index 7cde91b..0000000 --- a/sys/ia64/include/ieeefp.h +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_IEEEFP_H_ -#define _MACHINE_IEEEFP_H_ - -/* Deprecated historical FPU control interface */ - -#include <machine/fpu.h> - -typedef int fp_except_t; -#define FP_X_INV IA64_FPSR_TRAP_VD /* invalid operation exception */ -#define FP_X_DZ IA64_FPSR_TRAP_ZD /* divide-by-zero exception */ -#define FP_X_OFL IA64_FPSR_TRAP_OD /* overflow exception */ -#define FP_X_UFL IA64_FPSR_TRAP_UD /* underflow exception */ -#define FP_X_IMP IA64_FPSR_TRAP_ID /* imprecise(inexact) exception */ - -typedef enum { - FP_RN = 0, /* round to nearest */ - FP_RM, /* round toward minus infinity */ - FP_RP, /* round toward plus infinity */ - FP_RZ /* round toward zero */ -} fp_rnd_t; - -__BEGIN_DECLS -extern fp_rnd_t fpgetround(void); -extern fp_rnd_t fpsetround(fp_rnd_t); -extern fp_except_t fpgetmask(void); -extern fp_except_t fpsetmask(fp_except_t); -__END_DECLS - -#endif /* !_MACHINE_IEEEFP_H_ */ diff --git a/sys/ia64/include/in_cksum.h b/sys/ia64/include/in_cksum.h deleted file mode 100644 index 4fe1b40..0000000 --- a/sys/ia64/include/in_cksum.h +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from tahoe: in_cksum.c 1.2 86/01/05 - * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 - * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp - * $FreeBSD$ - */ - -#ifndef _MACHINE_IN_CKSUM_H_ -#define _MACHINE_IN_CKSUM_H_ 1 - -#include <sys/cdefs.h> - -#define in_cksum(m, len) in_cksum_skip(m, len, 0) - -#if defined(IPVERSION) && (IPVERSION == 4) -/* - * It it useful to have an Internet checksum routine which is inlineable - * and optimized specifically for the task of computing IP header checksums - * in the normal case (where there are no options and the header length is - * therefore always exactly five 32-bit words. - */ -#ifdef __CC_SUPPORTS___INLINE - -static __inline void -in_cksum_update(struct ip *ip) -{ - int __tmpsum; - __tmpsum = (int)ntohs(ip->ip_sum) + 256; - ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); -} - -#else - -#define in_cksum_update(ip) \ - do { \ - int __tmpsum; \ - __tmpsum = (int)ntohs(ip->ip_sum) + 256; \ - ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \ - } while(0) - -#endif -#endif - -#ifdef _KERNEL -#if defined(IPVERSION) && (IPVERSION == 4) -u_int in_cksum_hdr(const struct ip *ip); -#endif -u_short in_addword(u_short sum, u_short b); -u_short in_pseudo(u_int sum, u_int b, u_int c); -u_short in_cksum_skip(struct mbuf *m, int len, int skip); -#endif - -#endif /* _MACHINE_IN_CKSUM_H_ */ diff --git a/sys/ia64/include/intr.h b/sys/ia64/include/intr.h deleted file mode 100644 index 81603cf..0000000 --- a/sys/ia64/include/intr.h +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * Copyright (c) 2007-2010 Marcel Moolenaar - * Copyright (c) 1998 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_INTR_H_ -#define _MACHINE_INTR_H_ - -#define IA64_NXIVS 256 /* External Interrupt Vectors */ -#define IA64_MIN_XIV 16 - -#define IA64_MAX_HWPRIO 14 - -struct pcpu; -struct sapic; -struct thread; -struct trapframe; - -/* - * Layout of the Processor Interrupt Block. - */ -struct ia64_pib -{ - uint64_t ib_ipi[65536][2]; /* 64K-way IPIs (1MB area). */ - uint8_t _rsvd1[0xe0000]; - uint8_t ib_inta; /* Generate INTA cycle. */ - uint8_t _rsvd2[7]; - uint8_t ib_xtp; /* External Task Priority. */ - uint8_t _rsvd3[7]; - uint8_t _rsvd4[0x1fff0]; -}; - -enum ia64_xiv_use { - IA64_XIV_FREE, - IA64_XIV_ARCH, /* Architecturally defined. */ - IA64_XIV_PLAT, /* Platform defined. */ - IA64_XIV_IPI, /* Used for IPIs. */ - IA64_XIV_IRQ /* Used for external interrupts. */ -}; - -typedef u_int (ia64_ihtype)(struct thread *, u_int, struct trapframe *); - -extern struct ia64_pib *ia64_pib; - -void ia64_bind_intr(void); -void ia64_handle_intr(struct trapframe *); -int ia64_setup_intr(const char *, int, driver_filter_t, driver_intr_t, - void *, enum intr_type, void **); -int ia64_teardown_intr(void *); - -void ia64_xiv_init(void); -u_int ia64_xiv_alloc(u_int, enum ia64_xiv_use, ia64_ihtype); -int ia64_xiv_free(u_int, enum ia64_xiv_use); -int ia64_xiv_reserve(u_int, enum ia64_xiv_use, ia64_ihtype); - -int sapic_bind_intr(u_int, struct pcpu *); -int sapic_config_intr(u_int, enum intr_trigger, enum intr_polarity); -struct sapic *sapic_create(u_int, u_int, uint64_t); -int sapic_enable(struct sapic *, u_int, u_int); -void sapic_eoi(struct sapic *, u_int); -struct sapic *sapic_lookup(u_int, u_int *); -void sapic_mask(struct sapic *, u_int); -void sapic_unmask(struct sapic *, u_int); - -#ifdef DDB -void sapic_print(struct sapic *, u_int); -#endif - -#endif /* !_MACHINE_INTR_H_ */ diff --git a/sys/ia64/include/intrcnt.h b/sys/ia64/include/intrcnt.h deleted file mode 100644 index 5e165ea..0000000 --- a/sys/ia64/include/intrcnt.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: intrcnt.h,v 1.17 1998/11/19 01:48:04 ross Exp $ */ - -/*- - * Copyright (c) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 the - * rights to redistribute these changes. - */ - -#define INTRCNT_CLOCK 0 -#define INTRCNT_COUNT 256 - -/* - * Maximum name length in intrnames table (including terminating '\0'. - * Since vmstat(8) assumes a maximum length of 13 (including '\0'), we're - * pretty much limited to that (unless we don't care about the alignment - * of the columns :-) - */ -#define INTRNAME_LEN 13 diff --git a/sys/ia64/include/iodev.h b/sys/ia64/include/iodev.h deleted file mode 100644 index cf349d9..0000000 --- a/sys/ia64/include/iodev.h +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * Copyright (c) 2010 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_IODEV_H_ -#define _MACHINE_IODEV_H_ - -#include <sys/uuid.h> - -#ifdef _KERNEL -#include <machine/bus.h> -#endif - -#define IODEV_EFIVAR_GETVAR 0 -#define IODEV_EFIVAR_NEXTNAME 1 -#define IODEV_EFIVAR_SETVAR 2 - -struct iodev_efivar_req { - u_int access; - u_int result; /* errno value */ - size_t namesize; - u_short *name; /* UCS-2 */ - struct uuid vendor; - uint32_t attrib; - size_t datasize; - void *data; -}; - -#define IODEV_EFIVAR _IOWR('I', 1, struct iodev_efivar_req) - -#ifdef _KERNEL -#define iodev_read_1 bus_space_read_io_1 -#define iodev_read_2 bus_space_read_io_2 -#define iodev_read_4 bus_space_read_io_4 -#define iodev_write_1 bus_space_write_io_1 -#define iodev_write_2 bus_space_write_io_2 -#define iodev_write_4 bus_space_write_io_4 - -int iodev_open(struct thread *td); -int iodev_close(struct thread *td); -int iodev_ioctl(u_long, caddr_t data); - -#endif /* _KERNEL */ -#endif /* _MACHINE_IODEV_H_ */ diff --git a/sys/ia64/include/kdb.h b/sys/ia64/include/kdb.h deleted file mode 100644 index 0304f51..0000000 --- a/sys/ia64/include/kdb.h +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * Copyright (c) 2004 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_KDB_H_ -#define _MACHINE_KDB_H_ - -#include <machine/cpufunc.h> -#include <machine/frame.h> -#include <machine/ia64_cpu.h> - -#define KDB_STOPPEDPCB(pc) (&(pc)->pc_md.pcb) - -void kdb_cpu_trap(int, int); - -static __inline void -kdb_cpu_clear_singlestep(void) -{ - kdb_frame->tf_special.psr &= ~IA64_PSR_SS; -} - -static __inline void -kdb_cpu_set_singlestep(void) -{ - kdb_frame->tf_special.psr |= IA64_PSR_SS; -} - -static __inline void -kdb_cpu_sync_icache(unsigned char *addr, size_t size) -{ - vm_offset_t cacheline; - - cacheline = (uintptr_t)addr & ~31; - size += (uintptr_t)addr - cacheline; - size = (size + 31) & ~31; - while (size > 0) { - __asm __volatile("fc %0;; sync.i;; srlz.i;;" :: "r"(cacheline)); - cacheline += 32; - size -= 32; - } -} - -#endif /* _MACHINE_KDB_H_ */ diff --git a/sys/ia64/include/limits.h b/sys/ia64/include/limits.h deleted file mode 100644 index 62772bc..0000000 --- a/sys/ia64/include/limits.h +++ /dev/null @@ -1,46 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: limits.h,v 1.3 1997/04/06 08:47:31 cgd Exp */ - -/*- - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)limits.h 8.3 (Berkeley) 1/4/94 - */ - -#ifndef _MACHINE_LIMITS_H_ -#define _MACHINE_LIMITS_H_ - -#include <sys/cdefs.h> - -#ifdef __CC_SUPPORTS_WARNING -#warning "machine/limits.h is deprecated. Include sys/limits.h instead." -#endif - -#include <sys/limits.h> - -#endif /* !_MACHINE_LIMITS_H_ */ diff --git a/sys/ia64/include/mca.h b/sys/ia64/include/mca.h deleted file mode 100644 index 1f38c13..0000000 --- a/sys/ia64/include/mca.h +++ /dev/null @@ -1,248 +0,0 @@ -/*- - * Copyright (c) 2002-2010 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_MCA_H_ -#define _MACHINE_MCA_H_ - -struct mca_record_header { - uint64_t rh_seqnr; /* Record id. */ - uint8_t rh_major; /* BCD (=02). */ - uint8_t rh_minor; /* BCD (=00). */ - uint8_t rh_error; /* Error severity. */ -#define MCA_RH_ERROR_RECOVERABLE 0 -#define MCA_RH_ERROR_FATAL 1 -#define MCA_RH_ERROR_CORRECTED 2 - uint8_t rh_flags; -#define MCA_RH_FLAGS_PLATFORM_ID 0x01 /* Platform_id present. */ -#define MCA_RH_FLAGS_TIME_STAMP 0x02 /* Timestamp invalid. */ - uint32_t rh_length; /* Size including header. */ - uint8_t rh_time[8]; -#define MCA_RH_TIME_SEC 0 -#define MCA_RH_TIME_MIN 1 -#define MCA_RH_TIME_HOUR 2 -#define MCA_RH_TIME_MDAY 4 -#define MCA_RH_TIME_MON 5 -#define MCA_RH_TIME_YEAR 6 -#define MCA_RH_TIME_CENT 7 - struct uuid rh_platform; -}; - -struct mca_section_header { - struct uuid sh_uuid; - uint8_t sh_major; /* BCD (=02). */ - uint8_t sh_minor; /* BCD (=00). */ - uint8_t sh_flags; -#define MCA_SH_FLAGS_CORRECTED 0x01 /* Error has been corrected. */ -#define MCA_SH_FLAGS_PROPAGATE 0x02 /* Possible propagation. */ -#define MCA_SH_FLAGS_RESET 0x04 /* Reset device before use. */ -#define MCA_SH_FLAGS_VALID 0x80 /* Flags are valid. */ - uint8_t __reserved; - uint32_t sh_length; /* Size including header. */ -}; - -struct mca_cpu_record { - uint64_t cpu_flags; -#define MCA_CPU_FLAGS_ERRMAP (1ULL << 0) -#define MCA_CPU_FLAGS_STATE (1ULL << 1) -#define MCA_CPU_FLAGS_CR_LID (1ULL << 2) -#define MCA_CPU_FLAGS_PSI_STRUCT (1ULL << 3) -#define MCA_CPU_FLAGS_CACHE(x) (((x) >> 4) & 15) -#define MCA_CPU_FLAGS_TLB(x) (((x) >> 8) & 15) -#define MCA_CPU_FLAGS_BUS(x) (((x) >> 12) & 15) -#define MCA_CPU_FLAGS_REG(x) (((x) >> 16) & 15) -#define MCA_CPU_FLAGS_MS(x) (((x) >> 20) & 15) -#define MCA_CPU_FLAGS_CPUID (1ULL << 24) - uint64_t cpu_errmap; - uint64_t cpu_state; - uint64_t cpu_cr_lid; - /* Nx cpu_mod (cache). */ - /* Nx cpu_mod (TLB). */ - /* Nx cpu_mod (bus). */ - /* Nx cpu_mod (reg). */ - /* Nx cpu_mod (MS). */ - /* cpu_cpuid. */ - /* cpu_psi. */ -}; - -struct mca_cpu_cpuid { - uint64_t cpuid[6]; -}; - -struct mca_cpu_mod { - uint64_t cpu_mod_flags; -#define MCA_CPU_MOD_FLAGS_INFO (1ULL << 0) -#define MCA_CPU_MOD_FLAGS_REQID (1ULL << 1) -#define MCA_CPU_MOD_FLAGS_RSPID (1ULL << 2) -#define MCA_CPU_MOD_FLAGS_TGTID (1ULL << 3) -#define MCA_CPU_MOD_FLAGS_IP (1ULL << 4) - uint64_t cpu_mod_info; - uint64_t cpu_mod_reqid; - uint64_t cpu_mod_rspid; - uint64_t cpu_mod_tgtid; - uint64_t cpu_mod_ip; -}; - -struct mca_cpu_psi { - uint64_t cpu_psi_flags; -#define MCA_CPU_PSI_FLAGS_STATE (1ULL << 0) -#define MCA_CPU_PSI_FLAGS_BR (1ULL << 1) -#define MCA_CPU_PSI_FLAGS_CR (1ULL << 2) -#define MCA_CPU_PSI_FLAGS_AR (1ULL << 3) -#define MCA_CPU_PSI_FLAGS_RR (1ULL << 4) -#define MCA_CPU_PSI_FLAGS_FR (1ULL << 5) - uint8_t cpu_psi_state[1024]; /* XXX variable? */ - uint64_t cpu_psi_br[8]; - uint64_t cpu_psi_cr[128]; /* XXX variable? */ - uint64_t cpu_psi_ar[128]; /* XXX variable? */ - uint64_t cpu_psi_rr[8]; - uint64_t cpu_psi_fr[256]; /* 16 bytes per register! */ -}; - -struct mca_mem_record { - uint64_t mem_flags; -#define MCA_MEM_FLAGS_STATUS (1ULL << 0) -#define MCA_MEM_FLAGS_ADDR (1ULL << 1) -#define MCA_MEM_FLAGS_ADDRMASK (1ULL << 2) -#define MCA_MEM_FLAGS_NODE (1ULL << 3) -#define MCA_MEM_FLAGS_CARD (1ULL << 4) -#define MCA_MEM_FLAGS_MODULE (1ULL << 5) -#define MCA_MEM_FLAGS_BANK (1ULL << 6) -#define MCA_MEM_FLAGS_DEVICE (1ULL << 7) -#define MCA_MEM_FLAGS_ROW (1ULL << 8) -#define MCA_MEM_FLAGS_COLUMN (1ULL << 9) -#define MCA_MEM_FLAGS_BITPOS (1ULL << 10) -#define MCA_MEM_FLAGS_REQID (1ULL << 11) -#define MCA_MEM_FLAGS_RSPID (1ULL << 12) -#define MCA_MEM_FLAGS_TGTID (1ULL << 13) -#define MCA_MEM_FLAGS_BUSDATA (1ULL << 14) -#define MCA_MEM_FLAGS_OEM_ID (1ULL << 15) -#define MCA_MEM_FLAGS_OEM_DATA (1ULL << 16) - uint64_t mem_status; - uint64_t mem_addr; - uint64_t mem_addrmask; - uint16_t mem_node; - uint16_t mem_card; - uint16_t mem_module; - uint16_t mem_bank; - uint16_t mem_device; - uint16_t mem_row; - uint16_t mem_column; - uint16_t mem_bitpos; - uint64_t mem_reqid; - uint64_t mem_rspid; - uint64_t mem_tgtid; - uint64_t mem_busdata; - struct uuid mem_oem_id; - uint16_t mem_oem_length; /* Size of OEM data. */ - /* N bytes of OEM platform data. */ -}; - -struct mca_pcibus_record { - uint64_t pcibus_flags; -#define MCA_PCIBUS_FLAGS_STATUS (1ULL << 0) -#define MCA_PCIBUS_FLAGS_ERROR (1ULL << 1) -#define MCA_PCIBUS_FLAGS_BUS (1ULL << 2) -#define MCA_PCIBUS_FLAGS_ADDR (1ULL << 3) -#define MCA_PCIBUS_FLAGS_DATA (1ULL << 4) -#define MCA_PCIBUS_FLAGS_CMD (1ULL << 5) -#define MCA_PCIBUS_FLAGS_REQID (1ULL << 6) -#define MCA_PCIBUS_FLAGS_RSPID (1ULL << 7) -#define MCA_PCIBUS_FLAGS_TGTID (1ULL << 8) -#define MCA_PCIBUS_FLAGS_OEM_ID (1ULL << 9) -#define MCA_PCIBUS_FLAGS_OEM_DATA (1ULL << 10) - uint64_t pcibus_status; - uint16_t pcibus_error; - uint16_t pcibus_bus; - uint32_t __reserved; - uint64_t pcibus_addr; - uint64_t pcibus_data; - uint64_t pcibus_cmd; - uint64_t pcibus_reqid; - uint64_t pcibus_rspid; - uint64_t pcibus_tgtid; - struct uuid pcibus_oem_id; - uint16_t pcibus_oem_length; /* Size of OEM data. */ - /* N bytes of OEM platform data. */ -}; - -struct mca_pcidev_record { - uint64_t pcidev_flags; -#define MCA_PCIDEV_FLAGS_STATUS (1ULL << 0) -#define MCA_PCIDEV_FLAGS_INFO (1ULL << 1) -#define MCA_PCIDEV_FLAGS_REG_MEM (1ULL << 2) -#define MCA_PCIDEV_FLAGS_REG_IO (1ULL << 3) -#define MCA_PCIDEV_FLAGS_REG_DATA (1ULL << 4) -#define MCA_PCIDEV_FLAGS_OEM_DATA (1ULL << 5) - uint64_t pcidev_status; - struct { - uint16_t info_vendor; - uint16_t info_device; - uint32_t info_ccfn; /* Class code & funct. nr. */ -#define MCA_PCIDEV_INFO_CLASS(x) ((x) & 0xffffff) -#define MCA_PCIDEV_INFO_FUNCTION(x) (((x) >> 24) & 0xff) - uint8_t info_slot; - uint8_t info_bus; - uint8_t info_segment; - uint8_t __res0; - uint32_t __res1; - } pcidev_info; - uint32_t pcidev_reg_mem; - uint32_t pcidev_reg_io; - /* Nx pcidev_reg. */ - /* M bytes of OEM platform data. */ -}; - -struct mca_pcidev_reg { - uint64_t pcidev_reg_addr; - uint64_t pcidev_reg_data; -}; - -#define MCA_UUID_CPU \ - {0xe429faf1,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}} -#define MCA_UUID_MEMORY \ - {0xe429faf2,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}} -#define MCA_UUID_SEL \ - {0xe429faf3,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}} -#define MCA_UUID_PCI_BUS \ - {0xe429faf4,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}} -#define MCA_UUID_SMBIOS \ - {0xe429faf5,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}} -#define MCA_UUID_PCI_DEV \ - {0xe429faf6,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}} -#define MCA_UUID_GENERIC \ - {0xe429faf7,0x3cb7,0x11d4,0xbc,0xa7,{0x00,0x80,0xc7,0x3c,0x88,0x81}} - -#ifdef _KERNEL - -void ia64_mca_init(void); -void ia64_mca_init_ap(void); -void ia64_mca_save_state(int); - -#endif /* _KERNEL */ - -#endif /* _MACHINE_MCA_H_ */ diff --git a/sys/ia64/include/md_var.h b/sys/ia64/include/md_var.h deleted file mode 100644 index b69b1af..0000000 --- a/sys/ia64/include/md_var.h +++ /dev/null @@ -1,123 +0,0 @@ -/*- - * Copyright (c) 1998 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_MD_VAR_H_ -#define _MACHINE_MD_VAR_H_ - -/* - * Miscellaneous machine-dependent declarations. - */ - -struct ia64_fdesc { - uint64_t func; - uint64_t gp; -}; - -#define FDESC_FUNC(fn) (((struct ia64_fdesc *) fn)->func) -#define FDESC_GP(fn) (((struct ia64_fdesc *) fn)->gp) - -/* Convenience macros to decompose CFM & ar.pfs. */ -#define IA64_CFM_SOF(x) ((x) & 0x7f) -#define IA64_CFM_SOL(x) (((x) >> 7) & 0x7f) -#define IA64_CFM_SOR(x) (((x) >> 14) & 0x0f) -#define IA64_CFM_RRB_GR(x) (((x) >> 18) & 0x7f) -#define IA64_CFM_RRB_FR(x) (((x) >> 25) & 0x7f) -#define IA64_CFM_RRB_PR(x) (((x) >> 32) & 0x3f) - -/* Convenience function (inline) to adjust backingstore pointers. */ -static __inline uint64_t -ia64_bsp_adjust(uint64_t bsp, int nslots) -{ - int bias = ((unsigned int)bsp & 0x1f8) >> 3; - nslots += (nslots + bias + 63*8) / 63 - 8; - return bsp + (nslots << 3); -} - -#ifdef _KERNEL - -struct _special; -struct pcpu; -struct thread; -struct trapframe; - -/* - * Return value from ia64_init. Describes stack to switch to. - */ -struct ia64_init_return { - uint64_t bspstore; - uint64_t sp; -}; - -extern uint64_t ia64_lapic_addr; -extern vm_paddr_t paddr_max; -extern u_int busdma_swi_pending; - -void *acpi_find_table(const char *sig); -void busdma_swi(void); -int copyout_regstack(struct thread *, uint64_t *, uint64_t *); -void cpu_mp_add(u_int, u_int, u_int); -void cpu_pcpu_setup(struct pcpu *, u_int, u_int); -int do_ast(struct trapframe *); -void ia32_trap(int, struct trapframe *); -int ia64_count_cpus(void); -int ia64_emulate(struct trapframe *, struct thread *); -int ia64_flush_dirty(struct thread *, struct _special *); -uint64_t ia64_get_hcdp(void); -int ia64_highfp_drop(struct thread *); -int ia64_highfp_enable(struct thread *, struct trapframe *); -int ia64_highfp_save(struct thread *); -int ia64_highfp_save_ipi(void); -struct ia64_init_return ia64_init(void); -u_int ia64_itc_freq(void); -int ia64_physmem_add(vm_paddr_t, vm_size_t); -void *ia64_physmem_alloc(vm_size_t, vm_size_t); -int ia64_physmem_delete(vm_paddr_t, vm_size_t); -int ia64_physmem_fini(void); -int ia64_physmem_init(void); -int ia64_physmem_track(vm_paddr_t, vm_size_t); -void ia64_probe_sapics(void); -void ia64_sync_icache(vm_offset_t, vm_size_t); -void *ia64_xtrace_alloc(void); -void ia64_xtrace_init_ap(void *); -void ia64_xtrace_init_bsp(void); -void ia64_xtrace_save(void); -void ia64_xtrace_stop(void); -void interrupt(struct trapframe *); -void map_gateway_page(void); -void map_pal_code(void); -void map_vhpt(uintptr_t); -void os_boot_rendez(void); -void os_mca(void); -int syscall(struct trapframe *); -void trap(int, struct trapframe *); -void trap_panic(int, struct trapframe *); -int unaligned_fixup(struct trapframe *, struct thread *); - -#endif /* _KERNEL */ - -#endif /* !_MACHINE_MD_VAR_H_ */ diff --git a/sys/ia64/include/memdev.h b/sys/ia64/include/memdev.h deleted file mode 100644 index 85fca07..0000000 --- a/sys/ia64/include/memdev.h +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * Copyright (c) 2004 Mark R V Murray - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_MEMDEV_H_ -#define _MACHINE_MEMDEV_H_ - -#define CDEV_MINOR_MEM 0 -#define CDEV_MINOR_KMEM 1 - -d_open_t memopen; -d_read_t memrw; -#define memioctl (d_ioctl_t *)NULL -d_mmap_t memmmap; - -#endif /* _MACHINE_MEMDEV_H_ */ diff --git a/sys/ia64/include/pal.h b/sys/ia64/include/pal.h deleted file mode 100644 index a8a5e90..0000000 --- a/sys/ia64/include/pal.h +++ /dev/null @@ -1,122 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PAL_H_ -#define _MACHINE_PAL_H_ - -/* - * Architected static calling convention procedures. - */ -#define PAL_CACHE_FLUSH 1 -#define PAL_CACHE_INFO 2 -#define PAL_CACHE_INIT 3 -#define PAL_CACHE_SUMMARY 4 -#define PAL_MEM_ATTRIB 5 -#define PAL_PTCE_INFO 6 -#define PAL_VM_INFO 7 -#define PAL_VM_SUMMARY 8 -#define PAL_BUS_GET_FEATURES 9 -#define PAL_BUS_SET_FEATURES 10 -#define PAL_DEBUG_INFO 11 -#define PAL_FIXED_ADDR 12 -#define PAL_FREQ_BASE 13 -#define PAL_FREQ_RATIOS 14 -#define PAL_PERF_MON_INFO 15 -#define PAL_PLATFORM_ADDR 16 -#define PAL_PROC_GET_FEATURE 17 -#define PAL_PROC_SET_FEATURE 18 -#define PAL_RSE_INFO 19 -#define PAL_VERSION 20 -#define PAL_MC_CLEAR_LOG 21 -#define PAL_MC_DRAIN 22 -#define PAL_MC_EXPECTED 23 -#define PAL_MC_DYNAMIC_STATE 24 -#define PAL_MC_ERROR_INFO 25 -#define PAL_MC_RESUME 26 -#define PAL_MC_REGISTER_MEM 27 -#define PAL_HALT 28 -#define PAL_HALT_LIGHT 29 -#define PAL_COPY_INFO 30 -#define PAL_CACHE_LINE_INIT 31 -#define PAL_PMI_ENTRYPOINT 32 -#define PAL_ENTER_IA_32_ENV 33 -#define PAL_VM_PAGE_SIZE 34 -#define PAL_TEST_INFO 37 -#define PAL_CACHE_PROT_INFO 38 -#define PAL_REGISTER_INFO 39 -#define PAL_PREFETCH_VISIBILITY 41 -#define PAL_LOGICAL_TO_PHYSICAL 42 -#define PAL_CACHE_SHARED_INFO 43 -#define PAL_PSTATE_INFO 44 -#define PAL_SHUTDOWN 45 -#define PAL_GET_HW_POLICY 48 -#define PAL_SET_HW_POLICY 49 - -/* - * Architected stacked calling convention procedures. - */ -#define PAL_COPY_PAL 256 -#define PAL_HALT_INFO 257 -#define PAL_TEST_PROC 258 -#define PAL_CACHE_READ 259 -#define PAL_CACHE_WRITE 260 -#define PAL_VM_TR_READ 261 -#define PAL_GET_PSTATE 262 -#define PAL_SET_PSTATE 263 -#define PAL_VP_CREATE 265 -#define PAL_VP_ENV_INFO 266 -#define PAL_VP_EXIT_ENV 267 -#define PAL_VP_INIT_ENV 268 -#define PAL_VP_REGISTER 269 -#define PAL_VP_RESTORE 270 -#define PAL_VP_SAVE 271 -#define PAL_VP_TERMINATE 272 -#define PAL_BRAND_INFO 274 -#define PAL_MC_ERROR_INJECT 276 -#define PAL_MEMORY_BUFFER 277 - -/* - * Default physical address of the Processor Interrupt Block (PIB). - * See also: IA-64 SDM, rev 1.1, volume 2, page 5-31. - */ -#define PAL_PIB_DEFAULT_ADDR 0x00000000FEE00000L - -struct ia64_pal_result { - int64_t pal_status; - uint64_t pal_result[3]; -}; - -struct ia64_pal_result ia64_pal_physical(u_long, u_long, u_long, u_long); - -struct ia64_pal_result ia64_call_pal_static(uint64_t proc, uint64_t arg1, - uint64_t arg2, uint64_t arg3); - -struct ia64_pal_result ia64_call_pal_stacked(uint64_t proc, uint64_t arg1, - uint64_t arg2, uint64_t arg3); - -#endif /* _MACHINE_PAL_H_ */ diff --git a/sys/ia64/include/param.h b/sys/ia64/include/param.h deleted file mode 100644 index a260a75..0000000 --- a/sys/ia64/include/param.h +++ /dev/null @@ -1,124 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: param.h,v 1.20 1997/09/19 13:52:53 leo Exp */ - -/*- - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah $Hdr: machparam.h 1.11 89/08/14$ - * - * @(#)param.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _IA64_INCLUDE_PARAM_H_ -#define _IA64_INCLUDE_PARAM_H_ - -/* - * Machine dependent constants for the IA64. - */ - -#include <machine/_align.h> - -#define __HAVE_ACPI -#define __PCI_REROUTE_INTERRUPT - -#ifndef MACHINE -#define MACHINE "ia64" -#endif -#ifndef MACHINE_ARCH -#define MACHINE_ARCH "ia64" -#endif -#ifndef MACHINE_ARCH32 -#define MACHINE_ARCH32 "i386" -#endif - -#if defined(SMP) || defined(KLD_MODULE) -#ifndef MAXCPU -#define MAXCPU 64 -#endif -#else -#define MAXCPU 1 -#endif - -#ifndef MAXMEMDOM -#define MAXMEMDOM 1 -#endif - -#define ALIGNBYTES _ALIGNBYTES -#define ALIGN(p) _ALIGN(p) -/* - * ALIGNED_POINTER is a boolean macro that checks whether an address - * is valid to fetch data elements of type t from on this architecture. - * This does not reflect the optimal alignment, just the possibility - * (within reasonable limits). - */ -#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0) - -/* - * CACHE_LINE_SIZE is the compile-time maximum cache line size for an - * architecture. It should be used with appropriate caution. - */ -#define CACHE_LINE_SHIFT 7 -#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) - -#ifndef LOG2_PAGE_SIZE -#define LOG2_PAGE_SIZE 13 /* 8K pages by default. */ -#endif -#define PAGE_SHIFT (LOG2_PAGE_SIZE) -#define PAGE_SIZE (1<<(LOG2_PAGE_SIZE)) -#define PAGE_MASK (PAGE_SIZE-1) -#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) - -#define MAXPAGESIZES 1 /* maximum number of supported page sizes */ - -#ifndef KSTACK_PAGES -#define KSTACK_PAGES 4 /* pages of kernel stack */ -#endif -#define KSTACK_GUARD_PAGES 0 /* pages of kstack guard; 0 disables */ - -/* The default size of identity mappings in region 6 & 7. */ -#ifndef LOG2_ID_PAGE_SIZE -#define LOG2_ID_PAGE_SIZE 16 -#endif - -/* - * Mach derived conversion macros - */ -#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) -#define trunc_page(x) ((unsigned long)(x) & ~(PAGE_MASK)) - -#define atop(x) ((unsigned long)(x) >> PAGE_SHIFT) -#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT) - -#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) - -#endif /* !_IA64_INCLUDE_PARAM_H_ */ diff --git a/sys/ia64/include/pc/display.h b/sys/ia64/include/pc/display.h deleted file mode 100644 index fad568c..0000000 --- a/sys/ia64/include/pc/display.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * IBM PC display definitions - * - * $FreeBSD$ - * from: i386/include/pc display.h,v 1.4 - */ - -/* Color attributes for foreground text */ - -#define FG_BLACK 0 -#define FG_BLUE 1 -#define FG_GREEN 2 -#define FG_CYAN 3 -#define FG_RED 4 -#define FG_MAGENTA 5 -#define FG_BROWN 6 -#define FG_LIGHTGREY 7 -#define FG_DARKGREY 8 -#define FG_LIGHTBLUE 9 -#define FG_LIGHTGREEN 10 -#define FG_LIGHTCYAN 11 -#define FG_LIGHTRED 12 -#define FG_LIGHTMAGENTA 13 -#define FG_YELLOW 14 -#define FG_WHITE 15 -#define FG_BLINK 0x80 - -/* Color attributes for text background */ - -#define BG_BLACK 0x00 -#define BG_BLUE 0x10 -#define BG_GREEN 0x20 -#define BG_CYAN 0x30 -#define BG_RED 0x40 -#define BG_MAGENTA 0x50 -#define BG_BROWN 0x60 -#define BG_LIGHTGREY 0x70 - -/* Monochrome attributes for foreground text */ - -#define FG_UNDERLINE 0x01 -#define FG_INTENSE 0x08 - -/* Monochrome attributes for text background */ - -#define BG_INTENSE 0x10 diff --git a/sys/ia64/include/pcb.h b/sys/ia64/include/pcb.h deleted file mode 100644 index dac7169..0000000 --- a/sys/ia64/include/pcb.h +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * Copyright (c) 2003,2004 Marcel Moolenaar - * Copyright (c) 2000 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PCB_H_ -#define _MACHINE_PCB_H_ - -#ifndef _MACHINE_REGSET_H_ -#include <machine/_regset.h> -#endif - -/* - * PCB: process control block - */ -struct pmap; -struct pcb { - struct _special pcb_special; - struct _callee_saved pcb_preserved; - struct _callee_saved_fp pcb_preserved_fp; - struct _high_fp pcb_high_fp; - struct pcpu *pcb_fpcpu; - struct pmap *pcb_current_pmap; - - uint64_t pcb_onfault; /* for copy faults */ - - /* IA32 specific registers. */ - uint64_t pcb_ia32_cflg; - uint64_t pcb_ia32_eflag; - uint64_t pcb_ia32_fcr; - uint64_t pcb_ia32_fdr; - uint64_t pcb_ia32_fir; - uint64_t pcb_ia32_fsr; -}; - -#ifdef _KERNEL - -#define savectx(p) swapctx(p, NULL) - -struct trapframe; - -void makectx(struct trapframe *, struct pcb *); -void restorectx(struct pcb *) __dead2; -int swapctx(struct pcb *old, struct pcb *new) __returns_twice; - -void ia32_restorectx(struct pcb *); -void ia32_savectx(struct pcb *) __returns_twice; - -#endif - -#endif /* _MACHINE_PCB_H_ */ diff --git a/sys/ia64/include/pci_cfgreg.h b/sys/ia64/include/pci_cfgreg.h deleted file mode 100644 index a0bc6e1..0000000 --- a/sys/ia64/include/pci_cfgreg.h +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * Copyright (c) 2010 Marcel Moolenaar <marcel@FreeBSD.org> - * Copyright (c) 1997, Stefan Esser <se@freebsd.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PCI_CFGREG_H_ -#define _MACHINE_PCI_CFGREG_H_ - -int pci_cfgregopen(void); -uint32_t pci_cfgregread(int bus, int slot, int func, int reg, int len); -void pci_cfgregwrite(int bus, int slot, int func, int reg, uint32_t data, - int bytes); - -#endif /* _MACHINE_PCI_CFGREG_H_ */ diff --git a/sys/ia64/include/pcpu.h b/sys/ia64/include/pcpu.h deleted file mode 100644 index 4c3f5e8..0000000 --- a/sys/ia64/include/pcpu.h +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org> - * Copyright (c) Peter Wemm <peter@netplex.com.au> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PCPU_H_ -#define _MACHINE_PCPU_H_ - -#include <sys/sysctl.h> -#include <machine/pcb.h> - -struct pcpu_stats { - u_long pcs_nasts; /* IPI_AST counter. */ - u_long pcs_nclks; /* Clock interrupt counter. */ - u_long pcs_nextints; /* ExtINT counter. */ - u_long pcs_nhardclocks; /* IPI_HARDCLOCK counter. */ - u_long pcs_nhighfps; /* IPI_HIGH_FP counter. */ - u_long pcs_nhwints; /* Hardware int. counter. */ - u_long pcs_npreempts; /* IPI_PREEMPT counter. */ - u_long pcs_nrdvs; /* IPI_RENDEZVOUS counter. */ - u_long pcs_nstops; /* IPI_STOP counter. */ - u_long pcs_nstrays; /* Stray interrupt counter. */ -}; - -struct pcpu_md { - struct pcb pcb; /* Used by IPI_STOP */ - struct pmap *current_pmap; /* active pmap */ - vm_offset_t vhpt; /* Address of VHPT */ - uint64_t lid; /* local CPU ID */ - uint64_t clock; /* Clock counter. */ - uint64_t clock_load; /* Clock reload value. */ - uint32_t clock_mode; /* Clock ET mode */ - uint32_t awake:1; /* CPU is awake? */ - struct pcpu_stats stats; /* Interrupt stats. */ - void *xtrace_buffer; - uint64_t xtrace_tail; -#ifdef _KERNEL - struct sysctl_ctx_list sysctl_ctx; - struct sysctl_oid *sysctl_tree; -#endif -}; - -#define PCPU_MD_FIELDS \ - uint32_t pc_acpi_id; /* ACPI CPU id. */ \ - struct pcpu_md pc_md; /* MD fields. */ \ - char __pad[10*128] - -#ifdef _KERNEL - -struct pcpu; - -register struct pcpu * volatile pcpup __asm__("r13"); - -static __inline __pure2 struct thread * -__curthread(void) -{ - struct thread *td; - - __asm("ld8.acq %0=[r13]" : "=r"(td)); - return (td); -} -#define curthread (__curthread()) - -#define PCPU_GET(member) (pcpup->pc_ ## member) - -/* - * XXX The implementation of this operation should be made atomic - * with respect to preemption. - */ -#define PCPU_ADD(member, value) (pcpup->pc_ ## member += (value)) -#define PCPU_INC(member) PCPU_ADD(member, 1) -#define PCPU_PTR(member) (&pcpup->pc_ ## member) -#define PCPU_SET(member,value) (pcpup->pc_ ## member = (value)) - -#endif /* _KERNEL */ - -#endif /* !_MACHINE_PCPU_H_ */ diff --git a/sys/ia64/include/pmap.h b/sys/ia64/include/pmap.h deleted file mode 100644 index e9c8952..0000000 --- a/sys/ia64/include/pmap.h +++ /dev/null @@ -1,143 +0,0 @@ -/*- - * Copyright (c) 1991 Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and William Jolitz of UUNET Technologies Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Derived from hp300 version by Mike Hibler, this version by William - * Jolitz uses a recursive map [a pde points to the page directory] to - * map the page tables using the pagetables themselves. This is done to - * reduce the impact on kernel virtual memory for lots of sparse address - * space, and to reduce the cost of memory to each process. - * - * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 - * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 - * from: i386 pmap.h,v 1.54 1997/11/20 19:30:35 bde Exp - * $FreeBSD$ - */ - -#ifndef _MACHINE_PMAP_H_ -#define _MACHINE_PMAP_H_ - -#include <sys/queue.h> -#include <sys/_lock.h> -#include <sys/_mutex.h> -#include <machine/atomic.h> -#include <machine/pte.h> -#include <machine/vmparam.h> - -#ifdef _KERNEL - -#define MAXKPT (PAGE_SIZE/sizeof(vm_offset_t)) - -#define vtophys(va) pmap_kextract((vm_offset_t)(va)) - -#endif /* _KERNEL */ - -/* - * Pmap stuff - */ -struct pv_entry; -struct pv_chunk; - -struct md_page { - TAILQ_HEAD(,pv_entry) pv_list; - vm_memattr_t memattr; -}; - -struct pmap { - struct mtx pm_mtx; - TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ - uint32_t pm_rid[IA64_VM_MINKERN_REGION]; - struct pmap_statistics pm_stats; /* pmap statistics */ -}; - -typedef struct pmap *pmap_t; - -#ifdef _KERNEL -extern struct pmap kernel_pmap_store; -#define kernel_pmap (&kernel_pmap_store) - -#define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx) -#define PMAP_LOCK_ASSERT(pmap, type) \ - mtx_assert(&(pmap)->pm_mtx, (type)) -#define PMAP_LOCK_DESTROY(pmap) mtx_destroy(&(pmap)->pm_mtx) -#define PMAP_LOCK_INIT(pmap) mtx_init(&(pmap)->pm_mtx, "pmap", \ - NULL, MTX_DEF) -#define PMAP_LOCKED(pmap) mtx_owned(&(pmap)->pm_mtx) -#define PMAP_MTX(pmap) (&(pmap)->pm_mtx) -#define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx) -#define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx) -#endif - -/* - * For each vm_page_t, there is a list of all currently valid virtual - * mappings of that page. An entry is a pv_entry_t, the list is pv_list. - */ -typedef struct pv_entry { - vm_offset_t pv_va; /* virtual address for mapping */ - TAILQ_ENTRY(pv_entry) pv_list; -} *pv_entry_t; - -#ifdef _KERNEL - -extern vm_paddr_t phys_avail[]; -extern vm_offset_t virtual_avail; -extern vm_offset_t virtual_end; - -extern uint64_t pmap_vhpt_base[]; -extern int pmap_vhpt_log2size; - -#define pmap_mapbios(pa,sz) pmap_mapdev_attr(pa,sz,VM_MEMATTR_UNCACHEABLE) -#define pmap_mapdev(pa,sz) pmap_mapdev_attr(pa,sz,VM_MEMATTR_UNCACHEABLE) -#define pmap_unmapbios(va,sz) pmap_unmapdev(va,sz) - -#define pmap_page_get_memattr(m) ((m)->md.memattr) -#define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) -#define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0) - -void pmap_kenter(vm_offset_t va, vm_paddr_t pa); -vm_paddr_t pmap_kextract(vm_offset_t va); -void pmap_kremove(vm_offset_t); -void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t); -void pmap_page_set_memattr(vm_page_t, vm_memattr_t); -void pmap_unmapdev(vm_offset_t, vm_size_t); - -/* Machine-architecture private */ -vm_offset_t pmap_alloc_vhpt(void); -void pmap_bootstrap(void); -void pmap_invalidate_all(void); -vm_offset_t pmap_mapdev_priv(vm_paddr_t, vm_size_t, vm_memattr_t); -vm_offset_t pmap_page_to_va(vm_page_t); -vm_offset_t pmap_steal_memory(vm_size_t); -struct pmap *pmap_switch(struct pmap *pmap); - -#endif /* _KERNEL */ - -#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/ia64/include/pmc_mdep.h b/sys/ia64/include/pmc_mdep.h deleted file mode 100644 index 7ced0b9..0000000 --- a/sys/ia64/include/pmc_mdep.h +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * This file is in the public domain. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PMC_MDEP_H_ -#define _MACHINE_PMC_MDEP_H_ - -union pmc_md_op_pmcallocate { - uint64_t __pad[4]; -}; - -/* Logging */ -#define PMCLOG_READADDR PMCLOG_READ64 -#define PMCLOG_EMITADDR PMCLOG_EMIT64 - -#if _KERNEL -union pmc_md_pmc { -}; - -#define PMC_TRAPFRAME_TO_PC(TF) (0) /* Stubs */ -#define PMC_TRAPFRAME_TO_FP(TF) (0) -#define PMC_TRAPFRAME_TO_SP(TF) (0) - -#endif - -#endif /* !_MACHINE_PMC_MDEP_H_ */ diff --git a/sys/ia64/include/proc.h b/sys/ia64/include/proc.h deleted file mode 100644 index b046872..0000000 --- a/sys/ia64/include/proc.h +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * Copyright (c) 2003 The FreeBSD Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PROC_H_ -#define _MACHINE_PROC_H_ - -struct mdthread { - int md_spinlock_count; /* (k) */ - int md_saved_intr; /* (k) */ -}; - -struct mdproc { - int __dummy; /* Avoid having an empty struct. */ -}; - -#define KINFO_PROC_SIZE 1088 -#define KINFO_PROC32_SIZE 768 - -#ifdef _KERNEL -struct syscall_args { - u_int code; - int narg; - struct sysent *callp; - register_t *args; - register_t args32[8]; -}; -#endif - -#endif /* !_MACHINE_PROC_H_ */ diff --git a/sys/ia64/include/profile.h b/sys/ia64/include/profile.h deleted file mode 100644 index cdf1434..0000000 --- a/sys/ia64/include/profile.h +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * Copyright (c) 2004 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PROFILE_H_ -#define _MACHINE_PROFILE_H_ - -#define _MCOUNT_DECL void __mcount -#define MCOUNT - -#define FUNCTION_ALIGNMENT 16 - -typedef unsigned long fptrdiff_t; - -#ifdef _KERNEL -/* - * The following two macros do splhigh and splx respectively. - */ -#define MCOUNT_ENTER(s) s = intr_disable() -#define MCOUNT_EXIT(s) intr_restore(s) -#define MCOUNT_DECL(s) register_t s; - -void bintr(void); -void btrap(void); -void eintr(void); -void user(void); - -#define MCOUNT_FROMPC_USER(pc) \ - ((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? ~0UL : pc) - -#define MCOUNT_FROMPC_INTR(pc) (~0UL) - -_MCOUNT_DECL(uintfptr_t, uintfptr_t); - -#else /* !_KERNEL */ - -typedef unsigned long uintfptr_t; - -#endif - -#endif /* _MACHINE_PROFILE_H_ */ diff --git a/sys/ia64/include/pte.h b/sys/ia64/include/pte.h deleted file mode 100644 index f57cb4d..0000000 --- a/sys/ia64/include/pte.h +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PTE_H_ -#define _MACHINE_PTE_H_ - -#define PTE_PRESENT 0x0000000000000001 -#define PTE__RV1_ 0x0000000000000002 -#define PTE_MA_MASK 0x000000000000001C -#define PTE_MA_WB 0x0000000000000000 -#define PTE_MA_UC 0x0000000000000010 -#define PTE_MA_UCE 0x0000000000000014 -#define PTE_MA_WC 0x0000000000000018 -#define PTE_MA_NATPAGE 0x000000000000001C -#define PTE_ACCESSED 0x0000000000000020 -#define PTE_DIRTY 0x0000000000000040 -#define PTE_PL_MASK 0x0000000000000180 -#define PTE_PL_KERN 0x0000000000000000 -#define PTE_PL_USER 0x0000000000000180 -#define PTE_AR_MASK 0x0000000000000E00 -#define PTE_AR_R 0x0000000000000000 -#define PTE_AR_RX 0x0000000000000200 -#define PTE_AR_RW 0x0000000000000400 -#define PTE_AR_RWX 0x0000000000000600 -#define PTE_AR_R_RW 0x0000000000000800 -#define PTE_AR_RX_RWX 0x0000000000000A00 -#define PTE_AR_RWX_RW 0x0000000000000C00 -#define PTE_AR_X_RX 0x0000000000000E00 -#define PTE_PPN_MASK 0x0003FFFFFFFFF000 -#define PTE__RV2_ 0x000C000000000000 -#define PTE_ED 0x0010000000000000 -#define PTE_IG_MASK 0xFFE0000000000000 -#define PTE_WIRED 0x0020000000000000 -#define PTE_MANAGED 0x0040000000000000 -#define PTE_PROT_MASK 0x0700000000000000 - -#define ITIR__RV1_ 0x0000000000000003 -#define ITIR_PS_MASK 0x00000000000000FC -#define ITIR_KEY_MASK 0x00000000FFFFFF00 -#define ITIR__RV2_ 0xFFFFFFFF00000000 - -#ifndef LOCORE - -typedef uint64_t pt_entry_t; - -static __inline pt_entry_t -pte_atomic_clear(pt_entry_t *ptep, uint64_t val) -{ - return (atomic_clear_64(ptep, val)); -} - -static __inline pt_entry_t -pte_atomic_set(pt_entry_t *ptep, uint64_t val) -{ - return (atomic_set_64(ptep, val)); -} - -/* - * A long-format VHPT entry. - */ -struct ia64_lpte { - pt_entry_t pte; - uint64_t itir; - uint64_t tag; /* includes ti */ - uint64_t chain; /* pa of collision chain */ -}; - -/* - * Layout of rr[x]. - */ -struct ia64_rr { - uint64_t rr_ve :1; /* bit 0 */ - uint64_t __rv1__ :1; /* bit 1 */ - uint64_t rr_ps :6; /* bits 2..7 */ - uint64_t rr_rid :24; /* bits 8..31 */ - uint64_t __rv2__ :32; /* bits 32..63 */ -}; - -#endif /* !LOCORE */ - -#endif /* !_MACHINE_PTE_H_ */ diff --git a/sys/ia64/include/ptrace.h b/sys/ia64/include/ptrace.h deleted file mode 100644 index d73077d..0000000 --- a/sys/ia64/include/ptrace.h +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ptrace.h 8.1 (Berkeley) 6/11/93 - * $FreeBSD$ - */ - -#ifndef _MACHINE_PTRACE_H_ -#define _MACHINE_PTRACE_H_ - -#define __HAVE_PTRACE_MACHDEP - -/* Fetch/store dirty registers on the kernel stack. */ -#define PT_GETKSTACK (PT_FIRSTMACH + 0) -#define PT_SETKSTACK (PT_FIRSTMACH + 1) - -#endif /* _MACHINE_PTRACE_H_ */ diff --git a/sys/ia64/include/reg.h b/sys/ia64/include/reg.h deleted file mode 100644 index af6489d..0000000 --- a/sys/ia64/include/reg.h +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_REG_H_ -#define _MACHINE_REG_H_ - -#include <machine/_regset.h> - -struct reg32 { - unsigned int r_fs; - unsigned int r_es; - unsigned int r_ds; - unsigned int r_edi; - unsigned int r_esi; - unsigned int r_ebp; - unsigned int r_isp; - unsigned int r_ebx; - unsigned int r_edx; - unsigned int r_ecx; - unsigned int r_eax; - unsigned int r_trapno; - unsigned int r_err; - unsigned int r_eip; - unsigned int r_cs; - unsigned int r_eflags; - unsigned int r_esp; - unsigned int r_ss; - unsigned int r_gs; -}; - -struct reg { - struct _special r_special; - struct _callee_saved r_preserved; - struct _caller_saved r_scratch; -}; - -struct fpreg32 { - unsigned int fpr_env[7]; - unsigned char fpr_acc[8][10]; - unsigned int fpr_ex_sw; - unsigned char fpr_pad[64]; -}; - -struct fpreg { - struct _callee_saved_fp fpr_preserved; - struct _caller_saved_fp fpr_scratch; - struct _high_fp fpr_high; -}; - -struct dbreg32 { - unsigned int dr[8]; -}; - -struct dbreg { - unsigned long dbr_data[8]; - unsigned long dbr_inst[8]; -}; - -#ifdef _KERNEL -struct thread; - -/* XXX these interfaces are MI, so they should be declared in a MI place. */ -int fill_regs(struct thread *, struct reg *); -int set_regs(struct thread *, struct reg *); -int fill_fpregs(struct thread *, struct fpreg *); -int set_fpregs(struct thread *, struct fpreg *); -int fill_dbregs(struct thread *, struct dbreg *); -int set_dbregs(struct thread *, struct dbreg *); -#ifdef COMPAT_FREEBSD32 -int fill_regs32(struct thread *, struct reg32 *); -int set_regs32(struct thread *, struct reg32 *); -int fill_fpregs32(struct thread *, struct fpreg32 *); -int set_fpregs32(struct thread *, struct fpreg32 *); -int fill_dbregs32(struct thread *, struct dbreg32 *); -int set_dbregs32(struct thread *, struct dbreg32 *); -#endif -#endif - -#endif /* _MACHINE_REG_H_ */ diff --git a/sys/ia64/include/reloc.h b/sys/ia64/include/reloc.h deleted file mode 100644 index 0e4155d..0000000 --- a/sys/ia64/include/reloc.h +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ diff --git a/sys/ia64/include/resource.h b/sys/ia64/include/resource.h deleted file mode 100644 index edde5eb..0000000 --- a/sys/ia64/include/resource.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $FreeBSD$ */ -/*- - * Copyright 1998 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that both the above copyright notice and this - * permission notice appear in all copies, that both the above - * copyright notice and this permission notice appear in all - * supporting documentation, and that the name of M.I.T. not be used - * in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. M.I.T. makes - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT - * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_RESOURCE_H_ -#define _MACHINE_RESOURCE_H_ 1 - -/* - * Definitions of resource types for Intel Architecture machines - * with support for legacy ISA devices and drivers. - */ - -#define SYS_RES_IRQ 1 /* interrupt lines */ -#define SYS_RES_DRQ 2 /* isa dma lines */ -#define SYS_RES_MEMORY 3 /* i/o memory */ -#define SYS_RES_IOPORT 4 /* i/o ports */ - -#endif /* !_MACHINE_RESOURCE_H_ */ diff --git a/sys/ia64/include/runq.h b/sys/ia64/include/runq.h deleted file mode 100644 index c2486d1..0000000 --- a/sys/ia64/include/runq.h +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_RUNQ_H_ -#define _MACHINE_RUNQ_H_ - -#define RQB_LEN (1UL) /* Number of priority status words. */ -#define RQB_L2BPW (6UL) /* Log2(sizeof(rqb_word_t) * NBBY)). */ -#define RQB_BPW (1UL<<RQB_L2BPW) /* Bits in an rqb_word_t. */ - -#define RQB_BIT(pri) (1UL << ((pri) & (RQB_BPW - 1))) -#define RQB_WORD(pri) ((pri) >> RQB_L2BPW) - -#define RQB_FFS(word) (__ffsl(word) - 1) - -/* - * Type of run queue status word. - */ -typedef uint64_t rqb_word_t; - -static __inline uint64_t -__popcnt(uint64_t bits) -{ - uint64_t result; - - __asm __volatile("popcnt %0=%1" : "=r" (result) : "r" (bits)); - return result; -} - - -static __inline int -__ffsl(u_long mask) -{ - - if (__predict_false(mask == 0ul)) - return (0); - return (__popcnt(mask ^ (mask - 1))); -} - -#endif diff --git a/sys/ia64/include/sal.h b/sys/ia64/include/sal.h deleted file mode 100644 index 4857464..0000000 --- a/sys/ia64/include/sal.h +++ /dev/null @@ -1,141 +0,0 @@ -/*- - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_SAL_H_ -#define _MACHINE_SAL_H_ - -struct sal_system_table { - char sal_signature[4]; -#define SAL_SIGNATURE "SST_" - uint32_t sal_length; - uint8_t sal_rev[2]; - uint16_t sal_entry_count; - uint8_t sal_checksum; - uint8_t sal_reserved1[7]; - uint8_t sal_a_version[2]; - uint8_t sal_b_version[2]; - char sal_oem_id[32]; - char sal_product_id[32]; - uint8_t sal_reserved2[8]; -}; - -struct sal_entrypoint_descriptor { - uint8_t sale_type; /* == 0 */ - uint8_t sale_reserved1[7]; - uint64_t sale_pal_proc; - uint64_t sale_sal_proc; - uint64_t sale_sal_gp; - uint8_t sale_reserved2[16]; -}; - -struct sal_memory_descriptor { - uint8_t sale_type; /* == 1 */ - uint8_t sale_need_virtual; - uint8_t sale_current_attribute; - uint8_t sale_access_rights; - uint8_t sale_supported_attributes; - uint8_t sale_reserved1; - uint8_t sale_memory_type[2]; - uint64_t sale_physical_address; - uint32_t sale_length; - uint8_t sale_reserved2[12]; -}; - -struct sal_platform_descriptor { - uint8_t sale_type; /* == 2 */ - uint8_t sale_features; - uint8_t sale_reserved[14]; -}; - -struct sal_tr_descriptor { - uint8_t sale_type; /* == 3 */ - uint8_t sale_register_type; - uint8_t sale_register_number; - uint8_t sale_reserved1[5]; - uint64_t sale_virtual_address; - uint64_t sale_page_size; - uint8_t sale_reserved2[8]; -}; - -struct sal_ptc_cache_descriptor { - uint8_t sale_type; /* == 4 */ - uint8_t sale_reserved[3]; - uint32_t sale_domains; - uint64_t sale_address; -}; - -struct sal_ap_wakeup_descriptor { - uint8_t sale_type; /* == 5 */ - uint8_t sale_mechanism; - uint8_t sale_reserved[6]; - uint64_t sale_vector; -}; - -/* - * SAL Procedure numbers. - */ - -#define SAL_SET_VECTORS 0x01000000 -#define SAL_GET_STATE_INFO 0x01000001 -#define SAL_GET_STATE_INFO_SIZE 0x01000002 -#define SAL_CLEAR_STATE_INFO 0x01000003 -#define SAL_MC_RENDEZ 0x01000004 -#define SAL_MC_SET_PARAMS 0x01000005 -#define SAL_REGISTER_PHYSICAL_ADDR 0x01000006 -#define SAL_CACHE_FLUSH 0x01000008 -#define SAL_CACHE_INIT 0x01000009 -#define SAL_PCI_CONFIG_READ 0x01000010 -#define SAL_PCI_CONFIG_WRITE 0x01000011 -#define SAL_FREQ_BASE 0x01000012 -#define SAL_UPDATE_PAL 0x01000020 - -/* SAL_SET_VECTORS event handler types */ -#define SAL_OS_MCA 0 -#define SAL_OS_INIT 1 -#define SAL_OS_BOOT_RENDEZ 2 - -/* SAL_GET_STATE_INFO, SAL_GET_STATE_INFO_SIZE types */ -#define SAL_INFO_MCA 0 -#define SAL_INFO_INIT 1 -#define SAL_INFO_CMC 2 -#define SAL_INFO_CPE 3 -#define SAL_INFO_TYPES 4 /* number of types we know about */ - -struct ia64_sal_result { - int64_t sal_status; - uint64_t sal_result[3]; -}; - -typedef struct ia64_sal_result sal_entry_t(uint64_t, uint64_t, uint64_t, - uint64_t, uint64_t, uint64_t, uint64_t, uint64_t); - -extern sal_entry_t *ia64_sal_entry; - -extern void ia64_sal_init(void); - -#endif /* _MACHINE_SAL_H_ */ diff --git a/sys/ia64/include/setjmp.h b/sys/ia64/include/setjmp.h deleted file mode 100644 index 0e7641e..0000000 --- a/sys/ia64/include/setjmp.h +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * Copyright (c) 2000 - * Intel Corporation. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by Intel Corporation and - * its contributors. - * - * 4. Neither the name of Intel Corporation or its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_SETJMP_H_ -#define _MACHINE_SETJMP_H_ - -#include <sys/cdefs.h> - -#if __BSD_VISIBLE -#define JMPBUF_ADDR_OF(buf, item) ((unsigned long)((char *)buf + item)) - -#define J_UNAT 0 -#define J_NATS 0x8 -#define J_PFS 0x10 -#define J_BSP 0x18 -#define J_RNAT 0x20 -#define J_PREDS 0x28 -#define J_LC 0x30 -#define J_R4 0x38 -#define J_R5 0x40 -#define J_R6 0x48 -#define J_R7 0x50 -#define J_SP 0x58 -#define J_F2 0x60 -#define J_F3 0x70 -#define J_F4 0x80 -#define J_F5 0x90 -#define J_F16 0xa0 -#define J_F17 0xb0 -#define J_F18 0xc0 -#define J_F19 0xd0 -#define J_F20 0xe0 -#define J_F21 0xf0 -#define J_F22 0x100 -#define J_F23 0x110 -#define J_F24 0x120 -#define J_F25 0x130 -#define J_F26 0x140 -#define J_F27 0x150 -#define J_F28 0x160 -#define J_F29 0x170 -#define J_F30 0x180 -#define J_F31 0x190 -#define J_FPSR 0x1a0 -#define J_B0 0x1a8 -#define J_B1 0x1b0 -#define J_B2 0x1b8 -#define J_B3 0x1c0 -#define J_B4 0x1c8 -#define J_B5 0x1d0 -#define J_SIGMASK 0x1d8 -#define J_SIGSET 0x1e0 -#endif /* __BSD_VISIBLE */ - -#define _JBLEN 0x20 /* Size in long doubles */ - -/* - * XXX this check is wrong, since LOCORE is in the application namespace and - * applications shouldn't be able to affect the implementation. One workaround - * would be to only check LOCORE if _KERNEL is defined, but unfortunately - * LOCORE is used outside of the kernel. The best solution would be to rename - * LOCORE to _LOCORE, so that it can be used in userland to safely affect the - * implementation. - */ -#ifndef LOCORE - -/* - * jmp_buf and sigjmp_buf are encapsulated in different structs to force - * compile-time diagnostics for mismatches. The structs are the same - * internally to avoid some run-time errors for mismatches. - */ -#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE -struct _sigjmp_buf { - long double buf[_JBLEN]; -}; -typedef struct _sigjmp_buf sigjmp_buf[1]; -#endif - -struct _jmp_buf { - long double buf[_JBLEN]; -}; -typedef struct _jmp_buf jmp_buf[1]; - -#ifdef _KERNEL -#ifdef CTASSERT -CTASSERT(sizeof(struct _jmp_buf) == 512); -#endif -#endif - -#endif /* !LOCORE */ - -#endif /* !_MACHINE_SETJMP_H_ */ diff --git a/sys/ia64/include/sf_buf.h b/sys/ia64/include/sf_buf.h deleted file mode 100644 index 44d0109..0000000 --- a/sys/ia64/include/sf_buf.h +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_SF_BUF_H_ -#define _MACHINE_SF_BUF_H_ - -#include <vm/vm.h> -#include <vm/vm_param.h> -#include <vm/vm_page.h> - -/* - * On this machine, the only purpose for which sf_buf is used is to implement - * an opaque pointer required by the machine-independent parts of the kernel. - * That pointer references the vm_page that is "mapped" by the sf_buf. The - * actual mapping is provided by the direct virtual-to-physical mapping. - */ -struct sf_buf; - -static inline struct sf_buf * -sf_buf_alloc(struct vm_page *m, int pri) -{ - - return ((struct sf_buf *)m); -} - -static inline void -sf_buf_free(struct sf_buf *sf) -{ -} - -static __inline vm_page_t -sf_buf_page(struct sf_buf *sf) -{ - - return ((vm_page_t)sf); -} - -static __inline vm_offset_t -sf_buf_kva(struct sf_buf *sf) -{ - vm_page_t m; - - m = sf_buf_page(sf); - return (pmap_page_to_va(m)); -} - -#endif /* !_MACHINE_SF_BUF_H_ */ diff --git a/sys/ia64/include/sigframe.h b/sys/ia64/include/sigframe.h deleted file mode 100644 index d0e886e..0000000 --- a/sys/ia64/include/sigframe.h +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * Copyright (c) 1999 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_SIGFRAME_H_ -#define _MACHINE_SIGFRAME_H_ 1 - -struct sigframe { - ucontext_t sf_uc; - siginfo_t sf_si; -}; - -#endif /* _MACHINE_SIGFRAME_H_ */ diff --git a/sys/ia64/include/signal.h b/sys/ia64/include/signal.h deleted file mode 100644 index d99013c..0000000 --- a/sys/ia64/include/signal.h +++ /dev/null @@ -1,81 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: signal.h,v 1.3 1997/04/06 08:47:43 cgd Exp */ - -/*- - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 the - * rights to redistribute these changes. - */ - -#ifndef _MACHINE_SIGNAL_H_ -#define _MACHINE_SIGNAL_H_ - -#include <sys/cdefs.h> -#include <sys/_sigset.h> - -typedef long sig_atomic_t; - -#if __BSD_VISIBLE -/* portable macros for SIGFPE/ARITHTRAP */ -#define FPE_INTOVF 1 /* integer overflow */ -#define FPE_INTDIV 2 /* integer divide by zero */ -#define FPE_FLTDIV 3 /* floating point divide by zero */ -#define FPE_FLTOVF 4 /* floating point overflow */ -#define FPE_FLTUND 5 /* floating point underflow */ -#define FPE_FLTRES 6 /* floating point inexact result */ -#define FPE_FLTINV 7 /* invalid floating point operation */ -#define FPE_FLTSUB 8 /* subscript out of range */ - -#define BUS_SEGM_FAULT 30 /* segment protection base */ -#endif - -/* - * Information pushed on stack when a signal is delivered. - * This is used by the kernel to restore state following - * execution of the signal handler. It is also made available - * to the handler to allow it to restore state properly if - * a non-standard exit is performed. - */ - -#if __BSD_VISIBLE -#include <machine/_regset.h> - -/* - * The sequence of the fields should match those in - * mcontext_t. Keep them in sync! - */ -struct sigcontext { - struct __sigset sc_mask; /* signal mask to restore */ - unsigned long sc_onstack; - unsigned long sc_flags; - struct _special sc_special; - struct _callee_saved sc_preserved; - struct _callee_saved_fp sc_preserved_fp; - struct _caller_saved sc_scratch; - struct _caller_saved_fp sc_scratch_fp; - struct _high_fp sc_high_fp; -}; -#endif /* __BSD_VISIBLE */ - -#endif /* !_MACHINE_SIGNAL_H_*/ diff --git a/sys/ia64/include/smp.h b/sys/ia64/include/smp.h deleted file mode 100644 index 1623609..0000000 --- a/sys/ia64/include/smp.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $FreeBSD$ - */ -#ifndef _MACHINE_SMP_H_ -#define _MACHINE_SMP_H_ - -#ifdef _KERNEL - -#define IPI_AST ia64_ipi_ast -#define IPI_HARDCLOCK ia64_ipi_hardclock -#define IPI_PREEMPT ia64_ipi_preempt -#define IPI_RENDEZVOUS ia64_ipi_rndzvs -#define IPI_STOP ia64_ipi_stop -#define IPI_STOP_HARD ia64_ipi_nmi - -#ifndef LOCORE - -#include <sys/_cpuset.h> - -struct pcpu; - -struct ia64_ap_state { - uint64_t as_trace; - uint64_t as_pgtbl_pte; - uint64_t as_pgtbl_itir; - uint64_t as_text_va; - uint64_t as_text_pte; - uint64_t as_text_itir; - uint64_t as_data_va; - uint64_t as_data_pte; - uint64_t as_data_itir; - void *as_kstack; - void *as_kstack_top; - struct pcpu *as_pcpu; - void *as_xtrace_buffer; - volatile int as_delay; - volatile u_int as_awake; - volatile u_int as_spin; -}; - -extern int ia64_ipi_ast; -extern int ia64_ipi_hardclock; -extern int ia64_ipi_highfp; -extern int ia64_ipi_nmi; -extern int ia64_ipi_preempt; -extern int ia64_ipi_rndzvs; -extern int ia64_ipi_stop; -extern int ia64_ipi_wakeup; - -void ipi_all_but_self(int ipi); -void ipi_cpu(int cpu, u_int ipi); -void ipi_selected(cpuset_t cpus, int ipi); -void ipi_send(struct pcpu *, int ipi); - -#endif /* !LOCORE */ -#endif /* _KERNEL */ -#endif /* !_MACHINE_SMP_H */ diff --git a/sys/ia64/include/stdarg.h b/sys/ia64/include/stdarg.h deleted file mode 100644 index e6d0988..0000000 --- a/sys/ia64/include/stdarg.h +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * Copyright (c) 2002 David E. O'Brien. All rights reserved. - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD$ - */ - -#ifndef _MACHINE_STDARG_H_ -#define _MACHINE_STDARG_H_ - -#include <sys/cdefs.h> -#include <sys/_types.h> - -#ifndef _VA_LIST_DECLARED -#define _VA_LIST_DECLARED -typedef __va_list va_list; -#endif - -#if defined(__GNUCLIKE_BUILTIN_STDARG) - -#define va_start(ap, last) \ - __builtin_va_start((ap), (last)) - -#define va_arg(ap, type) \ - __builtin_va_arg((ap), type) - -#if __ISO_C_VISIBLE >= 1999 -#define va_copy(dest, src) \ - __builtin_va_copy((dest), (src)) -#endif - -#define va_end(ap) \ - __builtin_va_end(ap) - -#endif - -#endif /* !_MACHINE_STDARG_H_ */ diff --git a/sys/ia64/include/sysarch.h b/sys/ia64/include/sysarch.h deleted file mode 100644 index c46d100..0000000 --- a/sys/ia64/include/sysarch.h +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * Copyright (c) 1993 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_SYSARCH_H_ -#define _MACHINE_SYSARCH_H_ - -#ifndef _KERNEL -#include <sys/cdefs.h> - -__BEGIN_DECLS -int sysarch(int, void *); -__END_DECLS -#endif - -#endif /* !_MACHINE_SYSARCH_H_ */ diff --git a/sys/ia64/include/ucontext.h b/sys/ia64/include/ucontext.h deleted file mode 100644 index f4af26c..0000000 --- a/sys/ia64/include/ucontext.h +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * Copyright (c) 1999, 2003 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_UCONTEXT_H_ -#define _MACHINE_UCONTEXT_H_ - -#include <machine/_regset.h> - -/* - * The mc_flags field provides the necessary clues when dealing with the gory - * details of ia64 specific contexts. A comprehensive explanation is added for - * everybody's sanity, including the author's. - * - * The first and foremost variation in the context is synchronous contexts - * (= synctx) versus asynchronous contexts (= asynctx). A synctx is created - * synchronously WRT program execution and has the advantage that none of the - * scratch registers have to be saved. They are assumed to be clobbered by the - * call to the function that creates the context. An asynctx needs to have the - * scratch registers preserved because it can describe any point in a thread's - * (or process') execution. - * The second variation is for synchronous contexts. When the kernel creates - * a synchronous context if needs to preserve the scratch registers, because - * the syscall argument and return values are stored there in the trapframe - * and they need to be preserved in order to restart a syscall or return the - * proper return values. Also, the IIP and CFM fields need to be preserved - * as they point to the syscall stub, which the kernel saves as a favor to - * userland (it keeps the stubs small and simple). - * - * Below a description of the flags and their meaning: - * - * _MC_FLAGS_ASYNC_CONTEXT - * If set, indicates that mc_scratch and mc_scratch_fp are both - * valid. IFF not set, _MC_FLAGS_SYSCALL_CONTEXT indicates if the - * synchronous context is one corresponding to a syscall or not. - * Only the kernel is expected to create such a context and it's - * probably wise to let the kernel restore it. - * _MC_FLAGS_HIGHFP_VALID - * If set, indicates that the high FP registers (f32-f127) are - * valid. This flag is very likely not going to be set for any - * sensible synctx, but is not explicitly disallowed. Any synctx - * that has this flag may or may not have the high FP registers - * restored. In short: don't do it. - * _MC_FLAGS_SYSCALL_CONTEXT - * If set (hence _MC_FLAGS_ASYNC_CONTEXT is not set) indicates - * that the scratch registers contain syscall arguments and - * return values and that additionally IIP and CFM are valid. - * Only the kernel is expected to create such a context. It's - * probably wise to let the kernel restore it. - */ - -typedef struct __mcontext { - unsigned long mc_flags; -#define _MC_FLAGS_ASYNC_CONTEXT 0x0001 -#define _MC_FLAGS_HIGHFP_VALID 0x0002 -#define _MC_FLAGS_SYSCALL_CONTEXT 0x0008 - unsigned long _reserved_; - struct _special mc_special; - struct _callee_saved mc_preserved; - struct _callee_saved_fp mc_preserved_fp; - struct _caller_saved mc_scratch; - struct _caller_saved_fp mc_scratch_fp; - struct _high_fp mc_high_fp; -} mcontext_t; - -#endif /* !_MACHINE_UCONTEXT_H_ */ diff --git a/sys/ia64/include/unwind.h b/sys/ia64/include/unwind.h deleted file mode 100644 index b1d512c..0000000 --- a/sys/ia64/include/unwind.h +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * Copyright (c) 2003 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_UNWIND_H_ -#define _MACHINE_UNWIND_H_ - -struct pcb; -struct trapframe; -struct uwx_env; - -struct unw_regstate { - struct pcb *pcb; - struct trapframe *frame; - struct uwx_env *env; - uint64_t keyval[8]; -}; - -int unw_create_from_pcb(struct unw_regstate *s, struct pcb *pcb); -int unw_create_from_frame(struct unw_regstate *s, struct trapframe *tf); -void unw_delete(struct unw_regstate *s); -int unw_step(struct unw_regstate *s); - -int unw_get_bsp(struct unw_regstate *s, uint64_t *r); -int unw_get_cfm(struct unw_regstate *s, uint64_t *r); -int unw_get_ip(struct unw_regstate *s, uint64_t *r); -int unw_get_sp(struct unw_regstate *s, uint64_t *r); - -int unw_table_add(uint64_t, uint64_t, uint64_t); -void unw_table_remove(uint64_t); - -#endif /* _MACHINE_UNWIND_H_ */ diff --git a/sys/ia64/include/varargs.h b/sys/ia64/include/varargs.h deleted file mode 100644 index 3ed4231..0000000 --- a/sys/ia64/include/varargs.h +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * Copyright (c) 2002 David E. O'Brien. All rights reserved. - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)varargs.h 8.2 (Berkeley) 3/22/94 - * $FreeBSD$ - */ - -#ifndef _MACHINE_VARARGS_H_ -#define _MACHINE_VARARGS_H_ - -#error "<varargs.h> is obsolete on ia64. Use <stdarg.h> instead." - -#endif /* !_MACHINE_VARARGS_H_ */ diff --git a/sys/ia64/include/vdso.h b/sys/ia64/include/vdso.h deleted file mode 100644 index 4571daa..0000000 --- a/sys/ia64/include/vdso.h +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * Copyright 2012 Konstantin Belousov <kib@FreeBSD.ORG>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _IA64_VDSO_H -#define _IA64_VDSO_H - -#define VDSO_TIMEHANDS_MD \ - uint32_t th_res[8]; - -#ifdef _KERNEL -#ifdef COMPAT_FREEBSD32 - -#define VDSO_TIMEHANDS_MD32 VDSO_TIMEHANDS_MD - -#endif -#endif -#endif diff --git a/sys/ia64/include/vm.h b/sys/ia64/include/vm.h deleted file mode 100644 index 7176771..0000000 --- a/sys/ia64/include/vm.h +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_VM_H_ -#define _MACHINE_VM_H_ - -#include <machine/atomic.h> -#include <machine/pte.h> - -/* Memory attributes. */ -#define VM_MEMATTR_WRITE_BACK ((vm_memattr_t)PTE_MA_WB) -#define VM_MEMATTR_UNCACHEABLE ((vm_memattr_t)PTE_MA_UC) -#define VM_MEMATTR_UNCACHEABLE_EXPORTED ((vm_memattr_t)PTE_MA_UCE) -#define VM_MEMATTR_WRITE_COMBINING ((vm_memattr_t)PTE_MA_WC) -#define VM_MEMATTR_NATPAGE ((vm_memattr_t)PTE_MA_NATPAGE) - -#define VM_MEMATTR_DEFAULT VM_MEMATTR_WRITE_BACK - -#endif /* !_MACHINE_VM_H_ */ diff --git a/sys/ia64/include/vmparam.h b/sys/ia64/include/vmparam.h deleted file mode 100644 index edae4c4..0000000 --- a/sys/ia64/include/vmparam.h +++ /dev/null @@ -1,206 +0,0 @@ -/*- - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah $Hdr: vmparam.h 1.16 91/01/18$ - * - * @(#)vmparam.h 8.2 (Berkeley) 4/22/94 - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_VMPARAM_H_ -#define _MACHINE_VMPARAM_H_ - -/* - * Virtual memory related constants, all in bytes - */ -#ifndef MAXTSIZ -#define MAXTSIZ (1<<30) /* max text size (1G) */ -#endif -#ifndef DFLDSIZ -#define DFLDSIZ (1<<27) /* initial data size (128M) */ -#endif -#ifndef MAXDSIZ -#define MAXDSIZ (1<<30) /* max data size (1G) */ -#endif -#ifndef DFLSSIZ -#define DFLSSIZ (1<<21) /* initial stack size (2M) */ -#endif -#ifndef MAXSSIZ -#define MAXSSIZ (1<<28) /* max stack size (256M) */ -#endif -#ifndef SGROWSIZ -#define SGROWSIZ (128UL*1024) /* amount to grow stack */ -#endif - -/* - * We need region 7 virtual addresses for pagetables. - */ -#define UMA_MD_SMALL_ALLOC - -/* - * The physical address space is sparsely populated. - */ -#define VM_PHYSSEG_SPARSE - -/* - * The number of PHYSSEG entries is equal to the number of phys_avail - * entries. - */ -#define VM_PHYSSEG_MAX 49 - -/* - * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool - * from which physical pages are allocated and VM_FREEPOOL_DIRECT is - * the pool from which physical pages for small UMA objects are - * allocated. - */ -#define VM_NFREEPOOL 3 -#define VM_FREEPOOL_CACHE 2 -#define VM_FREEPOOL_DEFAULT 0 -#define VM_FREEPOOL_DIRECT 1 - -/* - * Create one free page list. - */ -#define VM_NFREELIST 1 -#define VM_FREELIST_DEFAULT 0 - -/* - * An allocation size of 256MB is supported in order to optimize the - * use of the identity mappings in region 7 by UMA. - */ -#define VM_NFREEORDER 16 - -/* - * Disable superpage reservations. - */ -#ifndef VM_NRESERVLEVEL -#define VM_NRESERVLEVEL 0 -#endif - -#define IA64_VM_MINKERN_REGION 4 - -/* - * Manipulating region bits of an address. - */ -#define IA64_RR_BASE(n) (((uint64_t) (n)) << 61) -#define IA64_RR_MASK(x) ((x) & ((1L << 61) - 1)) - -#define IA64_PHYS_TO_RR6(x) ((x) | IA64_RR_BASE(6)) -#define IA64_PHYS_TO_RR7(x) ((x) | IA64_RR_BASE(7)) - -/* - * The Itanium architecture defines that all implementations support at - * least 51 virtual address bits (i.e. IMPL_VA_MSB=50). The unimplemented - * bits are sign-extended from VA{IMPL_VA_MSB}. As such, there's a gap in - * the virtual address range, which extends at most from 0x0004000000000000 - * to 0x1ffbffffffffffff. We define the top half of a region in terms of - * this worst-case gap. - */ -#define IA64_REGION_GAP_START 0x0004000000000000 -#define IA64_REGION_GAP_EXTEND 0x1ffc000000000000 - -/* - * Parameters for Pre-Boot Virtual Memory (PBVM). - * The kernel, its modules and metadata are loaded in the PBVM by the loader. - * The PBVM consists of pages for which the mapping is maintained in a page - * table. The page table is at least 1 EFI page large (i.e. 4KB), but can be - * larger to accommodate more PBVM. The maximum page table size is 1MB. With - * 8 bytes per page table entry, this means that the PBVM has at least 512 - * pages and at most 128K pages. - * The GNU toolchain (in particular GNU ld) does not support an alignment - * larger than 64K. This means that we cannot guarantee page alignment for - * a page size that's larger than 64K. We do want to have text and data in - * different pages, which means that the maximum usable page size is 64KB. - * Consequently: - * The maximum total PBVM size is 8GB -- enough for a DVD image. A page table - * of a single EFI page (4KB) allows for 32MB of PBVM. - * - * The kernel is given the PA and size of the page table that provides the - * mapping of the PBVM. The page table itself is assumed to be mapped at a - * known virtual address and using a single translation wired into the CPU. - * As such, the page table is assumed to be a power of 2 and naturally aligned. - * The kernel also assumes that a good portion of the kernel text is mapped - * and wired into the CPU, but does not assume that the mapping covers the - * whole of PBVM. - */ -#define IA64_PBVM_RR IA64_VM_MINKERN_REGION -#define IA64_PBVM_BASE \ - (IA64_RR_BASE(IA64_PBVM_RR) + IA64_REGION_GAP_EXTEND) - -#define IA64_PBVM_PGTBL_MAXSZ 1048576 -#define IA64_PBVM_PGTBL \ - (IA64_RR_BASE(IA64_PBVM_RR + 1) - IA64_PBVM_PGTBL_MAXSZ) - -#define IA64_PBVM_PAGE_SHIFT 16 /* 64KB */ -#define IA64_PBVM_PAGE_SIZE (1 << IA64_PBVM_PAGE_SHIFT) -#define IA64_PBVM_PAGE_MASK (IA64_PBVM_PAGE_SIZE - 1) - -/* - * Mach derived constants - */ - -/* user/kernel map constants */ -#define VM_MIN_ADDRESS 0 -#define VM_MAXUSER_ADDRESS IA64_RR_BASE(IA64_VM_MINKERN_REGION) -#define VM_MIN_KERNEL_ADDRESS VM_MAXUSER_ADDRESS -#define VM_INIT_KERNEL_ADDRESS IA64_RR_BASE(IA64_VM_MINKERN_REGION + 1) -#define VM_MAX_KERNEL_ADDRESS (IA64_RR_BASE(IA64_VM_MINKERN_REGION + 2) - 1) -#define VM_MAX_ADDRESS ~0UL - -/* We link the kernel at IA64_PBVM_BASE. */ -#define KERNBASE IA64_PBVM_BASE - -/* - * USRSTACK is the top (end) of the user stack. Immediately above the user - * stack resides the syscall gateway page. - */ -#define USRSTACK VM_MAXUSER_ADDRESS -#define IA64_BACKINGSTORE (USRSTACK - (2 * MAXSSIZ) - PAGE_SIZE) - -/* - * How many physical pages per kmem arena virtual page. - */ -#ifndef VM_KMEM_SIZE_SCALE -#define VM_KMEM_SIZE_SCALE (4) -#endif - -/* initial pagein size of beginning of executable file */ -#ifndef VM_INITIAL_PAGEIN -#define VM_INITIAL_PAGEIN 16 -#endif - -#define ZERO_REGION_SIZE (2 * 1024 * 1024) /* 2MB */ - -#endif /* !_MACHINE_VMPARAM_H_ */ diff --git a/sys/ia64/isa/isa.c b/sys/ia64/isa/isa.c deleted file mode 100644 index cdb93cc..0000000 --- a/sys/ia64/isa/isa.c +++ /dev/null @@ -1,137 +0,0 @@ -/*- - * Copyright (c) 1998 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * Modifications for Intel architecture by Garrett A. Wollman. - * Copyright 1998 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that both the above copyright notice and this - * permission notice appear in all copies, that both the above - * copyright notice and this permission notice appear in all - * supporting documentation, and that the name of M.I.T. not be used - * in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. M.I.T. makes - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT - * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/bus.h> -#include <sys/malloc.h> -#include <machine/bus.h> -#include <sys/rman.h> - -#include <machine/resource.h> - -#include <isa/isareg.h> -#include <isa/isavar.h> -#include <isa/isa_common.h> - -void -isa_init(device_t dev) -{ -} - -/* - * This implementation simply passes the request up to the parent - * bus, which in our case is the special i386 nexus, substituting any - * configured values if the caller defaulted. We can get away with - * this because there is no special mapping for ISA resources on an Intel - * platform. When porting this code to another architecture, it may be - * necessary to interpose a mapping layer here. - */ -struct resource * -isa_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) -{ - /* - * Consider adding a resource definition. - */ - int passthrough = (device_get_parent(child) != bus); - int isdefault = (start == 0UL && end == ~0UL); - struct isa_device* idev = DEVTOISA(child); - struct resource_list *rl = &idev->id_resources; - struct resource_list_entry *rle; - - if (!passthrough && !isdefault) { - rle = resource_list_find(rl, type, *rid); - if (!rle) { - if (*rid < 0) - return 0; - switch (type) { - case SYS_RES_IRQ: - if (*rid >= ISA_NIRQ) - return 0; - break; - case SYS_RES_DRQ: - if (*rid >= ISA_NDRQ) - return 0; - break; - case SYS_RES_MEMORY: - if (*rid >= ISA_NMEM) - return 0; - break; - case SYS_RES_IOPORT: - if (*rid >= ISA_NPORT) - return 0; - break; - default: - return 0; - } - resource_list_add(rl, type, *rid, start, end, count); - } - } - - return resource_list_alloc(rl, bus, child, type, rid, - start, end, count, flags); -} - -int -isa_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - struct isa_device* idev = DEVTOISA(child); - struct resource_list *rl = &idev->id_resources; - return resource_list_release(rl, bus, child, type, rid, r); -} diff --git a/sys/ia64/isa/isa_dma.c b/sys/ia64/isa/isa_dma.c deleted file mode 100644 index 1b093e5..0000000 --- a/sys/ia64/isa/isa_dma.c +++ /dev/null @@ -1,508 +0,0 @@ -/*- - * Copyright (c) 1991 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, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * from: isa_dma.c,v 1.3 1999/05/09 23:56:00 peter Exp $ - * $FreeBSD$ - */ - -/* - * code to manage AT bus - * - * 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com): - * Fixed uninitialized variable problem and added code to deal - * with DMA page boundaries in isa_dmarangecheck(). Fixed word - * mode DMA count compution and reorganized DMA setup code in - * isa_dmastart() - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/malloc.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/bus.h> -#include <vm/vm.h> -#include <vm/vm_param.h> -#include <vm/pmap.h> -#include <isa/isareg.h> -#include <isa/isavar.h> -#include <isa/isa_dmareg.h> -#include <machine/bus.h> - -static bus_dma_tag_t dma_tag[8]; -static bus_dmamap_t dma_map[8]; -static u_int8_t dma_busy = 0; /* Used in isa_dmastart() */ -static u_int8_t dma_inuse = 0; /* User for acquire/release */ -static u_int8_t dma_auto_mode = 0; -static u_int8_t dma_bounced = 0; - -#define VALID_DMA_MASK (7) - -/* high byte of address is stored in this port for i-th dma channel */ -static int dmapageport[8] = { 0x87, 0x83, 0x81, 0x82, 0x8f, 0x8b, 0x89, 0x8a }; - -/* - * Setup a DMA channel's bounce buffer. - */ -int -isa_dma_init(int chan, u_int bouncebufsize, int flag __unused) -{ - static int initted = 0; - bus_addr_t boundary = chan >= 4 ? 0x20000 : 0x10000; - - if (!initted) { - /* - * Reset the DMA hardware. - */ - outb(DMA1_RESET, 0); - outb(DMA2_RESET, 0); - isa_dmacascade(4); - - initted = 1; - } - -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dma_init: channel out of range"); - - if (dma_tag[chan] || dma_map[chan]) - panic("isa_dma_init: impossible request"); -#endif - - if (bus_dma_tag_create(/*parent*/NULL, - /*alignment*/2, - /*boundary*/boundary, - /*lowaddr*/BUS_SPACE_MAXADDR_24BIT, - /*highaddr*/BUS_SPACE_MAXADDR, - /*filter*/NULL, /*filterarg*/NULL, - /*maxsize*/bouncebufsize, - /*nsegments*/1, /*maxsegz*/0x3ffff, - /*flags*/0, - /*lockfunc*/busdma_lock_mutex, - /*lockarg*/&Giant, - &dma_tag[chan]) != 0) { - panic("isa_dma_init: unable to create dma tag\n"); - } - - if (bus_dmamap_create(dma_tag[chan], 0, &dma_map[chan])) { - panic("isa_dma_init: unable to create dma map\n"); - } - - return (0); -} - -/* - * Register a DMA channel's usage. Usually called from a device driver - * in open() or during its initialization. - */ -int -isa_dma_acquire(chan) - int chan; -{ -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dma_acquire: channel out of range"); -#endif - - if (dma_inuse & (1 << chan)) { - printf("isa_dma_acquire: channel %d already in use\n", chan); - return (EBUSY); - } - dma_inuse |= (1 << chan); - dma_auto_mode &= ~(1 << chan); - - return (0); -} - -/* - * Unregister a DMA channel's usage. Usually called from a device driver - * during close() or during its shutdown. - */ -void -isa_dma_release(chan) - int chan; -{ -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dma_release: channel out of range"); - - if ((dma_inuse & (1 << chan)) == 0) - printf("isa_dma_release: channel %d not in use\n", chan); -#endif - - if (dma_busy & (1 << chan)) { - dma_busy &= ~(1 << chan); - /* - * XXX We should also do "dma_bounced &= (1 << chan);" - * because we are acting on behalf of isa_dmadone() which - * was not called to end the last DMA operation. This does - * not matter now, but it may in the future. - */ - } - - dma_inuse &= ~(1 << chan); - dma_auto_mode &= ~(1 << chan); -} - -/* - * isa_dmacascade(): program 8237 DMA controller channel to accept - * external dma control by a board. - */ -void -isa_dmacascade(chan) - int chan; -{ -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dmacascade: channel out of range"); -#endif - - /* set dma channel mode, and set dma channel mode */ - if ((chan & 4) == 0) { - outb(DMA1_MODE, DMA37MD_CASCADE | chan); - outb(DMA1_SMSK, chan); - } else { - outb(DMA2_MODE, DMA37MD_CASCADE | (chan & 3)); - outb(DMA2_SMSK, chan & 3); - } -} - -/* - * isa_dmastart(): program 8237 DMA controller channel. - */ - -struct isa_dmastart_arg { - caddr_t addr; - int chan; - int flags; -}; - -static void isa_dmastart_cb(void *arg, bus_dma_segment_t *segs, int nseg, - int error) -{ -#if 0 - caddr_t addr = ((struct isa_dmastart_arg *) arg)->addr; -#endif - int chan = ((struct isa_dmastart_arg *) arg)->chan; - int flags = ((struct isa_dmastart_arg *) arg)->flags; - bus_addr_t phys = segs->ds_addr; - int nbytes = segs->ds_len; - int waport; - - if (nseg != 1) - panic("isa_dmastart: transfer mapping not contiguous"); - -#if 0 - if ((chipset.sgmap == NULL) && - (pmap_extract(kernel_pmap, (vm_offset_t)addr) - > BUS_SPACE_MAXADDR_24BIT)) { - /* we bounced */ - dma_bounced |= (1 << chan); - /* copy bounce buffer on write */ - if (!(flags & ISADMA_READ)) - bus_dmamap_sync(dma_tag[chan], dma_map[chan], - BUS_DMASYNC_PREWRITE); - } -#endif - - if ((chan & 4) == 0) { - /* - * Program one of DMA channels 0..3. These are - * byte mode channels. - */ - /* set dma channel mode, and reset address ff */ - - /* If ISADMA_RAW flag is set, then use autoinitialise mode */ - if (flags & ISADMA_RAW) { - if (flags & ISADMA_READ) - outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_WRITE|chan); - else - outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_READ|chan); - } - else - if (flags & ISADMA_READ) - outb(DMA1_MODE, DMA37MD_SINGLE|DMA37MD_WRITE|chan); - else - outb(DMA1_MODE, DMA37MD_SINGLE|DMA37MD_READ|chan); - outb(DMA1_FFC, 0); - - /* send start address */ - waport = DMA1_CHN(chan); - outb(waport, phys); - outb(waport, phys>>8); - outb(dmapageport[chan], phys>>16); - - /* send count */ - outb(waport + 1, --nbytes); - outb(waport + 1, nbytes>>8); - - /* unmask channel */ - outb(DMA1_SMSK, chan); - } else { - /* - * Program one of DMA channels 4..7. These are - * word mode channels. - */ - /* set dma channel mode, and reset address ff */ - - /* If ISADMA_RAW flag is set, then use autoinitialise mode */ - if (flags & ISADMA_RAW) { - if (flags & ISADMA_READ) - outb(DMA2_MODE, DMA37MD_AUTO|DMA37MD_WRITE|(chan&3)); - else - outb(DMA2_MODE, DMA37MD_AUTO|DMA37MD_READ|(chan&3)); - } - else - if (flags & ISADMA_READ) - outb(DMA2_MODE, DMA37MD_SINGLE|DMA37MD_WRITE|(chan&3)); - else - outb(DMA2_MODE, DMA37MD_SINGLE|DMA37MD_READ|(chan&3)); - outb(DMA2_FFC, 0); - - /* send start address */ - waport = DMA2_CHN(chan - 4); - outb(waport, phys>>1); - outb(waport, phys>>9); - outb(dmapageport[chan], phys>>16); - - /* send count */ - nbytes >>= 1; - outb(waport + 2, --nbytes); - outb(waport + 2, nbytes>>8); - - /* unmask channel */ - outb(DMA2_SMSK, chan & 3); - } -} - -void -isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan) -{ - struct isa_dmastart_arg args; - -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dmastart: channel out of range"); - - if ((chan < 4 && nbytes > (1<<16)) - || (chan >= 4 && (nbytes > (1<<17) || (uintptr_t)addr & 1))) - panic("isa_dmastart: impossible request"); - - if ((dma_inuse & (1 << chan)) == 0) - printf("isa_dmastart: channel %d not acquired\n", chan); -#endif - -#if 0 - /* - * XXX This should be checked, but drivers like ad1848 only call - * isa_dmastart() once because they use Auto DMA mode. If we - * leave this in, drivers that do this will print this continuously. - */ - if (dma_busy & (1 << chan)) - printf("isa_dmastart: channel %d busy\n", chan); -#endif - - if (!dma_tag[chan] || !dma_map[chan]) - panic("isa_dmastart: called without isa_dma_init"); - - dma_busy |= (1 << chan); - - if (flags & ISADMA_RAW) { - dma_auto_mode |= (1 << chan); - } else { - dma_auto_mode &= ~(1 << chan); - } - - /* - * Freeze dma while updating registers. - */ - outb(chan & 4 ? DMA2_SMSK : DMA1_SMSK, (chan & 3) | 4); - - args.addr = addr; - args.chan = chan; - args.flags = flags; - bus_dmamap_load(dma_tag[chan], dma_map[chan], addr, nbytes, - isa_dmastart_cb, &args, 0); -} - -void -isa_dmadone(int flags, caddr_t addr, int nbytes, int chan) -{ -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dmadone: channel out of range"); - - if ((dma_inuse & (1 << chan)) == 0) - printf("isa_dmadone: channel %d not acquired\n", chan); -#endif - - if (((dma_busy & (1 << chan)) == 0) && - (dma_auto_mode & (1 << chan)) == 0 ) - printf("isa_dmadone: channel %d not busy\n", chan); - - if (dma_bounced & (1 << chan)) { - /* copy bounce buffer on read */ - if (flags & ISADMA_READ) { - bus_dmamap_sync(dma_tag[chan], dma_map[chan], - BUS_DMASYNC_POSTREAD); - } - dma_bounced &= ~(1 << chan); - } - - if ((dma_auto_mode & (1 << chan)) == 0) { - outb(chan & 4 ? DMA2_SMSK : DMA1_SMSK, (chan & 3) | 4); - bus_dmamap_unload(dma_tag[chan], dma_map[chan]); - } - - dma_busy &= ~(1 << chan); -} - -/* - * Query the progress of a transfer on a DMA channel. - * - * To avoid having to interrupt a transfer in progress, we sample - * each of the high and low databytes twice, and apply the following - * logic to determine the correct count. - * - * Reads are performed with interrupts disabled, thus it is to be - * expected that the time between reads is very small. At most - * one rollover in the low count byte can be expected within the - * four reads that are performed. - * - * There are three gaps in which a rollover can occur : - * - * - read low1 - * gap1 - * - read high1 - * gap2 - * - read low2 - * gap3 - * - read high2 - * - * If a rollover occurs in gap1 or gap2, the low2 value will be - * greater than the low1 value. In this case, low2 and high2 are a - * corresponding pair. - * - * In any other case, low1 and high1 can be considered to be correct. - * - * The function returns the number of bytes remaining in the transfer, - * or -1 if the channel requested is not active. - * - */ -int -isa_dmastatus(int chan) -{ - u_long cnt = 0; - int ffport, waport; - u_long low1, high1, low2, high2; - int s; - - /* channel active? */ - if ((dma_inuse & (1 << chan)) == 0) { - printf("isa_dmastatus: channel %d not active\n", chan); - return(-1); - } - /* channel busy? */ - - if (((dma_busy & (1 << chan)) == 0) && - (dma_auto_mode & (1 << chan)) == 0 ) { - printf("chan %d not busy\n", chan); - return -2 ; - } - if (chan < 4) { /* low DMA controller */ - ffport = DMA1_FFC; - waport = DMA1_CHN(chan) + 1; - } else { /* high DMA controller */ - ffport = DMA2_FFC; - waport = DMA2_CHN(chan - 4) + 2; - } - - s = splhigh(); /* no interrupts Mr Jones! */ - outb(ffport, 0); /* clear register LSB flipflop */ - low1 = inb(waport); - high1 = inb(waport); - outb(ffport, 0); /* clear again */ - low2 = inb(waport); - high2 = inb(waport); - splx(s); /* enable interrupts again */ - - /* - * Now decide if a wrap has tried to skew our results. - * Note that after TC, the count will read 0xffff, while we want - * to return zero, so we add and then mask to compensate. - */ - if (low1 >= low2) { - cnt = (low1 + (high1 << 8) + 1) & 0xffff; - } else { - cnt = (low2 + (high2 << 8) + 1) & 0xffff; - } - - if (chan >= 4) /* high channels move words */ - cnt *= 2; - return(cnt); -} - -/* - * Reached terminal count yet ? - */ -int -isa_dmatc(int chan) -{ - - if (chan < 4) - return(inb(DMA1_STATUS) & (1 << chan)); - else - return(inb(DMA2_STATUS) & (1 << (chan & 3))); -} - -/* - * Stop a DMA transfer currently in progress. - */ -int -isa_dmastop(int chan) -{ - if ((dma_inuse & (1 << chan)) == 0) - printf("isa_dmastop: channel %d not acquired\n", chan); - - if (((dma_busy & (1 << chan)) == 0) && - ((dma_auto_mode & (1 << chan)) == 0)) { - printf("chan %d not busy\n", chan); - return -2 ; - } - - if ((chan & 4) == 0) { - outb(DMA1_SMSK, (chan & 3) | 4 /* disable mask */); - } else { - outb(DMA2_SMSK, (chan & 3) | 4 /* disable mask */); - } - return(isa_dmastatus(chan)); -} diff --git a/sys/ia64/pci/pci_cfgreg.c b/sys/ia64/pci/pci_cfgreg.c deleted file mode 100644 index e3f472b..0000000 --- a/sys/ia64/pci/pci_cfgreg.c +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * Copyright (c) 2010 Marcel Moolenaar - * Copyright (c) 2001 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <machine/cpufunc.h> -#include <machine/pci_cfgreg.h> -#include <machine/sal.h> - -static u_long -pci_sal_address(int dom, int bus, int slot, int func, int reg) -{ - u_long addr; - - addr = ~0ul; - if (dom >= 0 && dom <= 255 && bus >= 0 && bus <= 255 && - slot >= 0 && slot <= 31 && func >= 0 && func <= 7 && - reg >= 0 && reg <= 255) { - addr = ((u_long)dom << 24) | ((u_long)bus << 16) | - ((u_long)slot << 11) | ((u_long)func << 8) | (u_long)reg; - } - return (addr); -} - -static int -pci_valid_access(int reg, int len) -{ - int ok; - - ok = ((len == 1 || len == 2 || len == 4) && (reg & (len - 1)) == 0) - ? 1 : 0; - return (ok); -} - -int -pci_cfgregopen(void) -{ - return (1); -} - -uint32_t -pci_cfgregread(int bus, int slot, int func, int reg, int len) -{ - struct ia64_sal_result res; - register_t is; - u_long addr; - - addr = pci_sal_address(bus >> 8, bus & 0xff, slot, func, reg); - if (addr == ~0ul) - return (~0); - - if (!pci_valid_access(reg, len)) - return (~0); - - is = intr_disable(); - res = ia64_sal_entry(SAL_PCI_CONFIG_READ, addr, len, 0, 0, 0, 0, 0); - intr_restore(is); - - return ((res.sal_status < 0) ? ~0 : res.sal_result[0]); -} - -void -pci_cfgregwrite(int bus, int slot, int func, int reg, uint32_t data, int len) -{ - struct ia64_sal_result res; - register_t is; - u_long addr; - - addr = pci_sal_address(bus >> 8, bus & 0xff, slot, func, reg); - if (addr == ~0ul) - return; - - if (!pci_valid_access(reg, len)) - return; - - is = intr_disable(); - res = ia64_sal_entry(SAL_PCI_CONFIG_WRITE, addr, len, data, 0, 0, 0, 0); - intr_restore(is); -} diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index b085a70..6342119 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -130,7 +130,7 @@ SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) ": enable non-executable stack"); #if __ELF_WORD_SIZE == 32 -#if defined(__amd64__) || defined(__ia64__) +#if defined(__amd64__) int i386_read_exec = 0; SYSCTL_INT(_kern_elf32, OID_AUTO, read_exec, CTLFLAG_RW, &i386_read_exec, 0, "enable execution from readable segments"); @@ -2112,7 +2112,7 @@ __elfN(trans_prot)(Elf_Word flags) if (flags & PF_R) prot |= VM_PROT_READ; #if __ELF_WORD_SIZE == 32 -#if defined(__amd64__) || defined(__ia64__) +#if defined(__amd64__) if (i386_read_exec && (flags & PF_R)) prot |= VM_PROT_EXECUTE; #endif diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index bc9af29..860820a 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1091,15 +1091,6 @@ exec_new_vmspace(imgp, sv) if (error) return (error); -#ifdef __ia64__ - /* Allocate a new register stack */ - stack_addr = IA64_BACKINGSTORE; - error = vm_map_stack(map, stack_addr, (vm_size_t)ssiz, - sv->sv_stackprot, VM_PROT_ALL, MAP_STACK_GROWS_UP); - if (error) - return (error); -#endif - /* * vm_ssize and vm_maxsaddr are somewhat antiquated concepts, but they * are still used to enforce the stack rlimit on the process stack. diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index b21a4f0..3f95371 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -234,7 +234,7 @@ thread_fini(void *mem, int size) * For a newly created process, * link up all the structures and its initial threads etc. * called from: - * {arch}/{arch}/machdep.c ia64_init(), init386() etc. + * {arch}/{arch}/machdep.c {arch}_init(), init386() etc. * proc_dtor() (should go away) * proc_init() */ diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 631ba75..ecee5a7 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -317,10 +317,6 @@ link_elf_delete_gdb(struct link_map *l) } #endif /* GDB */ -#ifdef __ia64__ -Elf_Addr link_elf_get_gp(linker_file_t); -#endif - /* * The kernel symbol table starts here. */ @@ -1454,21 +1450,6 @@ link_elf_each_function_nameval(linker_file_t file, return (0); } -#ifdef __ia64__ -/* - * Each KLD has its own GP. The GP value for each load module is given by - * DT_PLTGOT on ia64. We need GP to construct function descriptors, but - * don't have direct access to the ELF file structure. The link_elf_get_gp() - * function returns the GP given a pointer to a generic linker file struct. - */ -Elf_Addr -link_elf_get_gp(linker_file_t lf) -{ - elf_file_t ef = (elf_file_t)lf; - return ((Elf_Addr)ef->got); -} -#endif - const Elf_Sym * elf_get_sym(linker_file_t lf, Elf_Size symidx) { diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index 4ba4cf1..8d25461 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -660,9 +660,6 @@ static struct witness_order_list_entry order_lists[] = { { "mprof lock", &lock_class_mtx_spin }, { "zombie lock", &lock_class_mtx_spin }, { "ALD Queue", &lock_class_mtx_spin }, -#ifdef __ia64__ - { "MCA spin lock", &lock_class_mtx_spin }, -#endif #if defined(__i386__) || defined(__amd64__) { "pcicfg", &lock_class_mtx_spin }, { "NDIS thread lock", &lock_class_mtx_spin }, diff --git a/sys/libkern/ia64/__divdi3.S b/sys/libkern/ia64/__divdi3.S deleted file mode 100644 index 9465c9c..0000000 --- a/sys/libkern/ia64/__divdi3.S +++ /dev/null @@ -1,142 +0,0 @@ -.file "__divdi3.s" - -// $FreeBSD$ - -//- -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -.section .text -.proc __divdi3# -.align 32 -.global __divdi3# -.align 32 - -// 64-bit signed integer divide - -__divdi3: - -{ .mii - alloc r31=ar.pfs,2,0,0,0 - nop.i 0 - nop.i 0;; -} { .mmi - - // 64-BIT SIGNED INTEGER DIVIDE BEGINS HERE - - setf.sig f8=r32 - setf.sig f9=r33 - nop.i 0;; -} { .mfb - nop.m 0 - fcvt.xf f6=f8 - nop.b 0 -} { .mfb - nop.m 0 - fcvt.xf f7=f9 - nop.b 0;; -} { .mfi - nop.m 0 - // Step (1) - // y0 = 1 / b in f8 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (2) - // e0 = 1 - b * y0 in f9 - (p6) fnma.s1 f9=f7,f8,f1 - nop.i 0 -} { .mfi - nop.m 0 - // Step (3) - // q0 = a * y0 in f10 - (p6) fma.s1 f10=f6,f8,f0 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (4) - // e1 = e0 * e0 in f11 - (p6) fma.s1 f11=f9,f9,f0 - nop.i 0 -} { .mfi - nop.m 0 - // Step (5) - // q1 = q0 + e0 * q0 in f10 - (p6) fma.s1 f10=f9,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (6) - // y1 = y0 + e0 * y0 in f8 - (p6) fma.s1 f8=f9,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (7) - // q2 = q1 + e1 * q1 in f9 - (p6) fma.s1 f9=f11,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (8) - // y2 = y1 + e1 * y1 in f8 - (p6) fma.s1 f8=f11,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (9) - // r2 = a - b * q2 in f10 - (p6) fnma.s1 f10=f7,f9,f6 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (10) - // q3 = q2 + r2 * y2 in f8 - (p6) fma.s1 f8=f10,f8,f9 - nop.i 0;; -} { .mfb - nop.m 0 - // Step (11) - // q = trunc (q3) - fcvt.fx.trunc.s1 f8=f8 - nop.b 0;; -} { .mmi - // quotient will be in r8 (if b != 0) - getf.sig r8=f8 - nop.m 0 - nop.i 0;; -} - - // 64-BIT SIGNED INTEGER DIVIDE ENDS HERE - -{ .mmb - nop.m 0 - nop.m 0 - br.ret.sptk b0;; -} - -.endp __divdi3 diff --git a/sys/libkern/ia64/__divsi3.S b/sys/libkern/ia64/__divsi3.S deleted file mode 100644 index f7edd97..0000000 --- a/sys/libkern/ia64/__divsi3.S +++ /dev/null @@ -1,124 +0,0 @@ -.file "__divsi3.s" - -// $FreeBSD$ - -//- -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -.section .text - -// 32-bit signed integer divide - -.proc __divsi3# -.align 32 -.global __divsi3# -.align 32 - -__divsi3: - -{ .mii - alloc r31=ar.pfs,2,0,0,0 - nop.i 0 - nop.i 0;; -} { .mii - nop.m 0 - - // 32-BIT SIGNED INTEGER DIVIDE BEGINS HERE - - // general register used: - // r32 - 32-bit signed integer dividend - // r33 - 32-bit signed integer divisor - // r8 - 32-bit signed integer result - // r2 - scratch register - // floating-point registers used: f6, f7, f8, f9 - // predicate registers used: p6 - - sxt4 r32=r32 - sxt4 r33=r33;; -} { .mmb - setf.sig f6=r32 - setf.sig f7=r33 - nop.b 0;; -} { .mfi - nop.m 0 - fcvt.xf f6=f6 - nop.i 0 -} { .mfi - nop.m 0 - fcvt.xf f7=f7 - mov r2 = 0x0ffdd;; -} { .mfi - setf.exp f9 = r2 - // (1) y0 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // (2) q0 = a * y0 - (p6) fma.s1 f6=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // (3) e0 = 1 - b * y0 - (p6) fnma.s1 f7=f7,f8,f1 - nop.i 0;; -} { .mfi - nop.m 0 - // (4) q1 = q0 + e0 * q0 - (p6) fma.s1 f6=f7,f6,f6 - nop.i 0 -} { .mfi - nop.m 0 - // (5) e1 = e0 * e0 + 2^-34 - (p6) fma.s1 f7=f7,f7,f9 - nop.i 0;; -} { .mfi - nop.m 0 - // (6) q2 = q1 + e1 * q1 - (p6) fma.s1 f8=f7,f6,f6 - nop.i 0;; -} { .mfi - nop.m 0 - // (7) q = trunc(q2) - fcvt.fx.trunc.s1 f8=f8 - nop.i 0;; -} { .mmi - // quotient will be in the least significant 32 bits of r8 (if b != 0) - getf.sig r8=f8 - nop.m 0 - nop.i 0;; -} - - // 32-BIT SIGNED INTEGER DIVIDE ENDS HERE - -{ .mmb - nop.m 0 - nop.m 0 - br.ret.sptk b0;; -} - -.endp __divsi3 diff --git a/sys/libkern/ia64/__moddi3.S b/sys/libkern/ia64/__moddi3.S deleted file mode 100644 index e731adc..0000000 --- a/sys/libkern/ia64/__moddi3.S +++ /dev/null @@ -1,159 +0,0 @@ -.file "__moddi3.s" - -// $FreeBSD$ - -//- -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -.section .text - -// 64-bit signed integer remainder - -.proc __moddi3# -.align 32 -.global __moddi3# -.align 32 - -__moddi3: - -{ .mii - alloc r31=ar.pfs,3,0,0,0 - nop.i 0 - nop.i 0 -} { .mmb - - // 64-BIT SIGNED INTEGER REMAINDER BEGINS HERE - - // general register used: - // r32 - 64-bit signed integer dividend, called a below - // r33 - 64-bit signed integer divisor, called b below - // r8 - 64-bit signed integer result - // r2 - scratch register - // floating-point registers used: f6, f7, f8, f9, f10, f11, f12 - // predicate registers used: p6 - - setf.sig f12=r32 // holds a in integer form - setf.sig f7=r33 - nop.b 0 -} { .mlx - nop.m 0 - //movl r2=0x8000000000000000;; - movl r2=0xffffffffffffffff;; -} { .mfi - // get the 2's complement of b - sub r33=r0,r33 - fcvt.xf f6=f12 - nop.i 0 -} { .mfi - nop.m 0 - fcvt.xf f7=f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (1) - // y0 = 1 / b in f8 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (2) - // q0 = a * y0 in f10 - (p6) fma.s1 f10=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // Step (3) - // e0 = 1 - b * y0 in f9 - (p6) fnma.s1 f9=f7,f8,f1 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (4) - // q1 = q0 + e0 * q0 in f10 - (p6) fma.s1 f10=f9,f10,f10 - nop.i 0 -} { .mfi - nop.m 0 - // Step (5) - // e1 = e0 * e0 in f11 - (p6) fma.s1 f11=f9,f9,f0 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (6) - // y1 = y0 + e0 * y0 in f8 - (p6) fma.s1 f8=f9,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (7) - // q2 = q1 + e1 * q1 in f9 - (p6) fma.s1 f9=f11,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (8) - // y2 = y1 + e1 * y1 in f8 - (p6) fma.s1 f8=f11,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (9) - // r2 = a - b * q2 in f10 - (p6) fnma.s1 f10=f7,f9,f6 - nop.i 0;; -} { .mfi - setf.sig f7=r33 - // Step (10) - // q3 = q2 + r2 * y2 in f8 - (p6) fma.s1 f8=f10,f8,f9 - nop.i 0;; -} { .mfi - nop.m 0 - // (11) q = trunc(q3) - fcvt.fx.trunc.s1 f8=f8 - nop.i 0;; -} { .mfi - nop.m 0 - // (12) r = a + (-b) * q - xma.l f8=f8,f7,f12 - nop.i 0;; -} { .mib - getf.sig r8=f8 - nop.i 0 - nop.b 0 -} - - // 64-BIT SIGNED INTEGER REMAINDER ENDS HERE - -{ .mib - nop.m 0 - nop.i 0 - br.ret.sptk b0;; -} - -.endp __moddi3 diff --git a/sys/libkern/ia64/__modsi3.S b/sys/libkern/ia64/__modsi3.S deleted file mode 100644 index 568b20b..0000000 --- a/sys/libkern/ia64/__modsi3.S +++ /dev/null @@ -1,131 +0,0 @@ -.file "__modsi3.s" - -// $FreeBSD$ - -//- -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -.section .text - -// 32-bit signed integer remainder - -.proc __modsi3# -.align 32 -.global __modsi3# -.align 32 - -__modsi3: - -{ .mii - alloc r31=ar.pfs,2,0,0,0 - nop.i 0 - nop.i 0;; -} { .mii - nop.m 0 - - // 32-BIT SIGNED INTEGER REMAINDER BEGINS HERE - - // general register used: - // r32 - 32-bit signed integer dividend - // r33 - 32-bit signed integer divisor - // r8 - 32-bit signed integer result - // r2 - scratch register - // floating-point registers used: f6, f7, f8, f9, f10, f11 - // predicate registers used: p6 - - sxt4 r32=r32 - sxt4 r33=r33;; -} { .mmb - setf.sig f11=r32 - setf.sig f7=r33 - nop.b 0;; -} { .mfi - // get 2's complement of b - sub r33=r0,r33 - fcvt.xf f6=f11 - nop.i 0 -} { .mfi - nop.m 0 - fcvt.xf f7=f7 - mov r2 = 0x0ffdd;; -} { .mfi - setf.exp f9 = r2 - // (1) y0 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // (2) q0 = a * y0 - (p6) fma.s1 f10=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // (3) e0 = 1 - b * y0 - (p6) fnma.s1 f8=f7,f8,f1 - nop.i 0;; -} { .mfi - // 2's complement of b - setf.sig f7=r33 - // (4) q1 = q0 + e0 * q0 - (p6) fma.s1 f10=f8,f10,f10 - nop.i 0 -} { .mfi - nop.m 0 - // (5) e1 = e0 * e0 + 2^-34 - (p6) fma.s1 f8=f8,f8,f9 - nop.i 0;; -} { .mfi - nop.m 0 - // (6) q2 = q1 + e1 * q1 - (p6) fma.s1 f8=f8,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // (7) q = trunc(q2) - fcvt.fx.trunc.s1 f8=f8 - nop.i 0;; -} { .mfi - nop.m 0 - // (8) r = a + (-b) * q - xma.l f8=f8,f7,f11 - nop.i 0;; -} { .mmi - // remainder will be in the least significant 32 bits of r8 (if b != 0) - getf.sig r8=f8 - nop.m 0 - nop.i 0;; -} - - // 32-BIT SIGNED INTEGER REMAINDER ENDS HERE - -{ .mmb - nop.m 0 - nop.m 0 - br.ret.sptk b0;; -} - -.endp __modsi3 diff --git a/sys/libkern/ia64/__udivdi3.S b/sys/libkern/ia64/__udivdi3.S deleted file mode 100644 index 91c9429..0000000 --- a/sys/libkern/ia64/__udivdi3.S +++ /dev/null @@ -1,143 +0,0 @@ -.file "__udivdi3.s" - -// $FreeBSD$ - -//- -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -.section .text -.proc __udivdi3# -.align 32 -.global __udivdi3# -.align 32 - -// 64-bit unsigned integer divide - -__udivdi3: - -{ .mii - alloc r31=ar.pfs,2,0,0,0 - nop.i 0 - nop.i 0;; -} - -{ .mmi - - // 64-BIT UNSIGNED INTEGER DIVIDE BEGINS HERE - - setf.sig f8=r32 - setf.sig f9=r33 - nop.i 0;; -} { .mfb - nop.m 0 - fma.s1 f6=f8,f1,f0 - nop.b 0 -} { .mfb - nop.m 0 - fma.s1 f7=f9,f1,f0 - nop.b 0;; -} { .mfi - nop.m 0 - // Step (1) - // y0 = 1 / b in f8 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (2) - // e0 = 1 - b * y0 in f9 - (p6) fnma.s1 f9=f7,f8,f1 - nop.i 0 -} { .mfi - nop.m 0 - // Step (3) - // q0 = a * y0 in f10 - (p6) fma.s1 f10=f6,f8,f0 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (4) - // e1 = e0 * e0 in f11 - (p6) fma.s1 f11=f9,f9,f0 - nop.i 0 -} { .mfi - nop.m 0 - // Step (5) - // q1 = q0 + e0 * q0 in f10 - (p6) fma.s1 f10=f9,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (6) - // y1 = y0 + e0 * y0 in f8 - (p6) fma.s1 f8=f9,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (7) - // q2 = q1 + e1 * q1 in f9 - (p6) fma.s1 f9=f11,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (8) - // y2 = y1 + e1 * y1 in f8 - (p6) fma.s1 f8=f11,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (9) - // r2 = a - b * q2 in f10 - (p6) fnma.s1 f10=f7,f9,f6 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (10) - // q3 = q2 + r2 * y2 in f8 - (p6) fma.s1 f8=f10,f8,f9 - nop.i 0;; -} { .mfb - nop.m 0 - // (11) q = trunc(q3) - fcvt.fxu.trunc.s1 f8=f8 - nop.b 0;; -} { .mmi - // quotient will be in r8 (if b != 0) - getf.sig r8=f8 - nop.m 0 - nop.i 0;; -} - - // 64-BIT UNSIGNED INTEGER DIVIDE ENDS HERE - -{ .mmb - nop.m 0 - nop.m 0 - br.ret.sptk b0;; -} - -.endp __udivdi3 diff --git a/sys/libkern/ia64/__udivsi3.S b/sys/libkern/ia64/__udivsi3.S deleted file mode 100644 index 9597abd..0000000 --- a/sys/libkern/ia64/__udivsi3.S +++ /dev/null @@ -1,124 +0,0 @@ -.file "__udivsi3.s" - -// $FreeBSD$ - -//- -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -.section .text - -// 32-bit unsigned integer divide - -.proc __udivsi3# -.align 32 -.global __udivsi3# -.align 32 - -__udivsi3: - -{ .mii - alloc r31=ar.pfs,2,0,0,0 - nop.i 0 - nop.i 0;; -} { .mii - nop.m 0 - - // 32-BIT UNSIGNED INTEGER DIVIDE BEGINS HERE - - // general register used: - // r32 - 32-bit unsigned integer dividend - // r33 - 32-bit unsigned integer divisor - // r8 - 32-bit unsigned integer result - // r2 - scratch register - // floating-point registers used: f6, f7, f8, f9 - // predicate registers used: p6 - - zxt4 r32=r32 - zxt4 r33=r33;; -} { .mmb - setf.sig f6=r32 - setf.sig f7=r33 - nop.b 0;; -} { .mfi - nop.m 0 - fcvt.xf f6=f6 - nop.i 0 -} { .mfi - nop.m 0 - fcvt.xf f7=f7 - mov r2 = 0x0ffdd;; -} { .mfi - setf.exp f9 = r2 - // (1) y0 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // (2) q0 = a * y0 - (p6) fma.s1 f6=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // (3) e0 = 1 - b * y0 - (p6) fnma.s1 f7=f7,f8,f1 - nop.i 0;; -} { .mfi - nop.m 0 - // (4) q1 = q0 + e0 * q0 - (p6) fma.s1 f6=f7,f6,f6 - nop.i 0 -} { .mfi - nop.m 0 - // (5) e1 = e0 * e0 + 2^-34 - (p6) fma.s1 f7=f7,f7,f9 - nop.i 0;; -} { .mfi - nop.m 0 - // (6) q2 = q1 + e1 * q1 - (p6) fma.s1 f8=f7,f6,f6 - nop.i 0;; -} { .mfi - nop.m 0 - // (7) q = trunc(q2) - fcvt.fxu.trunc.s1 f8=f8 - nop.i 0;; -} { .mmi - // quotient will be in the least significant 32 bits of r8 (if b != 0) - getf.sig r8=f8 - nop.m 0 - nop.i 0;; -} - - // 32-BIT UNSIGNED INTEGER DIVIDE ENDS HERE - -{ .mmb - nop.m 0 - nop.m 0 - br.ret.sptk b0;; -} - -.endp __udivsi3 diff --git a/sys/libkern/ia64/__umoddi3.S b/sys/libkern/ia64/__umoddi3.S deleted file mode 100644 index 98708e4..0000000 --- a/sys/libkern/ia64/__umoddi3.S +++ /dev/null @@ -1,155 +0,0 @@ -.file "__umoddi3.s" - -// $FreeBSD$ - -//- -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -.section .text - - // 64-bit unsigned integer remainder - -.proc __umoddi3# -.align 32 -.global __umoddi3# -.align 32 - -__umoddi3: - -{ .mii - alloc r31=ar.pfs,3,0,0,0 - nop.i 0 - nop.i 0 -} { .mmb - - // 64-BIT UNSIGNED INTEGER REMAINDER BEGINS HERE - - // general register used: - // r32 - 64-bit unsigned integer dividend, called a below - // r33 - 64-bit unsigned integer divisor, called b below - // r8 - 64-bit unsigned integer result - // floating-point registers used: f6, f7, f8, f9, f10, f11, f12 - // predicate registers used: p6 - - setf.sig f12=r32 // holds a in integer form - setf.sig f7=r33 - nop.b 0;; -} { .mfi - // get 2's complement of b - sub r33=r0,r33 - fcvt.xuf.s1 f6=f12 - nop.i 0 -} { .mfi - nop.m 0 - fcvt.xuf.s1 f7=f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (1) - // y0 = 1 / b in f8 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (2) - // q0 = a * y0 in f10 - (p6) fma.s1 f10=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // Step (3) - // e0 = 1 - b * y0 in f9 - (p6) fnma.s1 f9=f7,f8,f1 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (4) - // q1 = q0 + e0 * q0 in f10 - (p6) fma.s1 f10=f9,f10,f10 - nop.i 0 -} { .mfi - nop.m 0 - // Step (5) - // e1 = e0 * e0 in f11 - (p6) fma.s1 f11=f9,f9,f0 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (6) - // y1 = y0 + e0 * y0 in f8 - (p6) fma.s1 f8=f9,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (7) - // q2 = q1 + e1 * q1 in f9 - (p6) fma.s1 f9=f11,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (8) - // y2 = y1 + e1 * y1 in f8 - (p6) fma.s1 f8=f11,f8,f8 - nop.i 0;; -} { .mfi - nop.m 0 - // Step (9) - // r2 = a - b * q2 in f10 - (p6) fnma.s1 f10=f7,f9,f6 - nop.i 0;; -} { .mfi - // f7=-b - setf.sig f7=r33 - // Step (10) - // q3 = q2 + r2 * y2 in f8 - (p6) fma.s1 f8=f10,f8,f9 - nop.i 0;; -} { .mfi - nop.m 0 - // (11) q = trunc(q3) - fcvt.fxu.trunc.s1 f8=f8 - nop.i 0;; -} { .mfi - nop.m 0 - // (12) r = a + (-b) * q - xma.l f8=f8,f7,f12 - nop.i 0;; -} { .mib - getf.sig r8=f8 - nop.i 0 - nop.b 0 -} - - // 64-BIT UNSIGNED INTEGER REMAINDER ENDS HERE - -{ .mib - nop.m 0 - nop.i 0 - br.ret.sptk b0;; -} - -.endp __umoddi3 diff --git a/sys/libkern/ia64/__umodsi3.S b/sys/libkern/ia64/__umodsi3.S deleted file mode 100644 index 7df61a6..0000000 --- a/sys/libkern/ia64/__umodsi3.S +++ /dev/null @@ -1,131 +0,0 @@ -.file "__umodsi3.s" - -// $FreeBSD$ - -//- -// Copyright (c) 2000, Intel Corporation -// All rights reserved. -// -// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache, -// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab, -// Intel Corporation. -// -// WARRANTY DISCLAIMER -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Intel Corporation is the author of this code, and requests that all -// problem reports or change requests be submitted to it directly at -// http://developer.intel.com/opensource. -// - -.section .text - -// 32-bit unsigned integer remainder - -.proc __umodsi3# -.align 32 -.global __umodsi3# -.align 32 - -__umodsi3: - -{ .mii - alloc r31=ar.pfs,2,0,0,0 - nop.i 0 - nop.i 0;; -} { .mii - nop.m 0 - - // 32-BIT UNSIGNED INTEGER REMAINDER BEGINS HERE - - // general register used: - // r32 - 32-bit unsigned integer dividend - // r33 - 32-bit unsigned integer divisor - // r8 - 32-bit unsigned integer result - // r2 - scratch register - // floating-point registers used: f6, f7, f8, f9, f10, f11 - // predicate registers used: p6 - - zxt4 r32=r32 - zxt4 r33=r33;; -} { .mmb - setf.sig f11=r32 - setf.sig f7=r33 - nop.b 0;; -} { .mfi - nop.m 0 - fcvt.xf f6=f11 - nop.i 0 -} { .mfi - // get 2's complement of b - sub r33=r0,r33 - fcvt.xf f7=f7 - mov r2 = 0x0ffdd;; -} { .mfi - setf.exp f9 = r2 - // (1) y0 - frcpa.s1 f8,p6=f6,f7 - nop.i 0;; -} { .mfi - nop.m 0 - // (2) q0 = a * y0 - (p6) fma.s1 f10=f6,f8,f0 - nop.i 0 -} { .mfi - nop.m 0 - // (3) e0 = 1 - b * y0 - (p6) fnma.s1 f8=f7,f8,f1 - nop.i 0;; -} { .mfi - nop.m 0 - // (4) q1 = q0 + e0 * q0 - (p6) fma.s1 f10=f8,f10,f10 - nop.i 0 -} { .mfi - // get 2's complement of b - setf.sig f7=r33 - // (5) e1 = e0 * e0 + 2^-34 - (p6) fma.s1 f8=f8,f8,f9 - nop.i 0;; -} { .mfi - nop.m 0 - // (6) q2 = q1 + e1 * q1 - (p6) fma.s1 f8=f8,f10,f10 - nop.i 0;; -} { .mfi - nop.m 0 - // (7) q = trunc(q2) - fcvt.fxu.trunc.s1 f8=f8 - nop.i 0;; -} { .mfi - nop.m 0 - // (8) r = a + (-b) * q - xma.l f8=f8,f7,f11 - nop.i 0;; -} { .mmi - // remainder will be in the least significant 32 bits of r8 (if b != 0) - getf.sig r8=f8 - nop.m 0 - nop.i 0;; -} - - // 32-BIT UNSIGNED INTEGER REMAINDER ENDS HERE - -{ .mmb - nop.m 0 - nop.m 0 - br.ret.sptk b0;; -} - -.endp __umodsi3 diff --git a/sys/libkern/ia64/bswap16.S b/sys/libkern/ia64/bswap16.S deleted file mode 100644 index d3adc2e..0000000 --- a/sys/libkern/ia64/bswap16.S +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 the - * rights to redistribute these changes. - * - * from: NetBSD: htons.S,v 1.1 1996/04/17 22:36:54 cgd - * from: src/sys/libkern/ia64/htons.S,v 1.2 2002/02/18 20:35:21 - * - * $FreeBSD$ - */ - -#define NAME __bswap16 - -#include <libkern/ia64/byte_swap_2.S> diff --git a/sys/libkern/ia64/bswap32.S b/sys/libkern/ia64/bswap32.S deleted file mode 100644 index c1c76d1..0000000 --- a/sys/libkern/ia64/bswap32.S +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 the - * rights to redistribute these changes. - * - * from: NetBSD: htonl.S,v 1.1 1996/04/17 22:36:52 cgd - * from: src/sys/libkern/ia64/htonl.S,v 1.2 2002/02/18 20:35:21 - * - * $FreeBSD$ - */ - -#define NAME __bswap32 - -#include <libkern/ia64/byte_swap_4.S> diff --git a/sys/libkern/ia64/byte_swap_2.S b/sys/libkern/ia64/byte_swap_2.S deleted file mode 100644 index 74ad5f7..0000000 --- a/sys/libkern/ia64/byte_swap_2.S +++ /dev/null @@ -1,47 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: byte_swap_2.S,v 1.2 1996/10/17 03:08:08 cgd Exp $ */ - -/*- - * Copyright (c) 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 the - * rights to redistribute these changes. - */ - -#include <machine/asm.h> - -#ifndef NAME -#error NAME not defined -#endif - -/* - * Byte-swap a 2-byte quantity. (Convert 0x0123 to 0x2301.) - * - * Argument is an unsigned 2-byte integer (u_int16_t). - */ -ENTRY(NAME, 1) - mux1 r16=in0,@rev - ;; - extr.u r8=r16,48,16 - br.ret.sptk.few rp -END(NAME) diff --git a/sys/libkern/ia64/byte_swap_4.S b/sys/libkern/ia64/byte_swap_4.S deleted file mode 100644 index 9aba08d..0000000 --- a/sys/libkern/ia64/byte_swap_4.S +++ /dev/null @@ -1,47 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: byte_swap_4.S,v 1.2 1996/10/17 03:08:09 cgd Exp $ */ - -/*- - * Copyright (c) 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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 the - * rights to redistribute these changes. - */ - -#include <machine/asm.h> - -#ifndef NAME -#error NAME not defined -#endif - -/* - * Byte-swap a 4-byte quantity. (Convert 0x01234567 to 0x67452301.) - * - * Argument is an unsigned 4-byte integer (u_int32_t). - */ -ENTRY(NAME, 1) - mux1 r16=in0,@rev - ;; - extr.u r8=r16,32,32 - br.ret.sptk.few rp -END(NAME) diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 28a72b7..0a28b2b 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -782,46 +782,6 @@ _cpsw= cpsw _sound= sound .endif -.if ${MACHINE_CPUARCH} == "ia64" -_aac= aac -_aacraid= aacraid -_aic= aic -_an= an -_arcnet= arcnet -_asr= asr -_bktr= bktr -_cardbus= cardbus -_cbb= cbb -_ciss= ciss -_cm= cm -_cmx= cmx -_coff= coff -_cpufreq= cpufreq -_dpt= dpt -_em= em -_ep= ep -_et= et -_exca= exca -_fe= fe -_hptiop= hptiop -_ida= ida -_igb= igb -_iir= iir -_ips= ips -_mly= mly -_pccard= pccard -_scsi_low= scsi_low -_smbfs= smbfs -_sound= sound -_splash= splash -_sppp= sppp -_streams= streams -_tpm= tpm -_twa= twa -_wi= wi -_xe= xe -.endif - .if ${MACHINE_CPUARCH} == "powerpc" _agp= agp _an= an diff --git a/sys/modules/acpi/acpi/Makefile b/sys/modules/acpi/acpi/Makefile index 9cf28b5..5722692 100644 --- a/sys/modules/acpi/acpi/Makefile +++ b/sys/modules/acpi/acpi/Makefile @@ -4,10 +4,6 @@ .error "The ACPI module is deprecated, set FORCE_BUILD to force it" .endif -.if ${MACHINE_CPUARCH} == "ia64" -.error "ACPI can only be compiled into the kernel on the ia64 platform" -.endif - .if ${MACHINE} != "amd64" && ${MACHINE} != "i386" .error "The ACPI module is only for amd64 and i386" .endif diff --git a/sys/modules/hwpmc/Makefile b/sys/modules/hwpmc/Makefile index fd05940..c9c60fc 100644 --- a/sys/modules/hwpmc/Makefile +++ b/sys/modules/hwpmc/Makefile @@ -24,10 +24,6 @@ SRCS+= hwpmc_pentium.c hwpmc_tsc.c hwpmc_x86.c hwpmc_uncore.c SRCS+= device_if.h bus_if.h .endif -.if ${MACHINE_CPUARCH} == "ia64" -SRCS+= hwpmc_ia64.c -.endif - .if ${MACHINE_CPUARCH} == "powerpc" SRCS+= hwpmc_powerpc.c hwpmc_mpc7xxx.c hwpmc_ppc970.c .endif diff --git a/sys/modules/ppc/Makefile b/sys/modules/ppc/Makefile index c097002..53621f1 100644 --- a/sys/modules/ppc/Makefile +++ b/sys/modules/ppc/Makefile @@ -17,8 +17,4 @@ SRCS+= ppc_acpi.c SRCS+= ppc_isa.c .endif -.if ${MACHINE_CPUARCH} == "ia64" -SRCS+= ppc_acpi.c -.endif - .include <bsd.kmod.mk> diff --git a/sys/modules/sound/sound/Makefile b/sys/modules/sound/sound/Makefile index 0db294b..9650adf 100644 --- a/sys/modules/sound/sound/Makefile +++ b/sys/modules/sound/sound/Makefile @@ -45,7 +45,7 @@ CLEANFILES+= feeder_eq_gen.h feeder_rate_gen.h snd_fxdiv_gen.h EXPORT_SYMS= YES # XXX evaluate .if ${MACHINE_CPUARCH} != "i386" && ${MACHINE_CPUARCH} != "amd64" && \ - ${MACHINE_CPUARCH} != "ia64" && ${MACHINE_CPUARCH} != "pc98" + ${MACHINE_CPUARCH} != "pc98" # Create an empty opt_isa.h in order to keep kmod.mk from linking in an # existing one from KERNBUILDDIR which possibly has DEV_ISA defined so # sound.ko is always built without isadma support. diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index c3501e0..80d57c4 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -52,7 +52,7 @@ /* XXX these should be defined per controller (or drive) elsewhere, not here! */ #if defined(__i386__) || defined(__amd64__) || defined(__arm__) || \ - defined(__ia64__) || defined(__powerpc__) || defined(__mips__) + defined(__powerpc__) || defined(__mips__) #define LABELSECTOR 1 /* sector containing label */ #define LABELOFFSET 0 /* offset of label in sector */ #endif diff --git a/sys/sys/efi.h b/sys/sys/efi.h index 749f094..4c5d937 100644 --- a/sys/sys/efi.h +++ b/sys/sys/efi.h @@ -151,27 +151,4 @@ struct efi_systbl { uint64_t st_cfgtbl; }; -#if defined(_KERNEL) && defined(__ia64__) - -typedef u_long (*ia64_efi_f)(u_long, u_long, u_long, u_long); - -u_long ia64_efi_physical(ia64_efi_f, u_long, u_long, u_long, u_long); - -void efi_boot_finish(void); -int efi_boot_minimal(uint64_t); -void *efi_get_table(struct uuid *); -void efi_get_time(struct efi_tm *); -struct efi_md *efi_md_find(vm_paddr_t); -struct efi_md *efi_md_first(void); -struct efi_md *efi_md_last(void); -struct efi_md *efi_md_next(struct efi_md *); -struct efi_md *efi_md_prev(struct efi_md *); -void efi_reset_system(void); -int efi_set_time(struct efi_tm *); -int efi_var_get(efi_char *, struct uuid *, uint32_t *, size_t *, void *); -int efi_var_nextname(size_t *, efi_char *, struct uuid *); -int efi_var_set(efi_char *, struct uuid *, uint32_t, size_t, void *); - -#endif /* _KERNEL && __ia64__ */ - #endif /* _SYS_EFI_H_ */ diff --git a/sys/sys/fnv_hash.h b/sys/sys/fnv_hash.h index c1452a6..901603e 100644 --- a/sys/sys/fnv_hash.h +++ b/sys/sys/fnv_hash.h @@ -60,7 +60,7 @@ static __inline Fnv64_t fnv_64_str(const char *str, Fnv64_t hval) { const u_int8_t *s = (const u_int8_t *)str; - u_register_t c; /* 32 bit on i386, 64 bit on alpha,ia64 */ + u_register_t c; /* 32 bit on i386, 64 bit on alpha */ while ((c = *s++) != 0) { hval *= FNV_64_PRIME; diff --git a/sys/sys/kerneldump.h b/sys/sys/kerneldump.h index 6342f7d..a148736 100644 --- a/sys/sys/kerneldump.h +++ b/sys/sys/kerneldump.h @@ -70,7 +70,6 @@ struct kerneldumpheader { #define KERNELDUMP_AMD64_VERSION 2 #define KERNELDUMP_ARM_VERSION 1 #define KERNELDUMP_I386_VERSION 2 -#define KERNELDUMP_IA64_VERSION 1 #define KERNELDUMP_MIPS_VERSION 1 #define KERNELDUMP_POWERPC_VERSION 1 #define KERNELDUMP_SPARC64_VERSION 1 diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 209e732..21ad521 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -131,7 +131,7 @@ struct ctlname { #define REQ_WIRED 2 /* definitions for sysctl_req 'flags' member */ -#if defined(__amd64__) || defined(__ia64__) || defined(__powerpc64__) ||\ +#if defined(__amd64__) || defined(__powerpc64__) ||\ (defined(__mips__) && defined(__mips_n64)) #define SCTL_MASK32 1 /* 32 bit emulation */ #endif diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index c49db41..0f1c256 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -155,7 +155,7 @@ extern struct sysentvec null_sysvec; extern struct sysent sysent[]; extern const char *syscallnames[]; -#if defined(__amd64__) || defined(__ia64__) +#if defined(__amd64__) extern int i386_read_exec; #endif diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index e94090c..1ae7189 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -487,7 +487,7 @@ ommap(td, uap) nargs.len = uap->len; nargs.prot = cvtbsdprot[uap->prot & 0x7]; #ifdef COMPAT_FREEBSD32 -#if defined(__amd64__) || defined(__ia64__) +#if defined(__amd64__) if (i386_read_exec && SV_PROC_FLAG(td->td_proc, SV_ILP32) && nargs.prot != 0) nargs.prot |= PROT_EXEC; diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 65743d7..264aff4 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -875,14 +875,6 @@ vm_pageout_map_deactivate_pages(map, desired) tmpe = tmpe->next; } -#ifdef __ia64__ - /* - * Remove all non-wired, managed mappings if a process is swapped out. - * This will free page table pages. - */ - if (desired == 0) - pmap_remove_pages(map->pmap); -#else /* * Remove all mappings if a process is swapped out, this will free page * table pages. @@ -891,7 +883,6 @@ vm_pageout_map_deactivate_pages(map, desired) pmap_remove(vm_map_pmap(map), vm_map_min(map), vm_map_max(map)); } -#endif vm_map_unlock(map); } diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c index edb6ecc..de9aa78 100644 --- a/sys/vm/vm_unix.c +++ b/sys/vm/vm_unix.c @@ -162,7 +162,7 @@ sys_obreak(td, uap) #endif prot = VM_PROT_RW; #ifdef COMPAT_FREEBSD32 -#if defined(__amd64__) || defined(__ia64__) +#if defined(__amd64__) if (i386_read_exec && SV_PROC_FLAG(td->td_proc, SV_ILP32)) prot |= VM_PROT_EXECUTE; #endif diff --git a/sys/x86/include/segments.h b/sys/x86/include/segments.h index 0d6a282..a5c1ea4 100644 --- a/sys/x86/include/segments.h +++ b/sys/x86/include/segments.h @@ -219,7 +219,7 @@ union descriptor { #define IDT_DTRACE_RET 0x92 /* DTrace pid provider Interrupt Vector */ #define IDT_EVTCHN 0x93 /* Xen HVM Event Channel Interrupt Vector */ -#if defined(__i386__) || defined(__ia64__) +#if defined(__i386__) /* * Entries in the Global Descriptor Table (GDT) * Note that each 4 entries share a single 32 byte L1 cache line. @@ -264,7 +264,7 @@ union descriptor { #define LBSDICALLS_SEL 16 /* BSDI system call gate */ #define NLDT (LBSDICALLS_SEL + 1) -#else /* !__i386__ && !__ia64__ */ +#else /* !__i386__ */ /* * Entries in the Global Descriptor Table (GDT) */ @@ -282,6 +282,6 @@ union descriptor { #define GUSERLDT_SEL 11 /* LDT */ /* slot 12 is second half of GUSERLDT_SEL */ #define NGDT 13 -#endif /* __i386__ || __ia64__ */ +#endif /* __i386__ */ #endif /* !_X86_SEGMENTS_H_ */ diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c index ce3f284..a71c02f 100644 --- a/sys/x86/iommu/intel_drv.c +++ b/sys/x86/iommu/intel_drv.c @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" -#if defined(__amd64__) /* || defined(__ia64__) */ +#if defined(__amd64__) #define DEV_APIC #else #include "opt_apic.h" diff --git a/sys/xen/interface/arch-ia64.h b/sys/xen/interface/arch-ia64.h deleted file mode 100644 index c9da5d4..0000000 --- a/sys/xen/interface/arch-ia64.h +++ /dev/null @@ -1,637 +0,0 @@ -/****************************************************************************** - * arch-ia64/hypervisor-if.h - * - * Guest OS interface to IA64 Xen. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - */ - -#include "xen.h" - -#ifndef __HYPERVISOR_IF_IA64_H__ -#define __HYPERVISOR_IF_IA64_H__ - -#if !defined(__GNUC__) || defined(__STRICT_ANSI__) -#error "Anonymous structs/unions are a GNU extension." -#endif - -/* Structural guest handles introduced in 0x00030201. */ -#if __XEN_INTERFACE_VERSION__ >= 0x00030201 -#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \ - typedef struct { type *p; } __guest_handle_ ## name -#else -#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \ - typedef type * __guest_handle_ ## name -#endif - -#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ - ___DEFINE_XEN_GUEST_HANDLE(name, type); \ - ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type) - -#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) -#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name -#define XEN_GUEST_HANDLE_64(name) XEN_GUEST_HANDLE(name) -#define uint64_aligned_t uint64_t -#define set_xen_guest_handle_raw(hnd, val) do { (hnd).p = val; } while (0) -#ifdef __XEN_TOOLS__ -#define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0) -#endif -#define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val) - -#ifndef __ASSEMBLY__ -typedef unsigned long xen_pfn_t; -#define PRI_xen_pfn "lx" -#endif - -/* Arch specific VIRQs definition */ -#define VIRQ_ITC VIRQ_ARCH_0 /* V. Virtual itc timer */ -#define VIRQ_MCA_CMC VIRQ_ARCH_1 /* MCA cmc interrupt */ -#define VIRQ_MCA_CPE VIRQ_ARCH_2 /* MCA cpe interrupt */ - -/* Maximum number of virtual CPUs in multi-processor guests. */ -/* WARNING: before changing this, check that shared_info fits on a page */ -#define XEN_LEGACY_MAX_VCPUS 64 - -/* IO ports location for PV. */ -#define IO_PORTS_PADDR 0x00000ffffc000000UL -#define IO_PORTS_SIZE 0x0000000004000000UL - -#ifndef __ASSEMBLY__ - -typedef unsigned long xen_ulong_t; - -#ifdef __XEN_TOOLS__ -#define XEN_PAGE_SIZE XC_PAGE_SIZE -#else -#define XEN_PAGE_SIZE PAGE_SIZE -#endif - -#define INVALID_MFN (~0UL) - -struct pt_fpreg { - union { - unsigned long bits[2]; - long double __dummy; /* force 16-byte alignment */ - } u; -}; - -union vac { - unsigned long value; - struct { - int a_int:1; - int a_from_int_cr:1; - int a_to_int_cr:1; - int a_from_psr:1; - int a_from_cpuid:1; - int a_cover:1; - int a_bsw:1; - long reserved:57; - }; -}; -typedef union vac vac_t; - -union vdc { - unsigned long value; - struct { - int d_vmsw:1; - int d_extint:1; - int d_ibr_dbr:1; - int d_pmc:1; - int d_to_pmd:1; - int d_itm:1; - long reserved:58; - }; -}; -typedef union vdc vdc_t; - -struct mapped_regs { - union vac vac; - union vdc vdc; - unsigned long virt_env_vaddr; - unsigned long reserved1[29]; - unsigned long vhpi; - unsigned long reserved2[95]; - union { - unsigned long vgr[16]; - unsigned long bank1_regs[16]; // bank1 regs (r16-r31) when bank0 active - }; - union { - unsigned long vbgr[16]; - unsigned long bank0_regs[16]; // bank0 regs (r16-r31) when bank1 active - }; - unsigned long vnat; - unsigned long vbnat; - unsigned long vcpuid[5]; - unsigned long reserved3[11]; - unsigned long vpsr; - unsigned long vpr; - unsigned long reserved4[76]; - union { - unsigned long vcr[128]; - struct { - unsigned long dcr; // CR0 - unsigned long itm; - unsigned long iva; - unsigned long rsv1[5]; - unsigned long pta; // CR8 - unsigned long rsv2[7]; - unsigned long ipsr; // CR16 - unsigned long isr; - unsigned long rsv3; - unsigned long iip; - unsigned long ifa; - unsigned long itir; - unsigned long iipa; - unsigned long ifs; - unsigned long iim; // CR24 - unsigned long iha; - unsigned long rsv4[38]; - unsigned long lid; // CR64 - unsigned long ivr; - unsigned long tpr; - unsigned long eoi; - unsigned long irr[4]; - unsigned long itv; // CR72 - unsigned long pmv; - unsigned long cmcv; - unsigned long rsv5[5]; - unsigned long lrr0; // CR80 - unsigned long lrr1; - unsigned long rsv6[46]; - }; - }; - union { - unsigned long reserved5[128]; - struct { - unsigned long precover_ifs; - unsigned long unat; // not sure if this is needed until NaT arch is done - int interrupt_collection_enabled; // virtual psr.ic - /* virtual interrupt deliverable flag is evtchn_upcall_mask in - * shared info area now. interrupt_mask_addr is the address - * of evtchn_upcall_mask for current vcpu - */ - unsigned char *interrupt_mask_addr; - int pending_interruption; - unsigned char vpsr_pp; - unsigned char vpsr_dfh; - unsigned char hpsr_dfh; - unsigned char hpsr_mfh; - unsigned long reserved5_1[4]; - int metaphysical_mode; // 1 = use metaphys mapping, 0 = use virtual - int banknum; // 0 or 1, which virtual register bank is active - unsigned long rrs[8]; // region registers - unsigned long krs[8]; // kernel registers - unsigned long tmp[16]; // temp registers (e.g. for hyperprivops) - - /* itc paravirtualization - * vAR.ITC = mAR.ITC + itc_offset - * itc_last is one which was lastly passed to - * the guest OS in order to prevent it from - * going backwords. - */ - unsigned long itc_offset; - unsigned long itc_last; - }; - }; -}; -typedef struct mapped_regs mapped_regs_t; - -struct vpd { - struct mapped_regs vpd_low; - unsigned long reserved6[3456]; - unsigned long vmm_avail[128]; - unsigned long reserved7[4096]; -}; -typedef struct vpd vpd_t; - -struct arch_vcpu_info { -}; -typedef struct arch_vcpu_info arch_vcpu_info_t; - -/* - * This structure is used for magic page in domain pseudo physical address - * space and the result of XENMEM_machine_memory_map. - * As the XENMEM_machine_memory_map result, - * xen_memory_map::nr_entries indicates the size in bytes - * including struct xen_ia64_memmap_info. Not the number of entries. - */ -struct xen_ia64_memmap_info { - uint64_t efi_memmap_size; /* size of EFI memory map */ - uint64_t efi_memdesc_size; /* size of an EFI memory map descriptor */ - uint32_t efi_memdesc_version; /* memory descriptor version */ - void *memdesc[0]; /* array of efi_memory_desc_t */ -}; -typedef struct xen_ia64_memmap_info xen_ia64_memmap_info_t; - -struct arch_shared_info { - /* PFN of the start_info page. */ - unsigned long start_info_pfn; - - /* Interrupt vector for event channel. */ - int evtchn_vector; - - /* PFN of memmap_info page */ - unsigned int memmap_info_num_pages;/* currently only = 1 case is - supported. */ - unsigned long memmap_info_pfn; - - uint64_t pad[31]; -}; -typedef struct arch_shared_info arch_shared_info_t; - -typedef unsigned long xen_callback_t; - -struct ia64_tr_entry { - unsigned long pte; - unsigned long itir; - unsigned long vadr; - unsigned long rid; -}; -typedef struct ia64_tr_entry ia64_tr_entry_t; -DEFINE_XEN_GUEST_HANDLE(ia64_tr_entry_t); - -struct vcpu_tr_regs { - struct ia64_tr_entry itrs[12]; - struct ia64_tr_entry dtrs[12]; -}; - -union vcpu_ar_regs { - unsigned long ar[128]; - struct { - unsigned long kr[8]; - unsigned long rsv1[8]; - unsigned long rsc; - unsigned long bsp; - unsigned long bspstore; - unsigned long rnat; - unsigned long rsv2; - unsigned long fcr; - unsigned long rsv3[2]; - unsigned long eflag; - unsigned long csd; - unsigned long ssd; - unsigned long cflg; - unsigned long fsr; - unsigned long fir; - unsigned long fdr; - unsigned long rsv4; - unsigned long ccv; /* 32 */ - unsigned long rsv5[3]; - unsigned long unat; - unsigned long rsv6[3]; - unsigned long fpsr; - unsigned long rsv7[3]; - unsigned long itc; - unsigned long rsv8[3]; - unsigned long ign1[16]; - unsigned long pfs; /* 64 */ - unsigned long lc; - unsigned long ec; - unsigned long rsv9[45]; - unsigned long ign2[16]; - }; -}; - -union vcpu_cr_regs { - unsigned long cr[128]; - struct { - unsigned long dcr; // CR0 - unsigned long itm; - unsigned long iva; - unsigned long rsv1[5]; - unsigned long pta; // CR8 - unsigned long rsv2[7]; - unsigned long ipsr; // CR16 - unsigned long isr; - unsigned long rsv3; - unsigned long iip; - unsigned long ifa; - unsigned long itir; - unsigned long iipa; - unsigned long ifs; - unsigned long iim; // CR24 - unsigned long iha; - unsigned long rsv4[38]; - unsigned long lid; // CR64 - unsigned long ivr; - unsigned long tpr; - unsigned long eoi; - unsigned long irr[4]; - unsigned long itv; // CR72 - unsigned long pmv; - unsigned long cmcv; - unsigned long rsv5[5]; - unsigned long lrr0; // CR80 - unsigned long lrr1; - unsigned long rsv6[46]; - }; -}; - -struct vcpu_guest_context_regs { - unsigned long r[32]; - unsigned long b[8]; - unsigned long bank[16]; - unsigned long ip; - unsigned long psr; - unsigned long cfm; - unsigned long pr; - unsigned int nats; /* NaT bits for r1-r31. */ - unsigned int bnats; /* Nat bits for banked registers. */ - union vcpu_ar_regs ar; - union vcpu_cr_regs cr; - struct pt_fpreg f[128]; - unsigned long dbr[8]; - unsigned long ibr[8]; - unsigned long rr[8]; - unsigned long pkr[16]; - - /* FIXME: cpuid,pmd,pmc */ - - unsigned long xip; - unsigned long xpsr; - unsigned long xfs; - unsigned long xr[4]; - - struct vcpu_tr_regs tr; - - /* Physical registers in case of debug event. */ - unsigned long excp_iipa; - unsigned long excp_ifa; - unsigned long excp_isr; - unsigned int excp_vector; - - /* - * The rbs is intended to be the image of the stacked registers still - * in the cpu (not yet stored in memory). It is laid out as if it - * were written in memory at a 512 (64*8) aligned address + offset. - * rbs_voff is (offset / 8). rbs_nat contains NaT bits for the - * remaining rbs registers. rbs_rnat contains NaT bits for in memory - * rbs registers. - * Note: loadrs is 2**14 bytes == 2**11 slots. - */ - unsigned int rbs_voff; - unsigned long rbs[2048]; - unsigned long rbs_rnat; - - /* - * RSE.N_STACKED_PHYS via PAL_RSE_INFO - * Strictly this isn't cpu context, but this value is necessary - * for domain save/restore. So is here. - */ - unsigned long num_phys_stacked; -}; - -struct vcpu_guest_context { -#define VGCF_EXTRA_REGS (1UL << 1) /* Set extra regs. */ -#define VGCF_SET_CR_IRR (1UL << 2) /* Set cr_irr[0:3]. */ -#define VGCF_online (1UL << 3) /* make this vcpu online */ -#define VGCF_SET_AR_ITC (1UL << 4) /* set pv ar.itc. itc_offset, itc_last */ - unsigned long flags; /* VGCF_* flags */ - - struct vcpu_guest_context_regs regs; - - unsigned long event_callback_ip; - - /* xen doesn't share privregs pages with hvm domain so that this member - * doesn't make sense for hvm domain. - * ~0UL is already used for INVALID_P2M_ENTRY. */ -#define VGC_PRIVREGS_HVM (~(-2UL)) - unsigned long privregs_pfn; -}; -typedef struct vcpu_guest_context vcpu_guest_context_t; -DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t); - -/* dom0 vp op */ -#define __HYPERVISOR_ia64_dom0vp_op __HYPERVISOR_arch_0 -/* Map io space in machine address to dom0 physical address space. - Currently physical assigned address equals to machine address. */ -#define IA64_DOM0VP_ioremap 0 - -/* Convert a pseudo physical page frame number to the corresponding - machine page frame number. If no page is assigned, INVALID_MFN or - GPFN_INV_MASK is returned depending on domain's non-vti/vti mode. */ -#define IA64_DOM0VP_phystomach 1 - -/* Convert a machine page frame number to the corresponding pseudo physical - page frame number of the caller domain. */ -#define IA64_DOM0VP_machtophys 3 - -/* Reserved for future use. */ -#define IA64_DOM0VP_iounmap 4 - -/* Unmap and free pages contained in the specified pseudo physical region. */ -#define IA64_DOM0VP_zap_physmap 5 - -/* Assign machine page frame to dom0's pseudo physical address space. */ -#define IA64_DOM0VP_add_physmap 6 - -/* expose the p2m table into domain */ -#define IA64_DOM0VP_expose_p2m 7 - -/* xen perfmon */ -#define IA64_DOM0VP_perfmon 8 - -/* gmfn version of IA64_DOM0VP_add_physmap */ -#define IA64_DOM0VP_add_physmap_with_gmfn 9 - -/* get fpswa revision */ -#define IA64_DOM0VP_fpswa_revision 10 - -/* Add an I/O port space range */ -#define IA64_DOM0VP_add_io_space 11 - -/* expose the foreign domain's p2m table into privileged domain */ -#define IA64_DOM0VP_expose_foreign_p2m 12 -#define IA64_DOM0VP_EFP_ALLOC_PTE 0x1 /* allocate p2m table */ - -/* unexpose the foreign domain's p2m table into privileged domain */ -#define IA64_DOM0VP_unexpose_foreign_p2m 13 - -/* get memmap_info and memmap. It is possible to map the page directly - by foreign page mapping, but there is a race between writer. - This hypercall avoids such race. */ -#define IA64_DOM0VP_get_memmap 14 - -// flags for page assignement to pseudo physical address space -#define _ASSIGN_readonly 0 -#define ASSIGN_readonly (1UL << _ASSIGN_readonly) -#define ASSIGN_writable (0UL << _ASSIGN_readonly) // dummy flag -/* Internal only: memory attribute must be WC/UC/UCE. */ -#define _ASSIGN_nocache 1 -#define ASSIGN_nocache (1UL << _ASSIGN_nocache) -// tlb tracking -#define _ASSIGN_tlb_track 2 -#define ASSIGN_tlb_track (1UL << _ASSIGN_tlb_track) -/* Internal only: associated with PGC_allocated bit */ -#define _ASSIGN_pgc_allocated 3 -#define ASSIGN_pgc_allocated (1UL << _ASSIGN_pgc_allocated) -/* Page is an IO page. */ -#define _ASSIGN_io 4 -#define ASSIGN_io (1UL << _ASSIGN_io) - -/* This structure has the same layout of struct ia64_boot_param, defined in - <asm/system.h>. It is redefined here to ease use. */ -struct xen_ia64_boot_param { - unsigned long command_line; /* physical address of cmd line args */ - unsigned long efi_systab; /* physical address of EFI system table */ - unsigned long efi_memmap; /* physical address of EFI memory map */ - unsigned long efi_memmap_size; /* size of EFI memory map */ - unsigned long efi_memdesc_size; /* size of an EFI memory map descriptor */ - unsigned int efi_memdesc_version; /* memory descriptor version */ - struct { - unsigned short num_cols; /* number of columns on console. */ - unsigned short num_rows; /* number of rows on console. */ - unsigned short orig_x; /* cursor's x position */ - unsigned short orig_y; /* cursor's y position */ - } console_info; - unsigned long fpswa; /* physical address of the fpswa interface */ - unsigned long initrd_start; - unsigned long initrd_size; - unsigned long domain_start; /* va where the boot time domain begins */ - unsigned long domain_size; /* how big is the boot domain */ -}; - -#endif /* !__ASSEMBLY__ */ - -/* Size of the shared_info area (this is not related to page size). */ -#define XSI_SHIFT 14 -#define XSI_SIZE (1 << XSI_SHIFT) -/* Log size of mapped_regs area (64 KB - only 4KB is used). */ -#define XMAPPEDREGS_SHIFT 12 -#define XMAPPEDREGS_SIZE (1 << XMAPPEDREGS_SHIFT) -/* Offset of XASI (Xen arch shared info) wrt XSI_BASE. */ -#define XMAPPEDREGS_OFS XSI_SIZE - -/* Hyperprivops. */ -#define HYPERPRIVOP_START 0x1 -#define HYPERPRIVOP_RFI (HYPERPRIVOP_START + 0x0) -#define HYPERPRIVOP_RSM_DT (HYPERPRIVOP_START + 0x1) -#define HYPERPRIVOP_SSM_DT (HYPERPRIVOP_START + 0x2) -#define HYPERPRIVOP_COVER (HYPERPRIVOP_START + 0x3) -#define HYPERPRIVOP_ITC_D (HYPERPRIVOP_START + 0x4) -#define HYPERPRIVOP_ITC_I (HYPERPRIVOP_START + 0x5) -#define HYPERPRIVOP_SSM_I (HYPERPRIVOP_START + 0x6) -#define HYPERPRIVOP_GET_IVR (HYPERPRIVOP_START + 0x7) -#define HYPERPRIVOP_GET_TPR (HYPERPRIVOP_START + 0x8) -#define HYPERPRIVOP_SET_TPR (HYPERPRIVOP_START + 0x9) -#define HYPERPRIVOP_EOI (HYPERPRIVOP_START + 0xa) -#define HYPERPRIVOP_SET_ITM (HYPERPRIVOP_START + 0xb) -#define HYPERPRIVOP_THASH (HYPERPRIVOP_START + 0xc) -#define HYPERPRIVOP_PTC_GA (HYPERPRIVOP_START + 0xd) -#define HYPERPRIVOP_ITR_D (HYPERPRIVOP_START + 0xe) -#define HYPERPRIVOP_GET_RR (HYPERPRIVOP_START + 0xf) -#define HYPERPRIVOP_SET_RR (HYPERPRIVOP_START + 0x10) -#define HYPERPRIVOP_SET_KR (HYPERPRIVOP_START + 0x11) -#define HYPERPRIVOP_FC (HYPERPRIVOP_START + 0x12) -#define HYPERPRIVOP_GET_CPUID (HYPERPRIVOP_START + 0x13) -#define HYPERPRIVOP_GET_PMD (HYPERPRIVOP_START + 0x14) -#define HYPERPRIVOP_GET_EFLAG (HYPERPRIVOP_START + 0x15) -#define HYPERPRIVOP_SET_EFLAG (HYPERPRIVOP_START + 0x16) -#define HYPERPRIVOP_RSM_BE (HYPERPRIVOP_START + 0x17) -#define HYPERPRIVOP_GET_PSR (HYPERPRIVOP_START + 0x18) -#define HYPERPRIVOP_SET_RR0_TO_RR4 (HYPERPRIVOP_START + 0x19) -#define HYPERPRIVOP_MAX (0x1a) - -/* Fast and light hypercalls. */ -#define __HYPERVISOR_ia64_fast_eoi __HYPERVISOR_arch_1 - -/* Extra debug features. */ -#define __HYPERVISOR_ia64_debug_op __HYPERVISOR_arch_2 - -/* Xencomm macros. */ -#define XENCOMM_INLINE_MASK 0xf800000000000000UL -#define XENCOMM_INLINE_FLAG 0x8000000000000000UL - -#ifndef __ASSEMBLY__ - -/* - * Optimization features. - * The hypervisor may do some special optimizations for guests. This hypercall - * can be used to switch on/of these special optimizations. - */ -#define __HYPERVISOR_opt_feature 0x700UL - -#define XEN_IA64_OPTF_OFF 0x0 -#define XEN_IA64_OPTF_ON 0x1 - -/* - * If this feature is switched on, the hypervisor inserts the - * tlb entries without calling the guests traphandler. - * This is useful in guests using region 7 for identity mapping - * like the linux kernel does. - */ -#define XEN_IA64_OPTF_IDENT_MAP_REG7 1 - -/* Identity mapping of region 4 addresses in HVM. */ -#define XEN_IA64_OPTF_IDENT_MAP_REG4 2 - -/* Identity mapping of region 5 addresses in HVM. */ -#define XEN_IA64_OPTF_IDENT_MAP_REG5 3 - -#define XEN_IA64_OPTF_IDENT_MAP_NOT_SET (0) - -struct xen_ia64_opt_feature { - unsigned long cmd; /* Which feature */ - unsigned char on; /* Switch feature on/off */ - union { - struct { - /* The page protection bit mask of the pte. - * This will be or'ed with the pte. */ - unsigned long pgprot; - unsigned long key; /* A protection key for itir. */ - }; - }; -}; - -#endif /* __ASSEMBLY__ */ - -/* xen perfmon */ -#ifdef XEN -#ifndef __ASSEMBLY__ -#ifndef _ASM_IA64_PERFMON_H - -#include <xen/list.h> // asm/perfmon.h requires struct list_head -#include <asm/perfmon.h> -// for PFM_xxx and pfarg_features_t, pfarg_context_t, pfarg_reg_t, pfarg_load_t - -#endif /* _ASM_IA64_PERFMON_H */ - -DEFINE_XEN_GUEST_HANDLE(pfarg_features_t); -DEFINE_XEN_GUEST_HANDLE(pfarg_context_t); -DEFINE_XEN_GUEST_HANDLE(pfarg_reg_t); -DEFINE_XEN_GUEST_HANDLE(pfarg_load_t); -#endif /* __ASSEMBLY__ */ -#endif /* XEN */ - -#ifndef __ASSEMBLY__ -#include "arch-ia64/hvm/memmap.h" -#endif - -#endif /* __HYPERVISOR_IF_IA64_H__ */ - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/sys/xen/interface/arch-ia64/debug_op.h b/sys/xen/interface/arch-ia64/debug_op.h deleted file mode 100644 index 8f47358..0000000 --- a/sys/xen/interface/arch-ia64/debug_op.h +++ /dev/null @@ -1,99 +0,0 @@ -/****************************************************************************** - * debug_op.h - * - * Copyright (c) 2007 Tristan Gingold <tgingold@free.fr> - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef __XEN_PUBLIC_IA64_DEBUG_OP_H__ -#define __XEN_PUBLIC_IA64_DEBUG_OP_H__ - -/* Set/Get extra conditions to break. */ -#define XEN_IA64_DEBUG_OP_SET_FLAGS 1 -#define XEN_IA64_DEBUG_OP_GET_FLAGS 2 - -/* Break on kernel single step. */ -#define XEN_IA64_DEBUG_ON_KERN_SSTEP (1 << 0) - -/* Break on kernel debug (breakpoint or watch point). */ -#define XEN_IA64_DEBUG_ON_KERN_DEBUG (1 << 1) - -/* Break on kernel taken branch. */ -#define XEN_IA64_DEBUG_ON_KERN_TBRANCH (1 << 2) - -/* Break on interrupt injection. */ -#define XEN_IA64_DEBUG_ON_EXTINT (1 << 3) - -/* Break on interrupt injection. */ -#define XEN_IA64_DEBUG_ON_EXCEPT (1 << 4) - -/* Break on event injection. */ -#define XEN_IA64_DEBUG_ON_EVENT (1 << 5) - -/* Break on privop/virtualized instruction (slow path only). */ -#define XEN_IA64_DEBUG_ON_PRIVOP (1 << 6) - -/* Break on emulated PAL call (at entry). */ -#define XEN_IA64_DEBUG_ON_PAL (1 << 7) - -/* Break on emulated SAL call (at entry). */ -#define XEN_IA64_DEBUG_ON_SAL (1 << 8) - -/* Break on emulated EFI call (at entry). */ -#define XEN_IA64_DEBUG_ON_EFI (1 << 9) - -/* Break on rfi emulation (slow path only, before exec). */ -#define XEN_IA64_DEBUG_ON_RFI (1 << 10) - -/* Break on address translation switch. */ -#define XEN_IA64_DEBUG_ON_MMU (1 << 11) - -/* Break on bad guest physical address. */ -#define XEN_IA64_DEBUG_ON_BAD_MPA (1 << 12) - -/* Force psr.ss bit. */ -#define XEN_IA64_DEBUG_FORCE_SS (1 << 13) - -/* Force psr.db bit. */ -#define XEN_IA64_DEBUG_FORCE_DB (1 << 14) - -/* Break on ITR/PTR. */ -#define XEN_IA64_DEBUG_ON_TR (1 << 15) - -/* Break on ITC/PTC.L/PTC.G/PTC.GA. */ -#define XEN_IA64_DEBUG_ON_TC (1 << 16) - -/* Get translation cache. */ -#define XEN_IA64_DEBUG_OP_GET_TC 3 - -/* Translate virtual address to guest physical address. */ -#define XEN_IA64_DEBUG_OP_TRANSLATE 4 - -union xen_ia64_debug_op { - uint64_t flags; - struct xen_ia64_debug_vtlb { - uint64_t nbr; /* IN/OUT */ - XEN_GUEST_HANDLE_64(ia64_tr_entry_t) tr; /* IN/OUT */ - } vtlb; -}; -typedef union xen_ia64_debug_op xen_ia64_debug_op_t; -DEFINE_XEN_GUEST_HANDLE(xen_ia64_debug_op_t); - -#endif /* __XEN_PUBLIC_IA64_DEBUG_OP_H__ */ diff --git a/sys/xen/interface/arch-ia64/hvm/memmap.h b/sys/xen/interface/arch-ia64/hvm/memmap.h deleted file mode 100644 index 68d14f3..0000000 --- a/sys/xen/interface/arch-ia64/hvm/memmap.h +++ /dev/null @@ -1,91 +0,0 @@ -/****************************************************************************** - * memmap.h - * - * Copyright (c) 2008 Tristan Gingold <tgingold AT free fr> - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef __XEN_PUBLIC_HVM_MEMMAP_IA64_H__ -#define __XEN_PUBLIC_HVM_MEMMAP_IA64_H__ - -#define MEM_G (1UL << 30) -#define MEM_M (1UL << 20) -#define MEM_K (1UL << 10) - -/* Guest physical address of IO ports space. */ -#define MMIO_START (3 * MEM_G) -#define MMIO_SIZE (512 * MEM_M) - -#define VGA_IO_START 0xA0000UL -#define VGA_IO_SIZE 0x20000 - -#define LEGACY_IO_START (MMIO_START + MMIO_SIZE) -#define LEGACY_IO_SIZE (64 * MEM_M) - -#define IO_PAGE_START (LEGACY_IO_START + LEGACY_IO_SIZE) -#define IO_PAGE_SIZE XEN_PAGE_SIZE - -#define STORE_PAGE_START (IO_PAGE_START + IO_PAGE_SIZE) -#define STORE_PAGE_SIZE XEN_PAGE_SIZE - -#define BUFFER_IO_PAGE_START (STORE_PAGE_START + STORE_PAGE_SIZE) -#define BUFFER_IO_PAGE_SIZE XEN_PAGE_SIZE - -#define BUFFER_PIO_PAGE_START (BUFFER_IO_PAGE_START + BUFFER_IO_PAGE_SIZE) -#define BUFFER_PIO_PAGE_SIZE XEN_PAGE_SIZE - -#define IO_SAPIC_START 0xfec00000UL -#define IO_SAPIC_SIZE 0x100000 - -#define PIB_START 0xfee00000UL -#define PIB_SIZE 0x200000 - -#define GFW_START (4 * MEM_G - 16 * MEM_M) -#define GFW_SIZE (16 * MEM_M) - -/* domVTI */ -#define GPFN_FRAME_BUFFER 0x1 /* VGA framebuffer */ -#define GPFN_LOW_MMIO 0x2 /* Low MMIO range */ -#define GPFN_PIB 0x3 /* PIB base */ -#define GPFN_IOSAPIC 0x4 /* IOSAPIC base */ -#define GPFN_LEGACY_IO 0x5 /* Legacy I/O base */ -#define GPFN_HIGH_MMIO 0x6 /* High MMIO range */ - -/* Nvram belongs to GFW memory space */ -#define NVRAM_SIZE (MEM_K * 64) -#define NVRAM_START (GFW_START + 10 * MEM_M) - -#define NVRAM_VALID_SIG 0x4650494e45584948 /* "HIXENIPF" */ -struct nvram_save_addr { - unsigned long addr; - unsigned long signature; -}; - -#endif /* __XEN_PUBLIC_HVM_MEMMAP_IA64_H__ */ - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/sys/xen/interface/arch-ia64/hvm/save.h b/sys/xen/interface/arch-ia64/hvm/save.h deleted file mode 100644 index c44e913..0000000 --- a/sys/xen/interface/arch-ia64/hvm/save.h +++ /dev/null @@ -1,208 +0,0 @@ -/****************************************************************************** - * save_types.h - * - * Copyright (c) 2007 Isaku Yamahata <yamahata at valinux co jp> - * VA Linux Systems Japan K.K. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef __XEN_PUBLIC_HVM_SAVE_IA64_H__ -#define __XEN_PUBLIC_HVM_SAVE_IA64_H__ - -#include "../../hvm/save.h" -#include "../../arch-ia64.h" - -/* - * Save/restore header: general info about the save file. - */ - -/* x86 uses 0x54381286 */ -#define HVM_FILE_MAGIC 0x343641492f6e6558UL /* "Xen/IA64" */ -#define HVM_FILE_VERSION 0x0000000000000001UL - -struct hvm_save_header { - uint64_t magic; /* Must be HVM_FILE_MAGIC */ - uint64_t version; /* File format version */ - uint64_t changeset; /* Version of Xen that saved this file */ - uint64_t cpuid[5]; /* CPUID[0x01][%eax] on the saving machine */ -}; - -DECLARE_HVM_SAVE_TYPE(HEADER, 1, struct hvm_save_header); - -/* - * CPU - */ -struct hvm_hw_ia64_cpu { - uint64_t ipsr; -}; -DECLARE_HVM_SAVE_TYPE(CPU, 2, struct hvm_hw_ia64_cpu); - -/* - * CPU - */ -struct hvm_hw_ia64_vpd { - struct vpd vpd; -}; -DECLARE_HVM_SAVE_TYPE(VPD, 3, struct hvm_hw_ia64_vpd); - -/* - * device dependency - * vacpi => viosapic => vlsapic - */ -/* - * vlsapic - */ -struct hvm_hw_ia64_vlsapic { - uint64_t insvc[4]; - uint64_t vhpi; // ??? should this be saved in vpd - uint8_t xtp; - uint8_t pal_init_pending; - uint8_t pad[2]; -}; -DECLARE_HVM_SAVE_TYPE(VLSAPIC, 4, struct hvm_hw_ia64_vlsapic); -/* set - * unconditionaly set v->arch.irq_new_peding = 1 - * unconditionaly set v->arch.irq_new_condition = 0 - */ - -/* - * vtime - */ -/* itc, itm, itv are saved by arch vcpu context */ -struct hvm_hw_ia64_vtime { - uint64_t itc; - uint64_t itm; - - uint64_t last_itc; - uint64_t pending; -}; -DECLARE_HVM_SAVE_TYPE(VTIME, 5, struct hvm_hw_ia64_vtime); -/* - * calculate v->vtm.vtm_offset - * ??? Or should vtm_offset be set by leave_hypervisor_tail()? - * start vtm_timer if necessary by vtm_set_itm(). - * ??? Or should vtm_timer be set by leave_hypervisor_tail()? - * - * ??? or should be done by schedule_tail() - * => schedule_tail() should do. - */ - -/* - * viosapic - */ -#define VIOSAPIC_NUM_PINS 48 - -/* To share VT-d code which uses vioapic_redir_entry. - * Although on ia64 this is for vsapic, but we have to vioapic_redir_entry - * instead of viosapic_redir_entry. - */ -union vioapic_redir_entry -{ - uint64_t bits; - struct { - uint8_t vector; - - uint8_t delivery_mode : 3; - uint8_t reserve1 : 1; - uint8_t delivery_status: 1; - uint8_t polarity : 1; - uint8_t reserve2 : 1; - uint8_t trig_mode : 1; - - uint8_t mask : 1; - uint8_t reserve3 : 7; - - uint8_t reserved[3]; - uint16_t dest_id; - } fields; -}; - -struct hvm_hw_ia64_viosapic { - uint64_t irr; - uint64_t isr; - uint32_t ioregsel; - uint32_t pad; - uint64_t lowest_vcpu_id; - uint64_t base_address; - union vioapic_redir_entry redirtbl[VIOSAPIC_NUM_PINS]; -}; -DECLARE_HVM_SAVE_TYPE(VIOSAPIC, 6, struct hvm_hw_ia64_viosapic); - -/* - * vacpi - * PM timer - */ -struct vacpi_regs { - union { - struct { - uint32_t pm1a_sts:16;/* PM1a_EVT_BLK.PM1a_STS: status register */ - uint32_t pm1a_en:16; /* PM1a_EVT_BLK.PM1a_EN: enable register */ - }; - uint32_t evt_blk; - }; - uint32_t tmr_val; /* PM_TMR_BLK.TMR_VAL: 32bit free-running counter */ -}; - -struct hvm_hw_ia64_vacpi { - struct vacpi_regs regs; -}; -DECLARE_HVM_SAVE_TYPE(VACPI, 7, struct hvm_hw_ia64_vacpi); -/* update last_gtime and setup timer of struct vacpi */ - -/* - * opt_feature: identity mapping of region 4, 5 and 7. - * With the c/s 16396:d2935f9c217f of xen-ia64-devel.hg, - * opt_feature hypercall supports only region 4,5,7 identity mappings. - * structure hvm_hw_ia64_identity_mappings only supports them. - * The new structure, struct hvm_hw_ia64_identity_mappings, is created to - * avoid to keep up with change of the xen/ia64 internal structure, struct - * opt_feature. - * - * If it is enhanced in the future, new structure will be created. - */ -struct hvm_hw_ia64_identity_mapping { - uint64_t on; /* on/off */ - uint64_t pgprot; /* The page protection bit mask of the pte. */ - uint64_t key; /* A protection key. */ -}; - -struct hvm_hw_ia64_identity_mappings { - struct hvm_hw_ia64_identity_mapping im_reg4;/* Region 4 identity mapping */ - struct hvm_hw_ia64_identity_mapping im_reg5;/* Region 5 identity mapping */ - struct hvm_hw_ia64_identity_mapping im_reg7;/* Region 7 identity mapping */ -}; -DECLARE_HVM_SAVE_TYPE(OPT_FEATURE_IDENTITY_MAPPINGS, 8, struct hvm_hw_ia64_identity_mappings); - -/* - * Largest type-code in use - */ -#define HVM_SAVE_CODE_MAX 8 - -#endif /* __XEN_PUBLIC_HVM_SAVE_IA64_H__ */ - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/sys/xen/interface/arch-ia64/sioemu.h b/sys/xen/interface/arch-ia64/sioemu.h deleted file mode 100644 index d48da1a..0000000 --- a/sys/xen/interface/arch-ia64/sioemu.h +++ /dev/null @@ -1,92 +0,0 @@ -/****************************************************************************** - * sioemu.h - * - * Copyright (c) 2008 Tristan Gingold <tgingold@free.fr> - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef __XEN_PUBLIC_IA64_SIOEMU_H__ -#define __XEN_PUBLIC_IA64_SIOEMU_H__ - -/* SIOEMU specific hypercalls. - The numbers are the minor part of FW_HYPERCALL_SIOEMU. */ - -/* Defines the callback entry point. r8=ip, r9=data. - Must be called per-vcpu. */ -#define SIOEMU_HYPERCALL_SET_CALLBACK 0x01 - -/* Finish sioemu fw initialization and start firmware. r8=ip. */ -#define SIOEMU_HYPERCALL_START_FW 0x02 - -/* Add IO pages in physmap. */ -#define SIOEMU_HYPERCALL_ADD_IO_PHYSMAP 0x03 - -/* Get wallclock time. */ -#define SIOEMU_HYPERCALL_GET_TIME 0x04 - -/* Flush cache. */ -#define SIOEMU_HYPERCALL_FLUSH_CACHE 0x07 - -/* Get freq base. */ -#define SIOEMU_HYPERCALL_FREQ_BASE 0x08 - -/* Return from callback. */ -#define SIOEMU_HYPERCALL_CALLBACK_RETURN 0x09 - -/* Deliver an interrupt. */ -#define SIOEMU_HYPERCALL_DELIVER_INT 0x0a - -/* SIOEMU callback reason. */ - -/* An event (from event channel) has to be delivered. */ -#define SIOEMU_CB_EVENT 0x00 - -/* Emulate an IO access. */ -#define SIOEMU_CB_IO_EMULATE 0x01 - -/* An IPI is sent to a dead vcpu. */ -#define SIOEMU_CB_WAKEUP_VCPU 0x02 - -/* A SAL hypercall is executed. */ -#define SIOEMU_CB_SAL_ASSIST 0x03 - -#ifndef __ASSEMBLY__ -struct sioemu_callback_info { - /* Saved registers. */ - unsigned long ip; - unsigned long psr; - unsigned long ifs; - unsigned long nats; - unsigned long r8; - unsigned long r9; - unsigned long r10; - unsigned long r11; - - /* Callback parameters. */ - unsigned long cause; - unsigned long arg0; - unsigned long arg1; - unsigned long arg2; - unsigned long arg3; - unsigned long _pad2[2]; - unsigned long r2; -}; -#endif /* __ASSEMBLY__ */ -#endif /* __XEN_PUBLIC_IA64_SIOEMU_H__ */ |