Changeset 270bf4f in mainline
- Timestamp:
- 2015-03-15T00:05:49Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a420203
- Parents:
- 7f9d97f3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/typedefs.h
r7f9d97f3 r270bf4f 47 47 48 48 typedef struct { 49 uint64_t lo;50 int64_t hi;51 } __attribute__ ((aligned(16))) int128_t;52 53 typedef struct {54 uint64_t lo;55 uint64_t hi;56 } __attribute__ ((aligned(16))) uint128_t;57 58 typedef struct {59 49 volatile atomic_count_t count; 60 50 } atomic_t; -
tools/autotool.py
r7f9d97f3 r270bf4f 99 99 100 100 PROBE_TAIL = """} 101 """ 102 103 PROBE_INT128_HEAD = """#define AUTOTOOL_DECLARE(category, subcategory, tag, name, strc, conc, value) \\ 104 asm volatile ( \\ 105 "AUTOTOOL_DECLARE\\t" category "\\t" subcategory "\\t" tag "\\t" name "\\t" strc "\\t" conc "\\t%[val]\\n" \\ 106 : \\ 107 : [val] "n" (value) \\ 108 ) 109 110 #define DECLARE_INTSIZE(tag, type) \\ 111 AUTOTOOL_DECLARE("intsize", "unsigned", tag, #type, "", "", sizeof(unsigned type)); \\ 112 AUTOTOOL_DECLARE("intsize", "signed", tag, #type, "", "", sizeof(signed type)); 113 114 int main(int argc, char *argv[]) 115 { 116 """ 117 118 PROBE_INT128_TAIL = """} 101 119 """ 102 120 … … 510 528 return {'unsigned_sizes': unsigned_sizes, 'signed_sizes': signed_sizes, 'unsigned_tags': unsigned_tags, 'signed_tags': signed_tags, 'unsigned_strcs': unsigned_strcs, 'signed_strcs': signed_strcs, 'unsigned_concs': unsigned_concs, 'signed_concs': signed_concs, 'float_tags': float_tags, 'builtin_sizes': builtin_sizes, 'builtin_signs': builtin_signs} 511 529 530 def probe_int128(common): 531 "Generate, compile and parse probing source for 128-bit integers" 532 533 check_common(common, "CC") 534 535 outf = open(PROBE_SOURCE, 'w') 536 outf.write(PROBE_INT128_HEAD) 537 outf.write("\tDECLARE_INTSIZE(\"INT128\", int __attribute((mode(TI))));\n") 538 outf.write(PROBE_INT128_TAIL) 539 outf.close() 540 541 args = [common['CC']] 542 args.extend(common['CC_ARGS']) 543 args.extend(["-S", "-o", PROBE_OUTPUT, PROBE_SOURCE]) 544 545 try: 546 sys.stderr.write("Checking whether the compiler has intrinsic support for 128-bit integers ... ") 547 output = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE).communicate() 548 except: 549 sys.stderr.write("no\n") 550 return False 551 552 if (not os.path.isfile(PROBE_OUTPUT)): 553 sys.stderr.write("no\n") 554 return False 555 556 inf = open(PROBE_OUTPUT, 'r') 557 lines = inf.readlines() 558 inf.close() 559 560 for j in range(len(lines)): 561 tokens = lines[j].strip().split("\t") 562 563 if (len(tokens) > 0): 564 if (tokens[0] == "AUTOTOOL_DECLARE"): 565 if (len(tokens) < 7): 566 print_error(["Malformed declaration in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL]) 567 568 category = tokens[1] 569 subcategory = tokens[2] 570 tag = tokens[3] 571 name = tokens[4] 572 strc = tokens[5] 573 conc = tokens[6] 574 value = tokens[7] 575 576 if (category == "intsize"): 577 try: 578 value_int = decode_value(value) 579 except: 580 print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL]) 581 582 if (subcategory == "unsigned"): 583 if (value_int != 16): 584 sys.stderr.write("no\n") 585 return False 586 elif (subcategory == "signed"): 587 if (value_int != 16): 588 sys.stderr.write("no\n") 589 return False 590 else: 591 print_error(["Unexpected keyword \"%s\" in \"%s\" on line %s." % (subcategory, PROBE_OUTPUT, j), COMPILER_FAIL]) 592 593 sys.stderr.write("yes\n") 594 return True 595 512 596 def detect_sizes(probe, bytes, inttags, floattags): 513 597 "Detect correct types for fixed-size types" … … 683 767 outmk.close() 684 768 685 def create_header(hdname, maps ):769 def create_header(hdname, maps, int128): 686 770 "Create header output" 687 771 … … 703 787 for typedef in maps['typedefs']: 704 788 outhd.write('typedef %s %s;\n' % (typedef['oldtype'], typedef['newtype'])) 789 790 if (int128): 791 outhd.write('typedef unsigned int __attribute((mode(TI))) uint128_t;\n') 792 outhd.write('typedef signed int __attribute((mode(TI))) int128_t;\n') 705 793 706 794 outhd.write('\n#endif\n') … … 845 933 ) 846 934 935 int128 = probe_int128(common) 936 847 937 maps = detect_sizes(probe, [1, 2, 4, 8], ['CHAR', 'SHORT', 'INT', 'LONG', 'LLONG'], ['LONG_DOUBLE', 'DOUBLE', 'FLOAT']) 848 938 … … 851 941 852 942 common['AUTOGEN'] = "%s/autogen.py" % os.path.dirname(os.path.abspath(sys.argv[0])) 853 943 854 944 create_makefile(MAKEFILE, common) 855 create_header(HEADER, maps )945 create_header(HEADER, maps, int128) 856 946 857 947 return 0 -
uspace/lib/c/arch/ia64/include/libarch/types.h
r7f9d97f3 r270bf4f 46 46 #define SSIZE_MAX INT64_MAX 47 47 48 typedef struct {49 uint64_t lo;50 int64_t hi;51 } __attribute__((aligned(16))) int128_t;52 53 typedef struct {54 uint64_t lo;55 uint64_t hi;56 } __attribute__((aligned(16))) uint128_t;57 58 48 typedef uint64_t sysarg_t; 59 49 typedef int64_t native_t;
Note:
See TracChangeset
for help on using the changeset viewer.