Merge branch 'master' into sam460ex
Conflicts: src/system/boot/platform/u-boot/arch/ppc/Jamfile
This commit is contained in:
commit
77d95e1d47
6
Jamfile
6
Jamfile
@ -173,7 +173,11 @@ SubDir HAIKU_TOP ;
|
||||
UserBuildConfigRulePostBuildTargets ;
|
||||
|
||||
# specify the Haiku image and network boot archive contents
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) HaikuImage ] ;
|
||||
if $(TARGET_ARCH) = x86_64 {
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) Haiku64Image ] ;
|
||||
} else {
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) HaikuImage ] ;
|
||||
}
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) NetBootArchive ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) FloppyBootImage ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDBootImage ] ;
|
||||
|
1
Jamrules
1
Jamrules
@ -44,6 +44,7 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) DocumentationRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) BootRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ;
|
||||
|
129
build/jam/BootRules
Normal file
129
build/jam/BootRules
Normal file
@ -0,0 +1,129 @@
|
||||
|
||||
rule SetupBoot
|
||||
{
|
||||
# Usage SetupBoot <sources_or_objects> : <extra_cc_flags> : <include_private_headers> ;
|
||||
#
|
||||
# <sources_or_objects> - Ideally sources, otherwise HDRSEARCH can not be
|
||||
# set for the sources and the sources some header
|
||||
# dependencies might be missing.
|
||||
|
||||
local sources = [ FGristFiles $(1) ] ;
|
||||
local objects = $(sources:S=$(SUFOBJ)) ;
|
||||
|
||||
# add private kernel headers
|
||||
if $(3) != false {
|
||||
SourceSysHdrs $(sources) : $(TARGET_PRIVATE_KERNEL_HEADERS) ;
|
||||
}
|
||||
|
||||
local object ;
|
||||
for object in $(objects) {
|
||||
# add boot flags for the object
|
||||
ObjectCcFlags $(object) : $(TARGET_BOOT_CCFLAGS) $(2) ;
|
||||
ObjectC++Flags $(object) : $(TARGET_BOOT_C++FLAGS) $(2) ;
|
||||
ObjectDefines $(object) : $(TARGET_KERNEL_DEFINES) ;
|
||||
ASFLAGS on $(object) = $(TARGET_BOOT_CCFLAGS) ;
|
||||
|
||||
# override warning flags
|
||||
TARGET_WARNING_CCFLAGS on $(object) = $(TARGET_KERNEL_WARNING_CCFLAGS) ;
|
||||
TARGET_WARNING_C++FLAGS on $(object)
|
||||
= $(TARGET_KERNEL_WARNING_C++FLAGS) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule BootObjects
|
||||
{
|
||||
SetupBoot $(1) : $(2) ;
|
||||
Objects $(1) ;
|
||||
}
|
||||
|
||||
rule BootLd
|
||||
{
|
||||
# BootLd <name> : <objs> : <linkerscript> : <args> ;
|
||||
|
||||
LINK on $(1) = $(TARGET_LD) ;
|
||||
|
||||
LINKFLAGS on $(1) = $(4) ;
|
||||
if $(3) { LINKFLAGS on $(1) += --script=$(3) ; }
|
||||
|
||||
# Remove any preset LINKLIBS, but link against libgcc.a. Linking against
|
||||
# libsupc++ is opt-out.
|
||||
local libs ;
|
||||
if ! [ on $(1) return HAIKU_NO_LIBSUPC++ ] {
|
||||
libs += $(TARGET_BOOT_LIBSUPC++) ;
|
||||
}
|
||||
LINKLIBS on $(1) = $(libs) $(TARGET_BOOT_LIBGCC) ;
|
||||
|
||||
# TODO: Do we really want to invoke SetupBoot here? The objects should
|
||||
# have been compiled with BootObjects anyway, so we're doing that twice.
|
||||
SetupBoot $(2) ;
|
||||
|
||||
# Show that we depend on the libraries we need
|
||||
LocalClean clean : $(1) ;
|
||||
LocalDepends all : $(1) ;
|
||||
Depends $(1) : $(2) ;
|
||||
|
||||
MakeLocateDebug $(1) ;
|
||||
|
||||
on $(1) XRes $(1) : $(RESFILES) ;
|
||||
if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] {
|
||||
SetType $(1) ;
|
||||
MimeSet $(1) ;
|
||||
SetVersion $(1) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions BootLd bind VERSION_SCRIPT
|
||||
{
|
||||
$(LINK) $(LINKFLAGS) -o "$(1)" "$(2)" $(LINKLIBS) \
|
||||
--version-script=$(VERSION_SCRIPT)
|
||||
}
|
||||
|
||||
rule BootMergeObject
|
||||
{
|
||||
# BootMergeObject <name> : <sources> : <extra CFLAGS> : <other objects> ;
|
||||
# Compiles source files and merges the object files to an object file.
|
||||
# <name>: Name of the object file to create. No grist will be added.
|
||||
# <sources>: Sources to be compiled. Grist will be added.
|
||||
# <extra CFLAGS>: Additional flags for compilation.
|
||||
# <other objects>: Object files or static libraries to be merged. No grist
|
||||
# will be added.
|
||||
#
|
||||
|
||||
SetupBoot $(2) : $(3) ;
|
||||
Objects $(2) ;
|
||||
MergeObjectFromObjects $(1) : $(2:S=$(SUFOBJ)) : $(4) ;
|
||||
LINKFLAGS on $(1) += $(TARGET_BOOT_LINKFLAGS) ;
|
||||
}
|
||||
|
||||
rule BootStaticLibrary
|
||||
{
|
||||
# Usage BootStaticLibrary <name> : <sources> : <extra cc flags> ;
|
||||
# This is designed to take a set of sources and libraries and create
|
||||
# a file called lib<name>.a
|
||||
|
||||
SetupBoot $(2) : $(3) : false ;
|
||||
Library $(1) : $(2) ;
|
||||
}
|
||||
|
||||
rule BootStaticLibraryObjects
|
||||
{
|
||||
# Usage BootStaticLibrary <name> : <sources> ;
|
||||
# This is designed to take a set of sources and libraries and create
|
||||
# a file called <name>
|
||||
|
||||
# Show that we depend on the libraries we need
|
||||
SetupBoot $(2) ;
|
||||
LocalClean clean : $(1) ;
|
||||
LocalDepends all : $(1) ;
|
||||
Depends $(1) : $(2) ;
|
||||
|
||||
MakeLocateDebug $(1) ;
|
||||
}
|
||||
|
||||
actions BootStaticLibraryObjects
|
||||
{
|
||||
# Force recreation of the archive to avoid build errors caused by
|
||||
# stale dependencies after renaming or deleting object files.
|
||||
$(RM) "$(1)"
|
||||
$(HAIKU_AR) -r "$(1)" "$(2)" ;
|
||||
}
|
@ -159,10 +159,13 @@ if $(HAIKU_GCC_VERSION[1]) = 2 {
|
||||
HAIKU_C++ ?= $(HAIKU_CC) ;
|
||||
HAIKU_LINK = $(HAIKU_CC) ;
|
||||
HAIKU_LINKFLAGS = $(HAIKU_GCC_BASE_FLAGS) ;
|
||||
HAIKU_BOOT_LINKFLAGS = ;
|
||||
|
||||
HAIKU_HDRS = [ FStandardHeaders ] ;
|
||||
HAIKU_KERNEL_CCFLAGS = $(HAIKU_CCFLAGS) $(HAIKU_GCC_BASE_FLAGS) ;
|
||||
HAIKU_KERNEL_C++FLAGS = $(HAIKU_C++FLAGS) $(HAIKU_GCC_BASE_FLAGS) ;
|
||||
HAIKU_BOOT_CCFLAGS = $(HAIKU_CCFLAGS) $(HAIKU_GCC_BASE_FLAGS) ;
|
||||
HAIKU_BOOT_C++FLAGS = $(HAIKU_C++FLAGS) $(HAIKU_GCC_BASE_FLAGS) ;
|
||||
HAIKU_CCFLAGS += $(HAIKU_GCC_BASE_FLAGS) -nostdinc ;
|
||||
HAIKU_C++FLAGS += $(HAIKU_GCC_BASE_FLAGS) -nostdinc ;
|
||||
HAIKU_DEFINES = __HAIKU__ ;
|
||||
@ -190,7 +193,7 @@ switch $(HAIKU_DISTRO_COMPATIBILITY) {
|
||||
# analyze the gcc machine spec to determine HAIKU_CPU
|
||||
switch $(HAIKU_GCC_MACHINE) {
|
||||
case i?86-* : HAIKU_CPU = x86 ;
|
||||
case x86_64-* : HAIKU_CPU = x86_64 ;
|
||||
case x86_64-* : HAIKU_CPU = x86_64 ;
|
||||
case powerpc-* : HAIKU_CPU = ppc ;
|
||||
case m68k-* : HAIKU_CPU = m68k ;
|
||||
case mipsel-* : HAIKU_CPU = mipsel ;
|
||||
@ -249,12 +252,15 @@ switch $(HAIKU_CPU) {
|
||||
}
|
||||
case x86_64 :
|
||||
{
|
||||
HAIKU_DEFINES += __x86_64__ ;
|
||||
# x86_64 completely shares the x86 bootloader.
|
||||
HAIKU_BOOT_PLATFORM = bios_ia32 ;
|
||||
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB
|
||||
# offset in floppy image (>= sizeof(haiku_loader))
|
||||
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 300 ; # in kB
|
||||
|
||||
# x86_64 kernel source is under arch/x86.
|
||||
HAIKU_KERNEL_ARCH = x86 ;
|
||||
|
||||
# yasm is required for target arch x86_64
|
||||
if ! $(HAIKU_YASM) {
|
||||
Exit "HAIKU_YASM not set. Please re-run configure." ;
|
||||
@ -304,6 +310,7 @@ HAIKU_ARCH ?= $(HAIKU_CPU) ;
|
||||
HAIKU_ARCH_MACRO_DEFINE = ARCH_$(HAIKU_ARCH) ;
|
||||
HAIKU_DEFINES += $(HAIKU_ARCH_MACRO_DEFINE) ;
|
||||
HAIKU_DEFINES += BOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ;
|
||||
HAIKU_KERNEL_ARCH ?= $(HAIKU_ARCH) ;
|
||||
HAIKU_ATA_STACK ?= 1 ;
|
||||
|
||||
# directories
|
||||
@ -329,8 +336,11 @@ HAIKU_ASFLAGS = ;
|
||||
HAIKU_KERNEL_CCFLAGS += -finline -fno-builtin ;
|
||||
HAIKU_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions ;
|
||||
HAIKU_KERNEL_DEFINES += _KERNEL_MODE ;
|
||||
HAIKU_BOOT_CCFLAGS += -finline -fno-builtin ;
|
||||
HAIKU_BOOT_C++FLAGS += -finline -fno-builtin -fno-exceptions ;
|
||||
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 3 {
|
||||
HAIKU_BOOT_C++FLAGS += -fno-use-cxa-atexit ;
|
||||
HAIKU_KERNEL_C++FLAGS += -fno-use-cxa-atexit ;
|
||||
}
|
||||
|
||||
@ -340,11 +350,14 @@ if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
if $(HAIKU_GCC_VERSION[2]) >= 3 {
|
||||
HAIKU_KERNEL_CCFLAGS += -ffreestanding ;
|
||||
HAIKU_KERNEL_C++FLAGS += -ffreestanding ;
|
||||
HAIKU_BOOT_CCFLAGS += -ffreestanding ;
|
||||
HAIKU_BOOT_C++FLAGS += -ffreestanding ;
|
||||
}
|
||||
}
|
||||
|
||||
HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ;
|
||||
HAIKU_KERNEL_PIC_LINKFLAGS = ;
|
||||
HAIKU_KERNEL_ADDON_LINKFLAGS = ;
|
||||
|
||||
switch $(HAIKU_ARCH) {
|
||||
case ppc :
|
||||
@ -377,6 +390,23 @@ switch $(HAIKU_ARCH) {
|
||||
}
|
||||
case x86_64 :
|
||||
{
|
||||
# Kernel lives in the top 2GB of the address space, use kernel code
|
||||
# model.
|
||||
HAIKU_KERNEL_PIC_CCFLAGS += -mcmodel=kernel ;
|
||||
|
||||
# Disable the red zone, which cannot be used in kernel code due to
|
||||
# interrupts, and always enable the frame pointer so stack traces are
|
||||
# correct.
|
||||
HAIKU_KERNEL_CCFLAGS += -mno-red-zone -fno-omit-frame-pointer ;
|
||||
HAIKU_KERNEL_C++FLAGS += -mno-red-zone -fno-omit-frame-pointer ;
|
||||
HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ;
|
||||
HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 ;
|
||||
|
||||
# Bootloader is 32-bit.
|
||||
HAIKU_BOOT_LINKFLAGS += -m elf_i386_haiku ;
|
||||
HAIKU_BOOT_CCFLAGS += -m32 -march=pentium ;
|
||||
HAIKU_BOOT_C++FLAGS += -m32 -march=pentium ;
|
||||
|
||||
# Enable use of the gcc built-in atomic functions instead of atomic_*().
|
||||
# The former are inlined and have thus less overhead.
|
||||
HAIKU_DEFINES += B_USE_BUILTIN_ATOMIC_FUNCTIONS ;
|
||||
@ -439,7 +469,7 @@ HAIKU_PRIVATE_SYSTEM_HEADERS =
|
||||
HAIKU_PRIVATE_KERNEL_HEADERS =
|
||||
[ PrivateHeaders $(DOT) kernel libroot shared
|
||||
kernel/boot/platform/$(HAIKU_BOOT_PLATFORM) ]
|
||||
[ ArchHeaders $(HAIKU_ARCH) ]
|
||||
[ ArchHeaders $(HAIKU_KERNEL_ARCH) ]
|
||||
[ FDirName $(HAIKU_COMMON_DEBUG_OBJECT_DIR) system kernel ]
|
||||
$(HAIKU_PRIVATE_SYSTEM_HEADERS)
|
||||
;
|
||||
@ -957,9 +987,9 @@ if $(TARGET_PLATFORM) != haiku {
|
||||
# specified TARGET_PLATFORM.
|
||||
|
||||
local buildVars =
|
||||
ARCH CPU GCC_VERSION
|
||||
ARCH CPU GCC_VERSION KERNEL_ARCH
|
||||
|
||||
AR CC C++ LD OBJCOPY RANLIB
|
||||
AR CC C++ LD OBJCOPY RANLIB ELFEDIT
|
||||
|
||||
INCLUDES_SEPARATOR LOCAL_INCLUDES_OPTION SYSTEM_INCLUDES_OPTION
|
||||
|
||||
@ -968,7 +998,8 @@ local buildVars =
|
||||
KERNEL_DEFINES
|
||||
|
||||
KERNEL_CCFLAGS KERNEL_C++FLAGS
|
||||
KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS
|
||||
KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS KERNEL_ADDON_LINKFLAGS
|
||||
BOOT_CCFLAGS BOOT_C++FLAGS BOOT_LINKFLAGS
|
||||
WARNING_CCFLAGS WARNING_C++FLAGS
|
||||
|
||||
KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS
|
||||
@ -1005,6 +1036,11 @@ if $(TARGET_PLATFORM) = haiku {
|
||||
TARGET_GCC_LIBGCC = $(HAIKU_GCC_LIBGCC) ;
|
||||
TARGET_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS) ;
|
||||
|
||||
TARGET_KERNEL_LIBGCC = $(HAIKU_KERNEL_LIBGCC) ;
|
||||
TARGET_KERNEL_LIBSUPC++ = $(HAIKU_KERNEL_LIBSUPC++) ;
|
||||
TARGET_BOOT_LIBGCC = $(HAIKU_BOOT_LIBGCC) ;
|
||||
TARGET_BOOT_LIBSUPC++ = $(HAIKU_BOOT_LIBSUPC++) ;
|
||||
|
||||
TARGET_BOOT_PLATFORM ?= $(HAIKU_BOOT_PLATFORM) ;
|
||||
TARGET_BOOT_BOARD ?= $(HAIKU_BOOT_BOARD) ;
|
||||
|
||||
@ -1021,6 +1057,11 @@ if $(TARGET_PLATFORM) = haiku {
|
||||
TARGET_GCC_LIBGCC = ;
|
||||
TARGET_GCC_LIBGCC_OBJECTS = ;
|
||||
|
||||
TARGET_KERNEL_LIBGCC = ;
|
||||
TARGET_KERNEL_LIBSUPC++ = ;
|
||||
TARGET_BOOT_LIBGCC = ;
|
||||
TARGET_BOOT_LIBSUPC++ = ;
|
||||
|
||||
TARGET_BOOT_PLATFORM = ;
|
||||
TARGET_BOOT_BOARD = ;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
local X86_ONLY = ;
|
||||
local PPC_ONLY = ;
|
||||
local ARM_ONLY = ;
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
if $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 {
|
||||
X86_ONLY = "" ;
|
||||
} else if $(TARGET_ARCH) = ppc {
|
||||
X86_ONLY = ;
|
||||
@ -55,41 +55,77 @@ SYSTEM_ADD_ONS_BUS_MANAGERS = $(X86_ONLY)acpi $(ATA_ONLY)ata config_manager dpc
|
||||
SYSTEM_ADD_ONS_FILE_SYSTEMS = bfs iso9660 attribute_overlay write_overlay ;
|
||||
|
||||
|
||||
# modules
|
||||
AddFilesToFloppyBootArchive system add-ons kernel bus_managers
|
||||
: $(SYSTEM_ADD_ONS_BUS_MANAGERS) ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel busses ide
|
||||
: generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 legacy_sata it8211 ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel busses scsi
|
||||
: ahci ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel console : vga_text ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel file_systems
|
||||
: $(SYSTEM_ADD_ONS_FILE_SYSTEMS) ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel generic
|
||||
: $(ATA_ONLY)ata_adapter $(IDE_ONLY)ide_adapter locked_pool scsi_periph ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel partitioning_systems
|
||||
: intel session ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel interrupt_controllers
|
||||
: $(PPC_ONLY)openpic ;
|
||||
if $(TARGET_ARCH) = x86_64 {
|
||||
AddFilesToFloppyBootArchive system add-ons kernel bus_managers
|
||||
: ata config_manager dpc pci isa scsi $(USB_ONLY)usb ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel busses ata
|
||||
: generic_ide_pci legacy_sata ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel busses scsi
|
||||
: ahci ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel file_systems
|
||||
: $(SYSTEM_ADD_ONS_FILE_SYSTEMS) ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel generic
|
||||
: ata_adapter locked_pool scsi_periph ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel partitioning_systems
|
||||
: intel session ;
|
||||
|
||||
if $(USB_BOOT) = 1 {
|
||||
AddFilesToFloppyBootArchive system add-ons kernel busses usb
|
||||
: <usb>uhci <usb>ohci <usb>ehci ;
|
||||
}
|
||||
if $(USB_BOOT) = 1 {
|
||||
AddFilesToFloppyBootArchive system add-ons kernel busses usb
|
||||
: <usb>uhci <usb>ohci <usb>ehci ;
|
||||
}
|
||||
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
AddFilesToFloppyBootArchive system add-ons kernel cpu : generic_x86 ;
|
||||
}
|
||||
|
||||
# drivers
|
||||
AddNewDriversToFloppyBootArchive disk scsi : scsi_cd scsi_disk ;
|
||||
AddNewDriversToFloppyBootArchive disk : $(ARM_ONLY)norflash ;
|
||||
if $(USB_BOOT) = 1 {
|
||||
AddDriversToFloppyBootArchive disk usb : usb_disk ;
|
||||
}
|
||||
if $(NET_BOOT) = 1 {
|
||||
AddDriversToFloppyBootArchive disk virtual : remote_disk ;
|
||||
AddDriversToFloppyBootArchive net : $(SYSTEM_ADD_ONS_DRIVERS_NET) ;
|
||||
AddNewDriversToFloppyBootArchive disk scsi : scsi_cd scsi_disk ;
|
||||
if $(USB_BOOT) = 1 {
|
||||
AddDriversToFloppyBootArchive disk usb : usb_disk ;
|
||||
}
|
||||
} else {
|
||||
# modules
|
||||
AddFilesToFloppyBootArchive system add-ons kernel bus_managers
|
||||
: $(SYSTEM_ADD_ONS_BUS_MANAGERS) ;
|
||||
|
||||
if $(HAIKU_ATA_STACK) = 1 {
|
||||
AddFilesToFloppyBootArchive system add-ons kernel busses ata
|
||||
: generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 legacy_sata
|
||||
it8211 ;
|
||||
} else {
|
||||
AddFilesToFloppyBootArchive system add-ons kernel busses ide
|
||||
: generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 legacy_sata
|
||||
it8211 ;
|
||||
}
|
||||
|
||||
AddFilesToFloppyBootArchive system add-ons kernel busses scsi
|
||||
: ahci ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel console : vga_text ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel file_systems
|
||||
: $(SYSTEM_ADD_ONS_FILE_SYSTEMS) ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel generic
|
||||
: $(ATA_ONLY)ata_adapter $(IDE_ONLY)ide_adapter locked_pool scsi_periph ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel partitioning_systems
|
||||
: intel session ;
|
||||
AddFilesToFloppyBootArchive system add-ons kernel interrupt_controllers
|
||||
: $(PPC_ONLY)openpic ;
|
||||
|
||||
if $(USB_BOOT) = 1 {
|
||||
AddFilesToFloppyBootArchive system add-ons kernel busses usb
|
||||
: <usb>uhci <usb>ohci <usb>ehci ;
|
||||
}
|
||||
|
||||
if $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 {
|
||||
AddFilesToFloppyBootArchive system add-ons kernel cpu : generic_x86 ;
|
||||
}
|
||||
|
||||
# drivers
|
||||
AddNewDriversToFloppyBootArchive disk scsi : scsi_cd scsi_disk ;
|
||||
AddNewDriversToFloppyBootArchive disk : $(ARM_ONLY)norflash ;
|
||||
if $(USB_BOOT) = 1 {
|
||||
AddDriversToFloppyBootArchive disk usb : usb_disk ;
|
||||
}
|
||||
if $(NET_BOOT) = 1 {
|
||||
AddDriversToFloppyBootArchive disk virtual : remote_disk ;
|
||||
AddDriversToFloppyBootArchive net : $(SYSTEM_ADD_ONS_DRIVERS_NET) ;
|
||||
}
|
||||
}
|
||||
|
||||
# kernel
|
||||
@ -118,19 +154,30 @@ if $(NET_BOOT) = 1 {
|
||||
}
|
||||
|
||||
# boot module links
|
||||
AddBootModuleSymlinksToFloppyBootArchive
|
||||
$(SYSTEM_ADD_ONS_BUS_MANAGERS)
|
||||
$(PPC_ONLY)openpic
|
||||
$(ATA_ONLY)ata_adapter $(IDE_ONLY)ide_adapter locked_pool scsi_periph
|
||||
$(X86_ONLY)generic_x86
|
||||
ahci generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 legacy_sata
|
||||
it8211
|
||||
$(USB_ONLY)<usb>uhci $(USB_ONLY)<usb>ohci $(USB_ONLY)<usb>ehci
|
||||
scsi_cd scsi_disk $(USB_ONLY)usb_disk $(ARM_ONLY)norflash
|
||||
intel session
|
||||
$(SYSTEM_ADD_ONS_FILE_SYSTEMS)
|
||||
$(BOOT_ADD_ONS_NET)
|
||||
;
|
||||
if $(TARGET_ARCH) = x86_64 {
|
||||
AddBootModuleSymlinksToFloppyBootArchive
|
||||
ata dpc config_manager pci scsi $(USB_ONLY)usb ata_adapter locked_pool
|
||||
scsi_periph generic_x86 ahci generic_ide_pci legacy_sata
|
||||
$(USB_ONLY)<usb>uhci $(USB_ONLY)<usb>ohci $(USB_ONLY)<usb>ehci
|
||||
scsi_cd scsi_disk $(USB_ONLY)usb_disk
|
||||
intel session
|
||||
$(SYSTEM_ADD_ONS_FILE_SYSTEMS)
|
||||
;
|
||||
} else {
|
||||
AddBootModuleSymlinksToFloppyBootArchive
|
||||
$(SYSTEM_ADD_ONS_BUS_MANAGERS)
|
||||
$(PPC_ONLY)openpic
|
||||
$(ATA_ONLY)ata_adapter $(IDE_ONLY)ide_adapter locked_pool scsi_periph
|
||||
$(X86_ONLY)generic_x86
|
||||
ahci generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 legacy_sata
|
||||
it8211
|
||||
$(USB_ONLY)<usb>uhci $(USB_ONLY)<usb>ohci $(USB_ONLY)<usb>ehci
|
||||
scsi_cd scsi_disk $(USB_ONLY)usb_disk $(ARM_ONLY)norflash
|
||||
intel session
|
||||
$(SYSTEM_ADD_ONS_FILE_SYSTEMS)
|
||||
$(BOOT_ADD_ONS_NET)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Build The Archive
|
||||
|
593
build/jam/Haiku64Image
Normal file
593
build/jam/Haiku64Image
Normal file
@ -0,0 +1,593 @@
|
||||
# This file defines what ends up on the Haiku image (respectively in the Haiku
|
||||
# installation directory) and it executes the rules building the image
|
||||
# (respectively installing the files in the installation directory).
|
||||
|
||||
# This is only temporary while x86_64 is still a work in progress, so I can
|
||||
# easily add things to the image as I port them.
|
||||
|
||||
local GPL_ONLY = ;
|
||||
if $(HAIKU_INCLUDE_GPL_ADDONS) = 1 {
|
||||
GPL_ONLY = "" ;
|
||||
}
|
||||
|
||||
#HACK: remove when old ide code is removed!
|
||||
local ATA_ONLY = ;
|
||||
local IDE_ONLY = ;
|
||||
if $(HAIKU_ATA_STACK) = 1 {
|
||||
ATA_ONLY = "" ;
|
||||
} else {
|
||||
IDE_ONLY = "" ;
|
||||
}
|
||||
|
||||
SYSTEM_BIN = "[" addattr base64 basename bash beep cal cat catattr checkfs
|
||||
chgrp chmod chown chroot cksum clear clockconfig cmp collectcatkeys comm
|
||||
compress copyattr cp csplit cut date dd diff diff3 dircolors dirname df du
|
||||
dumpcatalog echo eject env error expand expr factor false find finddir
|
||||
fmt fold fortune gawk gdb gzip gzexe getlimits grep groups head hostname id
|
||||
ifconfig <bin>install isvolume join kernel_debugger kill less lessecho
|
||||
lesskey link linkcatkeys listdev ln locale locate logger logname ls
|
||||
makebootable md5sum mimeset mkdir mkfifo mkfs mktemp mount mountvolume
|
||||
mv nl nohup notify nproc od paste patch pathchk ping pr printenv printf
|
||||
ps ptx pwd query rc readlink ReadOnlyBootPrompt rm rmattr rmdir safemode
|
||||
sdiff seq sha1sum shred shuf sleep sort split stat strace stty su sum sync
|
||||
sysinfo tac tail tee test timeout touch tr true truncate tsort tty unexpand
|
||||
uname uniq unlink unmount unzip <bin>updatedb waitfor wc wget whoami xargs
|
||||
xres yes zdiff zforce zgrep zip zipcloak <bin>zipgrep zipnote zipsplit
|
||||
zmore znew
|
||||
;
|
||||
|
||||
SYSTEM_APPS = AboutSystem DriveSetup Installer NetworkStatus ProcessController
|
||||
StyledEdit Terminal
|
||||
;
|
||||
|
||||
SYSTEM_PREFERENCES = Appearance Backgrounds <preference>Deskbar FileTypes
|
||||
Keyboard Keymap Locale Mouse Network Notifications Screen Time Touchpad
|
||||
<preference>Tracker VirtualMemory
|
||||
;
|
||||
|
||||
SYSTEM_DEMOS = ;
|
||||
|
||||
SYSTEM_LIBS = libbe.so libbnetapi.so libdebug.so libnetwork.so
|
||||
<revisioned>libroot.so libroot-addon-icu.so
|
||||
libtextencoding.so libtiff.so libtracker.so libtranslation.so
|
||||
$(HAIKU_SHARED_LIBSTDC++) $(HAIKU_SHARED_LIBSUPC++)
|
||||
;
|
||||
|
||||
PRIVATE_SYSTEM_LIBS =
|
||||
$(HAIKU_JPEG_CURRENT_LIB)
|
||||
$(HAIKU_LIBPNG_CURRENT_LIB)
|
||||
$(HAIKU_ZLIB_CURRENT_LIB)
|
||||
$(HAIKU_FREETYPE_CURRENT_LIB)
|
||||
libilmimf.so
|
||||
;
|
||||
|
||||
SYSTEM_SERVERS = app_server debug_server input_server mount_server
|
||||
net_server notification_server registrar syslog_daemon
|
||||
;
|
||||
|
||||
SYSTEM_NETWORK_DEVICES = ethernet loopback ;
|
||||
SYSTEM_NETWORK_DATALINK_PROTOCOLS = ethernet_frame <module>arp loopback_frame
|
||||
ipv6_datagram ;
|
||||
SYSTEM_NETWORK_PROTOCOLS = ipv4 tcp udp icmp unix icmp6 ipv6 ;
|
||||
|
||||
SYSTEM_ADD_ONS_ACCELERANTS = vesa.accelerant ;
|
||||
SYSTEM_ADD_ONS_TRANSLATORS = BMPTranslator EXRTranslator GIFTranslator
|
||||
HVIFTranslator ICOTranslator JPEGTranslator JPEG2000Translator
|
||||
PCXTranslator PNGTranslator PPMTranslator
|
||||
RAWTranslator RTFTranslator SGITranslator STXTTranslator TGATranslator
|
||||
TIFFTranslator WebPTranslator WonderBrushTranslator
|
||||
;
|
||||
|
||||
SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = vesa ;
|
||||
SYSTEM_ADD_ONS_DRIVERS_NET = 3com atheros813x ar81xx attansic_l1 attansic_l2
|
||||
broadcom440x broadcom570x dec21xxx etherpci ipro100 ipro1000 jmicron2x0
|
||||
marvell_yukon nforce pcnet pegasus rtl8139 rtl81xx sis19x sis900 syskonnect
|
||||
via_rhine wb840
|
||||
;
|
||||
|
||||
SYSTEM_ADD_ONS_BUS_MANAGERS = $(ATA_ONLY)ata pci ps2 isa scsi config_manager
|
||||
usb ;
|
||||
SYSTEM_ADD_ONS_FILE_SYSTEMS = bfs iso9660 attribute_overlay write_overlay ;
|
||||
|
||||
# modules
|
||||
AddFilesToHaikuImage system add-ons kernel bus_managers
|
||||
: $(SYSTEM_ADD_ONS_BUS_MANAGERS) ;
|
||||
|
||||
if $(HAIKU_ATA_STACK) = 1 {
|
||||
AddFilesToHaikuImage system add-ons kernel busses ata
|
||||
: generic_ide_pci legacy_sata ;
|
||||
}
|
||||
|
||||
AddFilesToHaikuImage system add-ons kernel busses scsi
|
||||
: ahci ;
|
||||
AddFilesToHaikuImage system add-ons kernel busses usb
|
||||
: <usb>uhci <usb>ohci <usb>ehci ;
|
||||
AddFilesToHaikuImage system add-ons kernel debugger
|
||||
: <kdebug>demangle <kdebug>invalidate_on_exit <kdebug>usb_keyboard ;
|
||||
AddFilesToHaikuImage system add-ons kernel file_systems
|
||||
: $(SYSTEM_ADD_ONS_FILE_SYSTEMS) ;
|
||||
AddFilesToHaikuImage system add-ons kernel generic
|
||||
: $(ATA_ONLY)ata_adapter bios dpc locked_pool scsi_periph <module>tty ;
|
||||
AddFilesToHaikuImage system add-ons kernel partitioning_systems
|
||||
: intel session ;
|
||||
|
||||
AddFilesToHaikuImage system add-ons kernel cpu : generic_x86 ;
|
||||
|
||||
# drivers
|
||||
AddNewDriversToHaikuImage disk scsi : scsi_cd scsi_disk ;
|
||||
|
||||
# legacy drivers
|
||||
AddDriversToHaikuImage : console dprintf null
|
||||
random <driver>tty zero ;
|
||||
AddDriversToHaikuImage graphics : $(SYSTEM_ADD_ONS_DRIVERS_GRAPHICS) ;
|
||||
AddDriversToHaikuImage disk usb : usb_disk ;
|
||||
AddDriversToHaikuImage input : ps2_hid usb_hid ;
|
||||
AddDriversToHaikuImage net : $(SYSTEM_ADD_ONS_DRIVERS_NET) ;
|
||||
|
||||
# kernel
|
||||
AddFilesToHaikuImage system : <revisioned>kernel_$(TARGET_ARCH) ;
|
||||
|
||||
# libs
|
||||
AddLibrariesToHaikuHybridImage system lib
|
||||
: $(SYSTEM_LIBS) $(PRIVATE_SYSTEM_LIBS) ;
|
||||
|
||||
# libfreetype.so links to the current freetype lib
|
||||
AddSymlinkToHaikuHybridImage system lib : $(HAIKU_FREETYPE_CURRENT_LIB:BS)
|
||||
: $(HAIKU_FREETYPE_CURRENT_LINK) : : true ;
|
||||
AddSymlinkToHaikuHybridImage system lib : $(HAIKU_FREETYPE_CURRENT_LINK)
|
||||
: libfreetype.so : : true ;
|
||||
|
||||
# libpng.so links to the current libpng
|
||||
AddSymlinkToHaikuHybridImage system lib : $(HAIKU_LIBPNG_CURRENT_LIB:BS)
|
||||
: $(HAIKU_LIBPNG_CURRENT_LINK) : : true ;
|
||||
AddSymlinkToHaikuHybridImage system lib : $(HAIKU_LIBPNG_CURRENT_LINK)
|
||||
: libpng.so : : true ;
|
||||
|
||||
# libjpeg.so links to the current libjpeg
|
||||
AddSymlinkToHaikuHybridImage system lib : $(HAIKU_JPEG_CURRENT_LIB:BS)
|
||||
: $(HAIKU_JPEG_CURRENT_LINK) : : true ;
|
||||
AddSymlinkToHaikuHybridImage system lib : $(HAIKU_JPEG_CURRENT_LINK)
|
||||
: libjpeg.so : : true ;
|
||||
|
||||
# zlib.so links to the current zlib
|
||||
AddSymlinkToHaikuHybridImage system lib : $(HAIKU_ZLIB_CURRENT_LIB:BS)
|
||||
: $(HAIKU_ZLIB_CURRENT_LINK) : : true ;
|
||||
AddSymlinkToHaikuHybridImage system lib : $(HAIKU_ZLIB_CURRENT_LINK)
|
||||
: libz.so : : true ;
|
||||
|
||||
# servers
|
||||
AddFilesToHaikuImage system servers : $(SYSTEM_SERVERS) ;
|
||||
|
||||
# apps
|
||||
AddFilesToHaikuImage system : runtime_loader Deskbar Tracker ;
|
||||
AddFilesToHaikuImage system bin : $(SYSTEM_BIN) consoled ;
|
||||
AddFilesToHaikuImage system apps : $(SYSTEM_APPS) ;
|
||||
AddFilesToHaikuImage system preferences : $(SYSTEM_PREFERENCES) ;
|
||||
AddFilesToHaikuImage system demos : $(SYSTEM_DEMOS) ;
|
||||
|
||||
SEARCH on which = [ FDirName $(HAIKU_TOP) data bin ] ;
|
||||
AddFilesToHaikuImage system bin : which ;
|
||||
SEARCH on installoptionalpackage = [ FDirName $(HAIKU_TOP) data bin ] ;
|
||||
AddFilesToHaikuImage system bin : installoptionalpackage ;
|
||||
SEARCH on install-wifi-firmwares.sh = [ FDirName $(HAIKU_TOP) data bin ] ;
|
||||
AddFilesToHaikuImage system bin : install-wifi-firmwares.sh ;
|
||||
|
||||
# Add the files to be used by installoptionalpackage.
|
||||
AddDirectoryToHaikuImage common data optional-packages ;
|
||||
local optional-pkg-files = OptionalBuildFeatures OptionalPackageDependencies
|
||||
OptionalPackages OptionalLibPackages ;
|
||||
for name in $(optional-pkg-files) {
|
||||
local file = [ FDirName $(HAIKU_TOP) build jam $(name) ] ;
|
||||
AddFilesToHaikuImage common data optional-packages : $(file) ;
|
||||
}
|
||||
AddInstalledPackagesFileToHaikuImage ;
|
||||
|
||||
AddSymlinkToHaikuImage system bin : bash : sh ;
|
||||
AddSymlinkToHaikuImage system bin : trash : untrash ;
|
||||
|
||||
AddSymlinkToHaikuImage home Desktop : /boot/home : Home ;
|
||||
|
||||
# Mailbox folders and symlink
|
||||
AddDirectoryToHaikuImage home mail draft ;
|
||||
AddDirectoryToHaikuImage home mail in ;
|
||||
AddDirectoryToHaikuImage home mail out ;
|
||||
|
||||
AddSymlinkToHaikuImage home config : settings/deskbar : be ;
|
||||
# Deskbar Application links
|
||||
AddDirectoryToHaikuImage home config settings deskbar Applications ;
|
||||
DESKBAR_APPLICATIONS = DriveSetup Installer StyledEdit Terminal ;
|
||||
local linkTarget ;
|
||||
for linkTarget in $(DESKBAR_APPLICATIONS) {
|
||||
AddSymlinkToHaikuImage home config settings deskbar Applications
|
||||
: /boot/system/apps/$(linkTarget) : $(linkTarget) ;
|
||||
}
|
||||
|
||||
# Deskbar Desktop applets links
|
||||
AddDirectoryToHaikuImage home config settings deskbar Desktop\ applets ;
|
||||
DESKBAR_DESKTOP_APPLETS = NetworkStatus ProcessController ;
|
||||
for linkTarget in $(DESKBAR_DESKTOP_APPLETS) {
|
||||
AddSymlinkToHaikuImage home config settings deskbar Desktop\ applets
|
||||
: /boot/system/apps/$(linkTarget) : $(linkTarget) ;
|
||||
}
|
||||
|
||||
# Deskbar Preferences links
|
||||
AddDirectoryToHaikuImage home config settings deskbar Preferences ;
|
||||
DESKBAR_PREFERENCES = $(SYSTEM_PREFERENCES:B) ;
|
||||
for linkTarget in $(DESKBAR_PREFERENCES) {
|
||||
AddSymlinkToHaikuImage home config settings deskbar Preferences
|
||||
: /boot/system/preferences/$(linkTarget)
|
||||
: $(linkTarget) ;
|
||||
}
|
||||
|
||||
AddSymlinkToHaikuImage system bin : less : more ;
|
||||
AddSymlinkToHaikuImage system bin : gzip : gunzip ;
|
||||
AddSymlinkToHaikuImage system bin : gzip : zcat ;
|
||||
AddSymlinkToHaikuImage system bin : zdiff : zcmp ;
|
||||
AddSymlinkToHaikuImage system bin : unzip : zipinfo ;
|
||||
AddSymlinkToHaikuImage system bin : gawk : awk ;
|
||||
AddSymlinkToHaikuImage system bin : grep : egrep ;
|
||||
AddSymlinkToHaikuImage system bin : grep : fgrep ;
|
||||
|
||||
|
||||
# scripts and data files
|
||||
local bootScripts = Bootscript Bootscript.cd SetupEnvironment Netscript
|
||||
InstallerInitScript InstallerFinishScript ;
|
||||
SEARCH on $(bootScripts) = [ FDirName $(HAIKU_TOP) data system boot ] ;
|
||||
AddFilesToHaikuImage system boot : $(bootScripts) ;
|
||||
|
||||
local userBootScripts = UserBootscript UserSetupEnvironment.sample ;
|
||||
SEARCH on $(userBootScripts) = [ FDirName $(HAIKU_TOP) data config boot ] ;
|
||||
AddFilesToHaikuImage home config boot : $(userBootScripts) ;
|
||||
|
||||
# Add boot launch directory
|
||||
AddDirectoryToHaikuImage home config boot launch ;
|
||||
|
||||
local logoArtwork =
|
||||
$(HAIKU_INCLUDE_TRADEMARKS)"HAIKU logo - white on blue - big.png"
|
||||
$(HAIKU_INCLUDE_TRADEMARKS)"HAIKU logo - white on blue - normal.png" ;
|
||||
SEARCH on $(logoArtwork) = [ FDirName $(HAIKU_TOP) data artwork ] ;
|
||||
AddFilesToHaikuImage system data artwork : $(logoArtwork) ;
|
||||
|
||||
local etcDir = [ FDirName $(HAIKU_TOP) data etc ] ;
|
||||
local etcFiles = inputrc profile ;
|
||||
etcFiles = $(etcFiles:G=etc) ;
|
||||
SEARCH on $(etcFiles) = [ FDirName $(etcDir) ] ;
|
||||
etcFiles += <etc>termcap <etc>sysless <etc>sysless.in ;
|
||||
AddFilesToHaikuImage common etc : $(etcFiles) ;
|
||||
|
||||
local profileFiles = [ Glob $(etcDir)/profile.d : *.sh ] ;
|
||||
profileFiles = $(profileFiles:G=profile-d) ;
|
||||
AddDirectoryToHaikuImage common etc profile.d ;
|
||||
AddFilesToHaikuImage common etc profile.d : $(profileFiles) ;
|
||||
|
||||
local fortuneFiles = [ Glob $(HAIKU_TOP)/data/system/data/fortunes
|
||||
: [a-zA-Z0-9]* ] ;
|
||||
fortuneFiles = $(fortuneFiles:G=data!fortunes) ;
|
||||
AddFilesToHaikuImage system data fortunes : $(fortuneFiles) ;
|
||||
|
||||
local fontDir = [ FDirName $(HAIKU_TOP) data system data fonts ] ;
|
||||
local psFonts = [ Glob $(fontDir)/psfonts : *.afm *.pfb ] ;
|
||||
local ttFonts = [ Glob $(fontDir)/ttfonts : *.ttf ] ;
|
||||
AddFilesToHaikuImage system data fonts psfonts : $(psFonts) ;
|
||||
AddFilesToHaikuImage system data fonts ttfonts : $(ttFonts) ;
|
||||
|
||||
local keymapFiles = [ Glob [ FDirName $(HAIKU_TOP) src data keymaps ]
|
||||
: *.keymap ] ;
|
||||
keymapFiles = $(keymapFiles:BG=keymap) ;
|
||||
AddFilesToHaikuImage system data Keymaps : $(keymapFiles) ;
|
||||
AddSymlinkToHaikuImage system data Keymaps : Swedish : Finnish ;
|
||||
AddSymlinkToHaikuImage system data Keymaps : Slovene : Croatian ;
|
||||
AddSymlinkToHaikuImage system data Keymaps : US-International : Brazilian ;
|
||||
|
||||
# Copy keyboard layout files to the image one-by-one.
|
||||
local keyboardLayoutsDir
|
||||
= [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts ] ;
|
||||
local keyboardLayoutFiles =
|
||||
"Generic 104-key"
|
||||
"Generic 105-key International"
|
||||
"Kinesis Advantage"
|
||||
"Kinesis Ergo Elan International"
|
||||
"TypeMatrix 2030" ;
|
||||
keyboardLayoutFiles = $(keyboardLayoutFiles:G=keyboard-layout) ;
|
||||
SEARCH on $(keyboardLayoutFiles) = $(keyboardLayoutsDir) ;
|
||||
AddFilesToHaikuImage system data KeyboardLayouts
|
||||
: $(keyboardLayoutFiles) ;
|
||||
|
||||
# Add Apple Aluminum keyboard layout files to the image in an Apple Aluminum
|
||||
# subdirectory. The subdirectory is turned into a submenu in the Layout menu
|
||||
# of the Keymap preference app.
|
||||
local appleAluminumDir
|
||||
= [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts
|
||||
Apple\ Aluminum ] ;
|
||||
local appleAluminumFiles =
|
||||
"Apple Aluminium Extended International"
|
||||
"Apple Aluminium International"
|
||||
"Apple Aluminum (US)"
|
||||
"Apple Aluminum Extended (US)" ;
|
||||
appleAluminumFiles = $(appleAluminumFiles:G=keyboard-layout) ;
|
||||
SEARCH on $(appleAluminumFiles) = $(appleAluminumDir) ;
|
||||
AddFilesToHaikuImage system data KeyboardLayouts Apple\ Aluminum
|
||||
: $(appleAluminumFiles) ;
|
||||
|
||||
# Add ThinkPad keyboard layout files to the image in a ThinkPad
|
||||
# subdirectory. The subdirectory is turned into a submenu in the Layout menu
|
||||
# of the Keymap preference app.
|
||||
local thinkpadDir
|
||||
= [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts ThinkPad ] ;
|
||||
local thinkPadFiles =
|
||||
"ThinkPad (US)"
|
||||
"ThinkPad International"
|
||||
"ThinkPad T400s (US)"
|
||||
"ThinkPad T400s International"
|
||||
"ThinkPad X1 (US)"
|
||||
"ThinkPad X1 International"
|
||||
"ThinkPad X100e (US)"
|
||||
"ThinkPad X100e International" ;
|
||||
thinkPadFiles = $(thinkPadFiles:G=keyboard-layout) ;
|
||||
SEARCH on $(thinkPadFiles) = $(thinkpadDir) ;
|
||||
AddFilesToHaikuImage system data KeyboardLayouts ThinkPad
|
||||
: $(thinkPadFiles) ;
|
||||
|
||||
local driverSettingsFiles = <driver-settings>kernel ;
|
||||
SEARCH on $(driverSettingsFiles)
|
||||
= [ FDirName $(HAIKU_TOP) data settings kernel drivers ] ;
|
||||
AddFilesToHaikuImage home config settings kernel drivers
|
||||
: $(driverSettingsFiles) ;
|
||||
|
||||
# post install scripts and fresh install indicator file
|
||||
local postInstallFiles = add_catalog_entry_attributes.sh
|
||||
default_deskbar_items.sh mime_update.sh ;
|
||||
postInstallFiles = $(postInstallFiles:G=post-install) ;
|
||||
SEARCH on $(postInstallFiles)
|
||||
= [ FDirName $(HAIKU_TOP) data common boot post_install ] ;
|
||||
SEARCH on <post-install>fresh_install
|
||||
= [ FDirName $(HAIKU_TOP) data common settings ] ;
|
||||
AddFilesToHaikuImage common boot post_install : $(postInstallFiles) ;
|
||||
AddFilesToHaikuImage common settings : <post-install>fresh_install ;
|
||||
|
||||
# boot loader
|
||||
AddFilesToHaikuImage system : haiku_loader ;
|
||||
|
||||
# boot module links
|
||||
AddBootModuleSymlinksToHaikuImage
|
||||
$(ATA_ONLY)ata pci config_manager dpc scsi usb $(ATA_ONLY)ata_adapter
|
||||
locked_pool scsi_periph ahci generic_ide_pci legacy_sata
|
||||
<usb>uhci <usb>ohci <usb>ehci
|
||||
scsi_cd scsi_disk usb_disk
|
||||
intel
|
||||
bfs
|
||||
;
|
||||
|
||||
# add-ons
|
||||
AddFilesToHaikuImage system add-ons accelerants
|
||||
: $(SYSTEM_ADD_ONS_ACCELERANTS) ;
|
||||
|
||||
AddFilesToHaikuHybridImage system add-ons Translators
|
||||
: $(SYSTEM_ADD_ONS_TRANSLATORS) : : true ;
|
||||
AddFilesToHaikuImage system add-ons input_server devices
|
||||
: <input>keyboard <input>mouse <input>tablet <input>wacom ;
|
||||
AddFilesToHaikuImage system add-ons kernel network
|
||||
: <net>notifications stack ;
|
||||
AddFilesToHaikuImage system add-ons kernel network devices
|
||||
: $(SYSTEM_NETWORK_DEVICES) ;
|
||||
AddFilesToHaikuImage system add-ons kernel network datalink_protocols
|
||||
: $(SYSTEM_NETWORK_DATALINK_PROTOCOLS) ;
|
||||
AddFilesToHaikuImage system add-ons kernel network protocols
|
||||
: $(SYSTEM_NETWORK_PROTOCOLS) ;
|
||||
|
||||
AddFilesToHaikuImage system add-ons disk_systems
|
||||
: <disk_system>intel <disk_system>bfs ;
|
||||
|
||||
# create directories that will remain empty
|
||||
AddDirectoryToHaikuImage common bin ;
|
||||
AddDirectoryToHaikuImage common include ;
|
||||
AddDirectoryToHaikuImage common lib ;
|
||||
AddDirectoryToHaikuImage home Desktop ;
|
||||
AddDirectoryToHaikuImage home config bin ;
|
||||
AddDirectoryToHaikuImage home config lib ;
|
||||
AddDirectoryToHaikuImage home mail ;
|
||||
AddDirectoryToHaikuImage common var empty ;
|
||||
AddDirectoryToHaikuImage common var log ;
|
||||
AddDirectoryToHaikuImage common cache tmp ;
|
||||
|
||||
AddDirectoryToHaikuImage home config add-ons kernel drivers bin ;
|
||||
AddDirectoryToHaikuImage home config add-ons kernel drivers dev ;
|
||||
AddDirectoryToHaikuImage home config add-ons input_server devices ;
|
||||
AddDirectoryToHaikuImage home config add-ons input_server filters ;
|
||||
AddDirectoryToHaikuImage home config add-ons input_server methods ;
|
||||
AddDirectoryToHaikuImage home config add-ons media plugins ;
|
||||
AddDirectoryToHaikuImage home config add-ons Tracker ;
|
||||
AddDirectoryToHaikuImage home config add-ons Print ;
|
||||
AddDirectoryToHaikuImage home config add-ons Screen\ Savers ;
|
||||
AddDirectoryToHaikuImage home config add-ons Translators ;
|
||||
AddDirectoryToHaikuImage system data synth ;
|
||||
AddDirectoryToHaikuImage system add-ons input_server methods ;
|
||||
|
||||
# licenses
|
||||
CopyDirectoryToHaikuImage system data
|
||||
: [ FDirName $(HAIKU_TOP) data system data licenses ]
|
||||
: licenses : -x .svn ;
|
||||
|
||||
# Copy documentation as per DiskUsage's license requirement.
|
||||
CopyDirectoryToHaikuImage system documentation
|
||||
: [ FDirName $(HAIKU_TOP) docs apps diskusage ]
|
||||
: diskusage : -x .svn ;
|
||||
|
||||
|
||||
#pragma mark - Optional Packages
|
||||
|
||||
|
||||
HAIKU_IMAGE_OPTIONAL_PACKAGE_DESCRIPTIONS = ;
|
||||
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalPackages ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalTestPackages ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalLibPackages ] ;
|
||||
|
||||
local optionalPackageDescriptions ;
|
||||
if $(HAIKU_IMAGE_OPTIONAL_PACKAGE_DESCRIPTIONS) {
|
||||
optionalPackageDescriptions = <haiku-image>optional_package_descriptions ;
|
||||
MakeLocate $(optionalPackageDescriptions)
|
||||
: $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) ;
|
||||
|
||||
Depends $(optionalPackageDescriptions)
|
||||
: $(HAIKU_IMAGE_OPTIONAL_PACKAGE_DESCRIPTIONS) ;
|
||||
|
||||
actions together BuildOptionalPackageDescriptions
|
||||
{
|
||||
cat $(2) > $(1)
|
||||
}
|
||||
|
||||
BuildOptionalPackageDescriptions $(optionalPackageDescriptions)
|
||||
: $(HAIKU_IMAGE_OPTIONAL_PACKAGE_DESCRIPTIONS) ;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - User/Group Setup
|
||||
|
||||
|
||||
# add the root user and the root and users groups
|
||||
AddUserToHaikuImage $(HAIKU_ROOT_USER_NAME:E=baron) : 0 : 0 : /boot/home
|
||||
: /bin/bash : $(HAIKU_ROOT_USER_REAL_NAME:E="Root User") ;
|
||||
AddGroupToHaikuImage root : 0 : ;
|
||||
AddGroupToHaikuImage users : 100 : ;
|
||||
|
||||
|
||||
#pragma mark - Host Name
|
||||
|
||||
|
||||
if $(HAIKU_IMAGE_HOST_NAME) {
|
||||
actions BuildHaikuImageHostnameFile
|
||||
{
|
||||
echo "$(HAIKU_IMAGE_HOST_NAME)" > $(1)
|
||||
}
|
||||
|
||||
local file = <haiku-image>hostname ;
|
||||
Always $(file) ;
|
||||
MakeLocate $(file) : $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) ;
|
||||
BuildHaikuImageHostnameFile $(file) ;
|
||||
AddFilesToHaikuImage common settings network : $(file) ;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Build The Image
|
||||
|
||||
|
||||
# Execute pre-image user config rules.
|
||||
UserBuildConfigRulePreImage ;
|
||||
|
||||
# Set image name and directory defaults and locate the image.
|
||||
HAIKU_IMAGE_NAME ?= $(HAIKU_DEFAULT_IMAGE_NAME) ;
|
||||
HAIKU_IMAGE_DIR ?= $(HAIKU_DEFAULT_IMAGE_DIR) ;
|
||||
HAIKU_IMAGE = $(HAIKU_IMAGE_NAME) ;
|
||||
HAIKU_IMAGE_SIZE ?= $(HAIKU_DEFAULT_IMAGE_SIZE) ; # 300 MB
|
||||
HAIKU_IMAGE_LABEL ?= $(HAIKU_DEFAULT_IMAGE_LABEL) ;
|
||||
MakeLocate $(HAIKU_IMAGE) : $(HAIKU_IMAGE_DIR) ;
|
||||
|
||||
# Set the default installation directory.
|
||||
HAIKU_INSTALL_DIR ?= $(HAIKU_DEFAULT_INSTALL_DIR) ;
|
||||
|
||||
# the pseudo target all image contents is attached to
|
||||
NotFile $(HAIKU_IMAGE_CONTAINER_NAME) ;
|
||||
|
||||
# prepare the script that initializes the shell variables
|
||||
HAIKU_IMAGE_INIT_VARIABLES_SCRIPT = <HaikuImage>haiku.image-init-vars ;
|
||||
local script = $(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT) ;
|
||||
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
|
||||
Always $(script) ;
|
||||
|
||||
AddVariableToScript $(script) : sourceDir : $(HAIKU_TOP) ;
|
||||
AddVariableToScript $(script) : outputDir : $(HAIKU_OUTPUT_DIR) ;
|
||||
AddVariableToScript $(script) : tmpDir : $(HAIKU_TMP_DIR) ;
|
||||
AddVariableToScript $(script) : installDir : $(HAIKU_INSTALL_DIR) ;
|
||||
#AddVariableToScript $(script) : isImage : 1 ;
|
||||
AddVariableToScript $(script) : imageSize : $(HAIKU_IMAGE_SIZE) ;
|
||||
AddVariableToScript $(script) : imageLabel : $(HAIKU_IMAGE_LABEL) ;
|
||||
AddVariableToScript $(script) : addBuildCompatibilityLibDir
|
||||
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
|
||||
AddVariableToScript $(script) : dontClearImage : $(HAIKU_DONT_CLEAR_IMAGE) ;
|
||||
AddVariableToScript $(script) : updateOnly : [ IsUpdateHaikuImageOnly ] ;
|
||||
AddVariableToScript $(script) : stripOptionalPackageDebugSymbols
|
||||
: $(HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES) ;
|
||||
AddTargetVariableToScript $(script) : <build>addattr ;
|
||||
AddTargetVariableToScript $(script) : <build>bfs_shell : bfsShell ;
|
||||
AddTargetVariableToScript $(script) : <build>fs_shell_command : fsShellCommand ;
|
||||
AddTargetVariableToScript $(script) : <build>copyattr ;
|
||||
AddTargetVariableToScript $(script) : <build>create_image : createImage ;
|
||||
AddTargetVariableToScript $(script) : <build>makebootable ;
|
||||
AddTargetVariableToScript $(script) : <build>rc ;
|
||||
AddTargetVariableToScript $(script) : <build>resattr ;
|
||||
AddTargetVariableToScript $(script) : <build>unzip ;
|
||||
AddTargetVariableToScript $(script) : <build>vmdkimage ;
|
||||
if $(HOST_RM_ATTRS_TARGET) {
|
||||
AddTargetVariableToScript $(script) : $(HOST_RM_ATTRS_TARGET) : rmAttrs ;
|
||||
} else {
|
||||
AddVariableToScript $(script) : rmAttrs : rm ;
|
||||
}
|
||||
if $(optionalPackageDescriptions) {
|
||||
AddTargetVariableToScript $(script) : $(optionalPackageDescriptions)
|
||||
: optionalPackageDescriptions ;
|
||||
}
|
||||
|
||||
|
||||
# create the other scripts
|
||||
HAIKU_IMAGE_MAKE_DIRS_SCRIPT = <HaikuImage>haiku.image-make-dirs ;
|
||||
HAIKU_IMAGE_COPY_FILES_SCRIPT = <HaikuImage>haiku.image-copy-files ;
|
||||
HAIKU_IMAGE_EXTRACT_FILES_SCRIPT = <HaikuImage>haiku.image-extract-files ;
|
||||
MakeLocate $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) $(HAIKU_IMAGE_COPY_FILES_SCRIPT)
|
||||
$(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT) : $(HAIKU_OUTPUT_DIR) ;
|
||||
|
||||
CreateHaikuImageMakeDirectoriesScript $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) ;
|
||||
CreateHaikuImageCopyFilesScript $(HAIKU_IMAGE_COPY_FILES_SCRIPT) ;
|
||||
CreateHaikuImageExtractFilesScript $(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT) ;
|
||||
|
||||
# Convenience wrapper rule around BuildHaikuImage.
|
||||
rule _BuildHaikuImage image : isImage : isVMwareImage
|
||||
{
|
||||
# _BuildHaikuImage <image target> : <isImage> : <isVMwareImage> ;
|
||||
#
|
||||
|
||||
# build the image
|
||||
# HAIKU_IMAGE_EARLY_USER_SCRIPTS, HAIKU_IMAGE_LATE_USER_SCRIPTS can be
|
||||
# specified by the user.
|
||||
BuildHaikuImage $(image) :
|
||||
$(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT)
|
||||
$(HAIKU_IMAGE_EARLY_USER_SCRIPTS)
|
||||
$(HAIKU_IMAGE_MAKE_DIRS_SCRIPT)
|
||||
$(HAIKU_IMAGE_COPY_FILES_SCRIPT)
|
||||
$(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT)
|
||||
$(HAIKU_IMAGE_LATE_USER_SCRIPTS)
|
||||
: $(isImage)
|
||||
: $(isVMwareImage)
|
||||
;
|
||||
|
||||
# remove the scripts we have generated
|
||||
RmTemps $(image) :
|
||||
$(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT)
|
||||
$(HAIKU_IMAGE_MAKE_DIRS_SCRIPT)
|
||||
$(HAIKU_IMAGE_COPY_FILES_SCRIPT)
|
||||
$(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT)
|
||||
;
|
||||
}
|
||||
|
||||
# build the image
|
||||
_BuildHaikuImage $(HAIKU_IMAGE) : true ;
|
||||
NotFile haiku-image ;
|
||||
Depends haiku-image : $(HAIKU_IMAGE) ;
|
||||
|
||||
|
||||
# install Haiku into a directory
|
||||
NotFile install-haiku ;
|
||||
_BuildHaikuImage install-haiku : 0 ;
|
||||
|
||||
|
||||
# build the VMware image
|
||||
HAIKU_VMWARE_IMAGE_NAME ?= $(HAIKU_DEFAULT_VMWARE_IMAGE_NAME) ;
|
||||
HAIKU_VMWARE_IMAGE = $(HAIKU_VMWARE_IMAGE_NAME) ;
|
||||
MakeLocate $(HAIKU_VMWARE_IMAGE) : $(HAIKU_IMAGE_DIR) ;
|
||||
|
||||
_BuildHaikuImage $(HAIKU_VMWARE_IMAGE) : true : true ;
|
||||
NotFile haiku-vmware-image ;
|
||||
Depends haiku-vmware-image : $(HAIKU_VMWARE_IMAGE) ;
|
||||
|
||||
# Execute post-image user config rules.
|
||||
UserBuildConfigRulePostImage ;
|
@ -5,6 +5,7 @@
|
||||
local X86_ONLY = ;
|
||||
local PPC_ONLY = ;
|
||||
local M68K_ONLY = ;
|
||||
local ARM_ONLY = ;
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
X86_ONLY = "" ;
|
||||
} else if $(TARGET_ARCH) = ppc {
|
||||
@ -86,8 +87,8 @@ SYSTEM_DEMOS = BSnow Chart Clock Cortex FontDemo $(X86_ONLY)GLTeapot
|
||||
SYSTEM_LIBS =
|
||||
libbe.so libbsd.so libbnetapi.so
|
||||
libdebug.so libdevice.so
|
||||
libgame.so $(X86_ONLY)libGL.so libgnu.so
|
||||
libmail.so libmedia.so libmidi.so libmidi2.so
|
||||
libgame.so $(X86_ONLY)libGL.so $(X86_ONLY)libglut.so
|
||||
libgnu.so libmail.so libmedia.so libmidi.so libmidi2.so
|
||||
libnetwork.so
|
||||
<revisioned>libroot.so libroot-addon-icu.so
|
||||
libscreensaver.so
|
||||
@ -246,8 +247,8 @@ AddFilesToHaikuImage system add-ons kernel debugger
|
||||
AddFilesToHaikuImage system add-ons kernel file_systems
|
||||
: $(SYSTEM_ADD_ONS_FILE_SYSTEMS) ;
|
||||
AddFilesToHaikuImage system add-ons kernel generic
|
||||
: $(ATA_ONLY)ata_adapter dpc $(IDE_ONLY)ide_adapter locked_pool mpu401
|
||||
scsi_periph <module>tty ;
|
||||
: $(ATA_ONLY)ata_adapter $(X86_ONLY)bios dpc $(IDE_ONLY)ide_adapter
|
||||
locked_pool mpu401 scsi_periph <module>tty ; #$(X86_ONLY)cpuidle ;
|
||||
AddFilesToHaikuImage system add-ons kernel partitioning_systems
|
||||
: amiga_rdb apple efi_gpt intel session ;
|
||||
AddFilesToHaikuImage system add-ons kernel interrupt_controllers
|
||||
@ -261,6 +262,7 @@ if $(TARGET_ARCH) = x86 {
|
||||
AddNewDriversToHaikuImage disk scsi : scsi_cd scsi_disk ;
|
||||
AddNewDriversToHaikuImage power : $(X86_ONLY)enhanced_speedstep ;
|
||||
AddNewDriversToHaikuImage power : $(X86_ONLY)acpi_battery ;
|
||||
#AddNewDriversToHaikuImage power : $(X86_ONLY)x86_cpuidle ;
|
||||
|
||||
# legacy drivers
|
||||
AddDriversToHaikuImage : console dprintf null
|
||||
@ -305,9 +307,8 @@ if $(HAIKU_GCC_VERSION[1]) = 2 {
|
||||
}
|
||||
|
||||
|
||||
# libGL.so has GLU (like BeOS) *and* GLUT API built-in
|
||||
SYSTEM_LIBS_LIBGL_ALIASES
|
||||
= libGLU.so libglut.so ;
|
||||
# libGL.so has GLU (like BeOS) built-in
|
||||
SYSTEM_LIBS_LIBGL_ALIASES = libGLU.so ;
|
||||
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
local lib ;
|
||||
|
@ -48,9 +48,9 @@ rule KernelLd
|
||||
# libsupc++ is opt-out.
|
||||
local libs ;
|
||||
if ! [ on $(1) return HAIKU_NO_LIBSUPC++ ] {
|
||||
libs += $(TARGET_STATIC_LIBSUPC++) ;
|
||||
libs += $(TARGET_KERNEL_LIBSUPC++) ;
|
||||
}
|
||||
LINKLIBS on $(1) = $(libs) $(TARGET_GCC_LIBGCC) ;
|
||||
LINKLIBS on $(1) = $(libs) $(TARGET_KERNEL_LIBGCC) ;
|
||||
|
||||
# TODO: Do we really want to invoke SetupKernel here? The objects should
|
||||
# have been compiled with KernelObjects anyway, so we're doing that twice.
|
||||
@ -77,6 +77,24 @@ actions KernelLd bind VERSION_SCRIPT
|
||||
--version-script=$(VERSION_SCRIPT)
|
||||
}
|
||||
|
||||
rule KernelSo target : source
|
||||
{
|
||||
# KernelSo <target> : <source>
|
||||
|
||||
Depends $(target) : <build>copyattr $(source) ;
|
||||
|
||||
MakeLocateDebug $(1) ;
|
||||
KernelSo1 $(target) : <build>copyattr $(source) ;
|
||||
}
|
||||
|
||||
actions KernelSo1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
|
||||
$(2[1]) --data $(2[2]) $(1) &&
|
||||
$(HAIKU_ELFEDIT) --output-type dyn $(1)
|
||||
}
|
||||
|
||||
rule KernelAddon
|
||||
{
|
||||
# KernelAddon <name> : <sources> : <static-libraries> : <res> ;
|
||||
@ -117,7 +135,7 @@ rule KernelAddon
|
||||
# compile and link
|
||||
SetupKernel $(sources) : $(TARGET_KERNEL_PIC_FLAGS) : false ;
|
||||
local linkFlags = -nostdlib -Xlinker --no-undefined
|
||||
-Xlinker -soname=\"$(target:G=)\" ;
|
||||
-Xlinker -soname=\"$(target:G=)\" $(TARGET_KERNEL_ADDON_LINKFLAGS) ;
|
||||
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ] $(linkFlags) ;
|
||||
Main $(target) : $(sources) ;
|
||||
LinkAgainst $(target) : $(libs) $(kernel) ;
|
||||
|
@ -69,12 +69,20 @@ if $(HAIKU_BUILD_FEATURE_SSL) {
|
||||
HAIKU_ICU_GCC_2_PACKAGE = icu-4.8.1.1-r1a4-x86-gcc2-2012-08-29.zip ;
|
||||
HAIKU_ICU_GCC_4_PACKAGE = icu-4.8.1.1-r1a4-x86-gcc4-2012-08-29.zip ;
|
||||
HAIKU_ICU_PPC_PACKAGE = icu-4.8.1-ppc-2011-08-20.zip ;
|
||||
HAIKU_ICU_ARM_PACKAGE = icu-4.8.1.1-arm-2012-11-16.zip ;
|
||||
HAIKU_ICU_X86_64_PACKAGE = icu-4.8.1.1-x86_64-2012-07-30.zip ;
|
||||
|
||||
if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 {
|
||||
if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = arm || $(TARGET_ARCH) = x86_64 {
|
||||
local icu_package ;
|
||||
if $(TARGET_ARCH) = ppc {
|
||||
icu_package = $(HAIKU_ICU_PPC_PACKAGE) ;
|
||||
HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1-ppc-2011-12-19.zip ;
|
||||
} else if $(TARGET_ARCH) = arm {
|
||||
icu_package = $(HAIKU_ICU_ARM_PACKAGE) ;
|
||||
HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-arm-2012-11-16.zip ;
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
icu_package = $(HAIKU_ICU_X86_64_PACKAGE) ;
|
||||
HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-x86_64-2012-07-30.zip ;
|
||||
} else if $(HAIKU_GCC_VERSION[1]) = 2 {
|
||||
icu_package = $(HAIKU_ICU_GCC_2_PACKAGE) ;
|
||||
HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-x86-gcc2-2011-12-20.zip ;
|
||||
@ -209,8 +217,7 @@ if $(TARGET_ARCH) = x86 {
|
||||
local galliumObjects ;
|
||||
local zipFile ;
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
HAIKU_MESA_FILE = mesa-8.1devel-x86-gcc4-2012-06-07.zip ;
|
||||
#HAIKU_MESA_FILE = mesa-8.1develdbg-x86-gcc4-2012-06-07.zip ;
|
||||
HAIKU_MESA_FILE = mesa-9.0-x86-gcc4-2012-11-17.zip ;
|
||||
glslObject = lib.haiku/libglsl.a ;
|
||||
galliumObjects = lib.haiku/libgallium.a ;
|
||||
} else {
|
||||
@ -401,9 +408,11 @@ if $(TARGET_ARCH) = x86 {
|
||||
|
||||
# Freetype
|
||||
local freetypeBaseURL = $(baseURL)/lib ;
|
||||
if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 {
|
||||
if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 {
|
||||
if $(TARGET_ARCH) = ppc {
|
||||
HAIKU_FREETYPE_FILE = freetype-2.4.9-ppc-gcc4-2012-06-26.zip ;
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
HAIKU_FREETYPE_FILE = freetype-2.4.9-x86_64-2012-08-04.zip ;
|
||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
HAIKU_FREETYPE_FILE = freetype-2.4.9-r1a4-x86-gcc4-2012-09-02.zip ;
|
||||
} else {
|
||||
@ -529,9 +538,11 @@ if $(HAIKU_BUILD_FEATURE_WEBKIT) {
|
||||
|
||||
# libpng
|
||||
local libpngBaseURL = $(baseURL)/lib ;
|
||||
if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 {
|
||||
if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 {
|
||||
if $(TARGET_ARCH) = ppc {
|
||||
HAIKU_LIBPNG_FILE = libpng-1.5.12-ppc-gcc4-2012-08-27.zip ;
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
HAIKU_LIBPNG_FILE = libpng-1.5.12-x86_64-2012-11-18.zip ;
|
||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
HAIKU_LIBPNG_FILE = libpng-1.5.12-x86-gcc4-2012-08-23.zip ;
|
||||
} else {
|
||||
@ -569,9 +580,11 @@ if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 {
|
||||
|
||||
# jpeg
|
||||
local jpegBaseURL = $(baseURL)/lib ;
|
||||
if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 {
|
||||
if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 {
|
||||
if $(TARGET_ARCH) = ppc {
|
||||
HAIKU_JPEG_FILE = jpeg-8d-ppc-gcc4-2012-08-27.zip ;
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
HAIKU_JPEG_FILE = jpeg-8d-x86_64-2012-11-18.zip ;
|
||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
HAIKU_JPEG_FILE = jpeg-8d-x86-gcc4-2012-08-23.zip ;
|
||||
} else {
|
||||
@ -609,9 +622,11 @@ if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 {
|
||||
|
||||
# zlib
|
||||
local zlibBaseURL = $(baseURL)/lib ;
|
||||
if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 {
|
||||
if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 {
|
||||
if $(TARGET_ARCH) = ppc {
|
||||
HAIKU_ZLIB_FILE = zlib-1.2.7-ppc-gcc4-2012-10-30.zip ;
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
HAIKU_ZLIB_FILE = zlib-1.2.7-x86_64-2012-11-18.zip ;
|
||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
HAIKU_ZLIB_FILE = zlib-1.2.7-x86-gcc4-2012-10-30.zip ;
|
||||
} else {
|
||||
|
@ -355,18 +355,25 @@ if [ IsOptionalHaikuImagePackageAdded BurnItNow ] {
|
||||
|
||||
# Bzip
|
||||
if [ IsOptionalHaikuImagePackageAdded Bzip ] {
|
||||
if $(TARGET_ARCH) != x86 {
|
||||
Echo "No optional package Bzip available for $(TARGET_ARCH)" ;
|
||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
bzip2-1.0.6-r1a4-x86-gcc4-2012-08-30.zip
|
||||
: $(baseURL)/bzip2-1.0.6-r1a4-x86-gcc4-2012-08-30.zip
|
||||
: : true ;
|
||||
} else {
|
||||
InstallOptionalHaikuImagePackage
|
||||
bzip2-1.0.6-r1a4-x86-gcc2-2012-08-27.zip
|
||||
: $(baseURL)/bzip2-1.0.6-r1a4-x86-gcc2-2012-08-27.zip
|
||||
: : true ;
|
||||
}
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
bzip2-1.0.6-r1a4-x86-gcc4-2012-08-30.zip
|
||||
: $(baseURL)/bzip2-1.0.6-r1a4-x86-gcc4-2012-08-30.zip
|
||||
bzip2-1.0.6-x86_64-2012-08-16.zip
|
||||
: $(baseURL)/bzip2-1.0.6-x86_64-2012-08-16.zip
|
||||
: : true ;
|
||||
} else {
|
||||
InstallOptionalHaikuImagePackage
|
||||
bzip2-1.0.6-r1a4-x86-gcc2-2012-08-27.zip
|
||||
: $(baseURL)/bzip2-1.0.6-r1a4-x86-gcc2-2012-08-27.zip
|
||||
: : true ;
|
||||
Echo "No optional package Bzip available for $(TARGET_ARCH)" ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -609,125 +616,181 @@ if [ IsOptionalHaikuImagePackageAdded DemoPackage_Video ] {
|
||||
|
||||
|
||||
# Development
|
||||
if [ IsOptionalHaikuImagePackageAdded Development ] && $(TARGET_ARCH) = x86 {
|
||||
AddFilesToHaikuImage system apps : Debugger ;
|
||||
AddSymlinkToHaikuImage home config settings deskbar Applications
|
||||
: /boot/system/apps/Debugger : Debugger ;
|
||||
# autotools
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
if [ IsOptionalHaikuImagePackageAdded Development ] {
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
AddFilesToHaikuImage system apps : Debugger ;
|
||||
AddSymlinkToHaikuImage home config settings deskbar Applications
|
||||
: /boot/system/apps/Debugger : Debugger ;
|
||||
# autotools
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
autoconf-2.68-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/autoconf-2.68-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: : true ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
automake-1.11.1-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/automake-1.11.1-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: : true ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
libtool-2.4-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/libtool-2.4-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: : true ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
texinfo-4.13a-r1a4-x86-gcc4-2012-08-30.zip
|
||||
: $(baseURL)/texinfo-4.13a-r1a4-x86-gcc4-2012-08-30.zip
|
||||
: : true ;
|
||||
} else {
|
||||
InstallOptionalHaikuImagePackage
|
||||
autoconf-2.68-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/autoconf-2.68-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: : true ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
automake-1.11.1-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/automake-1.11.1-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: : true ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
libtool-2.4-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/libtool-2.4-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: : true ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
texinfo-4.13a-r1a4-x86-gcc2-2012-08-28.zip
|
||||
: $(baseURL)/texinfo-4.13a-r1a4-x86-gcc2-2012-08-28.zip
|
||||
: : true ;
|
||||
}
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
autoconf-2.68-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/autoconf-2.68-r1a4-x86-gcc4-2012-08-28.zip
|
||||
autoconf-2.69-x86_64-2012-08-17.zip
|
||||
: $(baseURL)/autoconf-2.69-x86_64-2012-08-17.zip
|
||||
: : true ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
automake-1.11.1-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/automake-1.11.1-r1a4-x86-gcc4-2012-08-28.zip
|
||||
automake-1.12.2-x86_64-2012-08-17.zip
|
||||
: $(baseURL)/automake-1.12.2-x86_64-2012-08-17.zip
|
||||
: : true ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
libtool-2.4-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/libtool-2.4-r1a4-x86-gcc4-2012-08-28.zip
|
||||
libtool-2.4.2-x86_64-2012-08-17.zip
|
||||
: $(baseURL)/libtool-2.4.2-x86_64-2012-08-17.zip
|
||||
: : true ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
texinfo-4.13a-r1a4-x86-gcc4-2012-08-30.zip
|
||||
: $(baseURL)/texinfo-4.13a-r1a4-x86-gcc4-2012-08-30.zip
|
||||
: : true ;
|
||||
} else {
|
||||
InstallOptionalHaikuImagePackage
|
||||
autoconf-2.68-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/autoconf-2.68-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: : true ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
automake-1.11.1-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/automake-1.11.1-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: : true ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
libtool-2.4-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/libtool-2.4-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: : true ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
texinfo-4.13a-r1a4-x86-gcc2-2012-08-28.zip
|
||||
: $(baseURL)/texinfo-4.13a-r1a4-x86-gcc2-2012-08-28.zip
|
||||
texinfo-4.13a-x86_64-2012-08-17.zip
|
||||
: $(baseURL)/texinfo-4.13a-x86_64-2012-08-17.zip
|
||||
: : true ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# DevelopmentBase
|
||||
if [ IsOptionalHaikuImagePackageAdded DevelopmentBase ]
|
||||
&& $(TARGET_ARCH) = x86 {
|
||||
# gcc and binutils
|
||||
if $(HAIKU_GCC_VERSION[1]) = 2 || $(isHybridBuild) {
|
||||
if [ IsOptionalHaikuImagePackageAdded DevelopmentBase ] {
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
# gcc and binutils
|
||||
if $(HAIKU_GCC_VERSION[1]) = 2 || $(isHybridBuild) {
|
||||
InstallOptionalHaikuImagePackage
|
||||
gcc-2.95.3-r1a4-x86-gcc2-2012-11-01.zip
|
||||
: $(baseURL)/gcc-2.95.3-r1a4-x86-gcc2-2012-11-01.zip ;
|
||||
}
|
||||
|
||||
if $(HAIKU_GCC_VERSION[1]) = 2 {
|
||||
# symlink to the appropriate system/lib[/gcc2] folder
|
||||
AddSymlinkToHaikuHybridImage
|
||||
develop abi x86 gcc2 tools gcc-2.95.3-haiku-121101 lib
|
||||
: /system/lib libstdc++.r4.so : : true ;
|
||||
}
|
||||
|
||||
if $(HAIKU_GCC_VERSION[1]) = 4 || $(isHybridBuild) {
|
||||
InstallOptionalHaikuImagePackage
|
||||
gcc-4.6.3-r1a4-x86-gcc4-2012-11-01.zip
|
||||
: $(baseURL)/gcc-4.6.3-r1a4-x86-gcc4-2012-11-01.zip ;
|
||||
}
|
||||
|
||||
if $(HAIKU_GCC_VERSION[1]) = 4 {
|
||||
# symlink cpp to g++'s headers
|
||||
AddSymlinkToHaikuHybridImage develop abi x86 gcc4 headers
|
||||
: ../tools/current/include/g++ : cpp ;
|
||||
|
||||
# symlink to the appropriate system/lib[/gcc4] folder
|
||||
local libs = libstdc++.so libsupc++.so ;
|
||||
for lib in $(libs) {
|
||||
AddSymlinkToHaikuHybridImage
|
||||
develop abi x86 gcc4 tools gcc-4.6.3-haiku-121101 lib
|
||||
: /system/lib $(lib) : : true ;
|
||||
}
|
||||
}
|
||||
|
||||
# other commonly used tools
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
bison-2.4.3-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/bison-2.4.3-r1a4-x86-gcc4-2012-08-28.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
m4-1.4.16-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/m4-1.4.16-r1a4-x86-gcc4-2012-08-28.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
flex-2.5.35-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/flex-2.5.35-r1a4-x86-gcc4-2012-08-28.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
jam-2.5-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/jam-2.5-r1a4-x86-gcc4-2012-08-28.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
mkdepend-1.7-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/mkdepend-1.7-r1a4-x86-gcc4-2012-08-28.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
make-3.82-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/make-3.82-r1a4-x86-gcc4-2012-08-28.zip ;
|
||||
} else {
|
||||
InstallOptionalHaikuImagePackage
|
||||
bison-2.4.3-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/bison-2.4.3-r1a4-x86-gcc2-2012-08-26.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
m4-1.4.16-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/m4-1.4.16-r1a4-x86-gcc2-2012-08-26.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
flex-2.5.35-r1a4-x86-gcc2-2012-09-10.zip
|
||||
: $(baseURL)/flex-2.5.35-r1a4-x86-gcc2-2012-09-10.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
jam-2.5-r1a4-x86-gcc2-2012-08-27.zip
|
||||
: $(baseURL)/jam-2.5-r1a4-x86-gcc2-2012-08-27.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
mkdepend-1.7-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/mkdepend-1.7-r1a4-x86-gcc2-2012-08-26.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
make-3.82-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/make-3.82-r1a4-x86-gcc2-2012-08-26.zip ;
|
||||
}
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
# gcc and binutils
|
||||
InstallOptionalHaikuImagePackage
|
||||
gcc-2.95.3-r1a4-x86-gcc2-2012-11-01.zip
|
||||
: $(baseURL)/gcc-2.95.3-r1a4-x86-gcc2-2012-11-01.zip ;
|
||||
}
|
||||
gcc-4.6.2-x86_64-2012-08-16.zip
|
||||
: $(baseURL)/gcc-4.6.2-x86_64-2012-08-16.zip ;
|
||||
|
||||
if $(HAIKU_GCC_VERSION[1]) = 2 {
|
||||
# symlink to the appropriate system/lib[/gcc2] folder
|
||||
AddSymlinkToHaikuHybridImage
|
||||
develop abi x86 gcc2 tools gcc-2.95.3-haiku-121101 lib
|
||||
: /system/lib libstdc++.r4.so : : true ;
|
||||
}
|
||||
|
||||
if $(HAIKU_GCC_VERSION[1]) = 4 || $(isHybridBuild) {
|
||||
InstallOptionalHaikuImagePackage
|
||||
gcc-4.6.3-r1a4-x86-gcc4-2012-11-01.zip
|
||||
: $(baseURL)/gcc-4.6.3-r1a4-x86-gcc4-2012-11-01.zip ;
|
||||
}
|
||||
|
||||
if $(HAIKU_GCC_VERSION[1]) = 4 {
|
||||
# symlink cpp to g++'s headers
|
||||
AddSymlinkToHaikuHybridImage develop abi x86 gcc4 headers
|
||||
AddSymlinkToHaikuHybridImage develop abi x86_64 gcc4 headers
|
||||
: ../tools/current/include/g++ : cpp ;
|
||||
|
||||
# symlink to the appropriate system/lib[/gcc4] folder
|
||||
local libs = libstdc++.so libsupc++.so ;
|
||||
for lib in $(libs) {
|
||||
AddSymlinkToHaikuHybridImage
|
||||
develop abi x86 gcc4 tools gcc-4.6.3-haiku-121101 lib
|
||||
develop abi x86_64 gcc4 tools gcc-4.6.2-haiku-120816 lib
|
||||
: /system/lib $(lib) : : true ;
|
||||
}
|
||||
}
|
||||
|
||||
# other commonly used tools
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
bison-2.4.3-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/bison-2.4.3-r1a4-x86-gcc4-2012-08-28.zip ;
|
||||
bison-2.5-x86_64-2012-08-12.zip
|
||||
: $(baseURL)/bison-2.5-x86_64-2012-08-12.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
m4-1.4.16-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/m4-1.4.16-r1a4-x86-gcc4-2012-08-28.zip ;
|
||||
m4-1.4.16-x86_64-2012-08-12.zip
|
||||
: $(baseURL)/m4-1.4.16-x86_64-2012-08-12.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
flex-2.5.35-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/flex-2.5.35-r1a4-x86-gcc4-2012-08-28.zip ;
|
||||
flex-2.5.35-x86_64-2012-08-18.zip
|
||||
: $(baseURL)/flex-2.5.35-x86_64-2012-08-18.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
jam-2.5-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/jam-2.5-r1a4-x86-gcc4-2012-08-28.zip ;
|
||||
jam-2.5-x86_64-2012-08-12.zip
|
||||
: $(baseURL)/jam-2.5-x86_64-2012-08-12.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
mkdepend-1.7-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/mkdepend-1.7-r1a4-x86-gcc4-2012-08-28.zip ;
|
||||
mkdepend-1.7-x86_64-2012-08-14.zip
|
||||
: $(baseURL)/mkdepend-1.7-x86_64-2012-08-14.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
make-3.82-r1a4-x86-gcc4-2012-08-28.zip
|
||||
: $(baseURL)/make-3.82-r1a4-x86-gcc4-2012-08-28.zip ;
|
||||
} else {
|
||||
InstallOptionalHaikuImagePackage
|
||||
bison-2.4.3-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/bison-2.4.3-r1a4-x86-gcc2-2012-08-26.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
m4-1.4.16-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/m4-1.4.16-r1a4-x86-gcc2-2012-08-26.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
flex-2.5.35-r1a4-x86-gcc2-2012-09-10.zip
|
||||
: $(baseURL)/flex-2.5.35-r1a4-x86-gcc2-2012-09-10.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
jam-2.5-r1a4-x86-gcc2-2012-08-27.zip
|
||||
: $(baseURL)/jam-2.5-r1a4-x86-gcc2-2012-08-27.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
mkdepend-1.7-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/mkdepend-1.7-r1a4-x86-gcc2-2012-08-26.zip ;
|
||||
InstallOptionalHaikuImagePackage
|
||||
make-3.82-r1a4-x86-gcc2-2012-08-26.zip
|
||||
: $(baseURL)/make-3.82-r1a4-x86-gcc2-2012-08-26.zip ;
|
||||
make-3.82-x86_64-2012-08-11.zip
|
||||
: $(baseURL)/make-3.82-x86_64-2012-08-11.zip ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -754,7 +817,8 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentJava ] {
|
||||
|
||||
|
||||
# DevelopmentMin
|
||||
if [ IsOptionalHaikuImagePackageAdded DevelopmentMin ] && $(TARGET_ARCH) = x86 {
|
||||
if [ IsOptionalHaikuImagePackageAdded DevelopmentMin ]
|
||||
&& ( $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 ) {
|
||||
if ! ( $(HAIKU_GCC_VERSION[1]) in 2 4 ) {
|
||||
Exit "Optional package DevelopmentMin: Unsupported GCC version:"
|
||||
$(HAIKU_GCC_VERSION[1]) ;
|
||||
@ -988,9 +1052,7 @@ if [ IsOptionalHaikuImagePackageAdded friss ] {
|
||||
|
||||
# GetText
|
||||
if [ IsOptionalHaikuImagePackageAdded GetText ] {
|
||||
if $(TARGET_ARCH) != x86 {
|
||||
Echo "No optional package GetText available for $(TARGET_ARCH)" ;
|
||||
} else {
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
gettext-0.18.1.1-r1a4-x86-gcc4-2012-08-30.zip
|
||||
@ -1002,6 +1064,13 @@ if [ IsOptionalHaikuImagePackageAdded GetText ] {
|
||||
: $(baseURL)/gettext-0.18.1.1-r1a4-x86-gcc2-2012-08-28.zip
|
||||
: : true ;
|
||||
}
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
gettext-0.18.1.1-x86_64-2012-08-17.zip
|
||||
: $(baseURL)/gettext-0.18.1.1-x86_64-2012-08-17.zip
|
||||
: : true ;
|
||||
} else {
|
||||
Echo "No optional package GetText available for $(TARGET_ARCH)" ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1100,9 +1169,7 @@ if [ IsOptionalHaikuImagePackageAdded HGrep ] {
|
||||
|
||||
# ICU
|
||||
if [ IsOptionalHaikuImagePackageAdded ICU ] {
|
||||
if $(TARGET_ARCH) != x86 {
|
||||
Echo "No optional package ICU available for $(TARGET_ARCH)" ;
|
||||
} else {
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
if $(HAIKU_GCC_VERSION[1]) = 2 {
|
||||
# unzip gcc2
|
||||
InstallOptionalHaikuImagePackage $(HAIKU_ICU_GCC_2_PACKAGE)
|
||||
@ -1126,6 +1193,16 @@ if [ IsOptionalHaikuImagePackageAdded ICU ] {
|
||||
: system lib gcc2 ;
|
||||
}
|
||||
}
|
||||
} else if $(TARGET_ARCH) = arm {
|
||||
InstallOptionalHaikuImagePackage $(HAIKU_ICU_ARM_PACKAGE)
|
||||
: $(baseURL)/(HAIKU_ICU_ARM_PACKAGE)
|
||||
: system lib ;
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
InstallOptionalHaikuImagePackage $(HAIKU_ICU_X86_64_PACKAGE)
|
||||
: $(baseURL)/$(HAIKU_ICU_X86_64_PACKAGE)
|
||||
: system lib ;
|
||||
} else {
|
||||
Echo "No optional package ICU available for $(TARGET_ARCH)" ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1374,9 +1451,7 @@ if [ IsOptionalHaikuImagePackageAdded Mercurial ] {
|
||||
|
||||
# Nano
|
||||
if [ IsOptionalHaikuImagePackageAdded Nano ] {
|
||||
if $(TARGET_ARCH) != x86 {
|
||||
Echo "No optional package Nano available for $(TARGET_ARCH)" ;
|
||||
} else {
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
nano-2.2.6-r1a4-x86-gcc4-2012-08-30.zip
|
||||
@ -1386,6 +1461,12 @@ if [ IsOptionalHaikuImagePackageAdded Nano ] {
|
||||
nano-2.2.6-r1a4-x86-gcc2-2012-08-28.zip
|
||||
: $(baseURL)/nano-2.2.6-r1a4-x86-gcc2-2012-08-28.zip ;
|
||||
}
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
nano-2.3.1-x86_64-2012-08-17.zip
|
||||
: $(baseURL)/nano-2.3.1-x86_64-2012-08-17.zip ;
|
||||
} else {
|
||||
Echo "No optional package Nano available for $(TARGET_ARCH)" ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1627,9 +1708,7 @@ if [ IsOptionalHaikuImagePackageAdded Pe ] {
|
||||
|
||||
# Perl
|
||||
if [ IsOptionalHaikuImagePackageAdded Perl ] {
|
||||
if $(TARGET_ARCH) != x86 {
|
||||
Echo "No optional package Perl available for $(TARGET_ARCH)" ;
|
||||
} else {
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
perl-5.10.1-r1a4-x86-gcc4-2012-10-17.zip
|
||||
@ -1641,6 +1720,13 @@ if [ IsOptionalHaikuImagePackageAdded Perl ] {
|
||||
: $(baseURL)/perl-5.10.1-r1a4-x86-gcc2-2012-08-27.zip
|
||||
: : true ;
|
||||
}
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
perl-5.10.1-x86_64-2012-08-17.zip
|
||||
: $(baseURL)/perl-5.10.1-x86_64-2012-08-17.zip
|
||||
: : true ;
|
||||
} else {
|
||||
Echo "No optional package Perl available for $(TARGET_ARCH)" ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1719,16 +1805,22 @@ if [ IsOptionalHaikuImagePackageAdded Ruby ] {
|
||||
|
||||
# Sed
|
||||
if [ IsOptionalHaikuImagePackageAdded Sed ] {
|
||||
if $(TARGET_ARCH) != x86 {
|
||||
Echo "No optional package Sed available for $(TARGET_ARCH)" ;
|
||||
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
sed-4.2.1-r1a4-x86-gcc4-2012-08-31.zip
|
||||
: $(baseURL)/sed-4.2.1-r1a4-x86-gcc4-2012-08-31.zip ;
|
||||
} else {
|
||||
InstallOptionalHaikuImagePackage
|
||||
sed-4.2.1-r1a4-x86-gcc2-2012-08-27.zip
|
||||
: $(baseURL)/sed-4.2.1-r1a4-x86-gcc2-2012-08-27.zip ;
|
||||
}
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
sed-4.2.1-r1a4-x86-gcc4-2012-08-31.zip
|
||||
: $(baseURL)/sed-4.2.1-r1a4-x86-gcc4-2012-08-31.zip ;
|
||||
sed-4.2.1-x86_64-2012-08-14.zip
|
||||
: $(baseURL)/sed-4.2.1-x86_64-2012-08-14.zip ;
|
||||
} else {
|
||||
InstallOptionalHaikuImagePackage
|
||||
sed-4.2.1-r1a4-x86-gcc2-2012-08-27.zip
|
||||
: $(baseURL)/sed-4.2.1-r1a4-x86-gcc2-2012-08-27.zip ;
|
||||
Echo "No optional package Sed available for $(TARGET_ARCH)" ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1789,9 +1881,7 @@ if [ IsOptionalHaikuImagePackageAdded TagLib ] {
|
||||
|
||||
# Tar
|
||||
if [ IsOptionalHaikuImagePackageAdded Tar ] {
|
||||
if $(TARGET_ARCH) != x86 {
|
||||
Echo "No optional package Tar available for $(TARGET_ARCH)" ;
|
||||
} else {
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 4 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
tar-1.26-r1a4-x86-gcc4-2012-09-03.zip
|
||||
@ -1801,6 +1891,12 @@ if [ IsOptionalHaikuImagePackageAdded Tar ] {
|
||||
tar-1.26-r1a4-x86-gcc2-2012-08-29.zip
|
||||
: $(baseURL)/tar-1.26-r1a4-x86-gcc2-2012-08-29.zip ;
|
||||
}
|
||||
} else if $(TARGET_ARCH) = x86_64 {
|
||||
InstallOptionalHaikuImagePackage
|
||||
tar-1.26-x86_64-2012-08-12.zip
|
||||
: $(baseURL)/tar-1.26-x86_64-2012-08-12.zip ;
|
||||
} else {
|
||||
Echo "No optional package Tar available for $(TARGET_ARCH)" ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@ x86_64-*)
|
||||
# failure
|
||||
binutilsConfigureArgs=""
|
||||
gccConfigureArgs=""
|
||||
kernelCcFlags="-mno-red-zone"
|
||||
;;
|
||||
m68k-*)
|
||||
binutilsConfigureArgs="--enable-multilib"
|
||||
@ -45,6 +46,7 @@ arm-*)
|
||||
*)
|
||||
binutilsConfigureArgs="--disable-multilib"
|
||||
gccConfigureArgs="--disable-multilib"
|
||||
kernelCcFlags=
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -101,13 +103,14 @@ installDir=$haikuOutputDir/cross-tools
|
||||
objDir=$haikuOutputDir/cross-tools-build
|
||||
binutilsObjDir=$objDir/binutils
|
||||
gccObjDir=$objDir/gcc
|
||||
stdcxxObjDir=$objDir/stdcxx
|
||||
tmpIncludeDir=$objDir/sysincludes
|
||||
tmpLibDir=$objDir/syslibs
|
||||
|
||||
rm -rf $installDir $objDir
|
||||
|
||||
mkdir -p $installDir $objDir $binutilsObjDir $gccObjDir $tmpIncludeDir \
|
||||
$tmpLibDir || exit 1
|
||||
mkdir -p $installDir $objDir $binutilsObjDir $gccObjDir $stdcxxObjDir \
|
||||
$tmpIncludeDir $tmpLibDir || exit 1
|
||||
mkdir -p $installDir/lib/gcc/$haikuMachine/$gccVersion
|
||||
|
||||
# force the POSIX locale, as the build (makeinfo) might choke otherwise
|
||||
@ -165,6 +168,28 @@ $MAKE $additionalMakeArgs install || {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# build libraries for the kernel if the target arch requires it
|
||||
if [ -n "$kernelCcFlags" ]; then
|
||||
$MAKE -C $haikuMachine/libgcc clean
|
||||
$MAKE -C $haikuMachine/libgcc CFLAGS="-g -O2 $kernelCcFlags" || {
|
||||
echo "Error: Building kernel libgcc failed." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
cp $haikuMachine/libgcc/libgcc.a \
|
||||
$installDir/$haikuMachine/lib/libgcc-kernel.a || exit 1
|
||||
|
||||
$MAKE -C $haikuMachine/libstdc++-v3/libsupc++ clean
|
||||
$MAKE -C $haikuMachine/libstdc++-v3/libsupc++ CFLAGS="-g -O2 $kernelCcFlags" \
|
||||
CXXFLAGS="-g -O2 $kernelCcFlags" || {
|
||||
echo "Error: Building kernel libsupc++ failed." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
cp $haikuMachine/libstdc++-v3/libsupc++/.libs/libsupc++.a \
|
||||
$installDir/$haikuMachine/lib/libsupc++-kernel.a || exit 1
|
||||
fi
|
||||
|
||||
# cleanup
|
||||
|
||||
# remove the system headers from the installation dir
|
||||
|
44
configure
vendored
44
configure
vendored
@ -188,6 +188,17 @@ standard_gcc_settings()
|
||||
HAIKU_STATIC_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.a`
|
||||
HAIKU_SHARED_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.so`
|
||||
|
||||
# If the architecture has separate runtime libraries for the
|
||||
# kernel, use them.
|
||||
HAIKU_KERNEL_LIBGCC=`$HAIKU_CC -print-file-name=libgcc-kernel.a`
|
||||
if [ $HAIKU_KERNEL_LIBGCC = libgcc-kernel.a ]; then
|
||||
HAIKU_KERNEL_LIBGCC=$HAIKU_GCC_LIBGCC
|
||||
fi
|
||||
HAIKU_KERNEL_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++-kernel.a`
|
||||
if [ $HAIKU_KERNEL_LIBSUPCXX = libsupc++-kernel.a ]; then
|
||||
HAIKU_KERNEL_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
|
||||
fi
|
||||
|
||||
local headers
|
||||
if [ -d $gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION ]; then
|
||||
headers=$gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION
|
||||
@ -240,6 +251,21 @@ standard_gcc_settings()
|
||||
echo "Please download it from www.haiku-os.org...";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
HAIKU_KERNEL_LIBGCC=$HAIKU_GCC_LIBGCC
|
||||
HAIKU_KERNEL_LIBSUPCXX=
|
||||
;;
|
||||
esac
|
||||
|
||||
case $HAIKU_GCC_MACHINE in
|
||||
x86_64-*)
|
||||
# Boot loader is 32-bit, need the 32-bit libs.
|
||||
HAIKU_BOOT_LIBGCC=`$HAIKU_CC -m32 -print-libgcc-file-name`
|
||||
HAIKU_BOOT_LIBSUPCXX=`$HAIKU_CC -m32 -print-file-name=libsupc++.a`
|
||||
;;
|
||||
*)
|
||||
HAIKU_BOOT_LIBGCC=$HAIKU_GCC_LIBGCC
|
||||
HAIKU_BOOT_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@ -336,6 +362,7 @@ set_default_value HAIKU_CC gcc
|
||||
set_default_value HAIKU_LD ld
|
||||
set_default_value HAIKU_OBJCOPY objcopy
|
||||
set_default_value HAIKU_RANLIB ranlib
|
||||
set_default_value HAIKU_ELFEDIT elfedit
|
||||
set_default_value HAIKU_YASM yasm
|
||||
set_default_value HAIKU_CPPFLAGS ""
|
||||
set_default_value HAIKU_CCFLAGS ""
|
||||
@ -392,7 +419,7 @@ while [ $# -gt 0 ] ; do
|
||||
buildCrossToolsScript="${buildCrossToolsScript}_gcc4"
|
||||
case "$2" in
|
||||
x86) HAIKU_GCC_MACHINE=i586-pc-haiku;;
|
||||
x86_64) HAIKU_GCC_MACHINE=x86_64-pc-haiku; targetArch=x86_64;;
|
||||
x86_64) HAIKU_GCC_MACHINE=x86_64-unknown-haiku; targetArch=x86_64;;
|
||||
ppc) HAIKU_GCC_MACHINE=powerpc-apple-haiku; targetArch=ppc;;
|
||||
m68k) HAIKU_GCC_MACHINE=m68k-unknown-haiku; targetArch=m68k;;
|
||||
arm) HAIKU_GCC_MACHINE=arm-unknown-haiku; targetArch=arm;;
|
||||
@ -507,6 +534,15 @@ fi
|
||||
# prepare gcc settings
|
||||
standard_gcc_settings
|
||||
|
||||
# cross tools for gcc4 builds
|
||||
if [ -n "$crossToolsPrefix" ]; then
|
||||
case $HAIKU_GCC_RAW_VERSION in
|
||||
4.*)
|
||||
get_build_tool_path ELFEDIT elfedit
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# check whether the Haiku compiler really targets Haiku or BeOS
|
||||
case "$HAIKU_GCC_MACHINE" in
|
||||
*-*-haiku) ;;
|
||||
@ -552,6 +588,11 @@ HAIKU_STATIC_LIBSUPC++ ?= ${HAIKU_STATIC_LIBSUPCXX} ;
|
||||
HAIKU_SHARED_LIBSUPC++ ?= ${HAIKU_SHARED_LIBSUPCXX} ;
|
||||
HAIKU_C++_HEADERS_DIR ?= ${HAIKU_CXX_HEADERS_DIR} ;
|
||||
|
||||
HAIKU_KERNEL_LIBGCC ?= ${HAIKU_KERNEL_LIBGCC} ;
|
||||
HAIKU_KERNEL_LIBSUPC++ ?= ${HAIKU_KERNEL_LIBSUPCXX} ;
|
||||
HAIKU_BOOT_LIBGCC ?= ${HAIKU_BOOT_LIBGCC} ;
|
||||
HAIKU_BOOT_LIBSUPC++ ?= ${HAIKU_BOOT_LIBSUPCXX} ;
|
||||
|
||||
HAIKU_BUILD_ATTRIBUTES_DIR ?= ${HAIKU_BUILD_ATTRIBUTES_DIR} ;
|
||||
|
||||
HAIKU_AR ?= ${HAIKU_AR} ;
|
||||
@ -559,6 +600,7 @@ HAIKU_CC ?= ${HAIKU_CC} ;
|
||||
HAIKU_LD ?= ${HAIKU_LD} ;
|
||||
HAIKU_OBJCOPY ?= ${HAIKU_OBJCOPY} ;
|
||||
HAIKU_RANLIB ?= ${HAIKU_RANLIB} ;
|
||||
HAIKU_ELFEDIT ?= ${HAIKU_ELFEDIT} ;
|
||||
HAIKU_YASM ?= ${HAIKU_YASM} ;
|
||||
HAIKU_CPPFLAGS ?= ${HAIKU_CPPFLAGS} ;
|
||||
HAIKU_CCFLAGS ?= ${HAIKU_CCFLAGS} ;
|
||||
|
@ -96,6 +96,12 @@ fi
|
||||
# We must wait for the app_server and registrar to be ready
|
||||
launch $SERVERS/registrar _roster_thread_ # launch registrar
|
||||
|
||||
# If app_server doesn't exist, just run consoled.
|
||||
if [ ! -f "/boot/$SERVERS/app_server" ]; then
|
||||
/bin/consoled
|
||||
exit
|
||||
fi
|
||||
|
||||
launch $SERVERS/debug_server # launch debug_server
|
||||
|
||||
# Init Network
|
||||
|
@ -17,7 +17,7 @@ BeMac|BeBox)
|
||||
BE_HOST_CPU=ppc
|
||||
;;
|
||||
*)
|
||||
BE_HOST_CPU=unknown
|
||||
BE_HOST_CPU=`uname -m`
|
||||
esac
|
||||
|
||||
BELIBRARIES="$BUILDHOME/abi/current/library-paths/common:$BUILDHOME/lib/$BE_HOST_CPU"
|
||||
|
@ -20,8 +20,13 @@ typedef signed short __haiku_std_int16;
|
||||
typedef unsigned short __haiku_std_uint16;
|
||||
typedef signed int __haiku_std_int32;
|
||||
typedef unsigned int __haiku_std_uint32;
|
||||
#ifdef __HAIKU_ARCH_64_BIT
|
||||
typedef signed long __haiku_std_int64;
|
||||
typedef unsigned long __haiku_std_uint64;
|
||||
#else
|
||||
typedef signed long long __haiku_std_int64;
|
||||
typedef unsigned long long __haiku_std_uint64;
|
||||
#endif
|
||||
|
||||
typedef __haiku_std_int8 __haiku_int8;
|
||||
typedef __haiku_std_uint8 __haiku_uint8;
|
||||
@ -38,17 +43,12 @@ typedef __haiku_std_int64 __haiku_int64;
|
||||
typedef __haiku_std_uint64 __haiku_uint64;
|
||||
|
||||
/* address types */
|
||||
#ifdef __HAIKU_ARCH_64_BIT
|
||||
typedef __haiku_int64 __haiku_saddr_t;
|
||||
typedef __haiku_uint64 __haiku_addr_t;
|
||||
#else
|
||||
typedef __haiku_int32 __haiku_saddr_t;
|
||||
typedef __haiku_uint32 __haiku_addr_t;
|
||||
#endif
|
||||
typedef signed long int __haiku_saddr_t;
|
||||
typedef unsigned long int __haiku_addr_t;
|
||||
|
||||
#ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
|
||||
typedef __haiku_int64 __haiku_phys_saddr_t;
|
||||
typedef __haiku_uint64 __haiku_phys_addr_t;
|
||||
typedef __haiku_int64 __haiku_phys_saddr_t;
|
||||
typedef __haiku_uint64 __haiku_phys_addr_t;
|
||||
#else
|
||||
typedef __haiku_int32 __haiku_phys_saddr_t;
|
||||
typedef __haiku_uint32 __haiku_phys_addr_t;
|
||||
@ -76,20 +76,20 @@ typedef __haiku_std_uint64 __haiku_uint64;
|
||||
|
||||
/* printf()/scanf() format prefixes */
|
||||
#define __HAIKU_STD_PRI_PREFIX_32 ""
|
||||
#define __HAIKU_STD_PRI_PREFIX_64 "ll"
|
||||
#ifdef __HAIKU_ARCH_64_BIT
|
||||
# define __HAIKU_STD_PRI_PREFIX_64 "l"
|
||||
#else
|
||||
# define __HAIKU_STD_PRI_PREFIX_64 "ll"
|
||||
#endif
|
||||
|
||||
#ifdef __HAIKU_BEOS_COMPATIBLE_TYPES
|
||||
# define __HAIKU_PRI_PREFIX_32 "l"
|
||||
# define __HAIKU_PRI_PREFIX_32 "l"
|
||||
#else
|
||||
# define __HAIKU_PRI_PREFIX_32 __HAIKU_STD_PRI_PREFIX_32
|
||||
# define __HAIKU_PRI_PREFIX_32 __HAIKU_STD_PRI_PREFIX_32
|
||||
#endif
|
||||
#define __HAIKU_PRI_PREFIX_64 __HAIKU_STD_PRI_PREFIX_64
|
||||
#define __HAIKU_PRI_PREFIX_64 __HAIKU_STD_PRI_PREFIX_64
|
||||
|
||||
#ifdef __HAIKU_ARCH_64_BIT
|
||||
# define __HAIKU_PRI_PREFIX_ADDR __HAIKU_PRI_PREFIX_64
|
||||
#else
|
||||
# define __HAIKU_PRI_PREFIX_ADDR __HAIKU_PRI_PREFIX_32
|
||||
#endif
|
||||
#define __HAIKU_PRI_PREFIX_ADDR "l"
|
||||
|
||||
#ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
|
||||
# define __HAIKU_PRI_PREFIX_PHYS_ADDR __HAIKU_PRI_PREFIX_64
|
||||
|
197
headers/libs/x86emu/x86emu.h
Normal file
197
headers/libs/x86emu/x86emu.h
Normal file
@ -0,0 +1,197 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Realmode X86 Emulator Library
|
||||
*
|
||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of the authors not be used
|
||||
* in advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. The authors makes no
|
||||
* representations about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for public specific functions.
|
||||
* Any application linking against us should only
|
||||
* include this header
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __X86EMU_X86EMU_H
|
||||
#define __X86EMU_X86EMU_H
|
||||
|
||||
#ifdef SCITECH
|
||||
#include "scitech.h"
|
||||
#define X86API _ASMAPI
|
||||
#define X86APIP _ASMAPIP
|
||||
typedef int X86EMU_pioAddr;
|
||||
#else
|
||||
#include "x86emu/types.h"
|
||||
#define X86API
|
||||
#define X86APIP *
|
||||
#endif
|
||||
#include "x86emu/regs.h"
|
||||
|
||||
/*---------------------- Macros and type definitions ----------------------*/
|
||||
|
||||
#ifdef PACK
|
||||
#pragma PACK /* Don't pack structs with function pointers! */
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Data structure containing ponters to programmed I/O functions used by the
|
||||
emulator. This is used so that the user program can hook all programmed
|
||||
I/O for the emulator to handled as necessary by the user program. By
|
||||
default the emulator contains simple functions that do not do access the
|
||||
hardware in any way. To allow the emualtor access the hardware, you will
|
||||
need to override the programmed I/O functions using the X86EMU_setupPioFuncs
|
||||
function.
|
||||
|
||||
HEADER:
|
||||
x86emu.h
|
||||
|
||||
MEMBERS:
|
||||
inb - Function to read a byte from an I/O port
|
||||
inw - Function to read a word from an I/O port
|
||||
inl - Function to read a dword from an I/O port
|
||||
outb - Function to write a byte to an I/O port
|
||||
outw - Function to write a word to an I/O port
|
||||
outl - Function to write a dword to an I/O port
|
||||
****************************************************************************/
|
||||
typedef struct {
|
||||
u8(X86APIP inb) (X86EMU_pioAddr addr);
|
||||
u16(X86APIP inw) (X86EMU_pioAddr addr);
|
||||
u32(X86APIP inl) (X86EMU_pioAddr addr);
|
||||
void (X86APIP outb) (X86EMU_pioAddr addr, u8 val);
|
||||
void (X86APIP outw) (X86EMU_pioAddr addr, u16 val);
|
||||
void (X86APIP outl) (X86EMU_pioAddr addr, u32 val);
|
||||
} X86EMU_pioFuncs;
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Data structure containing ponters to memory access functions used by the
|
||||
emulator. This is used so that the user program can hook all memory
|
||||
access functions as necessary for the emulator. By default the emulator
|
||||
contains simple functions that only access the internal memory of the
|
||||
emulator. If you need specialised functions to handle access to different
|
||||
types of memory (ie: hardware framebuffer accesses and BIOS memory access
|
||||
etc), you will need to override this using the X86EMU_setupMemFuncs
|
||||
function.
|
||||
|
||||
HEADER:
|
||||
x86emu.h
|
||||
|
||||
MEMBERS:
|
||||
rdb - Function to read a byte from an address
|
||||
rdw - Function to read a word from an address
|
||||
rdl - Function to read a dword from an address
|
||||
wrb - Function to write a byte to an address
|
||||
wrw - Function to write a word to an address
|
||||
wrl - Function to write a dword to an address
|
||||
****************************************************************************/
|
||||
typedef struct {
|
||||
u8(X86APIP rdb) (u32 addr);
|
||||
u16(X86APIP rdw) (u32 addr);
|
||||
u32(X86APIP rdl) (u32 addr);
|
||||
void (X86APIP wrb) (u32 addr, u8 val);
|
||||
void (X86APIP wrw) (u32 addr, u16 val);
|
||||
void (X86APIP wrl) (u32 addr, u32 val);
|
||||
} X86EMU_memFuncs;
|
||||
|
||||
/****************************************************************************
|
||||
Here are the default memory read and write
|
||||
function in case they are needed as fallbacks.
|
||||
***************************************************************************/
|
||||
extern u8 X86API rdb(u32 addr);
|
||||
extern u16 X86API rdw(u32 addr);
|
||||
extern u32 X86API rdl(u32 addr);
|
||||
extern void X86API wrb(u32 addr, u8 val);
|
||||
extern void X86API wrw(u32 addr, u16 val);
|
||||
extern void X86API wrl(u32 addr, u32 val);
|
||||
|
||||
#ifdef END_PACK
|
||||
#pragma END_PACK
|
||||
#endif
|
||||
|
||||
/*--------------------- type definitions -----------------------------------*/
|
||||
|
||||
typedef void (X86APIP X86EMU_intrFuncs) (int num);
|
||||
extern X86EMU_intrFuncs _X86EMU_intrTab[256];
|
||||
|
||||
/*-------------------------- Function Prototypes --------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
void X86EMU_setupMemFuncs(X86EMU_memFuncs * funcs);
|
||||
void X86EMU_setupPioFuncs(X86EMU_pioFuncs * funcs);
|
||||
void X86EMU_setupIntrFuncs(X86EMU_intrFuncs funcs[]);
|
||||
void X86EMU_prepareForInt(int num);
|
||||
|
||||
/* decode.c */
|
||||
|
||||
void X86EMU_exec(void);
|
||||
void X86EMU_halt_sys(void);
|
||||
|
||||
#ifdef DEBUG
|
||||
#define HALT_SYS() \
|
||||
printk("halt_sys: file %s, line %d\n", __FILE__, __LINE__), \
|
||||
X86EMU_halt_sys()
|
||||
#else
|
||||
#define HALT_SYS() X86EMU_halt_sys()
|
||||
#endif
|
||||
|
||||
/* Debug options */
|
||||
|
||||
#define DEBUG_DECODE_F 0x000001 /* print decoded instruction */
|
||||
#define DEBUG_TRACE_F 0x000002 /* dump regs before/after execution */
|
||||
#define DEBUG_STEP_F 0x000004
|
||||
#define DEBUG_DISASSEMBLE_F 0x000008
|
||||
#define DEBUG_BREAK_F 0x000010
|
||||
#define DEBUG_SVC_F 0x000020
|
||||
#define DEBUG_SAVE_IP_CS_F 0x000040
|
||||
#define DEBUG_FS_F 0x000080
|
||||
#define DEBUG_PROC_F 0x000100
|
||||
#define DEBUG_SYSINT_F 0x000200 /* bios system interrupts. */
|
||||
#define DEBUG_TRACECALL_F 0x000400
|
||||
#define DEBUG_INSTRUMENT_F 0x000800
|
||||
#define DEBUG_MEM_TRACE_F 0x001000
|
||||
#define DEBUG_IO_TRACE_F 0x002000
|
||||
#define DEBUG_TRACECALL_REGS_F 0x004000
|
||||
#define DEBUG_DECODE_NOPRINT_F 0x008000
|
||||
#define DEBUG_EXIT 0x010000
|
||||
#define DEBUG_SYS_F (DEBUG_SVC_F|DEBUG_FS_F|DEBUG_PROC_F)
|
||||
|
||||
void X86EMU_trace_regs(void);
|
||||
void X86EMU_trace_xregs(void);
|
||||
void X86EMU_dump_memory(u16 seg, u16 off, u32 amt);
|
||||
int X86EMU_trace_on(void);
|
||||
int X86EMU_trace_off(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif
|
||||
#endif /* __X86EMU_X86EMU_H */
|
209
headers/libs/x86emu/x86emu/debug.h
Normal file
209
headers/libs/x86emu/x86emu/debug.h
Normal file
@ -0,0 +1,209 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Realmode X86 Emulator Library
|
||||
*
|
||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of the authors not be used
|
||||
* in advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. The authors makes no
|
||||
* representations about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for debug definitions.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __X86EMU_DEBUG_H
|
||||
#define __X86EMU_DEBUG_H
|
||||
|
||||
/*---------------------- Macros and type definitions ----------------------*/
|
||||
|
||||
/* checks to be enabled for "runtime" */
|
||||
|
||||
#define CHECK_IP_FETCH_F 0x1
|
||||
#define CHECK_SP_ACCESS_F 0x2
|
||||
#define CHECK_MEM_ACCESS_F 0x4 /*using regular linear pointer */
|
||||
#define CHECK_DATA_ACCESS_F 0x8 /*using segment:offset */
|
||||
|
||||
#ifdef DEBUG
|
||||
#define CHECK_IP_FETCH() (M.x86.check & CHECK_IP_FETCH_F)
|
||||
#define CHECK_SP_ACCESS() (M.x86.check & CHECK_SP_ACCESS_F)
|
||||
#define CHECK_MEM_ACCESS() (M.x86.check & CHECK_MEM_ACCESS_F)
|
||||
#define CHECK_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_F)
|
||||
#else
|
||||
#define CHECK_IP_FETCH()
|
||||
#define CHECK_SP_ACCESS()
|
||||
#define CHECK_MEM_ACCESS()
|
||||
#define CHECK_DATA_ACCESS()
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEBUG_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F)
|
||||
#define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F)
|
||||
#define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F)
|
||||
#define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F)
|
||||
#define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F)
|
||||
#define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_F)
|
||||
#define DEBUG_SVC() (M.x86.debug & DEBUG_SVC_F)
|
||||
#define DEBUG_SAVE_IP_CS() (M.x86.debug & DEBUG_SAVE_IP_CS_F)
|
||||
|
||||
#define DEBUG_FS() (M.x86.debug & DEBUG_FS_F)
|
||||
#define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F)
|
||||
#define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F)
|
||||
#define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F)
|
||||
#define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F)
|
||||
#define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_F)
|
||||
#define DEBUG_MEM_TRACE() (M.x86.debug & DEBUG_MEM_TRACE_F)
|
||||
#define DEBUG_IO_TRACE() (M.x86.debug & DEBUG_IO_TRACE_F)
|
||||
#define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F)
|
||||
#else
|
||||
#define DEBUG_INSTRUMENT() 0
|
||||
#define DEBUG_DECODE() 0
|
||||
#define DEBUG_TRACE() 0
|
||||
#define DEBUG_STEP() 0
|
||||
#define DEBUG_DISASSEMBLE() 0
|
||||
#define DEBUG_BREAK() 0
|
||||
#define DEBUG_SVC() 0
|
||||
#define DEBUG_SAVE_IP_CS() 0
|
||||
#define DEBUG_FS() 0
|
||||
#define DEBUG_PROC() 0
|
||||
#define DEBUG_SYSINT() 0
|
||||
#define DEBUG_TRACECALL() 0
|
||||
#define DEBUG_TRACECALLREGS() 0
|
||||
#define DEBUG_SYS() 0
|
||||
#define DEBUG_MEM_TRACE() 0
|
||||
#define DEBUG_IO_TRACE() 0
|
||||
#define DEBUG_DECODE_NOPRINT() 0
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#define DECODE_PRINTF(x) if (DEBUG_DECODE()) \
|
||||
x86emu_decode_printf(x)
|
||||
#define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \
|
||||
x86emu_decode_printf2(x,y)
|
||||
|
||||
/*
|
||||
* The following allow us to look at the bytes of an instruction. The
|
||||
* first INCR_INSTRN_LEN, is called everytime bytes are consumed in
|
||||
* the decoding process. The SAVE_IP_CS is called initially when the
|
||||
* major opcode of the instruction is accessed.
|
||||
*/
|
||||
#define INC_DECODED_INST_LEN(x) \
|
||||
if (DEBUG_DECODE()) \
|
||||
x86emu_inc_decoded_inst_len(x)
|
||||
|
||||
#define SAVE_IP_CS(x,y) \
|
||||
if (DEBUG_DECODE() | DEBUG_TRACECALL() | DEBUG_BREAK() \
|
||||
| DEBUG_IO_TRACE() | DEBUG_SAVE_IP_CS()) { \
|
||||
M.x86.saved_cs = x; \
|
||||
M.x86.saved_ip = y; \
|
||||
}
|
||||
#else
|
||||
#define INC_DECODED_INST_LEN(x)
|
||||
#define DECODE_PRINTF(x)
|
||||
#define DECODE_PRINTF2(x,y)
|
||||
#define SAVE_IP_CS(x,y)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define TRACE_REGS() \
|
||||
if (DEBUG_DISASSEMBLE()) { \
|
||||
x86emu_just_disassemble(); \
|
||||
goto EndOfTheInstructionProcedure; \
|
||||
} \
|
||||
if (DEBUG_TRACE() || DEBUG_DECODE()) X86EMU_trace_regs()
|
||||
#else
|
||||
#define TRACE_REGS()
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define SINGLE_STEP() if (DEBUG_STEP()) x86emu_single_step()
|
||||
#else
|
||||
#define SINGLE_STEP()
|
||||
#endif
|
||||
|
||||
#define TRACE_AND_STEP() \
|
||||
TRACE_REGS(); \
|
||||
SINGLE_STEP()
|
||||
|
||||
#ifdef DEBUG
|
||||
#define START_OF_INSTR()
|
||||
#define END_OF_INSTR() EndOfTheInstructionProcedure: x86emu_end_instr();
|
||||
#define END_OF_INSTR_NO_TRACE() x86emu_end_instr();
|
||||
#else
|
||||
#define START_OF_INSTR()
|
||||
#define END_OF_INSTR()
|
||||
#define END_OF_INSTR_NO_TRACE()
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define CALL_TRACE(u,v,w,x,s) \
|
||||
if (DEBUG_TRACECALLREGS()) \
|
||||
x86emu_dump_regs(); \
|
||||
if (DEBUG_TRACECALL()) \
|
||||
printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x);
|
||||
#define RETURN_TRACE(n,u,v) \
|
||||
if (DEBUG_TRACECALLREGS()) \
|
||||
x86emu_dump_regs(); \
|
||||
if (DEBUG_TRACECALL()) \
|
||||
printk("%04x:%04x: %s\n",u,v,n);
|
||||
#else
|
||||
#define CALL_TRACE(u,v,w,x,s)
|
||||
#define RETURN_TRACE(n,u,v)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DB(x) x
|
||||
#else
|
||||
#define DB(x)
|
||||
#endif
|
||||
|
||||
/*-------------------------- Function Prototypes --------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
extern void x86emu_inc_decoded_inst_len(int x);
|
||||
extern void x86emu_decode_printf(const char *x);
|
||||
extern void x86emu_decode_printf2(const char *x, int y);
|
||||
extern void x86emu_just_disassemble(void);
|
||||
extern void x86emu_single_step(void);
|
||||
extern void x86emu_end_instr(void);
|
||||
extern void x86emu_dump_regs(void);
|
||||
extern void x86emu_dump_xregs(void);
|
||||
extern void x86emu_print_int_vect(u16 iv);
|
||||
extern void x86emu_instrument_instruction(void);
|
||||
extern void x86emu_check_ip_access(void);
|
||||
extern void x86emu_check_sp_access(void);
|
||||
extern void x86emu_check_mem_access(u32 p);
|
||||
extern void x86emu_check_data_access(uint s, uint o);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif
|
||||
#endif /* __X86EMU_DEBUG_H */
|
87
headers/libs/x86emu/x86emu/decode.h
Normal file
87
headers/libs/x86emu/x86emu/decode.h
Normal file
@ -0,0 +1,87 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Realmode X86 Emulator Library
|
||||
*
|
||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of the authors not be used
|
||||
* in advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. The authors makes no
|
||||
* representations about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for instruction decoding logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __X86EMU_DECODE_H
|
||||
#define __X86EMU_DECODE_H
|
||||
|
||||
/*---------------------- Macros and type definitions ----------------------*/
|
||||
|
||||
/* Instruction Decoding Stuff */
|
||||
|
||||
#define FETCH_DECODE_MODRM(mod,rh,rl) fetch_decode_modrm(&mod,&rh,&rl)
|
||||
#define DECODE_RM_BYTE_REGISTER(r) decode_rm_byte_register(r)
|
||||
#define DECODE_RM_WORD_REGISTER(r) decode_rm_word_register(r)
|
||||
#define DECODE_RM_LONG_REGISTER(r) decode_rm_long_register(r)
|
||||
#define DECODE_CLEAR_SEGOVR() M.x86.mode &= ~SYSMODE_CLRMASK
|
||||
|
||||
/*-------------------------- Function Prototypes --------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
void x86emu_intr_raise(u8 type);
|
||||
void fetch_decode_modrm(int *mod, int *regh, int *regl);
|
||||
u8 fetch_byte_imm(void);
|
||||
u16 fetch_word_imm(void);
|
||||
u32 fetch_long_imm(void);
|
||||
u8 fetch_data_byte(uint offset);
|
||||
u8 fetch_data_byte_abs(uint segment, uint offset);
|
||||
u16 fetch_data_word(uint offset);
|
||||
u16 fetch_data_word_abs(uint segment, uint offset);
|
||||
u32 fetch_data_long(uint offset);
|
||||
u32 fetch_data_long_abs(uint segment, uint offset);
|
||||
void store_data_byte(uint offset, u8 val);
|
||||
void store_data_byte_abs(uint segment, uint offset, u8 val);
|
||||
void store_data_word(uint offset, u16 val);
|
||||
void store_data_word_abs(uint segment, uint offset, u16 val);
|
||||
void store_data_long(uint offset, u32 val);
|
||||
void store_data_long_abs(uint segment, uint offset, u32 val);
|
||||
u8 *decode_rm_byte_register(int reg);
|
||||
u16 *decode_rm_word_register(int reg);
|
||||
u32 *decode_rm_long_register(int reg);
|
||||
u16 *decode_rm_seg_register(int reg);
|
||||
u32 decode_rm00_address(int rm);
|
||||
u32 decode_rm01_address(int rm);
|
||||
u32 decode_rm10_address(int rm);
|
||||
u32 decode_sib_address(int sib, int mod);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif
|
||||
#endif /* __X86EMU_DECODE_H */
|
60
headers/libs/x86emu/x86emu/fpu.h
Normal file
60
headers/libs/x86emu/x86emu/fpu.h
Normal file
@ -0,0 +1,60 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Realmode X86 Emulator Library
|
||||
*
|
||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of the authors not be used
|
||||
* in advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. The authors makes no
|
||||
* representations about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for FPU instruction decoding.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __X86EMU_FPU_H
|
||||
#define __X86EMU_FPU_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
/* these have to be defined, whether 8087 support compiled in or not. */
|
||||
|
||||
extern void x86emuOp_esc_coprocess_d8(u8 op1);
|
||||
extern void x86emuOp_esc_coprocess_d9(u8 op1);
|
||||
extern void x86emuOp_esc_coprocess_da(u8 op1);
|
||||
extern void x86emuOp_esc_coprocess_db(u8 op1);
|
||||
extern void x86emuOp_esc_coprocess_dc(u8 op1);
|
||||
extern void x86emuOp_esc_coprocess_dd(u8 op1);
|
||||
extern void x86emuOp_esc_coprocess_de(u8 op1);
|
||||
extern void x86emuOp_esc_coprocess_df(u8 op1);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif
|
||||
#endif /* __X86EMU_FPU_H */
|
119
headers/libs/x86emu/x86emu/fpu_regs.h
Normal file
119
headers/libs/x86emu/x86emu/fpu_regs.h
Normal file
@ -0,0 +1,119 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Realmode X86 Emulator Library
|
||||
*
|
||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of the authors not be used
|
||||
* in advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. The authors makes no
|
||||
* representations about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for FPU register definitions.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __X86EMU_FPU_REGS_H
|
||||
#define __X86EMU_FPU_REGS_H
|
||||
|
||||
#ifdef X86_FPU_SUPPORT
|
||||
|
||||
#ifdef PACK
|
||||
#pragma PACK
|
||||
#endif
|
||||
|
||||
/* Basic 8087 register can hold any of the following values: */
|
||||
|
||||
union x86_fpu_reg_u {
|
||||
s8 tenbytes[10];
|
||||
double dval;
|
||||
float fval;
|
||||
s16 sval;
|
||||
s32 lval;
|
||||
};
|
||||
|
||||
struct x86_fpu_reg {
|
||||
union x86_fpu_reg_u reg;
|
||||
char tag;
|
||||
};
|
||||
|
||||
/*
|
||||
* Since we are not going to worry about the problems of aliasing
|
||||
* registers, every time a register is modified, its result type is
|
||||
* set in the tag fields for that register. If some operation
|
||||
* attempts to access the type in a way inconsistent with its current
|
||||
* storage format, then we flag the operation. If common, we'll
|
||||
* attempt the conversion.
|
||||
*/
|
||||
|
||||
#define X86_FPU_VALID 0x80
|
||||
#define X86_FPU_REGTYP(r) ((r) & 0x7F)
|
||||
|
||||
#define X86_FPU_WORD 0x0
|
||||
#define X86_FPU_SHORT 0x1
|
||||
#define X86_FPU_LONG 0x2
|
||||
#define X86_FPU_FLOAT 0x3
|
||||
#define X86_FPU_DOUBLE 0x4
|
||||
#define X86_FPU_LDBL 0x5
|
||||
#define X86_FPU_BSD 0x6
|
||||
|
||||
#define X86_FPU_STKTOP 0
|
||||
|
||||
struct x86_fpu_registers {
|
||||
struct x86_fpu_reg x86_fpu_stack[8];
|
||||
int x86_fpu_flags;
|
||||
int x86_fpu_config; /* rounding modes, etc. */
|
||||
short x86_fpu_tos, x86_fpu_bos;
|
||||
};
|
||||
|
||||
#ifdef END_PACK
|
||||
#pragma END_PACK
|
||||
#endif
|
||||
|
||||
/*
|
||||
* There are two versions of the following macro.
|
||||
*
|
||||
* One version is for opcode D9, for which there are more than 32
|
||||
* instructions encoded in the second byte of the opcode.
|
||||
*
|
||||
* The other version, deals with all the other 7 i87 opcodes, for
|
||||
* which there are only 32 strings needed to describe the
|
||||
* instructions.
|
||||
*/
|
||||
|
||||
#endif /* X86_FPU_SUPPORT */
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DECODE_PRINTINSTR32(t,mod,rh,rl) \
|
||||
DECODE_PRINTF(t[(mod<<3)+(rh)]);
|
||||
#define DECODE_PRINTINSTR256(t,mod,rh,rl) \
|
||||
DECODE_PRINTF(t[(mod<<6)+(rh<<3)+(rl)]);
|
||||
#else
|
||||
#define DECODE_PRINTINSTR32(t,mod,rh,rl)
|
||||
#define DECODE_PRINTINSTR256(t,mod,rh,rl)
|
||||
#endif
|
||||
|
||||
#endif /* __X86EMU_FPU_REGS_H */
|
45
headers/libs/x86emu/x86emu/ops.h
Normal file
45
headers/libs/x86emu/x86emu/ops.h
Normal file
@ -0,0 +1,45 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Realmode X86 Emulator Library
|
||||
*
|
||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of the authors not be used
|
||||
* in advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. The authors makes no
|
||||
* representations about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for operand decoding functions.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __X86EMU_OPS_H
|
||||
#define __X86EMU_OPS_H
|
||||
|
||||
extern void (*x86emu_optab[0x100]) (u8 op1);
|
||||
extern void (*x86emu_optab2[0x100]) (u8 op2);
|
||||
|
||||
#endif /* __X86EMU_OPS_H */
|
1053
headers/libs/x86emu/x86emu/prim_asm.h
Normal file
1053
headers/libs/x86emu/x86emu/prim_asm.h
Normal file
File diff suppressed because it is too large
Load Diff
141
headers/libs/x86emu/x86emu/prim_ops.h
Normal file
141
headers/libs/x86emu/x86emu/prim_ops.h
Normal file
@ -0,0 +1,141 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Realmode X86 Emulator Library
|
||||
*
|
||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of the authors not be used
|
||||
* in advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. The authors makes no
|
||||
* representations about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for primitive operation functions.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __X86EMU_PRIM_OPS_H
|
||||
#define __X86EMU_PRIM_OPS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
u16 aaa_word(u16 d);
|
||||
u16 aas_word(u16 d);
|
||||
u16 aad_word(u16 d);
|
||||
u16 aam_word(u8 d);
|
||||
u8 adc_byte(u8 d, u8 s);
|
||||
u16 adc_word(u16 d, u16 s);
|
||||
u32 adc_long(u32 d, u32 s);
|
||||
u8 add_byte(u8 d, u8 s);
|
||||
u16 add_word(u16 d, u16 s);
|
||||
u32 add_long(u32 d, u32 s);
|
||||
u8 and_byte(u8 d, u8 s);
|
||||
u16 and_word(u16 d, u16 s);
|
||||
u32 and_long(u32 d, u32 s);
|
||||
u8 cmp_byte(u8 d, u8 s);
|
||||
u16 cmp_word(u16 d, u16 s);
|
||||
u32 cmp_long(u32 d, u32 s);
|
||||
u8 daa_byte(u8 d);
|
||||
u8 das_byte(u8 d);
|
||||
u8 dec_byte(u8 d);
|
||||
u16 dec_word(u16 d);
|
||||
u32 dec_long(u32 d);
|
||||
u8 inc_byte(u8 d);
|
||||
u16 inc_word(u16 d);
|
||||
u32 inc_long(u32 d);
|
||||
u8 or_byte(u8 d, u8 s);
|
||||
u16 or_word(u16 d, u16 s);
|
||||
u32 or_long(u32 d, u32 s);
|
||||
u8 neg_byte(u8 s);
|
||||
u16 neg_word(u16 s);
|
||||
u32 neg_long(u32 s);
|
||||
u8 not_byte(u8 s);
|
||||
u16 not_word(u16 s);
|
||||
u32 not_long(u32 s);
|
||||
u8 rcl_byte(u8 d, u8 s);
|
||||
u16 rcl_word(u16 d, u8 s);
|
||||
u32 rcl_long(u32 d, u8 s);
|
||||
u8 rcr_byte(u8 d, u8 s);
|
||||
u16 rcr_word(u16 d, u8 s);
|
||||
u32 rcr_long(u32 d, u8 s);
|
||||
u8 rol_byte(u8 d, u8 s);
|
||||
u16 rol_word(u16 d, u8 s);
|
||||
u32 rol_long(u32 d, u8 s);
|
||||
u8 ror_byte(u8 d, u8 s);
|
||||
u16 ror_word(u16 d, u8 s);
|
||||
u32 ror_long(u32 d, u8 s);
|
||||
u8 shl_byte(u8 d, u8 s);
|
||||
u16 shl_word(u16 d, u8 s);
|
||||
u32 shl_long(u32 d, u8 s);
|
||||
u8 shr_byte(u8 d, u8 s);
|
||||
u16 shr_word(u16 d, u8 s);
|
||||
u32 shr_long(u32 d, u8 s);
|
||||
u8 sar_byte(u8 d, u8 s);
|
||||
u16 sar_word(u16 d, u8 s);
|
||||
u32 sar_long(u32 d, u8 s);
|
||||
u16 shld_word(u16 d, u16 fill, u8 s);
|
||||
u32 shld_long(u32 d, u32 fill, u8 s);
|
||||
u16 shrd_word(u16 d, u16 fill, u8 s);
|
||||
u32 shrd_long(u32 d, u32 fill, u8 s);
|
||||
u8 sbb_byte(u8 d, u8 s);
|
||||
u16 sbb_word(u16 d, u16 s);
|
||||
u32 sbb_long(u32 d, u32 s);
|
||||
u8 sub_byte(u8 d, u8 s);
|
||||
u16 sub_word(u16 d, u16 s);
|
||||
u32 sub_long(u32 d, u32 s);
|
||||
void test_byte(u8 d, u8 s);
|
||||
void test_word(u16 d, u16 s);
|
||||
void test_long(u32 d, u32 s);
|
||||
u8 xor_byte(u8 d, u8 s);
|
||||
u16 xor_word(u16 d, u16 s);
|
||||
u32 xor_long(u32 d, u32 s);
|
||||
void imul_byte(u8 s);
|
||||
void imul_word(u16 s);
|
||||
void imul_long(u32 s);
|
||||
void imul_long_direct(u32 * res_lo, u32 * res_hi, u32 d, u32 s);
|
||||
void mul_byte(u8 s);
|
||||
void mul_word(u16 s);
|
||||
void mul_long(u32 s);
|
||||
void idiv_byte(u8 s);
|
||||
void idiv_word(u16 s);
|
||||
void idiv_long(u32 s);
|
||||
void div_byte(u8 s);
|
||||
void div_word(u16 s);
|
||||
void div_long(u32 s);
|
||||
void ins(int size);
|
||||
void outs(int size);
|
||||
u16 mem_access_word(int addr);
|
||||
void push_word(u16 w);
|
||||
void push_long(u32 w);
|
||||
u16 pop_word(void);
|
||||
u32 pop_long(void);
|
||||
void cpuid(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif
|
||||
#endif /* __X86EMU_PRIM_OPS_H */
|
77
headers/libs/x86emu/x86emu/prim_x86_gcc.h
Normal file
77
headers/libs/x86emu/x86emu/prim_x86_gcc.h
Normal file
@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Inline helpers for x86emu
|
||||
*
|
||||
* Copyright (C) 2008 Bart Trojanowski, Symbio Technologies, LLC
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of the authors not be used
|
||||
* in advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. The authors makes no
|
||||
* representations about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: GNU C
|
||||
* Environment: GCC on i386 or x86-64
|
||||
* Developer: Bart Trojanowski
|
||||
*
|
||||
* Description: This file defines a few x86 macros that can be used by the
|
||||
* emulator to execute native instructions.
|
||||
*
|
||||
* For PIC vs non-PIC code refer to:
|
||||
* http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef __X86EMU_PRIM_X86_GCC_H
|
||||
#define __X86EMU_PRIM_X86_GCC_H
|
||||
|
||||
#include "x86emu/types.h"
|
||||
|
||||
#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__))
|
||||
#error This file is intended to be used by gcc on i386 or x86-64 system
|
||||
#endif
|
||||
|
||||
#if defined(__PIC__) && defined(__i386__)
|
||||
|
||||
#define X86EMU_HAS_HW_CPUID 1
|
||||
static inline void
|
||||
hw_cpuid(u32 * a, u32 * b, u32 * c, u32 * d)
|
||||
{
|
||||
__asm__ __volatile__("pushl %%ebx \n\t"
|
||||
"cpuid \n\t"
|
||||
"movl %%ebx, %1 \n\t"
|
||||
"popl %%ebx \n\t":"=a"(*a), "=r"(*b),
|
||||
"=c"(*c), "=d"(*d)
|
||||
:"a"(*a), "c"(*c)
|
||||
:"cc");
|
||||
}
|
||||
|
||||
#else /* ! (__PIC__ && __i386__) */
|
||||
|
||||
#define x86EMU_HAS_HW_CPUID 1
|
||||
static inline void
|
||||
hw_cpuid(u32 * a, u32 * b, u32 * c, u32 * d)
|
||||
{
|
||||
__asm__ __volatile__("cpuid":"=a"(*a), "=b"(*b), "=c"(*c), "=d"(*d)
|
||||
:"a"(*a), "c"(*c)
|
||||
:"cc");
|
||||
}
|
||||
|
||||
#endif /* __PIC__ && __i386__ */
|
||||
|
||||
#endif /* __X86EMU_PRIM_X86_GCC_H */
|
342
headers/libs/x86emu/x86emu/regs.h
Normal file
342
headers/libs/x86emu/x86emu/regs.h
Normal file
@ -0,0 +1,342 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Realmode X86 Emulator Library
|
||||
*
|
||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of the authors not be used
|
||||
* in advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. The authors makes no
|
||||
* representations about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for x86 register definitions.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __X86EMU_REGS_H
|
||||
#define __X86EMU_REGS_H
|
||||
|
||||
/*---------------------- Macros and type definitions ----------------------*/
|
||||
|
||||
#ifdef PACK
|
||||
#pragma PACK
|
||||
#endif
|
||||
|
||||
/*
|
||||
* General EAX, EBX, ECX, EDX type registers. Note that for
|
||||
* portability, and speed, the issue of byte swapping is not addressed
|
||||
* in the registers. All registers are stored in the default format
|
||||
* available on the host machine. The only critical issue is that the
|
||||
* registers should line up EXACTLY in the same manner as they do in
|
||||
* the 386. That is:
|
||||
*
|
||||
* EAX & 0xff === AL
|
||||
* EAX & 0xffff == AX
|
||||
*
|
||||
* etc. The result is that alot of the calculations can then be
|
||||
* done using the native instruction set fully.
|
||||
*/
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
|
||||
typedef struct {
|
||||
u32 e_reg;
|
||||
} I32_reg_t;
|
||||
|
||||
typedef struct {
|
||||
u16 filler0, x_reg;
|
||||
} I16_reg_t;
|
||||
|
||||
typedef struct {
|
||||
u8 filler0, filler1, h_reg, l_reg;
|
||||
} I8_reg_t;
|
||||
|
||||
#else /* !__BIG_ENDIAN__ */
|
||||
|
||||
typedef struct {
|
||||
u32 e_reg;
|
||||
} I32_reg_t;
|
||||
|
||||
typedef struct {
|
||||
u16 x_reg;
|
||||
} I16_reg_t;
|
||||
|
||||
typedef struct {
|
||||
u8 l_reg, h_reg;
|
||||
} I8_reg_t;
|
||||
|
||||
#endif /* BIG_ENDIAN */
|
||||
|
||||
typedef union {
|
||||
I32_reg_t I32_reg;
|
||||
I16_reg_t I16_reg;
|
||||
I8_reg_t I8_reg;
|
||||
} i386_general_register;
|
||||
|
||||
struct i386_general_regs {
|
||||
i386_general_register A, B, C, D;
|
||||
};
|
||||
|
||||
typedef struct i386_general_regs Gen_reg_t;
|
||||
|
||||
struct i386_special_regs {
|
||||
i386_general_register SP, BP, SI, DI, IP;
|
||||
u32 FLAGS;
|
||||
};
|
||||
|
||||
/*
|
||||
* Segment registers here represent the 16 bit quantities
|
||||
* CS, DS, ES, SS.
|
||||
*/
|
||||
|
||||
struct i386_segment_regs {
|
||||
u16 CS, DS, SS, ES, FS, GS;
|
||||
};
|
||||
|
||||
/* 8 bit registers */
|
||||
#define R_AH gen.A.I8_reg.h_reg
|
||||
#define R_AL gen.A.I8_reg.l_reg
|
||||
#define R_BH gen.B.I8_reg.h_reg
|
||||
#define R_BL gen.B.I8_reg.l_reg
|
||||
#define R_CH gen.C.I8_reg.h_reg
|
||||
#define R_CL gen.C.I8_reg.l_reg
|
||||
#define R_DH gen.D.I8_reg.h_reg
|
||||
#define R_DL gen.D.I8_reg.l_reg
|
||||
|
||||
/* 16 bit registers */
|
||||
#define R_AX gen.A.I16_reg.x_reg
|
||||
#define R_BX gen.B.I16_reg.x_reg
|
||||
#define R_CX gen.C.I16_reg.x_reg
|
||||
#define R_DX gen.D.I16_reg.x_reg
|
||||
|
||||
/* 32 bit extended registers */
|
||||
#define R_EAX gen.A.I32_reg.e_reg
|
||||
#define R_EBX gen.B.I32_reg.e_reg
|
||||
#define R_ECX gen.C.I32_reg.e_reg
|
||||
#define R_EDX gen.D.I32_reg.e_reg
|
||||
|
||||
/* special registers */
|
||||
#define R_SP spc.SP.I16_reg.x_reg
|
||||
#define R_BP spc.BP.I16_reg.x_reg
|
||||
#define R_SI spc.SI.I16_reg.x_reg
|
||||
#define R_DI spc.DI.I16_reg.x_reg
|
||||
#define R_IP spc.IP.I16_reg.x_reg
|
||||
#define R_FLG spc.FLAGS
|
||||
|
||||
/* special registers */
|
||||
#define R_SP spc.SP.I16_reg.x_reg
|
||||
#define R_BP spc.BP.I16_reg.x_reg
|
||||
#define R_SI spc.SI.I16_reg.x_reg
|
||||
#define R_DI spc.DI.I16_reg.x_reg
|
||||
#define R_IP spc.IP.I16_reg.x_reg
|
||||
#define R_FLG spc.FLAGS
|
||||
|
||||
/* special registers */
|
||||
#define R_ESP spc.SP.I32_reg.e_reg
|
||||
#define R_EBP spc.BP.I32_reg.e_reg
|
||||
#define R_ESI spc.SI.I32_reg.e_reg
|
||||
#define R_EDI spc.DI.I32_reg.e_reg
|
||||
#define R_EIP spc.IP.I32_reg.e_reg
|
||||
#define R_EFLG spc.FLAGS
|
||||
|
||||
/* segment registers */
|
||||
#define R_CS seg.CS
|
||||
#define R_DS seg.DS
|
||||
#define R_SS seg.SS
|
||||
#define R_ES seg.ES
|
||||
#define R_FS seg.FS
|
||||
#define R_GS seg.GS
|
||||
|
||||
/* flag conditions */
|
||||
#define FB_CF 0x0001 /* CARRY flag */
|
||||
#define FB_PF 0x0004 /* PARITY flag */
|
||||
#define FB_AF 0x0010 /* AUX flag */
|
||||
#define FB_ZF 0x0040 /* ZERO flag */
|
||||
#define FB_SF 0x0080 /* SIGN flag */
|
||||
#define FB_TF 0x0100 /* TRAP flag */
|
||||
#define FB_IF 0x0200 /* INTERRUPT ENABLE flag */
|
||||
#define FB_DF 0x0400 /* DIR flag */
|
||||
#define FB_OF 0x0800 /* OVERFLOW flag */
|
||||
|
||||
/* 80286 and above always have bit#1 set */
|
||||
#define F_ALWAYS_ON (0x0002) /* flag bits always on */
|
||||
|
||||
/*
|
||||
* Define a mask for only those flag bits we will ever pass back
|
||||
* (via PUSHF)
|
||||
*/
|
||||
#define F_MSK (FB_CF|FB_PF|FB_AF|FB_ZF|FB_SF|FB_TF|FB_IF|FB_DF|FB_OF)
|
||||
|
||||
/* following bits masked in to a 16bit quantity */
|
||||
|
||||
#define F_CF 0x0001 /* CARRY flag */
|
||||
#define F_PF 0x0004 /* PARITY flag */
|
||||
#define F_AF 0x0010 /* AUX flag */
|
||||
#define F_ZF 0x0040 /* ZERO flag */
|
||||
#define F_SF 0x0080 /* SIGN flag */
|
||||
#define F_TF 0x0100 /* TRAP flag */
|
||||
#define F_IF 0x0200 /* INTERRUPT ENABLE flag */
|
||||
#define F_DF 0x0400 /* DIR flag */
|
||||
#define F_OF 0x0800 /* OVERFLOW flag */
|
||||
|
||||
#define TOGGLE_FLAG(flag) (M.x86.R_FLG ^= (flag))
|
||||
#define SET_FLAG(flag) (M.x86.R_FLG |= (flag))
|
||||
#define CLEAR_FLAG(flag) (M.x86.R_FLG &= ~(flag))
|
||||
#define ACCESS_FLAG(flag) (M.x86.R_FLG & (flag))
|
||||
#define CLEARALL_FLAG(m) (M.x86.R_FLG = 0)
|
||||
|
||||
#define CONDITIONAL_SET_FLAG(COND,FLAG) \
|
||||
if (COND) SET_FLAG(FLAG); else CLEAR_FLAG(FLAG)
|
||||
|
||||
#define F_PF_CALC 0x010000 /* PARITY flag has been calced */
|
||||
#define F_ZF_CALC 0x020000 /* ZERO flag has been calced */
|
||||
#define F_SF_CALC 0x040000 /* SIGN flag has been calced */
|
||||
|
||||
#define F_ALL_CALC 0xff0000 /* All have been calced */
|
||||
|
||||
/*
|
||||
* Emulator machine state.
|
||||
* Segment usage control.
|
||||
*/
|
||||
#define SYSMODE_SEG_DS_SS 0x00000001
|
||||
#define SYSMODE_SEGOVR_CS 0x00000002
|
||||
#define SYSMODE_SEGOVR_DS 0x00000004
|
||||
#define SYSMODE_SEGOVR_ES 0x00000008
|
||||
#define SYSMODE_SEGOVR_FS 0x00000010
|
||||
#define SYSMODE_SEGOVR_GS 0x00000020
|
||||
#define SYSMODE_SEGOVR_SS 0x00000040
|
||||
#define SYSMODE_PREFIX_REPE 0x00000080
|
||||
#define SYSMODE_PREFIX_REPNE 0x00000100
|
||||
#define SYSMODE_PREFIX_DATA 0x00000200
|
||||
#define SYSMODE_PREFIX_ADDR 0x00000400
|
||||
#define SYSMODE_INTR_PENDING 0x10000000
|
||||
#define SYSMODE_EXTRN_INTR 0x20000000
|
||||
#define SYSMODE_HALTED 0x40000000
|
||||
|
||||
#define SYSMODE_SEGMASK (SYSMODE_SEG_DS_SS | \
|
||||
SYSMODE_SEGOVR_CS | \
|
||||
SYSMODE_SEGOVR_DS | \
|
||||
SYSMODE_SEGOVR_ES | \
|
||||
SYSMODE_SEGOVR_FS | \
|
||||
SYSMODE_SEGOVR_GS | \
|
||||
SYSMODE_SEGOVR_SS)
|
||||
#define SYSMODE_CLRMASK (SYSMODE_SEG_DS_SS | \
|
||||
SYSMODE_SEGOVR_CS | \
|
||||
SYSMODE_SEGOVR_DS | \
|
||||
SYSMODE_SEGOVR_ES | \
|
||||
SYSMODE_SEGOVR_FS | \
|
||||
SYSMODE_SEGOVR_GS | \
|
||||
SYSMODE_SEGOVR_SS | \
|
||||
SYSMODE_PREFIX_DATA | \
|
||||
SYSMODE_PREFIX_ADDR)
|
||||
|
||||
#define INTR_SYNCH 0x1
|
||||
#define INTR_ASYNCH 0x2
|
||||
#define INTR_HALTED 0x4
|
||||
|
||||
typedef struct {
|
||||
struct i386_general_regs gen;
|
||||
struct i386_special_regs spc;
|
||||
struct i386_segment_regs seg;
|
||||
/*
|
||||
* MODE contains information on:
|
||||
* REPE prefix 2 bits repe,repne
|
||||
* SEGMENT overrides 5 bits normal,DS,SS,CS,ES
|
||||
* Delayed flag set 3 bits (zero, signed, parity)
|
||||
* reserved 6 bits
|
||||
* interrupt # 8 bits instruction raised interrupt
|
||||
* BIOS video segregs 4 bits
|
||||
* Interrupt Pending 1 bits
|
||||
* Extern interrupt 1 bits
|
||||
* Halted 1 bits
|
||||
*/
|
||||
u32 mode;
|
||||
volatile int intr; /* mask of pending interrupts */
|
||||
int debug;
|
||||
#ifdef DEBUG
|
||||
int check;
|
||||
u16 saved_ip;
|
||||
u16 saved_cs;
|
||||
int enc_pos;
|
||||
int enc_str_pos;
|
||||
char decode_buf[32]; /* encoded byte stream */
|
||||
char decoded_buf[256]; /* disassembled strings */
|
||||
#endif
|
||||
u8 intno;
|
||||
u8 __pad[3];
|
||||
} X86EMU_regs;
|
||||
|
||||
/****************************************************************************
|
||||
REMARKS:
|
||||
Structure maintaining the emulator machine state.
|
||||
|
||||
MEMBERS:
|
||||
mem_base - Base real mode memory for the emulator
|
||||
mem_size - Size of the real mode memory block for the emulator
|
||||
private - private data pointer
|
||||
x86 - X86 registers
|
||||
****************************************************************************/
|
||||
typedef struct {
|
||||
unsigned long mem_base;
|
||||
unsigned long mem_size;
|
||||
#ifdef __cplusplus
|
||||
void *_private;
|
||||
#else
|
||||
void *private;
|
||||
#endif
|
||||
X86EMU_regs x86;
|
||||
} X86EMU_sysEnv;
|
||||
|
||||
#ifdef END_PACK
|
||||
#pragma END_PACK
|
||||
#endif
|
||||
|
||||
/*----------------------------- Global Variables --------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
/* Global emulator machine state.
|
||||
*
|
||||
* We keep it global to avoid pointer dereferences in the code for speed.
|
||||
*/
|
||||
|
||||
extern X86EMU_sysEnv _X86EMU_env;
|
||||
#define M _X86EMU_env
|
||||
|
||||
/*-------------------------- Function Prototypes --------------------------*/
|
||||
|
||||
/* Function to log information at runtime */
|
||||
|
||||
#include <KernelExport.h>
|
||||
#define printk(fmt...) dprintf(fmt)
|
||||
// void printk(const char *fmt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif
|
||||
#endif /* __X86EMU_REGS_H */
|
80
headers/libs/x86emu/x86emu/types.h
Normal file
80
headers/libs/x86emu/x86emu/types.h
Normal file
@ -0,0 +1,80 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Realmode X86 Emulator Library
|
||||
*
|
||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of the authors not be used
|
||||
* in advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. The authors makes no
|
||||
* representations about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for x86 emulator type definitions.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __X86EMU_TYPES_H
|
||||
#define __X86EMU_TYPES_H
|
||||
|
||||
#ifndef NO_SYS_HEADERS
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following kludge is an attempt to work around typedef conflicts with
|
||||
* <sys/types.h>.
|
||||
*/
|
||||
#define u8 x86emuu8
|
||||
#define u16 x86emuu16
|
||||
#define u32 x86emuu32
|
||||
#define u64 x86emuu64
|
||||
#define s8 x86emus8
|
||||
#define s16 x86emus16
|
||||
#define s32 x86emus32
|
||||
#define s64 x86emus64
|
||||
#define uint x86emuuint
|
||||
#define sint x86emusint
|
||||
|
||||
/*---------------------- Macros and type definitions ----------------------*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef int64_t s64;
|
||||
|
||||
typedef unsigned int uint;
|
||||
typedef int sint;
|
||||
|
||||
typedef u16 X86EMU_pioAddr;
|
||||
|
||||
#endif /* __X86EMU_TYPES_H */
|
100
headers/libs/x86emu/x86emu/x86emui.h
Normal file
100
headers/libs/x86emu/x86emu/x86emui.h
Normal file
@ -0,0 +1,100 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Realmode X86 Emulator Library
|
||||
*
|
||||
* Copyright (C) 1996-1999 SciTech Software, Inc.
|
||||
* Copyright (C) David Mosberger-Tang
|
||||
* Copyright (C) 1999 Egbert Eich
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of the authors not be used
|
||||
* in advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. The authors makes no
|
||||
* representations about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* ========================================================================
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
* Developer: Kendall Bennett
|
||||
*
|
||||
* Description: Header file for system specific functions. These functions
|
||||
* are always compiled and linked in the OS depedent libraries,
|
||||
* and never in a binary portable driver.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __X86EMU_X86EMUI_H
|
||||
#define __X86EMU_X86EMUI_H
|
||||
|
||||
/* If we are compiling in C++ mode, we can compile some functions as
|
||||
* inline to increase performance (however the code size increases quite
|
||||
* dramatically in this case).
|
||||
*/
|
||||
|
||||
#if defined(__cplusplus) && !defined(_NO_INLINE)
|
||||
#define _INLINE inline
|
||||
#else
|
||||
#define _INLINE static
|
||||
#endif
|
||||
|
||||
/* Get rid of unused parameters in C++ compilation mode */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define X86EMU_UNUSED(v)
|
||||
#else
|
||||
#define X86EMU_UNUSED(v) v
|
||||
#endif
|
||||
|
||||
#include "x86emu.h"
|
||||
#include "x86emu/regs.h"
|
||||
#include "x86emu/debug.h"
|
||||
#include "x86emu/decode.h"
|
||||
#include "x86emu/ops.h"
|
||||
#include "x86emu/prim_ops.h"
|
||||
#include "x86emu/fpu.h"
|
||||
#include "x86emu/fpu_regs.h"
|
||||
|
||||
#ifndef NO_SYS_HEADERS
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
/*--------------------------- Inline Functions ----------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
extern u8(X86APIP sys_rdb) (u32 addr);
|
||||
extern u16(X86APIP sys_rdw) (u32 addr);
|
||||
extern u32(X86APIP sys_rdl) (u32 addr);
|
||||
extern void (X86APIP sys_wrb) (u32 addr, u8 val);
|
||||
extern void (X86APIP sys_wrw) (u32 addr, u16 val);
|
||||
extern void (X86APIP sys_wrl) (u32 addr, u32 val);
|
||||
|
||||
extern u8(X86APIP sys_inb) (X86EMU_pioAddr addr);
|
||||
extern u16(X86APIP sys_inw) (X86EMU_pioAddr addr);
|
||||
extern u32(X86APIP sys_inl) (X86EMU_pioAddr addr);
|
||||
extern void (X86APIP sys_outb) (X86EMU_pioAddr addr, u8 val);
|
||||
extern void (X86APIP sys_outw) (X86EMU_pioAddr addr, u16 val);
|
||||
extern void (X86APIP sys_outl) (X86EMU_pioAddr addr, u32 val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif
|
||||
#endif /* __X86EMU_X86EMUI_H */
|
69
headers/os/arch/x86_64/arch_debugger.h
Normal file
69
headers/os/arch/x86_64/arch_debugger.h
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2005-2012, Haiku Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _ARCH_X86_64_DEBUGGER_H
|
||||
#define _ARCH_X86_64_DEBUGGER_H
|
||||
|
||||
|
||||
typedef struct x86_64_fp_register {
|
||||
uint8 value[10];
|
||||
uint8 reserved[6];
|
||||
} x86_64_fp_register;
|
||||
|
||||
|
||||
typedef struct x86_64_xmm_register {
|
||||
uint8 value[16];
|
||||
} x86_64_xmm_register;
|
||||
|
||||
|
||||
typedef struct x86_64_extended_registers {
|
||||
uint16 control;
|
||||
uint16 status;
|
||||
uint8 tag;
|
||||
uint8 reserved1;
|
||||
uint16 opcode;
|
||||
uint64 instruction_pointer;
|
||||
uint64 data_pointer;
|
||||
uint32 mxcsr;
|
||||
uint32 mxcsr_mask;
|
||||
union {
|
||||
x86_64_fp_register fp_registers[8]; // st0-st7
|
||||
x86_64_fp_register mmx_registers[8]; // mm0-mm7
|
||||
};
|
||||
x86_64_xmm_register xmm_registers[16]; // xmm0-xmm15
|
||||
uint8 reserved2[96]; // 416 - 512
|
||||
} x86_64_extended_registers;
|
||||
|
||||
|
||||
struct x86_64_debug_cpu_state {
|
||||
x86_64_extended_registers extended_registers;
|
||||
|
||||
uint64 gs;
|
||||
uint64 fs;
|
||||
uint64 es;
|
||||
uint64 ds;
|
||||
uint64 r15;
|
||||
uint64 r14;
|
||||
uint64 r13;
|
||||
uint64 r12;
|
||||
uint64 r11;
|
||||
uint64 r10;
|
||||
uint64 r9;
|
||||
uint64 r8;
|
||||
uint64 rbp;
|
||||
uint64 rsi;
|
||||
uint64 rdi;
|
||||
uint64 rdx;
|
||||
uint64 rcx;
|
||||
uint64 rbx;
|
||||
uint64 rax;
|
||||
uint64 rip;
|
||||
uint64 cs;
|
||||
uint64 rflags;
|
||||
uint64 rsp;
|
||||
uint64 ss;
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
|
||||
#endif // _ARCH_X86_64_DEBUGGER_H
|
@ -133,6 +133,7 @@ typedef struct acpi_data {
|
||||
|
||||
enum {
|
||||
ACPI_ALLOCATE_BUFFER = -1,
|
||||
ACPI_ALLOCATE_LOCAL_BUFFER = -2,
|
||||
};
|
||||
|
||||
|
||||
@ -261,6 +262,10 @@ struct acpi_module_info {
|
||||
/* Table Access */
|
||||
status_t (*get_table)(const char *signature, uint32 instance,
|
||||
void **tableHeader);
|
||||
|
||||
/* Register Access */
|
||||
status_t (*read_bit_register)(uint32 regid, uint32 *val);
|
||||
status_t (*write_bit_register)(uint32 regid, uint32 val);
|
||||
};
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ typedef struct isa_module_info {
|
||||
isa_dma_entry *table, /* -> caller-supplied scatter/gather table */
|
||||
long num_entries /* max # entries in table */
|
||||
);
|
||||
long (*start_isa_dma) (
|
||||
status_t (*start_isa_dma) (
|
||||
long channel, /* dma channel to use */
|
||||
void *buf, /* buffer to transfer */
|
||||
long transfer_count, /* # transfers */
|
||||
@ -70,8 +70,8 @@ typedef struct isa_module_info {
|
||||
uchar mode, /* mode flags */
|
||||
uchar emode /* extended mode flags */
|
||||
);
|
||||
long (*lock_isa_dma_channel) (long channel);
|
||||
long (*unlock_isa_dma_channel) (long channel);
|
||||
status_t (*lock_isa_dma_channel) (long channel);
|
||||
status_t (*unlock_isa_dma_channel) (long channel);
|
||||
} isa_module_info;
|
||||
|
||||
#define B_ISA_MODULE_NAME "bus_managers/isa/v1"
|
||||
|
@ -44,15 +44,15 @@ typedef struct pci_info {
|
||||
uchar reserved; /* filler, for alignment */
|
||||
union {
|
||||
struct {
|
||||
ulong cardbus_cis; /* CardBus CIS pointer */
|
||||
uint32 cardbus_cis; /* CardBus CIS pointer */
|
||||
ushort subsystem_id; /* subsystem (add-in card) id */
|
||||
ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */
|
||||
ulong rom_base; /* rom base address, viewed from host */
|
||||
ulong rom_base_pci; /* rom base addr, viewed from pci */
|
||||
ulong rom_size; /* rom size */
|
||||
ulong base_registers[6]; /* base registers, viewed from host */
|
||||
ulong base_registers_pci[6]; /* base registers, viewed from pci */
|
||||
ulong base_register_sizes[6]; /* size of what base regs point to */
|
||||
uint32 rom_base; /* rom base address, viewed from host */
|
||||
uint32 rom_base_pci; /* rom base addr, viewed from pci */
|
||||
uint32 rom_size; /* rom size */
|
||||
uint32 base_registers[6]; /* base registers, viewed from host */
|
||||
uint32 base_registers_pci[6]; /* base registers, viewed from pci */
|
||||
uint32 base_register_sizes[6]; /* size of what base regs point to */
|
||||
uchar base_register_flags[6]; /* flags from base address fields */
|
||||
uchar interrupt_line; /* interrupt line */
|
||||
uchar interrupt_pin; /* interrupt pin */
|
||||
@ -60,9 +60,9 @@ typedef struct pci_info {
|
||||
uchar max_latency; /* how often PCI access needed */
|
||||
} h0;
|
||||
struct {
|
||||
ulong base_registers[2]; /* base registers, viewed from host */
|
||||
ulong base_registers_pci[2]; /* base registers, viewed from pci */
|
||||
ulong base_register_sizes[2]; /* size of what base regs point to */
|
||||
uint32 base_registers[2]; /* base registers, viewed from host */
|
||||
uint32 base_registers_pci[2]; /* base registers, viewed from pci */
|
||||
uint32 base_register_sizes[2]; /* size of what base regs point to */
|
||||
uchar base_register_flags[2]; /* flags from base address fields */
|
||||
uchar primary_bus;
|
||||
uchar secondary_bus;
|
||||
@ -75,12 +75,12 @@ typedef struct pci_info {
|
||||
ushort memory_limit;
|
||||
ushort prefetchable_memory_base;
|
||||
ushort prefetchable_memory_limit;
|
||||
ulong prefetchable_memory_base_upper32;
|
||||
ulong prefetchable_memory_limit_upper32;
|
||||
uint32 prefetchable_memory_base_upper32;
|
||||
uint32 prefetchable_memory_limit_upper32;
|
||||
ushort io_base_upper16;
|
||||
ushort io_limit_upper16;
|
||||
ulong rom_base; /* rom base address, viewed from host */
|
||||
ulong rom_base_pci; /* rom base addr, viewed from pci */
|
||||
uint32 rom_base; /* rom base address, viewed from host */
|
||||
uint32 rom_base_pci; /* rom base addr, viewed from pci */
|
||||
uchar interrupt_line; /* interrupt line */
|
||||
uchar interrupt_pin; /* interrupt pin */
|
||||
ushort bridge_control;
|
||||
@ -98,14 +98,14 @@ typedef struct pci_info {
|
||||
uchar subordinate_bus;
|
||||
uchar secondary_latency;
|
||||
ushort reserved;
|
||||
ulong memory_base;
|
||||
ulong memory_limit;
|
||||
ulong memory_base_upper32;
|
||||
ulong memory_limit_upper32;
|
||||
ulong io_base;
|
||||
ulong io_limit;
|
||||
ulong io_base_upper32;
|
||||
ulong io_limit_upper32;
|
||||
uint32 memory_base;
|
||||
uint32 memory_limit;
|
||||
uint32 memory_base_upper32;
|
||||
uint32 memory_limit_upper32;
|
||||
uint32 io_base;
|
||||
uint32 io_limit;
|
||||
uint32 io_base_upper32;
|
||||
uint32 io_limit_upper32;
|
||||
ushort secondary_status;
|
||||
ushort bridge_control;
|
||||
#endif /* __HAIKU_PCI_BUS_MANAGER_TESTING */
|
||||
|
73
headers/os/drivers/bios.h
Normal file
73
headers/os/drivers/bios.h
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright 2012, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _BIOS_MODULE_H_
|
||||
#define _BIOS_MODULE_H_
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <module.h>
|
||||
|
||||
|
||||
/*! BIOS call interface.
|
||||
|
||||
This module provides a mechanism to call PC BIOS interrupts (e.g. to use
|
||||
the VESA BIOS).
|
||||
|
||||
Basic usage is as follows:
|
||||
- Call bios_module_info::prepare(). This sets up memory mappings and
|
||||
obtains exclusive access to the BIOS (only 1 thread is able to use the
|
||||
BIOS at a time).
|
||||
- Allocate memory for data that will be passed to BIOS interrupts using
|
||||
bios_module_info::allocate_mem(). This returns a virtual address, to
|
||||
get the physical address to pass to the BIOS use
|
||||
bios_module_info::physical_address().
|
||||
- Call the BIOS with bios_module_info::interrupt().
|
||||
- Get the virtual location of any physical addresses returned using
|
||||
bios_module_info::virtual_address().
|
||||
- Release the BIOS and free created memory mappings with
|
||||
bios_module_info::finish().
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// Cookie for the BIOS module functions.
|
||||
typedef struct BIOSState bios_state;
|
||||
|
||||
|
||||
// Registers to pass to a BIOS interrupt.
|
||||
struct bios_regs {
|
||||
uint32 eax;
|
||||
uint32 ebx;
|
||||
uint32 ecx;
|
||||
uint32 edx;
|
||||
uint32 edi;
|
||||
uint32 esi;
|
||||
uint32 ebp;
|
||||
uint32 eflags;
|
||||
uint32 ds;
|
||||
uint32 es;
|
||||
uint32 fs;
|
||||
uint32 gs;
|
||||
};
|
||||
|
||||
|
||||
struct bios_module_info {
|
||||
module_info info;
|
||||
|
||||
status_t (*prepare)(bios_state** _state);
|
||||
status_t (*interrupt)(bios_state* state, uint8 vector, bios_regs* regs);
|
||||
void (*finish)(bios_state* state);
|
||||
|
||||
// Memory management methods.
|
||||
void* (*allocate_mem)(bios_state* state, size_t size);
|
||||
uint32 (*physical_address)(bios_state* state, void* virtualAddress);
|
||||
void* (*virtual_address)(bios_state* state, uint32 physicalAddress);
|
||||
};
|
||||
|
||||
|
||||
#define B_BIOS_MODULE_NAME "generic/bios/v1"
|
||||
|
||||
|
||||
#endif // _BIOS_MODULE_H_
|
57
headers/os/drivers/cpuidle.h
Normal file
57
headers/os/drivers/cpuidle.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2012, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _CPUIDLE_MODULE_H
|
||||
#define _CPUIDLE_MODULE_H
|
||||
|
||||
|
||||
#include <module.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CPUIDLE_CSTATE_MAX 8
|
||||
#define CSTATE_NAME_LENGTH 32
|
||||
#define B_CPUIDLE_MODULE_NAME "generic/cpuidle/v1"
|
||||
|
||||
|
||||
struct CpuidleStat {
|
||||
uint64 usageCount;
|
||||
bigtime_t usageTime;
|
||||
};
|
||||
|
||||
|
||||
struct CpuidleInfo {
|
||||
int32 cstateSleep;
|
||||
CpuidleStat stats[CPUIDLE_CSTATE_MAX];
|
||||
};
|
||||
|
||||
struct CpuidleDevice;
|
||||
|
||||
struct CpuidleCstate {
|
||||
char name[CSTATE_NAME_LENGTH];
|
||||
int32 latency;
|
||||
int32 (*EnterIdle)(int32 state, CpuidleDevice *device);
|
||||
void *pData;
|
||||
};
|
||||
|
||||
|
||||
struct CpuidleDevice {
|
||||
CpuidleCstate cStates[CPUIDLE_CSTATE_MAX];
|
||||
int32 cStateCount;
|
||||
};
|
||||
|
||||
|
||||
struct CpuidleModuleInfo {
|
||||
module_info info;
|
||||
status_t (*AddDevice)(CpuidleDevice *device);
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CPUIDLE_MODULE_H
|
@ -1328,7 +1328,7 @@ MenuItem<ParentBuilder>::MenuItem(ParentBuilder* parentBuilder, BMenu* menu,
|
||||
Menu<ParentBuilder>(menu),
|
||||
fMenuItem(item)
|
||||
{
|
||||
SetParent(parentBuilder);
|
||||
this->SetParent(parentBuilder);
|
||||
}
|
||||
|
||||
|
||||
|
@ -85,7 +85,7 @@ private:
|
||||
BRegion(const clipping_rect& rect);
|
||||
|
||||
void _AdoptRegionData(BRegion& region);
|
||||
bool _SetSize(long newSize);
|
||||
bool _SetSize(int32 newSize);
|
||||
|
||||
clipping_rect _Convert(const BRect& rect) const;
|
||||
clipping_rect _ConvertToInternal(const BRect& rect) const;
|
||||
@ -93,8 +93,8 @@ private:
|
||||
const clipping_rect& rect) const;
|
||||
|
||||
private:
|
||||
long fCount;
|
||||
long fDataSize;
|
||||
int32 fCount;
|
||||
int32 fDataSize;
|
||||
clipping_rect fBounds;
|
||||
clipping_rect* fData;
|
||||
};
|
||||
|
@ -413,7 +413,7 @@ private:
|
||||
void _ShowContextMenu(BPoint where);
|
||||
|
||||
void _FilterDisallowedChars(char* text,
|
||||
int32& length, text_run_array* runArray);
|
||||
ssize_t& length, text_run_array* runArray);
|
||||
|
||||
private:
|
||||
BPrivate::TextGapBuffer* fText;
|
||||
|
@ -96,7 +96,7 @@ extern status_t set_area_protection(area_id id, uint32 newProtection);
|
||||
|
||||
/* system private, use macros instead */
|
||||
extern status_t _get_area_info(area_id id, area_info *areaInfo, size_t size);
|
||||
extern status_t _get_next_area_info(team_id team, int32 *cookie,
|
||||
extern status_t _get_next_area_info(team_id team, ssize_t *cookie,
|
||||
area_info *areaInfo, size_t size);
|
||||
|
||||
#define get_area_info(id, areaInfo) \
|
||||
@ -645,7 +645,7 @@ typedef enum cpu_types {
|
||||
|
||||
#define B_CPU_x86_VENDOR_MASK 0xff00
|
||||
|
||||
#ifdef __INTEL__
|
||||
#if defined(__INTEL__) || defined(__x86_64__)
|
||||
typedef union {
|
||||
struct {
|
||||
uint32 max_eax;
|
||||
@ -713,7 +713,8 @@ typedef enum platform_types {
|
||||
B_MK_61_PLATFORM,
|
||||
B_NINTENDO_64_PLATFORM,
|
||||
B_AMIGA_PLATFORM,
|
||||
B_ATARI_PLATFORM
|
||||
B_ATARI_PLATFORM,
|
||||
B_64_BIT_PC_PLATFORM
|
||||
} platform_type;
|
||||
|
||||
typedef struct {
|
||||
|
@ -13,13 +13,16 @@
|
||||
|
||||
// include architecture specific definitions
|
||||
#include <arch/x86/arch_debugger.h>
|
||||
#include <arch/x86_64/arch_debugger.h>
|
||||
#include <arch/ppc/arch_debugger.h>
|
||||
#include <arch/m68k/arch_debugger.h>
|
||||
#include <arch/mipsel/arch_debugger.h>
|
||||
#include <arch/arm/arch_debugger.h>
|
||||
|
||||
|
||||
#ifdef __INTEL__
|
||||
#ifdef __x86_64__
|
||||
typedef struct x86_64_debug_cpu_state debug_cpu_state;
|
||||
#elif __INTEL__
|
||||
typedef struct x86_debug_cpu_state debug_cpu_state;
|
||||
#elif __POWERPC__
|
||||
typedef struct ppc_debug_cpu_state debug_cpu_state;
|
||||
|
@ -1,15 +1,18 @@
|
||||
/*
|
||||
* Copyright 1994-1997 Mark Kilgard, All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Mark Kilgard
|
||||
*/
|
||||
#ifndef __glut_h__
|
||||
#define __glut_h__
|
||||
|
||||
/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */
|
||||
|
||||
/* This program is freely distributable without licensing fees and is
|
||||
provided without guarantee or warrantee expressed or implied. This
|
||||
program is -not- in the public domain. */
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
#include <GL/mesa_wgl.h>
|
||||
#endif
|
||||
@ -752,4 +755,5 @@ GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __glut_h__ */
|
||||
|
@ -148,6 +148,14 @@ typedef generic_addr_t generic_size_t;
|
||||
#define B_PRIiTIME B_PRIi32
|
||||
|
||||
|
||||
/* Printed width of a pointer with the %p format (minus 0x prefix). */
|
||||
#ifdef B_HAIKU_64_BIT
|
||||
# define B_PRINTF_POINTER_WIDTH 16
|
||||
#else
|
||||
# define B_PRINTF_POINTER_WIDTH 8
|
||||
#endif
|
||||
|
||||
|
||||
/* Empty string ("") */
|
||||
#ifdef __cplusplus
|
||||
extern const char *B_EMPTY_STRING;
|
||||
|
@ -6,7 +6,6 @@
|
||||
#define _ARCH_SETJMP_H_
|
||||
|
||||
|
||||
/* TODO: A jmp_buf size of 12 might not be large enough. Increase to a large size if needed. */
|
||||
typedef int __jmp_buf[12];
|
||||
typedef unsigned long __jmp_buf[8];
|
||||
|
||||
#endif /* _ARCH_SETJMP_H_ */
|
||||
|
@ -111,7 +111,8 @@ feclearexcept(int __excepts)
|
||||
static __inline int
|
||||
fegetexceptflag(fexcept_t *__flagp, int __excepts)
|
||||
{
|
||||
int __mxcsr, __status;
|
||||
uint32_t __mxcsr;
|
||||
uint16_t __status;
|
||||
|
||||
__stmxcsr(&__mxcsr);
|
||||
__fnstsw(&__status);
|
||||
@ -125,7 +126,8 @@ int feraiseexcept(int __excepts);
|
||||
static __inline int
|
||||
fetestexcept(int __excepts)
|
||||
{
|
||||
int __mxcsr, __status;
|
||||
uint32_t __mxcsr;
|
||||
uint16_t __status;
|
||||
|
||||
__stmxcsr(&__mxcsr);
|
||||
__fnstsw(&__status);
|
||||
@ -135,7 +137,7 @@ fetestexcept(int __excepts)
|
||||
static __inline int
|
||||
fegetround(void)
|
||||
{
|
||||
int __control;
|
||||
uint16_t __control;
|
||||
|
||||
/*
|
||||
* We assume that the x87 and the SSE unit agree on the
|
||||
@ -150,7 +152,8 @@ fegetround(void)
|
||||
static __inline int
|
||||
fesetround(int __round)
|
||||
{
|
||||
int __mxcsr, __control;
|
||||
uint32_t __mxcsr;
|
||||
uint16_t __control;
|
||||
|
||||
if (__round & ~_ROUND_MASK)
|
||||
return (-1);
|
||||
@ -198,7 +201,7 @@ int fedisableexcept(int __mask);
|
||||
static __inline int
|
||||
fegetexcept(void)
|
||||
{
|
||||
int __control;
|
||||
uint16_t __control;
|
||||
|
||||
/*
|
||||
* We assume that the masks for the x87 and the SSE unit are
|
||||
|
218
headers/posix/arch/x86_64/fpu.h
Normal file
218
headers/posix/arch/x86_64/fpu.h
Normal file
@ -0,0 +1,218 @@
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, 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: @(#)npx.h 5.3 (Berkeley) 1/18/91
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Floating Point Data Structures and Constants
|
||||
* W. Jolitz 1/90
|
||||
*/
|
||||
|
||||
#ifndef _X86_FPU_H_
|
||||
#define _X86_FPU_H_
|
||||
|
||||
#define __aligned(x) __attribute__((__aligned__(x)))
|
||||
|
||||
/* Environment information of floating point unit. */
|
||||
struct env87 {
|
||||
int32_t en_cw; /* control word (16bits) */
|
||||
int32_t en_sw; /* status word (16bits) */
|
||||
int32_t en_tw; /* tag word (16bits) */
|
||||
int32_t en_fip; /* fp instruction pointer */
|
||||
uint16_t en_fcs; /* fp code segment selector */
|
||||
uint16_t en_opcode; /* opcode last executed (11 bits) */
|
||||
int32_t en_foo; /* fp operand offset */
|
||||
int32_t en_fos; /* fp operand segment selector */
|
||||
};
|
||||
|
||||
/* Contents of each x87 floating point accumulator. */
|
||||
struct fpacc87 {
|
||||
uint8_t fp_bytes[10];
|
||||
};
|
||||
|
||||
/* Floating point context. (i386 fnsave/frstor) */
|
||||
struct save87 {
|
||||
struct env87 sv_env; /* floating point control/status */
|
||||
struct fpacc87 sv_ac[8]; /* accumulator contents, 0-7 */
|
||||
uint8_t sv_pad0[4]; /* saved status word (now unused) */
|
||||
/*
|
||||
* Bogus padding for emulators. Emulators should use their own
|
||||
* struct and arrange to store into this struct (ending here)
|
||||
* before it is inspected for ptracing or for core dumps. Some
|
||||
* emulators overwrite the whole struct. We have no good way of
|
||||
* knowing how much padding to leave. Leave just enough for the
|
||||
* GPL emulator's i387_union (176 bytes total).
|
||||
*/
|
||||
uint8_t sv_pad[64]; /* padding; used by emulators */
|
||||
};
|
||||
|
||||
/* Contents of each SSE extended accumulator. */
|
||||
struct xmmacc {
|
||||
uint8_t xmm_bytes[16];
|
||||
};
|
||||
|
||||
/* Contents of the upper 16 bytes of each AVX extended accumulator. */
|
||||
struct ymmacc {
|
||||
uint8_t ymm_bytes[16];
|
||||
};
|
||||
|
||||
/* Rename structs below depending on machine architecture. */
|
||||
#ifdef __i386__
|
||||
#define __envxmm32 envxmm
|
||||
#else
|
||||
#define __envxmm32 envxmm32
|
||||
#define __envxmm64 envxmm
|
||||
#endif
|
||||
|
||||
struct __envxmm32 {
|
||||
uint16_t en_cw; /* control word (16bits) */
|
||||
uint16_t en_sw; /* status word (16bits) */
|
||||
uint16_t en_tw; /* tag word (16bits) */
|
||||
uint16_t en_opcode; /* opcode last executed (11 bits) */
|
||||
uint32_t en_fip; /* fp instruction pointer */
|
||||
uint16_t en_fcs; /* fp code segment selector */
|
||||
uint16_t en_pad0; /* padding */
|
||||
uint32_t en_foo; /* fp operand offset */
|
||||
uint16_t en_fos; /* fp operand segment selector */
|
||||
uint16_t en_pad1; /* padding */
|
||||
uint32_t en_mxcsr; /* SSE control/status register */
|
||||
uint32_t en_mxcsr_mask; /* valid bits in mxcsr */
|
||||
};
|
||||
|
||||
struct __envxmm64 {
|
||||
uint16_t en_cw; /* control word (16bits) */
|
||||
uint16_t en_sw; /* status word (16bits) */
|
||||
uint8_t en_tw; /* tag word (8bits) */
|
||||
uint8_t en_zero;
|
||||
uint16_t en_opcode; /* opcode last executed (11 bits ) */
|
||||
uint64_t en_rip; /* fp instruction pointer */
|
||||
uint64_t en_rdp; /* fp operand pointer */
|
||||
uint32_t en_mxcsr; /* SSE control/status register */
|
||||
uint32_t en_mxcsr_mask; /* valid bits in mxcsr */
|
||||
};
|
||||
|
||||
/* Floating point context. (i386 fxsave/fxrstor) */
|
||||
struct savexmm {
|
||||
struct __envxmm32 sv_env;
|
||||
struct {
|
||||
struct fpacc87 fp_acc;
|
||||
uint8_t fp_pad[6]; /* padding */
|
||||
} sv_fp[8];
|
||||
struct xmmacc sv_xmm[8];
|
||||
uint8_t sv_pad[224];
|
||||
} __aligned(16);
|
||||
|
||||
#ifdef __i386__
|
||||
union savefpu {
|
||||
struct save87 sv_87;
|
||||
struct savexmm sv_xmm;
|
||||
};
|
||||
#else
|
||||
/* Floating point context. (amd64 fxsave/fxrstor) */
|
||||
struct savefpu {
|
||||
struct __envxmm64 sv_env;
|
||||
struct {
|
||||
struct fpacc87 fp_acc;
|
||||
uint8_t fp_pad[6]; /* padding */
|
||||
} sv_fp[8];
|
||||
struct xmmacc sv_xmm[16];
|
||||
uint8_t sv_pad[96];
|
||||
} __aligned(16);
|
||||
#endif
|
||||
|
||||
struct xstate_hdr {
|
||||
uint64_t xstate_bv;
|
||||
uint8_t xstate_rsrv0[16];
|
||||
uint8_t xstate_rsrv[40];
|
||||
};
|
||||
|
||||
struct savexmm_xstate {
|
||||
struct xstate_hdr sx_hd;
|
||||
struct ymmacc sx_ymm[16];
|
||||
};
|
||||
|
||||
struct savexmm_ymm {
|
||||
struct __envxmm32 sv_env;
|
||||
struct {
|
||||
struct fpacc87 fp_acc;
|
||||
int8_t fp_pad[6]; /* padding */
|
||||
} sv_fp[8];
|
||||
struct xmmacc sv_xmm[16];
|
||||
uint8_t sv_pad[96];
|
||||
struct savexmm_xstate sv_xstate;
|
||||
} __aligned(64);
|
||||
|
||||
struct savefpu_xstate {
|
||||
struct xstate_hdr sx_hd;
|
||||
struct ymmacc sx_ymm[16];
|
||||
};
|
||||
|
||||
struct savefpu_ymm {
|
||||
struct __envxmm64 sv_env;
|
||||
struct {
|
||||
struct fpacc87 fp_acc;
|
||||
int8_t fp_pad[6]; /* padding */
|
||||
} sv_fp[8];
|
||||
struct xmmacc sv_xmm[16];
|
||||
uint8_t sv_pad[96];
|
||||
struct savefpu_xstate sv_xstate;
|
||||
} __aligned(64);
|
||||
|
||||
#undef __envxmm32
|
||||
#undef __envxmm64
|
||||
|
||||
/*
|
||||
* The hardware default control word for i387's and later coprocessors is
|
||||
* 0x37F, giving:
|
||||
*
|
||||
* round to nearest
|
||||
* 64-bit precision
|
||||
* all exceptions masked.
|
||||
*
|
||||
* FreeBSD/i386 uses 53 bit precision for things like fadd/fsub/fsqrt etc
|
||||
* because of the difference between memory and fpu register stack arguments.
|
||||
* If its using an intermediate fpu register, it has 80/64 bits to work
|
||||
* with. If it uses memory, it has 64/53 bits to work with. However,
|
||||
* gcc is aware of this and goes to a fair bit of trouble to make the
|
||||
* best use of it.
|
||||
*
|
||||
* This is mostly academic for AMD64, because the ABI prefers the use
|
||||
* SSE2 based math. For FreeBSD/amd64, we go with the default settings.
|
||||
*/
|
||||
#define __INITIAL_FPUCW__ 0x037F
|
||||
#define __INITIAL_FPUCW_I386__ 0x127F
|
||||
#define __INITIAL_NPXCW__ __INITIAL_FPUCW_I386__
|
||||
#define __INITIAL_MXCSR__ 0x1F80
|
||||
#define __INITIAL_MXCSR_MASK__ 0xFFBF
|
||||
|
||||
#endif /* !_X86_FPU_H_ */
|
@ -12,35 +12,108 @@
|
||||
|
||||
#if __x86_64__
|
||||
|
||||
struct vregs {
|
||||
unsigned long rax; /* gp regs */
|
||||
unsigned long rdx;
|
||||
unsigned long rcx;
|
||||
unsigned long rbx;
|
||||
unsigned long rsi;
|
||||
unsigned long rdi;
|
||||
unsigned long rbp;
|
||||
unsigned long rsp;
|
||||
|
||||
unsigned long r8; /* egp regs */
|
||||
unsigned long r9;
|
||||
unsigned long r10;
|
||||
unsigned long r11;
|
||||
unsigned long r12;
|
||||
unsigned long r13;
|
||||
unsigned long r14;
|
||||
unsigned long r15;
|
||||
|
||||
unsigned long rip;
|
||||
|
||||
/*TODO: add
|
||||
* Floatpoint
|
||||
* MMX
|
||||
* SSE
|
||||
*/
|
||||
|
||||
struct fp_stack {
|
||||
unsigned char st0[10];
|
||||
unsigned char _reserved_42_47[6];
|
||||
unsigned char st1[10];
|
||||
unsigned char _reserved_58_63[6];
|
||||
unsigned char st2[10];
|
||||
unsigned char _reserved_74_79[6];
|
||||
unsigned char st3[10];
|
||||
unsigned char _reserved_90_95[6];
|
||||
unsigned char st4[10];
|
||||
unsigned char _reserved_106_111[6];
|
||||
unsigned char st5[10];
|
||||
unsigned char _reserved_122_127[6];
|
||||
unsigned char st6[10];
|
||||
unsigned char _reserved_138_143[6];
|
||||
unsigned char st7[10];
|
||||
unsigned char _reserved_154_159[6];
|
||||
};
|
||||
|
||||
struct mmx_regs {
|
||||
unsigned char mm0[10];
|
||||
unsigned char _reserved_42_47[6];
|
||||
unsigned char mm1[10];
|
||||
unsigned char _reserved_58_63[6];
|
||||
unsigned char mm2[10];
|
||||
unsigned char _reserved_74_79[6];
|
||||
unsigned char mm3[10];
|
||||
unsigned char _reserved_90_95[6];
|
||||
unsigned char mm4[10];
|
||||
unsigned char _reserved_106_111[6];
|
||||
unsigned char mm5[10];
|
||||
unsigned char _reserved_122_127[6];
|
||||
unsigned char mm6[10];
|
||||
unsigned char _reserved_138_143[6];
|
||||
unsigned char mm7[10];
|
||||
unsigned char _reserved_154_159[6];
|
||||
};
|
||||
|
||||
struct xmm_regs {
|
||||
unsigned char xmm0[16];
|
||||
unsigned char xmm1[16];
|
||||
unsigned char xmm2[16];
|
||||
unsigned char xmm3[16];
|
||||
unsigned char xmm4[16];
|
||||
unsigned char xmm5[16];
|
||||
unsigned char xmm6[16];
|
||||
unsigned char xmm7[16];
|
||||
unsigned char xmm8[16];
|
||||
unsigned char xmm9[16];
|
||||
unsigned char xmm10[16];
|
||||
unsigned char xmm11[16];
|
||||
unsigned char xmm12[16];
|
||||
unsigned char xmm13[16];
|
||||
unsigned char xmm14[16];
|
||||
unsigned char xmm15[16];
|
||||
};
|
||||
|
||||
struct fpu_state {
|
||||
unsigned short control;
|
||||
unsigned short status;
|
||||
unsigned short tag;
|
||||
unsigned short opcode;
|
||||
unsigned long rip;
|
||||
unsigned long rdp;
|
||||
unsigned int mxcsr;
|
||||
unsigned int mscsr_mask;
|
||||
|
||||
union {
|
||||
struct fp_stack fp;
|
||||
struct mmx_regs mmx;
|
||||
};
|
||||
|
||||
struct xmm_regs xmm;
|
||||
unsigned char _reserved_416_511[96];
|
||||
};
|
||||
|
||||
struct vregs {
|
||||
unsigned long rax;
|
||||
unsigned long rbx;
|
||||
unsigned long rcx;
|
||||
unsigned long rdx;
|
||||
unsigned long rdi;
|
||||
unsigned long rsi;
|
||||
unsigned long rbp;
|
||||
unsigned long r8;
|
||||
unsigned long r9;
|
||||
unsigned long r10;
|
||||
unsigned long r11;
|
||||
unsigned long r12;
|
||||
unsigned long r13;
|
||||
unsigned long r14;
|
||||
unsigned long r15;
|
||||
|
||||
unsigned long rsp;
|
||||
unsigned long rip;
|
||||
unsigned long rflags;
|
||||
|
||||
struct fpu_state fpu;
|
||||
};
|
||||
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
#endif /* _ARCH_SIGNAL_H_ */
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#if defined(__INTEL__)
|
||||
# include <arch/x86/fenv.h>
|
||||
#elif defined(_x86_64_)
|
||||
#elif defined(__x86_64__)
|
||||
# include <arch/x86_64/fenv.h>
|
||||
#elif defined(__ARM__)
|
||||
# include <arch/arm/fenv.h>
|
||||
|
@ -26,7 +26,11 @@ typedef uint32_t in_addr_t;
|
||||
* and we are not allowed to import all the BeOS types here.
|
||||
*/
|
||||
#ifndef htonl
|
||||
extern unsigned long __swap_int32(unsigned long); /* private */
|
||||
# ifdef __HAIKU_BEOS_COMPATIBLE_TYPES
|
||||
extern unsigned long __swap_int32(unsigned long); /* private */
|
||||
# else
|
||||
extern unsigned int __swap_int32(unsigned int); /* private */
|
||||
# endif
|
||||
extern uint16_t __swap_int16(uint16_t); /* private */
|
||||
# if BYTE_ORDER == LITTLE_ENDIAN
|
||||
# define htonl(x) ((uint32_t)__swap_int32(x))
|
||||
|
@ -30,7 +30,7 @@ typedef struct {
|
||||
void* converter;
|
||||
char charset[64];
|
||||
unsigned int count;
|
||||
char data[1024 + 8]; // 1024 bytes for data, 8 for alignment space
|
||||
char data[1024 + 8]; /* 1024 bytes for data, 8 for alignment space */
|
||||
} mbstate_t;
|
||||
|
||||
|
||||
|
@ -23,10 +23,10 @@
|
||||
#define USER_BASE 0x100000
|
||||
#define USER_BASE_ANY USER_BASE
|
||||
#define USER_SIZE (0x80000000 - (0x10000 + 0x100000))
|
||||
#define USER_TOP (USER_BASE + USER_SIZE)
|
||||
#define USER_TOP (USER_BASE + (USER_SIZE - 1))
|
||||
|
||||
#define KERNEL_USER_DATA_BASE 0x6fff0000
|
||||
#define USER_STACK_REGION 0x70000000
|
||||
#define USER_STACK_REGION_SIZE (USER_TOP - USER_STACK_REGION)
|
||||
#define USER_STACK_REGION_SIZE ((USER_TOP - USER_STACK_REGION) + 1)
|
||||
|
||||
#endif /* _KERNEL_ARCH_ARM_KERNEL_H */
|
||||
|
@ -5,23 +5,28 @@
|
||||
#ifndef _KERNEL_ARCH_ELF_H
|
||||
#define _KERNEL_ARCH_ELF_H
|
||||
|
||||
struct Elf32_Rel;
|
||||
struct Elf32_Rela;
|
||||
|
||||
#include <elf_common.h>
|
||||
|
||||
|
||||
struct elf_image_info;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int arch_elf_relocate_rel(struct elf_image_info *image,
|
||||
struct elf_image_info *resolve_image, struct Elf32_Rel *rel, int rel_len);
|
||||
struct elf_image_info *resolve_image, elf_rel *rel, int rel_len);
|
||||
extern int arch_elf_relocate_rela(struct elf_image_info *image,
|
||||
struct elf_image_info *resolve_image, struct Elf32_Rela *rel, int rel_len);
|
||||
struct elf_image_info *resolve_image, elf_rela *rel, int rel_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#include <arch_elf.h>
|
||||
|
||||
|
||||
#endif /* _KERNEL_ARCH_ELF_H */
|
||||
|
@ -23,10 +23,10 @@
|
||||
#define USER_BASE 0x100000
|
||||
#define USER_BASE_ANY USER_BASE
|
||||
#define USER_SIZE (0x80000000 - (0x10000 + 0x100000))
|
||||
#define USER_TOP (USER_BASE + USER_SIZE)
|
||||
#define USER_TOP (USER_BASE + (USER_SIZE - 1))
|
||||
|
||||
#define KERNEL_USER_DATA_BASE 0x6fff0000
|
||||
#define USER_STACK_REGION 0x70000000
|
||||
#define USER_STACK_REGION_SIZE (USER_TOP - USER_STACK_REGION)
|
||||
#define USER_STACK_REGION_SIZE ((USER_TOP - USER_STACK_REGION) + 1)
|
||||
|
||||
#endif /* _KERNEL_ARCH_M68K_KERNEL_H */
|
||||
|
@ -26,11 +26,11 @@
|
||||
#define USER_BASE 0x100000
|
||||
#define USER_BASE_ANY USER_BASE
|
||||
#define USER_SIZE (0x80000000 - (0x10000 + 0x100000))
|
||||
#define USER_TOP (USER_BASE + USER_SIZE)
|
||||
#define USER_TOP (USER_BASE + (USER_SIZE - 1))
|
||||
|
||||
#define KERNEL_USER_DATA_BASE 0x6fff0000
|
||||
#define USER_STACK_REGION 0x70000000
|
||||
#define USER_STACK_REGION_SIZE (USER_TOP - USER_STACK_REGION)
|
||||
#define USER_STACK_REGION_SIZE ((USER_TOP - USER_STACK_REGION) + 1)
|
||||
|
||||
#endif /* _KERNEL_ARCH_MIPSEL_KERNEL_H */
|
||||
|
||||
|
@ -23,10 +23,10 @@
|
||||
#define USER_BASE 0x100000
|
||||
#define USER_BASE_ANY USER_BASE
|
||||
#define USER_SIZE (0x80000000 - (0x10000 + 0x100000))
|
||||
#define USER_TOP (USER_BASE + USER_SIZE)
|
||||
#define USER_TOP (USER_BASE + (USER_SIZE - 1))
|
||||
|
||||
#define KERNEL_USER_DATA_BASE 0x6fff0000
|
||||
#define USER_STACK_REGION 0x70000000
|
||||
#define USER_STACK_REGION_SIZE (USER_TOP - USER_STACK_REGION)
|
||||
#define USER_STACK_REGION_SIZE ((USER_TOP - USER_STACK_REGION) + 1)
|
||||
|
||||
#endif /* _KERNEL_ARCH_PPC_KERNEL_H */
|
||||
|
146
headers/private/kernel/arch/x86/32/descriptors.h
Normal file
146
headers/private/kernel/arch/x86/32/descriptors.h
Normal file
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
* Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_X86_32_DESCRIPTORS_H
|
||||
#define _KERNEL_ARCH_X86_32_DESCRIPTORS_H
|
||||
|
||||
|
||||
#define KERNEL_CODE_SEG 0x8
|
||||
#define KERNEL_DATA_SEG 0x10
|
||||
|
||||
#define USER_CODE_SEG 0x1b
|
||||
#define USER_DATA_SEG 0x23
|
||||
|
||||
#define APM_CODE32_SEGMENT 0x28
|
||||
#define APM_CODE16_SEGMENT 0x30
|
||||
#define APM_DATA_SEGMENT 0x38
|
||||
|
||||
#define BIOS_DATA_SEGMENT 0x40
|
||||
|
||||
|
||||
#ifndef _ASSEMBLER
|
||||
// this file can also be included from assembler as well
|
||||
// (and is in arch_interrupts.S)
|
||||
|
||||
#define DOUBLE_FAULT_TSS_BASE_SEGMENT 9
|
||||
#define TSS_BASE_SEGMENT (DOUBLE_FAULT_TSS_BASE_SEGMENT + smp_get_num_cpus())
|
||||
#define TLS_BASE_SEGMENT (TSS_BASE_SEGMENT + smp_get_num_cpus())
|
||||
#define APM_BASE_SEGMENT (TLS_BASE_SEGMENT + smp_get_num_cpus())
|
||||
|
||||
#define TSS_SEGMENT(cpu) (TSS_BASE_SEGMENT + cpu)
|
||||
|
||||
// defines entries in the GDT/LDT
|
||||
|
||||
struct segment_descriptor {
|
||||
uint16 limit_00_15; // bit 0 - 15
|
||||
uint16 base_00_15; // 16 - 31
|
||||
uint32 base_23_16 : 8; // 0 - 7
|
||||
uint32 type : 4; // 8 - 11
|
||||
uint32 desc_type : 1; // 12 (0 = system, 1 = code/data)
|
||||
uint32 privilege_level : 2; // 13 - 14
|
||||
uint32 present : 1; // 15
|
||||
uint32 limit_19_16 : 4; // 16 - 19
|
||||
uint32 available : 1; // 20
|
||||
uint32 zero : 1; // 21
|
||||
uint32 d_b : 1; // 22
|
||||
uint32 granularity : 1; // 23
|
||||
uint32 base_31_24 : 8; // 24 - 31
|
||||
};
|
||||
|
||||
struct interrupt_descriptor {
|
||||
uint32 a;
|
||||
uint32 b;
|
||||
};
|
||||
|
||||
struct tss {
|
||||
uint16 prev_task;
|
||||
uint16 unused0;
|
||||
uint32 sp0;
|
||||
uint32 ss0;
|
||||
uint32 sp1;
|
||||
uint32 ss1;
|
||||
uint32 sp2;
|
||||
uint32 ss2;
|
||||
uint32 cr3;
|
||||
uint32 eip, eflags, eax, ecx, edx, ebx, esp, ebp, esi, edi;
|
||||
uint32 es, cs, ss, ds, fs, gs;
|
||||
uint32 ldt_seg_selector;
|
||||
uint16 unused1;
|
||||
uint16 io_map_base;
|
||||
};
|
||||
|
||||
|
||||
static inline void
|
||||
clear_segment_descriptor(segment_descriptor* desc)
|
||||
{
|
||||
*(long long*)desc = 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
set_segment_descriptor_base(segment_descriptor* desc, addr_t base)
|
||||
{
|
||||
desc->base_00_15 = (addr_t)base & 0xffff; // base is 32 bits long
|
||||
desc->base_23_16 = ((addr_t)base >> 16) & 0xff;
|
||||
desc->base_31_24 = ((addr_t)base >> 24) & 0xff;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
set_segment_descriptor(segment_descriptor* desc, addr_t base, uint32 limit,
|
||||
uint8 type, uint8 privilegeLevel)
|
||||
{
|
||||
set_segment_descriptor_base(desc, base);
|
||||
|
||||
// limit is 20 bits long
|
||||
if (limit & 0xfff00000) {
|
||||
desc->limit_00_15 = ((addr_t)limit >> 12) & 0x0ffff;
|
||||
desc->limit_19_16 = ((addr_t)limit >> 28) & 0xf;
|
||||
desc->granularity = 1; // 4 KB granularity
|
||||
} else {
|
||||
desc->limit_00_15 = (addr_t)limit & 0x0ffff;
|
||||
desc->limit_19_16 = ((addr_t)limit >> 16) & 0xf;
|
||||
desc->granularity = 0; // 1 byte granularity
|
||||
}
|
||||
|
||||
desc->type = type;
|
||||
desc->desc_type = DT_CODE_DATA_SEGMENT;
|
||||
desc->privilege_level = privilegeLevel;
|
||||
|
||||
desc->present = 1;
|
||||
desc->available = 0; // system available bit is currently not used
|
||||
desc->d_b = 1; // 32-bit code
|
||||
|
||||
desc->zero = 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
set_tss_descriptor(segment_descriptor* desc, addr_t base, uint32 limit)
|
||||
{
|
||||
// the TSS descriptor has a special layout different from the standard descriptor
|
||||
set_segment_descriptor_base(desc, base);
|
||||
|
||||
desc->limit_00_15 = (addr_t)limit & 0x0ffff;
|
||||
desc->limit_19_16 = 0;
|
||||
|
||||
desc->type = DT_TSS;
|
||||
desc->desc_type = DT_SYSTEM_SEGMENT;
|
||||
desc->privilege_level = DPL_KERNEL;
|
||||
|
||||
desc->present = 1;
|
||||
desc->granularity = 0; // 1 Byte granularity
|
||||
desc->available = 0; // system available bit is currently not used
|
||||
desc->d_b = 0;
|
||||
|
||||
desc->zero = 0;
|
||||
}
|
||||
|
||||
|
||||
#endif /* _ASSEMBLER */
|
||||
|
||||
#endif /* _KERNEL_ARCH_X86_32_DESCRIPTORS_H */
|
44
headers/private/kernel/arch/x86/32/iframe.h
Normal file
44
headers/private/kernel/arch/x86/32/iframe.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2002-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
* Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_X86_32_IFRAME_H
|
||||
#define _KERNEL_ARCH_X86_32_IFRAME_H
|
||||
|
||||
|
||||
struct iframe {
|
||||
uint32 type; // iframe type
|
||||
uint32 gs;
|
||||
uint32 fs;
|
||||
uint32 es;
|
||||
uint32 ds;
|
||||
uint32 di;
|
||||
uint32 si;
|
||||
uint32 bp;
|
||||
uint32 sp;
|
||||
uint32 bx;
|
||||
uint32 dx;
|
||||
uint32 cx;
|
||||
uint32 ax;
|
||||
uint32 orig_eax;
|
||||
uint32 orig_edx;
|
||||
uint32 vector;
|
||||
uint32 error_code;
|
||||
uint32 ip;
|
||||
uint32 cs;
|
||||
uint32 flags;
|
||||
|
||||
// user_sp and user_ss are only present when the iframe is a userland
|
||||
// iframe (IFRAME_IS_USER()). A kernel iframe is shorter.
|
||||
uint32 user_sp;
|
||||
uint32 user_ss;
|
||||
};
|
||||
|
||||
#define IFRAME_IS_USER(f) ((f)->cs == USER_CODE_SEG \
|
||||
|| ((f)->flags & 0x20000) != 0)
|
||||
|
||||
|
||||
#endif /* _KERNEL_ARCH_X86_32_IFRAME_H */
|
169
headers/private/kernel/arch/x86/64/descriptors.h
Normal file
169
headers/private/kernel/arch/x86/64/descriptors.h
Normal file
@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_X86_64_DESCRIPTORS_H
|
||||
#define _KERNEL_ARCH_X86_64_DESCRIPTORS_H
|
||||
|
||||
|
||||
// Segment definitions.
|
||||
// Note that the ordering of these is important to SYSCALL/SYSRET.
|
||||
#define KERNEL_CODE_SEG 0x08
|
||||
#define KERNEL_DATA_SEG 0x10
|
||||
#define USER_DATA_SEG 0x1b
|
||||
#define USER_CODE_SEG 0x23
|
||||
|
||||
|
||||
#ifndef _ASSEMBLER
|
||||
|
||||
|
||||
#define TSS_BASE_SEGMENT 5
|
||||
#define TSS_SEGMENT(cpu) (TSS_BASE_SEGMENT + cpu * 2)
|
||||
|
||||
|
||||
// Structure of a segment descriptor.
|
||||
struct segment_descriptor {
|
||||
uint32 limit0 : 16;
|
||||
uint32 base0 : 24;
|
||||
uint32 type : 4;
|
||||
uint32 desc_type : 1;
|
||||
uint32 dpl : 2;
|
||||
uint32 present : 1;
|
||||
uint32 limit1 : 4;
|
||||
uint32 available : 1;
|
||||
uint32 long_mode : 1;
|
||||
uint32 d_b : 1;
|
||||
uint32 granularity : 1;
|
||||
uint32 base1 : 8;
|
||||
} _PACKED;
|
||||
|
||||
// Structure of a TSS segment descriptor.
|
||||
struct tss_descriptor {
|
||||
uint32 limit0 : 16;
|
||||
uint32 base0 : 24;
|
||||
uint32 type : 4;
|
||||
uint32 desc_type : 1;
|
||||
uint32 dpl : 2;
|
||||
uint32 present : 1;
|
||||
uint32 limit1 : 4;
|
||||
uint32 available : 1;
|
||||
uint32 unused1 : 2;
|
||||
uint32 granularity : 1;
|
||||
uint32 base1 : 8;
|
||||
uint32 base2 : 32;
|
||||
uint32 unused2 : 32;
|
||||
} _PACKED;
|
||||
|
||||
// Structure of an interrupt descriptor.
|
||||
struct interrupt_descriptor {
|
||||
uint32 base0 : 16;
|
||||
uint32 sel : 16;
|
||||
uint32 ist : 3;
|
||||
uint32 unused1 : 5;
|
||||
uint32 type : 4;
|
||||
uint32 unused2 : 1;
|
||||
uint32 dpl : 2;
|
||||
uint32 present : 1;
|
||||
uint32 base1 : 16;
|
||||
uint32 base2 : 32;
|
||||
uint32 reserved : 32;
|
||||
} _PACKED;
|
||||
|
||||
struct gdt_idt_descr {
|
||||
uint16 limit;
|
||||
addr_t base;
|
||||
} _PACKED;
|
||||
|
||||
struct tss {
|
||||
uint32 _reserved1;
|
||||
uint64 sp0;
|
||||
uint64 sp1;
|
||||
uint64 sp2;
|
||||
uint64 _reserved2;
|
||||
uint64 ist1;
|
||||
uint64 ist2;
|
||||
uint64 ist3;
|
||||
uint64 ist4;
|
||||
uint64 ist5;
|
||||
uint64 ist6;
|
||||
uint64 ist7;
|
||||
uint64 _reserved3;
|
||||
uint16 _reserved4;
|
||||
uint16 io_map_base;
|
||||
} _PACKED;
|
||||
|
||||
|
||||
static inline void
|
||||
clear_segment_descriptor(segment_descriptor* desc)
|
||||
{
|
||||
*(uint64*)desc = 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
set_segment_descriptor(segment_descriptor* desc, uint8 type, uint8 dpl)
|
||||
{
|
||||
clear_segment_descriptor(desc);
|
||||
|
||||
// In 64-bit mode the CPU ignores the base/limit of code/data segments,
|
||||
// it always treats base as 0 and does no limit checks.
|
||||
desc->base0 = 0;
|
||||
desc->base1 = 0;
|
||||
desc->limit0 = 0xffff;
|
||||
desc->limit1 = 0xf;
|
||||
desc->granularity = 1;
|
||||
|
||||
desc->type = type;
|
||||
desc->desc_type = DT_CODE_DATA_SEGMENT;
|
||||
desc->dpl = dpl;
|
||||
desc->present = 1;
|
||||
|
||||
desc->long_mode = (type & DT_CODE_EXECUTE_ONLY) ? 1 : 0;
|
||||
// Must be set to 1 for code segments only.
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
set_tss_descriptor(segment_descriptor* _desc, uint64 base, uint32 limit)
|
||||
{
|
||||
clear_segment_descriptor(_desc);
|
||||
clear_segment_descriptor(&_desc[1]);
|
||||
|
||||
// The TSS descriptor is a special format in 64-bit mode, it is 16 bytes
|
||||
// instead of 8.
|
||||
tss_descriptor* desc = (tss_descriptor*)_desc;
|
||||
|
||||
desc->base0 = base & 0xffffff;
|
||||
desc->base1 = (base >> 24) & 0xff;
|
||||
desc->base2 = (base >> 32);
|
||||
desc->limit0 = limit & 0xffff;
|
||||
desc->limit1 = (limit >> 16) & 0xf;
|
||||
|
||||
desc->present = 1;
|
||||
desc->type = DT_TSS;
|
||||
desc->desc_type = DT_SYSTEM_SEGMENT;
|
||||
desc->dpl = DPL_KERNEL;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
set_interrupt_descriptor(interrupt_descriptor* desc, uint64 addr, uint32 type,
|
||||
uint16 seg, uint32 dpl, uint32 ist)
|
||||
{
|
||||
desc->base0 = addr & 0xffff;
|
||||
desc->base1 = (addr >> 16) & 0xffff;
|
||||
desc->base2 = (addr >> 32) & 0xffffffff;
|
||||
desc->sel = seg;
|
||||
desc->ist = ist;
|
||||
desc->type = type;
|
||||
desc->dpl = dpl;
|
||||
desc->present = 1;
|
||||
desc->unused1 = 0;
|
||||
desc->unused2 = 0;
|
||||
desc->reserved = 0;
|
||||
}
|
||||
|
||||
|
||||
#endif /* _ASSEMBLER */
|
||||
|
||||
#endif /* _KERNEL_ARCH_X86_64_DESCRIPTORS_H */
|
48
headers/private/kernel/arch/x86/64/iframe.h
Normal file
48
headers/private/kernel/arch/x86/64/iframe.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_X86_64_IFRAME_H
|
||||
#define _KERNEL_ARCH_X86_64_IFRAME_H
|
||||
|
||||
|
||||
struct iframe {
|
||||
uint64 type;
|
||||
uint64 r15;
|
||||
uint64 r14;
|
||||
uint64 r13;
|
||||
uint64 r12;
|
||||
uint64 r11;
|
||||
uint64 r10;
|
||||
uint64 r9;
|
||||
uint64 r8;
|
||||
uint64 bp;
|
||||
uint64 si;
|
||||
uint64 di;
|
||||
uint64 dx;
|
||||
uint64 cx;
|
||||
uint64 bx;
|
||||
uint64 ax;
|
||||
uint64 orig_rax;
|
||||
uint64 vector;
|
||||
uint64 error_code;
|
||||
uint64 ip;
|
||||
uint64 cs;
|
||||
uint64 flags;
|
||||
|
||||
// SP and SS are unconditionally present on x86_64, make both names
|
||||
// available.
|
||||
union {
|
||||
uint64 sp;
|
||||
uint64 user_sp;
|
||||
};
|
||||
union {
|
||||
uint64 ss;
|
||||
uint64 user_ss;
|
||||
};
|
||||
} _PACKED;
|
||||
|
||||
#define IFRAME_IS_USER(f) (((f)->cs & DPL_USER) == DPL_USER)
|
||||
|
||||
|
||||
#endif /* _KERNEL_ARCH_X86_64_IFRAME_H */
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <apm_defs.h>
|
||||
#include <arch/x86/apm_defs.h>
|
||||
|
||||
|
||||
struct kernel_args;
|
||||
@ -50,6 +50,7 @@ typedef struct apm_info {
|
||||
|
||||
|
||||
#ifndef _BOOT_MODE
|
||||
#ifndef __x86_64__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -60,6 +61,7 @@ status_t apm_init(struct kernel_args *args);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // !__x86_64__
|
||||
#endif // !_BOOT_MODE
|
||||
|
||||
#endif /* KERNEL_APM_H */
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2002-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
@ -14,13 +15,15 @@
|
||||
#include <module.h>
|
||||
#include <arch/x86/descriptors.h>
|
||||
|
||||
#ifdef __x86_64__
|
||||
# include <arch/x86/64/iframe.h>
|
||||
#else
|
||||
# include <arch/x86/32/iframe.h>
|
||||
#endif
|
||||
|
||||
#endif // !_ASSEMBLER
|
||||
|
||||
|
||||
#undef PAUSE
|
||||
#define PAUSE() asm volatile ("pause;")
|
||||
|
||||
|
||||
// MSR registers (possibly Intel specific)
|
||||
#define IA32_MSR_TSC 0x10
|
||||
#define IA32_MSR_APIC_BASE 0x1b
|
||||
@ -34,6 +37,16 @@
|
||||
#define IA32_MSR_MTRR_PHYSICAL_BASE_0 0x200
|
||||
#define IA32_MSR_MTRR_PHYSICAL_MASK_0 0x201
|
||||
|
||||
#define IA32_MSR_EFER 0xc0000080
|
||||
|
||||
// x86_64 MSRs.
|
||||
#define IA32_MSR_STAR 0xc0000081
|
||||
#define IA32_MSR_LSTAR 0xc0000082
|
||||
#define IA32_MSR_FMASK 0xc0000084
|
||||
#define IA32_MSR_FS_BASE 0xc0000100
|
||||
#define IA32_MSR_GS_BASE 0xc0000101
|
||||
#define IA32_MSR_KERNEL_GS_BASE 0xc0000102
|
||||
|
||||
// K8 MSR registers
|
||||
#define K8_MSR_IPM 0xc0010055
|
||||
|
||||
@ -143,7 +156,6 @@
|
||||
#define IA32_MTR_WRITE_PROTECTED 5
|
||||
#define IA32_MTR_WRITE_BACK 6
|
||||
|
||||
|
||||
// EFLAGS register
|
||||
#define X86_EFLAGS_CARRY 0x00000001
|
||||
#define X86_EFLAGS_RESERVED1 0x00000002
|
||||
@ -178,6 +190,7 @@
|
||||
|
||||
#ifndef _ASSEMBLER
|
||||
|
||||
|
||||
struct X86PagingStructures;
|
||||
|
||||
|
||||
@ -209,87 +222,6 @@ typedef struct x86_cpu_module_info {
|
||||
void (*get_optimized_functions)(x86_optimized_functions* functions);
|
||||
} x86_cpu_module_info;
|
||||
|
||||
|
||||
struct tss {
|
||||
uint16 prev_task;
|
||||
uint16 unused0;
|
||||
uint32 sp0;
|
||||
uint32 ss0;
|
||||
uint32 sp1;
|
||||
uint32 ss1;
|
||||
uint32 sp2;
|
||||
uint32 ss2;
|
||||
uint32 cr3;
|
||||
uint32 eip, eflags, eax, ecx, edx, ebx, esp, ebp, esi, edi;
|
||||
uint32 es, cs, ss, ds, fs, gs;
|
||||
uint32 ldt_seg_selector;
|
||||
uint16 unused1;
|
||||
uint16 io_map_base;
|
||||
};
|
||||
|
||||
struct iframe {
|
||||
uint32 type; // iframe type
|
||||
uint32 gs;
|
||||
uint32 fs;
|
||||
uint32 es;
|
||||
uint32 ds;
|
||||
uint32 edi;
|
||||
uint32 esi;
|
||||
uint32 ebp;
|
||||
uint32 esp;
|
||||
uint32 ebx;
|
||||
uint32 edx;
|
||||
uint32 ecx;
|
||||
uint32 eax;
|
||||
uint32 orig_eax;
|
||||
uint32 orig_edx;
|
||||
uint32 vector;
|
||||
uint32 error_code;
|
||||
uint32 eip;
|
||||
uint32 cs;
|
||||
uint32 flags;
|
||||
|
||||
// user_esp and user_ss are only present when the iframe is a userland
|
||||
// iframe (IFRAME_IS_USER()). A kernel iframe is shorter.
|
||||
uint32 user_esp;
|
||||
uint32 user_ss;
|
||||
};
|
||||
|
||||
struct vm86_iframe {
|
||||
uint32 type; // iframe type
|
||||
uint32 __null_gs;
|
||||
uint32 __null_fs;
|
||||
uint32 __null_es;
|
||||
uint32 __null_ds;
|
||||
uint32 edi;
|
||||
uint32 esi;
|
||||
uint32 ebp;
|
||||
uint32 __kern_esp;
|
||||
uint32 ebx;
|
||||
uint32 edx;
|
||||
uint32 ecx;
|
||||
uint32 eax;
|
||||
uint32 orig_eax;
|
||||
uint32 orig_edx;
|
||||
uint32 vector;
|
||||
uint32 error_code;
|
||||
uint32 eip;
|
||||
uint16 cs, __csh;
|
||||
uint32 flags;
|
||||
uint32 esp;
|
||||
uint16 ss, __ssh;
|
||||
|
||||
/* vm86 mode specific part */
|
||||
uint16 es, __esh;
|
||||
uint16 ds, __dsh;
|
||||
uint16 fs, __fsh;
|
||||
uint16 gs, __gsh;
|
||||
};
|
||||
|
||||
#define IFRAME_IS_USER(f) ((f)->cs == USER_CODE_SEG \
|
||||
|| ((f)->flags & 0x20000) != 0)
|
||||
#define IFRAME_IS_VM86(f) (((f)->flags & 0x20000) != 0)
|
||||
|
||||
// features
|
||||
enum x86_feature_type {
|
||||
FEATURE_COMMON = 0, // cpuid eax=1, ecx register
|
||||
@ -316,6 +248,7 @@ enum x86_vendors {
|
||||
VENDOR_UNKNOWN,
|
||||
};
|
||||
|
||||
|
||||
typedef struct arch_cpu_info {
|
||||
// saved cpu info
|
||||
enum x86_vendors vendor;
|
||||
@ -331,71 +264,63 @@ typedef struct arch_cpu_info {
|
||||
|
||||
struct X86PagingStructures* active_paging_structures;
|
||||
|
||||
uint32 dr6; // temporary storage for debug registers (cf.
|
||||
uint32 dr7; // x86_exit_user_debug_at_kernel_entry())
|
||||
size_t dr6; // temporary storage for debug registers (cf.
|
||||
size_t dr7; // x86_exit_user_debug_at_kernel_entry())
|
||||
|
||||
// local TSS for this cpu
|
||||
struct tss tss;
|
||||
#ifndef __x86_64__
|
||||
struct tss double_fault_tss;
|
||||
#endif
|
||||
} arch_cpu_info;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#undef PAUSE
|
||||
#define PAUSE() asm volatile ("pause;")
|
||||
|
||||
#define nop() __asm__ ("nop"::)
|
||||
|
||||
struct arch_thread;
|
||||
#define x86_read_cr0() ({ \
|
||||
size_t _v; \
|
||||
__asm__("mov %%cr0,%0" : "=r" (_v)); \
|
||||
_v; \
|
||||
})
|
||||
|
||||
void __x86_setup_system_time(uint32 conversionFactor,
|
||||
uint32 conversionFactorNsecs, bool conversionFactorNsecsShift);
|
||||
void x86_context_switch(struct arch_thread* oldState,
|
||||
struct arch_thread* newState);
|
||||
void x86_userspace_thread_exit(void);
|
||||
void x86_end_userspace_thread_exit(void);
|
||||
void x86_swap_pgdir(uint32 newPageDir);
|
||||
void i386_set_tss_and_kstack(addr_t kstack);
|
||||
void i386_fnsave(void* fpuState);
|
||||
void i386_fxsave(void* fpuState);
|
||||
void i386_frstor(const void* fpuState);
|
||||
void i386_fxrstor(const void* fpuState);
|
||||
void i386_noop_swap(void* oldFpuState, const void* newFpuState);
|
||||
void i386_fnsave_swap(void* oldFpuState, const void* newFpuState);
|
||||
void i386_fxsave_swap(void* oldFpuState, const void* newFpuState);
|
||||
uint32 x86_read_ebp();
|
||||
uint32 x86_read_cr0();
|
||||
void x86_write_cr0(uint32 value);
|
||||
uint32 x86_read_cr4();
|
||||
void x86_write_cr4(uint32 value);
|
||||
uint64 x86_read_msr(uint32 registerNumber);
|
||||
void x86_write_msr(uint32 registerNumber, uint64 value);
|
||||
void x86_set_task_gate(int32 cpu, int32 n, int32 segment);
|
||||
void* x86_get_idt(int32 cpu);
|
||||
uint32 x86_count_mtrrs(void);
|
||||
void x86_set_mtrr(uint32 index, uint64 base, uint64 length, uint8 type);
|
||||
status_t x86_get_mtrr(uint32 index, uint64* _base, uint64* _length,
|
||||
uint8* _type);
|
||||
void x86_set_mtrrs(uint8 defaultType, const x86_mtrr_info* infos,
|
||||
uint32 count);
|
||||
void x86_init_fpu();
|
||||
bool x86_check_feature(uint32 feature, enum x86_feature_type type);
|
||||
void* x86_get_double_fault_stack(int32 cpu, size_t* _size);
|
||||
int32 x86_double_fault_get_cpu(void);
|
||||
void x86_double_fault_exception(struct iframe* frame);
|
||||
void x86_page_fault_exception_double_fault(struct iframe* frame);
|
||||
#define x86_write_cr0(value) \
|
||||
__asm__("mov %0,%%cr0" : : "r" (value))
|
||||
|
||||
#define x86_read_cr2() ({ \
|
||||
size_t _v; \
|
||||
__asm__("mov %%cr2,%0" : "=r" (_v)); \
|
||||
_v; \
|
||||
})
|
||||
|
||||
#define read_cr3(value) \
|
||||
__asm__("movl %%cr3,%0" : "=r" (value))
|
||||
#define x86_read_cr3() ({ \
|
||||
size_t _v; \
|
||||
__asm__("mov %%cr3,%0" : "=r" (_v)); \
|
||||
_v; \
|
||||
})
|
||||
|
||||
#define write_cr3(value) \
|
||||
__asm__("movl %0,%%cr3" : : "r" (value))
|
||||
#define x86_write_cr3(value) \
|
||||
__asm__("mov %0,%%cr3" : : "r" (value))
|
||||
|
||||
#define read_dr3(value) \
|
||||
__asm__("movl %%dr3,%0" : "=r" (value))
|
||||
#define x86_read_cr4() ({ \
|
||||
size_t _v; \
|
||||
__asm__("mov %%cr4,%0" : "=r" (_v)); \
|
||||
_v; \
|
||||
})
|
||||
|
||||
#define write_dr3(value) \
|
||||
__asm__("movl %0,%%dr3" : : "r" (value))
|
||||
#define x86_write_cr4(value) \
|
||||
__asm__("mov %0,%%cr4" : : "r" (value))
|
||||
|
||||
#define x86_read_dr3() ({ \
|
||||
size_t _v; \
|
||||
__asm__("mov %%dr3,%0" : "=r" (_v)); \
|
||||
_v; \
|
||||
})
|
||||
|
||||
#define x86_write_dr3(value) \
|
||||
__asm__("mov %0,%%dr3" : : "r" (value))
|
||||
|
||||
#define invalidate_TLB(va) \
|
||||
__asm__("invlpg (%0)" : : "r" (va))
|
||||
@ -445,7 +370,57 @@ void x86_page_fault_exception_double_fault(struct iframe* frame);
|
||||
_v; \
|
||||
})
|
||||
|
||||
extern segment_descriptor* gGDT;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct arch_thread;
|
||||
|
||||
#ifdef __x86_64__
|
||||
void __x86_setup_system_time(uint64 conversionFactor,
|
||||
uint64 conversionFactorNsecs);
|
||||
#else
|
||||
void __x86_setup_system_time(uint32 conversionFactor,
|
||||
uint32 conversionFactorNsecs, bool conversionFactorNsecsShift);
|
||||
#endif
|
||||
|
||||
void x86_context_switch(struct arch_thread* oldState,
|
||||
struct arch_thread* newState);
|
||||
void x86_userspace_thread_exit(void);
|
||||
void x86_end_userspace_thread_exit(void);
|
||||
void x86_swap_pgdir(addr_t newPageDir);
|
||||
void x86_fxsave(void* fpuState);
|
||||
void x86_fxrstor(const void* fpuState);
|
||||
void x86_noop_swap(void* oldFpuState, const void* newFpuState);
|
||||
void x86_fxsave_swap(void* oldFpuState, const void* newFpuState);
|
||||
addr_t x86_get_stack_frame();
|
||||
uint64 x86_read_msr(uint32 registerNumber);
|
||||
void x86_write_msr(uint32 registerNumber, uint64 value);
|
||||
uint32 x86_count_mtrrs(void);
|
||||
void x86_set_mtrr(uint32 index, uint64 base, uint64 length, uint8 type);
|
||||
status_t x86_get_mtrr(uint32 index, uint64* _base, uint64* _length,
|
||||
uint8* _type);
|
||||
void x86_set_mtrrs(uint8 defaultType, const x86_mtrr_info* infos,
|
||||
uint32 count);
|
||||
void x86_init_fpu();
|
||||
bool x86_check_feature(uint32 feature, enum x86_feature_type type);
|
||||
void* x86_get_double_fault_stack(int32 cpu, size_t* _size);
|
||||
int32 x86_double_fault_get_cpu(void);
|
||||
|
||||
void x86_invalid_exception(iframe* frame);
|
||||
void x86_fatal_exception(iframe* frame);
|
||||
void x86_unexpected_exception(iframe* frame);
|
||||
void x86_hardware_interrupt(iframe* frame);
|
||||
void x86_page_fault_exception(iframe* iframe);
|
||||
|
||||
#ifndef __x86_64__
|
||||
|
||||
void x86_fnsave(void* fpuState);
|
||||
void x86_frstor(const void* fpuState);
|
||||
void x86_fnsave_swap(void* oldFpuState, const void* newFpuState);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
|
||||
struct arch_debug_registers {
|
||||
uint32 ebp;
|
||||
addr_t bp;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2005-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_x86_INT_H
|
||||
@ -20,30 +21,30 @@ arch_int_enable_interrupts_inline(void)
|
||||
static inline int
|
||||
arch_int_disable_interrupts_inline(void)
|
||||
{
|
||||
int flags;
|
||||
size_t flags;
|
||||
|
||||
asm volatile("pushfl;\n"
|
||||
"popl %0;\n"
|
||||
asm volatile("pushf;\n"
|
||||
"pop %0;\n"
|
||||
"cli" : "=g" (flags));
|
||||
return flags ;
|
||||
return (flags & 0x200) != 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
arch_int_restore_interrupts_inline(int oldState)
|
||||
{
|
||||
if (oldState & 0x200)
|
||||
asm("sti");
|
||||
if (oldState)
|
||||
asm("sti");
|
||||
}
|
||||
|
||||
|
||||
static inline bool
|
||||
arch_int_are_interrupts_enabled_inline(void)
|
||||
{
|
||||
int flags;
|
||||
size_t flags;
|
||||
|
||||
asm volatile("pushfl;\n"
|
||||
"popl %0;\n" : "=g" (flags));
|
||||
asm volatile("pushf;\n"
|
||||
"pop %0;\n" : "=g" (flags));
|
||||
return (flags & 0x200) != 0;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2004-2008, Haiku Inc. All rights reserved.
|
||||
* Distributes under the terms of the MIT license.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*
|
||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
* Distributed under the terms of the NewOS License.
|
||||
@ -8,14 +8,58 @@
|
||||
#ifndef _KERNEL_ARCH_x86_KERNEL_H
|
||||
#define _KERNEL_ARCH_x86_KERNEL_H
|
||||
|
||||
|
||||
#ifndef _ASSEMBLER
|
||||
# include <arch/cpu.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _BOOT_MODE
|
||||
|
||||
|
||||
// 32-bit and 64-bit kernel load addresses.
|
||||
#define KERNEL_LOAD_BASE 0x80000000
|
||||
#define KERNEL_LOAD_BASE_64_BIT 0xffffffff80000000ll
|
||||
|
||||
|
||||
#elif defined(__x86_64__)
|
||||
|
||||
|
||||
// Base of the kernel address space.
|
||||
// KERNEL_BASE is the base of the kernel address space. This differs from the
|
||||
// address where the kernel is loaded to: the kernel is loaded in the top 2GB
|
||||
// of the virtual address space as required by GCC's kernel code model. The
|
||||
// whole kernel address space is the top 512GB of the address space.
|
||||
#define KERNEL_BASE 0xffffff8000000000
|
||||
#define KERNEL_SIZE 0x8000000000
|
||||
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
|
||||
#define KERNEL_LOAD_BASE 0xffffffff80000000
|
||||
|
||||
// Kernel physical memory map area.
|
||||
#define KERNEL_PMAP_BASE 0xffffff0000000000
|
||||
#define KERNEL_PMAP_SIZE 0x8000000000
|
||||
|
||||
// Userspace address space layout.
|
||||
// There is a 2MB hole just before the end of the bottom half of the address
|
||||
// space. This means that if userland passes in a buffer that crosses into the
|
||||
// uncanonical address region, it will be caught through a page fault.
|
||||
#define USER_BASE 0x0
|
||||
#define USER_BASE_ANY 0x100000
|
||||
#define USER_SIZE (0x800000000000 - 0x200000)
|
||||
#define USER_TOP (USER_BASE + (USER_SIZE - 1))
|
||||
|
||||
#define KERNEL_USER_DATA_BASE 0x7fffefff0000
|
||||
#define USER_STACK_REGION 0x7ffff0000000
|
||||
#define USER_STACK_REGION_SIZE ((USER_TOP - USER_STACK_REGION) + 1)
|
||||
|
||||
|
||||
#else // __x86_64__
|
||||
|
||||
|
||||
// memory layout
|
||||
#define KERNEL_BASE 0x80000000
|
||||
#define KERNEL_SIZE 0x80000000
|
||||
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
|
||||
#define KERNEL_BASE 0x80000000
|
||||
#define KERNEL_SIZE 0x80000000
|
||||
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
|
||||
|
||||
/* User space layout is a little special:
|
||||
* The user space does not completely cover the space not covered by the
|
||||
@ -27,13 +71,16 @@
|
||||
* TODO: introduce the 1Mb lower barrier again - it's only used for vm86 mode,
|
||||
* and this should be moved into the kernel (and address space) completely.
|
||||
*/
|
||||
#define USER_BASE 0x00
|
||||
#define USER_BASE_ANY 0x100000
|
||||
#define USER_SIZE (KERNEL_BASE - 0x10000)
|
||||
#define USER_TOP (USER_BASE + USER_SIZE)
|
||||
#define USER_BASE 0x0
|
||||
#define USER_BASE_ANY 0x100000
|
||||
#define USER_SIZE (KERNEL_BASE - 0x10000)
|
||||
#define USER_TOP (USER_BASE + (USER_SIZE - 1))
|
||||
|
||||
#define KERNEL_USER_DATA_BASE 0x6fff0000
|
||||
#define USER_STACK_REGION 0x70000000
|
||||
#define USER_STACK_REGION_SIZE (USER_TOP - USER_STACK_REGION)
|
||||
#define USER_STACK_REGION_SIZE ((USER_TOP - USER_STACK_REGION) + 1)
|
||||
|
||||
#endif /* _KERNEL_ARCH_x86_KERNEL_H */
|
||||
|
||||
#endif // __x86_64__
|
||||
|
||||
#endif // _KERNEL_ARCH_x86_KERNEL_H
|
||||
|
@ -9,6 +9,10 @@
|
||||
# error This file is included from <boot/kernel_args.h> only
|
||||
#endif
|
||||
|
||||
|
||||
#include <util/FixedWidthPointer.h>
|
||||
|
||||
|
||||
#define MAX_BOOT_PTABLES 4
|
||||
|
||||
#define _PACKED __attribute__((packed))
|
||||
@ -22,26 +26,25 @@ typedef struct {
|
||||
uint32 system_time_cv_factor;
|
||||
uint64 cpu_clock_speed;
|
||||
uint32 phys_pgdir;
|
||||
uint32 vir_pgdir;
|
||||
uint64 vir_pgdir;
|
||||
uint32 num_pgtables;
|
||||
uint32 pgtables[MAX_BOOT_PTABLES];
|
||||
uint32 virtual_end;
|
||||
uint64 virtual_end;
|
||||
uint32 phys_idt;
|
||||
uint32 vir_idt;
|
||||
uint64 vir_idt;
|
||||
uint32 phys_gdt;
|
||||
uint32 vir_gdt;
|
||||
uint32 page_hole;
|
||||
uint64 vir_gdt;
|
||||
uint64 page_hole;
|
||||
// smp stuff
|
||||
uint32 apic_time_cv_factor; // apic ticks per second
|
||||
uint32 apic_phys;
|
||||
uint32 *apic;
|
||||
FixedWidthPointer<void> apic;
|
||||
uint32 ioapic_phys;
|
||||
uint32 *ioapic;
|
||||
uint32 cpu_apic_id[MAX_BOOT_CPUS];
|
||||
uint32 cpu_apic_version[MAX_BOOT_CPUS];
|
||||
// hpet stuff
|
||||
uint32 hpet_phys;
|
||||
uint32 *hpet;
|
||||
} arch_kernel_args;
|
||||
FixedWidthPointer<void> hpet;
|
||||
} _PACKED arch_kernel_args;
|
||||
|
||||
#endif /* KERNEL_ARCH_x86_KERNEL_ARGS_H */
|
||||
|
@ -12,11 +12,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
status_t get_current_cpuid(cpuid_info *info, uint32 eax);
|
||||
status_t get_current_cpuid(cpuid_info* info, uint32 eax);
|
||||
uint32 get_eflags(void);
|
||||
void set_eflags(uint32 value);
|
||||
|
||||
status_t _user_get_cpuid(cpuid_info *info, uint32 eax, uint32 cpu);
|
||||
status_t _user_get_cpuid(cpuid_info* info, uint32 eax, uint32 cpu);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -16,39 +16,69 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct iframe *i386_get_user_iframe(void);
|
||||
struct iframe *i386_get_current_iframe(void);
|
||||
struct iframe *i386_get_thread_user_iframe(Thread *thread);
|
||||
struct sigaction;
|
||||
|
||||
uint32 x86_next_page_directory(Thread *from, Thread *to);
|
||||
|
||||
void x86_restart_syscall(struct iframe *frame);
|
||||
struct iframe* x86_get_user_iframe(void);
|
||||
struct iframe* x86_get_current_iframe(void);
|
||||
struct iframe* x86_get_thread_user_iframe(Thread* thread);
|
||||
|
||||
phys_addr_t x86_next_page_directory(Thread* from, Thread* to);
|
||||
void x86_initial_return_to_userland(Thread* thread, struct iframe* iframe);
|
||||
|
||||
void x86_restart_syscall(struct iframe* frame);
|
||||
void x86_set_tls_context(Thread* thread);
|
||||
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
|
||||
static inline Thread*
|
||||
arch_thread_get_current_thread(void)
|
||||
{
|
||||
addr_t addr;
|
||||
__asm__("mov %%gs:0, %0" : "=r"(addr));
|
||||
return (Thread*)addr;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
arch_thread_set_current_thread(Thread* t)
|
||||
{
|
||||
// Point GS segment base at thread architecture data.
|
||||
t->arch_info.thread = t;
|
||||
x86_write_msr(IA32_MSR_GS_BASE, (addr_t)&t->arch_info);
|
||||
}
|
||||
|
||||
|
||||
#else // __x86_64__
|
||||
|
||||
void x86_set_tls_context(Thread *thread);
|
||||
|
||||
// override empty macro
|
||||
#undef arch_syscall_64_bit_return_value
|
||||
void arch_syscall_64_bit_return_value(void);
|
||||
|
||||
|
||||
static
|
||||
inline Thread *
|
||||
static inline Thread*
|
||||
arch_thread_get_current_thread(void)
|
||||
{
|
||||
Thread *t;
|
||||
read_dr3(t);
|
||||
Thread* t = (Thread*)x86_read_dr3();
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
arch_thread_set_current_thread(Thread *t)
|
||||
arch_thread_set_current_thread(Thread* t)
|
||||
{
|
||||
write_dr3(t);
|
||||
x86_write_dr3(t);
|
||||
}
|
||||
|
||||
|
||||
#endif // __x86_64__
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _KERNEL_ARCH_x86_THREAD_H */
|
||||
|
||||
|
@ -11,32 +11,81 @@
|
||||
|
||||
#include <arch_cpu.h>
|
||||
|
||||
|
||||
namespace BKernel {
|
||||
struct Thread;
|
||||
}
|
||||
|
||||
|
||||
#define _ALIGNED(bytes) __attribute__((aligned(bytes)))
|
||||
// move this to somewhere else, maybe BeBuild.h?
|
||||
|
||||
|
||||
#ifndef __x86_64__
|
||||
struct farcall {
|
||||
uint32 *esp;
|
||||
uint32 *ss;
|
||||
uint32* esp;
|
||||
uint32* ss;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
// architecture specific thread info
|
||||
struct arch_thread {
|
||||
struct farcall current_stack;
|
||||
struct farcall interrupt_stack;
|
||||
#ifdef __x86_64__
|
||||
// Back pointer to the containing Thread structure. The GS segment base is
|
||||
// pointed here, used to get the current thread.
|
||||
BKernel::Thread* thread;
|
||||
|
||||
// RSP for kernel entry used by SYSCALL, and temporary scratch space.
|
||||
uint64* syscall_rsp;
|
||||
uint64* user_rsp;
|
||||
|
||||
uint64* current_stack;
|
||||
#else
|
||||
struct farcall current_stack;
|
||||
struct farcall interrupt_stack;
|
||||
#endif
|
||||
|
||||
// 512 byte floating point save point - this must be 16 byte aligned
|
||||
uint8 fpu_state[512];
|
||||
uint8 fpu_state[512] _ALIGNED(16);
|
||||
|
||||
addr_t GetFramePointer() const;
|
||||
} _ALIGNED(16);
|
||||
|
||||
|
||||
struct arch_team {
|
||||
// gcc treats empty structures as zero-length in C, but as if they contain
|
||||
// a char in C++. So we have to put a dummy in to be able to use the struct
|
||||
// from both in a consistent way.
|
||||
char dummy;
|
||||
char dummy;
|
||||
};
|
||||
|
||||
|
||||
struct arch_fork_arg {
|
||||
struct iframe iframe;
|
||||
};
|
||||
|
||||
#endif /* _KERNEL_ARCH_x86_THREAD_TYPES_H */
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
|
||||
inline addr_t
|
||||
arch_thread::GetFramePointer() const
|
||||
{
|
||||
return current_stack[1];
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
inline addr_t
|
||||
arch_thread::GetFramePointer() const
|
||||
{
|
||||
return current_stack.esp[2];
|
||||
}
|
||||
|
||||
|
||||
#endif // __x86_64__
|
||||
|
||||
#endif // _KERNEL_ARCH_x86_THREAD_TYPES_H
|
||||
|
@ -9,8 +9,12 @@
|
||||
#define ARCH_INIT_USER_DEBUG x86_init_user_debug
|
||||
|
||||
// number of breakpoints the CPU supports
|
||||
// Actually it supports 4, but DR3 is used to hold the Thread*.
|
||||
#define X86_BREAKPOINT_COUNT 3
|
||||
// On 32-bit, DR3 is used to hold the Thread*.
|
||||
#ifdef __x86_64__
|
||||
# define X86_BREAKPOINT_COUNT 4
|
||||
#else
|
||||
# define X86_BREAKPOINT_COUNT 3
|
||||
#endif
|
||||
|
||||
// debug status register DR6
|
||||
enum {
|
||||
@ -95,14 +99,14 @@ enum {
|
||||
|
||||
struct arch_breakpoint {
|
||||
void *address; // NULL, if deactivated
|
||||
uint32 type; // one of the architecture types above
|
||||
uint32 length; // one of the length values above
|
||||
size_t type; // one of the architecture types above
|
||||
size_t length; // one of the length values above
|
||||
};
|
||||
|
||||
struct arch_team_debug_info {
|
||||
struct arch_breakpoint breakpoints[X86_BREAKPOINT_COUNT];
|
||||
|
||||
uint32 dr7; // debug control register DR7
|
||||
size_t dr7; // debug control register DR7
|
||||
};
|
||||
|
||||
struct arch_thread_debug_info {
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
#ifndef __x86_64__
|
||||
|
||||
#define BIOS32_PCI_SERVICE 'ICP$'
|
||||
|
||||
struct bios32_service {
|
||||
@ -29,4 +31,6 @@ status_t bios_init(void);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
#endif /* ARCH_x86_BIOS_H */
|
||||
|
@ -9,45 +9,14 @@
|
||||
#define _KERNEL_ARCH_x86_DESCRIPTORS_H
|
||||
|
||||
|
||||
#define KERNEL_CODE_SEG 0x8
|
||||
#define KERNEL_DATA_SEG 0x10
|
||||
|
||||
#define USER_CODE_SEG 0x1b
|
||||
#define USER_DATA_SEG 0x23
|
||||
|
||||
#define APM_CODE32_SEGMENT 0x28
|
||||
#define APM_CODE16_SEGMENT 0x30
|
||||
#define APM_DATA_SEGMENT 0x38
|
||||
|
||||
#define BIOS_DATA_SEGMENT 0x40
|
||||
|
||||
#ifndef _ASSEMBLER
|
||||
// this file can also be included from assembler as well
|
||||
// (and is in arch_interrupts.S)
|
||||
|
||||
#define DOUBLE_FAULT_TSS_BASE_SEGMENT 9
|
||||
#define TSS_BASE_SEGMENT (DOUBLE_FAULT_TSS_BASE_SEGMENT + smp_get_num_cpus())
|
||||
#define TLS_BASE_SEGMENT (TSS_BASE_SEGMENT + smp_get_num_cpus())
|
||||
#define APM_BASE_SEGMENT (TLS_BASE_SEGMENT + smp_get_num_cpus())
|
||||
|
||||
|
||||
// defines entries in the GDT/LDT
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
struct kernel_args;
|
||||
|
||||
typedef struct segment_descriptor {
|
||||
uint16 limit_00_15; // bit 0 - 15
|
||||
uint16 base_00_15; // 16 - 31
|
||||
uint32 base_23_16 : 8; // 0 - 7
|
||||
uint32 type : 4; // 8 - 11
|
||||
uint32 desc_type : 1; // 12 (0 = system, 1 = code/data)
|
||||
uint32 privilege_level : 2; // 13 - 14
|
||||
uint32 present : 1; // 15
|
||||
uint32 limit_19_16 : 4; // 16 - 19
|
||||
uint32 available : 1; // 20
|
||||
uint32 zero : 1; // 21
|
||||
uint32 d_b : 1; // 22
|
||||
uint32 granularity : 1; // 23
|
||||
uint32 base_31_24 : 8; // 24 - 31
|
||||
} segment_descriptor;
|
||||
|
||||
enum descriptor_privilege_levels {
|
||||
DPL_KERNEL = 0,
|
||||
@ -73,74 +42,25 @@ enum descriptor_types {
|
||||
DT_CODE_DATA_SEGMENT = 1,
|
||||
};
|
||||
|
||||
static inline void
|
||||
clear_segment_descriptor(struct segment_descriptor *desc)
|
||||
{
|
||||
*(long long *)desc = 0;
|
||||
}
|
||||
enum gate_types {
|
||||
GATE_INTERRUPT = 14,
|
||||
GATE_TRAP = 15,
|
||||
};
|
||||
|
||||
|
||||
static inline void
|
||||
set_segment_descriptor_base(struct segment_descriptor *desc, addr_t base)
|
||||
{
|
||||
desc->base_00_15 = (addr_t)base & 0xffff; // base is 32 bits long
|
||||
desc->base_23_16 = ((addr_t)base >> 16) & 0xff;
|
||||
desc->base_31_24 = ((addr_t)base >> 24) & 0xff;
|
||||
}
|
||||
void x86_descriptors_init(kernel_args* args);
|
||||
void x86_descriptors_init_percpu(kernel_args* args, int cpu);
|
||||
status_t x86_descriptors_init_post_vm(kernel_args* args);
|
||||
|
||||
|
||||
static inline void
|
||||
set_segment_descriptor(struct segment_descriptor *desc, addr_t base, uint32 limit,
|
||||
uint8 type, uint8 privilegeLevel)
|
||||
{
|
||||
set_segment_descriptor_base(desc, base);
|
||||
|
||||
// limit is 20 bits long
|
||||
if (limit & 0xfff00000) {
|
||||
desc->limit_00_15 = ((addr_t)limit >> 12) & 0x0ffff;
|
||||
desc->limit_19_16 = ((addr_t)limit >> 28) & 0xf;
|
||||
desc->granularity = 1; // 4 KB granularity
|
||||
} else {
|
||||
desc->limit_00_15 = (addr_t)limit & 0x0ffff;
|
||||
desc->limit_19_16 = ((addr_t)limit >> 16) & 0xf;
|
||||
desc->granularity = 0; // 1 byte granularity
|
||||
}
|
||||
limit >>= 12;
|
||||
#endif // !_ASSEMBLER
|
||||
|
||||
|
||||
desc->type = type;
|
||||
desc->desc_type = DT_CODE_DATA_SEGMENT;
|
||||
desc->privilege_level = privilegeLevel;
|
||||
#ifdef __x86_64__
|
||||
# include <arch/x86/64/descriptors.h>
|
||||
#else
|
||||
# include <arch/x86/32/descriptors.h>
|
||||
#endif
|
||||
|
||||
desc->present = 1;
|
||||
desc->available = 0; // system available bit is currently not used
|
||||
desc->d_b = 1; // 32-bit code
|
||||
|
||||
desc->zero = 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
set_tss_descriptor(struct segment_descriptor *desc, addr_t base, uint32 limit)
|
||||
{
|
||||
// the TSS descriptor has a special layout different from the standard descriptor
|
||||
set_segment_descriptor_base(desc, base);
|
||||
|
||||
desc->limit_00_15 = (addr_t)limit & 0x0ffff;
|
||||
desc->limit_19_16 = 0;
|
||||
|
||||
desc->type = DT_TSS;
|
||||
desc->desc_type = DT_SYSTEM_SEGMENT;
|
||||
desc->privilege_level = DPL_KERNEL;
|
||||
|
||||
desc->present = 1;
|
||||
desc->granularity = 0; // 1 Byte granularity
|
||||
desc->available = 0; // system available bit is currently not used
|
||||
desc->d_b = 0;
|
||||
|
||||
desc->zero = 0;
|
||||
}
|
||||
|
||||
#endif /* _ASSEMBLER */
|
||||
|
||||
#endif /* _KERNEL_ARCH_x86_DESCRIPTORS_H */
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
** Copyright 2002, Michael Noisternig. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_x86_SELECTOR_H
|
||||
#define _KERNEL_ARCH_x86_SELECTOR_H
|
||||
|
||||
typedef uint32 selector_id;
|
||||
typedef uint64 selector_type;
|
||||
|
||||
// DATA segments are read-only
|
||||
// CODE segments are execute-only
|
||||
// both can be modified by using the suffixed enum versions
|
||||
// legend: w = writable
|
||||
// d = expand down
|
||||
// r = readable
|
||||
// c = conforming
|
||||
enum segment_type {
|
||||
DATA = 0x8, DATA_w, DATA_d, DATA_wd, CODE, CODE_r, CODE_c, CODE_rc
|
||||
};
|
||||
|
||||
#define SELECTOR(base,limit,type,mode32) \
|
||||
(((uint64)(((((uint32)base)>>16)&0xff) | (((uint32)base)&0xff000000) | ((type)<<9) | ((mode32)<<22) | (1<<15))<<32) \
|
||||
| ( (limit) >= (1<<20) ? (((limit)>>12)&0xffff) | ((uint64)(((limit)>>12)&0xf0000)<<32) | ((uint64)1<<(23+32)) : ((limit)&0xffff) | ((uint64)((limit)&0xf0000)<<32) ) \
|
||||
| ((((uint32)base)&0xffff)<<16))
|
||||
|
||||
void i386_selector_init( void *gdt );
|
||||
selector_id i386_selector_add( selector_type selector );
|
||||
void i386_selector_remove( selector_id id );
|
||||
selector_type i386_selector_get( selector_id id );
|
||||
|
||||
#endif
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
int i386_smp_interrupt(int vector);
|
||||
void arch_smp_ack_interrupt(void);
|
||||
status_t arch_smp_set_apic_timer(bigtime_t relativeTimeout);
|
||||
status_t arch_smp_clear_apic_timer(void);
|
||||
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
#ifndef _ARCH_x86_TYPES_H
|
||||
#define _ARCH_x86_TYPES_H
|
||||
|
||||
#ifndef WIN32
|
||||
typedef unsigned long long uint64;
|
||||
typedef long long int64;
|
||||
#else /* WIN32 */
|
||||
typedef unsigned __int64 uint64;
|
||||
typedef __int64 int64;
|
||||
#endif
|
||||
|
||||
typedef unsigned long uint32;
|
||||
typedef long int32;
|
||||
typedef unsigned short uint16;
|
||||
typedef short int16;
|
||||
typedef unsigned char uint8;
|
||||
typedef char int8;
|
||||
typedef unsigned long addr;
|
||||
|
||||
#define _OBOS_TIME_T_ int /* basic time_t type */
|
||||
|
||||
/* define this as not all platforms have it set, but we'll make sure as
|
||||
* some conditional checks need it
|
||||
*/
|
||||
#define __INTEL__ 1
|
||||
|
||||
#endif /* _ARCH_x86_TYPES_H */
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2008 Jan Klötzke
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _VM86_H
|
||||
#define _VM86_H
|
||||
|
||||
#include <OS.h>
|
||||
#include <arch/x86/arch_cpu.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define VM86_MIN_RAM_SIZE 0x1000
|
||||
#define RETURN_TO_32_INT 255
|
||||
|
||||
struct vm86_state {
|
||||
struct vm86_iframe regs;
|
||||
area_id bios_area;
|
||||
area_id ram_area;
|
||||
unsigned int if_flag : 1;
|
||||
};
|
||||
|
||||
status_t x86_vm86_enter(struct vm86_iframe *frame);
|
||||
void x86_vm86_return(struct vm86_iframe *frame, status_t retval);
|
||||
|
||||
status_t vm86_prepare(struct vm86_state *state, unsigned int ram_size);
|
||||
void vm86_cleanup(struct vm86_state *state);
|
||||
status_t vm86_do_int(struct vm86_state *state, uint8 vec);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -11,15 +11,9 @@
|
||||
|
||||
|
||||
typedef struct addr_range {
|
||||
addr_t start;
|
||||
size_t size;
|
||||
} addr_range;
|
||||
|
||||
|
||||
typedef struct phys_addr_range {
|
||||
phys_addr_t start;
|
||||
phys_size_t size;
|
||||
} phys_addr_range;
|
||||
uint64 start;
|
||||
uint64 size;
|
||||
} _PACKED addr_range;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -27,28 +21,18 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
status_t insert_address_range(addr_range* ranges, uint32* _numRanges,
|
||||
uint32 maxRanges, addr_t start, size_t size);
|
||||
uint32 maxRanges, uint64 start, uint64 size);
|
||||
status_t remove_address_range(addr_range* ranges, uint32* _numRanges,
|
||||
uint32 maxRanges, addr_t start, size_t size);
|
||||
bool get_free_address_range(addr_range* ranges, uint32 numRanges, addr_t base,
|
||||
size_t size, addr_t* _rangeBase);
|
||||
bool is_address_range_covered(addr_range* ranges, uint32 numRanges, addr_t base,
|
||||
size_t size);
|
||||
uint32 maxRanges, uint64 start, uint64 size);
|
||||
bool get_free_address_range(addr_range* ranges, uint32 numRanges, uint64 base,
|
||||
uint64 size, uint64* _rangeBase);
|
||||
bool is_address_range_covered(addr_range* ranges, uint32 numRanges, uint64 base,
|
||||
uint64 size);
|
||||
void sort_address_ranges(addr_range* ranges, uint32 numRanges);
|
||||
|
||||
status_t insert_physical_address_range(phys_addr_range* ranges,
|
||||
uint32* _numRanges, uint32 maxRanges, phys_addr_t start, phys_size_t size);
|
||||
status_t remove_physical_address_range(phys_addr_range* ranges,
|
||||
uint32* _numRanges, uint32 maxRanges, phys_addr_t start, phys_size_t size);
|
||||
bool get_free_physical_address_range(phys_addr_range* ranges, uint32 numRanges,
|
||||
phys_addr_t base, phys_size_t size, phys_addr_t* _rangeBase);
|
||||
bool is_physical_address_range_covered(phys_addr_range* ranges,
|
||||
uint32 numRanges, phys_addr_t base, phys_size_t size);
|
||||
void sort_physical_address_ranges(phys_addr_range* ranges, uint32 numRanges);
|
||||
|
||||
status_t insert_physical_memory_range(phys_addr_t start, phys_size_t size);
|
||||
status_t insert_physical_allocated_range(phys_addr_t start, phys_size_t size);
|
||||
status_t insert_virtual_allocated_range(addr_t start, size_t size);
|
||||
status_t insert_physical_memory_range(uint64 start, uint64 size);
|
||||
status_t insert_physical_allocated_range(uint64 start, uint64 size);
|
||||
status_t insert_virtual_allocated_range(uint64 start, uint64 size);
|
||||
void ignore_physical_memory_ranges_beyond_4gb();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -5,24 +5,21 @@
|
||||
#ifndef KERNEL_BOOT_ARCH_H
|
||||
#define KERNEL_BOOT_ARCH_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <boot/elf.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ELF support */
|
||||
|
||||
extern status_t boot_arch_elf_relocate_rel(struct preloaded_image *image,
|
||||
struct Elf32_Rel *rel, int rel_len);
|
||||
extern status_t boot_arch_elf_relocate_rela(struct preloaded_image *image,
|
||||
struct Elf32_Rela *rel, int rel_len);
|
||||
extern status_t boot_arch_elf_relocate_rel(preloaded_elf32_image* image,
|
||||
struct Elf32_Rel* rel, int rel_len);
|
||||
extern status_t boot_arch_elf_relocate_rel(preloaded_elf64_image* image,
|
||||
struct Elf64_Rel* rel, int rel_len);
|
||||
extern status_t boot_arch_elf_relocate_rela(preloaded_elf32_image* image,
|
||||
struct Elf32_Rela* rel, int rel_len);
|
||||
extern status_t boot_arch_elf_relocate_rela(preloaded_elf64_image* image,
|
||||
struct Elf64_Rela* rel, int rel_len);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* KERNEL_BOOT_ARCH_H */
|
||||
|
@ -34,41 +34,41 @@ typedef struct disk_identifier {
|
||||
union {
|
||||
struct {
|
||||
uint16 base_address;
|
||||
} legacy;
|
||||
} _PACKED legacy;
|
||||
struct {
|
||||
uint8 bus;
|
||||
uint8 slot;
|
||||
uint8 function;
|
||||
} pci;
|
||||
} _PACKED pci;
|
||||
} bus;
|
||||
union {
|
||||
struct {
|
||||
bool master;
|
||||
} ata;
|
||||
} _PACKED ata;
|
||||
struct {
|
||||
bool master;
|
||||
uint8 logical_unit;
|
||||
} atapi;
|
||||
} _PACKED atapi;
|
||||
struct {
|
||||
uint8 logical_unit;
|
||||
} scsi;
|
||||
} _PACKED scsi;
|
||||
struct {
|
||||
uint8 tbd;
|
||||
} usb;
|
||||
} _PACKED usb;
|
||||
struct {
|
||||
uint64 guid;
|
||||
} firewire;
|
||||
} _PACKED firewire;
|
||||
struct {
|
||||
uint64 wwd;
|
||||
} fibre;
|
||||
} _PACKED fibre;
|
||||
struct {
|
||||
off_t size;
|
||||
struct {
|
||||
off_t offset;
|
||||
uint32 sum;
|
||||
} check_sums[NUM_DISK_CHECK_SUMS];
|
||||
} unknown;
|
||||
} _PACKED check_sums[NUM_DISK_CHECK_SUMS];
|
||||
} _PACKED unknown;
|
||||
} device;
|
||||
} disk_identifier;
|
||||
} _PACKED disk_identifier;
|
||||
|
||||
#endif /* KERNEL_BOOT_DISK_IDENTIFIER_H */
|
||||
|
@ -6,14 +6,15 @@
|
||||
#define KERNEL_BOOT_DRIVER_SETTINGS_H
|
||||
|
||||
|
||||
#include <util/FixedWidthPointer.h>
|
||||
#include <util/list.h>
|
||||
|
||||
|
||||
struct driver_settings_file {
|
||||
struct driver_settings_file *next;
|
||||
FixedWidthPointer<struct driver_settings_file> next;
|
||||
char name[B_OS_NAME_LENGTH];
|
||||
char *buffer;
|
||||
size_t size;
|
||||
};
|
||||
FixedWidthPointer<char> buffer;
|
||||
uint32 size;
|
||||
} _PACKED;
|
||||
|
||||
#endif /* KERNEL_BOOT_DRIVER_SETTINGS_H */
|
||||
|
@ -1,7 +1,8 @@
|
||||
/*
|
||||
** Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
* Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef KERNEL_BOOT_ELF_H
|
||||
#define KERNEL_BOOT_ELF_H
|
||||
|
||||
@ -9,45 +10,88 @@
|
||||
#include <boot/addr_range.h>
|
||||
#include <sys/stat.h>
|
||||
#include <elf_priv.h>
|
||||
#include <util/FixedWidthPointer.h>
|
||||
|
||||
typedef struct elf32_region {
|
||||
area_id id;
|
||||
uint32 start;
|
||||
uint32 size;
|
||||
int32 delta;
|
||||
} _PACKED elf32_region;
|
||||
|
||||
typedef struct elf64_region {
|
||||
area_id id;
|
||||
uint64 start;
|
||||
uint64 size;
|
||||
int64 delta;
|
||||
} _PACKED elf64_region;
|
||||
|
||||
struct preloaded_image {
|
||||
struct preloaded_image *next;
|
||||
char *name;
|
||||
elf_region text_region;
|
||||
elf_region data_region;
|
||||
FixedWidthPointer<struct preloaded_image> next;
|
||||
FixedWidthPointer<char> name;
|
||||
uint8 elf_class;
|
||||
addr_range dynamic_section;
|
||||
struct Elf32_Ehdr elf_header;
|
||||
|
||||
struct Elf32_Sym *syms;
|
||||
struct Elf32_Rel *rel;
|
||||
int rel_len;
|
||||
struct Elf32_Rela *rela;
|
||||
int rela_len;
|
||||
struct Elf32_Rel *pltrel;
|
||||
int pltrel_len;
|
||||
int pltrel_type;
|
||||
|
||||
struct Elf32_Sym *debug_symbols;
|
||||
const char *debug_string_table;
|
||||
uint32 num_debug_symbols, debug_string_table_size;
|
||||
FixedWidthPointer<char> debug_string_table;
|
||||
uint32 num_debug_symbols;
|
||||
uint32 debug_string_table_size;
|
||||
|
||||
ino_t inode;
|
||||
image_id id;
|
||||
// the ID field will be filled out in the kernel
|
||||
bool is_module;
|
||||
// set by the module initialization code
|
||||
};
|
||||
} _PACKED;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
struct preloaded_elf32_image : public preloaded_image {
|
||||
Elf32_Ehdr elf_header;
|
||||
elf32_region text_region;
|
||||
elf32_region data_region;
|
||||
|
||||
FixedWidthPointer<Elf32_Sym> syms;
|
||||
FixedWidthPointer<Elf32_Rel> rel;
|
||||
int32 rel_len;
|
||||
FixedWidthPointer<Elf32_Rela> rela;
|
||||
int32 rela_len;
|
||||
FixedWidthPointer<Elf32_Rel> pltrel;
|
||||
int32 pltrel_len;
|
||||
int32 pltrel_type;
|
||||
|
||||
FixedWidthPointer<Elf32_Sym> debug_symbols;
|
||||
} _PACKED;
|
||||
|
||||
struct preloaded_elf64_image : public preloaded_image {
|
||||
Elf64_Ehdr elf_header;
|
||||
elf64_region text_region;
|
||||
elf64_region data_region;
|
||||
|
||||
FixedWidthPointer<Elf64_Sym> syms;
|
||||
FixedWidthPointer<Elf64_Rel> rel;
|
||||
int64 rel_len;
|
||||
FixedWidthPointer<Elf64_Rela> rela;
|
||||
int64 rela_len;
|
||||
FixedWidthPointer<Elf64_Rel> pltrel;
|
||||
int64 pltrel_len;
|
||||
int64 pltrel_type;
|
||||
|
||||
FixedWidthPointer<Elf64_Sym> debug_symbols;
|
||||
} _PACKED;
|
||||
|
||||
|
||||
#if B_HAIKU_64_BIT
|
||||
typedef preloaded_elf64_image preloaded_elf_image;
|
||||
#else
|
||||
typedef preloaded_elf32_image preloaded_elf_image;
|
||||
#endif
|
||||
|
||||
extern status_t boot_elf_resolve_symbol(struct preloaded_image *image,
|
||||
struct Elf32_Sym *symbol, addr_t *symbolAddress);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#ifdef _BOOT_MODE
|
||||
extern status_t boot_elf_resolve_symbol(preloaded_elf32_image* image,
|
||||
struct Elf32_Sym* symbol, Elf32_Addr* symbolAddress);
|
||||
extern status_t boot_elf_resolve_symbol(preloaded_elf64_image* image,
|
||||
struct Elf64_Sym* symbol, Elf64_Addr* symbolAddress);
|
||||
extern void boot_elf64_set_relocation(Elf64_Addr resolveAddress,
|
||||
Elf64_Addr finalAddress);
|
||||
#endif
|
||||
|
||||
#endif /* KERNEL_BOOT_ELF_H */
|
||||
|
@ -18,7 +18,8 @@
|
||||
#include <platform_kernel_args.h>
|
||||
#include <arch_kernel_args.h>
|
||||
|
||||
#include <util/KMessage.h>
|
||||
#include <util/FixedWidthPointer.h>
|
||||
|
||||
|
||||
#define CURRENT_KERNEL_ARGS_VERSION 1
|
||||
#define MAX_KERNEL_ARGS_RANGE 20
|
||||
@ -43,28 +44,30 @@ typedef struct kernel_args {
|
||||
uint32 kernel_args_size;
|
||||
uint32 version;
|
||||
|
||||
struct preloaded_image kernel_image;
|
||||
struct preloaded_image *preloaded_images;
|
||||
FixedWidthPointer<struct preloaded_image> kernel_image;
|
||||
FixedWidthPointer<struct preloaded_image> preloaded_images;
|
||||
|
||||
uint32 num_physical_memory_ranges;
|
||||
phys_addr_range physical_memory_range[MAX_PHYSICAL_MEMORY_RANGE];
|
||||
uint32 num_physical_allocated_ranges;
|
||||
phys_addr_range physical_allocated_range[MAX_PHYSICAL_ALLOCATED_RANGE];
|
||||
uint32 num_virtual_allocated_ranges;
|
||||
addr_range virtual_allocated_range[MAX_VIRTUAL_ALLOCATED_RANGE];
|
||||
uint32 num_kernel_args_ranges;
|
||||
addr_range kernel_args_range[MAX_KERNEL_ARGS_RANGE];
|
||||
uint64 ignored_physical_memory;
|
||||
uint32 num_physical_memory_ranges;
|
||||
addr_range physical_memory_range[MAX_PHYSICAL_MEMORY_RANGE];
|
||||
uint32 num_physical_allocated_ranges;
|
||||
addr_range physical_allocated_range[MAX_PHYSICAL_ALLOCATED_RANGE];
|
||||
uint32 num_virtual_allocated_ranges;
|
||||
addr_range virtual_allocated_range[MAX_VIRTUAL_ALLOCATED_RANGE];
|
||||
uint32 num_kernel_args_ranges;
|
||||
addr_range kernel_args_range[MAX_KERNEL_ARGS_RANGE];
|
||||
uint64 ignored_physical_memory;
|
||||
|
||||
uint32 num_cpus;
|
||||
addr_range cpu_kstack[MAX_BOOT_CPUS];
|
||||
|
||||
KMessage boot_volume;
|
||||
// boot volume KMessage data
|
||||
FixedWidthPointer<void> boot_volume;
|
||||
int32 boot_volume_size;
|
||||
|
||||
struct driver_settings_file *driver_settings;
|
||||
FixedWidthPointer<struct driver_settings_file> driver_settings;
|
||||
|
||||
struct {
|
||||
phys_addr_range physical_buffer;
|
||||
addr_range physical_buffer;
|
||||
uint32 bytes_per_row;
|
||||
uint16 width;
|
||||
uint16 height;
|
||||
@ -72,12 +75,12 @@ typedef struct kernel_args {
|
||||
bool enabled;
|
||||
} frame_buffer;
|
||||
|
||||
void *vesa_modes;
|
||||
FixedWidthPointer<void> vesa_modes;
|
||||
uint16 vesa_modes_size;
|
||||
uint8 vesa_capabilities;
|
||||
void *edid_info;
|
||||
FixedWidthPointer<void> edid_info;
|
||||
|
||||
void *debug_output;
|
||||
FixedWidthPointer<void> debug_output;
|
||||
uint32 debug_size;
|
||||
bool keep_debug_output_buffer;
|
||||
|
||||
@ -85,8 +88,8 @@ typedef struct kernel_args {
|
||||
arch_kernel_args arch_args;
|
||||
|
||||
// bootsplash data
|
||||
uint8 *boot_splash;
|
||||
FixedWidthPointer<uint8> boot_splash;
|
||||
|
||||
} kernel_args;
|
||||
} _PACKED kernel_args;
|
||||
|
||||
#endif /* KERNEL_BOOT_KERNEL_ARGS_H */
|
||||
|
@ -10,8 +10,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include <apm.h>
|
||||
#include <arch/x86/apm.h>
|
||||
#include <bios_drive.h>
|
||||
#include <util/FixedWidthPointer.h>
|
||||
|
||||
|
||||
// must match SMP_MAX_CPUS in arch_smp.h
|
||||
@ -25,9 +26,10 @@
|
||||
typedef struct {
|
||||
uint16 serial_base_ports[MAX_SERIAL_PORTS];
|
||||
|
||||
bios_drive *drives; // this does not contain the boot drive
|
||||
FixedWidthPointer<bios_drive> drives;
|
||||
// this does not contain the boot drive
|
||||
|
||||
apm_info apm;
|
||||
} platform_kernel_args;
|
||||
} _PACKED platform_kernel_args;
|
||||
|
||||
#endif /* KERNEL_BOOT_PLATFORM_BIOS_IA32_KERNEL_ARGS_H */
|
||||
|
@ -8,10 +8,12 @@
|
||||
|
||||
#include <boot/kernel_args.h>
|
||||
|
||||
#include <util/KMessage.h>
|
||||
|
||||
struct stage2_args;
|
||||
|
||||
extern struct kernel_args gKernelArgs;
|
||||
extern KMessage gBootVolume;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define _KERNEL_ELF_H
|
||||
|
||||
|
||||
#include <elf_common.h>
|
||||
#include <thread.h>
|
||||
#include <image.h>
|
||||
|
||||
@ -49,9 +50,9 @@ status_t elf_add_memory_image_symbol(image_id id, const char* name,
|
||||
addr_t address, size_t size, int32 type);
|
||||
status_t elf_init(struct kernel_args *args);
|
||||
|
||||
status_t _user_read_kernel_image_symbols(image_id id,
|
||||
struct Elf32_Sym* symbolTable, int32* _symbolCount,
|
||||
char* stringTable, size_t* _stringTableSize, addr_t* _imageDelta);
|
||||
status_t _user_read_kernel_image_symbols(image_id id, elf_sym* symbolTable,
|
||||
int32* _symbolCount, char* stringTable, size_t* _stringTableSize,
|
||||
addr_t* _imageDelta);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
|
||||
#include <elf32.h>
|
||||
#include <elf64.h>
|
||||
#include <image.h>
|
||||
|
||||
|
||||
@ -24,60 +25,67 @@ typedef struct elf_region {
|
||||
} elf_region;
|
||||
|
||||
struct elf_image_info {
|
||||
struct elf_image_info *next; // next image in the hash
|
||||
char *name;
|
||||
image_id id;
|
||||
int32 ref_count;
|
||||
struct vnode *vnode;
|
||||
elf_region text_region;
|
||||
elf_region data_region;
|
||||
addr_t dynamic_section; // pointer to the dynamic section
|
||||
struct elf_linked_image *linked_images;
|
||||
struct elf_image_info* next; // next image in the hash
|
||||
char* name;
|
||||
image_id id;
|
||||
int32 ref_count;
|
||||
struct vnode* vnode;
|
||||
elf_region text_region;
|
||||
elf_region data_region;
|
||||
addr_t dynamic_section; // pointer to the dynamic section
|
||||
struct elf_linked_image* linked_images;
|
||||
|
||||
bool symbolic;
|
||||
bool symbolic;
|
||||
|
||||
struct Elf32_Ehdr *elf_header;
|
||||
elf_ehdr* elf_header;
|
||||
|
||||
// pointer to symbol participation data structures
|
||||
char *needed;
|
||||
uint32 *symhash;
|
||||
struct Elf32_Sym *syms;
|
||||
char *strtab;
|
||||
struct Elf32_Rel *rel;
|
||||
int rel_len;
|
||||
struct Elf32_Rela *rela;
|
||||
int rela_len;
|
||||
struct Elf32_Rel *pltrel;
|
||||
int pltrel_len;
|
||||
int pltrel_type;
|
||||
char* needed;
|
||||
uint32* symhash;
|
||||
elf_sym* syms;
|
||||
char* strtab;
|
||||
elf_rel* rel;
|
||||
int rel_len;
|
||||
elf_rela* rela;
|
||||
int rela_len;
|
||||
elf_rel* pltrel;
|
||||
int pltrel_len;
|
||||
int pltrel_type;
|
||||
|
||||
struct Elf32_Sym *debug_symbols;
|
||||
uint32 num_debug_symbols;
|
||||
const char *debug_string_table;
|
||||
elf_sym* debug_symbols;
|
||||
uint32 num_debug_symbols;
|
||||
const char* debug_string_table;
|
||||
|
||||
// versioning related structures
|
||||
uint32 num_version_definitions;
|
||||
struct Elf32_Verdef *version_definitions;
|
||||
uint32 num_needed_versions;
|
||||
struct Elf32_Verneed *needed_versions;
|
||||
Elf32_Versym *symbol_versions;
|
||||
struct elf_version_info *versions;
|
||||
uint32 num_versions;
|
||||
uint32 num_version_definitions;
|
||||
elf_verdef* version_definitions;
|
||||
uint32 num_needed_versions;
|
||||
elf_verneed* needed_versions;
|
||||
elf_versym* symbol_versions;
|
||||
struct elf_version_info* versions;
|
||||
uint32 num_versions;
|
||||
};
|
||||
|
||||
|
||||
#define STRING(image, offset) ((char *)(&(image)->strtab[(offset)]))
|
||||
#define STRING(image, offset) ((char*)(&(image)->strtab[(offset)]))
|
||||
#define SYMNAME(image, sym) STRING(image, (sym)->st_name)
|
||||
#define SYMBOL(image, num) ((struct Elf32_Sym *)&(image)->syms[num])
|
||||
#define SYMBOL(image, num) (&(image)->syms[num])
|
||||
#define HASHTABSIZE(image) ((image)->symhash[0])
|
||||
#define HASHBUCKETS(image) ((unsigned int *)&(image)->symhash[2])
|
||||
#define HASHCHAINS(image) ((unsigned int *)&(image)->symhash[2+HASHTABSIZE(image)])
|
||||
#define HASHBUCKETS(image) ((unsigned int*)&(image)->symhash[2])
|
||||
#define HASHCHAINS(image) ((unsigned int*)&(image)->symhash[2+HASHTABSIZE(image)])
|
||||
|
||||
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
extern "C" {
|
||||
#endif
|
||||
status_t elf_resolve_symbol(struct elf_image_info *image, struct Elf32_Sym *sym,
|
||||
struct elf_image_info *shared_image, addr_t *sym_addr);
|
||||
|
||||
extern status_t elf_resolve_symbol(struct elf_image_info* image,
|
||||
elf_sym* symbol, struct elf_image_info* sharedImage,
|
||||
addr_t* _symbolAddress);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _KERNEL_ELF_PRIV_H */
|
||||
|
@ -15,6 +15,10 @@
|
||||
#include <arch_config.h>
|
||||
|
||||
|
||||
#ifndef KERNEL_LOAD_BASE
|
||||
# define KERNEL_LOAD_BASE KERNEL_BASE
|
||||
#endif
|
||||
|
||||
// macro to check whether an address is in the kernel address space (avoid
|
||||
// always-true checks)
|
||||
#if KERNEL_BASE == 0
|
||||
@ -27,7 +31,14 @@
|
||||
#endif
|
||||
|
||||
// Buffers passed in from user-space shouldn't point into the kernel.
|
||||
#define IS_USER_ADDRESS(x) (!IS_KERNEL_ADDRESS(x))
|
||||
#if USER_BASE == 0
|
||||
# define IS_USER_ADDRESS(x) ((addr_t)(x) <= USER_TOP)
|
||||
#elif USER_TOP == __HAIKU_ADDR_MAX
|
||||
# define IS_USER_ADDRESS(x) ((addr_t)(x) >= USER_BASE)
|
||||
#else
|
||||
# define IS_USER_ADDRESS(x) \
|
||||
((addr_t)(x) >= USER_BASE && (addr_t)(x) <= USER_TOP)
|
||||
#endif
|
||||
|
||||
#define DEBUG_KERNEL_STACKS
|
||||
// Note, debugging kernel stacks doesn't really work yet. Since the
|
||||
|
@ -34,7 +34,7 @@ enum {
|
||||
|
||||
typedef uint32 cpu_mask_t;
|
||||
|
||||
typedef void (*smp_call_func)(uint32 data1, int32 currentCPU, uint32 data2, uint32 data3);
|
||||
typedef void (*smp_call_func)(addr_t data1, int32 currentCPU, addr_t data2, addr_t data3);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -49,14 +49,14 @@ status_t smp_init_post_generic_syscalls(void);
|
||||
bool smp_trap_non_boot_cpus(int32 cpu, uint32* rendezVous);
|
||||
void smp_wake_up_non_boot_cpus(void);
|
||||
void smp_cpu_rendezvous(volatile uint32 *var, int current_cpu);
|
||||
void smp_send_ici(int32 targetCPU, int32 message, uint32 data, uint32 data2, uint32 data3,
|
||||
void smp_send_ici(int32 targetCPU, int32 message, addr_t data, addr_t data2, addr_t data3,
|
||||
void *data_ptr, uint32 flags);
|
||||
void smp_send_multicast_ici(cpu_mask_t cpuMask, int32 message, uint32 data,
|
||||
uint32 data2, uint32 data3, void *data_ptr, uint32 flags);
|
||||
void smp_send_broadcast_ici(int32 message, uint32 data, uint32 data2, uint32 data3,
|
||||
void smp_send_multicast_ici(cpu_mask_t cpuMask, int32 message, addr_t data,
|
||||
addr_t data2, addr_t data3, void *data_ptr, uint32 flags);
|
||||
void smp_send_broadcast_ici(int32 message, addr_t data, addr_t data2, addr_t data3,
|
||||
void *data_ptr, uint32 flags);
|
||||
void smp_send_broadcast_ici_interrupts_disabled(int32 currentCPU, int32 message,
|
||||
uint32 data, uint32 data2, uint32 data3, void *data_ptr, uint32 flags);
|
||||
addr_t data, addr_t data2, addr_t data3, void *data_ptr, uint32 flags);
|
||||
|
||||
int32 smp_get_num_cpus(void);
|
||||
void smp_set_num_cpus(int32 numCPUs);
|
||||
|
@ -187,9 +187,6 @@ private:
|
||||
|
||||
typedef int32 (*thread_entry_func)(thread_func, void *);
|
||||
|
||||
typedef bool (*page_fault_callback)(addr_t address, addr_t faultAddress,
|
||||
bool isWrite);
|
||||
|
||||
|
||||
namespace BKernel {
|
||||
|
||||
@ -477,13 +474,7 @@ struct Thread : TeamThreadIteratorEntry<thread_id>, KernelReferenceable {
|
||||
} msg; // write_sem/read_sem are protected by fLock when accessed by
|
||||
// others, the other fields are protected by write_sem/read_sem
|
||||
|
||||
union {
|
||||
addr_t fault_handler;
|
||||
page_fault_callback fault_callback;
|
||||
// TODO: this is a temporary field used for the vm86 implementation
|
||||
// and should be removed again when that one is moved into the
|
||||
// kernel entirely.
|
||||
};
|
||||
addr_t fault_handler;
|
||||
int32 page_faults_allowed;
|
||||
/* this field may only stay in debug builds in the future */
|
||||
|
||||
|
156
headers/private/kernel/util/FixedWidthPointer.h
Normal file
156
headers/private/kernel/util/FixedWidthPointer.h
Normal file
@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef KERNEL_UTIL_FIXED_WIDTH_POINTER_H
|
||||
#define KERNEL_UTIL_FIXED_WIDTH_POINTER_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
/*!
|
||||
\class FixedWidthPointer
|
||||
\brief Pointer class with fixed size (64-bit) storage.
|
||||
|
||||
This class is a pointer-like class that uses a fixed size 64-bit storage.
|
||||
This is used to make kernel_args compatible (i.e. the same size) for both
|
||||
32-bit and 64-bit kernels.
|
||||
*/
|
||||
template<typename Type>
|
||||
class FixedWidthPointer {
|
||||
public:
|
||||
Type * Pointer() const
|
||||
{
|
||||
return (Type*)(addr_t)fValue;
|
||||
}
|
||||
|
||||
operator Type*() const
|
||||
{
|
||||
return Pointer();
|
||||
}
|
||||
|
||||
Type& operator*() const
|
||||
{
|
||||
return *Pointer();
|
||||
}
|
||||
|
||||
Type* operator->() const
|
||||
{
|
||||
return Pointer();
|
||||
}
|
||||
|
||||
Type& operator[](size_t i) const
|
||||
{
|
||||
return Pointer()[i];
|
||||
}
|
||||
|
||||
FixedWidthPointer& operator=(const FixedWidthPointer& p)
|
||||
{
|
||||
fValue = p.fValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
FixedWidthPointer& operator=(Type* p)
|
||||
{
|
||||
fValue = (addr_t)p;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
Get the 64-bit pointer value.
|
||||
\return Pointer address.
|
||||
*/
|
||||
uint64 Get() const
|
||||
{
|
||||
return fValue;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the 64-bit pointer value.
|
||||
\param addr New address for the pointer.
|
||||
*/
|
||||
void SetTo(uint64 addr)
|
||||
{
|
||||
fValue = addr;
|
||||
}
|
||||
|
||||
private:
|
||||
uint64 fValue;
|
||||
} _PACKED;
|
||||
|
||||
|
||||
// Specialization for void pointers, can be converted to another pointer type.
|
||||
template<>
|
||||
class FixedWidthPointer<void> {
|
||||
public:
|
||||
void * Pointer() const
|
||||
{
|
||||
return (void*)(addr_t)fValue;
|
||||
}
|
||||
|
||||
operator void*() const
|
||||
{
|
||||
return Pointer();
|
||||
}
|
||||
|
||||
FixedWidthPointer& operator=(const FixedWidthPointer& p)
|
||||
{
|
||||
fValue = p.fValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
FixedWidthPointer& operator=(void* p)
|
||||
{
|
||||
fValue = (addr_t)p;
|
||||
return *this;
|
||||
}
|
||||
|
||||
uint64 Get() const
|
||||
{
|
||||
return fValue;
|
||||
}
|
||||
|
||||
void SetTo(uint64 addr)
|
||||
{
|
||||
fValue = addr;
|
||||
}
|
||||
|
||||
private:
|
||||
uint64 fValue;
|
||||
} _PACKED;
|
||||
|
||||
|
||||
template<typename Type>
|
||||
inline bool
|
||||
operator==(const FixedWidthPointer<Type>& a, const Type* b)
|
||||
{
|
||||
return a.Get() == (addr_t)b;
|
||||
}
|
||||
|
||||
|
||||
template<typename Type>
|
||||
inline bool
|
||||
operator!=(const FixedWidthPointer<Type>& a, const Type* b)
|
||||
{
|
||||
return a.Get() != (addr_t)b;
|
||||
}
|
||||
|
||||
|
||||
template<typename Type>
|
||||
inline bool
|
||||
operator==(const FixedWidthPointer<Type>& a, Type* b)
|
||||
{
|
||||
return a.Get() == (addr_t)b;
|
||||
}
|
||||
|
||||
|
||||
template<typename Type>
|
||||
inline bool
|
||||
operator!=(const FixedWidthPointer<Type>& a, Type* b)
|
||||
{
|
||||
return a.Get() != (addr_t)b;
|
||||
}
|
||||
|
||||
|
||||
#endif /* KERNEL_UTIL_FIXED_WIDTH_POINTER_H */
|
@ -176,7 +176,7 @@ int _user_open_dir_entry_ref(dev_t device, ino_t inode,
|
||||
const char *name);
|
||||
int _user_open_dir(int fd, const char *path);
|
||||
int _user_open_parent_dir(int fd, char *name, size_t nameLength);
|
||||
status_t _user_fcntl(int fd, int op, uint32 argument);
|
||||
status_t _user_fcntl(int fd, int op, size_t argument);
|
||||
status_t _user_fsync(int fd);
|
||||
status_t _user_flock(int fd, int op);
|
||||
status_t _user_read_stat(int fd, const char *path, bool traverseLink,
|
||||
|
@ -176,7 +176,7 @@ status_t _user_get_memory_properties(team_id teamID, const void *address,
|
||||
area_id _user_area_for(void *address);
|
||||
area_id _user_find_area(const char *name);
|
||||
status_t _user_get_area_info(area_id area, area_info *info);
|
||||
status_t _user_get_next_area_info(team_id team, int32 *cookie, area_info *info);
|
||||
status_t _user_get_next_area_info(team_id team, ssize_t *cookie, area_info *info);
|
||||
status_t _user_resize_area(area_id area, size_t newSize);
|
||||
area_id _user_transfer_area(area_id area, void **_address, uint32 addressSpec,
|
||||
team_id target);
|
||||
|
@ -85,9 +85,9 @@ struct net_buffer_module_info {
|
||||
|
||||
status_t (*direct_access)(net_buffer* buffer, uint32 offset,
|
||||
size_t bytes, void** _data);
|
||||
status_t (*read)(net_buffer* buffer, uint32 offset, void* data,
|
||||
status_t (*read)(net_buffer* buffer, size_t offset, void* data,
|
||||
size_t bytes);
|
||||
status_t (*write)(net_buffer* buffer, uint32 offset,
|
||||
status_t (*write)(net_buffer* buffer, size_t offset,
|
||||
const void* data, size_t bytes);
|
||||
|
||||
int32 (*checksum)(net_buffer* buffer, uint32 offset, size_t bytes,
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <OS.h>
|
||||
|
||||
#include <elf32.h>
|
||||
#include <elf64.h>
|
||||
|
||||
|
||||
// #pragma mark - runtime loader libroot interface
|
||||
@ -100,13 +101,13 @@ typedef struct image_t {
|
||||
|
||||
// pointer to symbol participation data structures
|
||||
uint32 *symhash;
|
||||
struct Elf32_Sym *syms;
|
||||
elf_sym *syms;
|
||||
char *strtab;
|
||||
struct Elf32_Rel *rel;
|
||||
elf_rel *rel;
|
||||
int rel_len;
|
||||
struct Elf32_Rela *rela;
|
||||
elf_rela *rela;
|
||||
int rela_len;
|
||||
struct Elf32_Rel *pltrel;
|
||||
elf_rel *pltrel;
|
||||
int pltrel_len;
|
||||
|
||||
uint32 num_needed;
|
||||
@ -114,20 +115,20 @@ typedef struct image_t {
|
||||
|
||||
// versioning related structures
|
||||
uint32 num_version_definitions;
|
||||
struct Elf32_Verdef *version_definitions;
|
||||
elf_verdef *version_definitions;
|
||||
uint32 num_needed_versions;
|
||||
struct Elf32_Verneed *needed_versions;
|
||||
Elf32_Versym *symbol_versions;
|
||||
elf_verneed *needed_versions;
|
||||
elf_versym *symbol_versions;
|
||||
elf_version_info *versions;
|
||||
uint32 num_versions;
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct Elf32_Sym* (*find_undefined_symbol)(struct image_t* rootImage,
|
||||
elf_sym* (*find_undefined_symbol)(struct image_t* rootImage,
|
||||
struct image_t* image,
|
||||
const SymbolLookupInfo& lookupInfo,
|
||||
struct image_t** foundInImage);
|
||||
#else
|
||||
struct Elf32_Sym* (*find_undefined_symbol)(struct image_t* rootImage,
|
||||
elf_sym* (*find_undefined_symbol)(struct image_t* rootImage,
|
||||
struct image_t* image,
|
||||
const struct SymbolLookupInfo* lookupInfo,
|
||||
struct image_t** foundInImage);
|
||||
@ -152,12 +153,12 @@ typedef struct image_queue_t {
|
||||
#define IMAGE_FLAG_RTLD_MASK 0x03
|
||||
// RTLD_{LAZY,NOW} | RTLD_{LOCAL,GLOBAL}
|
||||
|
||||
#define STRING(image, offset) ((char *)(&(image)->strtab[(offset)]))
|
||||
#define STRING(image, offset) ((char*)(&(image)->strtab[(offset)]))
|
||||
#define SYMNAME(image, sym) STRING(image, (sym)->st_name)
|
||||
#define SYMBOL(image, num) ((struct Elf32_Sym *)&(image)->syms[num])
|
||||
#define SYMBOL(image, num) (&(image)->syms[num])
|
||||
#define HASHTABSIZE(image) ((image)->symhash[0])
|
||||
#define HASHBUCKETS(image) ((unsigned int *)&(image)->symhash[2])
|
||||
#define HASHCHAINS(image) ((unsigned int *)&(image)->symhash[2+HASHTABSIZE(image)])
|
||||
#define HASHBUCKETS(image) ((unsigned int*)&(image)->symhash[2])
|
||||
#define HASHCHAINS(image) ((unsigned int*)&(image)->symhash[2+HASHTABSIZE(image)])
|
||||
|
||||
|
||||
// The name of the area the runtime loader creates for debugging purposes.
|
||||
|
@ -28,7 +28,7 @@ int32 get_rounded_cpu_speed(void);
|
||||
#endif
|
||||
|
||||
|
||||
#if __INTEL__
|
||||
#if defined(__INTEL__) || defined(__x86_64__)
|
||||
/*! Tries to parse an Intel CPU ID string to match our usual naming scheme.
|
||||
Note, this function is not thread safe, and must only be called once
|
||||
at a time.
|
||||
@ -87,7 +87,7 @@ get_cpu_vendor_string(enum cpu_types type)
|
||||
/* We're not that nice here. */
|
||||
return "IBM/Motorola";
|
||||
#endif
|
||||
#if __INTEL__
|
||||
#if defined(__INTEL__) || defined(__x86_64__)
|
||||
/* Determine x86 vendor name */
|
||||
switch (type & B_CPU_x86_VENDOR_MASK) {
|
||||
case B_CPU_INTEL_x86:
|
||||
@ -113,7 +113,7 @@ get_cpu_vendor_string(enum cpu_types type)
|
||||
}
|
||||
|
||||
|
||||
#ifdef __INTEL__
|
||||
#if defined(__INTEL__) || defined(__x86_64__)
|
||||
/*! Parameter 'name' needs to point to an allocated array of 49 characters. */
|
||||
void
|
||||
get_cpuid_model_string(char *name)
|
||||
@ -168,16 +168,16 @@ get_cpuid_model_string(char *name)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* __INTEL__ */
|
||||
#endif /* __INTEL__ || __x86_64__ */
|
||||
|
||||
|
||||
const char *
|
||||
get_cpu_model_string(system_info *info)
|
||||
{
|
||||
#if __INTEL__
|
||||
#if defined(__INTEL__) || defined(__x86_64__)
|
||||
char cpuidName[49];
|
||||
/* for use with get_cpuid_model_string() */
|
||||
#endif /* __INTEL__ */
|
||||
#endif /* __INTEL__ || __x86_64__ */
|
||||
|
||||
/* Determine CPU type */
|
||||
switch (info->cpu_type) {
|
||||
@ -195,7 +195,7 @@ get_cpu_model_string(system_info *info)
|
||||
default:
|
||||
return NULL;
|
||||
#endif /* __POWERPC__ */
|
||||
#if __INTEL__
|
||||
#if defined(__INTEL__) || defined(__x86_64__)
|
||||
case B_CPU_x86:
|
||||
return "Unknown x86";
|
||||
|
||||
@ -405,7 +405,7 @@ get_cpu_model_string(system_info *info)
|
||||
return parse_intel(cpuidName);
|
||||
}
|
||||
return NULL;
|
||||
#endif /* __INTEL__ */
|
||||
#endif /* __INTEL__ || __x86_64__ */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,4 +19,8 @@
|
||||
#define R_386_GOTOFF 9 /* add GOT relative symbol address */
|
||||
#define R_386_GOTPC 10 /* add PC relative GOT table address */
|
||||
|
||||
#ifdef _BOOT_MODE
|
||||
# include "../x86_64/arch_elf.h"
|
||||
#endif
|
||||
|
||||
#endif /* _KERNEL_ARCH_x86_ELF_H */
|
||||
|
19
headers/private/system/arch/x86_64/arch_commpage_defs.h
Normal file
19
headers/private/system/arch/x86_64/arch_commpage_defs.h
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _SYSTEM_ARCH_x86_64_COMMPAGE_DEFS_H
|
||||
#define _SYSTEM_ARCH_x86_64_COMMPAGE_DEFS_H
|
||||
|
||||
#ifndef _SYSTEM_COMMPAGE_DEFS_H
|
||||
# error Must not be included directly. Include <commpage_defs.h> instead!
|
||||
#endif
|
||||
|
||||
#define COMMPAGE_ENTRY_X86_MEMCPY (COMMPAGE_ENTRY_FIRST_ARCH_SPECIFIC + 0)
|
||||
#define COMMPAGE_ENTRY_X86_MEMSET (COMMPAGE_ENTRY_FIRST_ARCH_SPECIFIC + 1)
|
||||
#define COMMPAGE_ENTRY_X86_SIGNAL_HANDLER \
|
||||
(COMMPAGE_ENTRY_FIRST_ARCH_SPECIFIC + 2)
|
||||
|
||||
#define ARCH_USER_COMMPAGE_ADDR (0xffffffffffff0000)
|
||||
|
||||
#endif /* _SYSTEM_ARCH_x86_64_COMMPAGE_DEFS_H */
|
15
headers/private/system/arch/x86_64/arch_config.h
Normal file
15
headers/private/system/arch/x86_64/arch_config.h
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_x86_64_CONFIG_H
|
||||
#define _KERNEL_ARCH_x86_64_CONFIG_H
|
||||
|
||||
#define FUNCTION_CALL_PARAMETER_ALIGNMENT_TYPE unsigned long
|
||||
|
||||
#define STACK_GROWS_DOWNWARDS
|
||||
|
||||
//#define ATOMIC_FUNCS_ARE_SYSCALLS
|
||||
//#define ATOMIC64_FUNCS_ARE_SYSCALLS
|
||||
|
||||
#endif /* _KERNEL_ARCH_x86_64_CONFIG_H */
|
12
headers/private/system/arch/x86_64/arch_cpu_defs.h
Normal file
12
headers/private/system/arch/x86_64/arch_cpu_defs.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _SYSTEM_ARCH_X86_DEFS_H
|
||||
#define _SYSTEM_ARCH_X86_DEFS_H
|
||||
|
||||
|
||||
#define SPINLOCK_PAUSE() asm volatile("pause;")
|
||||
|
||||
|
||||
#endif /* _SYSTEM_ARCH_X86_DEFS_H */
|
55
headers/private/system/arch/x86_64/arch_elf.h
Normal file
55
headers/private/system/arch/x86_64/arch_elf.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_x86_64_ELF_H
|
||||
#define _KERNEL_ARCH_x86_64_ELF_H
|
||||
|
||||
|
||||
/* Relocation types. */
|
||||
#define R_X86_64_NONE 0 /* No relocation. */
|
||||
#define R_X86_64_64 1 /* Direct 64-bit. */
|
||||
#define R_X86_64_PC32 2 /* PC relative 32-bit signed. */
|
||||
#define R_X86_64_GOT32 3 /* 32-bit GOT entry. */
|
||||
#define R_X86_64_PLT32 4 /* 32-bit PLT address. */
|
||||
#define R_X86_64_COPY 5 /* Copy symbol at runtime. */
|
||||
#define R_X86_64_GLOB_DAT 6 /* Create GOT entry. */
|
||||
#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry. */
|
||||
#define R_X86_64_RELATIVE 8 /* Adjust by program base. */
|
||||
#define R_X86_64_GOTPCREL 9 /* 32-bit signed PC relative offset to GOT. */
|
||||
#define R_X86_64_32 10 /* Direct 32-bit zero-extended. */
|
||||
#define R_X86_64_32S 11 /* Direct 32-bit sign-extended. */
|
||||
#define R_X86_64_16 12 /* Direct 16-bit zero-extended. */
|
||||
#define R_X86_64_PC16 13 /* 16-bit sign-extended PC relative. */
|
||||
#define R_X86_64_8 14 /* Direct 8-bit sign-extended. */
|
||||
#define R_X86_64_PC8 15 /* 8-bit sign-extended PC relative. */
|
||||
#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol. */
|
||||
#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block. */
|
||||
#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block. */
|
||||
#define R_X86_64_TLSGD 19 /* 32-bit signed PC relative offset to two GOT entries (GD). */
|
||||
#define R_X86_64_TLSLD 20 /* 32-bit signed PC relative offset to two GOT entries (LD). */
|
||||
#define R_X86_64_DTPOFF32 21 /* Offset in TLS block. */
|
||||
#define R_X86_64_GOTTPOFF 22 /* 32-bit signed PC relative offset to GOT entry (IE). */
|
||||
#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block. */
|
||||
#define R_X86_64_PC64 24 /* PC relative 64-bit. */
|
||||
#define R_X86_64_GOTOFF64 25 /* 64-bit offset to GOT. */
|
||||
#define R_X86_64_GOTPC32 26 /* 32 bit signed PC relative offset to GOT. */
|
||||
#define R_X86_64_GOT64 27 /* 64-bit GOT entry offset. */
|
||||
#define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset to GOT entry. */
|
||||
#define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT. */
|
||||
#define R_X86_64_GOTPLT64 30 /* Like GOT64, says PLT entry needed. */
|
||||
#define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset to PLT entry. */
|
||||
#define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend. */
|
||||
#define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend. */
|
||||
#define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */
|
||||
#define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS descriptor. */
|
||||
#define R_X86_64_TLSDESC 36 /* TLS descriptor. */
|
||||
#define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base. */
|
||||
|
||||
|
||||
#ifdef _BOOT_MODE
|
||||
# include "../x86/arch_elf.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _KERNEL_ARCH_x86_64_ELF_H */
|
17
headers/private/system/arch/x86_64/arch_real_time_data.h
Normal file
17
headers/private/system/arch/x86_64/arch_real_time_data.h
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_REAL_TIME_DATA_H
|
||||
#define _KERNEL_ARCH_REAL_TIME_DATA_H
|
||||
|
||||
#include <StorageDefs.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
struct arch_real_time_data {
|
||||
bigtime_t system_time_offset;
|
||||
uint32 system_time_conversion_factor;
|
||||
};
|
||||
|
||||
#endif /* _KERNEL_ARCH_REAL_TIME_DATA_H */
|
17
headers/private/system/arch/x86_64/asm_defs.h
Normal file
17
headers/private/system/arch/x86_64/asm_defs.h
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef SYSTEM_ARCH_X86_64_ASM_DEFS_H
|
||||
#define SYSTEM_ARCH_X86_64_ASM_DEFS_H
|
||||
|
||||
|
||||
#define SYMBOL(name) .global name; name
|
||||
#define SYMBOL_END(name) 1: .size name, 1b - name
|
||||
#define STATIC_FUNCTION(name) .type name, @function; name
|
||||
#define FUNCTION(name) .global name; .type name, @function; name
|
||||
#define FUNCTION_END(name) 1: .size name, 1b - name
|
||||
|
||||
|
||||
#endif /* SYSTEM_ARCH_X86_64_ASM_DEFS_H */
|
||||
|
@ -9,10 +9,7 @@
|
||||
#define _ELF32_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <ByteOrder.h>
|
||||
|
||||
#include <arch_elf.h>
|
||||
#include <elf_common.h>
|
||||
|
||||
|
||||
typedef uint32 Elf32_Addr;
|
||||
@ -25,8 +22,6 @@ typedef Elf32_Half Elf32_Versym;
|
||||
|
||||
/*** ELF header ***/
|
||||
|
||||
#define EI_NIDENT 16
|
||||
|
||||
struct Elf32_Ehdr {
|
||||
uint8 e_ident[EI_NIDENT];
|
||||
Elf32_Half e_type;
|
||||
@ -48,73 +43,6 @@ struct Elf32_Ehdr {
|
||||
#endif
|
||||
};
|
||||
|
||||
#define ELF_MAGIC "\x7f""ELF"
|
||||
|
||||
// e_ident[] indices
|
||||
#define EI_MAG0 0
|
||||
#define EI_MAG1 1
|
||||
#define EI_MAG2 2
|
||||
#define EI_MAG3 3
|
||||
#define EI_CLASS 4
|
||||
#define EI_DATA 5
|
||||
#define EI_VERSION 6
|
||||
#define EI_PAD 7
|
||||
|
||||
// e_machine (Architecture)
|
||||
#define EM_NONE 0 // No machine
|
||||
#define EM_M32 1 // AT&T WE 32100
|
||||
#define EM_SPARC 2 // Sparc
|
||||
#define EM_386 3 // Intel 80386
|
||||
#define EM_68K 4 // Motorola m68k family
|
||||
#define EM_88K 5 // Motorola m88k family
|
||||
#define EM_486 6 // Intel 80486, Reserved for future use
|
||||
#define EM_860 7 // Intel 80860
|
||||
#define EM_MIPS 8 // MIPS R3000 (officially, big-endian only)
|
||||
#define EM_S370 9 // IBM System/370
|
||||
#define EM_MIPS_RS3_LE 10 // MIPS R3000 little-endian, Deprecated
|
||||
#define EM_PARISC 15 // HPPA
|
||||
#define EM_VPP550 17 // Fujitsu VPP500
|
||||
#define EM_SPARC32PLUS 18 // Sun "v8plus"
|
||||
#define EM_960 19 // Intel 80960
|
||||
#define EM_PPC 20 // PowerPC
|
||||
#define EM_PPC64 21 // 64-bit PowerPC
|
||||
#define EM_S390 22 // IBM S/390
|
||||
#define EM_V800 36 // NEC V800 series
|
||||
#define EM_FR20 37 // Fujitsu FR20
|
||||
#define EM_RH32 38 // TRW RH32
|
||||
#define EM_MCORE 39 // Motorola M*Core
|
||||
#define EM_RCE 39 // Old name for MCore
|
||||
#define EM_ARM 40 // ARM
|
||||
#define EM_OLD_ALPHA 41 // Digital Alpha
|
||||
#define EM_SH 42 // Renesas / SuperH SH
|
||||
#define EM_SPARCV9 43 // SPARC v9 64-bit
|
||||
#define EM_TRICORE 44 // Siemens Tricore embedded processor
|
||||
#define EM_ARC 45 // ARC Cores
|
||||
#define EM_H8_300 46 // Renesas H8/300
|
||||
#define EM_H8_300H 47 // Renesas H8/300H
|
||||
#define EM_H8S 48 // Renesas H8S
|
||||
#define EM_H8_500 49 // Renesas H8/500
|
||||
#define EM_IA_64 50 // Intel IA-64 Processor
|
||||
#define EM_MIPS_X 51 // Stanford MIPS-X
|
||||
#define EM_COLDFIRE 52 // Motorola Coldfire
|
||||
#define EM_68HC12 53 // Motorola M68HC12
|
||||
#define EM_MMA 54 // Fujitsu Multimedia Accelerator
|
||||
#define EM_PCP 55 // Siemens PCP
|
||||
#define EM_NCPU 56 // Sony nCPU embedded RISC processor
|
||||
#define EM_NDR1 57 // Denso NDR1 microprocesspr
|
||||
#define EM_STARCORE 58 // Motorola Star*Core processor
|
||||
#define EM_ME16 59 // Toyota ME16 processor
|
||||
#define EM_ST100 60 // STMicroelectronics ST100 processor
|
||||
#define EM_TINYJ 61 // Advanced Logic Corp. TinyJ embedded processor
|
||||
#define EM_X86_64 62 // Advanced Micro Devices X86-64 processor
|
||||
|
||||
// architecture class (EI_CLASS)
|
||||
#define ELFCLASS32 1
|
||||
#define ELFCLASS64 2
|
||||
// endian (EI_DATA)
|
||||
#define ELFDATA2LSB 1 /* little endian */
|
||||
#define ELFDATA2MSB 2 /* big endian */
|
||||
|
||||
|
||||
/*** section header ***/
|
||||
|
||||
@ -131,45 +59,6 @@ struct Elf32_Shdr {
|
||||
Elf32_Word sh_entsize;
|
||||
};
|
||||
|
||||
// special section indices
|
||||
#define SHN_UNDEF 0
|
||||
#define SHN_LORESERVE 0xff00
|
||||
#define SHN_LOPROC 0xff00
|
||||
#define SHN_HIPROC 0xff1f
|
||||
#define SHN_ABS 0xfff1
|
||||
#define SHN_COMMON 0xfff2
|
||||
#define SHN_HIRESERVE 0xffff
|
||||
|
||||
// section header type
|
||||
#define SHT_NULL 0
|
||||
#define SHT_PROGBITS 1
|
||||
#define SHT_SYMTAB 2
|
||||
#define SHT_STRTAB 3
|
||||
#define SHT_RELA 4
|
||||
#define SHT_HASH 5
|
||||
#define SHT_DYNAMIC 6
|
||||
#define SHT_NOTE 7
|
||||
#define SHT_NOBITS 8
|
||||
#define SHT_REL 9
|
||||
#define SHT_SHLIB 10
|
||||
#define SHT_DYNSYM 11
|
||||
|
||||
#define SHT_GNU_verdef 0x6ffffffd /* version definition section */
|
||||
#define SHT_GNU_verneed 0x6ffffffe /* version needs section */
|
||||
#define SHT_GNU_versym 0x6fffffff /* version symbol table */
|
||||
|
||||
#define SHT_LOPROC 0x70000000
|
||||
#define SHT_HIPROC 0x7fffffff
|
||||
#define SHT_LOUSER 0x80000000
|
||||
#define SHT_HIUSER 0xffffffff
|
||||
|
||||
// section header flags
|
||||
#define SHF_WRITE 1
|
||||
#define SHF_ALLOC 2
|
||||
#define SHF_EXECINSTR 4
|
||||
|
||||
#define SHF_MASKPROC 0xf0000000
|
||||
|
||||
|
||||
/*** program header ***/
|
||||
|
||||
@ -189,27 +78,6 @@ struct Elf32_Phdr {
|
||||
#endif
|
||||
};
|
||||
|
||||
// program header segment types
|
||||
#define PT_NULL 0
|
||||
#define PT_LOAD 1
|
||||
#define PT_DYNAMIC 2
|
||||
#define PT_INTERP 3
|
||||
#define PT_NOTE 4
|
||||
#define PT_SHLIB 5
|
||||
#define PT_PHDR 6
|
||||
#define PT_STACK 0x6474e551
|
||||
|
||||
#define PT_LOPROC 0x70000000
|
||||
#define PT_HIPROC 0x7fffffff
|
||||
|
||||
// program header segment flags
|
||||
#define PF_EXECUTE 0x1
|
||||
#define PF_WRITE 0x2
|
||||
#define PF_READ 0x4
|
||||
#define PF_PROTECTION_MASK (PF_EXECUTE | PF_WRITE | PF_READ)
|
||||
|
||||
#define PF_MASKPROC 0xf0000000
|
||||
|
||||
struct Elf32_Sym {
|
||||
Elf32_Word st_name;
|
||||
Elf32_Addr st_value;
|
||||
@ -221,6 +89,7 @@ struct Elf32_Sym {
|
||||
#ifdef __cplusplus
|
||||
uint8 Bind() const;
|
||||
uint8 Type() const;
|
||||
void SetInfo(uint8 bind, uint8 type);
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -228,22 +97,6 @@ struct Elf32_Sym {
|
||||
#define ELF32_ST_TYPE(i) ((i) & 0xf)
|
||||
#define ELF32_ST_INFO(b, t) (((b) << 4) + ((t) & 0xf))
|
||||
|
||||
#define STT_NOTYPE 0
|
||||
#define STT_OBJECT 1
|
||||
#define STT_FUNC 2
|
||||
#define STT_SECTION 3
|
||||
#define STT_FILE 4
|
||||
#define STT_LOPROC 13
|
||||
#define STT_HIPROC 15
|
||||
|
||||
#define STB_LOCAL 0
|
||||
#define STB_GLOBAL 1
|
||||
#define STB_WEAK 2
|
||||
#define STB_LOPROC 13
|
||||
#define STB_HIPROC 15
|
||||
|
||||
#define STN_UNDEF 0
|
||||
|
||||
struct Elf32_Rel {
|
||||
Elf32_Addr r_offset;
|
||||
Elf32_Word r_info;
|
||||
@ -276,58 +129,6 @@ struct Elf32_Dyn {
|
||||
} d_un;
|
||||
};
|
||||
|
||||
#define DT_NULL 0
|
||||
#define DT_NEEDED 1
|
||||
#define DT_PLTRELSZ 2
|
||||
#define DT_PLTGOT 3
|
||||
#define DT_HASH 4
|
||||
#define DT_STRTAB 5
|
||||
#define DT_SYMTAB 6
|
||||
#define DT_RELA 7
|
||||
#define DT_RELASZ 8
|
||||
#define DT_RELAENT 9
|
||||
#define DT_STRSZ 10
|
||||
#define DT_SYMENT 11
|
||||
#define DT_INIT 12
|
||||
#define DT_FINI 13
|
||||
#define DT_SONAME 14
|
||||
#define DT_RPATH 15
|
||||
#define DT_SYMBOLIC 16
|
||||
#define DT_REL 17
|
||||
#define DT_RELSZ 18
|
||||
#define DT_RELENT 19
|
||||
#define DT_PLTREL 20
|
||||
#define DT_DEBUG 21
|
||||
#define DT_TEXTREL 22
|
||||
#define DT_JMPREL 23
|
||||
#define DT_BIND_NOW 24 /* no lazy binding */
|
||||
#define DT_INIT_ARRAY 25 /* init function array */
|
||||
#define DT_FINI_ARRAY 26 /* termination function array */
|
||||
#define DT_INIT_ARRAYSZ 27 /* init function array size */
|
||||
#define DT_FINI_ARRAYSZ 28 /* termination function array size */
|
||||
#define DT_RUNPATH 29 /* library search path (supersedes DT_RPATH) */
|
||||
#define DT_FLAGS 30 /* flags (see below) */
|
||||
#define DT_ENCODING 32
|
||||
#define DT_PREINIT_ARRAY 32 /* preinitialization array */
|
||||
#define DT_PREINIT_ARRAYSZ 33 /* preinitialization array size */
|
||||
|
||||
#define DT_VERSYM 0x6ffffff0 /* symbol version table */
|
||||
#define DT_VERDEF 0x6ffffffc /* version definition table */
|
||||
#define DT_VERDEFNUM 0x6ffffffd /* number of version definitions */
|
||||
#define DT_VERNEED 0x6ffffffe /* table with needed versions */
|
||||
#define DT_VERNEEDNUM 0x6fffffff /* number of needed versions */
|
||||
|
||||
#define DT_LOPROC 0x70000000
|
||||
#define DT_HIPROC 0x7fffffff
|
||||
|
||||
|
||||
/* DT_FLAGS values */
|
||||
#define DF_ORIGIN 0x01
|
||||
#define DF_SYMBOLIC 0x02
|
||||
#define DF_TEXTREL 0x04
|
||||
#define DF_BIND_NOW 0x08
|
||||
#define DF_STATIC_TLS 0x10
|
||||
|
||||
|
||||
/* version definition section */
|
||||
|
||||
@ -342,30 +143,6 @@ struct Elf32_Verdef {
|
||||
Elf32_Word vd_next; /* byte offset to next verdef entry */
|
||||
};
|
||||
|
||||
/* values for vd_version (version revision) */
|
||||
#define VER_DEF_NONE 0 /* no version */
|
||||
#define VER_DEF_CURRENT 1 /* current version */
|
||||
#define VER_DEF_NUM 2 /* given version number */
|
||||
|
||||
/* values for vd_flags (version information flags) */
|
||||
#define VER_FLG_BASE 0x1 /* version definition of file itself */
|
||||
#define VER_FLG_WEAK 0x2 /* weak version identifier */
|
||||
|
||||
/* values for versym symbol index */
|
||||
#define VER_NDX_LOCAL 0 /* symbol is local */
|
||||
#define VER_NDX_GLOBAL 1 /* symbol is global/unversioned */
|
||||
#define VER_NDX_INITIAL 2 /* initial version -- that's the one given
|
||||
to symbols when a library becomes
|
||||
versioned; handled by the linker (and
|
||||
runtime loader) similar to
|
||||
VER_NDX_GLOBAL */
|
||||
#define VER_NDX_LORESERVE 0xff00 /* beginning of reserved entries */
|
||||
#define VER_NDX_ELIMINATE 0xff01 /* symbol is to be eliminated */
|
||||
|
||||
#define VER_NDX_FLAG_HIDDEN 0x8000 /* flag: version is hidden */
|
||||
#define VER_NDX_MASK 0x7fff /* mask to get the actual version index */
|
||||
#define VER_NDX(x) ((x) & VER_NDX_MASK)
|
||||
|
||||
|
||||
/* auxiliary version information */
|
||||
|
||||
@ -387,11 +164,6 @@ struct Elf32_Verneed {
|
||||
Elf32_Word vn_next; /* byte offset to next verneed entry */
|
||||
};
|
||||
|
||||
/* values for vn_version (version revision) */
|
||||
#define VER_NEED_NONE 0 /* no version */
|
||||
#define VER_NEED_CURRENT 1 /* current version */
|
||||
#define VER_NEED_NUM 2 /* given version number */
|
||||
|
||||
|
||||
/* auxiliary needed version information */
|
||||
|
||||
@ -404,9 +176,6 @@ struct Elf32_Vernaux {
|
||||
Elf32_Word vna_next; /* byte offset to next vernaux entry */
|
||||
};
|
||||
|
||||
/* values for vna_flags */
|
||||
#define VER_FLG_WEAK 0x2 /* weak version identifier */
|
||||
|
||||
|
||||
/*** inline functions ***/
|
||||
|
||||
@ -450,6 +219,11 @@ Elf32_Sym::Type() const
|
||||
return ELF32_ST_TYPE(st_info);
|
||||
}
|
||||
|
||||
inline void
|
||||
Elf32_Sym::SetInfo(uint8 bind, uint8 type)
|
||||
{
|
||||
st_info = ELF32_ST_INFO(bind, type);
|
||||
}
|
||||
|
||||
inline uint8
|
||||
Elf32_Rel::SymbolIndex() const
|
||||
|
247
headers/private/system/elf64.h
Normal file
247
headers/private/system/elf64.h
Normal file
@ -0,0 +1,247 @@
|
||||
/*
|
||||
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
* Distributed under the terms of the NewOS License.
|
||||
*
|
||||
* Copyright 2002-2011, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*/
|
||||
#ifndef _ELF64_H
|
||||
#define _ELF64_H
|
||||
|
||||
|
||||
#include <elf_common.h>
|
||||
|
||||
|
||||
typedef uint64 Elf64_Addr;
|
||||
typedef uint64 Elf64_Off;
|
||||
typedef uint16 Elf64_Half;
|
||||
typedef uint32 Elf64_Word;
|
||||
typedef int32 Elf64_Sword;
|
||||
typedef uint64 Elf64_Xword;
|
||||
typedef int64 Elf64_Sxword;
|
||||
|
||||
typedef Elf64_Half Elf64_Versym;
|
||||
|
||||
/*** ELF header ***/
|
||||
|
||||
struct Elf64_Ehdr {
|
||||
uint8 e_ident[EI_NIDENT];
|
||||
Elf64_Half e_type;
|
||||
Elf64_Half e_machine;
|
||||
Elf64_Word e_version;
|
||||
Elf64_Addr e_entry;
|
||||
Elf64_Off e_phoff;
|
||||
Elf64_Off e_shoff;
|
||||
Elf64_Word e_flags;
|
||||
Elf64_Half e_ehsize;
|
||||
Elf64_Half e_phentsize;
|
||||
Elf64_Half e_phnum;
|
||||
Elf64_Half e_shentsize;
|
||||
Elf64_Half e_shnum;
|
||||
Elf64_Half e_shstrndx;
|
||||
|
||||
#ifdef __cplusplus
|
||||
bool IsHostEndian() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/*** section header ***/
|
||||
|
||||
struct Elf64_Shdr {
|
||||
Elf64_Word sh_name;
|
||||
Elf64_Word sh_type;
|
||||
Elf64_Xword sh_flags;
|
||||
Elf64_Addr sh_addr;
|
||||
Elf64_Off sh_offset;
|
||||
Elf64_Xword sh_size;
|
||||
Elf64_Word sh_link;
|
||||
Elf64_Word sh_info;
|
||||
Elf64_Xword sh_addralign;
|
||||
Elf64_Xword sh_entsize;
|
||||
};
|
||||
|
||||
|
||||
/*** program header ***/
|
||||
|
||||
struct Elf64_Phdr {
|
||||
Elf64_Word p_type;
|
||||
Elf64_Word p_flags;
|
||||
Elf64_Off p_offset; /* offset from the beginning of the file of the segment */
|
||||
Elf64_Addr p_vaddr; /* virtual address for the segment in memory */
|
||||
Elf64_Addr p_paddr;
|
||||
Elf64_Xword p_filesz; /* the size of the segment in the file */
|
||||
Elf64_Xword p_memsz; /* the size of the segment in memory */
|
||||
Elf64_Xword p_align;
|
||||
|
||||
#ifdef __cplusplus
|
||||
bool IsReadWrite() const;
|
||||
bool IsExecutable() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Elf64_Sym {
|
||||
Elf64_Word st_name;
|
||||
uint8 st_info;
|
||||
uint8 st_other;
|
||||
Elf64_Half st_shndx;
|
||||
Elf64_Addr st_value;
|
||||
Elf64_Xword st_size;
|
||||
|
||||
#ifdef __cplusplus
|
||||
uint8 Bind() const;
|
||||
uint8 Type() const;
|
||||
void SetInfo(uint8 bind, uint8 type);
|
||||
#endif
|
||||
};
|
||||
|
||||
#define ELF64_ST_BIND(i) ((i) >> 4)
|
||||
#define ELF64_ST_TYPE(i) ((i) & 0xf)
|
||||
#define ELF64_ST_INFO(b, t) (((b) << 4) + ((t) & 0xf))
|
||||
|
||||
struct Elf64_Rel {
|
||||
Elf64_Addr r_offset;
|
||||
Elf64_Xword r_info;
|
||||
|
||||
#ifdef __cplusplus
|
||||
uint8 SymbolIndex() const;
|
||||
uint8 Type() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct Elf64_Rela : public Elf64_Rel {
|
||||
#else
|
||||
struct Elf64_Rela {
|
||||
Elf64_Addr r_offset;
|
||||
Elf64_Xword r_info;
|
||||
#endif
|
||||
Elf64_Sxword r_addend;
|
||||
};
|
||||
|
||||
#define ELF64_R_SYM(i) ((i) >> 32)
|
||||
#define ELF64_R_TYPE(i) ((i) & 0xffffffffL)
|
||||
#define ELF64_R_INFO(s, t) ((((Elf64_Xword)(s)) << 32) + ((t) & 0xffffffffL))
|
||||
|
||||
struct Elf64_Dyn {
|
||||
Elf64_Sxword d_tag;
|
||||
union {
|
||||
Elf64_Xword d_val;
|
||||
Elf64_Addr d_ptr;
|
||||
} d_un;
|
||||
};
|
||||
|
||||
|
||||
/* version definition section */
|
||||
|
||||
struct Elf64_Verdef {
|
||||
Elf64_Half vd_version; /* version revision */
|
||||
Elf64_Half vd_flags; /* version information flags */
|
||||
Elf64_Half vd_ndx; /* version index as specified in the
|
||||
symbol version table */
|
||||
Elf64_Half vd_cnt; /* number of associated verdaux entries */
|
||||
Elf64_Word vd_hash; /* version name hash value */
|
||||
Elf64_Word vd_aux; /* byte offset to verdaux array */
|
||||
Elf64_Word vd_next; /* byte offset to next verdef entry */
|
||||
};
|
||||
|
||||
|
||||
/* auxiliary version information */
|
||||
|
||||
struct Elf64_Verdaux {
|
||||
Elf64_Word vda_name; /* string table offset to version or dependency
|
||||
name */
|
||||
Elf64_Word vda_next; /* byte offset to next verdaux entry */
|
||||
};
|
||||
|
||||
|
||||
/* version dependency section */
|
||||
|
||||
struct Elf64_Verneed {
|
||||
Elf64_Half vn_version; /* version of structure */
|
||||
Elf64_Half vn_cnt; /* number of associated vernaux entries */
|
||||
Elf64_Word vn_file; /* byte offset to file name for this
|
||||
dependency */
|
||||
Elf64_Word vn_aux; /* byte offset to vernaux array */
|
||||
Elf64_Word vn_next; /* byte offset to next verneed entry */
|
||||
};
|
||||
|
||||
|
||||
/* auxiliary needed version information */
|
||||
|
||||
struct Elf64_Vernaux {
|
||||
Elf64_Word vna_hash; /* dependency name hash value */
|
||||
Elf64_Half vna_flags; /* dependency specific information flags */
|
||||
Elf64_Half vna_other; /* version index as specified in the symbol
|
||||
version table */
|
||||
Elf64_Word vna_name; /* string table offset to dependency name */
|
||||
Elf64_Word vna_next; /* byte offset to next vernaux entry */
|
||||
};
|
||||
|
||||
|
||||
/*** inline functions ***/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
inline bool
|
||||
Elf64_Ehdr::IsHostEndian() const
|
||||
{
|
||||
#if B_HOST_IS_LENDIAN
|
||||
return e_ident[EI_DATA] == ELFDATA2LSB;
|
||||
#elif B_HOST_IS_BENDIAN
|
||||
return e_ident[EI_DATA] == ELFDATA2MSB;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
inline bool
|
||||
Elf64_Phdr::IsReadWrite() const
|
||||
{
|
||||
return !(~p_flags & (PF_READ | PF_WRITE));
|
||||
}
|
||||
|
||||
|
||||
inline bool
|
||||
Elf64_Phdr::IsExecutable() const
|
||||
{
|
||||
return (p_flags & PF_EXECUTE) != 0;
|
||||
}
|
||||
|
||||
|
||||
inline uint8
|
||||
Elf64_Sym::Bind() const
|
||||
{
|
||||
return ELF64_ST_BIND(st_info);
|
||||
}
|
||||
|
||||
|
||||
inline uint8
|
||||
Elf64_Sym::Type() const
|
||||
{
|
||||
return ELF64_ST_TYPE(st_info);
|
||||
}
|
||||
|
||||
|
||||
inline void
|
||||
Elf64_Sym::SetInfo(uint8 bind, uint8 type)
|
||||
{
|
||||
st_info = ELF64_ST_INFO(bind, type);
|
||||
}
|
||||
|
||||
|
||||
inline uint8
|
||||
Elf64_Rel::SymbolIndex() const
|
||||
{
|
||||
return ELF64_R_SYM(r_info);
|
||||
}
|
||||
|
||||
|
||||
inline uint8
|
||||
Elf64_Rel::Type() const
|
||||
{
|
||||
return ELF64_R_TYPE(r_info);
|
||||
}
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _ELF64_H_ */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user