Changes in / [e5d4294:743e17b] in mainline
- Files:
-
- 38 added
- 55 deleted
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
contrib/arch/HelenOS.adl
re5d4294 r743e17b 6 6 inst ns ns; 7 7 8 /* Loader (clonable service)*/9 inst loader loader;8 /* RAM disk */ 9 inst rd rd; 10 10 11 /* Block device */ 12 inst bd bd; 13 14 /* VFS server */ 15 inst vfs vfs; 16 17 /* Console */ 18 inst console console; 19 20 /* Kernel log */ 11 /* Klog */ 21 12 inst klog klog; 22 13 23 14 [/uspace/lib/libc/bind%ns] 24 [/uspace/lib/libc/bind%loader]25 [/uspace/lib/libc/bind%bd]26 [/uspace/lib/libc/bind%vfs]27 [/uspace/lib/libc/bind%console]28 [/uspace/lib/libc/bind%klog]29 15 30 bind loader:ns to ns:ns; 16 [/usrpace/lib/libc/bind%rd] 17 bind rd:ns to ns:ns; 18 bind rd:dm_driver to devmap:dm_driver; 31 19 32 bind bd:ns to ns:ns; 33 bind bd:devmap_driver to devmap:devmap_driver; 34 35 bind vfs:ns to ns:ns; 36 bind vfs:bd to bd:bd; 37 bind vfs:devmap_client to devmap:devmap_client; 38 bind vfs:device to console:console; 39 40 bind console:ns to ns:ns; 41 20 [/usrpace/lib/libc/bind%klog] 42 21 bind klog:ns to ns:ns; 43 22 }; -
contrib/arch/hadlbppp.py
re5d4294 r743e17b 34 34 import os 35 35 36 INC, POST_INC, BLOCK_COMMENT, LINE_COMMENT, SYSTEM, ARCH, HEAD, BODY, NULL, \37 INST, VAR, FIN, BIND, TO, SUBSUME, DELEGATE, IFACE, PROTOTYPE, PAR_LEFT, \38 PAR_RIGHT, SIGNATURE, PROTOCOL, FRAME, PROVIDES, REQUIRES = range(25)39 40 36 def usage(prname): 41 37 "Print usage syntax" 42 43 print "%s <OUTPUT>" % prname 38 print prname + " <OUTPUT>" 44 39 45 40 def tabs(cnt): … … 53 48 if (trim): 54 49 token = token.strip(" \t") 55 56 if (token != ""): 50 if (token != ""): 51 tokens.append(token) 52 else: 57 53 tokens.append(token) 58 54 59 55 return tokens 60 56 61 def split_tokens(string, delimiters, trim = False , separate = False):57 def split_tokens(string, delimiters, trim = False): 62 58 "Split string to tokens by delimiters, keep the delimiters" 63 59 … … 70 66 if (len(delim) > 0): 71 67 72 if (string[i:(i + len(delim))] == delim): 73 if (separate): 74 tokens = cond_append(tokens, string[last:i], trim) 75 tokens = cond_append(tokens, delim, trim) 76 last = i + len(delim) 77 elif (i > 0): 78 tokens = cond_append(tokens, string[last:i], trim) 79 last = i 80 68 if ((string[i:(i + len(delim))] == delim) and (i > 0)): 69 tokens = cond_append(tokens, string[last:i], trim) 70 last = i 81 71 i += len(delim) - 1 82 72 break … … 88 78 return tokens 89 79 90 def identifier(token):91 " Check whether the token is an identifier"80 def parse(fname, outf): 81 "Parse particular protocol" 92 82 93 i f (len(token) == 0):94 return False83 inf = file(fname, "r") 84 outf.write("### %s\n\n" % fname) 95 85 96 for i, char in enumerate(token): 97 if (i == 0): 98 if ((not char.isalpha()) and (char != "_")): 99 return False 100 else: 101 if ((not char.isalnum()) and (char != "_")): 102 return False 86 tokens = split_tokens(inf.read(), ["\n", " ", "\t", "(", ")", "{", "}", "[", "/*", "*/", "#", "*", ";", "+", "||", "|", "!", "?"], True) 103 87 104 return True 105 106 def descriptor(token): 107 "Check whether the token is an interface descriptor" 108 109 parts = token.split(":") 110 if (len(parts) != 2): 111 return False 112 113 return (identifier(parts[0]) and identifier(parts[1])) 114 115 def word(token): 116 "Check whether the token is a word" 117 118 if (len(token) == 0): 119 return False 120 121 for i, char in enumerate(token): 122 if ((not char.isalnum()) and (char != "_") and (char != ".")): 123 return False 124 125 return True 126 127 def preproc_bp(name, tokens): 128 "Preprocess tentative statements in Behavior Protocol" 129 130 result = [] 131 i = 0 132 133 while (i < len(tokens)): 134 if (tokens[i] == "tentative"): 135 if ((i + 1 < len(tokens)) and (tokens[i + 1] == "{")): 136 i += 2 137 start = i 138 level = 1 139 140 while ((i < len(tokens)) and (level > 0)): 141 if (tokens[i] == "{"): 142 level += 1 143 elif (tokens[i] == "}"): 144 level -= 1 145 146 i += 1 147 148 if (level == 0): 149 result.append("(") 150 result.extend(preproc_bp(name, tokens[start:(i - 1)])) 151 result.append(")") 152 result.append("+") 153 result.append("NULL") 154 if (i < len(tokens)): 155 result.append(tokens[i]) 156 else: 157 print "%s: Syntax error in tentative statement" % name 158 else: 159 print "%s: Unexpected token in tentative statement" % name 160 else: 161 result.append(tokens[i]) 162 163 i += 1 164 165 return result 166 167 def split_bp(protocol): 168 "Convert Behavior Protocol to tokens" 169 170 return split_tokens(protocol, ["\n", " ", "\t", "(", ")", "{", "}", "*", ";", "+", "||", "|", "!", "?"], True, True) 171 172 def extend_bp(name, tokens, iface): 173 "Add interface to incoming messages" 174 175 result = [] 176 i = 0 177 178 while (i < len(tokens)): 179 result.append(tokens[i]) 180 181 if (tokens[i] == "?"): 182 if (i + 1 < len(tokens)): 183 i += 1 184 parts = tokens[i].split(".") 185 186 if (len(parts) == 1): 187 result.append("%s.%s" % (iface, tokens[i])) 188 else: 189 result.append(tokens[i]) 190 else: 191 print "%s: Unexpected end of protocol" % name 192 193 i += 1 194 195 return result 196 197 def merge_bp(protocols): 198 "Merge several Behavior Protocols" 199 200 if (len(protocols) > 1): 201 result = [] 202 first = True 203 204 for protocol in protocols: 205 if (first): 206 first = False 207 else: 208 result.append("|") 209 210 result.append("(") 211 result.extend(protocol) 212 result.append(")") 213 214 return result 215 216 if (len(protocols) == 1): 217 return protocols[0] 218 219 return [] 220 221 def parse_bp(name, tokens, base_indent): 222 "Parse Behavior Protocol" 223 224 tokens = preproc_bp(name, tokens) 225 226 indent = base_indent 227 output = "" 88 empty = True 89 comment = False 90 lcomment = False 91 indent = 0 228 92 229 93 for token in tokens: 230 if (token == "\n"): 94 if (comment): 95 if (token == "*/"): 96 comment = False 231 97 continue 232 98 233 if ((token == ";") or (token == "+") or (token == "||") or (token == "|")): 234 output += " %s" % token 235 elif (token == "("): 236 output += "\n%s%s" % (tabs(indent), token) 237 indent += 1 238 elif (token == ")"): 239 if (indent < base_indent): 240 print "%s: Too many parentheses" % name 241 242 indent -= 1 243 output += "\n%s%s" % (tabs(indent), token) 244 elif (token == "{"): 245 output += " %s" % token 246 indent += 1 247 elif (token == "}"): 248 if (indent < base_indent): 249 print "%s: Too many parentheses" % name 250 251 indent -= 1 252 output += "\n%s%s" % (tabs(indent), token) 253 elif (token == "*"): 254 output += "%s" % token 255 elif ((token == "!") or (token == "?") or (token == "NULL")): 256 output += "\n%s%s" % (tabs(indent), token) 257 else: 258 output += "%s" % token 259 260 if (indent > base_indent): 261 print "%s: Missing parentheses" % name 262 263 output = output.strip() 264 if (output == ""): 265 return "NULL" 266 267 return output 268 269 def get_iface(name): 270 "Get interface by name" 271 272 global iface_properties 273 274 if (name in iface_properties): 275 return iface_properties[name] 276 277 return None 278 279 def dump_frame(frame, outdir): 280 "Dump Behavior Protocol of a given frame" 281 282 outname = os.path.join(outdir, "%s.bp" % frame['name']) 283 if (os.path.isfile(outname)): 284 print "%s: File already exists, overwriting" % outname 285 286 protocols = [] 287 if ('protocol' in frame): 288 protocols.append(frame['protocol']) 289 290 if ('provides' in frame): 291 for provides in frame['provides']: 292 iface = get_iface(provides['iface']) 293 if (not iface is None): 294 if ('protocol' in iface): 295 protocols.append(extend_bp(outname, iface['protocol'], iface['name'])) 296 else: 297 print "%s: Provided interface '%s' is undefined" % (frame['name'], provides['iface']) 298 299 outf = file(outname, "w") 300 outf.write(parse_bp(outname, merge_bp(protocols), 0)) 301 outf.close() 302 303 def get_system_arch(): 304 "Get system architecture" 305 306 global arch_properties 307 308 for arch, properties in arch_properties.items(): 309 if ('system' in properties): 310 return properties 311 312 return None 313 314 def get_arch(name): 315 "Get architecture by name" 316 317 global arch_properties 318 319 if (name in arch_properties): 320 return arch_properties[name] 321 322 return None 323 324 def get_frame(name): 325 "Get frame by name" 326 327 global frame_properties 328 329 if (name in frame_properties): 330 return frame_properties[name] 331 332 return None 333 334 def create_null_bp(name, outdir): 335 "Create null frame protocol" 336 337 outname = os.path.join(outdir, name) 338 if (not os.path.isfile(outname)): 339 outf = file(outname, "w") 340 outf.write("NULL") 341 outf.close() 342 343 def dump_arch(arch, outdir): 344 "Dump architecture Behavior Protocol" 345 346 outname = os.path.join(outdir, "%s.archbp" % arch['name']) 347 if (os.path.isfile(outname)): 348 print "%s: File already exists, overwriting" % outname 349 350 outf = file(outname, "w") 351 352 create_null_bp("null.bp", outdir) 353 outf.write("frame \"null.bp\"\n\n") 354 355 if ('inst' in arch): 356 for inst in arch['inst']: 357 subarch = get_arch(inst['type']) 358 if (not subarch is None): 359 outf.write("instantiate %s from \"%s.archbp\"\n" % (inst['var'], inst['type'])) 360 dump_arch(subarch, outdir) 361 else: 362 subframe = get_frame(inst['type']) 363 if (not subframe is None): 364 outf.write("instantiate %s from \"%s.bp\"\n" % (inst['var'], inst['type'])) 365 dump_frame(subframe, outdir) 366 else: 367 print "%s: '%s' is neither architecture nor frame" % (arch['name'], inst['type']) 368 369 outf.write("\n") 370 371 if ('bind' in arch): 372 for bind in arch['bind']: 373 outf.write("bind %s.%s to %s.%s\n" % (bind['from'][0], bind['from'][1], bind['to'][0], bind['to'][1])) 374 375 outf.close() 376 377 def preproc_adl(raw, inarg): 378 "Preprocess %% statements in ADL" 379 380 return raw.replace("%%", inarg) 381 382 def parse_adl(base, root, inname, nested, indent): 383 "Parse Architecture Description Language" 384 385 global output 386 global context 387 global architecture 388 global interface 389 global frame 390 global protocol 391 392 global iface_properties 393 global frame_properties 394 global arch_properties 395 396 global arg0 397 398 if (nested): 399 parts = inname.split("%") 400 401 if (len(parts) > 1): 402 inarg = parts[1] 403 else: 404 inarg = "%%" 405 406 if (parts[0][0:1] == "/"): 407 path = os.path.join(base, ".%s" % parts[0]) 408 nested_root = os.path.dirname(path) 409 else: 410 path = os.path.join(root, parts[0]) 411 nested_root = root 412 413 if (not os.path.isfile(path)): 414 print "%s: Unable to include file %s" % (inname, path) 415 return "" 416 else: 417 inarg = "%%" 418 path = inname 419 nested_root = root 420 421 inf = file(path, "r") 422 423 raw = preproc_adl(inf.read(), inarg) 424 tokens = split_tokens(raw, ["\n", " ", "\t", "(", ")", "{", "}", "[", "]", "/*", "*/", "#", ";"], True, True) 425 426 for token in tokens: 427 428 # Includes 429 430 if (INC in context): 431 context.remove(INC) 432 parse_adl(base, nested_root, token, True, indent) 433 context.add(POST_INC) 99 if ((not comment) and (token == "/*")): 100 comment = True 434 101 continue 435 102 436 if (POST_INC in context): 437 if (token != "]"): 438 print "%s: Expected ]" % inname 439 440 context.remove(POST_INC) 103 if (lcomment): 104 if (token == "\n"): 105 lcomment = False 441 106 continue 442 107 443 # Comments and newlines 444 445 if (BLOCK_COMMENT in context): 446 if (token == "*/"): 447 context.remove(BLOCK_COMMENT) 448 449 continue 450 451 if (LINE_COMMENT in context): 452 if (token == "\n"): 453 context.remove(LINE_COMMENT) 454 455 continue 456 457 # Any context 458 459 if (token == "/*"): 460 context.add(BLOCK_COMMENT) 461 continue 462 463 if (token == "#"): 464 context.add(LINE_COMMENT) 465 continue 466 467 if (token == "["): 468 context.add(INC) 108 if ((not lcomment) and (token == "#")): 109 lcomment = True 469 110 continue 470 111 … … 472 113 continue 473 114 474 # "frame" 115 if (empty): 116 empty = False 475 117 476 if (FRAME in context): 477 if (NULL in context): 478 if (token != ";"): 479 print "%s: Expected ';' in frame '%s'" % (inname, frame) 480 else: 481 output += "%s\n" % token 482 483 context.remove(NULL) 484 context.remove(FRAME) 485 frame = None 486 continue 487 488 if (BODY in context): 489 if (PROTOCOL in context): 490 if (token == "{"): 491 indent += 1 492 elif (token == "}"): 493 indent -= 1 494 495 if (indent == -1): 496 bp = split_bp(protocol) 497 protocol = None 498 499 if (not frame in frame_properties): 500 frame_properties[frame] = {} 501 502 if ('protocol' in frame_properties[frame]): 503 print "%s: Protocol for frame '%s' already defined" % (inname, frame) 504 else: 505 frame_properties[frame]['protocol'] = bp 506 507 output += "\n%s" % tabs(2) 508 output += parse_bp(inname, bp, 2) 509 output += "\n%s" % token 510 indent = 0 511 512 context.remove(PROTOCOL) 513 context.remove(BODY) 514 context.add(NULL) 515 else: 516 protocol += token 517 518 continue 519 520 if (REQUIRES in context): 521 if (FIN in context): 522 if (token != ";"): 523 print "%s: Expected ';' in frame '%s'" % (inname, frame) 524 else: 525 output += "%s" % token 526 527 context.remove(FIN) 528 continue 529 530 if (VAR in context): 531 if (not identifier(token)): 532 print "%s: Variable name expected in frame '%s'" % (inname, frame) 533 else: 534 if (not frame in frame_properties): 535 frame_properties[frame] = {} 536 537 if (not 'requires' in frame_properties[frame]): 538 frame_properties[frame]['requires'] = [] 539 540 frame_properties[frame]['requires'].append({'iface': arg0, 'var': token}) 541 arg0 = None 542 543 output += "%s" % token 544 545 context.remove(VAR) 546 context.add(FIN) 547 continue 548 549 if ((token == "}") or (token[-1] == ":")): 550 context.remove(REQUIRES) 551 else: 552 if (not identifier(token)): 553 print "%s: Interface name expected in frame '%s'" % (inname, frame) 554 else: 555 arg0 = token 556 output += "\n%s%s " % (tabs(indent), token) 557 558 context.add(VAR) 559 continue 560 561 if (PROVIDES in context): 562 if (FIN in context): 563 if (token != ";"): 564 print "%s: Expected ';' in frame '%s'" % (inname, frame) 565 else: 566 output += "%s" % token 567 568 context.remove(FIN) 569 continue 570 571 if (VAR in context): 572 if (not identifier(token)): 573 print "%s: Variable name expected in frame '%s'" % (inname, frame) 574 else: 575 if (not frame in frame_properties): 576 frame_properties[frame] = {} 577 578 if (not 'provides' in frame_properties[frame]): 579 frame_properties[frame]['provides'] = [] 580 581 frame_properties[frame]['provides'].append({'iface': arg0, 'var': token}) 582 arg0 = None 583 584 output += "%s" % token 585 586 context.remove(VAR) 587 context.add(FIN) 588 continue 589 590 if ((token == "}") or (token[-1] == ":")): 591 context.remove(PROVIDES) 592 else: 593 if (not identifier(token)): 594 print "%s: Interface name expected in frame '%s'" % (inname, frame) 595 else: 596 arg0 = token 597 output += "\n%s%s " % (tabs(indent), token) 598 599 context.add(VAR) 600 continue 601 602 if (token == "}"): 603 if (indent != 2): 604 print "%s: Wrong number of parentheses in frame '%s'" % (inname, frame) 605 else: 606 indent = 0 607 output += "\n%s" % token 608 609 context.remove(BODY) 610 context.add(NULL) 611 continue 612 613 if (token == "provides:"): 614 output += "\n%s%s" % (tabs(indent - 1), token) 615 context.add(PROVIDES) 616 protocol = "" 617 continue 618 619 if (token == "requires:"): 620 output += "\n%s%s" % (tabs(indent - 1), token) 621 context.add(REQUIRES) 622 protocol = "" 623 continue 624 625 if (token == "protocol:"): 626 output += "\n%s%s" % (tabs(indent - 1), token) 627 indent = 0 628 context.add(PROTOCOL) 629 protocol = "" 630 continue 631 632 print "%s: Unknown token '%s' in frame '%s'" % (inname, token, frame) 633 continue 634 635 if (HEAD in context): 636 if (token == "{"): 637 output += "%s" % token 638 indent += 2 639 context.remove(HEAD) 640 context.add(BODY) 641 continue 642 643 if (token == ";"): 644 output += "%s\n" % token 645 context.remove(HEAD) 646 context.remove(FRAME) 647 continue 648 649 print "%s: Unknown token '%s' in frame head '%s'" % (inname, token, frame) 650 651 continue 652 653 if (not identifier(token)): 654 print "%s: Expected frame name" % inname 655 else: 656 frame = token 657 output += "%s " % token 658 659 if (not frame in frame_properties): 660 frame_properties[frame] = {} 661 662 frame_properties[frame]['name'] = frame 663 664 context.add(HEAD) 665 continue 666 667 # "interface" 668 669 if (IFACE in context): 670 if (NULL in context): 671 if (token != ";"): 672 print "%s: Expected ';' in interface '%s'" % (inname, interface) 673 else: 674 output += "%s\n" % token 675 676 context.remove(NULL) 677 context.remove(IFACE) 678 interface = None 679 continue 680 681 if (BODY in context): 682 if (PROTOCOL in context): 683 if (token == "{"): 684 indent += 1 685 elif (token == "}"): 686 indent -= 1 687 688 if (indent == -1): 689 bp = split_bp(protocol) 690 protocol = None 691 692 if (not interface in iface_properties): 693 iface_properties[interface] = {} 694 695 if ('protocol' in iface_properties[interface]): 696 print "%s: Protocol for interface '%s' already defined" % (inname, interface) 697 else: 698 iface_properties[interface]['protocol'] = bp 699 700 output += "\n%s" % tabs(2) 701 output += parse_bp(inname, bp, 2) 702 output += "\n%s" % token 703 indent = 0 704 705 context.remove(PROTOCOL) 706 context.remove(BODY) 707 context.add(NULL) 708 else: 709 protocol += token 710 711 continue 712 713 if (PROTOTYPE in context): 714 if (FIN in context): 715 if (token != ";"): 716 print "%s: Expected ';' in interface '%s'" % (inname, interface) 717 else: 718 output += "%s" % token 719 720 context.remove(FIN) 721 context.remove(PROTOTYPE) 722 continue 723 724 if (PAR_RIGHT in context): 725 if (token == ")"): 726 output += "%s" % token 727 context.remove(PAR_RIGHT) 728 context.add(FIN) 729 else: 730 output += " %s" % token 731 732 continue 733 734 if (SIGNATURE in context): 735 output += "%s" % token 736 if (token == ")"): 737 context.remove(SIGNATURE) 738 context.add(FIN) 739 740 context.remove(SIGNATURE) 741 context.add(PAR_RIGHT) 742 continue 743 744 if (PAR_LEFT in context): 745 if (token != "("): 746 print "%s: Expected '(' in interface '%s'" % (inname, interface) 747 else: 748 output += "%s" % token 749 750 context.remove(PAR_LEFT) 751 context.add(SIGNATURE) 752 continue 753 754 if (not identifier(token)): 755 print "%s: Method identifier expected in interface '%s'" % (inname, interface) 756 else: 757 output += "%s" % token 758 759 context.add(PAR_LEFT) 760 continue 761 762 if (token == "}"): 763 if (indent != 2): 764 print "%s: Wrong number of parentheses in interface '%s'" % (inname, interface) 765 else: 766 indent = 0 767 output += "\n%s" % token 768 769 context.remove(BODY) 770 context.add(NULL) 771 continue 772 773 if ((token == "ipcarg_t") or (token == "unative_t")): 774 output += "\n%s%s " % (tabs(indent), token) 775 context.add(PROTOTYPE) 776 continue 777 778 if (token == "protocol:"): 779 output += "\n%s%s" % (tabs(indent - 1), token) 780 indent = 0 781 context.add(PROTOCOL) 782 protocol = "" 783 continue 784 785 print "%s: Unknown token '%s' in interface '%s'" % (inname, token, interface) 786 continue 787 788 if (HEAD in context): 789 if (token == "{"): 790 output += "%s" % token 791 indent += 2 792 context.remove(HEAD) 793 context.add(BODY) 794 continue 795 796 if (token == ";"): 797 output += "%s\n" % token 798 context.remove(HEAD) 799 context.remove(ARCH) 800 continue 801 802 if (not word(token)): 803 print "%s: Expected word in interface head '%s'" % (inname, interface) 804 else: 805 output += "%s " % token 806 807 continue 808 809 if (not identifier(token)): 810 print "%s: Expected interface name" % inname 811 else: 812 interface = token 813 output += "%s " % token 814 815 if (not interface in iface_properties): 816 iface_properties[interface] = {} 817 818 iface_properties[interface]['name'] = interface 819 820 context.add(HEAD) 821 continue 822 823 # "architecture" 824 825 if (ARCH in context): 826 if (NULL in context): 827 if (token != ";"): 828 print "%s: Expected ';' in architecture '%s'" % (inname, architecture) 829 else: 830 output += "%s\n" % token 831 832 context.remove(NULL) 833 context.remove(ARCH) 834 context.discard(SYSTEM) 835 architecture = None 836 continue 837 838 if (BODY in context): 839 if (DELEGATE in context): 840 if (FIN in context): 841 if (token != ";"): 842 print "%s: Expected ';' in architecture '%s'" % (inname, architecture) 843 else: 844 output += "%s" % token 845 846 context.remove(FIN) 847 context.remove(DELEGATE) 848 continue 849 850 if (VAR in context): 851 if (not descriptor(token)): 852 print "%s: Expected interface descriptor in architecture '%s'" % (inname, architecture) 853 else: 854 if (not architecture in arch_properties): 855 arch_properties[architecture] = {} 856 857 if (not 'delegate' in arch_properties[architecture]): 858 arch_properties[architecture]['delegate'] = [] 859 860 arch_properties[architecture]['delegate'].append({'from': arg0, 'to': token.split(":")}) 861 arg0 = None 862 863 output += "%s" % token 864 865 context.add(FIN) 866 context.remove(VAR) 867 continue 868 869 if (TO in context): 870 if (token != "to"): 871 print "%s: Expected 'to' in architecture '%s'" % (inname, architecture) 872 else: 873 output += "%s " % token 874 875 context.add(VAR) 876 context.remove(TO) 877 continue 878 879 if (not identifier(token)): 880 print "%s: Expected interface name in architecture '%s'" % (inname, architecture) 881 else: 882 output += "%s " % token 883 arg0 = token 884 885 context.add(TO) 886 continue 887 888 if (SUBSUME in context): 889 if (FIN in context): 890 if (token != ";"): 891 print "%s: Expected ';' in architecture '%s'" % (inname, architecture) 892 else: 893 output += "%s" % token 894 895 context.remove(FIN) 896 context.remove(SUBSUME) 897 continue 898 899 if (VAR in context): 900 if (not identifier(token)): 901 print "%s: Expected interface name in architecture '%s'" % (inname, architecture) 902 else: 903 if (not architecture in arch_properties): 904 arch_properties[architecture] = {} 905 906 if (not 'subsume' in arch_properties[architecture]): 907 arch_properties[architecture]['subsume'] = [] 908 909 arch_properties[architecture]['subsume'].append({'from': arg0.split(":"), 'to': token}) 910 arg0 = None 911 912 output += "%s" % token 913 914 context.add(FIN) 915 context.remove(VAR) 916 continue 917 918 if (TO in context): 919 if (token != "to"): 920 print "%s: Expected 'to' in architecture '%s'" % (inname, architecture) 921 else: 922 output += "%s " % token 923 924 context.add(VAR) 925 context.remove(TO) 926 continue 927 928 if (not descriptor(token)): 929 print "%s: Expected interface descriptor in architecture '%s'" % (inname, architecture) 930 else: 931 output += "%s " % token 932 arg0 = token 933 934 context.add(TO) 935 continue 936 937 if (BIND in context): 938 if (FIN in context): 939 if (token != ";"): 940 print "%s: Expected ';' in architecture '%s'" % (inname, architecture) 941 else: 942 output += "%s" % token 943 944 context.remove(FIN) 945 context.remove(BIND) 946 continue 947 948 if (VAR in context): 949 if (not descriptor(token)): 950 print "%s: Expected second interface descriptor in architecture '%s'" % (inname, architecture) 951 else: 952 if (not architecture in arch_properties): 953 arch_properties[architecture] = {} 954 955 if (not 'bind' in arch_properties[architecture]): 956 arch_properties[architecture]['bind'] = [] 957 958 arch_properties[architecture]['bind'].append({'from': arg0.split(":"), 'to': token.split(":")}) 959 arg0 = None 960 961 output += "%s" % token 962 963 context.add(FIN) 964 context.remove(VAR) 965 continue 966 967 if (TO in context): 968 if (token != "to"): 969 print "%s: Expected 'to' in architecture '%s'" % (inname, architecture) 970 else: 971 output += "%s " % token 972 973 context.add(VAR) 974 context.remove(TO) 975 continue 976 977 if (not descriptor(token)): 978 print "%s: Expected interface descriptor in architecture '%s'" % (inname, architecture) 979 else: 980 output += "%s " % token 981 arg0 = token 982 983 context.add(TO) 984 continue 985 986 if (INST in context): 987 if (FIN in context): 988 if (token != ";"): 989 print "%s: Expected ';' in architecture '%s'" % (inname, architecture) 990 else: 991 output += "%s" % token 992 993 context.remove(FIN) 994 context.remove(INST) 995 continue 996 997 if (VAR in context): 998 if (not identifier(token)): 999 print "%s: Expected instance name in architecture '%s'" % (inname, architecture) 1000 else: 1001 if (not architecture in arch_properties): 1002 arch_properties[architecture] = {} 1003 1004 if (not 'inst' in arch_properties[architecture]): 1005 arch_properties[architecture]['inst'] = [] 1006 1007 arch_properties[architecture]['inst'].append({'type': arg0, 'var': token}) 1008 arg0 = None 1009 1010 output += "%s" % token 1011 1012 context.add(FIN) 1013 context.remove(VAR) 1014 continue 1015 1016 if (not identifier(token)): 1017 print "%s: Expected frame/architecture type in architecture '%s'" % (inname, architecture) 1018 else: 1019 output += "%s " % token 1020 arg0 = token 1021 1022 context.add(VAR) 1023 continue 1024 1025 if (token == "}"): 1026 if (indent != 1): 1027 print "%s: Wrong number of parentheses in architecture '%s'" % (inname, architecture) 1028 else: 1029 indent -= 1 1030 output += "\n%s" % token 1031 1032 context.remove(BODY) 1033 context.add(NULL) 1034 continue 1035 1036 if (token == "inst"): 1037 output += "\n%s%s " % (tabs(indent), token) 1038 context.add(INST) 1039 continue 1040 1041 if (token == "bind"): 1042 output += "\n%s%s " % (tabs(indent), token) 1043 context.add(BIND) 1044 continue 1045 1046 if (token == "subsume"): 1047 output += "\n%s%s " % (tabs(indent), token) 1048 context.add(SUBSUME) 1049 continue 1050 1051 if (token == "delegate"): 1052 output += "\n%s%s " % (tabs(indent), token) 1053 context.add(DELEGATE) 1054 continue 1055 1056 print "%s: Unknown token '%s' in architecture '%s'" % (inname, token, architecture) 1057 continue 1058 1059 if (HEAD in context): 1060 if (token == "{"): 1061 output += "%s" % token 1062 indent += 1 1063 context.remove(HEAD) 1064 context.add(BODY) 1065 continue 1066 1067 if (token == ";"): 1068 output += "%s\n" % token 1069 context.remove(HEAD) 1070 context.remove(ARCH) 1071 context.discard(SYSTEM) 1072 continue 1073 1074 if (not word(token)): 1075 print "%s: Expected word in architecture head '%s'" % (inname, architecture) 1076 else: 1077 output += "%s " % token 1078 1079 continue 1080 1081 if (not identifier(token)): 1082 print "%s: Expected architecture name" % inname 1083 else: 1084 architecture = token 1085 output += "%s " % token 1086 1087 if (not architecture in arch_properties): 1088 arch_properties[architecture] = {} 1089 1090 arch_properties[architecture]['name'] = architecture 1091 1092 if (SYSTEM in context): 1093 arch_properties[architecture]['system'] = True 1094 1095 context.add(HEAD) 1096 continue 1097 1098 # "system architecture" 1099 1100 if (SYSTEM in context): 1101 if (token != "architecture"): 1102 print "%s: Expected 'architecture'" % inname 1103 else: 1104 output += "%s " % token 1105 1106 context.add(ARCH) 1107 continue 1108 1109 if (token == "frame"): 1110 output += "\n%s " % token 1111 context.add(FRAME) 1112 continue 1113 1114 if (token == "interface"): 1115 output += "\n%s " % token 1116 context.add(IFACE) 1117 continue 1118 1119 if (token == "system"): 1120 output += "\n%s " % token 1121 context.add(SYSTEM) 1122 continue 1123 1124 if (token == "architecture"): 1125 output += "\n%s " % token 1126 context.add(ARCH) 1127 continue 1128 1129 print "%s: Unknown token '%s'" % (inname, token) 118 if ((token == ";") or (token == "+") or (token == "||") or (token == "|")): 119 outf.write(" %s\n" % token) 120 elif (token == "("): 121 outf.write("%s%s\n" % (tabs(indent), token)) 122 indent += 1 123 elif (token == ")"): 124 indent -= 1 125 outf.write("\n%s%s" % (tabs(indent), token)) 126 elif (token == "{"): 127 outf.write(" %s\n" % token) 128 indent += 1 129 elif (token == "}"): 130 indent -= 1 131 outf.write("\n%s%s" % (tabs(indent), token)) 132 elif (token == "*"): 133 outf.write("%s" % token) 134 else: 135 outf.write("%s%s" % (tabs(indent), token)) 1130 136 137 if (empty): 138 outf.write("NULL") 139 140 outf.write("\n\n\n") 1131 141 inf.close() 1132 142 1133 def open_adl(base, root, inname, outdir, outname): 1134 "Open Architecture Description file" 1135 1136 global output 1137 global context 1138 global architecture 1139 global interface 1140 global frame 1141 global protocol 1142 1143 global arg0 1144 1145 output = "" 1146 context = set() 1147 architecture = None 1148 interface = None 1149 frame = None 1150 protocol = None 1151 arg0 = None 1152 1153 parse_adl(base, root, inname, False, 0) 1154 output = output.strip() 1155 1156 if (output != ""): 1157 if (os.path.isfile(outname)): 1158 print "%s: File already exists, overwriting" % outname 1159 1160 outf = file(outname, "w") 1161 outf.write(output) 1162 outf.close() 1163 else: 1164 if (os.path.isfile(outname)): 1165 print "%s: File already exists, but should be empty" % outname 1166 1167 def recursion(base, root, output, level): 143 def recursion(root, output, level): 1168 144 "Recursive directory walk" 1169 145 … … 1171 147 canon = os.path.join(root, name) 1172 148 1173 if ( os.path.isfile(canon)):149 if ((os.path.isfile(canon)) and (level > 0)): 1174 150 fcomp = split_tokens(canon, ["."]) 1175 cname = canon.split("/") 1176 1177 if (fcomp[-1] == ".adl"): 1178 output_path = os.path.join(output, cname[-1]) 1179 open_adl(base, root, canon, output, output_path) 151 if (fcomp[-1] == ".bp"): 152 parse(canon, outf) 1180 153 1181 154 if (os.path.isdir(canon)): 1182 recursion( base, canon, output, level + 1)155 recursion(canon, outf, level + 1) 1183 156 1184 157 def main(): 1185 global iface_properties1186 global frame_properties1187 global arch_properties1188 1189 158 if (len(sys.argv) < 2): 1190 159 usage(sys.argv[0]) … … 1193 162 path = os.path.abspath(sys.argv[1]) 1194 163 if (not os.path.isdir(path)): 1195 print " Error:<OUTPUT> is not a directory"164 print "<OUTPUT> is not a directory" 1196 165 return 1197 166 1198 iface_properties = {} 1199 frame_properties = {} 1200 arch_properties = {} 167 recursion(".", path, 0) 1201 168 1202 recursion(".", ".", path, 0)1203 1204 system_arch = get_system_arch()1205 1206 if (not system_arch is None):1207 dump_arch(system_arch, path)1208 1209 169 if __name__ == '__main__': 1210 170 main() -
contrib/arch/kernel/kernel.adl
re5d4294 r743e17b 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 12 12 interface kernel_console { 13 13 /* Enable kernel console */ 14 u native_t sys_debug_enable_console(void);14 uintptr_t sys_debug_enable_console(void); 15 15 16 16 /* Disable kernel console */ 17 unative_t sys_debug_disable_console(void); 18 protocol: 19 ?sys_debug_enable_console + 20 ?sys_debug_disable_console 17 uintptr_t sys_debug_disable_console(void); 18 protocol: 19 (?sys_debug_enable_console + ?sys_debug_disable_console)* 21 20 }; 22 21 … … 25 24 unative_t sys_tls_set(unative_t addr); 26 25 protocol: 27 ?sys_tls_set 26 ?sys_tls_set* 28 27 }; 29 28 … … 38 37 unative_t sys_thread_get_id(thread_id_t *uspace_thread_id); 39 38 protocol: 40 ( 41 ?sys_thread_create + 42 ?sys_thread_get_id 43 )* ; 44 ?sys_thread_exit 39 (?sys_thread_create + ?sys_thread_get_id)* ; ?sys_thread_exit 45 40 }; 46 41 … … 52 47 unative_t sys_task_get_id(task_id_t *uspace_task_id); 53 48 protocol: 54 ?sys_task_set_name + 55 ?sys_task_get_id 49 (?sys_task_set_name + ?sys_task_get_id)* 56 50 }; 57 51 … … 60 54 unative_t sys_program_spawn_loader(char *uspace_name, size_t name_len); 61 55 protocol: 62 ?sys_program_spawn_loader 56 ?sys_program_spawn_loader* 63 57 }; 64 58 … … 70 64 unative_t sys_futex_wakeup(uintptr_t uaddr); 71 65 protocol: 72 ?sys_futex_sleep_timeout + 73 ?sys_futex_wakeup 66 (?sys_futex_sleep_timeout + ?sys_futex_wakeup)* 74 67 }; 75 68 … … 78 71 unative_t sys_smc_coherence(uintptr_t va, size_t size); 79 72 protocol: 80 ?sys_smc_coherence 73 ?sys_smc_coherence* 81 74 }; 82 75 … … 94 87 unative_t sys_as_area_destroy(uintptr_t address); 95 88 protocol: 96 ?sys_as_area_create + 97 ?sys_as_area_resize + 98 ?sys_as_area_change_flags + 99 ?sys_as_area_destroy 89 (?sys_as_area_create + ?sys_as_area_resize + ?sys_as_area_change_flags + ?sys_as_area_destroy)* 100 90 }; 101 91 … … 134 124 unative_t sys_ipc_poke(void); 135 125 protocol: 136 ?sys_ipc_call_sync_fast + 137 ?sys_ipc_call_sync_slow + 138 ?sys_ipc_call_async_fast + 139 ?sys_ipc_call_async_slow + 140 ?sys_ipc_forward_fast + 141 ?sys_ipc_forward_slow + 142 ?sys_ipc_answer_fast + 143 ?sys_ipc_answer_slow + 144 ?sys_ipc_hangup + 145 ?sys_ipc_wait_for_call + 146 ?sys_ipc_poke 126 (?sys_ipc_call_sync_fast + ?sys_ipc_call_sync_slow + ?sys_ipc_call_async_fast + ?sys_ipc_call_async_slow + ?sys_ipc_forward_fast + ?sys_ipc_forward_slow + ?sys_ipc_answer_fast + ?sys_ipc_answer_slow + ?sys_ipc_hangup + ?sys_ipc_wait_for_call + ?sys_ipc_poke)* 147 127 }; 148 128 … … 151 131 unative_t sys_event_subscribe(unative_t evno, unative_t method); 152 132 protocol: 153 ?sys_event_subscribe 133 ?sys_event_subscribe* 154 134 }; 155 135 … … 161 141 unative_t sys_cap_revoke(sysarg64_t *uspace_taskid_arg, cap_t caps); 162 142 protocol: 163 ?sys_cap_grant + 164 ?sys_cap_rewoke 143 (?sys_cap_grant + ?sys_cap_rewoke)* 165 144 }; 166 145 … … 184 163 unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno); 185 164 protocol: 186 ?sys_enable_iospace + 187 ?sys_physmem_map + 188 ?sys_device_assign_devno + 189 ?sys_preempt_control + 190 ?sys_ipc_register_irq + 191 ?sys_ipc_unregister_irq 165 (?sys_enable_iospace + ?sys_physmem_map + ?sys_device_assign_devno + ?sys_preempt_control + ?sys_ipc_register_irq + ?sys_ipc_unregister_irq)* 192 166 }; 193 167 … … 199 173 unative_t sys_sysinfo_value(unatice_t ptr, unative_t len); 200 174 protocol: 201 ?sys_sysinfo_valid + 202 ?sys_sysinfo_value 175 (?sys_sysinfo_valid + ?sys_sysinfo_value)* 203 176 }; 204 177 … … 207 180 unative_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid_arg); 208 181 protocol: 209 ?sys_ipc_connect_kbox 182 ?sys_ipc_connect_kbox* 210 183 }; 211 184 -
contrib/arch/uspace/lib/libc/bind
re5d4294 r743e17b 1 /* Bind %%to kernel interfaces */1 /* Bindings to kernel interfaces */ 2 2 bind %%:kernel_klog to kernel:kernel_klog; 3 3 bind %%:kernel_console to kernel:kernel_console; -
contrib/arch/uspace/lib/libc/fnc.devmap_device_get_count
re5d4294 r743e17b 1 1 [fnc.devmap_get_phone] ; 2 tentative { 3 !dm_client.device_get_count 4 } 2 !dm_client.device_get_count -
contrib/arch/uspace/lib/libc/fnc.devmap_device_get_devices
re5d4294 r743e17b 1 1 [fnc.devmap_get_phone] ; 2 tentative { 3 !dm_client.device_get_devices { 4 !dm_client.ipc_m_data_read /* buffer */ 5 } 2 !dm_client.device_get_devices { 3 !dm_client.ipc_m_data_read /* buffer */ 6 4 } -
contrib/arch/uspace/lib/libc/fnc.devmap_device_get_handle
re5d4294 r743e17b 1 1 [fnc.devmap_get_phone] ; 2 tentative { 3 !dm_client.device_get_handle { 4 !dm_client.ipc_m_data_write /* name */ 5 } 2 !dm_client.device_get_handle { 3 !dm_client.ipc_m_data_write /* name */ 6 4 } -
contrib/arch/uspace/srv/bd/rd/rd.adl
re5d4294 r743e17b 1 1 frame rd { 2 2 provides: 3 b dbd;3 block_device bd; 4 4 requires: 5 naming_service ns; 6 device_mapper_driver dm_driver; 5 7 [/uspace/lib/libc/requires] 6 ns ns;7 devmap_driver devmap_driver;8 8 protocol: 9 9 [/uspace/lib/libc/protocol] + -
contrib/arch/uspace/srv/bd/rd/rd.bp
re5d4294 r743e17b 1 [/ uspace/lib/libc/fnc.devmap_driver_register] ;2 [/ uspace/lib/libc/fnc.devmap_device_register]1 [/lib/libc/fnc.devmap_driver_register] ; 2 [/lib/libc/fnc.devmap_device_register] -
contrib/arch/uspace/srv/console/console.bp
re5d4294 r743e17b 2 2 !kbd.IPC_CONNECT_TO_ME ; 3 3 !ns.IPC_CONNECT_ME_TO /* fb */ ; 4 [ /uspace/lib/libc/fnc.devmap_driver_register] ;4 [devmap_driver_register] ; 5 5 !fb.FB_GET_RESOLUTION ; 6 6 ( 7 [ fnc.vp_create] +8 [ fnc.vp_switch]7 [vp_create] + 8 [vp_switch] 9 9 )* ; 10 [ fnc.make_pixmap]* ;11 [ fnc.make_anim] ;12 [ fnc.vp_switch] ;10 [make_pixmap]* ; 11 [make_anim] ; 12 [vp_switch] ; 13 13 !fb.FB_FLUSH ; 14 14 !fb.FB_GET_CSIZE ; 15 15 !fb.FB_GET_COLOR_CAP ; 16 16 !fb.IPC_M_SHARE_OUT ; 17 [ /uspace/lib/libc/fnc.devmap_device_register]* ;18 [ fnc.gcons_redraw_console] ;19 [ fnc.set_rgb_color] ;20 [ fnc.screen_clear] ;21 [ fnc.curs_goto] ;22 [ fnc.curs_visibility] ;17 [devmap_device_register]* ; 18 [gcons_redraw_console] ; 19 [set_rgb_color] ; 20 [screen_clear] ; 21 [curs_goto] ; 22 [curs_visibility] ; 23 23 ( 24 24 ?console.IPC_M_CONNECT_ME_TO ; 25 [ fnc.gcons_notify_connect] ;25 [gcons_notify_connect] ; 26 26 ( 27 27 ?console.VFS_OUT_READ { 28 [ fnc.cons_read]28 [cons_read] 29 29 } + 30 30 31 31 ?console.VFS_OUT_WRITE { 32 [ fnc.cons_write]32 [cons_write] 33 33 } + 34 34 35 35 ?console.VFS_OUT_SYNC { 36 [f nc.fb_pending_flush] ;36 [fb_pending_flush] ; 37 37 ( 38 38 ( 39 39 !fb.FB_FLUSH ; 40 [ fnc.curs_goto]40 [curs_goto] 41 41 ) + 42 42 NULL … … 59 59 60 60 ?console.CONSOLE_SET_STYLE { 61 [f nc.fb_pending_flush] ;61 [fb_pending_flush] ; 62 62 ( 63 [ fnc.set_style] +63 [set_style] + 64 64 NULL 65 65 ) … … 67 67 68 68 ?console.CONSOLE_SET_COLOR { 69 [f nc.fb_pending_flush] ;69 [fb_pending_flush] ; 70 70 ( 71 [ fnc.set_color] +71 [set_color] + 72 72 NULL 73 73 ) … … 75 75 76 76 ?console.CONSOLE_SET_RGB_COLOR { 77 [f nc.fb_pending_flush] ;77 [fb_pending_flush] ; 78 78 ( 79 [ fnc.set_rgb_color] +79 [set_rgb_color] + 80 80 NULL 81 81 ) … … 83 83 84 84 ?console.CONSOLE_CURSOR_VISIBILITY { 85 [f nc.fb_pending_flush] ;85 [fb_pending_flush] ; 86 86 ( 87 [ fnc.curs_visibility] +87 [curs_visibility] + 88 88 NULL 89 89 ) … … 97 97 98 98 ?console.IPC_M_PHONE_HUNGUP { 99 [ fnc.gcons_notify_disconnect]99 [gcons_notify_disconnect] 100 100 } 101 101 )* -
contrib/arch/uspace/srv/devmap/devmap.adl
re5d4294 r743e17b 1 interface dev map_driver {1 interface device_mapper_driver { 2 2 /* Establish connection (iface is DEVMAP_DRIVER) */ 3 3 ipcarg_t ipc_m_connect_me_to(in ipcarg_t iface); 4 4 5 5 /* Register as a new driver */ 6 ipcarg_t driver_register( in_copy string name);6 ipcarg_t driver_register(void); 7 7 8 8 /* Unregister all devices and the driver itself */ … … 10 10 11 11 /* Register new device and return handle */ 12 ipcarg_t device_register( in_copy string name,out ipcarg_t handle);12 ipcarg_t device_register(out ipcarg_t handle); 13 13 14 14 /* Unregister device */ … … 16 16 17 17 /* Resolve device name to handle */ 18 ipcarg_t device_get_handle(in ipcarg_t flags , in_copy string name);18 ipcarg_t device_get_handle(in ipcarg_t flags); 19 19 20 20 /* Get device name for a given handle */ 21 21 ipcarg_t device_get_name(in ipcarg_t handle); 22 22 23 /* Transfer driver or device name */ 24 ipcarg_t ipc_m_data_write(in ipcarg_t src_addr, in ipcarg_t src_size, out ipcarg_t dst_addr, out ipcarg_t dst_size); 25 23 26 /* Close connection */ 24 27 ipcarg_t ipc_m_phone_hungup(void); 25 28 protocol: 26 [dev map_driver.bp]29 [device_mapper_driver.bp] 27 30 }; 28 31 29 interface dev map_client {32 interface device_mapper_client { 30 33 /* Establish connection (iface is DEVMAP_CLIENT) or forward to device (iface is DEVMAP_CONNECT_TO_DEVICE) */ 31 34 ipcarg_t ipc_m_connect_me_to(in ipcarg_t iface, in ipcarg_t handle); 32 35 33 36 /* Resolve device name to handle */ 34 ipcarg_t device_get_handle(in ipcarg_t flags , in_copy string name);37 ipcarg_t device_get_handle(in ipcarg_t flags); 35 38 36 39 /* Get device name for a given handle */ … … 47 50 48 51 /* Get an array of (device_name, handle) pairs */ 49 ipcarg_t device_get_devices(out_copy stream data); 52 ipcarg_t device_get_devices(void) 53 54 /* Transfer device name from client */ 55 ipcarg_t ipc_m_data_write(in ipcarg_t src_addr, in ipcarg_t src_size, out ipcarg_t dst_addr, out ipcarg_t dst_size); 56 57 /* Transfer (device_name, handle) pairs to client */ 58 ipcarg_t ipc_m_data_read(in ipcarg_t src_addr, in ipcarg_t src_size, out ipcarg_t dst_addr, out ipcarg_t dst_size); 50 59 51 60 /* Close connection */ 52 61 ipcarg_t ipc_m_phone_hungup(void); 53 62 protocol: 54 [dev map_client.bp]63 [device_mapper_client.bp] 55 64 56 65 }; … … 58 67 frame devmap { 59 68 provides: 60 dev map_driver devmap_driver;61 dev map_client devmap_client;69 device_mapper_driver dm_driver; 70 device_mapper_client dm_client; 62 71 requires: 63 [/ uspace/lib/libc/requires]72 [/lib/libc/iface.requires] 64 73 protocol: 65 [devmap _server.bp]74 [devmap.bp] 66 75 }; -
contrib/arch/uspace/srv/kbd/kbd.bp
re5d4294 r743e17b 1 ?ipc_m_connect_me_to ;2 1 ( 3 ?ipc_m_connect_to_me + 4 ?yield + 5 ?reclam 2 !ns.IPC_M_CONNECT_ME_TO /* cir */ + 3 NULL 4 ) ; 5 !ns.IPC_M_CONNECT_TO_ME ; 6 ( 7 ?kbd.IPC_M_CONNECT_ME_TO ; 8 ( 9 ( 10 ?kbd.KBD_YIELD + 11 ?kbd.KBD_RECLAIM + 12 ) | 13 !console.KBD_EVENT 14 )* ; 15 ?kbd.IPC_M_PHONE_HUNGUP 6 16 )* ; 7 ?ipc_m_phone_hungup 17 ( 18 !cir.IPC_M_PHONE_HUNGUP + 19 NULL 20 ) -
contrib/arch/uspace/srv/loader/loader.bp
re5d4294 r743e17b 1 !ns.NS_ID_INTRO ; 2 !ns.IPC_M_CONNECT_TO_ME ; 1 3 ( 2 ? get_taskid{3 ? ipc_m_data_read /* task ID*/4 ?loader.LOADER_GET_TASKID { 5 ?loader.IPC_M_DATA_READ /* task id */ 4 6 } + 5 7 6 ? set_pathname{7 ? ipc_m_data_write /* pathname*/8 ?loader.LOADER_SET_PATHNAME { 9 ?loader.IPC_M_DATA_WRITE /* path */ 8 10 } + 9 11 10 ? set_args{11 ? ipc_m_data_write/* arguments */12 ?loader.LOADER_SET_ARGS { 13 ?loader.IPC_M_DATA_WRITE /* arguments */ 12 14 } + 13 15 14 ? set_files{15 ? ipc_m_data_write/* files */16 ?loader.LOADER_SET_FILES { 17 ?loader.IPC_M_DATA_WRITE /* files */ 16 18 } + 17 19 18 ?load 20 ?loader.LOADER_LOAD 19 21 )* ; 20 22 ( 21 ? run+22 ? ipc_m_phone_hungup23 ?loader.LOADER_RUN + 24 ?loader.IPC_M_PHONE_HUNGUP 23 25 ) -
contrib/arch/uspace/srv/ns/ns.adl
re5d4294 r743e17b 1 interface n s{1 interface naming_service { 2 2 /* Register a clonable service or a generic service */ 3 3 ipcarg_t ipc_m_connect_to_me(in ipcarg_t service); … … 24 24 ipcarg_t ipc_m_phone_hungup(void); 25 25 protocol: 26 [n s.bp]26 [naming_service.bp] 27 27 }; 28 28 29 29 frame ns { 30 30 provides: 31 n sns;31 naming_service ns; 32 32 requires: 33 33 [/uspace/lib/libc/requires] -
contrib/arch/uspace/srv/pci/pci.bp
re5d4294 r743e17b 1 ?ipc_m_connect_me_to ; 2 ?ipc_m_phone_hungup 1 !ns.IPC_M_CONNECT_TO_ME ; 2 ( 3 ?pci.IPC_M_CONNECT_ME_TO ; 4 ?pci.IPC_M_PHONE_HUNGUP 5 )* -
contrib/arch/uspace/srv/vfs/vfs.bp
re5d4294 r743e17b 1 ?ipc_m_connect_me_to;1 !ns.IPC_M_CONNECT_TO_ME ; 2 2 ( 3 ?register { 4 ?ipc_m_data_write /* fs name */ ; 5 tentative { 6 /* callback connection */ 7 ?ipc_m_connect_to_me ; 8 ?ipc_m_share_in 3 ?vfs.IPC_M_CONNECT_ME_TO ; 4 ( 5 ?vfs.VFS_IN_REGISTER { 6 ?vfs.IPC_M_DATA_WRITE ; 7 ?vfs.IPC_M_CONNECT_TO_ME ; 8 ?vfs.IPC_M_SHARE_IN 9 } + 10 11 ?vfs.VFS_IN_MOUNT { 12 ?vfs.IPC_M_DATA_WRITE /* mount point */ ; 13 ?vfs.IPC_M_DATA_WRITE /* mount options */ ; 14 ?vfs.IPC_M_DATA_WRITE /* fs name */ ; 15 ?vfs.IPC_M_PING ; 16 ( 17 18 !fs.VFS_OUT_MOUNTED ; 19 !fs.IPC_M_DATA_WRITE /* mount options */ 20 ) /* root fs */ + 21 ( 22 !fs.VFS_OUT_MOUNT ; 23 !fs.IPC_M_CONNECTION_CLONE ; 24 !fs.VFS_M_DATA_WRITE /* mount options */ 25 ) /* non-root fs */ 26 } + 27 28 ?vfs.VFS_IN_OPEN { 29 ?vfs.IPC_M_DATA_WRITE /* path */ ; 30 [vfs_lookup_internal] ; 31 ( 32 ( 33 [vfs_grab_phone] ; 34 !fs.VFS_OUT_TRUNCATE ; 35 [vfs_release_phone] 36 ) + 37 NULL 38 ) 39 } + 40 41 ?vfs.VFS_IN_OPEN_NODE { 42 [vfs_grab_phone] ; 43 !fs.VFS_OUT_OPEN_NODE ; 44 [vfs_release_phone] ; 45 ( 46 ( 47 [vfs_grab_phone] ; 48 !fs.VFS_OUT_TRUNCATE ; 49 [vfs_release_phone] 50 ) + 51 NULL 52 ) 53 } + 54 55 ?vfs.VFS_IN_CLOSE { 56 [vfs_grab_phone] ; 57 !fs.VFS_OUT_CLOSE ; 58 [vfs_release_phone] 59 } + 60 61 ?vfs.VFS_IN_READ { 62 ?vfs.IPC_M_DATA_READ { 63 [vfs_grab_phone] ; 64 !fs.VFS_OUT_READ /* payload */ ; 65 !fs.IPC_M_DATA_READ /* forwarded */ ; 66 [vfs_release_phone] 67 } 68 } + 69 70 ?vfs.VFS_IN_WRITE { 71 ?vfs.IPC_M_DATA_WRITE { 72 [vfs_grab_phone] ; 73 !fs.VFS_OUT_WRITE /* payload */ ; 74 !fs.IPC_M_DATA_WRITE /* forwarded */ ; 75 [vfs_release_phone] 76 } 77 } + 78 79 ?vfs.VFS_IN_SEEK + 80 81 ?vfs.VFS_IN_TRUNCATE { 82 [vfs_grab_phone] ; 83 !fs.VFS_OUT_TRUNCATE ; 84 [vfs_release_phone] 85 } + 86 87 ?vfs.VFS_IN_FSTAT { 88 ?vfs.IPC_M_DATA_READ /* struct stat */ { 89 [vfs_grab_phone] ; 90 !fs.VFS_OUT_STAT ; 91 !fs.IPC_M_DATA_READ /* forwarded */ ; 92 [vfs_release_phone] 93 } 94 } + 95 96 ?vfs.VFS_IN_STAT { 97 ?vfs.IPC_M_DATA_WRITE /* path */ ; 98 ?vfs.IPC_M_DATA_READ /* struct stat */ { 99 [vfs_lookup_internal] ; 100 !fs.VFS_OUT_STAT ; 101 !fs.IPC_M_DATA_READ /* forwarded */ 102 } 103 } + 104 105 ?vfs.VFS_IN_MKDIR { 106 ?vfs.IPC_M_DATA_WRITE /* path */ ; 107 [vfs_lookup_internal] 108 } + 109 110 ?vfs.VFS_IN_UNLINK { 111 ?vfs.IPC_M_DATA_WRITE /* path */ ; 112 [vfs_lookup_internal] 113 } + 114 115 ?vfs.VFS_IN_RENAME { 116 ?vfs.IPC_M_DATA_WRITE /* old path */ ; 117 ?vfs.IPC_M_DATE_WRITE /* new path */ ; 118 [vfs_lookup_internal] /* lookup old path */ ; 119 [vfs_lookup_internal] /* lookup parent of new path */ ; 120 [vfs_lookup_internal] /* destroy old link for the new path */ ; 121 [vfs_lookup_internal] /* create new link for the new path */ ; 122 [vfs_lookup_internal] /* destroy link for the old path */ 123 } + 124 125 ?vfs.VFS_IN_SYNC { 126 !fs.VFS_OUT_SYNC 9 127 } 10 } + 11 12 ?mount { 13 ?ipc_m_data_write /* mount point */ ; 14 tentative { 15 ?ipc_m_data_write /* mount options */ ; 16 tentative { 17 ?ipc_m_data_write /* fs name */ ; 18 tentative { 19 ?ipc_m_ping ; 20 tentative { 21 ( 22 /* root fs */ 23 !fs.mounted ; 24 !fs.ipc_m_data_write /* mount options */ 25 ) + 26 ( 27 /* non-root fs */ 28 tentative { 29 [fnc.vfs_lookup_internal] ; 30 tentative { 31 [fnc.vfs_grab_phone] ; 32 [fnc.vfs_grab_phone] ; 33 !fs.mount ; 34 !fs.ipc_m_connection_clone ; 35 [fnc.vfs_release_phone] ; 36 tentative { 37 !fs.vfs_m_data_write /* mount options */ 38 } ; 39 [fnc.vfs_release_phone] 40 } 41 } 42 ) 43 } 44 } 45 } 46 } 47 } + 48 49 ?open { 50 tentative { 51 ?ipc_m_data_write /* path */ ; 52 tentative { 53 [fnc.vfs_lookup_internal] ; 54 tentative { 55 [fnc.vfs_grab_phone] ; 56 !fs.truncate ; 57 [fnc.vfs_release_phone] 58 } 59 } 60 } 61 } + 62 63 ?open_node { 64 [fnc.vfs_open_node_internal] ; 65 tentative { 66 [fnc.vfs_grab_phone] ; 67 !fs.truncate ; 68 [fnc.vfs_release_phone] 69 } 70 } + 71 72 ?close { 73 tentative { 74 [fnc.vfs_grab_phone] ; 75 !fs.close ; 76 [fnc.vfs_release_phone] 77 } 78 } + 79 80 ?read { 81 tentative { 82 ?ipc_m_data_read { 83 [fnc.vfs_grab_phone] ; 84 !fs.read ; 85 !fs.ipc_m_data_read /* forward payload */ ; 86 [fnc.vfs_release_phone] 87 } 88 } 89 } + 90 91 ?write { 92 tentative { 93 ?ipc_m_data_write { 94 [fnc.vfs_grab_phone] ; 95 !fs.write ; 96 !fs.ipc_m_data_write /* forward payload */ ; 97 [fnc.vfs_release_phone] 98 } 99 } 100 } + 101 102 ?truncate { 103 tentative { 104 [fnc.vfs_grab_phone] ; 105 !fs.truncate ; 106 [fnc.vfs_release_phone] 107 } 108 } + 109 110 ?fstat { 111 tentative { 112 ?ipc_m_data_read /* struct stat */ { 113 [fnc.vfs_grab_phone] ; 114 !fs.stat ; 115 !fs.ipc_m_data_read /* forward struct stat */ ; 116 [fnc.vfs_release_phone] 117 } 118 } 119 } + 120 121 ?stat { 122 ?ipc_m_data_write /* path */ ; 123 tentative { 124 ?ipc_m_data_read /* struct stat */ { 125 [fnc.vfs_lookup_internal] ; 126 tentative { 127 !fs.stat ; 128 !fs.ipc_m_data_read /* forward struct stat */ 129 } 130 } 131 } 132 } + 133 134 ?mkdir { 135 ?ipc_m_data_write /* path */ ; 136 tentative { 137 [fnc.vfs_lookup_internal] 138 } 139 } + 140 141 ?unlink { 142 ?ipc_m_data_write /* path */ ; 143 tentative { 144 [fnc.vfs_lookup_internal] 145 } 146 } + 147 148 ?rename { 149 ?ipc_m_data_write /* old path */ ; 150 tentative { 151 ?ipc_m_data_write /* new path */ ; 152 tentative { 153 [fnc.vfs_lookup_internal] /* lookup old path */ ; 154 tentative { 155 [fnc.vfs_lookup_internal] /* lookup parent of new path */ ; 156 tentative { 157 [fnc.vfs_lookup_internal] /* destroy old link for the new path */ ; 158 tentative { 159 [fnc.vfs_lookup_internal] /* create new link for the new path */ ; 160 tentative { 161 [fnc.vfs_lookup_internal] /* destroy link for the old path */ 162 } 163 } 164 } 165 } 166 } 167 } 168 } + 169 170 ?sync { 171 tentative { 172 !fs.sync 173 } 174 } + 175 176 ?seek 177 178 )* ; 179 ?ipc_m_phne_hungup 128 129 )* ; 130 ?vfs.IPC_M_PHONE_HUNGUP 131 )* -
contrib/highlight/adl.syntax
re5d4294 r743e17b 18 18 19 19 keyword whole ipcarg_t yellow 20 keyword whole string yellow21 keyword whole stream yellow22 20 keyword whole void yellow 23 21 24 22 keyword whole in yellow 25 keyword whole in_copy yellow26 23 keyword whole out yellow 27 keyword whole out_copy yellow28 24 29 25 keyword whole protocol yellow -
contrib/highlight/bp.syntax
re5d4294 r743e17b 4 4 context default 5 5 keyword whole NULL yellow 6 keyword whole try yellow 7 keyword whole catch yellow 6 8 keyword whole tentative yellow 7 9 -
kernel/arch/ia64/_link.ld.in
re5d4294 r743e17b 7 7 */ 8 8 9 #define LOAD_ADDRESS_V 0xe00000000440400010 #define LOAD_ADDRESS_P 0x000000000440400011 12 9 ENTRY(kernel_image_start) 13 10 14 11 SECTIONS { 15 .image LOAD_ADDRESS_V: AT (LOAD_ADDRESS_P) {12 .image 0xe000000004404000: AT (0x0000000004404000) { 16 13 ktext_start = .; 17 14 *(K_TEXT_START); … … 24 21 *(.opd) 25 22 *(.data .data.*) 26 hardcoded_load_address = .;27 QUAD(LOAD_ADDRESS_V);28 hardcoded_ktext_size = .;29 QUAD(ktext_end - ktext_start);30 hardcoded_kdata_size = .;31 QUAD(kdata_end - kdata_start);32 23 *(.got .got.*) 33 24 *(.sdata) … … 47 38 } 48 39 40 _hardcoded_ktext_size = ktext_end - ktext_start; 41 _hardcoded_kdata_size = kdata_end - kdata_start; 42 _hardcoded_load_address = 0xe000000004404000; 43 49 44 } -
kernel/arch/ia64/src/ivt.S
re5d4294 r743e17b 391 391 392 392 /* 10. call handler */ 393 movl r1 = kernel_image_start393 movl r1 = _hardcoded_load_address 394 394 395 395 mov b1 = loc2 -
kernel/arch/ia64/src/start.S
re5d4294 r743e17b 186 186 movl r20 = (VRN_KERNEL << VRN_SHIFT) ;; 187 187 or r20 = r20, r1 ;; 188 movl r1 = kernel_image_start188 movl r1 = _hardcoded_load_address 189 189 190 190 /* 191 * Initialize bootinfo on BSP.191 * Initialize hardcoded_* variables. Do only BSP 192 192 */ 193 (p3) addl r21 = @gprel(bootinfo), gp ;; 193 (p3) movl r14 = _hardcoded_ktext_size 194 (p3) movl r15 = _hardcoded_kdata_size 195 (p3) movl r16 = _hardcoded_load_address ;; 196 (p3) addl r17 = @gprel(hardcoded_ktext_size), gp 197 (p3) addl r18 = @gprel(hardcoded_kdata_size), gp 198 (p3) addl r19 = @gprel(hardcoded_load_address), gp 199 (p3) addl r21 = @gprel(bootinfo), gp 200 ;; 201 (p3) st8 [r17] = r14 202 (p3) st8 [r18] = r15 203 (p3) st8 [r19] = r16 194 204 (p3) st8 [r21] = r20 195 205 -
kernel/generic/include/main/main.h
re5d4294 r743e17b 38 38 #include <arch/types.h> 39 39 40 extern size_t hardcoded_kdata_size;41 extern size_t hardcoded_ktext_size;42 extern uintptr_t hardcoded_load_address;43 40 extern uintptr_t stack_safe; 44 41 -
kernel/generic/src/main/main.c
re5d4294 r743e17b 101 101 context_t ctx; 102 102 103 /* 104 * These 'hardcoded' variables will be intialized by 105 * the linker or the low level assembler code with 106 * appropriate sizes and addresses. 107 */ 108 109 /** Virtual address of where the kernel is loaded. */ 110 uintptr_t hardcoded_load_address = 0; 111 /** Size of the kernel code in bytes. */ 112 size_t hardcoded_ktext_size = 0; 113 /** Size of the kernel data in bytes. */ 114 size_t hardcoded_kdata_size = 0; 103 115 /** Lowest safe stack virtual address. */ 104 116 uintptr_t stack_safe = 0; -
uspace/srv/vfs/vfs_ops.c
re5d4294 r743e17b 934 934 { 935 935 int fd = IPC_GET_ARG1(*request); 936 size_t size = IPC_GET_ARG2(*request); 936 937 ipcarg_t rc; 937 938
Note:
See TracChangeset
for help on using the changeset viewer.