Are cineva totusi vreo idee? Flag-urile par ok?<br><br>Thanks,<br>Cosmin<br>
<br><br><div class="gmail_quote">2011/4/23 Cosmin Stefan-Dobrin <span dir="ltr"><<a href="mailto:cosminstefanxp@gmail.com">cosminstefanxp@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Salut,<br><br>Asa cum spune si titlul, am o mica problema cu sincronizarea datelor in fisierul de ram (functia w_sync_mapping). Mai exact, la testul 22, test_mapping_write_is_carried_through_to_file, in apelul w_sync_mapping, functia FlushViewOfFile imi iese cu eroare. Mai jos sa gaseste outputul meu:<br>
<br>============================================================================<br>Z:\so\tema3\win>vmsim_test 22<br>[LIB][DEBUG] Page SIZE: 65536<br>[LIB][DEBUG] Init finished.<br>[LIB][DEBUG] Creating new allocation of 10 pages and 4 frames.<br>
[LIB][DEBUG] VirtualAlloc (reserve) returned 00350000.<br>[LIB][DEBUG] Virtual memory mapping successful at address: '00350000'.<br>[LIB][DEBUG] Created '.\swp361.tmp' swap file.<br>[LIB][DEBUG] Created '.\ram362.tmp' ram file.<br>
[LIB][DEBUG] Page Table and Frame Table initialization complete.<br>[LIB][DEBUG] Alloc complete.<br>[TESTER][DEBUG] exception address: 004029B0<br>[LIB][DEBUG] Page Fault Handler triggered at address '00352EE5'.<br>
[LIB][DEBUG] Page 0 starting at 00350000 (Dirty 0, Prot 2, State 2) on allocation starting at 00350000.<br>[LIB][DEBUG] Page not alloc'ed. Alloc'ing on frame '0'.<br>[LIB][DEBUG] Alloc'ing on frame 0 with previous page table association 00000000.<br>
[LIB][DEBUG] Ret Val: 00350000; Page Start: 00350000; 0<br>[LIB][DEBUG] Page cleaning...<br>[LIB][DEBUG] Ret Val: 00350000; Page Start: 00350000; 0<br>[LIB][DEBUG] Page mapped on ram on frame 0.<br>
[LIB][DEBUG] Page Handler FINISHED.<br>[TESTER][DEBUG] exception address: 004029B0<br>[LIB][DEBUG] Page Fault Handler triggered at address '00352EE5'.<br>[LIB][DEBUG] Page 0 starting at 00350000 (Dirty 0, Prot 0, State 0) on allocation starting at 00350000.<br>
[LIB][DEBUG] Page in RAM. Changing protection to RW.<br>[LIB][DEBUG] Old file mapping unmapped. Mapping with new rights on same frame 0...<br>[LIB][DEBUG] Ret Val: 00350000; Page Start: 00350000; 0<br>[LIB][DEBUG] Page Handler FINISHED.<br>
[TESTER][DEBUG] After write, in memory: 18<br>EroareWSync: Attempt to access invalid address.<br>[TESTER][DEBUG] Found 0; Should've been: 18<br>[TESTER][DEBUG] Found 0; Should've been: 18<br>[TESTER][DEBUG] Found 0; Should've been: 18<br>
[TESTER][DEBUG] Found 0; Should've been: 18<br>test_mapping_write_is_carried_through_to_file...............failed [ 0/100]<br>============================================================================<br><br>Dupa cum se observa, in ultima portiune, FlushViewOfFile imi iese cu eroarea Attempt to access invalid address. Daca in apelul w_sync_mapping din functia de test pun 1 (sa imi flush-uiasca __doar prima pagina__), testul trece cu brio. Deci evident e o problema cand acel flush intra peste paginile care sunt mapate in memorie (VirtualAlloc), dupa pagina mapata peste fisier. <br>
<br>Si ca o scurta descriere a ce am facut in cod, initial am mapat (ca in exemplu), granular, fiecare pagina virtuala cu flagurile:<br>VirtualAlloc( addr, page_size, MEM_RESERVE | MEM_COMMIT, PAGE_NOACCESS);<br><br>si apoi, la maparea fisierului ram, realizez VirtualFree, Creez un FileMapping cu flagurile:<br>
CreateFileMapping( file_handle, NULL, (DWORD) PAGE_READWRITE, 0, 0, NULL);<br><br>si mapez fisierul:<br>MapViewOfFileEx( mHandle, desired_access, 0, file_page_no*page_size, page_size, address);<br><br>Am pus flagurile mai sus pentru ca probabil e o problema la alocare sau mapare.<br>
<br>Thanks for your help!<br><br>Sarbatori fericite,<br><font color="#888888">Cosmin<br>
</font></blockquote></div><br>