Changeset 810
- Timestamp:
- Oct 6, 2003, 2:55:10 AM (22 years ago)
- Location:
- trunk
- Files:
-
- 42 added
- 45 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile
-
Property cvs2svn:cvs-rev
changed from
1.53
to1.54
r809 r810 681 681 ifeq "$(BUILD_PLATFORM)" "OS2" 682 682 unset GCCLOAD ; $(MAKE) $(MAKEOPT) -C $(PATH_OBJ)/gcc \ 683 LIBGCC2_DEBUG_CFLAGS="$(BUILD_DEBUGINFO) " \684 CFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) - O2" \685 CXXFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) - O2" \686 BOOT_CFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) - O2 -mcpu=pentium -mpreferred-stack-boundary=2 -malign-strings=0 -falign-loops=2 -falign-jumps=2 -falign-functions=2" \687 LDFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -Z exe -Zcrtdll -Zstack 1024" \688 BOOT_LDFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -Z exe -Zcrtdll -Zstack 1024" \683 LIBGCC2_DEBUG_CFLAGS="$(BUILD_DEBUGINFO) -Zhigh-mem " \ 684 CFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -Zhigh-mem -O2" \ 685 CXXFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -Zhigh-mem -O2" \ 686 BOOT_CFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -Zhigh-mem -O2 -mcpu=pentium -mpreferred-stack-boundary=2 -malign-strings=0 -falign-loops=2 -falign-jumps=2 -falign-functions=2" \ 687 LDFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -Zhigh-mem -Zexe -Zcrtdll -Zstack 1024" \ 688 BOOT_LDFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -Zhigh-mem -Zexe -Zcrtdll -Zstack 1024" \ 689 689 bootstrap 690 690 else … … 794 794 unset GCCLOAD; \ 795 795 export GCC_OMF="real"; \ 796 export LIBGCC2_DEBUG_CFLAGS="-g -Z aout"; \797 export CFLAGS="$(OMFSPEC_HACK) -Z omf -g "; \798 export CXXFLAGS="$(OMFSPEC_HACK) -Z omf -g "; \799 export BOOT_CFLAGS="$(OMFSPEC_HACK) -Z omf -g "; \800 export LDFLAGS="$(OMFSPEC_HACK) -Z omf -g -Zexe -Zcrtdll -Zstack 1024"; \801 export BOOT_LDFLAGS="$(OMFSPEC_HACK) -Z omf -g -Zexe -Zcrtdll -Zstack 1024"; \796 export LIBGCC2_DEBUG_CFLAGS="-g -Zhigh-mem -Zaout"; \ 797 export CFLAGS="$(OMFSPEC_HACK) -Zhigh-mem -Zomf -g "; \ 798 export CXXFLAGS="$(OMFSPEC_HACK) -Zhigh-mem -Zomf -g "; \ 799 export BOOT_CFLAGS="$(OMFSPEC_HACK) -Zhigh-mem -Zomf -g "; \ 800 export LDFLAGS="$(OMFSPEC_HACK) -Zhigh-mem -Zomf -g -Zexe -Zcrtdll -Zstack 1024"; \ 801 export BOOT_LDFLAGS="$(OMFSPEC_HACK) -Zhigh-mem -Zomf -g -Zexe -Zcrtdll -Zstack 1024"; \ 802 802 $(subst \,/,$(COMSPEC)) ; \ 803 803 mv -f $(PATH_BUILTTOOLS)/omfhackbin $(PATH_BUILTTOOLS)/omfhack … … 818 818 if test ! -d $(PATH_BUILTTOOLS)/omfhackbin; then echo "no omfhackbin"; exit 1; fi ; \ 819 819 unset GCCLOAD ; export GCC_OMF="real" ; echo GCC_OMF=$$GCC_OMF; $(MAKE) $(MAKEOPT) -C $(PATH_OBJ)/gccomf \ 820 LIBGCC2_DEBUG_CFLAGS="-g -Z aout" \821 CFLAGS="$(OMFSPEC_HACK) -Z omf -g " \822 CXXFLAGS="$(OMFSPEC_HACK) -Z omf -g " \823 BOOT_CFLAGS="$(OMFSPEC_HACK) -Z omf -g " \824 LDFLAGS="$(OMFSPEC_HACK) -Z omf -g -Zexe -Zcrtdll -Zstack 1024" \825 BOOT_LDFLAGS="$(OMFSPEC_HACK) -Z omf -g -Zexe -Zcrtdll -Zstack 1024" \820 LIBGCC2_DEBUG_CFLAGS="-g -Zhigh-mem -Zaout" \ 821 CFLAGS="$(OMFSPEC_HACK) -Zhigh-mem -Zomf -g " \ 822 CXXFLAGS="$(OMFSPEC_HACK) -Zhigh-mem -Zomf -g " \ 823 BOOT_CFLAGS="$(OMFSPEC_HACK) -Zhigh-mem -Zomf -g " \ 824 LDFLAGS="$(OMFSPEC_HACK) -Zhigh-mem -Zomf -g -Zexe -Zcrtdll -Zstack 1024" \ 825 BOOT_LDFLAGS="$(OMFSPEC_HACK) -Zhigh-mem -Zomf -g -Zexe -Zcrtdll -Zstack 1024" \ 826 826 -e all 827 827 mv -f $(PATH_BUILTTOOLS)/omfhackbin $(PATH_BUILTTOOLS)/omfhack -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/Makefile
-
Property cvs2svn:cvs-rev
changed from
1.37
to1.38
r809 r810 103 103 LD = gcc 104 104 # Linker flags 105 LDFLAGS = $(LDFLAGS.$(MODE)) $(LDFLAGS.KIND) -Zmap -Zstack 1024 $(LIBS)105 LDFLAGS = $(LDFLAGS.$(MODE)) $(LDFLAGS.KIND) -Zmap -Zstack 1024 -Zhigh-mem $(LIBS) 106 106 LDFLAGS.DLL = $(LDFLAGS) -Zdll 107 107 # Linker flags for different build modes -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/emx/umalloc.h
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r809 r810 7 7 extern "C" { 8 8 #endif 9 10 /* include all we need here to make life easier. */ 11 #include <stddef.h> 12 #include <umalloc.h> 13 #include <sys/builtin.h> 14 #include <sys/fmutex.h> 15 #include <sys/rmutex.h> 16 #include <sys/uflags.h> 9 17 10 18 /* =========================== Introduction =========================== */ … … 221 229 222 230 #define _UM_TILE_OK(p,s) (_UM_TILE_ALIGNED ((p), (s)) \ 223 && _UM_TILE_TILED ((p), (s))) 231 && _UM_TILE_TILED ((p), (s))) 224 232 225 233 /* Compute the smallest number X such that P will be aligned on a A … … 603 611 604 612 /* Note that _um_regular_heap is declared in <umalloc.h>. 605 _um_tiled_heap isn't, so we declare ithere. */613 the others aren't, so we declare them here. */ 606 614 607 615 extern Heap_t _um_tiled_heap; 616 extern Heap_t _um_high_heap; 617 extern Heap_t _um_low_heap; 608 618 609 619 … … 710 720 int _um_find_bucket (size_t); 711 721 void _um_free_maybe_lock (void *, int); 712 void_um_init_default_regular_heap (void);713 void_um_init_default_tiled_heap (void);722 Heap_t _um_init_default_regular_heap (void); 723 Heap_t _um_init_default_tiled_heap (void); 714 724 void *_um_lump_alloc (Heap_t, size_t, size_t, unsigned); 715 725 void _um_lump_coalesce_free (Heap_t, struct _um_lump *, struct _um_seg *, … … 725 735 int _um_walk_no_lock (Heap_t, _um_callback2 *, void *); 726 736 737 738 /** @group Low Memory Heap Routines. 739 * Intended for internal LIBC use. First call to any of these routines 740 * will initialize the heap. 741 * @{ */ 742 void * _lmalloc(size_t); 743 void * _lcalloc(size_t, size_t); 744 void * _lrealloc(void *, size_t); 745 Heap_t _linitheap(void); 746 /** @} */ 747 748 /** @group High Memory Heap Routines. 749 * Intended for internal LIBC use. First call to any of these routines 750 * will initialize the heap. 751 * @{ */ 752 void * _hmalloc(size_t); 753 void * _hcalloc(size_t, size_t); 754 void * _hrealloc(void *, size_t); 755 Heap_t _hinitheap(void); 756 void * __libc_HimemDefaultAlloc(Heap_t Heap, size_t *pcb, int *pfClean); 757 void __libc_HimemDefaultRelease(Heap_t Heap, void *pv, size_t cb); 758 int __libc_HasHighMem(void); 759 /** @} */ 760 761 762 /** @group Default Heap Voting. 763 * @{ */ 764 void __libc_HeapVote(int fDefaultHeapInHighMem); 765 void __libc_HeapEndVoting(void); 766 int __libc_HeapGetResult(void); 767 /** @} */ 768 769 770 727 771 /* Inline functions. */ 728 772 … … 763 807 { 764 808 /* Use the 'syscall' write for safest possible path. */ 765 extern int __write (int handle, const void *buf, size_t nbytes); 809 extern int __write (int handle, const void *buf, size_t nbytes); 766 810 __write (2, "\r\n!_um_abort!", 13); 767 811 if (pszmsg) 768 812 { 769 813 const char *psz = pszmsg; 770 while (*psz) 814 while (*psz) 771 815 psz++; 772 816 __write (2, " ", 1); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/stdlib.h
-
Property cvs2svn:cvs-rev
changed from
1.15
to1.16
r809 r810 180 180 */ 181 181 #if __POSIX_VISIBLE /* >= ??? */ 182 /* int posix_memalign(void **, size_t, size_t); (ADV)*/182 int posix_memalign(void **, size_t, size_t); /* bird: we implement this. */ 183 183 /** @todo int rand_r(unsigned *); */ /* (TSF) */ 184 184 int setenv(const char *, const char *, int); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/umalloc.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r809 r810 47 47 #define _HEAP_TILED 0x02 48 48 #define _HEAP_SHARED 0x04 49 #define _HEAP_HIGHMEM 0x08 /* advisory flag */ 49 50 50 51 #define _BLOCK_CLEAN 1 … … 95 96 void *_utmalloc (Heap_t, size_t); 96 97 97 98 98 #if defined (__cplusplus) 99 99 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/alias/alias.smak
-
Property cvs2svn:cvs-rev
changed from
1.11
to1.12
r809 r810 10 10 .TKIND := aout 11 11 .INSDIR := lib/ 12 .TARGET := c_alias.a12 .TARGET := libc_alias.a 13 13 include common.smak 14 14 … … 22 22 # For every aliased function create a .o file containing the alias 23 23 # and add it to the target library. 24 $.$(.TARG): $.stmp-libc-std 24 ##$.$(.TARG): $.stmp-libc-std 25 ## Depending on the timestamp kind of sucks, now we depend on the 26 ## header, which is better but will require libc to be build first. 27 $.$(.TARG): $.libc-std.h 25 28 $(call RM,$@) 26 @$(call DO.STDALIAS,_strcasecmp,__std_stricmp,$.strcasecmp.o) 27 @$(call DO.STDALIAS,_strncasecmp,__std_strnicmp,$.strncasecmp.o) 28 @$(call DO.STDALIAS,_itoa,__std_ltoa,$.itoa.o) 29 @$(call DO.STDALIAS,__itoa,__std_ltoa,$._itoa.o) 30 @$(call DO.STDALIAS,__Exit,__exit,$.__Exit.o) 31 @$(foreach x,$(ALIAS.FUNCS),\ 32 $(call DO.STDALIAS,_$x,__std_$x,$.$x.o)$(NL)) 33 @$(foreach x,$(ALIAS._FUNCS),\ 34 $(call DO.STDALIAS,__$x,__std_$x,$._$x.o)$(NL)) 35 $(AR) $(ARFLAGS) $@ $(addprefix $.,\ 36 strcasecmp.o strncasecmp.o itoa.o _itoa.o __Exit.o \ 37 $(addsuffix .o,$(ALIAS.FUNCS) $(addprefix _,$(ALIAS._FUNCS)))) 38 @$(call RM,$(addprefix $., \ 39 strcasecmp.o strncasecmp.o itoa.o _itoa.o __Exit.o \ 40 $(addsuffix .o,$(ALIAS.FUNCS) $(addprefix _,$(ALIAS._FUNCS))))) 29 $(call MKDIR,$.aliases) 30 $(call RM,$.aliases/*.o) 31 $(call RM,$.aliases/*.s) 32 @$(call DO.STDALIAS,_strcasecmp,__std_stricmp,$.aliases/strcasecmp.o) 33 @$(call DO.STDALIAS,_strncasecmp,__std_strnicmp,$.aliases/strncasecmp.o) 34 @$(call DO.STDALIAS,_itoa,__std_ltoa,$.aliases/itoa.o) 35 @$(call DO.STDALIAS,__itoa,__std_ltoa,$.aliases/_itoa.o) 36 @$(call DO.STDALIAS,__Exit,__exit,$.aliases/__Exit.o) 37 for i in $(ALIAS.FUNCS); do \ 38 echo "Aliasing _$$i to __std_$$i ..."; \ 39 echo ".stabs \"_$$i\",11,0,0,0;.stabs \"__std_$$i\",1,0,0,0;" > $.aliases/_$$i.s; \ 40 if as -o $.aliases/_$$i.o $.aliases/_$$i.s; then \ 41 else false; \ 42 fi \ 43 done 44 for i in $(ALIAS._FUNCS); do \ 45 echo "Aliasing __$$i to __std_$$i ..."; \ 46 echo ".stabs \"__$$i\",11,0,0,0;.stabs \"__std_$$i\",1,0,0,0;" > $.aliases/__$$i.s; \ 47 if as -o $.aliases/__$$i.o $.aliases/__$$i.s; then \ 48 else false; \ 49 fi \ 50 done 51 $(AR) $(ARFLAGS) $@ $.aliases/*.o 41 52 42 53 include mkomflib.smak -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/app/app.smak
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r809 r810 7 7 8 8 .TKIND := aout 9 .TARGET := c_app.a9 .TARGET := libc_app.a 10 10 .TSRC := $(wildcard src/lib/app/*.c) 11 11 .TCF := -I$. … … 20 20 21 21 .TKIND := aout prof 22 .TARGET := c_app_p.a22 .TARGET := libc_app_p.a 23 23 include mklib.smak -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/eadread.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r809 r810 11 11 #include <errno.h> 12 12 #include <sys/ead.h> 13 #include <emx/umalloc.h> 13 14 #include "ea.h" 14 15 … … 147 148 { 148 149 reftype = ENUMEA_REFTYPE_PATH; 149 fileref = path; 150 i = strlen(path) + 1; 151 fileref = alloca(i); 152 memcpy(fileref, path, i); 150 153 } 151 154 else … … 162 165 { 163 166 dena_buf_size += 0x20000; /* DosEnumAttribute is broken */ 164 dena_buf = realloc (dena_buf, dena_buf_size);167 dena_buf = _lrealloc (dena_buf, dena_buf_size); 165 168 if (dena_buf == NULL) 166 169 { -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/libc.def
-
Property cvs2svn:cvs-rev
changed from
1.21
to1.22
r809 r810 43 43 "__sys_pid" @23 44 44 "__sys_ppid" @24 45 "__ sys_private_heap" @2545 "__um_high_heap" @25 46 46 "__sys_thread_table" @26 47 47 "__sys_top_heap_obj" @27 … … 72 72 "___locale_lconv" @52 73 73 "___locale_time" @53 74 "__sys_virtual_address_limit" @54 75 "___pfnDosOpenL" @55 76 "___pfnDosSetFileLocksL" @56 77 "___pfnDosSetFilePtrL" @57 78 "___pfnDosSetFileSizeL" @58 74 "__um_low_heap" @54 75 "__rand48_add" @55 76 "__rand48_mult" @56 77 "__rand48_seed" @57 79 78 80 79 ; code … … 89 88 "__init1_fdinit" @108 90 89 "__init1_tmp" @109 91 "__ _init_environ" @11092 "__ _init_ret" @11190 "__std_posix_memalign" @110 91 "__lrealloc" @111 93 92 "__init_streams" @112 94 93 "___initthread" @113 … … 812 811 "__std_unsetenv" @831 813 812 "__std_lockf" @832 814 "__ _init_largefileio" @833813 "__lmalloc" @833 815 814 "__std_fseeko" @834 816 815 "__std_ftello" @835 … … 835 834 "__dorand48" @854 836 835 "__std_srand48" @855 837 "__rand48_add" @856 838 "__rand48_mult" @857 839 "__rand48_seed" @858 840 "__std_drand48" @859 841 "__std_erand48" @860 842 "__std_jrand48" @861 843 "__std_lcong48" @862 844 "__std_lrand48" @863 845 "__std_mrand48" @864 846 "__std_nrand48" @865 847 "__std_seed48" @866 848 "__std_qsort_r" @867 836 "__std_drand48" @856 837 "__std_erand48" @857 838 "__std_jrand48" @858 839 "__std_lcong48" @859 840 "__std_lrand48" @860 841 "__std_mrand48" @861 842 "__std_nrand48" @862 843 "__std_seed48" @863 844 "__std_qsort_r" @864 845 "__hcalloc" @865 846 "__hinitheap" @866 847 "__hmalloc" @867 848 "__hrealloc" @868 849 "__lcalloc" @869 850 "__linitheap" @870 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/libc.smak
-
Property cvs2svn:cvs-rev
changed from
1.26
to1.27
r809 r810 25 25 .MDESC := The C library 26 26 27 .TARGET := c_p.a27 .TARGET := libc_p.a 28 28 .TKIND := aout prof 29 29 .TSRC := $(libc.TSRC.$(CPU)) $(libc.TSRC) … … 34 34 include mklib.smak 35 35 36 # Build c.a last since LIBC.DLL needs .OBJS fromc.a37 .TARGET := c.a36 # Build libc.a last since LIBC.DLL needs .OBJS from libc.a 37 .TARGET := libc.a 38 38 .TKIND := aout 39 39 .TKEEP := 1 … … 49 49 LIBC.STUBARG := $(if $(LIBC.STUB),-Zlinker -STUB:$(LIBC.STUB)) 50 50 LIBC.DLL := $.omf/libc$(VH)$(VM).dll 51 LIBC.IMPLIB := $.omf/ c_dll.lib $.aout/c_dll.a51 LIBC.IMPLIB := $.omf/libc_dll.lib $.aout/libc_dll.a 52 52 LIBC.DEF := $.omf/libc.def 53 LIBC.OBJS := $.omf/src/lib/startup/ 386/dll0.obj $.omf/src/lib/startup/dllinit.obj54 LIBC.LIBS := $.omf/ c.lib $.omf/c_app.lib55 LIBC.DEPS := $(LIBC.STUB) $.omf/ c_alias.lib53 LIBC.OBJS := $.omf/src/lib/startup/dll0hi.obj $.omf/src/lib/startup/dllinit.obj 54 LIBC.LIBS := $.omf/libc.lib $.omf/libc_app.lib 55 LIBC.DEPS := $(LIBC.STUB) $.omf/libc_alias.lib 56 56 LIBC.DLL.OBJS := 57 57 LIBC.DIRS := $(sort $(dir $(LIBC.OBJS) $(LIBC.DEPS) $(LIBC.DLL.OBJS))) … … 59 59 LIBC.PRF.DLL := $(LIBC.DLL:.dll=.prf) 60 60 LIBC.PRF.DEF := $.omf/libc.prf.def 61 LIBC.PRF.OBJS := $.omf/src/lib/startup/ 386/dll0.obj $.omf-prof/src/lib/startup/dllinit.obj62 LIBC.PRF.LIBS := $.omf-prof/ c_p.lib $.omf-prof/c_app_p.lib61 LIBC.PRF.OBJS := $.omf/src/lib/startup/dll0hi.obj $.omf-prof/src/lib/startup/dllinit.obj 62 LIBC.PRF.LIBS := $.omf-prof/libc_p.lib $.omf-prof/libc_app_p.lib 63 63 LIBC.PRF.DEPS := $(LIBC.DEPS) 64 64 LIBC.PRF.DIRS := $(sort $(dir $(LIBC.PRF.OBJS) $(LIBC.PRF.DEPS))) … … 95 95 @$(call FECHO,$@,EXPORTS) 96 96 $(call DO.EMXEXP,$(filter %.lib,$^),$@) 97 sed -e "/\"___pfn/d" -e "/\"__sys_/d" -e "/\"___libc_/d" $@ > $@.tmp 98 mv -f $@.tmp $@ 97 99 krx.exe src/lib/dlllegacy.cmd -e "_DLL_InitTerm" $@ src/lib/libc.def 98 100 … … 114 116 echo $@ 115 117 116 # LIBC .def file (two steps).118 # LIBC.PREF .def file 117 119 $(LIBC.PRF.DEF): $(LIBC.DEF) 118 120 $(call RM,$@) … … 134 136 echo $@ 135 137 136 # LIBC .def file (two steps)138 # LIBC.ELH .def file 137 139 # Man! This sucks! Isn't there support for inline files (<<\nfile\n<<) in GNU MAKE? 138 # Even M$/IBM nmake have that. 140 # Even M$/IBM nmake have that. ;-) 139 141 # And no, I couldn't care less about performance with this type of DLL. 140 142 $(LIBC.ELH.DEF): $(LIBC.DEF) src/lib/libc.smak … … 213 215 .PHONY: libc-dll 214 216 all: libc-dll 215 libc-dll: emxbind emxexp app alias libc os2 \217 libc-dll: emxbind emxexp app alias libc os2 os2@omf \ 216 218 $(LIBC.DIRS) $(LIBC.DLL) $(LIBC.IMPLIB) \ 217 219 $(LIBC.PRF.DIRS) $(LIBC.PRF.DLL) \ … … 244 246 245 247 # How libc-std.h can be auto-generated. 246 # Unfortunately, we cannot use c.a to find out all _std_ names since247 # c.a itself depends on this header file. Thus we have to scan all source248 # Unfortunately, we cannot use libc.a to find out all _std_ names since 249 # libc.a itself depends on this header file. Thus we have to scan all source 248 250 # files for _STD() macros invocations. Fortunately, gawk rulez forever thus 249 251 # this happens in just a fraction of second. -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/heapchk.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r809 r810 15 15 _UM_MT_DECL 16 16 int rc1, rc2; 17 Heap_t heap_reg = _UM_DEFAULT_REGULAR_HEAP; 18 Heap_t heap_tiled = _UM_DEFAULT_TILED_HEAP; 17 19 18 20 /* Initialize the heap pointers, in case _heapchk() is called by a 19 21 new thread before malloc(). */ 20 22 21 if ( _UM_DEFAULT_REGULAR_HEAP== NULL)22 _um_init_default_regular_heap ();23 if ( _UM_DEFAULT_TILED_HEAP== NULL)24 _um_init_default_tiled_heap ();23 if (heap_reg == NULL) 24 heap_reg = _um_init_default_regular_heap (); 25 if (heap_tiled == NULL) 26 heap_tiled = _um_init_default_tiled_heap (); 25 27 26 28 /* First check the regular heap. */ 27 29 28 rc1 = _uheapchk ( _UM_DEFAULT_REGULAR_HEAP);30 rc1 = _uheapchk (heap_reg); 29 31 if (rc1 != _HEAPOK && rc1 != _HEAPEMPTY) 30 32 return rc1; … … 40 42 heaps is non-empty. */ 41 43 42 rc2 = _uheapchk ( _UM_DEFAULT_TILED_HEAP);44 rc2 = _uheapchk (heap_tiled); 43 45 if (rc2 == _HEAPEMPTY) 44 46 return rc1; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/heapmin.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r809 r810 14 14 { 15 15 _UM_MT_DECL 16 Heap_t heap_reg = _UM_DEFAULT_REGULAR_HEAP; 16 17 17 if ( _UM_DEFAULT_REGULAR_HEAP== NULL)18 _um_init_default_regular_heap ();19 return _uheapmin ( _UM_DEFAULT_REGULAR_HEAP);18 if (heap_reg == NULL) 19 heap_reg = _um_init_default_regular_heap (); 20 return _uheapmin (heap_reg); 20 21 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/heapwalk.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r809 r810 2 2 3 3 #include "libc-alias.h" 4 #include <stdlib.h>5 #include <stddef.h>6 4 #include <umalloc.h> 7 #include <sys/builtin.h> /* For <sys/fmutex.h> */8 #include <sys/fmutex.h> /* For <sys/rmutex.h> */9 #include <sys/rmutex.h>10 5 #include <emx/umalloc.h> 11 6 #include <emx/thread.h> … … 14 9 { 15 10 _UM_MT_DECL 16 int rc; 11 Heap_t heap_reg = _UM_DEFAULT_REGULAR_HEAP; 12 Heap_t heap_tiled = _UM_DEFAULT_TILED_HEAP; 13 int rc; 17 14 18 15 /* Initialize the heap pointers, in case _heap_walk() is called by a 19 16 new thread before malloc(). */ 20 17 21 if ( _UM_DEFAULT_REGULAR_HEAP== NULL)22 _um_init_default_regular_heap ();23 if ( _UM_DEFAULT_TILED_HEAP== NULL)24 _um_init_default_tiled_heap ();18 if (heap_reg == NULL) 19 heap_reg = _um_init_default_regular_heap (); 20 if (heap_tiled == NULL) 21 heap_tiled = _um_init_default_tiled_heap (); 25 22 26 23 /* First walk through the regular heap. */ 27 24 28 rc = _uheap_walk ( _UM_DEFAULT_REGULAR_HEAP, callback);25 rc = _uheap_walk (heap_reg, callback); 29 26 if (rc != 0) 30 27 return rc; … … 33 30 heap, return the regular heap's status. */ 34 31 35 if (_UM_DEFAULT_REGULAR_HEAP == _UM_DEFAULT_TILED_HEAP 36 || _UM_DEFAULT_TILED_HEAP == NULL) 32 if (heap_reg == heap_tiled || heap_tiled == NULL) 37 33 return rc; 38 34 39 35 /* Walk through the tiled heap. */ 40 36 41 return _uheap_walk ( _UM_DEFAULT_TILED_HEAP, callback);37 return _uheap_walk (heap_tiled, callback); 42 38 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/initr.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r809 r810 2 2 3 3 #include "libc-alias.h" 4 #include <stdlib.h>5 #include <stddef.h>6 4 #include <umalloc.h> 7 #include <sys/builtin.h> /* For <sys/fmutex.h> */ 8 #include <sys/fmutex.h> /* For <sys/rmutex.h> */ 9 #include <sys/rmutex.h> 5 #include <emx/umalloc.h> 10 6 #include <sys/smutex.h> 11 #include <sys/uflags.h>12 #include <emx/umalloc.h>13 7 #include <emx/thread.h> 14 8 15 /* This is the default regular heap. */ 16 9 /** This is the default regular heap. */ 17 10 Heap_t _um_regular_heap; 18 11 12 /** 13 * Sets the default regular heap for the current thread and perhaps 14 * even the system. 15 * 16 * Now because of the voting procedure we do not set the _um_regular_heap nor 17 * the per thread variable until the voting is completed. There for make sure 18 * to use the returned value not the one in the per thread or system variables! 19 * 20 * @returns Default heap for the thread. 21 */ 22 Heap_t _um_init_default_regular_heap(void) 23 { 24 _UM_MT_DECL 25 static _smutex lock; 26 Heap_t heap_reg = _UM_DEFAULT_REGULAR_HEAP; 19 27 20 void _um_init_default_regular_heap (void) 21 { 22 _UM_MT_DECL 23 void *memory; 24 Heap_t h; 25 static _smutex lock; 28 /* 29 * Is there actually anything left to be done? 30 */ 31 if (!heap_reg) 32 { 33 int vote = __libc_HeapGetResult(); 34 if (vote >= 0) 35 { 36 /* 37 * Is system wide default heap initiated? 38 */ 39 _smutex_request(&lock); 40 heap_reg = _um_regular_heap; 41 if (!heap_reg) 42 { 43 if (vote) 44 { 45 /* 46 * Use high memory heap. 47 */ 48 _um_regular_heap = heap_reg = _hinitheap(); 49 } 50 else 51 { 52 /* 53 * Use low memory heap. 54 */ 55 _um_regular_heap = heap_reg = _linitheap(); 56 } 57 } 58 _smutex_release(&lock); 26 59 27 _smutex_request (&lock); 28 29 /* Create the regular heap if it hasn't been created by another 30 thread between the check of _UM_DEFAULT_REGULAR_HEAP by our 31 caller and obtaining the semaphore. */ 32 33 if (_UM_DEFAULT_REGULAR_HEAP == NULL) 34 { 35 if (_um_regular_heap == NULL) 60 /* 61 * Set the per thread default. 62 */ 63 _UM_DEFAULT_REGULAR_HEAP = heap_reg; 64 } 65 else 36 66 { 37 _uflags (_UF_SBRK_MODEL, _UF_SBRK_ARBITRARY); 38 memory = sbrk (_INITIAL_DEFAULT_HEAP_SIZE); 39 if (memory == (void *)-1) 40 abort (); 41 h = _ucreate2 (memory, _INITIAL_DEFAULT_HEAP_SIZE, 42 !_BLOCK_CLEAN, _HEAP_REGULAR, 43 _um_default_alloc, _um_default_release, 44 _um_default_expand, _um_default_shrink); 45 if (h == NULL) 46 abort (); 47 if (_uopen (h) != 0) 48 abort (); 49 _um_regular_heap = h; 67 /* 68 * The voting is not yet over, so we must return the low heap. 69 * We do not set either the per thread or system defaults! 70 */ 71 heap_reg = _um_low_heap; 72 if (!heap_reg) 73 heap_reg = _linitheap(); 50 74 } 51 52 _UM_DEFAULT_REGULAR_HEAP = _um_regular_heap;53 75 } 54 76 55 _smutex_release (&lock);77 return heap_reg; 56 78 } 79 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/initt.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r809 r810 2 2 3 3 #include "libc-alias.h" 4 #include <stdlib.h> 5 #include <stddef.h> 6 #include <umalloc.h> 7 #include <sys/builtin.h> /* For <sys/fmutex.h> */ 8 #include <sys/fmutex.h> /* For <sys/rmutex.h> */ 9 #include <sys/rmutex.h> 4 #include <emx/umalloc.h> 10 5 #include <sys/smutex.h> 11 #include <sys/uflags.h>12 #include <emx/umalloc.h>13 6 #include <emx/thread.h> 14 7 15 /* This is the default tiled heap. */ 16 8 /** This is the default tiled heap. */ 17 9 Heap_t _um_tiled_heap = NULL; 18 10 11 /** 12 * Initialize the default tiled heap for the current thread. 13 * 14 * Sets _um_tiled_heap to _um_low_heap if zero. The per thread 15 * default tiled heap is set to _um_tiled_heap. 16 * 17 * @returns Heap handle on success. 18 */ 19 Heap_t _um_init_default_tiled_heap(void) 20 { 21 _UM_MT_DECL 22 Heap_t heap_tiled; 23 static _smutex lock; 19 24 20 void _um_init_default_tiled_heap (void) 21 { 22 _UM_MT_DECL 23 static _smutex lock; 24 25 _smutex_request (&lock); 26 27 /* Create the tiled heap if it hasn't been created by another thread 28 between the check of _UM_DEFAULT_TILED_HEAP by our caller and 29 obtaining the semaphore. */ 30 31 if (_UM_DEFAULT_TILED_HEAP == NULL) 25 /* 26 * Create the tiled heap if it hasn't been created by another thread 27 * between the check of _UM_DEFAULT_TILED_HEAP by our caller and 28 * obtaining the semaphore. 29 */ 30 heap_tiled = _UM_DEFAULT_TILED_HEAP; 31 if (heap_tiled == NULL) 32 32 { 33 if (_um_tiled_heap == NULL) 33 _smutex_request(&lock); 34 if (_um_tiled_heap == NULL) 34 35 { 35 /* Use the regularheap also as tiled heap. */36 _um_init_default_regular_heap();37 _um_tiled_heap = _um_regular_heap;36 /* Use the low heap also as tiled heap. */ 37 _linitheap(); 38 _um_tiled_heap = _um_low_heap; 38 39 } 39 40 40 41 _UM_DEFAULT_TILED_HEAP = _um_tiled_heap;41 _UM_DEFAULT_TILED_HEAP = heap_tiled = _um_tiled_heap; 42 _smutex_release(&lock); 42 43 } 43 44 44 _smutex_release (&lock);45 return heap_tiled; 45 46 } 47 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/malloc.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r809 r810 14 14 { 15 15 _UM_MT_DECL 16 Heap_t heap_reg = _UM_DEFAULT_REGULAR_HEAP; 16 17 17 if ( _UM_DEFAULT_REGULAR_HEAP== NULL)18 _um_init_default_regular_heap ();19 return _umalloc ( _UM_DEFAULT_REGULAR_HEAP, size);18 if (heap_reg == NULL) 19 heap_reg = _um_init_default_regular_heap (); 20 return _umalloc (heap_reg, size); 20 21 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/realloc.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r809 r810 15 15 return malloc (new_size); 16 16 else 17 return _um_realloc (block, new_size, 4, 0);17 return _um_realloc (block, new_size, new_size < 32 ? 4 : 16, 0); 18 18 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/ucalloc.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r809 r810 18 18 void *block; 19 19 unsigned flags; 20 unsigned align; 20 21 21 22 assert (h->magic == _UM_MAGIC_HEAP); … … 27 28 return NULL; 28 29 30 align = (size < 32 ? 4 : 16); 31 29 32 _um_heap_lock (h); 30 33 flags = _UMFI_ZERO; 31 34 if (h->type & _HEAP_TILED) 32 35 flags |= _UMFI_TILED; 33 block = _um_alloc_no_lock (h, bytes, 4, flags);36 block = _um_alloc_no_lock (h, bytes, align, flags); 34 37 _um_heap_unlock (h); 35 38 return block; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/ucreate2.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r809 r810 22 22 23 23 /* Check the TYPE argument. It must not contain any bits but 24 _HEAP_REGULAR, _HEAP_TILED, and _HEAP_SHARED. Exactly one of 25 _HEAP_REGULAR and _HEAP_TILED must be set. */ 24 _HEAP_REGULAR, _HEAP_TILED, _HEAP_SHARED, and _HEAP_HIGHMEM. 25 Exactly one of _HEAP_REGULAR and _HEAP_TILED must be set. 26 _HEAP_HIGHMEM and _HEAP_TILED are mutaly exclusive. */ 26 27 27 if (type & ~(_HEAP_REGULAR|_HEAP_TILED|_HEAP_SHARED ))28 if (type & ~(_HEAP_REGULAR|_HEAP_TILED|_HEAP_SHARED|_HEAP_HIGHMEM)) 28 29 return NULL; 29 30 t = type & (_HEAP_REGULAR|_HEAP_TILED); 30 31 if (t != _HEAP_REGULAR && t != _HEAP_TILED) 31 32 return NULL; 33 if ((type & (_HEAP_HIGHMEM|_HEAP_TILED)) == (_HEAP_HIGHMEM|_HEAP_TILED)) 34 return NULL; 35 32 36 33 37 /* Check the SIZE argument. */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/umalloc.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r809 r810 15 15 void *block; 16 16 unsigned flags; 17 unsigned align = (size < 32 ? 4 : 16); 17 18 18 19 assert (h->magic == _UM_MAGIC_HEAP); 19 20 if (h->magic != _UM_MAGIC_HEAP) 20 21 return NULL; 22 21 23 _um_heap_lock (h); 22 24 flags = 0; 23 25 if (h->type & _HEAP_TILED) 24 26 flags |= _UMFI_TILED; 25 block = _um_alloc_no_lock (h, size, 4, flags);27 block = _um_alloc_no_lock (h, size, align, flags); 26 28 _um_heap_unlock (h); 27 29 return block; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/utcalloc.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r809 r810 19 19 if (h->magic != _UM_MAGIC_HEAP) 20 20 return NULL; 21 if (h->type & _HEAP_HIGHMEM) 22 return NULL; 21 23 22 24 bytes = count * size; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/utmalloc.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r809 r810 18 18 if (h->magic != _UM_MAGIC_HEAP) 19 19 return NULL; 20 if (h->type & _HEAP_HIGHMEM) 21 return NULL; 20 22 _um_heap_lock (h); 21 23 block = _um_alloc_no_lock (h, size, 4, _UMFI_TILED); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/dirent.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r809 r810 11 11 #include <emx/io.h> 12 12 #include <emx/syscalls.h> 13 #include <emx/umalloc.h> 13 14 14 15 … … 115 116 */ 116 117 cch = strlen(psz) + 1; 117 dp = malloc(sizeof(struct _dircontents) + cch);118 dp = _hmalloc(sizeof(struct _dircontents) + cch); 118 119 if (dp == NULL) 119 120 { -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/getopt.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r809 r810 6 6 #include <string.h> 7 7 #include <emx/getopt.h> 8 #include <emx/umalloc.h> 8 9 9 10 char *optarg = NULL; … … 47 48 if (optmode == GETOPT_ANY) 48 49 { 49 options = (char **) malloc (argc * sizeof (char *));50 non_options = (char **) malloc (argc * sizeof (char *));50 options = (char **)_hmalloc (argc * sizeof (char *)); 51 non_options = (char **)_hmalloc (argc * sizeof (char *)); 51 52 if (options == NULL || non_options == NULL) 52 53 { -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/os2_386/os2.smak
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r809 r810 6 6 .INSDIR := lib/ 7 7 8 .TARGET := os2.a8 .TARGET := libos2.a 9 9 .TKIND := aout 10 10 .TSRC.386 := $(wildcard src/lib/os2_386/*.s) 11 .TSRC := $(.TSRC.$(CPU)) $(wildcard src/lib/os2_386/*.c) 11 .TSRC := $(.TSRC.$(CPU)) $(wildcard src/lib/os2_386/*.c) $(wildcard src/lib/os2_386/safe/*.c) 12 12 .TCF := -Wno-unused -s 13 13 .IMPS := $(wildcard src/lib/os2_386/*.imp) … … 15 15 include mkimplib.smak 16 16 17 .TARGET := os2_p.a17 .TARGET := libos2_p.a 18 18 .TKIND := aout prof 19 19 .TCF := -Wno-unused 20 20 include mkimplib.smak 21 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/startup/386/crt0.s
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r809 r810 38 38 39 39 __text: 40 #if defined (HIGHMEM) 41 pushl $1 /* vote for high mem for default stack */ 42 #else 43 pushl $0 /* veto agains high mem for default stack */ 44 #endif 40 45 call ___init_app 41 46 /* esp points to main() call frame. */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/startup/386/dll0.s
-
Property cvs2svn:cvs-rev
changed from
1.8
to1.9
r809 r810 36 36 37 37 __text: 38 /** @todo ___init_dll shouldn't be called, only _DLL_InitTerm. */ 38 cmpl $0, 8(%esp) 39 jz do_common_init 40 jmp do_initterm 41 42 /* 43 * Nonstandard: we're doing some early initializations. 44 */ 45 do_common_init: 46 #if defined (HIGHMEM) 47 pushl $1 /* vote for high mem for default stack */ 48 #else 49 pushl $0 /* veto against high mem for default stack */ 50 #endif 39 51 call ___init_dll 52 add $4, %esp 53 orl %eax, %eax 54 jz do_initterm 55 /* 56 * __init_dll() failed - fail the dll loading. 57 */ 58 xorl %eax, %eax 59 ret 60 61 /* 62 * Standard initialization. 63 */ 64 do_initterm: 40 65 cld 41 66 jmp _DLL_InitTerm 42 67 68 43 69 .data 44 45 70 __data: 46 71 .long 0xba0bab // Magic number (error detection) -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/startup/startup.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r809 r810 111 111 * LIBCxy.DLL: 112 112 * - dll0.s gets control and calls __init_dll in sys/__initdll.c 113 * - __init_dll calls __libc_HeapVote() to do the heap voting. 113 114 * - __init_dll calls __init_os_version() to set _osminor,_osmajor globals. 114 115 * - __init_dll initiates _sys_pid and _sys_ppid globals. 115 * - __init_dll creates _sys_heap_fmutex. 116 * - __init_dll allocates and initialized the _sys_private_heap heap, which is 117 * operated by DosSubSetMem() and it's friends. 116 * - __init_dll creates _sys_heap_fmutex and _sys_gmtxHimem. 118 117 * - __init_dll then initializes _sys_thread_table and calls __newthread() in 119 118 * sys/__newthread.c to create the thread 1 entry. 119 * - __newthread() will call __sys_newthread() which inits the high memory 120 * heap (or low if no high mem) when calling _hmalloc(). 120 121 * - __init_dll calls __init_environ() which initializes environ and _org_environ. 121 122 * - __init_dll then intializes _sys_clock0_ms with the current MS count. … … 130 131 * Your.DLL: 131 132 * - dll0.s gets control and calls __init_dll() in sys/__initdll.c 132 * - __init_dll returns at once since already done during LIBCxy.DLL init. 133 * - __init_dll calls __libc_HeapVote() to do the heap voting. 134 * - __init_dll then returns since already done during LIBCxy.DLL init. 133 135 * - dll0.s calls _DLL_InitTerm in startup/dllinit.c. 134 136 * - _DLL_InitTerm calls _CRT_init() in startup/startup.c to initialize the CRT. … … 141 143 * - crt0.s gets control and calls ___init_app in sys/386/appinit.s which forwards 142 144 * the call to __init() in sys/__init.c. 143 * - __init() calls __init_dll() which returns at once because of LIBCxy.DLL init. 145 * - __init() calls __init_dll() to do common initiation. 146 * - __init_dll calls __libc_HeapVote() to do the heap voting. 147 * - __init_dll then returns since already done during LIBCxy.DLL init. 144 148 * - __init() parse the commandline to figure out how much stack to use for array 145 149 * and the argument copy. -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/startup/startup.smak
-
Property cvs2svn:cvs-rev
changed from
1.10
to1.11
r809 r810 9 9 include common.smak 10 10 11 .OBJS += $(addprefix $.$(.TKIND.DIR)src/lib/startup/,mcrt0.o gcrt0.o ) \11 .OBJS += $(addprefix $.$(.TKIND.DIR)src/lib/startup/,mcrt0.o gcrt0.o crt0hi.o dll0hi.o) \ 12 12 $(addprefix $.omf/src/lib/startup/,mcrt0.obj gcrt0.obj \ 13 $(CPU)/crt0.obj $(CPU)/dll0.obj )13 $(CPU)/crt0.obj $(CPU)/dll0.obj crt0hi.obj dll0hi.obj) 14 14 .DIRS := $(sort $(dir $(.OBJS))) 15 15 TARGDIRS += $(.DIRS) … … 21 21 $(call CP,$^,$(dir $@)) 22 22 23 $.aout/src/lib/startup/crt0hi.o: src/lib/startup/386/crt0.s 24 $(call DO.COMPILE.s, -DHIGHMEM) 25 26 $.aout/src/lib/startup/dll0hi.o: src/lib/startup/386/dll0.s 27 $(call DO.COMPILE.s, -DHIGHMEM) 28 23 29 $.aout/src/lib/startup/mcrt0.o: src/lib/startup/386/crt0.s 24 30 $(call DO.COMPILE.s, -DMCRT0) … … 30 36 $(call RM,tmp1.o tmp2.o) 31 37 32 # This rule doesn t work if the aout/src/lib/startup/ directory does not38 # This rule doesn't work if the aout/src/lib/startup/ directory does not 33 39 # exist when make is started, and is ignored because of this (shit!) 34 40 #$.omf/src/lib/startup/%.obj: $.aout/src/lib/startup/%.o … … 40 46 $.omf/src/lib/startup/gcrt0.obj: $.aout/src/lib/startup/gcrt0.o 41 47 $(call DO.EMXOMF,-m__text) 48 $.omf/src/lib/startup/dll0hi.obj: $.aout/src/lib/startup/dll0hi.o 49 $(call DO.EMXOMF,-m__text) 50 $.omf/src/lib/startup/crt0hi.obj: $.aout/src/lib/startup/crt0hi.o 51 $(call DO.EMXOMF,-m__text) 42 52 $.omf/src/lib/startup/386/dll0.obj: $.aout/src/lib/startup/386/dll0.o 43 53 $(call DO.EMXOMF,-m__text) -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/386/__init_environ.s
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r809 r810 36 36 * 37 37 */ 38 .globl __ _init_environ39 __ _init_environ:38 .globl __sys_init_environ 39 __sys_init_environ: 40 40 pushl %ebp 41 41 movl %esp, %ebp … … 68 68 movl %esi, %ecx 69 69 subl %esp, %ecx 70 / DosSubAllocMem(_sys_private_heap, &_org_environ,size);70 / _org_environ = _hmalloc(size); 71 71 pushl %ecx 72 pushl $__org_environ 73 pushl __sys_private_heap 74 call DosSubAllocMem 75 addl $12, %esp 72 call __hmalloc 73 addl $4, %esp 76 74 orl %eax, %eax 77 jnz env_ret 75 jz env_ret 76 mov %eax, __org_environ 78 77 79 78 /* -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/386/appinit.s
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r809 r810 2 2 3 3 .globl ___init_app 4 .globl __ _init_ret4 .globl __sys_init_ret 5 5 6 6 .data … … 16 16 hlt 17 17 18 __ _init_ret:18 __sys_init_ret: 19 19 movl 4(%esp), %esp 20 20 jmp *L_ret -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/386/systhrea.s
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r809 r810 8 8 9 9 __sys_thread: 10 /** @todo change this to use a TLS variable */ 11 movl %fs, %ecx 12 movl $DosTIB, %eax 13 movl %eax, %fs 10 14 fs 11 15 movl 12, %eax /* ptib2 */ 12 16 movl 0(%eax), %edx /* TID */ 13 17 movl __sys_thread_table(,%edx,4), %eax 18 movl %ecx, %fs 14 19 testl %eax, %eax 15 20 jz 1f … … 21 26 pushl %edx /* tid */ 22 27 call ___sys_newthread 23 addl $ 4, %esp28 addl $8, %esp 24 29 popl %edx 25 30 movl __sys_thread_table(,%edx,4), %eax -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__endthread.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r809 r810 2 2 3 3 #include "libc-alias.h" 4 #include <stdlib.h> 4 5 #define INCL_DOS 5 6 #define INCL_FSMACROS … … 11 12 { 12 13 thread_data *tp; 13 FS_VAR();14 14 15 15 if (tid < MAX_THREADS && _sys_thread_table[tid] != NULL) 16 16 { 17 17 tp = _sys_thread_table[tid]; 18 FS_SAVE_LOAD();19 18 if (tp->fd.hdir != HDIR_CREATE) 20 19 { 20 FS_VAR(); 21 FS_SAVE_LOAD(); 21 22 DosFindClose (tp->fd.hdir); 23 FS_RESTORE(); 22 24 tp->fd.hdir = HDIR_CREATE; 23 25 } 24 DosSubFreeMem (_sys_private_heap, tp, sizeof (thread_data)); 25 FS_RESTORE(); 26 free (tp); 26 27 _sys_thread_table[tid] = NULL; 27 28 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__init.c
-
Property cvs2svn:cvs-rev
changed from
1.8
to1.9
r809 r810 10 10 */ 11 11 12 13 /******************************************************************************* 14 * Header Files * 15 *******************************************************************************/ 12 16 #include "libc-alias.h" 13 17 #define INCL_DOS … … 21 25 #include <alloca.h> 22 26 27 28 /* All globals is to be defined in this object file. */ 23 29 #define EXTERN 24 30 #define INIT(x) = x 25 26 31 #include "syscalls.h" 27 32 28 33 29 extern int __init_dll(void); 30 extern void volatile __init_ret(void *stack); 34 /******************************************************************************* 35 * Internal Functions * 36 *******************************************************************************/ 31 37 static int parse_args(const char *src, char **argv, char *pool); 32 38 39 40 /******************************************************************************* 41 * Global Variables * 42 *******************************************************************************/ 33 43 /** argument count found by parse_args(). */ 34 44 static int argc; 35 45 46 47 /******************************************************************************* 48 * Defined Constants And Macros * 49 *******************************************************************************/ 36 50 /** Helper macros for parse args 37 51 * @{ */ … … 128 142 * magic done in sys/386/appinit.s. The top of the returned stack have a layout 129 143 * as seen in struct stackframe below - start of struct is main() callframe. 144 * @param fDefaultHeapInHighMem If set the application is open to put the default 145 * heap in high memory. 146 * If clear the application veto against putting the 147 * default heap in high memory. 148 * Passed on to __init_dll(). 130 149 * @ingroup startup 131 150 */ 132 void __init( void)151 void __init(int fDefaultHeapInHighMem) 133 152 { 134 153 /** top of stack unpon 'return' from this function. */ … … 155 174 /* 156 175 * Do the common initialization in case we're linked statically. 176 * Then end the heap voting. 157 177 */ 158 if (__init_dll( ))178 if (__init_dll(fDefaultHeapInHighMem)) 159 179 goto failure; 180 181 __libc_HeapEndVoting(); 182 160 183 161 184 /* … … 200 223 201 224 /* Return to the program. */ 202 _ _init_ret(pStackFrame);225 _sys_init_ret(pStackFrame); 203 226 204 227 failure: -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__initdll.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r809 r810 32 32 #include "syscalls.h" 33 33 34 /* Make this function an weak external. */ 35 #pragma weak __init_largefileio 36 37 34 38 /******************************************************************************* 35 39 * Global Variables * … … 39 43 40 44 41 /*******************************************************************************42 * External Functions *43 *******************************************************************************/44 extern int __init_environ(const char *pszEnv);45 extern void __init_largefileio(void) __attribute__((weak));46 47 48 45 /** 49 46 * Common init code for crt0 and dll0. 50 47 * This should perhaps be a part of _CRT_init. 51 48 */ 52 int __init_dll( void)49 int __init_dll(int fDefaultHeapInHighMem) 53 50 { 54 51 ULONG aul[2]; … … 60 57 61 58 /* 62 * Only called once. 59 * Heap voting. 60 */ 61 __libc_HeapVote(fDefaultHeapInHighMem); 62 63 /* 64 * The rest must only be executed once. 63 65 */ 64 66 if (initialized) … … 76 78 * Check for high memory (>512MB) support. 77 79 */ 78 _sys_ virtual_address_limit = 0;80 _sys_gcbVirtualAddressLimit = 0; 79 81 if ( !DosQuerySysInfo(QSV_VIRTUALADDRESSLIMIT, QSV_VIRTUALADDRESSLIMIT, &aul[0], sizeof(aul[0])) 80 82 && aul[0] > 512) 81 _sys_ virtual_address_limit = aul[0] * 1024*1024;83 _sys_gcbVirtualAddressLimit = aul[0] * 1024*1024; 82 84 83 85 /* … … 94 96 95 97 /* 96 * Initialize the heap. Here, we only create the semaphore 97 * (while having only one thread). The heap will be created by __sbrk(). 98 * Initialize the heap semaphores. 98 99 */ 99 100 if (_fmutex_create(&_sys_heap_fmutex, 0) != 0) 100 101 return -1; 101 102 /* 103 * LIBC Private heap, used for org_environ and per thread data. 104 * Let's try put it in high memory... 105 */ 106 /** @todo Redo this private heap stuff. */ 107 rc = DosAllocMem(&_sys_private_heap, SYS_PRIVATE_HEAP_SIZE, 108 _sys_virtual_address_limit 109 ? PAG_READ | PAG_WRITE | OBJ_ANY 110 : PAG_READ | PAG_WRITE); 111 if (rc != 0) 112 return -1; 113 rc = DosSubSetMem(_sys_private_heap, 114 DOSSUB_INIT | DOSSUB_SPARSE_OBJ | DOSSUB_SERIALIZE, 115 SYS_PRIVATE_HEAP_SIZE); 116 if (rc != 0) 102 if (_fmutex_create(&_sys_gmtxHimem, 0) != 0) 117 103 return -1; 118 104 … … 128 114 * Setup environment (org_environ and _STD(environ)) 129 115 */ 130 rc = _ _init_environ(ppib->pib_pchenv);116 rc = _sys_init_environ(ppib->pib_pchenv); 131 117 if (rc) 132 118 return -1; … … 137 123 * large file suppoort enabled. 138 124 */ 139 if (_ _init_largefileio)140 _ _init_largefileio();125 if (_sys_init_largefileio) 126 _sys_init_largefileio(); 141 127 142 128 /* -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__newthread.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r809 r810 2 2 3 3 #include "libc-alias.h" 4 #include <os2emx.h> 4 5 #include <errno.h> 5 #define INCL_DOS6 #define INCL_FSMACROS7 #include <os2emx.h>8 6 #include <emx/syscalls.h> 7 #include <emx/umalloc.h> 9 8 #include "syscalls.h" 10 9 … … 13 12 int __sys_newthread (int tid, int *errnop) 14 13 { 15 ULONG rc;16 14 void *data; 17 FS_VAR();18 15 19 16 if (tid >= MAX_THREADS) … … 23 20 return -1; 24 21 } 25 FS_SAVE_LOAD(); 26 rc = DosSubAllocMem (_sys_private_heap, &data, sizeof (thread_data)); 27 FS_RESTORE(); 28 if (rc != 0) 22 data = _hmalloc (sizeof (thread_data)); 23 if (!data) 29 24 { 30 _sys_set_errno (rc);25 errno = ENOMEM; 31 26 return -1; 32 27 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__open.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r809 r810 91 91 { 92 92 LONGLONG cbInitialTmp = cbInitial; 93 rc = __pfnDosOpenL(pszFile, &hFile, &ulAction, cbInitialTmp, flAttr, flOpenFlags, flOpenMode, NULL); 93 int cch = strlen(pszFile); 94 char * pszFile_safe = alloca(cch + 1); 95 if (pszFile_safe) 96 { 97 strcpy(pszFile_safe, pszFile); 98 rc = __pfnDosOpenL(pszFile_safe, &hFile, &ulAction, cbInitialTmp, flAttr, flOpenFlags, flOpenMode, NULL); 99 } 100 else 101 rc = ERROR_NOT_ENOUGH_MEMORY; 94 102 } 95 103 else -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__pipe.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r809 r810 4 4 #define INCL_DOSQUEUES 5 5 #define INCL_FSMACROS 6 #include <os2safe.h> 6 7 #include <os2emx.h> 7 8 #include <emx/syscalls.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__read.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r809 r810 3 3 #include "libc-alias.h" 4 4 #define INCL_FSMACROS 5 #define INCL_ERRORS 5 6 #include <os2emx.h> 7 #include <stdlib.h> 8 #include <memory.h> 9 #include <emx/umalloc.h> 6 10 #include <emx/syscalls.h> 7 11 #include "syscalls.h" … … 11 15 ULONG rc; 12 16 ULONG n; 17 void *pvBuf_safe = NULL; 13 18 FS_VAR(); 14 19 20 /* 21 * Devices doesn't like getting high addresses. 22 */ 23 if ((unsigned)buf >= 512*1024*1024) 24 { 25 ULONG ulType = 0; 26 ULONG ulAttr = 0; 27 FS_SAVE_LOAD(); 28 rc = DosQueryHType(handle, &ulType, &ulAttr); 29 FS_RESTORE(); 30 31 if (!rc && (ulType & 0xf) == HANDTYPE_DEVICE) 32 { 33 pvBuf_safe = _lmalloc(nbyte); 34 if (!pvBuf_safe) 35 return ERROR_NOT_ENOUGH_MEMORY; 36 memcpy(pvBuf_safe, buf, nbyte); 37 } 38 } 39 15 40 FS_SAVE_LOAD(); 16 rc = DosRead (handle, buf, nbyte, &n);41 rc = DosRead (handle, pvBuf_safe ? pvBuf_safe : buf, nbyte, &n); 17 42 FS_RESTORE(); 43 if (pvBuf_safe) 44 { 45 memcpy(buf, pvBuf_safe, nbyte); 46 free(pvBuf_safe); 47 } 18 48 if (rc == 0) 19 49 return n; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__write.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r809 r810 3 3 #include "libc-alias.h" 4 4 #define INCL_FSMACROS 5 #define INCL_ERRORS 5 6 #include <os2emx.h> 7 #include <memory.h> 8 #include <stdlib.h> 6 9 #include <emx/syscalls.h> 10 #include <emx/umalloc.h> 7 11 #include "syscalls.h" 8 12 … … 11 15 ULONG rc; 12 16 ULONG n; 17 void *pvBuf_safe = NULL; 13 18 FS_VAR(); 19 20 /* 21 * Devices doesn't like getting high addresses. 22 */ 23 if ((unsigned)buf >= 512*1024*1024) 24 { 25 ULONG ulType = 0; 26 ULONG ulAttr = 0; 27 FS_SAVE_LOAD(); 28 rc = DosQueryHType(handle, &ulType, &ulAttr); 29 FS_RESTORE(); 30 31 if (!rc && (ulType & 0xf) == HANDTYPE_DEVICE) 32 { 33 if (nbyte > 256) 34 { /* use heap for large buffers */ 35 pvBuf_safe = _lmalloc(nbyte); 36 if (!pvBuf_safe) 37 return ERROR_NOT_ENOUGH_MEMORY; 38 memcpy(pvBuf_safe, buf, nbyte); 39 buf = pvBuf_safe; 40 } 41 else 42 { /* use stack for small buffers */ 43 pvBuf_safe = alloca(nbyte); 44 memcpy(pvBuf_safe, buf, nbyte); 45 buf = pvBuf_safe; 46 pvBuf_safe = NULL; 47 } 48 } 49 } 14 50 15 51 FS_SAVE_LOAD(); 16 52 rc = DosWrite (handle, buf, nbyte, &n); 17 53 FS_RESTORE(); 54 55 if (pvBuf_safe) 56 free(pvBuf_safe); 18 57 if (rc == 0) 19 58 return n; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/largefileio.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r809 r810 37 37 #define INCL_BASE 38 38 #include <os2.h> 39 #include "syscalls.h" 39 40 40 41 … … 62 63 * @author knut st. osmundsen <bird-srcspam@anduin.net> 63 64 */ 64 void _ _init_largefileio(void)65 void _sys_init_largefileio(void) 65 66 { 66 67 HMODULE hmod = NULLHANDLE; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/remove.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r809 r810 5 5 #define INCL_FSMACROS 6 6 #define INCL_DOSMISC 7 #include <os2safe.h> 7 8 #include <os2emx.h> 8 9 #include <emx/syscalls.h> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/syscalls.h
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r809 r810 54 54 * address space size in bytes. 55 55 * 56 * Initiated by __init_dll(). */ 57 EXTERN unsigned long _sys_virtual_address_limit; 56 * Initiated by __init_dll(). 57 */ 58 EXTERN unsigned long _sys_gcbVirtualAddressLimit; 59 58 60 59 61 /* The top heap object. This points into _sys_heap_objs[] or is NULL. … … 65 67 objects are managed in LIFO fashion. */ 66 68 67 EXTERN struct heap_obj _sys_heap_objs[MAX_HEAP_OBJS];69 EXTERN struct heap_obj _sys_heap_objs[MAX_HEAP_OBJS]; 68 70 69 71 /* This is the number of heap objects. */ 70 72 71 EXTERN unsigned _sys_heap_obj_count;73 EXTERN unsigned _sys_heap_obj_count; 72 74 73 75 /* This variable can be initialized by the application to control the 74 76 size of the heap object(s). */ 75 77 76 extern unsigned _sys_heap_size;78 extern unsigned _sys_heap_size; 77 79 78 80 … … 158 160 #define MAX_THREADS 1024 159 161 160 /* This mutex semaphore protects the heap. */161 #ifdef _FMC_SHARED162 EXTERN _fmutex _sys_heap_fmutex;163 #endif164 EXTERN void *_sys_private_heap INIT (NULL);165 162 EXTERN thread_data *_sys_thread_table[MAX_THREADS]; 166 163 … … 172 169 void _sys_set_errno (unsigned long rc); 173 170 void _sys_get_clock (unsigned long *ms); 171 172 /** @group Heap stuff. 173 * @{ */ 174 174 ULONG _sys_expand_heap_obj_by (ULONG incr); 175 175 ULONG _sys_expand_heap_by (ULONG incr, ULONG sbrk_model); … … 177 177 ULONG _sys_shrink_heap_by (ULONG decr, ULONG sbrk_model); 178 178 ULONG _sys_shrink_heap_obj_by (ULONG decr); 179 #ifdef _FMC_SHARED 180 /** This mutex semaphore protects the heap. */ 181 EXTERN _fmutex _sys_heap_fmutex; 182 /** Mutex semaphore protecting the list of high memory big blocks. */ 183 EXTERN _fmutex _sys_gmtxHimem; 184 #endif 185 /** @} */ 179 186 187 188 /** @group Init functions 189 * @{ */ 190 extern int __init_dll(int fDefaultHeapInHighMem); 191 extern void volatile _sys_init_ret(void *stack); 192 extern int _sys_init_environ(const char *pszEnv); 193 extern void _sys_init_largefileio(void); 194 /** @} */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/libos2/os2.smak
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r809 r810 6 6 .INSDIR := lib/ 7 7 8 .TARGET := os2.a8 .TARGET := libos2.a 9 9 .TKIND := aout 10 10 .TSRC.386 := $(wildcard src/lib/os2_386/*.s) 11 .TSRC := $(.TSRC.$(CPU)) $(wildcard src/lib/os2_386/*.c) 11 .TSRC := $(.TSRC.$(CPU)) $(wildcard src/lib/os2_386/*.c) $(wildcard src/lib/os2_386/safe/*.c) 12 12 .TCF := -Wno-unused -s 13 13 .IMPS := $(wildcard src/lib/os2_386/*.imp) … … 15 15 include mkimplib.smak 16 16 17 .TARGET := os2_p.a17 .TARGET := libos2_p.a 18 18 .TKIND := aout prof 19 19 .TCF := -Wno-unused 20 20 include mkimplib.smak 21 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/config/i386/emx.h
-
Property cvs2svn:cvs-rev
changed from
1.21
to1.22
r809 r810 267 267 "%(cpp_cpu) " \ 268 268 "%{posix:-D_POSIX_SOURCE} " \ 269 "%{Zmt*:} "\269 "%{Zmt*:} %{Zlow-mem:} " \ 270 270 "%{pg:-D__GPROF__} " \ 271 271 "%{mepilogue:-D__EPILOGUE__} " \ … … 315 315 /* Override the default crt0 files. */ 316 316 #define STARTFILE_SPEC \ 317 "%{Zdll:dll0% O%{Zomf:bj}%s}"\317 "%{Zdll:dll0%{Zhigh-mem:hi}%O%{Zomf:bj}%s}" \ 318 318 "%{!Zdll:%{pg:gcrt0%O%{Zomf:bj}%s}" \ 319 "%{!pg:%{pn:gcrt0%O%{Zomf:bj}%s}%{!pn:%{p:mcrt0%O%{Zomf:bj}%s}%{!p:crt0% O%{Zomf:bj}%s}}}"\319 "%{!pg:%{pn:gcrt0%O%{Zomf:bj}%s}%{!pn:%{p:mcrt0%O%{Zomf:bj}%s}%{!p:crt0%{Zhigh-mem:hi}%O%{Zomf:bj}%s}}}"\ 320 320 " %{Zbin-files:binmode%O%{Zomf:bj}%s} %{Zsmall-conv:smallcnv%O%{Zomf:bj}%s}}" 321 321 … … 348 348 "%(cpp_cpu) " \ 349 349 "%{posix:-D_POSIX_SOURCE} " \ 350 "%{Zmt*:} "\350 "%{Zmt*:} %{Zlow-mem:} " \ 351 351 "%{pg:-D__GPROF__} " \ 352 352 "%{mepilogue:-D__EPILOGUE__} " \ … … 396 396 /* Override the default crt0 files. */ 397 397 #define STARTFILE_SPEC \ 398 "%{Zdll:dll0% O%{!Zaout:bj}%s}" \398 "%{Zdll:dll0%{Zhigh-mem:hi}%O%{!Zaout:bj}%s}" \ 399 399 "%{!Zdll:%{pg:gcrt0%O%{!Zaout:bj}%s}" \ 400 "%{!pg:%{pn:gcrt0%O%{!Zaout:bj}%s}%{!pn:%{p:mcrt0%O%{!Zaout:bj}%s}%{!p:crt0% O%{!Zaout:bj}%s}}}"\400 "%{!pg:%{pn:gcrt0%O%{!Zaout:bj}%s}%{!pn:%{p:mcrt0%O%{!Zaout:bj}%s}%{!p:crt0%{Zhigh-mem:hi}%O%{!Zaout:bj}%s}}}"\ 401 401 " %{Zbin-files:binmode%O%{!Zaout:bj}%s} %{Zsmall-conv:smallcnv%O%{!Zaout:bj}%s}}" 402 402 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.