Enhancements in iOSB for Fast Program Loading

Slide Note
Embed
Share

Utilizing the iOSB I/O block with a size of 8, new functions such as readblock_tape and writeblock_tape are introduced to support quick loading of programs on iOSB systems. Corresponding functions for disk operations and file creation from existing files are also detailed. Additionally, changes in memory access for user code pages are explained to improve efficiency.


Uploaded on Sep 21, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. New bits in iosb to support fast loading of programs: iosb_ioblock = 8; let readblock_tape(iosb, buff) be { let r; if buff = nil then buff := iosb ! iosb_buffer; r := devctl(dc$taperead, iosb ! iosb_unit, buff); if r >= 0 then zero_remainder(buff, r, 128); resultis r } let writeblock_tape(iosb, buff, num) be { let r; if buff = nil then buff := iosb ! iosb_buffer; r := devctl(dc$tapewrite, iosb ! iosb_unit, buff, num); resultis r }

  2. Corresponding parts in the shell: let readblock_disc(iosb, buff) be { ... } let writeblock_disc(iosb, buff, num) be { ... } let fast_create_file_from_file(tof, fromf) be { let r, num, buff = vec(128); if tof = tty \/ fromf = tty then { ... resultis err$software } while true do { num := readblock(fromf, buff); if num < 0 then resultis num; r := writeblock(tof, buff, num); if r < 0 then resultis r; if num < 512 then break } resultis 1 }

  3. Corresponding parts in the shell: let readblock_disc(iosb, buff) be { ... } let writeblock_disc(iosb, buff, num) be { ... } let fast_create_file_from_file(tof, fromf) be { let r, num, buff = vec(128); if tof = tty \/ fromf = tty then { ... resultis err$software } while true do { num := readblock(fromf, buff); if num < 0 then resultis num; r := writeblock(tof, buff, num); if r < 0 then resultis r; if num < 512 then break } resultis 1 }

  4. Change in the attic for access to user code pages too: OSAPT_first_page_offset = 0, OSAPT_usr_stack_pt_offset = 1, OSAPT_usr_code_pt_offset = 2, OSAPT_free_pages_offset = 3, first_attic_page_VA = 0xC0000000 + (OSAPT_first_page_offset << 11), usr_stack_pt_VA = 0xC0000000 + (OSAPT_usr_stack_pt_offset << 11), usr_code_pt_VA = 0xC0000000 + (OSAPT_usr_code_pt_offset << 11), free_list_VA = 0xC0000000 + (OSAPT_free_pages_offset << 11), OSA_num_free_pages_offset = 0, OSA_num_allocated_pages_offset = 1, OSA_intvec_offset = 2, OSA_kbbuff_offset = 2 + sizeof$intvec, OSA____use_this_slot_next = 2 + sizeof$intvec + kbbuff_len_words, num_free_pages_VA = first_attic_page_VA + OSA_num_free_pages_offset, num_allocated_pages_VA = first_attic_page_VA + OSA_num_allocated_pages_offset, intvec_VA = first_attic_page_VA + OSA_intvec_offset, kbbuff_VA = first_attic_page_VA + OSA_kbbuff_offset }

  5. The OS will need a heap if it is to open any files with iosb static { os_heap_VA, os_heap_size_pages = 2 } os_heap_VA := programs_last_page + page$size + 0x80000000; // make the currently executing program appear at 0x80000000 and above srcaddr := 0; // beginning of page about to be copied pn := 0; // page count while srcaddr ##<= programs_last_page do { let destaddr = get_free_page(); ... as before ... for i = 1 to os_heap_size_pages do { os_code_PT ! pn := get_free_page() bitor page$validmask; pn +:= 1 }

  6. run_user has changed its name: let continue_under_virtual_memory() be { $set_special_register(sr$syssp, 0xC0000000); $set_special_register(sr$sysfp, 0xC0000000); $set_special_register(sr$timer, 25000000); util_reset_statics(); heap_reset_statics(); iosb2_reset_statics(); reset_statics(); init(os_heap_VA, os_heap_size_pages * page$size); load_and_run_user_program() }

  7. let load_and_run_user_program() be { let f, pageinpt = 0, offsetinpage = 0x200, addr = 0x200; f := tape_open_r("runme.exe"); if f = ERROR then { write(tty, "could not open file\n"); resultis ERROR } get_new_page(0); while true do { let r; r := readblock(f, addr); if r <= 0 then break; addr +:= 128; offsetinpage +:= 128; if offsetinpage >= 2048 then { pageinpt +:= 1; offsetinpage := 0; get_new_page(pageinpt) } } $set_special_register(sr$usrsp, 0x80000000); $set_special_register(sr$usrfp, 0x80000000); $set_flag(flag$sys, 0); 0x200() }

  8. let get_new_page(entry) be { let p; if ! num_free_pages_VA <= 0 then resultis ERROR; p := free_list_VA ! ! num_allocated_pages_VA; ! num_allocated_pages_VA +:= 1; ! num_free_pages_VA -:= 1; usr_code_pt_VA ! entry := p bitor page$validmask; resultis 1 }

  9. $ cat runme.b import "io" let start() be { outs("\n**** runme is running ****\n") } $ run memc 0: 00000000 to 0000185A ... ... ... 0: pp 9 for VAs 0x00000000 to 0x003fffff: **** runme is running **** The OS is in charge again, but there is nothing for it to do $

Related


More Related Content