Changeset 6d4c549 in mainline for contrib/arch
- Timestamp:
- 2009-09-25T15:01:03Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bbf88db
- Parents:
- 2e37308
- Location:
- contrib/arch
- Files:
-
- 12 deleted
- 14 edited
-
hadlbppp.py (modified) (23 diffs)
-
kernel/kernel.adl (modified) (15 diffs)
-
uspace/app/klog/klog.adl (modified) (1 diff)
-
uspace/app/klog/klog.bp (deleted)
-
uspace/srv/bd/rd/rd.adl (modified) (1 diff)
-
uspace/srv/bd/rd/rd.bp (deleted)
-
uspace/srv/console/console.adl (modified) (1 diff)
-
uspace/srv/console/console_server.bp (deleted)
-
uspace/srv/devmap/devmap.adl (modified) (1 diff)
-
uspace/srv/devmap/devmap_server.bp (deleted)
-
uspace/srv/fb/fb.adl (modified) (1 diff)
-
uspace/srv/fb/fb_server.bp (deleted)
-
uspace/srv/fs/devfs/devfs.adl (modified) (1 diff)
-
uspace/srv/fs/devfs/devfs_server.bp (deleted)
-
uspace/srv/fs/fat/fat.adl (modified) (1 diff)
-
uspace/srv/fs/fat/fat_server.bp (deleted)
-
uspace/srv/fs/tmpfs/tmpfs.adl (modified) (1 diff)
-
uspace/srv/fs/tmpfs/tmpfs_server.bp (deleted)
-
uspace/srv/kbd/kbd.adl (modified) (1 diff)
-
uspace/srv/kbd/kbd_server.bp (deleted)
-
uspace/srv/loader/loader.adl (modified) (1 diff)
-
uspace/srv/loader/loader_server.bp (deleted)
-
uspace/srv/pci/pci.adl (modified) (1 diff)
-
uspace/srv/pci/pci_server.bp (deleted)
-
uspace/srv/vfs/vfs.adl (modified) (1 diff)
-
uspace/srv/vfs/vfs_server.bp (deleted)
Legend:
- Unmodified
- Added
- Removed
-
contrib/arch/hadlbppp.py
r2e37308 r6d4c549 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>" % prname44 print "%s <--dumpbp|--dumpadl|--noop>+ <OUTPUT>" % prname 45 45 46 46 def tabs(cnt): … … 246 246 "Convert interface Behavior Protocol to generic protocol" 247 247 248 result = [ "("]248 result = [] 249 249 i = 0 250 250 … … 266 266 i += 1 267 267 268 result.append(")")269 result.append("*")270 271 268 return result 272 269 273 def merge_bp( protocols):270 def merge_bp(initialization, finalization, protocols): 274 271 "Merge several Behavior Protocols" 275 272 273 indep = [] 274 276 275 if (len(protocols) > 1): 277 result = []278 276 first = True 279 277 … … 282 280 first = False 283 281 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 [] 282 indep.append("|") 283 284 indep.append("(") 285 indep.extend(protocol) 286 indep.append(")") 287 elif (len(protocols) == 1): 288 indep = protocols[0] 289 290 inited = [] 291 292 if (initialization != None): 293 if (len(indep) > 0): 294 inited.append("(") 295 inited.extend(initialization) 296 inited.append(")") 297 inited.append(";") 298 inited.append("(") 299 inited.extend(indep) 300 inited.append(")") 301 else: 302 inited = initialization 303 else: 304 inited = indep 305 306 finited = [] 307 308 if (finalization != None): 309 if (len(inited) > 0): 310 finited.append("(") 311 finited.extend(inited) 312 finited.append(")") 313 finited.append(";") 314 finited.append("(") 315 finited.extend(finalization) 316 finited.append(")") 317 else: 318 finited = finalization 319 else: 320 finited = inited 321 322 return finited 296 323 297 324 def parse_bp(name, tokens, base_indent): … … 373 400 "Dump Behavior Protocol of a given frame" 374 401 402 global opt_bp 403 375 404 fname = "%s.bp" % frame['name'] 376 405 377 archf.write("instantiate %s from \"%s\"\n" % (var, fname)) 406 if (archf != None): 407 archf.write("instantiate %s from \"%s\"\n" % (var, fname)) 408 378 409 outname = os.path.join(outdir, fname) 379 410 … … 381 412 if ('protocol' in frame): 382 413 protocols.append(frame['protocol']) 414 415 if ('initialization' in frame): 416 initialization = frame['initialization'] 417 else: 418 initialization = None 419 420 if ('finalization' in frame): 421 finalization = frame['finalization'] 422 else: 423 finalization = None 383 424 384 425 if ('provides' in frame): … … 393 434 print "%s: Provided interface '%s' is undefined" % (frame['name'], provides['iface']) 394 435 395 outf = file(outname, "w") 396 outf.write(parse_bp(outname, merge_bp(protocols), 0)) 397 outf.close() 436 437 if (opt_bp): 438 outf = file(outname, "w") 439 outf.write(parse_bp(outname, merge_bp(initialization, finalization, protocols), 0)) 440 outf.close() 398 441 399 442 def get_system_arch(): … … 431 474 "Create null frame protocol" 432 475 433 archf.write("frame \"%s\"\n" % fname) 476 global opt_bp 477 478 if (archf != None): 479 archf.write("frame \"%s\"\n" % fname) 480 434 481 outname = os.path.join(outdir, fname) 435 482 436 outf = file(outname, "w") 437 outf.write("NULL") 438 outf.close() 483 if (opt_bp): 484 outf = file(outname, "w") 485 outf.write("NULL") 486 outf.close() 439 487 440 488 def flatten_binds(binds, delegates, subsumes): … … 521 569 "Dump system architecture Behavior Protocol" 522 570 571 global opt_bp 572 523 573 arch = get_system_arch() 524 574 … … 562 612 break 563 613 614 564 615 outname = os.path.join(outdir, "%s.archbp" % arch['name']) 565 outf = file(outname, "w") 616 if (opt_bp): 617 outf = file(outname, "w") 618 else: 619 outf = None 566 620 567 621 create_null_bp("null.bp", outdir, outf) … … 573 627 574 628 for dst, src in directed_binds.items(): 575 outf.write("bind %s to %s\n" % (", ".join(src), dst)) 576 577 outf.close() 629 if (outf != None): 630 outf.write("bind %s to %s\n" % (", ".join(src), dst)) 631 632 if (outf != None): 633 outf.close() 578 634 579 635 def preproc_adl(raw, inarg): … … 591 647 global frame 592 648 global protocol 649 global initialization 650 global finalization 593 651 594 652 global iface_properties … … 689 747 690 748 if (BODY in context): 749 if (FINALIZATION in context): 750 if (token == "{"): 751 indent += 1 752 elif (token == "}"): 753 indent -= 1 754 755 if (((token[-1] == ":") and (indent == 0)) or (indent == -1)): 756 bp = split_bp(finalization) 757 finalization = None 758 759 if (not frame in frame_properties): 760 frame_properties[frame] = {} 761 762 if ('finalization' in frame_properties[frame]): 763 print "%s: Finalization protocol for frame '%s' already defined" % (inname, frame) 764 else: 765 frame_properties[frame]['finalization'] = bp 766 767 output += "\n%s" % tabs(2) 768 output += parse_bp(inname, bp, 2) 769 770 context.remove(FINALIZATION) 771 if (indent == -1): 772 output += "\n%s" % token 773 context.remove(BODY) 774 context.add(NULL) 775 indent = 0 776 continue 777 else: 778 indent = 2 779 else: 780 finalization += token 781 continue 782 783 if (INITIALIZATION in context): 784 if (token == "{"): 785 indent += 1 786 elif (token == "}"): 787 indent -= 1 788 789 if (((token[-1] == ":") and (indent == 0)) or (indent == -1)): 790 bp = split_bp(initialization) 791 initialization = None 792 793 if (not frame in frame_properties): 794 frame_properties[frame] = {} 795 796 if ('initialization' in frame_properties[frame]): 797 print "%s: Initialization protocol for frame '%s' already defined" % (inname, frame) 798 else: 799 frame_properties[frame]['initialization'] = bp 800 801 output += "\n%s" % tabs(2) 802 output += parse_bp(inname, bp, 2) 803 804 context.remove(INITIALIZATION) 805 if (indent == -1): 806 output += "\n%s" % token 807 context.remove(BODY) 808 context.add(NULL) 809 indent = 0 810 continue 811 else: 812 indent = 2 813 else: 814 initialization += token 815 continue 816 691 817 if (PROTOCOL in context): 692 818 if (token == "{"): … … 695 821 indent -= 1 696 822 697 if ( indent == -1):823 if (((token[-1] == ":") and (indent == 0)) or (indent == -1)): 698 824 bp = split_bp(protocol) 699 825 protocol = None … … 709 835 output += "\n%s" % tabs(2) 710 836 output += parse_bp(inname, bp, 2) 711 output += "\n%s" % token712 indent = 0713 837 714 838 context.remove(PROTOCOL) 715 context.remove(BODY) 716 context.add(NULL) 839 if (indent == -1): 840 output += "\n%s" % token 841 context.remove(BODY) 842 context.add(NULL) 843 indent = 0 844 continue 845 else: 846 indent = 2 717 847 else: 718 848 protocol += token 719 720 continue 849 continue 721 850 722 851 if (REQUIRES in context): … … 816 945 output += "\n%s%s" % (tabs(indent - 1), token) 817 946 context.add(PROVIDES) 818 protocol = ""819 947 continue 820 948 … … 822 950 output += "\n%s%s" % (tabs(indent - 1), token) 823 951 context.add(REQUIRES) 824 protocol = "" 952 continue 953 954 if (token == "initialization:"): 955 output += "\n%s%s" % (tabs(indent - 1), token) 956 indent = 0 957 context.add(INITIALIZATION) 958 initialization = "" 959 continue 960 961 if (token == "finalization:"): 962 output += "\n%s%s" % (tabs(indent - 1), token) 963 indent = 0 964 context.add(FINALIZATION) 965 finalization = "" 825 966 continue 826 967 … … 1012 1153 print "%s: Expected inherited interface name in interface head '%s'" % (inname, interface) 1013 1154 else: 1014 output += " %s" % token1155 output += "%s " % token 1015 1156 if (not interface in iface_properties): 1016 1157 iface_properties[interface] = {} … … 1023 1164 1024 1165 if (token == "extends"): 1025 output += " %s" % token1166 output += "%s " % token 1026 1167 context.add(EXTENDS) 1027 1168 continue … … 1376 1517 global frame 1377 1518 global protocol 1519 global initialization 1520 global finalization 1378 1521 1379 1522 global arg0 1523 1524 global opt_adl 1380 1525 1381 1526 output = "" … … 1385 1530 frame = None 1386 1531 protocol = None 1532 initialization = None 1533 finalization = None 1387 1534 arg0 = None 1388 1535 … … 1390 1537 output = output.strip() 1391 1538 1392 if ( output != ""):1539 if ((output != "") and (opt_adl)): 1393 1540 outf = file(outname, "w") 1394 1541 outf.write(output) … … 1416 1563 global frame_properties 1417 1564 global arch_properties 1418 1419 if (len(sys.argv) < 2): 1565 global opt_bp 1566 global opt_adl 1567 1568 if (len(sys.argv) < 3): 1420 1569 usage(sys.argv[0]) 1421 1570 return 1422 1571 1423 path = os.path.abspath(sys.argv[1]) 1572 opt_bp = False 1573 opt_adl = False 1574 1575 for arg in sys.argv[1:(len(sys.argv) - 1)]: 1576 if (arg == "--dumpbp"): 1577 opt_bp = True 1578 elif (arg == "--dumpadl"): 1579 opt_adl = True 1580 elif (arg == "--noop"): 1581 pass 1582 else: 1583 print "Error: Unknown command line option '%s'" % arg 1584 return 1585 1586 path = os.path.abspath(sys.argv[-1]) 1424 1587 if (not os.path.isdir(path)): 1425 1588 print "Error: <OUTPUT> is not a directory" -
contrib/arch/kernel/kernel.adl
r2e37308 r6d4c549 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
r2e37308 r6d4c549 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/srv/bd/rd/rd.adl
r2e37308 r6d4c549 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
r2e37308 r6d4c549 52 52 ns ns; 53 53 sys_console sys_console; 54 initialization: 55 !ns.ipc_m_connect_me_to /* kbd */ ; 56 !kbd.ipc_m_connect_to_me ; 57 !ns.ipc_m_connect_me_to /* fb */ ; 58 [/uspace/lib/libc/fnc.devmap_driver_register] ; 59 !fb.get_resolution ; 60 ( 61 [fnc.vp_create] + 62 [fnc.vp_switch] 63 )* ; 64 [fnc.make_pixmap]* ; 65 [fnc.make_anim] ; 66 [fnc.vp_switch] ; 67 !fb.flush ; 68 !fb.get_csize ; 69 !fb.get_color_cap ; 70 !fb.ipc_m_share_out ; 71 [/uspace/lib/libc/fnc.devmap_device_register]* ; 72 !sys_console.sys_disable_console ; 73 [fnc.gcons_redraw_console] ; 74 [fnc.set_rgb_color] ; 75 [fnc.screen_clear] ; 76 [fnc.curs_goto] ; 77 [fnc.curs_visibility] 54 78 protocol: 55 [/uspace/lib/libc/protocol] | 56 [console_server.bp] 79 [/uspace/lib/libc/protocol] 57 80 }; 58 81 -
contrib/arch/uspace/srv/devmap/devmap.adl
r2e37308 r6d4c549 63 63 [/uspace/lib/libc/requires] 64 64 ns ns; 65 initialization: 66 !ns.ipc_m_connect_to_me /* devmap */ 65 67 protocol: 66 [/uspace/lib/libc/protocol] | 67 [devmap_server.bp] 68 [/uspace/lib/libc/protocol] 68 69 }; -
contrib/arch/uspace/srv/fb/fb.adl
r2e37308 r6d4c549 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
r2e37308 r6d4c549 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
r2e37308 r6d4c549 12 12 ns ns; 13 13 rd rd; 14 initialization: 15 !ns.ipc_m_connect_me_to /* vfs */ ; 16 [/uspace/lib/libfs/fnc.fs_register] 14 17 protocol: 15 [/uspace/lib/libc/protocol] | 16 [fat_server.bp] 18 [/uspace/lib/libc/protocol] 17 19 }; -
contrib/arch/uspace/srv/fs/tmpfs/tmpfs.adl
r2e37308 r6d4c549 12 12 ns ns; 13 13 rd rd; 14 initialization: 15 !ns.ipc_m_connect_me_to /* vfs */ ; 16 [/uspace/lib/libfs/fnc.fs_register] 14 17 protocol: 15 [/uspace/lib/libc/protocol] | 16 [tmpfs_server.bp] 18 [/uspace/lib/libc/protocol] 17 19 }; -
contrib/arch/uspace/srv/kbd/kbd.adl
r2e37308 r6d4c549 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
r2e37308 r6d4c549 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/pci/pci.adl
r2e37308 r6d4c549 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
r2e37308 r6d4c549 92 92 devfs devfs; 93 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
Note:
See TracChangeset
for help on using the changeset viewer.
