- Timestamp:
- 2009-11-03T21:36:54Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1647323
- Parents:
- bbddafb (diff), b1c21c2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- contrib
- Files:
-
- 12 deleted
- 25 edited
-
arch/HelenOS.adl (modified) (2 diffs)
-
arch/hadlbppp.py (modified) (28 diffs)
-
arch/kernel/kernel.adl (modified) (15 diffs)
-
arch/uspace/app/klog/klog.adl (modified) (1 diff)
-
arch/uspace/app/klog/klog.bp (deleted)
-
arch/uspace/lib/libfs/fnc.libfs_lookup (modified) (1 diff)
-
arch/uspace/lib/libfs/fnc.libfs_mount (modified) (1 diff)
-
arch/uspace/lib/libfs/fnc.libfs_stat (modified) (1 diff)
-
arch/uspace/srv/bd/rd/rd.adl (modified) (1 diff)
-
arch/uspace/srv/bd/rd/rd.bp (deleted)
-
arch/uspace/srv/console/console.adl (modified) (3 diffs)
-
arch/uspace/srv/console/console.bp (modified) (1 diff)
-
arch/uspace/srv/console/console_server.bp (deleted)
-
arch/uspace/srv/devmap/devmap.adl (modified) (1 diff)
-
arch/uspace/srv/devmap/devmap_driver.bp (modified) (1 diff)
-
arch/uspace/srv/devmap/devmap_server.bp (deleted)
-
arch/uspace/srv/fb/fb.adl (modified) (1 diff)
-
arch/uspace/srv/fb/fb_server.bp (deleted)
-
arch/uspace/srv/fs/devfs/devfs.adl (modified) (1 diff)
-
arch/uspace/srv/fs/devfs/devfs_server.bp (deleted)
-
arch/uspace/srv/fs/fat/fat.adl (modified) (1 diff)
-
arch/uspace/srv/fs/fat/fat_server.bp (deleted)
-
arch/uspace/srv/fs/tmpfs/tmpfs.adl (modified) (1 diff)
-
arch/uspace/srv/fs/tmpfs/tmpfs_server.bp (deleted)
-
arch/uspace/srv/kbd/kbd.adl (modified) (1 diff)
-
arch/uspace/srv/kbd/kbd_server.bp (deleted)
-
arch/uspace/srv/loader/loader.adl (modified) (1 diff)
-
arch/uspace/srv/loader/loader_server.bp (deleted)
-
arch/uspace/srv/ns/ns.adl (modified) (1 diff)
-
arch/uspace/srv/ns/ns.bp (modified) (1 diff)
-
arch/uspace/srv/pci/pci.adl (modified) (1 diff)
-
arch/uspace/srv/pci/pci_server.bp (deleted)
-
arch/uspace/srv/vfs/vfs.adl (modified) (2 diffs)
-
arch/uspace/srv/vfs/vfs.bp (modified) (5 diffs)
-
arch/uspace/srv/vfs/vfs_server.bp (deleted)
-
highlight/adl.syntax (modified) (1 diff)
-
toolchain.sh (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
contrib/arch/HelenOS.adl
rbbddafb r4f5dc18 32 32 [/uspace/lib/libc/bind%klog] 33 33 34 bind ns:kbd to console:kbd; 35 bind ns:fb to console:fb; 36 bind ns:console to console:console; 37 bind ns:vfs to vfs:vfs; 38 bind ns:devmap_driver to devmap:devmap_driver; 39 bind ns:devmap_client to devmap:devmap_client; 40 bind ns:loader to loader:loader; 41 34 42 bind loader:ns to ns:ns; 35 43 36 44 bind devmap:ns to ns:ns; 45 bind devmap:rd to bd:rd; 46 bind devmap:console to console:console; 37 47 38 48 bind bd:ns to ns:ns; … … 45 55 46 56 bind console:ns to ns:ns; 57 bind console:devmap_driver to devmap:devmap_driver; 47 58 bind console:sys_console to kernel:sys_console; 48 59 -
contrib/arch/hadlbppp.py
rbbddafb r4f5dc18 36 36 INC, POST_INC, BLOCK_COMMENT, LINE_COMMENT, SYSTEM, ARCH, HEAD, BODY, NULL, \ 37 37 INST, VAR, FIN, BIND, TO, SUBSUME, DELEGATE, IFACE, EXTENDS, PRE_BODY, \ 38 PROTOTYPE, PAR_LEFT, PAR_RIGHT, SIGNATURE, PROTOCOL, FRAME, PROVIDES, \39 REQUIRES = range(27)38 PROTOTYPE, PAR_LEFT, PAR_RIGHT, SIGNATURE, PROTOCOL, INITIALIZATION, \ 39 FINALIZATION, FRAME, PROVIDES, REQUIRES = range(29) 40 40 41 41 def usage(prname): 42 42 "Print usage syntax" 43 43 44 print "%s <OUTPUT>" % prname 44 print "%s <--bp|--ebp|--adl|--dot|--nop>+ <OUTPUT>" % prname 45 print 46 print "--bp Dump original Behavior Protocols (dChecker, BPSlicer)" 47 print "--ebp Dump Extended Behavior Protocols (bp2promela)" 48 print "--adl Dump Architecture Description Language (modified SOFA ADL/CDL)" 49 print "--dot Dump Dot architecture diagram (GraphViz)" 50 print "--nop Do not dump anything (just input files syntax check)" 51 print 45 52 46 53 def tabs(cnt): … … 246 253 "Convert interface Behavior Protocol to generic protocol" 247 254 248 result = [ "("]255 result = [] 249 256 i = 0 250 257 … … 266 273 i += 1 267 274 268 result.append(")")269 result.append("*")270 271 275 return result 272 276 273 def merge_bp( protocols):277 def merge_bp(initialization, finalization, protocols): 274 278 "Merge several Behavior Protocols" 275 279 280 indep = [] 281 276 282 if (len(protocols) > 1): 277 result = []278 283 first = True 279 284 … … 282 287 first = False 283 288 else: 284 result.append("|") 285 286 result.append("(") 287 result.extend(protocol) 288 result.append(")") 289 290 return result 291 292 if (len(protocols) == 1): 293 return protocols[0] 294 295 return [] 289 indep.append("|") 290 291 indep.append("(") 292 indep.extend(protocol) 293 indep.append(")") 294 elif (len(protocols) == 1): 295 indep = protocols[0] 296 297 inited = [] 298 299 if (initialization != None): 300 if (len(indep) > 0): 301 inited.append("(") 302 inited.extend(initialization) 303 inited.append(")") 304 inited.append(";") 305 inited.append("(") 306 inited.extend(indep) 307 inited.append(")") 308 else: 309 inited = initialization 310 else: 311 inited = indep 312 313 finited = [] 314 315 if (finalization != None): 316 if (len(inited) > 0): 317 finited.append("(") 318 finited.extend(inited) 319 finited.append(")") 320 finited.append(";") 321 finited.append("(") 322 finited.extend(finalization) 323 finited.append(")") 324 else: 325 finited = finalization 326 else: 327 finited = inited 328 329 return finited 296 330 297 331 def parse_bp(name, tokens, base_indent): … … 344 378 return output 345 379 380 def parse_ebp(component, name, tokens, base_indent): 381 "Parse Behavior Protocol and generate Extended Behavior Protocol output" 382 383 return "component %s {\n\tbehavior {\n\t\t%s\n\t}\n}" % (component, parse_bp(name, tokens, base_indent + 2)) 384 346 385 def get_iface(name): 347 386 "Get interface by name" … … 370 409 return result 371 410 372 def dump_frame( frame, outdir, var, archf):411 def dump_frame(directed_binds, frame, outdir, var, archf): 373 412 "Dump Behavior Protocol of a given frame" 374 413 375 fname = "%s.bp" % frame['name'] 376 377 archf.write("instantiate %s from \"%s\"\n" % (var, fname)) 414 global opt_bp 415 global opt_ebp 416 417 if (opt_ebp): 418 fname = "%s.ebp" % frame['name'] 419 else: 420 fname = "%s.bp" % frame['name'] 421 422 if (archf != None): 423 archf.write("instantiate %s from \"%s\"\n" % (var, fname)) 424 378 425 outname = os.path.join(outdir, fname) 379 426 … … 381 428 if ('protocol' in frame): 382 429 protocols.append(frame['protocol']) 430 431 if ('initialization' in frame): 432 initialization = frame['initialization'] 433 else: 434 initialization = None 435 436 if ('finalization' in frame): 437 finalization = frame['finalization'] 438 else: 439 finalization = None 383 440 384 441 if ('provides' in frame): … … 386 443 iface = get_iface(provides['iface']) 387 444 if (not iface is None): 445 binds = directed_binds['%s.%s' % (var, provides['iface'])] 446 if (not binds is None): 447 cnt = len(binds) 448 else: 449 cnt = 1 450 388 451 if ('protocol' in iface): 389 protocols.append(extend_bp(outname, iface['protocol'], iface['name'])) 452 proto = extend_bp(outname, iface['protocol'], iface['name']) 453 for _ in range(0, cnt): 454 protocols.append(proto) 455 390 456 for protocol in inherited_protocols(iface): 391 protocols.append(extend_bp(outname, protocol, iface['name'])) 457 proto = extend_bp(outname, protocol, iface['name']) 458 for _ in range(0, cnt): 459 protocols.append(proto) 392 460 else: 393 461 print "%s: Provided interface '%s' is undefined" % (frame['name'], provides['iface']) 394 462 395 outf = file(outname, "w") 396 outf.write(parse_bp(outname, merge_bp(protocols), 0)) 397 outf.close() 463 if (opt_bp): 464 outf = file(outname, "w") 465 outf.write(parse_bp(outname, merge_bp(initialization, finalization, protocols), 0)) 466 outf.close() 467 468 if (opt_ebp): 469 outf = file(outname, "w") 470 outf.write(parse_ebp(frame['name'], outname, merge_bp(initialization, finalization, protocols), 0)) 471 outf.close() 398 472 399 473 def get_system_arch(): … … 431 505 "Create null frame protocol" 432 506 433 archf.write("frame \"%s\"\n" % fname) 507 global opt_bp 508 global opt_ebp 509 510 if (archf != None): 511 archf.write("frame \"%s\"\n" % fname) 512 434 513 outname = os.path.join(outdir, fname) 435 514 436 outf = file(outname, "w") 437 outf.write("NULL") 438 outf.close() 515 if (opt_bp): 516 outf = file(outname, "w") 517 outf.write("NULL") 518 outf.close() 519 520 if (opt_ebp): 521 outf = file(outname, "w") 522 outf.write("component null {\n\tbehavior {\n\t\tNULL\n\t}\n}") 523 outf.close() 439 524 440 525 def flatten_binds(binds, delegates, subsumes): … … 480 565 return result 481 566 482 def merge_ subarch(prefix, arch, outdir):483 "Merge subarchitecture into archite xture"567 def merge_arch(prefix, arch, outdir): 568 "Merge subarchitecture into architecture" 484 569 485 570 insts = [] … … 492 577 subarch = get_arch(inst['type']) 493 578 if (not subarch is None): 494 (subinsts, subbinds, subdelegates, subsubsumes) = merge_ subarch("%s_%s" % (prefix, subarch['name']), subarch, outdir)579 (subinsts, subbinds, subdelegates, subsubsumes) = merge_arch("%s_%s" % (prefix, subarch['name']), subarch, outdir) 495 580 insts.extend(subinsts) 496 581 binds.extend(subbinds) … … 521 606 "Dump system architecture Behavior Protocol" 522 607 608 global opt_bp 609 global opt_ebp 610 523 611 arch = get_system_arch() 524 612 … … 536 624 subarch = get_arch(inst['type']) 537 625 if (not subarch is None): 538 (subinsts, subbinds, subdelegates, subsubsumes) = merge_ subarch(subarch['name'], subarch, outdir)626 (subinsts, subbinds, subdelegates, subsubsumes) = merge_arch(subarch['name'], subarch, outdir) 539 627 insts.extend(subinsts) 540 628 binds.extend(subbinds) … … 562 650 break 563 651 652 directed_binds = direct_binds(flatten_binds(binds, delegates, subsumes)) 653 564 654 outname = os.path.join(outdir, "%s.archbp" % arch['name']) 565 outf = file(outname, "w") 655 if ((opt_bp) or (opt_ebp)): 656 outf = file(outname, "w") 657 else: 658 outf = None 566 659 567 660 create_null_bp("null.bp", outdir, outf) 568 661 569 662 for inst in insts: 570 dump_frame(inst['frame'], outdir, inst['var'], outf) 571 572 directed_binds = direct_binds(flatten_binds(binds, delegates, subsumes)) 663 dump_frame(directed_binds, inst['frame'], outdir, inst['var'], outf) 573 664 574 665 for dst, src in directed_binds.items(): 575 outf.write("bind %s to %s\n" % (", ".join(src), dst)) 576 577 outf.close() 666 if (outf != None): 667 outf.write("bind %s to %s\n" % (", ".join(src), dst)) 668 669 if (outf != None): 670 outf.close() 578 671 579 672 def preproc_adl(raw, inarg): … … 591 684 global frame 592 685 global protocol 686 global initialization 687 global finalization 593 688 594 689 global iface_properties … … 689 784 690 785 if (BODY in context): 786 if (FINALIZATION in context): 787 if (token == "{"): 788 indent += 1 789 elif (token == "}"): 790 indent -= 1 791 792 if (((token[-1] == ":") and (indent == 0)) or (indent == -1)): 793 bp = split_bp(finalization) 794 finalization = None 795 796 if (not frame in frame_properties): 797 frame_properties[frame] = {} 798 799 if ('finalization' in frame_properties[frame]): 800 print "%s: Finalization protocol for frame '%s' already defined" % (inname, frame) 801 else: 802 frame_properties[frame]['finalization'] = bp 803 804 output += "\n%s" % tabs(2) 805 output += parse_bp(inname, bp, 2) 806 807 context.remove(FINALIZATION) 808 if (indent == -1): 809 output += "\n%s" % token 810 context.remove(BODY) 811 context.add(NULL) 812 indent = 0 813 continue 814 else: 815 indent = 2 816 else: 817 finalization += token 818 continue 819 820 if (INITIALIZATION in context): 821 if (token == "{"): 822 indent += 1 823 elif (token == "}"): 824 indent -= 1 825 826 if (((token[-1] == ":") and (indent == 0)) or (indent == -1)): 827 bp = split_bp(initialization) 828 initialization = None 829 830 if (not frame in frame_properties): 831 frame_properties[frame] = {} 832 833 if ('initialization' in frame_properties[frame]): 834 print "%s: Initialization protocol for frame '%s' already defined" % (inname, frame) 835 else: 836 frame_properties[frame]['initialization'] = bp 837 838 output += "\n%s" % tabs(2) 839 output += parse_bp(inname, bp, 2) 840 841 context.remove(INITIALIZATION) 842 if (indent == -1): 843 output += "\n%s" % token 844 context.remove(BODY) 845 context.add(NULL) 846 indent = 0 847 continue 848 else: 849 indent = 2 850 else: 851 initialization += token 852 continue 853 691 854 if (PROTOCOL in context): 692 855 if (token == "{"): … … 695 858 indent -= 1 696 859 697 if ( indent == -1):860 if (((token[-1] == ":") and (indent == 0)) or (indent == -1)): 698 861 bp = split_bp(protocol) 699 862 protocol = None … … 709 872 output += "\n%s" % tabs(2) 710 873 output += parse_bp(inname, bp, 2) 711 output += "\n%s" % token712 indent = 0713 874 714 875 context.remove(PROTOCOL) 715 context.remove(BODY) 716 context.add(NULL) 876 if (indent == -1): 877 output += "\n%s" % token 878 context.remove(BODY) 879 context.add(NULL) 880 indent = 0 881 continue 882 else: 883 indent = 2 717 884 else: 718 885 protocol += token 719 720 continue 886 continue 721 887 722 888 if (REQUIRES in context): … … 816 982 output += "\n%s%s" % (tabs(indent - 1), token) 817 983 context.add(PROVIDES) 818 protocol = ""819 984 continue 820 985 … … 822 987 output += "\n%s%s" % (tabs(indent - 1), token) 823 988 context.add(REQUIRES) 824 protocol = "" 989 continue 990 991 if (token == "initialization:"): 992 output += "\n%s%s" % (tabs(indent - 1), token) 993 indent = 0 994 context.add(INITIALIZATION) 995 initialization = "" 996 continue 997 998 if (token == "finalization:"): 999 output += "\n%s%s" % (tabs(indent - 1), token) 1000 indent = 0 1001 context.add(FINALIZATION) 1002 finalization = "" 825 1003 continue 826 1004 … … 1012 1190 print "%s: Expected inherited interface name in interface head '%s'" % (inname, interface) 1013 1191 else: 1014 output += " %s" % token1192 output += "%s " % token 1015 1193 if (not interface in iface_properties): 1016 1194 iface_properties[interface] = {} … … 1023 1201 1024 1202 if (token == "extends"): 1025 output += " %s" % token1203 output += "%s " % token 1026 1204 context.add(EXTENDS) 1027 1205 continue … … 1376 1554 global frame 1377 1555 global protocol 1556 global initialization 1557 global finalization 1378 1558 1379 1559 global arg0 1560 1561 global opt_adl 1380 1562 1381 1563 output = "" … … 1385 1567 frame = None 1386 1568 protocol = None 1569 initialization = None 1570 finalization = None 1387 1571 arg0 = None 1388 1572 … … 1390 1574 output = output.strip() 1391 1575 1392 if ( output != ""):1576 if ((output != "") and (opt_adl)): 1393 1577 outf = file(outname, "w") 1394 1578 outf.write(output) … … 1411 1595 if (os.path.isdir(canon)): 1412 1596 recursion(base, canon, output, level + 1) 1597 1598 def merge_dot_frame(prefix, name, frame, outf, indent): 1599 "Dump Dot frame" 1600 1601 outf.write("%ssubgraph cluster_%s {\n" % (tabs(indent), prefix)) 1602 outf.write("%s\tlabel=\"%s\";\n" % (tabs(indent), name)) 1603 outf.write("%s\tstyle=filled;\n" % tabs(indent)) 1604 outf.write("%s\tcolor=red;\n" % tabs(indent)) 1605 outf.write("%s\tfillcolor=yellow;\n" % tabs(indent)) 1606 outf.write("%s\t\n" % tabs(indent)) 1607 1608 if ('provides' in frame): 1609 outf.write("%s\t%s__provides [label=\"\", shape=doublecircle, style=filled, color=green, fillcolor=yellow];\n" % (tabs(indent), prefix)) 1610 1611 if ('requires' in frame): 1612 outf.write("%s\t%s__requires [label=\"\", shape=circle, style=filled, color=red, fillcolor=yellow];\n" % (tabs(indent), prefix)) 1613 1614 outf.write("%s}\n" % tabs(indent)) 1615 outf.write("%s\n" % tabs(indent)) 1616 1617 def merge_dot_arch(prefix, name, arch, outf, indent): 1618 "Dump Dot subarchitecture" 1619 1620 outf.write("%ssubgraph cluster_%s {\n" % (tabs(indent), prefix)) 1621 outf.write("%s\tlabel=\"%s\";\n" % (tabs(indent), name)) 1622 outf.write("%s\tcolor=red;\n" % tabs(indent)) 1623 outf.write("%s\t\n" % tabs(indent)) 1624 1625 if ('inst' in arch): 1626 for inst in arch['inst']: 1627 subarch = get_arch(inst['type']) 1628 if (not subarch is None): 1629 merge_dot_arch("%s_%s" % (prefix, inst['var']), inst['var'], subarch, outf, indent + 1) 1630 else: 1631 subframe = get_frame(inst['type']) 1632 if (not subframe is None): 1633 merge_dot_frame("%s_%s" % (prefix, inst['var']), inst['var'], subframe, outf, indent + 1) 1634 else: 1635 print "%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']) 1636 1637 if ('bind' in arch): 1638 labels = {} 1639 for bind in arch['bind']: 1640 if (bind['from'][1] != bind['to'][1]): 1641 label = "%s:%s" % (bind['from'][1], bind['to'][1]) 1642 else: 1643 label = bind['from'][1] 1644 1645 if (not (bind['from'][0], bind['to'][0]) in labels): 1646 labels[(bind['from'][0], bind['to'][0])] = [] 1647 1648 labels[(bind['from'][0], bind['to'][0])].append(label) 1649 1650 for bind in arch['bind']: 1651 if (not (bind['from'][0], bind['to'][0]) in labels): 1652 continue 1653 1654 attrs = [] 1655 1656 if (bind['from'][0] != bind['to'][0]): 1657 attrs.append("ltail=cluster_%s_%s" % (prefix, bind['from'][0])) 1658 attrs.append("lhead=cluster_%s_%s" % (prefix, bind['to'][0])) 1659 1660 attrs.append("label=\"%s\"" % "\\n".join(labels[(bind['from'][0], bind['to'][0])])) 1661 del labels[(bind['from'][0], bind['to'][0])] 1662 1663 outf.write("%s\t%s_%s__requires -> %s_%s__provides [%s];\n" % (tabs(indent), prefix, bind['from'][0], prefix, bind['to'][0], ", ".join(attrs))) 1664 1665 if ('delegate' in arch): 1666 outf.write("%s\t%s__provides [label=\"\", shape=doublecircle, color=green];\n" % (tabs(indent), prefix)) 1667 1668 labels = {} 1669 for delegate in arch['delegate']: 1670 if (delegate['from'] != delegate['to'][1]): 1671 label = "%s:%s" % (delegate['from'], delegate['to'][1]) 1672 else: 1673 label = delegate['from'] 1674 1675 if (not delegate['to'][0] in labels): 1676 labels[delegate['to'][0]] = [] 1677 1678 labels[delegate['to'][0]].append(label) 1679 1680 for delegate in arch['delegate']: 1681 if (not delegate['to'][0] in labels): 1682 continue 1683 1684 attrs = [] 1685 attrs.append("color=gray") 1686 attrs.append("lhead=cluster_%s_%s" % (prefix, delegate['to'][0])) 1687 attrs.append("label=\"%s\"" % "\\n".join(labels[delegate['to'][0]])) 1688 del labels[delegate['to'][0]] 1689 1690 outf.write("%s\t%s__provides -> %s_%s__provides [%s];\n" % (tabs(indent), prefix, prefix, delegate['to'][0], ", ".join(attrs))) 1691 1692 if ('subsume' in arch): 1693 outf.write("%s\t%s__requires [label=\"\", shape=circle, color=red];\n" % (tabs(indent), prefix)) 1694 1695 labels = {} 1696 for subsume in arch['subsume']: 1697 if (subsume['from'][1] != subsume['to']): 1698 label = "%s:%s" % (subsume['from'][1], subsume['to']) 1699 else: 1700 label = subsume['to'] 1701 1702 if (not subsume['from'][0] in labels): 1703 labels[subsume['from'][0]] = [] 1704 1705 labels[subsume['from'][0]].append(label) 1706 1707 for subsume in arch['subsume']: 1708 if (not subsume['from'][0] in labels): 1709 continue 1710 1711 attrs = [] 1712 attrs.append("color=gray") 1713 attrs.append("ltail=cluster_%s_%s" % (prefix, subsume['from'][0])) 1714 attrs.append("label=\"%s\"" % "\\n".join(labels[subsume['from'][0]])) 1715 del labels[subsume['from'][0]] 1716 1717 outf.write("%s\t%s_%s__requires -> %s__requires [%s];\n" % (tabs(indent), prefix, subsume['from'][0], prefix, ", ".join(attrs))) 1718 1719 outf.write("%s}\n" % tabs(indent)) 1720 outf.write("%s\n" % tabs(indent)) 1721 1722 def dump_dot(outdir): 1723 "Dump Dot architecture" 1724 1725 global opt_dot 1726 1727 arch = get_system_arch() 1728 1729 if (arch is None): 1730 print "Unable to find system architecture" 1731 return 1732 1733 if (opt_dot): 1734 outname = os.path.join(outdir, "%s.dot" % arch['name']) 1735 outf = file(outname, "w") 1736 1737 outf.write("digraph {\n") 1738 outf.write("\tlabel=\"%s\";\n" % arch['name']) 1739 outf.write("\tcompound=true;\n") 1740 outf.write("\tsplines=\"polyline\";\n") 1741 outf.write("\tedge [fontsize=8];\n") 1742 outf.write("\t\n") 1743 1744 if ('inst' in arch): 1745 for inst in arch['inst']: 1746 subarch = get_arch(inst['type']) 1747 if (not subarch is None): 1748 merge_dot_arch(inst['var'], inst['var'], subarch, outf, 1) 1749 else: 1750 subframe = get_frame(inst['type']) 1751 if (not subframe is None): 1752 merge_dot_frame("%s" % inst['var'], inst['var'], subframe, outf, 1) 1753 else: 1754 print "%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']) 1755 1756 if ('bind' in arch): 1757 labels = {} 1758 for bind in arch['bind']: 1759 if (bind['from'][1] != bind['to'][1]): 1760 label = "%s:%s" % (bind['from'][1], bind['to'][1]) 1761 else: 1762 label = bind['from'][1] 1763 1764 if (not (bind['from'][0], bind['to'][0]) in labels): 1765 labels[(bind['from'][0], bind['to'][0])] = [] 1766 1767 labels[(bind['from'][0], bind['to'][0])].append(label) 1768 1769 for bind in arch['bind']: 1770 if (not (bind['from'][0], bind['to'][0]) in labels): 1771 continue 1772 1773 attrs = [] 1774 1775 if (bind['from'][0] != bind['to'][0]): 1776 attrs.append("ltail=cluster_%s" % bind['from'][0]) 1777 attrs.append("lhead=cluster_%s" % bind['to'][0]) 1778 1779 attrs.append("label=\"%s\"" % "\\n".join(labels[(bind['from'][0], bind['to'][0])])) 1780 del labels[(bind['from'][0], bind['to'][0])] 1781 1782 outf.write("\t%s__requires -> %s__provides [%s];\n" % (bind['from'][0], bind['to'][0], ", ".join(attrs))) 1783 1784 if ('delegate' in arch): 1785 for delegate in arch['delegate']: 1786 print "Unable to delegate interface in system architecture" 1787 break 1788 1789 if ('subsume' in arch): 1790 for subsume in arch['subsume']: 1791 print "Unable to subsume interface in system architecture" 1792 break 1793 1794 outf.write("}\n") 1795 1796 outf.close() 1413 1797 1414 1798 def main(): … … 1416 1800 global frame_properties 1417 1801 global arch_properties 1418 1419 if (len(sys.argv) < 2): 1802 global opt_bp 1803 global opt_ebp 1804 global opt_adl 1805 global opt_dot 1806 1807 if (len(sys.argv) < 3): 1420 1808 usage(sys.argv[0]) 1421 1809 return 1422 1810 1423 path = os.path.abspath(sys.argv[1]) 1811 opt_bp = False 1812 opt_ebp = False 1813 opt_adl = False 1814 opt_dot = False 1815 1816 for arg in sys.argv[1:(len(sys.argv) - 1)]: 1817 if (arg == "--bp"): 1818 opt_bp = True 1819 elif (arg == "--ebp"): 1820 opt_ebp = True 1821 elif (arg == "--adl"): 1822 opt_adl = True 1823 elif (arg == "--dot"): 1824 opt_dot = True 1825 elif (arg == "--nop"): 1826 pass 1827 else: 1828 print "Error: Unknown command line option '%s'" % arg 1829 return 1830 1831 if ((opt_bp) and (opt_ebp)): 1832 print "Error: Cannot dump both original Behavior Protocols and Extended Behavior Protocols" 1833 return 1834 1835 path = os.path.abspath(sys.argv[-1]) 1424 1836 if (not os.path.isdir(path)): 1425 1837 print "Error: <OUTPUT> is not a directory" … … 1432 1844 recursion(".", ".", path, 0) 1433 1845 dump_archbp(path) 1846 dump_dot(path) 1434 1847 1435 1848 if __name__ == '__main__': -
contrib/arch/kernel/kernel.adl
rbbddafb r4f5dc18 7 7 unative_t sys_klog(int fd, const void *buf, size_t size); 8 8 protocol: 9 ?sys_klog 9 ?sys_klog* 10 10 }; 11 11 … … 17 17 unative_t sys_debug_disable_console(void); 18 18 protocol: 19 ?sys_debug_enable_console + 20 ?sys_debug_disable_console 19 ( 20 ?sys_debug_enable_console + 21 ?sys_debug_disable_console 22 )* 21 23 }; 22 24 … … 25 27 unative_t sys_tls_set(unative_t addr); 26 28 protocol: 27 ?sys_tls_set 29 ?sys_tls_set* 28 30 }; 29 31 … … 38 40 unative_t sys_thread_get_id(thread_id_t *uspace_thread_id); 39 41 protocol: 40 ?sys_thread_create + 41 ?sys_thread_get_id + 42 ?sys_thread_exit 42 ( 43 ?sys_thread_create + 44 ?sys_thread_get_id + 45 ?sys_thread_exit 46 )* 43 47 }; 44 48 … … 50 54 unative_t sys_task_get_id(task_id_t *uspace_task_id); 51 55 protocol: 52 ?sys_task_set_name + 53 ?sys_task_get_id 56 ( 57 ?sys_task_set_name + 58 ?sys_task_get_id 59 )* 54 60 }; 55 61 … … 58 64 unative_t sys_program_spawn_loader(char *uspace_name, size_t name_len); 59 65 protocol: 60 ?sys_program_spawn_loader 66 ?sys_program_spawn_loader* 61 67 }; 62 68 … … 68 74 unative_t sys_futex_wakeup(uintptr_t uaddr); 69 75 protocol: 70 ?sys_futex_sleep_timeout + 71 ?sys_futex_wakeup 76 ( 77 ?sys_futex_sleep_timeout + 78 ?sys_futex_wakeup 79 )* 72 80 }; 73 81 … … 76 84 unative_t sys_smc_coherence(uintptr_t va, size_t size); 77 85 protocol: 78 ?sys_smc_coherence 86 ?sys_smc_coherence* 79 87 }; 80 88 … … 92 100 unative_t sys_as_area_destroy(uintptr_t address); 93 101 protocol: 94 ?sys_as_area_create + 95 ?sys_as_area_resize + 96 ?sys_as_area_change_flags + 97 ?sys_as_area_destroy 102 ( 103 ?sys_as_area_create + 104 ?sys_as_area_resize + 105 ?sys_as_area_change_flags + 106 ?sys_as_area_destroy 107 )* 98 108 }; 99 109 … … 132 142 unative_t sys_ipc_poke(void); 133 143 protocol: 134 ?sys_ipc_call_sync_fast + 135 ?sys_ipc_call_sync_slow + 136 ?sys_ipc_call_async_fast + 137 ?sys_ipc_call_async_slow + 138 ?sys_ipc_forward_fast + 139 ?sys_ipc_forward_slow + 140 ?sys_ipc_answer_fast + 141 ?sys_ipc_answer_slow + 142 ?sys_ipc_hangup + 143 ?sys_ipc_wait_for_call + 144 ?sys_ipc_poke 144 ( 145 ?sys_ipc_call_sync_fast + 146 ?sys_ipc_call_sync_slow + 147 ?sys_ipc_call_async_fast + 148 ?sys_ipc_call_async_slow + 149 ?sys_ipc_forward_fast + 150 ?sys_ipc_forward_slow + 151 ?sys_ipc_answer_fast + 152 ?sys_ipc_answer_slow + 153 ?sys_ipc_hangup + 154 ?sys_ipc_wait_for_call + 155 ?sys_ipc_poke 156 )* 145 157 }; 146 158 … … 149 161 unative_t sys_event_subscribe(unative_t evno, unative_t method); 150 162 protocol: 151 ?sys_event_subscribe 163 ?sys_event_subscribe* 152 164 }; 153 165 … … 159 171 unative_t sys_cap_revoke(sysarg64_t *uspace_taskid_arg, cap_t caps); 160 172 protocol: 161 ?sys_cap_grant + 162 ?sys_cap_rewoke 173 ( 174 ?sys_cap_grant + 175 ?sys_cap_rewoke 176 )* 163 177 }; 164 178 … … 182 196 unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno); 183 197 protocol: 184 ?sys_enable_iospace + 185 ?sys_physmem_map + 186 ?sys_device_assign_devno + 187 ?sys_preempt_control + 188 ?sys_ipc_register_irq + 189 ?sys_ipc_unregister_irq 198 ( 199 ?sys_enable_iospace + 200 ?sys_physmem_map + 201 ?sys_device_assign_devno + 202 ?sys_preempt_control + 203 ?sys_ipc_register_irq + 204 ?sys_ipc_unregister_irq 205 )* 190 206 }; 191 207 … … 197 213 unative_t sys_sysinfo_value(unatice_t ptr, unative_t len); 198 214 protocol: 199 ?sys_sysinfo_valid + 200 ?sys_sysinfo_value 215 ( 216 ?sys_sysinfo_valid + 217 ?sys_sysinfo_value 218 )* 201 219 }; 202 220 … … 205 223 unative_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid_arg); 206 224 protocol: 207 ?sys_ipc_connect_kbox 225 ?sys_ipc_connect_kbox* 208 226 }; 209 227 -
contrib/arch/uspace/app/klog/klog.adl
rbbddafb r4f5dc18 3 3 naming_service ns; 4 4 [/uspace/lib/libc/requires] 5 initialization: 6 !ns.ipc_m_share_in /* SERVICE_MEM_KLOG */ 5 7 protocol: 6 [/uspace/lib/libc/protocol] | 7 [klog.bp] 8 [/uspace/lib/libc/protocol] 8 9 }; -
contrib/arch/uspace/lib/libfs/fnc.libfs_lookup
rbbddafb r4f5dc18 1 1 ( 2 alternative (fs; tmpfs ; fat; devfs) {2 alternative (fs; tmpfs_nested; fat_nested; devfs_nested) { 3 3 !fs.lookup 4 4 } -
contrib/arch/uspace/lib/libfs/fnc.libfs_mount
rbbddafb r4f5dc18 2 2 ?ipc_m_connection_clone ; 3 3 ?ipc_m_data_write /* mount options */ { 4 alternative (fs; tmpfs ; fat; devfs) {4 alternative (fs; tmpfs_nested; fat_nested; devfs_nested) { 5 5 !fs.ipc_m_connect_to_me ; 6 !fs.mounted ; 7 !fs.ipc_m_data_write /* forward */ 6 !fs.mounted { 7 !fs.ipc_m_data_write /* forward */ 8 } 8 9 } 9 10 } -
contrib/arch/uspace/lib/libfs/fnc.libfs_stat
rbbddafb r4f5dc18 1 1 ( 2 ? fs.ipc_m_data_read2 ?ipc_m_data_read 3 3 ) -
contrib/arch/uspace/srv/bd/rd/rd.adl
rbbddafb r4f5dc18 8 8 ns ns; 9 9 devmap_driver devmap_driver; 10 initialization: 11 [/uspace/lib/libc/fnc.devmap_driver_register] ; 12 [/uspace/lib/libc/fnc.devmap_device_register] 10 13 protocol: 11 [/uspace/lib/libc/protocol] | 12 [rd.bp] 14 [/uspace/lib/libc/protocol] 13 15 }; -
contrib/arch/uspace/srv/console/console.adl
rbbddafb r4f5dc18 48 48 requires: 49 49 [/uspace/lib/libc/requires] 50 ns ns; 51 devmap_driver devmap_driver; 52 sys_console sys_console; 50 53 kbd kbd; 51 54 fb fb; 52 ns ns; 53 sys_console sys_console; 55 initialization: 56 !ns.ipc_m_connect_me_to /* kbd */ ; 57 !kbd.ipc_m_connect_to_me ; 58 !ns.ipc_m_connect_me_to /* fb */ ; 59 [/uspace/lib/libc/fnc.devmap_driver_register] ; 60 !fb.get_resolution ; 61 ( 62 [fnc.vp_create] + 63 [fnc.vp_switch] 64 )* ; 65 [fnc.make_pixmap]* ; 66 [fnc.make_anim] ; 67 [fnc.vp_switch] ; 68 !fb.flush ; 69 !fb.get_csize ; 70 !fb.get_color_cap ; 71 !fb.ipc_m_share_out ; 72 [/uspace/lib/libc/fnc.devmap_device_register]* ; 73 !sys_console.sys_debug_disable_console ; 74 [fnc.gcons_redraw_console] ; 75 [fnc.set_rgb_color] ; 76 [fnc.screen_clear] ; 77 [fnc.curs_goto] ; 78 [fnc.curs_visibility] 54 79 protocol: 55 [/uspace/lib/libc/protocol] | 56 [console_server.bp] 80 [/uspace/lib/libc/protocol] 57 81 }; 58 82 … … 68 92 69 93 delegate console to ui_dispatcher:console; 94 delegate kbd to kbd:kbd; 95 delegate fb to fb:fb; 70 96 71 97 [/uspace/lib/libc/subsume%ui_dispatcher] … … 74 100 75 101 subsume ui_dispatcher:ns to ns; 102 subsume ui_dispatcher:devmap_driver to devmap_driver; 76 103 subsume ui_dispatcher:sys_console to sys_console; 77 104 -
contrib/arch/uspace/srv/console/console.bp
rbbddafb r4f5dc18 59 59 60 60 ?kcon_enable { 61 !sys_console.sys_ enable_console61 !sys_console.sys_debug_enable_console 62 62 } + 63 63 -
contrib/arch/uspace/srv/devmap/devmap.adl
rbbddafb r4f5dc18 63 63 [/uspace/lib/libc/requires] 64 64 ns ns; 65 rd rd; 66 console console; 67 initialization: 68 !ns.ipc_m_connect_to_me /* devmap */ 65 69 protocol: 66 [/uspace/lib/libc/protocol] | 67 [devmap_server.bp] 70 [/uspace/lib/libc/protocol] 68 71 }; -
contrib/arch/uspace/srv/devmap/devmap_driver.bp
rbbddafb r4f5dc18 9 9 tentative { 10 10 ?ipc_m_data_write /* device name */ 11 } ; 12 tentative { 13 ?ipc_m_connect_to_me /* callback */ 11 14 } 12 15 } + -
contrib/arch/uspace/srv/fb/fb.adl
rbbddafb r4f5dc18 105 105 [/uspace/lib/libc/requires] 106 106 ns ns; 107 initialization: 108 !ns.ipc_m_connect_to_me /* fb */ 107 109 protocol: 108 [/uspace/lib/libc/protocol] | 109 [fb_server.bp] 110 [/uspace/lib/libc/protocol] 110 111 }; -
contrib/arch/uspace/srv/fs/devfs/devfs.adl
rbbddafb r4f5dc18 13 13 devmap_client devmap_client; 14 14 service device; 15 initialization: 16 [/uspace/lib/libc/fnc.devmap_get_phone] ; 17 !ns.ipc_m_connect_me_to /* vfs */ ; 18 [/uspace/lib/libfs/fnc.fs_register] 15 19 protocol: 16 [/uspace/lib/libc/protocol] | 17 [devfs_server.bp] 20 [/uspace/lib/libc/protocol] 18 21 }; -
contrib/arch/uspace/srv/fs/fat/fat.adl
rbbddafb r4f5dc18 9 9 requires: 10 10 [/uspace/lib/libc/requires] 11 vfs vfs;12 11 ns ns; 13 12 rd rd; 13 vfs vfs; 14 tmpfs tmpfs_nested; 15 fat fat_nested; 16 devfs devfs_nested; 17 initialization: 18 !ns.ipc_m_connect_me_to /* vfs */ ; 19 [/uspace/lib/libfs/fnc.fs_register] 14 20 protocol: 15 [/uspace/lib/libc/protocol] | 16 [fat_server.bp] 21 [/uspace/lib/libc/protocol] 17 22 }; -
contrib/arch/uspace/srv/fs/tmpfs/tmpfs.adl
rbbddafb r4f5dc18 9 9 requires: 10 10 [/uspace/lib/libc/requires] 11 vfs vfs;12 11 ns ns; 13 12 rd rd; 13 vfs vfs; 14 tmpfs tmpfs_nested; 15 fat fat_nested; 16 devfs devfs_nested; 17 initialization: 18 !ns.ipc_m_connect_me_to /* vfs */ ; 19 [/uspace/lib/libfs/fnc.fs_register] 14 20 protocol: 15 [/uspace/lib/libc/protocol] | 16 [tmpfs_server.bp] 21 [/uspace/lib/libc/protocol] 17 22 }; -
contrib/arch/uspace/srv/kbd/kbd.adl
rbbddafb r4f5dc18 26 26 event event; 27 27 ns ns; 28 initialization: 29 !ns.ipc_m_connect_to_me /* kbd */ ; 30 !event.event* 28 31 protocol: 29 [/uspace/lib/libc/protocol] | 30 [kbd_server.bp] 32 [/uspace/lib/libc/protocol] 31 33 }; -
contrib/arch/uspace/srv/loader/loader.adl
rbbddafb r4f5dc18 27 27 [/uspace/lib/libc/requires] 28 28 ns ns; 29 initialization: 30 !ns.id_intro ; 31 !ns.ipc_m_connect_to_me /* loader */ 29 32 protocol: 30 [/uspace/lib/libc/protocol] | 31 [loader_server.bp] 33 [/uspace/lib/libc/protocol] 32 34 }; -
contrib/arch/uspace/srv/ns/ns.adl
rbbddafb r4f5dc18 32 32 requires: 33 33 [/uspace/lib/libc/requires] 34 kbd kbd; 35 fb fb; 36 console console; 37 vfs vfs; 38 devmap_driver devmap_driver; 39 devmap_client devmap_client; 40 loader loader; 34 41 protocol: 35 42 [/uspace/lib/libc/protocol] -
contrib/arch/uspace/srv/ns/ns.bp
rbbddafb r4f5dc18 11 11 ?ipc_m_connect_me_to { 12 12 tentative { 13 alternative (service; kbd; fb; console; vfs; devmap ) {13 alternative (service; kbd; fb; console; vfs; devmap_driver; devmap_client) { 14 14 !service.ipc_m_connect_me_to /* forward */ 15 15 } -
contrib/arch/uspace/srv/pci/pci.adl
rbbddafb r4f5dc18 10 10 [/uspace/lib/libc/requires] 11 11 ns ns; 12 initialization: 13 !ns.ipc_m_connect_to_me /* pci */ 12 14 protocol: 13 [/uspace/lib/libc/protocol] | 14 [pci_server.bp] 15 [/uspace/lib/libc/protocol] 15 16 }; -
contrib/arch/uspace/srv/vfs/vfs.adl
rbbddafb r4f5dc18 88 88 requires: 89 89 [/uspace/lib/libc/requires] 90 ns ns; 90 91 tmpfs tmpfs; 91 92 fat fat; 92 93 devfs devfs; 93 ns ns; 94 initialization: 95 !ns.ipc_m_connect_to_me /* vfs */ 94 96 protocol: 95 [/uspace/lib/libc/protocol] | 96 [vfs_server.bp] 97 [/uspace/lib/libc/protocol] 97 98 }; 98 99 … … 110 111 bind fat:vfs to io_dispatcher:vfs; 111 112 bind devfs:vfs to io_dispatcher:vfs; 113 114 bind tmpfs:tmpfs_nested to tmpfs:tmpfs; 115 bind tmpfs:fat_nested to fat:fat; 116 bind tmpfs:devfs_nested to devfs:devfs; 117 118 bind fat:tmpfs_nested to tmpfs:tmpfs; 119 bind fat:fat_nested to fat:fat; 120 bind fat:devfs_nested to devfs:devfs; 112 121 113 122 delegate vfs to io_dispatcher:vfs; -
contrib/arch/uspace/srv/vfs/vfs.bp
rbbddafb r4f5dc18 22 22 /* root fs */ 23 23 alternative (fs; tmpfs; fat; devfs) { 24 !fs.mounted ; 25 !fs.ipc_m_data_write /* mount options */ 24 !fs.mounted { 25 !fs.ipc_m_data_write /* mount options */ 26 } 26 27 } 27 28 ) + … … 93 94 alternative (fs; tmpfs; fat; devfs) { 94 95 [fnc.vfs_grab_phone] ; 95 !fs.read ; 96 !fs.ipc_m_data_read /* forward payload */ ; 96 !fs.read { 97 !fs.ipc_m_data_read /* forward payload */ 98 } ; 97 99 [fnc.vfs_release_phone] 98 100 } … … 106 108 alternative (fs; tmpfs; fat; devfs) { 107 109 [fnc.vfs_grab_phone] ; 108 !fs.write ; 109 !fs.ipc_m_data_write /* forward payload */ ; 110 !fs.write { 111 !fs.ipc_m_data_write /* forward payload */ 112 } ; 110 113 [fnc.vfs_release_phone] 111 114 } … … 129 132 alternative (fs; tmpfs; fat; devfs) { 130 133 [fnc.vfs_grab_phone] ; 131 !fs.stat ; 132 !fs.ipc_m_data_read /* forward struct stat */ ; 134 !fs.stat { 135 !fs.ipc_m_data_read /* forward struct stat */ 136 } ; 133 137 [fnc.vfs_release_phone] 134 138 } … … 144 148 [fnc.vfs_lookup_internal] ; 145 149 tentative { 146 !fs.stat ; 147 !fs.ipc_m_data_read /* forward struct stat */ 150 !fs.stat { 151 !fs.ipc_m_data_read /* forward struct stat */ 152 } 148 153 } 149 154 } -
contrib/highlight/adl.syntax
rbbddafb r4f5dc18 28 28 29 29 keyword whole protocol yellow 30 keyword whole initialization yellow 31 keyword whole finalization yellow 30 32 keyword whole provides yellow 31 33 keyword whole requires yellow -
contrib/toolchain.sh
rbbddafb r4f5dc18 92 92 } 93 93 94 patch_binutils() { 95 PLATFORM="$1" 96 97 if [ "${PLATFORM}" == "arm32" ] ; then 98 patch -p1 <<EOF 99 diff -Naur binutils-2.20.orig/gas/config/tc-arm.c binutils-2.20/gas/config/tc-arm.c 100 --- binutils-2.20.orig/gas/config/tc-arm.c 2009-08-30 00:10:59.000000000 +0200 101 +++ binutils-2.20/gas/config/tc-arm.c 2009-11-02 14:25:11.000000000 +0100 102 @@ -2485,8 +2485,9 @@ 103 know (frag->tc_frag_data.first_map == NULL); 104 frag->tc_frag_data.first_map = symbolP; 105 } 106 - if (frag->tc_frag_data.last_map != NULL) 107 + if (frag->tc_frag_data.last_map != NULL) { 108 know (S_GET_VALUE (frag->tc_frag_data.last_map) < S_GET_VALUE (symbolP)); 109 + } 110 frag->tc_frag_data.last_map = symbolP; 111 } 112 EOF 113 check_error $? "Error patching binutils" 114 fi 115 } 116 94 117 build_target() { 95 118 PLATFORM="$1" 96 119 TARGET="$2" 97 120 98 BINUTILS_VERSION="2. 19.1"99 GCC_VERSION="4.4. 1"121 BINUTILS_VERSION="2.20" 122 GCC_VERSION="4.4.2" 100 123 101 124 BINUTILS="binutils-${BINUTILS_VERSION}.tar.bz2" … … 119 142 120 143 echo ">>> Downloading tarballs" 121 download_check "${BINUTILS_SOURCE}" "${BINUTILS}" " 09a8c5821a2dfdbb20665bc0bd680791"122 download_check "${GCC_SOURCE}" "${GCC_CORE}" "d 19693308aa6b2052e14c071111df59f"123 download_check "${GCC_SOURCE}" "${GCC_OBJC}" " f7b2a606394036e81433b2f4c3251cba"124 download_check "${GCC_SOURCE}" "${GCC_CPP}" " d449047b5761348ceec23739f5553e0b"144 download_check "${BINUTILS_SOURCE}" "${BINUTILS}" "ee2d3e996e9a2d669808713360fa96f8" 145 download_check "${GCC_SOURCE}" "${GCC_CORE}" "d50ec5af20508974411d0c83c5f4e396" 146 download_check "${GCC_SOURCE}" "${GCC_OBJC}" "d8d26187d386a0591222a580b5a5b3d3" 147 download_check "${GCC_SOURCE}" "${GCC_CPP}" "43b1e4879eb282dc4b05e4c016d356d7" 125 148 126 149 echo ">>> Removing previous content" … … 142 165 cd "${BINUTILSDIR}" 143 166 check_error $? "Change directory failed." 167 patch_binutils "${PLATFORM}" 144 168 ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls" 145 169 check_error $? "Error configuring binutils."
Note:
See TracChangeset
for help on using the changeset viewer.
