- Timestamp:
- Jun 28, 2014, 3:21:51 AM (11 years ago)
- Location:
- trunk/libc
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libc/include/klibc/asmdefs.mac
r3864 r3883 7 7 ; 8 8 9 10 ; 11 ; Indicator macros. 12 ; 13 14 ;; @def __EPILOGUE__ 15 ; The gcc -mepilogue option, probably not obsolete on x86, wants all functions 16 ; to have a single exit point, and apparently this should be labeled. 17 18 ;; @def __GPROF__ 19 ; The gcc -pg option sets this. We should generate calls to _mcount after 20 ; setting up the function frame pointer. 21 22 ;; @def __OS2__ 23 ; Assmebling for OS/2. 24 25 ;; @def __NT__ 26 ; Assmebling for NT (also set for Windows). 27 28 29 ;; @def KLIBC_ARCH_AMD64 30 ; Assembling for the AMD64 architecture. 31 32 ;; @def KLIBC_ARCH_X86 33 ; Assembling for the X86 architecture. 34 35 36 ;; @def KLIBC_CONV_X86_CDECL 37 ; Functions are using the x86 __cdecl calling convention. 38 39 ;; @def KLIBC_CONV_AMD64_MS 40 ; Functions are using the microsoft AMD64 calling convention. 41 42 ;; @def KLIBC_CONV_AMD64_GCC 43 ; Functions are using the GNU C/C++ AMD64 calling convention. 44 45 46 ; 47 ; Object format related macros. 48 ; 49 %assign KLIBC_OBJFMT_OMF 1 50 %assign KLIBC_OBJFMT_AOUT 2 51 %assign KLIBC_OBJFMT_COFF32 3 52 %assign KLIBC_OBJFMT_COFF64 4 53 %assign KLIBC_OBJFMT_ELF32 5 54 %assign KLIBC_OBJFMT_ELF64 6 55 %ifidn __OUTPUT_FORMAT__, obj 56 %assign KLIBC_OBJFMT KLIBC_OBJFMT_OMF 57 %elifidn __OUTPUT_FORMAT__, aout 58 %assign KLIBC_OBJFMT KLIBC_OBJFMT_AOUT 59 %elifidn __OUTPUT_FORMAT__, win32 60 %assign KLIBC_OBJFMT KLIBC_OBJFMT_COFF32 61 %elifidn __OUTPUT_FORMAT__, win64 62 %assign KLIBC_OBJFMT KLIBC_OBJFMT_COFF64 63 %elifidn __OUTPUT_FORMAT__, elf32 64 %assign KLIBC_OBJFMT KLIBC_OBJFMT_ELF32 65 %elifidn __OUTPUT_FORMAT__, elf64 66 %assign KLIBC_OBJFMT KLIBC_OBJFMT_ELF64 67 %else 68 %assign KLIBC_OBJFMT -1 69 %fatal Unknown object format: __OUTPUT_FORMAT__ 70 %endif 71 72 73 ; 74 ; Include the platform specific parts of this file. 75 ; 9 76 %ifdef __OS2__ 10 77 %include "klibc/os2/asmdefs.mac" … … 13 80 %endif 14 81 82 83 ; 84 ; Set default indicators. 85 ; 86 %ifndef KLIBC_ARCH_AMD64 87 %ifndef KLIBC_ARCH_X86 88 %define KLIBC_ARCH_X86 89 %endif 90 %endif 91 92 %ifndef __NT__ 93 %ifndef __OS2__ 94 %fatal "Neither __NT__ nor __OS2__ are defined." 95 %endif 96 %endif 97 98 %ifdef KLIBC_ARCH_X86 99 %ifdef KLIBC_ARCH_AMD64 100 %fatal "Both KLIBC_ARCH_AMD64 and KLIBC_ARCH_X86 are defined." 101 %endif 102 %ifndef KLIBC_CONV_X86_CDECL 103 %define KLIBC_CONV_X86_CDECL 104 %endif 105 %undef KLIBC_CONV_AMD64_MS 106 %undef KLIBC_CONV_AMD64_GCC 107 108 %elifdef KLIBC_ARCH_AMD64 109 %ifndef KLIBC_CONV_AMD64_MS 110 %ifndef KLIBC_CONV_AMD64_GCC 111 %define KLIBC_CONV_AMD64_MS 112 %endif 113 %elifdef KLIBC_CONV_AMD64_GCC 114 %fatal "Both KLIBC_CONV_AMD64_GCC and KLIBC_CONV_AMD64_MS are defined." 115 %endif 116 117 %else 118 %fatal "No KLIBC_ARCH_xxx define." 119 %endif 120 121 122 ; 123 ; Name mangling. 124 ; 125 126 ;; 127 ; Name mangling macro. Usually overridden by platform specific header. 128 %ifndef NAME 129 %define NAME(name) name 130 %endif 131 132 ;; 133 ; Function (cdecl) name mangling macro. 134 %ifndef NAME_FUNC 135 %define NAME_FUNC(name) NAME(name) 136 %endif 137 138 ;; 139 ; Data name mangling macro. 140 %ifndef NAME_DATA 141 %define NAME_DATA(name) NAME(name) 142 %endif 143 144 ;; 145 ; Decorate a standard kLibC function symbol. 146 %define _STD(x) NAME_FUNC(__std_ %+ x) 147 148 149 ; 150 ; Scoping and visibility macros. 151 ; 152 153 ;; 154 ; Marks a function %1 as global/public with default visibility, adding the 155 ; 'function' type and size depending on the object format. 156 %macro GLOBAL_FUNC 1 157 %if KLIBC_OBJFMT = KLIBC_OBJFMT_OMF || KLIBC_OBJFMT = KLIBC_OBJFMT_AOUT 158 global NAME_FUNC(%1) 159 %elif KLIBC_OBJFMT = KLIBC_OBJFMT_COFF32 || KLIBC_OBJFMT = KLIBC_OBJFMT_COFF64 160 %ifdef __YASM_VER__ 161 global NAME_FUNC(%1):function 162 %else 163 global NAME_FUNC(%1) 164 %endif 165 %else 166 global NAME_FUNC(%1):function (NAME_FUNC(%1) - NAME_FUNC(%1 %+ _EndProc)) default 167 %endif 168 %endmacro 169 170 ;; 171 ; Marks a data object %1 as global/public, adding the 'object' type if the 172 ; object formats that wants it. 173 %macro GLOBAL_DATA 1 174 %if KLIBC_OBJFMT = KLIBC_OBJFMT_OMF || KLIBC_OBJFMT = KLIBC_OBJFMT_AOUT 175 global NAME_DATA(%1) 176 %elif KLIBC_OBJFMT = KLIBC_OBJFMT_COFF32 || KLIBC_OBJFMT = KLIBC_OBJFMT_COFF64 177 %ifdef __YASM_VER__ 178 global NAME_DATA(%1):object 179 %else 180 global NAME_FUNC(%1) 181 %endif 182 %else 183 global NAME_DATA(%1):object 184 %endif 185 %endmacro 186 187 188 ; 189 ; Function markup. 190 ; 191 192 ;; 193 ; Marks the start of a function by name %1, no xBP frame. 194 %macro FUNC_BEGIN_NO_FRAME 1 195 GLOBAL_FUNC %1 196 NAME_FUNC(%1): 197 %define __FUNCTION__ %1 198 %ifdef KLIBC_ARCH_AMD64 199 PROC_FRAME NAME_FUNC(%1) 200 %endif 201 %ifdef __GPROF__ 202 %ifdef KLIBC_ARCH_AMD64 203 push rbp 204 mov rbp, rsp 205 call NAME_FUNC(_mcount) 206 pop rbp 207 %else 208 push ebp 209 mov ebp, esp 210 call NAME_FUNC(_mcount) 211 pop ebp 212 %endif 213 %endif 214 %endmacro ; FUNC_BEGIN_NO_FRAME 215 216 ;; 217 ; Marks the start of a function by name %1, with a simple xBP frame. 218 %macro FUNC_BEGIN_WITH_FRAME 1 219 GLOBAL_FUNC %1 220 NAME_FUNC(%1): 221 %ifdef KLIBC_ARCH_AMD64 222 PROC_FRAME NAME_FUNC(%1) 223 push rbp 224 [pushreg rbp] 225 mov rbp, rsp 226 [setframe rbp, 0] 227 %else 228 push ebp 229 mov ebp, esp 230 %endif 231 %ifdef __GPROF__ 232 call NAME_FUNC(_mcount) 233 %endif 234 %endmacro ; FUNC_BEGIN_WITH_FRAME 235 236 ;; 237 ; Marks the end of the prologue. 238 %macro FUNC_PROLOGUE_END 0 239 %ifdef KLIBC_ARCH_AMD64 240 [endprologue] 241 %endif 242 %endmacro 243 244 ;; 245 ; Combines FUNC_BEGIN_NO_FRAME and FUNC_PROLOGUE_END 246 %macro FUNC_BEGIN_NO_FRAME_NOR_PROLOGUE 1 247 FUNC_BEGIN_NO_FRAME %1 248 FUNC_PROLOGUE_END 249 %endmacro 250 251 ;; 252 ; Marks the start of the function epilogue. 253 ; This will define the local lable '.epilogue'. 254 %macro FUNC_EPILOGUE 0 255 .epilogue: 256 %ifdef __EPILOGUE__ 257 NAME_FUNC(__POST$ %+ __FUNCTION__): 258 %endif 259 %endmacro 260 261 ;; 262 ; Marks the end of a function. 263 %macro FUNC_END 0 264 %ifdef KLIBC_ARCH_AMD64 265 ENDPROC_FRAME 266 %endif 267 NAME_FUNC(__FUNCTION__)_EndProc: 268 %endmacro 269 270 271 ; 272 ; Generic x86 & AMD64 register access. 273 ; 274 %ifdef KLIBC_ARCH_AMD64 275 %define xAX rax 276 %define xBX rbx 277 %define xCX rcx 278 %define xDX rdx 279 %define xDI rdi 280 %define xSI rsi 281 %define xBP rbp 282 %define xSP rsp 283 %define xSIZE 8 284 %define xDEF dq 285 %define xRES resq 286 287 %elifdef KLIBC_ARCH_X86 288 %define xAX eax 289 %define xBX ebx 290 %define xCX ecx 291 %define xDX edx 292 %define xDI edi 293 %define xSI esi 294 %define xBP ebp 295 %define xSP esp 296 %define xSIZE 4 297 %define xDEF dd 298 %define xRES resd 299 300 %endif 301 302 -
trunk/libc/include/klibc/os2/asmdefs.mac
r3864 r3883 11 11 12 12 ; 13 ; Standard defines for OS/2. 14 ; 15 %define KLIBC_ARCH_X86 1 16 %define KLIBC_CONV_X86_CDECL 1 17 18 19 ; 13 20 ; Segment definitions. 14 21 ; 15 %ifdef KLIBC_ASM_FMT_AOUT 16 %define BEGIN_CODE32 .text 17 %define BEGIN_DATA32 .data 18 %define BEGIN_CONST32 .text 19 %else 20 %define BEGIN_CODE32 segment CODE32 21 %define BEGIN_DATA32 segment DATA32 22 %define BEGIN_CONST32 segment CODE32 22 %if KLIBC_OBJFMT = KLIBC_OBJFMT_AOUT 23 %define SEG_BEGIN_CODE section .text 24 %define SEG_BEGIN_DATA section .data 25 %define SEG_BEGIN_CONST section .text 26 %define SEG_BEGIN_BSS section .bss 27 28 %elif KLIBC_OBJFMT = KLIBC_OBJFMT_OMF 29 %define SEG_BEGIN_CODE segment CODE32 30 %define SEG_BEGIN_DATA segment DATA32 31 %define SEG_BEGIN_CONST segment CODE32 32 %define SEG_BEGIN_BSS segment BSS32 23 33 24 34 segment CODE32 use32 flat align=16 public class=CODE … … 49 59 50 60 segment CODE16 use16 align=16 public class=CODE 61 62 %elif KLIBC_OBJFMT = KLIBC_OBJFMT_ELF32 || KLIBC_OBJFMT = KLIBC_OBJFMT_COFF32 ; latter is just for testing! 63 %define SEG_BEGIN_CODE section .text 64 %define SEG_BEGIN_DATA section .data 65 %define SEG_BEGIN_CONST section .rodata 66 %define SEG_BEGIN_BSS section .bss 67 68 %else 69 %fatal Object format __OUTPUT_FORMAT__ is not supported by kLibC on OS/2. 51 70 %endif 52 71 53 72 54 73 ;; 55 ; Decorate a standard kLibC symbol.56 %define _STD(x) __std_ %+ x74 ; Prefix all symbols with an underscore. 75 %define NAME(name) _ %+ name 57 76 58 77 %endif -
trunk/libc/include/sys/cdefs.h
r3861 r3883 67 67 # define __KLIBC_WATCOM_PREREQ(a_uMajor, a_uMinor) \ 68 68 (__WATCOMC__ >= (a_uMajor)*10 + (a_uMinor)) 69 #else70 # define __KLIBC_WATCOM_PREREQ(a_uMajor, a_uMinor) 071 #endif72 73 #ifdef __WATCOMC__74 69 # define __KLIBC_WATCOM_C99_PREREQ(a_uMajor, a_uMinor) \ 75 70 (__KLIBC_WATCOM_PREREQ(a_uMajor, a_uMinor) && __STDC_VERSION__ >= 199901L) 76 71 #else 72 # define __KLIBC_WATCOM_PREREQ(a_uMajor, a_uMinor) 0 77 73 # define __KLIBC_WATCOM_C99_PREREQ(a_uMajor, a_uMinor) 0 78 74 #endif 75 79 76 80 77 #ifdef _MSC_VER -
trunk/libc/src/kNIX/os2/386/__libc_back_envInitAsm.asm
r3861 r3883 14 14 extern _STD(environ) 15 15 16 BEGIN_CODE32 16 SEG_BEGIN_CODE 17 17 18 18 ;; -
trunk/libc/src/kNIX/os2/386/unwind.asm
r3861 r3883 6 6 extern DosUnwindException 7 7 8 BEGIN_CODE32 8 SEG_BEGIN_CODE 9 9 ; void __unwind2 (void *xcpt_reg_ptr) 10 10 global ___unwind2 -
trunk/libc/src/libc/math/nan.c
r3873 r3883 4 4 * 5 5 * @copyright Copyright (C) 2006-2014 knut st. osmundsen <bird-klibc-spam-xiv@anduin.net> 6 * @licenses MIT, BSD2, BSD3, BSD4, LGPLv2.1, LGPLv3 .6 * @licenses MIT, BSD2, BSD3, BSD4, LGPLv2.1, LGPLv3, LGPLvFuture. 7 7 */ 8 8 -
trunk/libc/src/libc/math/nanf.c
r3873 r3883 4 4 * 5 5 * @copyright Copyright (C) 2006-2014 knut st. osmundsen <bird-klibc-spam-xiv@anduin.net> 6 * @licenses MIT, BSD2, BSD3, BSD4, LGPLv2.1, LGPLv3 .6 * @licenses MIT, BSD2, BSD3, BSD4, LGPLv2.1, LGPLv3, LGPLvFuture. 7 7 */ 8 8 -
trunk/libc/src/libc/math/nanl.c
r3873 r3883 4 4 * 5 5 * @copyright Copyright (C) 2006-2014 knut st. osmundsen <bird-klibc-spam-xiv@anduin.net> 6 * @licenses MIT, BSD2, BSD3, BSD4, LGPLv2.1, LGPLv3 .6 * @licenses MIT, BSD2, BSD3, BSD4, LGPLv2.1, LGPLv3, LGPLvFuture. 7 7 */ 8 8 -
trunk/libc/src/libsocket/386/swapl.asm
r3864 r3883 9 9 %include "klibc/asmdefs.mac" 10 10 11 BEGIN_CODE32 11 SEG_BEGIN_CODE 12 12 global __swapl 13 13 __swapl: -
trunk/libc/src/libsocket/386/swaps.asm
r3864 r3883 10 10 %include "klibc/asmdefs.mac" 11 11 12 BEGIN_CODE32 12 SEG_BEGIN_CODE 13 13 global __swaps 14 14 __swaps:
Note:
See TracChangeset
for help on using the changeset viewer.