From: Jesper Skov <jskov@zoftcorp.dk>
To: ecos-patches@sourceware.org
Subject: OS X Synthetic port (partial, incomplete and unlikely to ever work)
Date: Tue, 03 Feb 2009 19:13:00 -0000 [thread overview]
Message-ID: <9ad8ee4e0902031113q1fd9070cme458e16ff5db1f2f@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]
Greetings,
I finally got the FSF copyright assignment form and have returned it
to them again. So I figured it was about time to post the aborted OS X
Synthetic port. Just in case someone can make use of it (or parts).
I aborted the port simply because I could not get constructors to run.
OS X comes with its own tools and a special file format, and it
appears that GCC has just adopted this (for obvious reasons).
So the linker and loader is unlike what I know from Linux. In short,
the breakage is due to the linker apparently not loading constructor
sections. Probably because these are intended to be executed as part
of the loading. Unfortunately, I never figured out how to trigger
this. And I got fed up with the challenge. So, abort.
The current state of the patches are pre-V3. Can't be bothered to
upgrade my tree and make the header changes.
All tests build and link in the default configuration. But only tests
that do not make use of constructor sections work (such as the two HAL
tests).
Cheers,
Jesper
[-- Attachment #2: new-arch.diff --]
[-- Type: application/octet-stream, Size: 104836 bytes --]
Index: i386osx/current/cdl/hal_synth_i386_osx.cdl
===================================================================
--- i386osx/current/cdl/hal_synth_i386_osx.cdl (.../packages/hal/synth) (revision 0)
+++ i386osx/current/cdl/hal_synth_i386_osx.cdl (.../branches/synth-osx/packages/hal/synth) (revision 44)
@@ -0,0 +1,163 @@
+# ====================================================================
+#
+# hal_synth_i386.cdl
+#
+# i386-specific synthetic target configuration data
+#
+# ====================================================================
+#####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 2005 eCosCentric Ltd
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+##
+## eCos is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free
+## Software Foundation; either version 2 or (at your option) any later version.
+##
+## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+## WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with eCos; if not, write to the Free Software Foundation, Inc.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+##
+## As a special exception, if other files instantiate templates or use macros
+## or inline functions from this file, or you compile this file and link it
+## with other works to produce a work based on this file, this file does not
+## by itself cause the resulting work to be covered by the GNU General Public
+## License. However the source code for this file must still be made available
+## in accordance with section (3) of the GNU General Public License.
+##
+## This exception does not invalidate any other reasons why a work based on
+## this file might be covered by the GNU General Public License.
+##
+## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+## at http://sources.redhat.com/ecos/ecos-license/
+## -------------------------------------------
+#####ECOSGPLCOPYRIGHTEND####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s): jskov
+# Original data: jskov
+# Contributors: bartv
+# Date: 2008-11-05
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_HAL_SYNTH_I386_OSX {
+ parent CYGPKG_HAL_SYNTH
+ display "OS X/i386 synthetic target"
+ description "
+ The OS X/i386 Synthetic Target HAL package provides the
+ support needed to run eCos binaries on Apple OS X Intel machines."
+
+ include_dir cyg/hal
+ define_header hal_synth_i386_osx.h
+ define_proc {
+ puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_synth_i386_osx.h>"
+ }
+ # On the synthetic target the default main stack size is smaller than
+ # the recommended minimum from var_arch.h
+ requires { !CYGPKG_LIBC_STARTUP || CYGINT_LIBC_STARTUP_MAIN_NO_STACK_SIZE || (CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE >= (16 * 1024)) }
+
+ implements CYGINT_PROFILE_HAL_TIMER
+ implements CYGINT_PROFILE_HAL_MCOUNT
+
+ compile libsupc++/new_handler.cxx libsupc++/new_op.cxx
+
+ make {
+ <PREFIX>/lib/vectors.o : <PACKAGE>/src/vectors.S
+ $(CC) -Wp,-MD,vectors.tmp $(INCLUDE_PATH) $(CFLAGS) -c -o $@ $<
+ @echo $@ ": \\" > $(notdir $@).deps
+ @tail -n +2 vectors.tmp >> $(notdir $@).deps
+ @echo >> $(notdir $@).deps
+ @rm vectors.tmp
+ }
+ compile ctor_list.S ctor_end.S
+ compile devtab.S devtab_end.S
+ compile context.S syscall-i386-osx-1.0.S profile.c heap.S alias_functions.c
+
+ cdl_component CYG_HAL_STARTUP {
+ display "Startup type"
+ flavor data
+ legal_values {"ROM"}
+ default_value {"ROM"}
+ no_define
+ define -file system.h CYG_HAL_STARTUP
+ description "
+ At the moment only ROM startup is supported. In the context
+ of the synthetic target this means a read-only region for
+ code and a read-write region for data."
+ }
+
+ cdl_component CYGBLD_GLOBAL_OPTIONS {
+ display "Global build options"
+ flavor none
+ parent CYGPKG_NONE
+ description "
+ Global build options including control over
+ compiler flags, linker flags and choice of toolchain."
+
+
+ cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX {
+ display "Global command prefix"
+ flavor data
+ no_define
+ default_value { "${ECOS_REPOSITORY}/hal/synth/i386osx/current/bin/gnu-to-bsd" }
+ description "
+ This option specifies the command prefix used when
+ invoking the build tools."
+ }
+
+ cdl_option CYGBLD_GLOBAL_CFLAGS {
+ display "Global compiler flags"
+ flavor data
+ no_define
+ default_value { "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -D__ECOS" }
+ description "
+ This option controls the global compiler flags which
+ are used to compile all packages by
+ default. Individual packages may define
+ options which override these global flags."
+ }
+
+ cdl_option CYGBLD_GLOBAL_LDFLAGS {
+ display "Global linker flags"
+ flavor data
+ no_define
+ default_value { "-g -nostdlib -Wl,-static" }
+ description "
+ This option controls the global linker flags. Individual
+ packages may define options which override these global flags."
+ }
+ }
+
+ cdl_component CYGHWR_MEMORY_LAYOUT {
+ display "Memory layout"
+ flavor data
+ no_define
+ calculated { "mlt_synth_i386_osx_rom" }
+
+ cdl_option CYGHWR_MEMORY_LAYOUT_LDI {
+ display "Memory layout linker script fragment"
+ flavor data
+ no_define
+ define -file system.h CYGHWR_MEMORY_LAYOUT_LDI
+ calculated { "<pkgconf/mlt_synth_i386_osx_rom.ldi>" }
+ }
+
+ cdl_option CYGHWR_MEMORY_LAYOUT_H {
+ display "Memory layout header file"
+ flavor data
+ no_define
+ define -file system.h CYGHWR_MEMORY_LAYOUT_H
+ calculated { "<pkgconf/mlt_synth_i386_osx_rom.h>" }
+ }
+ }
+}
Index: i386osx/current/include/basetype.h
===================================================================
--- i386osx/current/include/basetype.h (.../packages/hal/synth) (revision 0)
+++ i386osx/current/include/basetype.h (.../branches/synth-osx/packages/hal/synth) (revision 22)
@@ -0,0 +1,82 @@
+#ifndef CYGONCE_HAL_BASETYPE_H
+#define CYGONCE_HAL_BASETYPE_H
+
+//=============================================================================
+//
+// basetype.h
+//
+// Standard types for x86 synthetic target.
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): proven
+// Contributors:proven
+// Date: 1998-10-02
+// Purpose: Define architecture base types.
+// Usage: Included by "cyg_type.h", do not use directly
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+// Characterize the architecture
+
+#define CYG_BYTEORDER CYG_LSBFIRST // Little endian
+
+//-----------------------------------------------------------------------------
+// I386 does not usually use labels with underscores.
+
+//#define CYG_LABEL_NAME(_name_) _name_
+
+//-----------------------------------------------------------------------------
+// Override the alignment definitions from cyg_type.h. x86 requires
+// 32 *byte* alignment because gcc sometimes tries to be clever with
+// aligning things on cache lines.
+
+#define CYGARC_ALIGNMENT 32
+#define CYGARC_P2ALIGNMENT 5
+
+//-----------------------------------------------------------------------------
+// Define the standard variable sizes
+
+// The ix86 architecture uses the default definitions of the base types,
+// so we do not need to define any here.
+
+//-----------------------------------------------------------------------------
+#endif // CYGONCE_HAL_BASETYPE_H
+// End of basetype.h
Index: i386osx/current/include/arch.inc
===================================================================
--- i386osx/current/include/arch.inc (.../packages/hal/synth) (revision 0)
+++ i386osx/current/include/arch.inc (.../branches/synth-osx/packages/hal/synth) (revision 25)
@@ -0,0 +1,77 @@
+##=============================================================================
+##
+## arch.inc
+##
+## i386 assembler header file for the synthetic target
+##
+##=============================================================================
+#####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+##
+## eCos is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free
+## Software Foundation; either version 2 or (at your option) any later version.
+##
+## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+## WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with eCos; if not, write to the Free Software Foundation, Inc.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+##
+## As a special exception, if other files instantiate templates or use macros
+## or inline functions from this file, or you compile this file and link it
+## with other works to produce a work based on this file, this file does not
+## by itself cause the resulting work to be covered by the GNU General Public
+## License. However the source code for this file must still be made available
+## in accordance with section (3) of the GNU General Public License.
+##
+## This exception does not invalidate any other reasons why a work based on
+## this file might be covered by the GNU General Public License.
+##
+## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+## at http://sources.redhat.com/ecos/ecos-license/
+## -------------------------------------------
+#####ECOSGPLCOPYRIGHTEND####
+##=============================================================================
+#######DESCRIPTIONBEGIN####
+##
+## Author(s): jskov
+## Contributors:jskov, nickg, bartv
+## Date: 1999-01-20
+## Purpose: i386 definitions.
+## Description: This file contains various definitions and macros that are
+## useful for writing assembly code for the i386
+## Usage:
+## #include <cyg/hal/arch.inc>
+## ...
+##
+##
+######DESCRIPTIONEND####
+##
+##=============================================================================
+
+#------------------------------------------------------------------------------
+# Exception, interrupt and thread context save area layout
+# The layout of this structure is also defined in "hal_arch.h", for C
+# code. Do not change this without changing that (or vice versa).
+
+ # See SYSV ABI4, i386 supplement (page 37-38)
+ # http://www.sco.com/products/layered/develop/devspecs/abi386-4.pdf
+
+ # Callee save registers (eax, ecx, and edx are scratch registers)
+ .set i386reg_esp, 0
+ .set i386reg_next_context, 4 # only used when dropping through...
+ .set i386reg_ebp, 8 # ...from switch_ to load_context.
+ .set i386reg_ebx, 12
+ .set i386reg_esi, 16
+ .set i386reg_edi, 20
+ .set i386reg_interrupts, 24
+ .set i386reg_context_size, 28
+
+#------------------------------------------------------------------------------
+# end of arch.inc
Index: i386osx/current/include/var_io.h
===================================================================
--- i386osx/current/include/var_io.h (.../packages/hal/synth) (revision 0)
+++ i386osx/current/include/var_io.h (.../branches/synth-osx/packages/hal/synth) (revision 22)
@@ -0,0 +1,101 @@
+#ifndef CYGONCE_HAL_VAR_IO_H
+#define CYGONCE_HAL_VAR_IO_H
+
+//=============================================================================
+//
+// var_io.h
+//
+// Processor-specific I/O support
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2003, 2005 eCosCentric Ltd
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): bartv
+// Date: 2003-10-08
+// Usage: #include <cyg/hal/hal_io.h>
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <cyg/infra/cyg_type.h>
+
+// In theory an application signal handler can just return straight to
+// the kernel. In reality this is usually the case as well, but with
+// some kernel versions on some processors it is necessary instead to
+// exit via a sigreturn system call.
+externC void cyg_hal_sys_restore(void);
+externC void cyg_hal_sys_restore_rt(void);
+
+#define CYG_HAL_SYS_SIGACTION_ADJUST(_sig_, _sigaction_) \
+ CYG_MACRO_START \
+ (_sigaction_)->hal_flags |= CYG_HAL_SYS_SA_RESTORER; \
+ (_sigaction_)->hal_restorer = &cyg_hal_sys_restore; \
+ CYG_MACRO_END
+
+// Additional information passed to a signal handler. This is useful
+// for e.g. profiling.
+struct cyg_hal_sys_sigcontext {
+ unsigned short hal_gs;
+ unsigned short hal_gsh;
+ unsigned short hal_fs;
+ unsigned short hal_fsh;
+ unsigned short hal_es;
+ unsigned short hal_esh;
+ unsigned short hal_ds;
+ unsigned short hal_dsh;
+ unsigned long hal_edi;
+ unsigned long hal_esi;
+ unsigned long hal_ebp;
+ unsigned long hal_esp;
+ unsigned long hal_ebx;
+ unsigned long hal_edx;
+ unsigned long hal_ecx;
+ unsigned long hal_eax;
+ unsigned long hal_trapno;
+ unsigned long hal_err;
+ unsigned long hal_eip;
+ unsigned short hal_cs;
+ unsigned short hal_csh;
+ unsigned long hal_eflags;
+ unsigned long hal_esp_at_signal;
+ unsigned short hal_ss;
+ unsigned short hal_ssh;
+ void* hal_fpstate;
+ unsigned long hal_oldmask;
+ unsigned long hal_cr2;
+};
+
+//--------------------------------------------------------------------------
+#endif // CYGONCE_HAL_VAR_IO_H
+// End of var_io.h
Index: i386osx/current/include/pkgconf/mlt_synth_i386_osx_rom.h
===================================================================
--- i386osx/current/include/pkgconf/mlt_synth_i386_osx_rom.h (.../packages/hal/synth) (revision 0)
+++ i386osx/current/include/pkgconf/mlt_synth_i386_osx_rom.h (.../branches/synth-osx/packages/hal/synth) (revision 22)
@@ -0,0 +1,20 @@
+// eCos memory layout - Fri Oct 20 08:40:39 2000
+
+// This is a generated file - do not edit
+
+#ifndef __ASSEMBLER__
+#include <cyg/infra/cyg_type.h>
+#include <stddef.h>
+
+#endif
+#define CYGMEM_REGION_rom (0x1000000)
+#define CYGMEM_REGION_rom_SIZE (0x800000)
+#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R)
+#define CYGMEM_REGION_ram (0x2000000)
+#define CYGMEM_REGION_ram_SIZE (0x800000)
+#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W)
+#ifndef __ASSEMBLER__
+extern char CYG_LABEL_NAME (__heap1) [];
+#endif
+#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1))
+#define CYGMEM_SECTION_heap1_SIZE (0x2800000 - (size_t) CYG_LABEL_NAME (__heap1))
Index: i386osx/current/include/pkgconf/mlt_synth_i386_osx_rom.ldi
===================================================================
--- i386osx/current/include/pkgconf/mlt_synth_i386_osx_rom.ldi (.../packages/hal/synth) (revision 0)
+++ i386osx/current/include/pkgconf/mlt_synth_i386_osx_rom.ldi (.../branches/synth-osx/packages/hal/synth) (revision 22)
@@ -0,0 +1,32 @@
+// eCos memory layout - Fri Oct 20 08:40:39 2000
+
+// This is a generated file - do not edit
+
+#include <cyg/infra/cyg_type.inc>
+
+MEMORY
+{
+ rom : ORIGIN = 0x01000000, LENGTH = 0x800000
+ ram : ORIGIN = 0x02000000, LENGTH = 0x800000
+}
+
+SECTIONS
+{
+ SECTIONS_BEGIN
+ SECTION_vectors (rom, 0x01000000, LMA_EQ_VMA)
+ SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_rodata1 (rom, ALIGN (0x8), LMA_EQ_VMA)
+ SECTION_rodata (rom, ALIGN (0x8), LMA_EQ_VMA)
+ SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_RELOCS (rom, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_eh_frame (rom, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_rel__got (rom, ALIGN (0x1), LMA_EQ_VMA)
+ SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA)
+ SECTION_data (ram, 0x02000000, LMA_EQ_VMA)
+ SECTION_sbss (ram, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA)
+ CYG_LABEL_DEFN(__heap1) = ALIGN (0x10);
+ SECTIONS_HEAP(ram, __heap1, 0x02800000)
+ SECTIONS_END
+}
Index: i386osx/current/include/var_intr.h
===================================================================
--- i386osx/current/include/var_intr.h (.../packages/hal/synth) (revision 0)
+++ i386osx/current/include/var_intr.h (.../branches/synth-osx/packages/hal/synth) (revision 22)
@@ -0,0 +1,76 @@
+#ifndef CYGONCE_HAL_VAR_INTR_H
+#define CYGONCE_HAL_VAR_INTR_H
+
+//=============================================================================
+//
+// var_intr.h
+//
+// Processor-specific interrupt support
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2005 eCosCentric Ltd.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): bartv
+// Date: 2005-06-26
+// Usage: #include <cyg/hal/hal_intr.h>
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+// The architectural HAL provides the bogomips rating. This is an
+// outer loop for the number of us and an inner loop for 1us. The
+// alignment of the inner loop can greatly affect performance. The
+// *16 of the bogomips rating seems to give about the right results
+// on a range of hardware.
+#define HAL_DELAY_US(_us_) \
+ CYG_MACRO_START \
+ asm volatile ( \
+ "1:\n" \
+ "movl %2,%1\n" \
+ "sal $0x4,%1\n" \
+ ".align 16\n" \
+ "2:\n" \
+ "decl %1\n" \
+ "jns 2b\n" \
+ "decl %0\n" \
+ "jns 1b\n" \
+ : \
+ : "r" (_us_), "r" (0), "g" (hal_bogomips+1) \
+ : "cc"); \
+ CYG_MACRO_END
+
+
+//--------------------------------------------------------------------------
+#endif // CYGONCE_HAL_VAR_INTR_H
+// End of var_intr.h
Index: i386osx/current/include/var_arch.h
===================================================================
--- i386osx/current/include/var_arch.h (.../packages/hal/synth) (revision 0)
+++ i386osx/current/include/var_arch.h (.../branches/synth-osx/packages/hal/synth) (revision 26)
@@ -0,0 +1,258 @@
+#ifndef CYGONCE_HAL_VAR_ARCH_H
+#define CYGONCE_HAL_VAR_ARCH_H
+
+//=============================================================================
+//
+// var_arch.h
+//
+// Per-processor information such as processor save states.
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): proven
+// Contributors:proven, pjo, nickg,bartv
+// Date: 1998-10-05
+// Purpose: Define architecture abstractions
+// Usage: #include <cyg/hal/hal_arch.h>
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+
+#include <cyg/infra/cyg_type.h>
+
+//-----------------------------------------------------------------------------
+// Processor saved states. This structure is also defined in arch.inc for
+// assembly code. Do not change this without changing that (or vice versa).
+// Note: there is no need to worry about floating point contexts, see context.S
+
+typedef struct
+{
+ cyg_uint32 esp;
+ cyg_uint32 next_context; // only used when dropping through...
+ cyg_uint32 ebp; // ...from switch_ to load_context
+ cyg_uint32 ebx;
+ cyg_uint32 esi;
+ cyg_uint32 edi;
+ cyg_bool interrupts; // Are interrupts enabled for this thread?
+} HAL_SavedRegisters;
+
+
+//-----------------------------------------------------------------------------
+// Bit manipulation routines. These are provided by the processor variant
+// HAL to allow for processor-specific implementations.
+
+#define HAL_LSBIT_INDEX(index, mask) \
+CYG_MACRO_START \
+ asm volatile( "bsfl %1,%0\n" \
+ : "=r" (index) \
+ : "r" (mask) \
+ ); \
+CYG_MACRO_END
+
+#define HAL_MSBIT_INDEX(index, mask) \
+CYG_MACRO_START \
+ asm volatile( "bsrl %1,%0\n" \
+ : "=r" (index) \
+ : "r" (mask) \
+ ); \
+CYG_MACRO_END
+
+//-----------------------------------------------------------------------------
+// Context Initialization
+// Initialize the context of a thread.
+// Arguments:
+// _sp_ name of variable containing current sp, will be written with new sp
+// _thread_ thread object address, passed as argument to entry point
+// _entry_ entry point address.
+// _id_ bit pattern used in initializing registers, for debugging.
+
+#define HAL_THREAD_INIT_CONTEXT( _sparg_, _thread_, _entry_, _id_ ) \
+ CYG_MACRO_START \
+ register CYG_WORD* _sp_ = ((CYG_WORD*)((_sparg_) &~15)); \
+ register HAL_SavedRegisters *_regs_; \
+ \
+ /* The 'ret' executed at the end of hal_thread_load_context will */ \
+ /* use the last entry on the stack as a return pointer (_entry_). */ \
+ /* Cyg_HardwareThread::thread_entry expects one argument at stack */ \
+ /* offset 4 (_thread_). The (0xDEADBEEF) entry is the return addr */ \
+ /* for thread_entry (which is never used). */ \
+ *(--_sp_) = (CYG_WORD)(0); \
+ *(--_sp_) = (CYG_WORD)(0); \
+ *(--_sp_) = (CYG_WORD)(0); \
+ *(--_sp_) = (CYG_WORD)(0); \
+ *(--_sp_) = (CYG_WORD)(_thread_); \
+ *(--_sp_) = (CYG_WORD)(0); \
+ *(--_sp_) = (CYG_WORD)(_entry_); \
+ \
+ _regs_ = (HAL_SavedRegisters *) \
+ ((unsigned long)_sp_ - sizeof(HAL_SavedRegisters)); \
+ _regs_->esp = (CYG_WORD) _sp_; \
+ _regs_->ebx = (CYG_WORD)(_id_); \
+ _regs_->ebp = (CYG_WORD)(_id_); \
+ _regs_->esi = (CYG_WORD)(_id_); \
+ _regs_->edi = (CYG_WORD)(_id_); \
+ _regs_->interrupts = true; \
+ (_sparg_) = (CYG_ADDRESS) _regs_; \
+ CYG_MACRO_END
+
+//-----------------------------------------------------------------------------
+// Context switch macros.
+// The arguments are pointers to locations where the stack pointer
+// of the current thread is to be stored, and from where the sp of the
+// next thread is to be fetched.
+
+externC void hal_thread_switch_context( CYG_ADDRESS _to_, CYG_ADDRESS _from_ );
+externC void hal_thread_load_context( CYG_ADDRESS _to_ )
+ __attribute__ ((noreturn));
+
+#define HAL_THREAD_SWITCH_CONTEXT(_fspptr_,_tspptr_) \
+ hal_thread_switch_context((CYG_ADDRESS)_tspptr_,(CYG_ADDRESS)_fspptr_);
+
+#define HAL_THREAD_LOAD_CONTEXT(_tspptr_) \
+ hal_thread_load_context( (CYG_ADDRESS)_tspptr_ );
+
+//-----------------------------------------------------------------------------
+// HAL setjmp
+
+#define CYGARC_JMP_BUF_SP 0
+#define CYGARC_JMP_BUF_EBP 1
+#define CYGARC_JMP_BUF_EBX 2
+#define CYGARC_JMP_BUF_ESI 3
+#define CYGARC_JMP_BUF_EDI 4
+#define CYGARC_JMP_BUF_PC 5
+
+#define CYGARC_JMP_BUF_SIZE 6
+
+typedef cyg_uint32 hal_jmp_buf[CYGARC_JMP_BUF_SIZE];
+
+externC int hal_setjmp(hal_jmp_buf env);
+externC void hal_longjmp(hal_jmp_buf env, int val);
+
+//-----------------------------------------------------------------------------
+// Minimal and sensible stack sizes: the intention is that applications
+// will use these to provide a stack size in the first instance prior to
+// proper analysis. Idle thread stack should be this big.
+
+// THESE ARE NOT INTENDED TO BE MICROMETRICALLY ACCURATE FIGURES.
+// THEY ARE HOWEVER ENOUGH TO START PROGRAMMING.
+// YOU MUST MAKE YOUR STACKS LARGER IF YOU HAVE LARGE "AUTO" VARIABLES!
+
+// This is not a config option because it should not be adjusted except
+// under "enough rope" sort of disclaimers.
+
+// Stack frame overhead per call. 3 local registers (edi, esi, ebx) and
+// return address.
+#define CYGNUM_HAL_STACK_FRAME_SIZE (4 * 4)
+
+// Stack needed for a context switch (i386reg_context_size from i386.inc)
+#define CYGNUM_HAL_STACK_CONTEXT_SIZE (4 * 24)
+
+// Interrupt stack size. Interrupts are handled by signals so the relevant
+// data is MINSIGSTKSIZE (see man sigaltstack) or 2048. Given the
+// multiplier *15 for STACK_SIZE_MINIMUM, this should be adequate.
+#define CYGNUM_HAL_STACK_INTERRUPT_SIZE 2048
+
+// We define a minimum stack size as the minimum any thread could ever
+// legitimately get away with. We can throw asserts if users ask for less
+// than this. Allow enough for three interrupt sources - clock, serial and
+// one other
+//
+// On the synthetic target memory is cheap so comparatively large stacks
+// are possible. This avoids stack overflow problems when working with
+// the synthetic target, although arguably the problem is now deferred to
+// when the application is moved to real hardware where it will be more
+// difficult to track down.
+#define CYGNUM_HAL_STACK_SIZE_MINIMUM (16 * 1024)
+#define CYGNUM_HAL_STACK_SIZE_TYPICAL (32 * 1024)
+
+//--------------------------------------------------------------------------
+// Macros for switching context between two eCos instances (jump from
+// code in ROM to code in RAM or vice versa).
+#define CYGARC_HAL_SAVE_GP()
+#define CYGARC_HAL_RESTORE_GP()
+
+//--------------------------------------------------------------------------
+#ifndef CYG_HAL_TABLE_BEGIN
+#define CYG_HAL_TABLE_BEGIN( _label, _name ) \
+__asm__(".section \".ecos." __xstring(_name) ".b\",\"aw\"\n" \
+ ".globl " __xstring(CYG_LABEL_DEFN(_label)) "\n" \
+ ".p2align " __xstring(CYGARC_P2ALIGNMENT) "\n" \
+__xstring(CYG_LABEL_DEFN(_label)) ":\n" \
+ )
+#endif
+// ".type " __xstring(CYG_LABEL_DEFN(_label)) ",object\n"
+// ".previous\n"
+
+#ifndef CYG_HAL_TABLE_END
+#define CYG_HAL_TABLE_END( _label, _name ) \
+__asm__(".section \".ecos." __xstring(_name) ".f\",\"aw\"\n" \
+ ".globl " __xstring(CYG_LABEL_DEFN(_label)) "\n" \
+ ".p2align " __xstring(CYGARC_P2ALIGNMENT) "\n" \
+__xstring(CYG_LABEL_DEFN(_label)) ":\n" \
+ )
+#endif
+
+// This macro must be applied to any types whose objects are to be placed in
+// tables
+#ifndef CYG_HAL_TABLE_TYPE
+#define CYG_HAL_TABLE_TYPE CYGBLD_ATTRIB_ALIGN( CYGARC_ALIGNMENT )
+#endif
+
+#ifndef CYG_HAL_TABLE_EXTRA
+#define CYG_HAL_TABLE_EXTRA( _name ) \
+ CYGBLD_ATTRIB_SECTION(".ecos.table, " __xstring(_name) ".extra")
+#endif
+
+#ifndef CYG_HAL_TABLE_ENTRY
+#define CYG_HAL_TABLE_ENTRY( _name ) \
+ CYGBLD_ATTRIB_SECTION(".ecos.table, " __xstring(_name) ".data") \
+ CYGBLD_ATTRIB_USED
+#endif
+
+#ifndef CYG_HAL_TABLE_QUALIFIED_ENTRY
+#define CYG_HAL_TABLE_QUALIFIED_ENTRY( _name, _qual ) \
+ CYGBLD_ATTRIB_SECTION(".ecos.table, " __xstring(_name) ".data." \
+ __xstring(_qual)) \
+ CYGBLD_ATTRIB_USED
+#endif
+
+
+//--------------------------------------------------------------------------
+#endif // CYGONCE_HAL_VAR_ARCH_H
+// End of var_arch.h
Index: i386osx/current/ChangeLog
===================================================================
--- i386osx/current/ChangeLog (.../packages/hal/synth) (revision 0)
+++ i386osx/current/ChangeLog (.../branches/synth-osx/packages/hal/synth) (revision 46)
@@ -0,0 +1,111 @@
+2008-11-24 Jesper Skov <jskov@zoftcorp.dk>
+
+ * src/alias_functions.c: Many more call-through functions. All
+ tests in default configuration now link.
+
+2008-11-23 Jesper Skov <jskov@zoftcorp.dk>
+
+ * src/alias_functions.c: Added call-through functions to replace
+ the missing __function__ alias support in Mach-O.
+
+2008-11-20 Jesper Skov <jskov@zoftcorp.dk>
+
+ * src/heap.S: Block of data reserved for heap.
+ * src/devtab.S:
+ * src/devtab_end.S: Adding wrapper symbols.
+
+ * src/libsupc++/new:
+ * src/libsupc++/new_handler.cxx:
+ * src/libsupc++/new_op.cxx:
+ * cdl/hal_synth_i386_osx.cdl: Fairly ignorant shot at replacing
+ libsupc++ dependency. Hacked and slashed into submission. Makes
+ tests link, but may not actually work...
+
+2008-11-16 Jesper Skov <jskov@zoftcorp.dk>
+
+ * bin/gnu-to-bsd-ar:
+ * bin/gnu-to-bsd-gcc: Hackish solution to gcc+ld being BSD variant
+ and not understanding GNU syntax: change passed arguments in
+ wrapper scripts to suite BSD commands.
+
+ * src/ctor_list.S: Added .constructors_used symbol. Still don't
+ quite understand its significance (loader dynamic calls this to
+ invoke constructors?)
+
+2008-11-13 Jesper Skov <jskov@zoftcorp.dk>
+
+ * cdl/hal_synth_i386_osx.cdl: Require --whole-archive option
+ removed from CYGBLD_GLOBAL_EXTRAS_LDFLAGS.
+ Fix CYGBLD_GLOBAL_COMMAND_PREFIX definition.
+
+ * src/syscall-i386-osx-1.0.S: Replace Linux system call numbers
+ with BSD ditto. Remapped a few Linux names to (semi)equivalent BSD
+ ones. Change SYSCALL macro to use C calling convention as is
+ standard on BSD.
+
+ * cdl/hal_synth_i386_osx.cdl:
+ * src/ctor_end.S:
+ * src/ctor_list.S: Added CTOR_LIST/CTOR_END symbols via assembly,
+ since the OS X ld cannot provide these. Need to combine these with
+ -order_file later.
+
+ * src/vectors.S (start): Removed _ prefix on start.
+
+ * src/context.S: Prefix labels with _.
+ * src/vectors.S:
+ * src/syscall-i386-osx-1.0.S:
+
+2008-11-08 Jesper Skov <jskov@zoftcorp.dk>
+
+ * include/var_arch.h: Added dumbed down table macros.
+
+ * src/vectors.S: Removed .externs, changed .global to .globl.
+
+ * cdl/hal_synth_i386_osx.cdl: Removed -Wl,--gc-sections.
+
+2008-11-07 Jesper Skov <jskov@zoftcorp.dk>
+
+ * include/arch.inc: Changed .equ to .set
+ * src/syscall-i386-osx-1.0.S: Changed .align statements to
+ power-of-two. Removed .type/.size statements. Changed .global to
+ .globl.
+ * src/context.S: Removed .externs.
+
+2008-11-05 Jesper Skov <jskov@zoftcorp.dk>
+
+ Initial i386 OS X port based on the linux port.
+
+//===========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//===========================================================================
Index: i386osx/current/src/profile.c
===================================================================
--- i386osx/current/src/profile.c (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/profile.c (.../branches/synth-osx/packages/hal/synth) (revision 22)
@@ -0,0 +1,182 @@
+//=============================================================================
+//
+// profile.c
+//
+// Support for profiling on x86 synthetic target
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2003, 2005 eCosCentric Ltd
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): bartv
+// Contributors: bartv
+// Date: 2003-10-12
+//
+//####DESCRIPTIONEND####
+//=============================================================================
+
+#include <pkgconf/system.h>
+#ifdef CYGPKG_PROFILE_GPROF
+#include <pkgconf/hal_synth.h>
+#include <pkgconf/hal_synth_i386.h>
+#include <cyg/infra/cyg_type.h>
+#include <cyg/infra/cyg_ass.h>
+#include <cyg/hal/hal_io.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/profile/profile.h>
+
+#if 1
+// Profiling support.
+//
+// The profile timer uses the ITIMER_PROF, which means we get a SIGPROF
+// signal at the desired rate. The signal handler can obtain the address
+// of the interrupted code via a sigcontext structure. The contents of
+// the sigcontext structure and exactly how it gets passed to the signal
+// handler depends on the architecture, hence this code is x86-specific.
+//
+// The results of this profiling code seem a lot poorer than on other
+// targets, but it is not clear why. There may be some subtle
+// interaction between the system and profiling clocks.
+static void
+synth_prof_sighandler(int sig, struct cyg_hal_sys_sigcontext context)
+{
+ __profile_hit((CYG_ADDRWORD) context.hal_eip);
+ CYG_UNUSED_PARAM(int, sig);
+}
+
+int
+hal_enable_profile_timer(int resolution)
+{
+ struct cyg_hal_sys_sigaction action;
+ struct cyg_hal_sys_sigset_t mask;
+ struct cyg_hal_sys_itimerval timer;
+
+ // We want profiling to be an atomic operation. __profile_hit() is
+ // a very simple function which should return quickly, and there
+ // is no need for a DSR or context switching. Hence everything
+ // including SIGIO and SIGALRM are blocked, effectively giving the
+ // profiling timer the highest priority.
+ action.hal_mask = 0xffffffff;
+ action.hal_flags = CYG_HAL_SYS_SA_RESTORER;
+ action.hal_handler = (void (*)(int)) &synth_prof_sighandler;
+ action.hal_restorer = &cyg_hal_sys_restore;
+
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGPROF, &action, (struct cyg_hal_sys_sigaction*) 0)) {
+ CYG_FAIL("Failed to install signal handler for SIGPROF");
+ }
+
+ // The resolution is limited by the underlying 100Hz system clock,
+ // there is no hardware timer which can generate faster clock
+ // interrupts.
+ if (resolution < 10000) {
+ resolution = 10000;
+ } else {
+ resolution = (resolution + 5000) / 10000;
+ resolution *= 10000;
+ }
+ timer.hal_it_interval.hal_tv_sec = 0;
+ timer.hal_it_interval.hal_tv_usec = resolution;
+ timer.hal_it_value.hal_tv_sec = 0;
+ timer.hal_it_value.hal_tv_usec = resolution;
+ if (0 != cyg_hal_sys_setitimer(CYG_HAL_SYS_ITIMER_PROF, &timer, (struct cyg_hal_sys_itimerval*) 0)) {
+ CYG_FAIL("Failed to initialize the profiling itimer");
+ }
+
+ // Now unblock SIGPROF
+ CYG_HAL_SYS_SIGEMPTYSET(&mask);
+ CYG_HAL_SYS_SIGADDSET(&mask, CYG_HAL_SYS_SIGPROF);
+ if (0 != cyg_hal_sys_sigprocmask(CYG_HAL_SYS_SIG_UNBLOCK, &mask, (cyg_hal_sys_sigset_t*)0)) {
+ CYG_FAIL("Failed to unblock SIGPROF");
+ }
+
+ return resolution;
+}
+
+#else
+
+// An alternative implementation that overloads the SIGALRM handler
+// rather than using SIGPROF. It does not seem to work any better.
+static void (*synth_profile_old_alrm_sighandler)(int);
+
+static void
+synth_profile_alrm_sighandler(int sig, struct cyg_hal_sys_sigcontext context)
+{
+ __profile_hit((CYG_ADDRWORD) context.hal_eip);
+ (*synth_profile_old_alrm_sighandler)(sig);
+}
+
+int
+hal_enable_profile_timer(int resolution)
+{
+ struct cyg_hal_sys_sigaction action;
+
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGALRM, (const struct cyg_hal_sys_sigaction*)0, &action)) {
+ CYG_FAIL("Failed to retrieve old signal handler for SIGALRM");
+ }
+ synth_profile_old_alrm_sighandler = action.hal_handler;
+ action.hal_handler = (void (*)(int)) &synth_profile_alrm_sighandler;
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGALRM, &action, (struct cyg_hal_sys_sigaction*)0)) {
+ CYG_FAIL("Failed to install new signal handler for SIGALRM");
+ }
+
+ return CYGNUM_HAL_RTC_PERIOD;
+}
+
+#endif
+
+// mcount() can be implemented largely using compiler built-ins. However
+// there are two complications. The generic profiling code assumes
+// __profile_mcount() is called with interrupts disabled. Blocking interrupts
+// won't stop the low-level signal handlers, so mcount() calls from those
+// may get lost because of the nesting test but that is fairly harmless.
+// Those signal handlers will complete before control returns here, i.e.
+// we have strict nesting, so there is no risk of the nested flag remaining
+// set while a context switch occurs. Also if eCos itself is built with
+// -pg then the compiler will insert a recursive call to mcount(), and
+// we have to guard against that.
+void
+mcount(void)
+{
+ static int nested = 0;
+ int enabled;
+
+ HAL_DISABLE_INTERRUPTS(enabled);
+ if (!nested) {
+ nested = 1;
+ __profile_mcount((CYG_ADDRWORD)__builtin_return_address(1),
+ (CYG_ADDRWORD)__builtin_return_address(0));
+ nested = 0;
+ }
+ HAL_RESTORE_INTERRUPTS(enabled);
+}
+
+#endif
Index: i386osx/current/src/alias_functions.c
===================================================================
--- i386osx/current/src/alias_functions.c (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/alias_functions.c (.../branches/synth-osx/packages/hal/synth) (revision 47)
@@ -0,0 +1,265 @@
+/*===========================================================================
+//
+// alias_functions.c
+//
+// Alias functions necessary with Mach-O that does not support symbol
+// aliases.
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2008 Jesper Skov
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): jskov
+// Contributors:jskov
+// Date: 20008-11-23
+// Purpose: This file implements aliases to functions
+// Description: This file implements call-through functions to functions
+// that use the __attribute__ alias mechanism to create ELF aliases.
+// These aliases are non-supported on Mach-O (and ignored with a
+// warning by GCC).
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================*/
+
+
+/* INCLUDES */
+#include <cyg/infra/cyg_type.h> /* Common type definitions */
+#include <stdio.h> // header for this file
+
+/* infra functions */
+
+externC void *
+_memcpy( void *s1, const void *s2, size_t n );
+
+externC void *
+_memset( void *s, int c, size_t n );
+
+void *
+memcpy( void *s1, const void *s2, size_t n ) {
+ return _memcpy(s1, s2, n);
+}
+
+void *
+memset( void *s, int c, size_t n ) {
+ return _memset(s, c, n);
+}
+
+
+/* lang/libc/strio functions */
+
+extern int
+fputc( int, FILE * );
+
+int
+putc( int c, FILE * file) {
+ return fputc(c, file);
+}
+
+
+
+/* lang/libc/string functions */
+
+extern size_t
+__strlen( const char *s );
+size_t
+strlen( const char *s ) {
+ return __strlen(s);
+}
+
+extern void *
+__memchr( const void *s, int c, size_t n );
+
+void *
+memchr( const void *s, int c, size_t n ) {
+ return __memchr(s, c, n);
+}
+
+extern int
+__memcmp( const void *s1, const void *s2, size_t n );
+
+int
+memcmp( const void *s1, const void *s2, size_t n ) {
+ return __memcmp(s1, s2, n);
+}
+
+extern char *
+__strchr( const char *s, int c );
+
+char *
+strchr( const char *s, int c ) {
+ return __strchr(s, c);
+}
+
+extern char *
+__strncat( char *s1, const char *s2, size_t n);
+
+char *
+strncat( char *s1, const char *s2, size_t n) {
+ return __strncat(s1, s2, n);
+}
+
+
+extern char *
+__strncpy( char *s1, const char *s2, size_t n);
+
+char *
+strncpy( char *s1, const char *s2, size_t n) {
+ return __strncpy(s1, s2, n);
+}
+
+
+extern char *
+__strpbrk( const char *s1, const char *s2 );
+
+char *
+strpbrk( const char *s1, const char *s2 ) {
+ return __strpbrk(s1, s2);
+}
+
+extern int
+__strcmp( const char *s1, const char *s2 );
+
+int
+strcmp( const char *s1, const char *s2 ) {
+ return __strcmp(s1, s2);
+}
+
+extern void *
+__memmove( void *s1, const void *s2, size_t n );
+
+void *
+memmove( void *s1, const void *s2, size_t n ) {
+ return __memmove(s1, s2, n);
+}
+
+extern char *
+__strcat( char *s1, const char *s2 );
+
+char *
+strcat( char *s1, const char *s2 ) {
+ return __strcat(s1, s2);
+}
+
+extern size_t
+__strcspn( const char *s1, const char *s2 );
+
+size_t
+strcspn( const char *s1, const char *s2 ) {
+ return __strcspn(s1, s2);
+}
+
+extern int
+__strncmp( const char *s1, const char *s2, size_t n );
+
+int
+strncmp( const char *s1, const char *s2, size_t n ) {
+ return __strncmp(s1, s2, n);
+}
+
+
+extern char *
+__strcpy( char *s1, const char *s2 );
+
+char *
+strcpy( char *s1, const char *s2 ) {
+ return __strcpy(s1, s2);
+}
+
+extern char *
+__strrchr( const char *s, int c );
+
+char *
+strrchr( const char *s, int c ) {
+ return __strrchr(s, c);
+}
+
+extern size_t
+__strxfrm( char *s1, const char *s2, size_t n );
+
+size_t
+strxfrm( char *s1, const char *s2, size_t n ) {
+ return __strxfrm(s1, s2, n);
+}
+
+extern size_t
+__strspn( const char *s1, const char *s2 );
+
+size_t
+strspn( const char *s1, const char *s2 ) {
+ return __strspn(s1, s2);
+}
+
+extern int
+__strcoll( const char *s1, const char *s2 );
+
+int
+strcoll( const char *s1, const char *s2 ) {
+ return __strcoll(s1, s2);
+}
+
+extern char *
+__strstr( const char *s1, const char *s2 );
+
+char *
+strstr( const char *s1, const char *s2 ) {
+ return __strstr(s1, s2);
+}
+
+extern int
+__strcasecmp( const char *s1, const char *s2 );
+int
+strcasecmp( const char *s1, const char *s2 ) {
+ return __strcasecmp(s1, s2);
+}
+
+extern int
+__strncasecmp( const char *s1, const char *s2, size_t n );
+int
+strncasecmp( const char *s1, const char *s2, size_t n ) {
+ return __strncasecmp(s1, s2, n);
+}
+
+
+
+
+/* error functions */
+
+extern char *
+__strerror( int errnum );
+
+char *
+strerror( int errnum ) {
+ return __strerror(errnum);
+}
+
+
Index: i386osx/current/src/ctor_list.S
===================================================================
--- i386osx/current/src/ctor_list.S (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/ctor_list.S (.../branches/synth-osx/packages/hal/synth) (revision 38)
@@ -0,0 +1,7 @@
+ .file "ctor_list.S"
+
+ .data
+ .globl .constructors_used
+.constructors_used:
+ .globl ___CTOR_LIST__
+___CTOR_LIST__:
Index: i386osx/current/src/context.S
===================================================================
--- i386osx/current/src/context.S (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/context.S (.../branches/synth-osx/packages/hal/synth) (revision 27)
@@ -0,0 +1,221 @@
+##=============================================================================
+##
+## context.S
+##
+## x86 thread context manipulation.
+##
+##=============================================================================
+#####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+##
+## eCos is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free
+## Software Foundation; either version 2 or (at your option) any later version.
+##
+## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+## WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with eCos; if not, write to the Free Software Foundation, Inc.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+##
+## As a special exception, if other files instantiate templates or use macros
+## or inline functions from this file, or you compile this file and link it
+## with other works to produce a work based on this file, this file does not
+## by itself cause the resulting work to be covered by the GNU General Public
+## License. However the source code for this file must still be made available
+## in accordance with section (3) of the GNU General Public License.
+##
+## This exception does not invalidate any other reasons why a work based on
+## this file might be covered by the GNU General Public License.
+##
+## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+## at http://sources.redhat.com/ecos/ecos-license/
+## -------------------------------------------
+#####ECOSGPLCOPYRIGHTEND####
+##=============================================================================
+#######DESCRIPTIONBEGIN####
+##
+## Author(s): jskov
+## Contributors:jskov, pjo, nickg, bartv
+## Date: 1999-03-11
+## Purpose: CPU-specific code
+## Description: This file contains the code needed to manage the
+## CPU on an i386/Linux synthetic target.
+##
+######DESCRIPTIONEND####
+##
+##=============================================================================
+
+#include <cyg/hal/arch.inc>
+
+#------------------------------------------------------------------------------
+# function declaration macro
+
+#define FUNC_START(name) \
+ .globl _##name; \
+_##name:
+
+#------------------------------------------------------------------------------
+# Context switch and setjmp/longjmp support.
+# Based on PowerPC context.S, using data from SYSV ABI4, i386
+# supplement (page 37-38)
+# http://www.sco.com/products/layered/develop/devspecs/abi386-4.pdf
+#
+# There is no need to worry about saving floating point context. If
+# a switch occurs because of an interrupt/signal, the system will have
+# saved the fpu state already before the signal handler was invoked,
+# and the state will be returned when the signal handler returns i.e.
+# when the interrupted thread is reactivated. If a context switch is
+# voluntary, for example a call to cyg_thread_yield(), then according
+# to the calling conventions all fpu registers are CALL_USED_REGISTERS
+# (gcc/config/i386/i386.h) and will have been saved by the calling
+# code.
+#
+# FIXME: it may be appropriate to match eCos thread contexts
+# more closely onto Linux sigcontexts - that might facilitate
+# thread-aware debugging.
+
+# hal_thread_switch_context
+# Switch thread contexts
+# : 0(%esp) : return address
+# : 4(%esp) : address of sp of next thread to execute
+# : 8(%esp) : address of sp save location of current thread
+#
+# %eax, %ecx, and %edx are ours to abuse.
+
+FUNC_START(hal_thread_switch_context)
+ movl 4(%esp),%eax # next context ptr
+ movl 8(%esp),%edx # this context ptr
+
+ # Make room on the stack for the context
+ movl %esp,%ecx # keep original SP
+ sub $i386reg_context_size,%esp
+
+ # Save next context ptr in this context. Necessary because
+ # hal_thread_load_context expects to find the ptr on the stack,
+ # not in a register as on PPC.
+ movl %eax,i386reg_next_context(%esp)
+
+ # Save registers
+ movl %ecx,i386reg_esp(%esp) # original esp
+ movl %ebp,i386reg_ebp(%esp)
+ movl %ebx,i386reg_ebx(%esp)
+ movl %esi,i386reg_esi(%esp)
+ movl %edi,i386reg_edi(%esp)
+
+ # And interrupt state
+ movl _hal_interrupts_enabled,%eax
+ movl %eax,i386reg_interrupts(%esp)
+
+ # Store the context ptr
+ movl %esp,(%edx)
+
+ # Now fall through to hal_thread_load_context
+
+
+#------------------------------------------------------------------------------
+# hal_thread_load_context
+# Load thread context
+# : 4(%esp) = i386reg_next_context(%esp) = address of sp of thread to execute
+# Note that this function is also the second half of hal_thread_switch_context
+# and is simply dropped into from it.
+#
+# %eax, %ecx, and %edx are ours to abuse.
+
+FUNC_START(hal_thread_load_context)
+
+ movl i386reg_next_context(%esp),%eax # get new context ptr
+ movl (%eax),%eax
+
+ # Restore registers
+ movl i386reg_ebp(%eax),%ebp
+ movl i386reg_ebx(%eax),%ebx
+ movl i386reg_esi(%eax),%esi
+ movl i386reg_edi(%eax),%edi
+ movl i386reg_esp(%eax),%esp
+
+ # And see what needs to happen about interrupts
+ movl i386reg_interrupts(%eax),%eax
+ cmpl _hal_interrupts_enabled,%eax
+ je interrupts_ok
+
+ # The saved interrupt state differs from the current one.
+ # If interrupts are supposed to be enabled then invoke
+ # hal_enable_interrupts. That can be done as a tail call.
+ # If interrupts are supposed to be disabled then just
+ # update the global variable.
+ cmpl $0,%eax
+ jne _hal_enable_interrupts
+ movl %eax,_hal_interrupts_enabled
+
+interrupts_ok:
+ ret
+
+
+#------------------------------------------------------------------------------
+# HAL longjmp, setjmp implementations
+# hal_setjmp saves only to callee save registers ebp, ebx, esi, edi and
+# and esp+pc into buffer supplied in 4(esp)
+# Note: These definitions are repeated in hal_arch.h. If changes are required
+# remember to update both sets.
+
+#define CYGARC_JMP_BUF_SP 0
+#define CYGARC_JMP_BUF_EBP 1
+#define CYGARC_JMP_BUF_EBX 2
+#define CYGARC_JMP_BUF_ESI 3
+#define CYGARC_JMP_BUF_EDI 4
+#define CYGARC_JMP_BUF_PC 5
+
+#define CYGARC_JMP_BUF_SIZE 6
+
+FUNC_START(hal_setjmp)
+ # Get jmpbuf pointer
+ movl 4(%esp),%eax
+
+ # Save regular registers
+ movl %ebp,CYGARC_JMP_BUF_EBP*4(%eax)
+ movl %ebx,CYGARC_JMP_BUF_EBX*4(%eax)
+ movl %esi,CYGARC_JMP_BUF_ESI*4(%eax)
+ movl %edi,CYGARC_JMP_BUF_EDI*4(%eax)
+
+ # Stack and PC
+ movl %esp,CYGARC_JMP_BUF_SP*4(%eax)
+ movl 0(%esp),%edx
+ movl %edx,CYGARC_JMP_BUF_PC*4(%eax)
+
+ # Return 0
+ xor %eax,%eax
+ ret
+
+
+# hal_longjmp loads state from 4(esp) and returns to PC stored in state
+
+FUNC_START(hal_longjmp)
+ # Get return value
+ movl 8(%esp),%eax
+
+ # Get jmpbuf pointer
+ movl 4(%esp),%ecx
+
+ # Restore regular registers
+ movl CYGARC_JMP_BUF_EBP*4(%ecx),%ebp
+ movl CYGARC_JMP_BUF_EBX*4(%ecx),%ebx
+ movl CYGARC_JMP_BUF_ESI*4(%ecx),%esi
+ movl CYGARC_JMP_BUF_EDI*4(%ecx),%edi
+
+ # Restore stack pointer
+ movl CYGARC_JMP_BUF_SP*4(%ecx),%esp
+
+ # Put return address on stack
+ movl CYGARC_JMP_BUF_PC*4(%ecx),%edx
+ movl %edx,0(%esp)
+
+ ret
+
+#------------------------------------------------------------------------------
+# end of linux.S
Index: i386osx/current/src/syscall-i386-osx-1.0.S
===================================================================
--- i386osx/current/src/syscall-i386-osx-1.0.S (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/syscall-i386-osx-1.0.S (.../branches/synth-osx/packages/hal/synth) (revision 30)
@@ -0,0 +1,471 @@
+//=============================================================================
+//
+// syscall-i386-linux-1.0.S
+//
+// Linux system call interface functions for i386.
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2005 eCosCentric Ltd.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): proven
+// Contributors:proven,bartv,jskov
+// Date: 1998-10-06
+// Description: Machine dependent syscalls for i386/i486/i586
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+
+// The numbers come from <sys/syscall.h>
+#define SYS_syscall 0
+#define SYS_exit 1
+#define SYS_fork 2
+#define SYS_read 3
+#define SYS_write 4
+#define SYS_open 5
+#define SYS_close 6
+#define SYS_wait4 7
+#define SYS_link 9
+#define SYS_unlink 10
+#define SYS_chdir 12
+#define SYS_fchdir 13
+#define SYS_mknod 14
+#define SYS_chmod 15
+#define SYS_chown 16
+#define SYS_obreak 17
+#define SYS_ogetfsstat 18
+#define SYS_getfsstat 18
+#define SYS_getpid 20
+#define SYS_setuid 23
+#define SYS_getuid 24
+#define SYS_geteuid 25
+#define SYS_ptrace 26
+#define SYS_recvmsg 27
+#define SYS_sendmsg 28
+#define SYS_recvfrom 29
+#define SYS_accept 30
+#define SYS_getpeername 31
+#define SYS_getsockname 32
+#define SYS_access 33
+#define SYS_chflags 34
+#define SYS_fchflags 35
+#define SYS_sync 36
+#define SYS_kill 37
+#define SYS_getppid 39
+#define SYS_dup 41
+#define SYS_pipe 42
+#define SYS_getegid 43
+#define SYS_profil 44
+#define SYS_sigaction 46
+#define SYS_getgid 47
+#define SYS_sigprocmask 48
+#define SYS_getlogin 49
+#define SYS_setlogin 50
+#define SYS_acct 51
+#define SYS_sigpending 52
+#define SYS_sigaltstack 53
+#define SYS_ioctl 54
+#define SYS_reboot 55
+#define SYS_revoke 56
+#define SYS_symlink 57
+#define SYS_readlink 58
+#define SYS_execve 59
+#define SYS_umask 60
+#define SYS_chroot 61
+#define SYS_msync 65
+#define SYS_vfork 66
+#define SYS_sbrk 69
+#define SYS_sstk 70
+#define SYS_ovadvise 72
+#define SYS_munmap 73
+#define SYS_mprotect 74
+#define SYS_madvise 75
+#define SYS_mincore 78
+#define SYS_getgroups 79
+#define SYS_setgroups 80
+#define SYS_getpgrp 81
+#define SYS_setpgid 82
+#define SYS_setitimer 83
+#define SYS_swapon 85
+#define SYS_getitimer 86
+#define SYS_getdtablesize 89
+#define SYS_dup2 90
+#define SYS_fcntl 92
+#define SYS_select 93
+#define SYS_fsync 95
+#define SYS_setpriority 96
+#define SYS_socket 97
+#define SYS_connect 98
+#define SYS_getpriority 100
+#define SYS_bind 104
+#define SYS_setsockopt 105
+#define SYS_listen 106
+#define SYS_sigsuspend 111
+#define SYS_gettimeofday 116
+#define SYS_getrusage 117
+#define SYS_getsockopt 118
+#define SYS_readv 120
+#define SYS_writev 121
+#define SYS_settimeofday 122
+#define SYS_fchown 123
+#define SYS_fchmod 124
+#define SYS_setreuid 126
+#define SYS_setregid 127
+#define SYS_rename 128
+#define SYS_flock 131
+#define SYS_mkfifo 132
+#define SYS_sendto 133
+#define SYS_shutdown 134
+#define SYS_socketpair 135
+#define SYS_mkdir 136
+#define SYS_rmdir 137
+#define SYS_utimes 138
+#define SYS_futimes 139
+#define SYS_adjtime 140
+#define SYS_gethostuuid 142
+#define SYS_setsid 147
+#define SYS_getpgid 151
+#define SYS_setprivexec 152
+#define SYS_pread 153
+#define SYS_pwrite 154
+#define SYS_nfssvc 155
+#define SYS_statfs 157
+#define SYS_fstatfs 158
+#define SYS_unmount 159
+#define SYS_getfh 161
+#define SYS_quotactl 165
+#define SYS_mount 167
+#define SYS_csops 169
+#define SYS_table 170
+#define SYS_waitid 173
+#define SYS_add_profil 176
+#define SYS_kdebug_trace 180
+#define SYS_setgid 181
+#define SYS_setegid 182
+#define SYS_seteuid 183
+#define SYS_sigreturn 184
+#define SYS_chud 185
+#define SYS_stat 188
+#define SYS_fstat 189
+#define SYS_lstat 190
+#define SYS_pathconf 191
+#define SYS_fpathconf 192
+#define SYS_getrlimit 194
+#define SYS_setrlimit 195
+#define SYS_getdirentries 196
+#define SYS_mmap 197
+#define SYS_lseek 199
+#define SYS_truncate 200
+#define SYS_ftruncate 201
+#define SYS___sysctl 202
+#define SYS_mlock 203
+#define SYS_munlock 204
+#define SYS_undelete 205
+#define SYS_ATsocket 206
+#define SYS_ATgetmsg 207
+#define SYS_ATputmsg 208
+#define SYS_ATPsndreq 209
+#define SYS_ATPsndrsp 210
+#define SYS_ATPgetreq 211
+#define SYS_ATPgetrsp 212
+#define SYS_kqueue_from_portset_np 214
+#define SYS_kqueue_portset_np 215
+#define SYS_mkcomplex 216
+#define SYS_statv 217
+#define SYS_lstatv 218
+#define SYS_fstatv 219
+#define SYS_getattrlist 220
+#define SYS_setattrlist 221
+#define SYS_getdirentriesattr 222
+#define SYS_exchangedata 223
+#define SYS_searchfs 225
+#define SYS_delete 226
+#define SYS_copyfile 227
+#define SYS_poll 230
+#define SYS_watchevent 231
+#define SYS_waitevent 232
+#define SYS_modwatch 233
+#define SYS_getxattr 234
+#define SYS_fgetxattr 235
+#define SYS_setxattr 236
+#define SYS_fsetxattr 237
+#define SYS_removexattr 238
+#define SYS_fremovexattr 239
+#define SYS_listxattr 240
+#define SYS_flistxattr 241
+#define SYS_fsctl 242
+#define SYS_initgroups 243
+#define SYS_posix_spawn 244
+#define SYS_nfsclnt 247
+#define SYS_fhopen 248
+#define SYS_minherit 250
+#define SYS_semsys 251
+#define SYS_msgsys 252
+#define SYS_shmsys 253
+#define SYS_semctl 254
+#define SYS_semget 255
+#define SYS_semop 256
+#define SYS_msgctl 258
+#define SYS_msgget 259
+#define SYS_msgsnd 260
+#define SYS_msgrcv 261
+#define SYS_shmat 262
+#define SYS_shmctl 263
+#define SYS_shmdt 264
+#define SYS_shmget 265
+#define SYS_shm_open 266
+#define SYS_shm_unlink 267
+#define SYS_sem_open 268
+#define SYS_sem_close 269
+#define SYS_sem_unlink 270
+#define SYS_sem_wait 271
+#define SYS_sem_trywait 272
+#define SYS_sem_post 273
+#define SYS_sem_getvalue 274
+#define SYS_sem_init 275
+#define SYS_sem_destroy 276
+#define SYS_open_extended 277
+#define SYS_umask_extended 278
+#define SYS_stat_extended 279
+#define SYS_lstat_extended 280
+#define SYS_fstat_extended 281
+#define SYS_chmod_extended 282
+#define SYS_fchmod_extended 283
+#define SYS_access_extended 284
+#define SYS_settid 285
+#define SYS_gettid 286
+#define SYS_setsgroups 287
+#define SYS_getsgroups 288
+#define SYS_setwgroups 289
+#define SYS_getwgroups 290
+#define SYS_mkfifo_extended 291
+#define SYS_mkdir_extended 292
+#define SYS_identitysvc 293
+#define SYS_shared_region_check_np 294
+#define SYS_shared_region_map_np 295
+#define SYS___pthread_mutex_destroy 301
+#define SYS___pthread_mutex_init 302
+#define SYS___pthread_mutex_lock 303
+#define SYS___pthread_mutex_trylock 304
+#define SYS___pthread_mutex_unlock 305
+#define SYS___pthread_cond_init 306
+#define SYS___pthread_cond_destroy 307
+#define SYS___pthread_cond_broadcast 308
+#define SYS___pthread_cond_signal 309
+#define SYS_getsid 310
+#define SYS_settid_with_pid 311
+#define SYS___pthread_cond_timedwait 312
+#define SYS_aio_fsync 313
+#define SYS_aio_return 314
+#define SYS_aio_suspend 315
+#define SYS_aio_cancel 316
+#define SYS_aio_error 317
+#define SYS_aio_read 318
+#define SYS_aio_write 319
+#define SYS_lio_listio 320
+#define SYS___pthread_cond_wait 321
+#define SYS_iopolicysys 322
+#define SYS_mlockall 324
+#define SYS_munlockall 325
+#define SYS_issetugid 327
+#define SYS___pthread_kill 328
+#define SYS___pthread_sigmask 329
+#define SYS___sigwait 330
+#define SYS___disable_threadsignal 331
+#define SYS___pthread_markcancel 332
+#define SYS___pthread_canceled 333
+#define SYS___semwait_signal 334
+#define SYS_proc_info 336
+#define SYS_sendfile 337
+#define SYS_stat64 338
+#define SYS_fstat64 339
+#define SYS_lstat64 340
+#define SYS_stat64_extended 341
+#define SYS_lstat64_extended 342
+#define SYS_fstat64_extended 343
+#define SYS_getdirentries64 344
+#define SYS_statfs64 345
+#define SYS_fstatfs64 346
+#define SYS_getfsstat64 347
+#define SYS___pthread_chdir 348
+#define SYS___pthread_fchdir 349
+#define SYS_audit 350
+#define SYS_auditon 351
+#define SYS_getauid 353
+#define SYS_setauid 354
+#define SYS_getaudit 355
+#define SYS_setaudit 356
+#define SYS_getaudit_addr 357
+#define SYS_setaudit_addr 358
+#define SYS_auditctl 359
+#define SYS_bsdthread_create 360
+#define SYS_bsdthread_terminate 361
+#define SYS_kqueue 362
+#define SYS_kevent 363
+#define SYS_lchown 364
+#define SYS_stack_snapshot 365
+#define SYS_bsdthread_register 366
+#define SYS_workq_open 367
+#define SYS_workq_ops 368
+#define SYS___mac_execve 380
+#define SYS___mac_syscall 381
+#define SYS___mac_get_file 382
+#define SYS___mac_set_file 383
+#define SYS___mac_get_link 384
+#define SYS___mac_set_link 385
+#define SYS___mac_get_proc 386
+#define SYS___mac_set_proc 387
+#define SYS___mac_get_fd 388
+#define SYS___mac_set_fd 389
+#define SYS___mac_get_pid 390
+#define SYS___mac_get_lcid 391
+#define SYS___mac_get_lctx 392
+#define SYS___mac_set_lctx 393
+#define SYS_setlcid 394
+#define SYS_getlcid 395
+#define SYS_read_nocancel 396
+#define SYS_write_nocancel 397
+#define SYS_open_nocancel 398
+#define SYS_close_nocancel 399
+#define SYS_wait4_nocancel 400
+#define SYS_recvmsg_nocancel 401
+#define SYS_sendmsg_nocancel 402
+#define SYS_recvfrom_nocancel 403
+#define SYS_accept_nocancel 404
+#define SYS_msync_nocancel 405
+#define SYS_fcntl_nocancel 406
+#define SYS_select_nocancel 407
+#define SYS_fsync_nocancel 408
+#define SYS_connect_nocancel 409
+#define SYS_sigsuspend_nocancel 410
+#define SYS_readv_nocancel 411
+#define SYS_writev_nocancel 412
+#define SYS_sendto_nocancel 413
+#define SYS_pread_nocancel 414
+#define SYS_pwrite_nocancel 415
+#define SYS_waitid_nocancel 416
+#define SYS_poll_nocancel 417
+#define SYS_msgsnd_nocancel 418
+#define SYS_msgrcv_nocancel 419
+#define SYS_sem_wait_nocancel 420
+#define SYS_aio_suspend_nocancel 421
+#define SYS___sigwait_nocancel 422
+#define SYS___semwait_signal_nocancel 423
+#define SYS___mac_mount 424
+#define SYS___mac_get_mount 425
+#define SYS___mac_getfsstat 426
+#define SYS_MAXSYSCALL 427
+
+// Linux->BSD system call mappings used for synthetic target
+// These may not be 100% equal in semantics, but it should not
+// matter (and avoids introducing further configuration).
+#define SYS__newselect SYS_select
+#define SYS_fdatasync SYS_fsync
+
+
+#define NAME(X) _cyg_hal_sys_##X
+#define END(X) 1:
+
+// BSD uses C calling convention, so just load up
+// the system number and fly away...
+
+#define SYSCALL(x) \
+ .globl NAME(x) ; \
+ \
+NAME(x): \
+ lea SYS_##x, %eax; \
+ int $0x80; \
+ ret; \
+ END(x)
+
+
+//==========================================================================
+// Initial asm stuff for all functions.
+ .text
+ .align 1
+
+SYSCALL(exit)
+SYSCALL(fork)
+SYSCALL(read)
+SYSCALL(write)
+SYSCALL(open)
+SYSCALL(close)
+SYSCALL(link)
+SYSCALL(unlink)
+SYSCALL(execve)
+SYSCALL(chdir)
+SYSCALL(chmod)
+SYSCALL(lseek)
+SYSCALL(getpid)
+SYSCALL(getuid)
+SYSCALL(kill)
+SYSCALL(dup)
+SYSCALL(pipe)
+SYSCALL(ioctl)
+SYSCALL(fcntl)
+SYSCALL(chroot)
+SYSCALL(dup2)
+SYSCALL(sigaction)
+SYSCALL(gettimeofday)
+SYSCALL(setitimer)
+SYSCALL(sigprocmask)
+SYSCALL(_newselect)
+SYSCALL(readv)
+SYSCALL(writev)
+SYSCALL(fdatasync)
+SYSCALL(access)
+SYSCALL(mkdir)
+
+// ----------------------------------------------------------------------------
+// Special support for returning from a signal handler. In theory no special
+// action is needed, but with some versions of the kernel on some
+// architectures that is not good enough. Instead returning has to happen
+// via another system call.
+
+// .align 4
+// .globl _cyg_hal_sys_restore_rt
+//_cyg_hal_sys_restore_rt:
+// movl $SYS_rt_sigreturn, %eax
+// int $0x80
+//
+ .align 3
+ .globl _cyg_hal_sys_restore
+_cyg_hal_sys_restore:
+ popl %eax
+ movl $SYS_sigreturn, %eax
+ int $0x80
Index: i386osx/current/src/vectors.S
===================================================================
--- i386osx/current/src/vectors.S (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/vectors.S (.../branches/synth-osx/packages/hal/synth) (revision 28)
@@ -0,0 +1,100 @@
+##=============================================================================
+##
+## vectors.S
+##
+## x86 exception vectors
+##
+##=============================================================================
+#####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+##
+## eCos is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free
+## Software Foundation; either version 2 or (at your option) any later version.
+##
+## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+## WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with eCos; if not, write to the Free Software Foundation, Inc.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+##
+## As a special exception, if other files instantiate templates or use macros
+## or inline functions from this file, or you compile this file and link it
+## with other works to produce a work based on this file, this file does not
+## by itself cause the resulting work to be covered by the GNU General Public
+## License. However the source code for this file must still be made available
+## in accordance with section (3) of the GNU General Public License.
+##
+## This exception does not invalidate any other reasons why a work based on
+## this file might be covered by the GNU General Public License.
+##
+## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+## at http://sources.redhat.com/ecos/ecos-license/
+## -------------------------------------------
+#####ECOSGPLCOPYRIGHTEND####
+##=============================================================================
+#######DESCRIPTIONBEGIN####
+##
+## Author(s): bartv
+## Contributors:bartv
+## Date: 2001-03-16
+## Purpose: Synthetic target startup
+## Description: When running on real hardware vectors.S contains
+## initialization code and usually the low-level interrupt and
+## exception support. On the synthetic target the latter is
+## handled by C code. The main initialization that is needed is
+## to jump into the C startup.
+##
+######DESCRIPTIONEND####
+##
+##=============================================================================
+
+# According the SVR4/i386 ABI, most registers are undefined. However
+# there is some interesting information on the stack:
+# %esp argc
+# %esp+4 argv[0]
+# ... argv[1 onwards]
+# %esp + (argc*4) NULL
+# ... environ[0]
+# ... ...
+# ... NULL
+#
+# There are some other things that could be done, for example aligning
+# the stack to a 16-byte boundary for SSE, but it is not clear which of
+# those things are actually useful. The glibc source file
+# sysdeps/i386/elf/start.S contains some relevant information.
+
+#==============================================================================
+
+ .file "vectors.S"
+
+ .data
+ .globl _cyg_hal_sys_argc
+_cyg_hal_sys_argc:
+ .long 0
+ .globl _cyg_hal_sys_argv
+_cyg_hal_sys_argv:
+ .long 0
+ .globl _cyg_hal_sys_environ
+_cyg_hal_sys_environ:
+ .long 0
+
+ .text
+ .globl start
+start:
+ popl %eax
+ movl %eax, _cyg_hal_sys_argc
+ movl %esp, %ebx
+ movl %ebx, _cyg_hal_sys_argv
+ inc %eax
+ addl %eax, %eax
+ addl %eax, %eax
+ addl %eax, %ebx
+ movl %ebx, _cyg_hal_sys_environ
+
+ jmp __linux_entry
Index: i386osx/current/src/devtab.S
===================================================================
--- i386osx/current/src/devtab.S (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/devtab.S (.../branches/synth-osx/packages/hal/synth) (revision 43)
@@ -0,0 +1,5 @@
+ .file "devtab.S"
+
+ .data
+ .globl ___DEVTAB__
+___DEVTAB__:
Index: i386osx/current/src/libsupc++/new_opvnt.cxx
===================================================================
--- i386osx/current/src/libsupc++/new_opvnt.cxx (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/libsupc++/new_opvnt.cxx (.../branches/synth-osx/packages/hal/synth) (revision 39)
@@ -0,0 +1,38 @@
+// Boilerplate support routines for -*- C++ -*- dynamic memory management.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2004 Free Software Foundation
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <bits/c++config.h>
+#include "new"
+
+_GLIBCXX_WEAK_DEFINITION void*
+operator new[] (std::size_t sz, const std::nothrow_t& nothrow) throw()
+{
+ return ::operator new(sz, nothrow);
+}
Index: i386osx/current/src/libsupc++/new_handler.cxx
===================================================================
--- i386osx/current/src/libsupc++/new_handler.cxx (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/libsupc++/new_handler.cxx (.../branches/synth-osx/packages/hal/synth) (revision 39)
@@ -0,0 +1,54 @@
+// Implementation file for the -*- C++ -*- dynamic memory management header.
+
+// Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+// 2005, 2006, 2007
+// Free Software Foundation
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include "new"
+
+const std::nothrow_t std::nothrow = { };
+
+using std::new_handler;
+new_handler __new_handler;
+
+new_handler
+std::set_new_handler (new_handler handler) throw()
+{
+ new_handler prev_handler = __new_handler;
+ __new_handler = handler;
+ return prev_handler;
+}
+
+std::bad_alloc::~bad_alloc() throw() { }
+
+const char*
+std::bad_alloc::what() const throw()
+{
+ return "std::bad_alloc";
+}
Index: i386osx/current/src/libsupc++/new_op.cxx
===================================================================
--- i386osx/current/src/libsupc++/new_op.cxx (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/libsupc++/new_op.cxx (.../branches/synth-osx/packages/hal/synth) (revision 39)
@@ -0,0 +1,81 @@
+// Support routines for the -*- C++ -*- dynamic memory management.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
+// Free Software Foundation
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <bits/c++config.h>
+//#include <cstdlib>
+#include <exception_defines.h>
+#include "new"
+
+#define _GLIBCXX_HOSTED 0
+#undef __EXCEPTIONS
+extern "C" void abort (void);
+
+
+using std::new_handler;
+using std::bad_alloc;
+#if _GLIBCXX_HOSTED
+using std::malloc;
+#else
+// A freestanding C runtime may not provide "malloc" -- but there is no
+// other reasonable way to implement "operator new".
+extern "C" void *malloc (std::size_t);
+#endif
+
+extern new_handler __new_handler;
+
+_GLIBCXX_WEAK_DEFINITION void *
+operator new (std::size_t sz) throw (std::bad_alloc)
+{
+ void *p;
+
+ /* malloc (0) is unpredictable; avoid it. */
+ if (sz == 0)
+ sz = 1;
+ p = (void *) malloc (sz);
+ while (p == 0)
+ {
+ new_handler handler = __new_handler;
+ if (! handler)
+#ifdef __ECOS
+ abort();
+#else // __ECOS
+#ifdef __EXCEPTIONS
+ throw bad_alloc();
+#else
+ std::abort();
+#endif
+#endif // __ECOS
+ handler ();
+ p = (void *) malloc (sz);
+ }
+
+ return p;
+}
Index: i386osx/current/src/libsupc++/new
===================================================================
--- i386osx/current/src/libsupc++/new (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/libsupc++/new (.../branches/synth-osx/packages/hal/synth) (revision 43)
@@ -0,0 +1,119 @@
+// The -*- C++ -*- dynamic memory management header.
+
+// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+// 2003, 2004, 2005, 2006, 2007
+// Free Software Foundation
+
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file new
+ * This is a Standard C++ Library header.
+ *
+ * The header @c new defines several functions to manage dynamic memory and
+ * handling memory allocation errors; see
+ * http://gcc.gnu.org/onlinedocs/libstdc++/18_support/howto.html#4 for more.
+ */
+
+#ifndef _NEW
+#define _NEW
+
+#include <cstddef>
+#include <exception>
+
+#pragma GCC visibility push(default)
+
+extern "C++" {
+
+namespace std
+{
+ /**
+ * @brief Exception possibly thrown by @c new.
+ *
+ * @c bad_alloc (or classes derived from it) is used to report allocation
+ * errors from the throwing forms of @c new. */
+ class bad_alloc
+#ifndef __ECOS
+ : public exception
+#endif // __ECOS
+ {
+ public:
+ bad_alloc() throw() { }
+
+ // This declaration is not useless:
+ // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
+ virtual ~bad_alloc() throw();
+
+ // See comment in eh_exception.cc.
+ virtual const char* what() const throw();
+ };
+
+ struct nothrow_t { };
+
+ extern const nothrow_t nothrow;
+
+ /** If you write your own error handler to be called by @c new, it must
+ * be of this type. */
+ typedef void (*new_handler)();
+
+ /// Takes a replacement handler as the argument, returns the
+ /// previous handler.
+ new_handler set_new_handler(new_handler) throw();
+} // namespace std
+
+//@{
+/** These are replaceable signatures:
+ * - normal single new and delete (no arguments, throw @c bad_alloc on error)
+ * - normal array new and delete (same)
+ * - @c nothrow single new and delete (take a @c nothrow argument, return
+ * @c NULL on error)
+ * - @c nothrow array new and delete (same)
+ *
+ * Placement new and delete signatures (take a memory address argument,
+ * does nothing) may not be replaced by a user's program.
+*/
+void* operator new(std::size_t) throw (std::bad_alloc);
+void* operator new[](std::size_t) throw (std::bad_alloc);
+void operator delete(void*) throw();
+void operator delete[](void*) throw();
+void* operator new(std::size_t, const std::nothrow_t&) throw();
+void* operator new[](std::size_t, const std::nothrow_t&) throw();
+void operator delete(void*, const std::nothrow_t&) throw();
+void operator delete[](void*, const std::nothrow_t&) throw();
+
+// Default placement versions of operator new.
+inline void* operator new(std::size_t, void* __p) throw() { return __p; }
+inline void* operator new[](std::size_t, void* __p) throw() { return __p; }
+
+// Default placement versions of operator delete.
+inline void operator delete (void*, void*) throw() { }
+inline void operator delete[](void*, void*) throw() { }
+//@}
+} // extern "C++"
+
+#pragma GCC visibility pop
+
+#endif
Index: i386osx/current/src/libsupc++/new_opnt.cxx
===================================================================
--- i386osx/current/src/libsupc++/new_opnt.cxx (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/libsupc++/new_opnt.cxx (.../branches/synth-osx/packages/hal/synth) (revision 39)
@@ -0,0 +1,67 @@
+// Support routines for the -*- C++ -*- dynamic memory management.
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2004 Free Software Foundation
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <bits/c++config.h>
+#include <exception_defines.h>
+#include "new"
+
+using std::new_handler;
+using std::bad_alloc;
+
+extern "C" void *malloc (std::size_t);
+extern new_handler __new_handler;
+
+_GLIBCXX_WEAK_DEFINITION void *
+operator new (std::size_t sz, const std::nothrow_t&) throw()
+{
+ void *p;
+
+ /* malloc (0) is unpredictable; avoid it. */
+ if (sz == 0)
+ sz = 1;
+ p = (void *) malloc (sz);
+ while (p == 0)
+ {
+ new_handler handler = __new_handler;
+ if (! handler)
+ return 0;
+ try
+ {
+ handler ();
+ }
+ catch (bad_alloc &)
+ {
+ return 0;
+ }
+
+ p = (void *) malloc (sz);
+ }
+
+ return p;
+}
Index: i386osx/current/src/libsupc++/new_opv.cxx
===================================================================
--- i386osx/current/src/libsupc++/new_opv.cxx (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/libsupc++/new_opv.cxx (.../branches/synth-osx/packages/hal/synth) (revision 39)
@@ -0,0 +1,38 @@
+// Boilerplate support routines for -*- C++ -*- dynamic memory management.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2004 Free Software Foundation
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+//
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <bits/c++config.h>
+#include "new"
+
+_GLIBCXX_WEAK_DEFINITION void*
+operator new[] (std::size_t sz) throw (std::bad_alloc)
+{
+ return ::operator new(sz);
+}
Index: i386osx/current/src/devtab_end.S
===================================================================
--- i386osx/current/src/devtab_end.S (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/devtab_end.S (.../branches/synth-osx/packages/hal/synth) (revision 43)
@@ -0,0 +1,5 @@
+ .file "devtab_end.S"
+
+ .data
+ .globl ___DEVTAB_END__
+___DEVTAB_END__:
Index: i386osx/current/src/ctor_end.S
===================================================================
--- i386osx/current/src/ctor_end.S (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/ctor_end.S (.../branches/synth-osx/packages/hal/synth) (revision 28)
@@ -0,0 +1,5 @@
+ .file "ctor_end.S"
+
+ .data
+ .globl ___CTOR_END__
+___CTOR_END__:
Index: i386osx/current/src/heap.S
===================================================================
--- i386osx/current/src/heap.S (.../packages/hal/synth) (revision 0)
+++ i386osx/current/src/heap.S (.../branches/synth-osx/packages/hal/synth) (revision 43)
@@ -0,0 +1,4 @@
+ .file "heap.S"
+
+ .zerofill __DATA, __bss, ___heap1, 128000, 3
+ .globl ___heap1
Index: i386osx/current/bin/gnu-to-bsd-ar
===================================================================
--- i386osx/current/bin/gnu-to-bsd-ar (.../packages/hal/synth) (revision 0)
+++ i386osx/current/bin/gnu-to-bsd-ar (.../branches/synth-osx/packages/hal/synth) (revision 35)
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+ar $*
Index: i386osx/current/bin/gnu-to-bsd-gcc
===================================================================
--- i386osx/current/bin/gnu-to-bsd-gcc (.../packages/hal/synth) (revision 0)
+++ i386osx/current/bin/gnu-to-bsd-gcc (.../branches/synth-osx/packages/hal/synth) (revision 44)
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+echo "------"
+echo "Started with : $*"
+
+new_args=
+#"-static -flat_namespace -undefined suppress"
+
+if $(echo $* | grep -q -- -static); then
+ #echo "Linking"
+ for arg in "$@"; do
+ #echo $arg
+ case $arg in
+ -Wl,-static | -Ttarget.ld | -g | -Wl,--fatal-warnings) continue ;;
+ esac
+ new_args="$new_args $arg"
+ done
+
+ gcc_archive_dir=`dirname \`gcc --print-libgcc-file-name\``
+
+ # FIXME: add sorting magic so ctors end up at the correct location
+
+ new_args="-static -Z $new_args -e start -lvectors.o -lextras -ltarget -L$gcc_archive_dir -lgcc -lgcc_eh"
+
+ #echo "Invoking ld: $new_args"
+ gcc $new_args
+else
+ #echo "Compiling"
+
+ prefix_args=-static
+
+ for arg in "$@"; do
+ #echo $arg
+ case $arg in
+ -Wl,--whole-archive) continue ;;
+ *libextras.a) prefix_args=-bundle ; echo "KILLING -static" ;;
+ esac
+ new_args="$new_args $arg"
+ done
+
+ new_args="$prefix_args $new_args"
+
+ #echo "Invoking GCC: $new_args"
+ gcc $new_args
+fi
[-- Attachment #3: synth-arch-hacks.diff --]
[-- Type: application/octet-stream, Size: 2385 bytes --]
Index: hal/synth/arch/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/synth/arch/current/ChangeLog,v
retrieving revision 1.39
diff -u -r1.39 ChangeLog
--- hal/synth/arch/current/ChangeLog 7 Oct 2008 09:47:40 -0000 1.39
+++ hal/synth/arch/current/ChangeLog 3 Feb 2009 18:37:41 -0000
@@ -1,3 +1,12 @@
+2008-11-10 Jesper Skov <jskov@zoftcorp.dk>
+
+ * src/synth_intr.c (synth_hardware_init): OS X hack: Disable
+ bogomips reading for now.
+
+2008-11-09 Jesper Skov <jskov@zoftcorp.dk>
+
+ * src/synth_entry.c: OS X hack: commented out __dso_handle.
+
2008-10-07 Bart Veer <bartv@ecoscentric.com>
* host/ecosynth.tcl: another attempt to fix the X problems when
Index: hal/synth/arch/current/src/synth_entry.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/synth/arch/current/src/synth_entry.c,v
retrieving revision 1.9
diff -u -r1.9 synth_entry.c
--- hal/synth/arch/current/src/synth_entry.c 12 Jun 2007 20:06:25 -0000 1.9
+++ hal/synth/arch/current/src/synth_entry.c 3 Feb 2009 18:37:41 -0000
@@ -185,7 +185,7 @@
__cxa_atexit(void (*arg1)(void*), void* arg2, void* arg3)
{
}
-void* __dso_handle = (void*) &__dso_handle;
+//void* __dso_handle = (void*) &__dso_handle;
// gcc 3.2.2 (approx). The libsupc++ version of the new operator pulls
// in exception handling code, even when using the nothrow version and
Index: hal/synth/arch/current/src/synth_intr.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/synth/arch/current/src/synth_intr.c,v
retrieving revision 1.9
diff -u -r1.9 synth_intr.c
--- hal/synth/arch/current/src/synth_intr.c 30 Jul 2005 11:10:35 -0000 1.9
+++ hal/synth/arch/current/src/synth_intr.c 3 Feb 2009 18:37:42 -0000
@@ -1328,6 +1328,7 @@
CYG_FAIL("Failed to install signal handler for SIGCHLD");
}
+#if 0 // FIXME: Make this an option.
// Determine the processor's bogomips rating. This adds some
// start-up overhead to all applications, even if HAL_DELAY_US()
// is not used. However doing it on demand in the first call
@@ -1363,6 +1364,7 @@
CYG_FAIL("Failed to find bogomips entry in /proc/cpuinfo");
}
}
+#endif
// Start up the auxiliary process.
synth_start_auxiliary();
[-- Attachment #4: top-level-package.diff --]
[-- Type: application/octet-stream, Size: 1975 bytes --]
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/ChangeLog,v
retrieving revision 1.192
diff -u -r1.192 ChangeLog
--- ChangeLog 4 Nov 2008 16:22:46 -0000 1.192
+++ ChangeLog 3 Feb 2009 18:27:16 -0000
@@ -1,3 +1,7 @@
+2008-11-05 Jesper Skov <jskov@zoftcorp.dk>
+
+ * ecos.db: Add Apple OS X Synthetic target.
+
2008-09-11 Uwe Kindler <uwe.kindler@cetoni.de>
* NEWS:
Index: ecos.db
===================================================================
RCS file: /cvs/ecos/ecos/packages/ecos.db,v
retrieving revision 1.179
diff -u -r1.179 ecos.db
--- ecos.db 4 Nov 2008 16:22:46 -0000 1.179
+++ ecos.db 3 Feb 2009 18:27:20 -0000
@@ -3511,6 +3511,16 @@
i386 processor-specific support for the Linux synthetic target"
}
+package CYGPKG_HAL_SYNTH_I386_OSX {
+ alias { "OS X/i386 synthetic target" i386_osx }
+ directory hal/synth/i386osx
+ script hal_synth_i386_osx.cdl
+ hardware
+ description "
+ i386 processor-specific support for the Apple Mac OS X synthetic
+ target"
+}
+
# --------------------------------------------------------------------------
# SPARClite packages
package CYGPKG_HAL_SPARCLITE {
@@ -5553,6 +5563,22 @@
Linux kernel."
}
+target osx {
+ alias { "Apple OS X synthetic target" i386osx }
+ packages { CYGPKG_HAL_SYNTH
+ CYGPKG_HAL_SYNTH_I386_OSX
+ CYGPKG_DEVS_FLASH_SYNTH
+ CYGPKG_DEVS_ETH_ECOSYNTH
+ CYGPKG_DEVS_WATCHDOG_SYNTH
+ CYGPKG_DEVS_WALLCLOCK_SYNTH
+ CYGPKG_DEVS_FRAMEBUF_SYNTH
+ }
+ description "
+ The osx target provides the
+ packages needed to run eCos binaries on an Apple
+ Machintosh OS X Intel computer."
+}
+
# --------------------------------------------------------------------------
# SPARClite targets
reply other threads:[~2009-02-03 19:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9ad8ee4e0902031113q1fd9070cme458e16ff5db1f2f@mail.gmail.com \
--to=jskov@zoftcorp.dk \
--cc=ecos-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).