From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,PLING_QUERY autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9a5e0182cbfaa45b,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!f25g2000yqc.googlegroups.com!not-for-mail From: Francesco PIRANEO GIULIANO Newsgroups: comp.lang.ada Subject: Does mmap gives a right result?! Date: Sun, 3 Oct 2010 04:27:25 -0700 (PDT) Organization: http://groups.google.com Message-ID: <459d08e4-1370-4925-9d9f-64ee0f472c19@f25g2000yqc.googlegroups.com> NNTP-Posting-Host: 81.253.0.50 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1286105245 9260 127.0.0.1 (3 Oct 2010 11:27:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 3 Oct 2010 11:27:25 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f25g2000yqc.googlegroups.com; posting-host=81.253.0.50; posting-account=xw7-jwoAAACQO3jUfKtbSvv-viNG0IGt User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; it; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:14364 Date: 2010-10-03T04:27:25-07:00 List-Id: Hi all, always trying to handle linux framebuffer with ada; big goal reached yesterday accessing fixed and variable data structures importing and executing ioctl functions. Now I have to draw inside the framebuffer and I've imported mmap as follows: function mmap(addr : in u32; length : in u32; prot : in mmap_prot; flags : in mmap_flag; fd : in file_id; offset : in u32) return Void_Ptr; pragma import( C, mmap, "mmap" ); pragma import_function(mmap); Void_Ptr is defined as follows: type void is mod System.Memory_Size; for void'Size use System.Word_Size; type Void_Ptr is access all Void; pragma Convention (C, Void_Ptr); The lines above has been derived by: http://en.wikibooks.org/wiki/Ada_Programming/Types/access#Where_is_void.2A.3F Finally, the mmap has been called as follows: fbindex := mmap(0, fbhandler.fixinfo.smem_len, fbhandler.PROT_READ + fbhandler.PROT_WRITE, fbhandler.MAP_FILE + fbhandler.MAP_SHARED, fbid, 0); NOTE: I defined PROT_READ and so on as constants in my code; First question: I have to analyze if fbindex is /= -1 otherwise I have to raise an exception: if integer(fbindex) = -1 then raise BADMMAPRESULT; end if; ...seems to be the most logical comparision BUT the following error in compile phase appears: "illegal operand for numeric conversion" -- Any help is really apreciated here! :-) When commenting out the above instructions and starting the compiled application, everything goes right except, when I try to draw inside the first location the program hungs with the following: raised STORAGE_ERROR : stack overflow (or erroneous memory access) I'm quite sure my mmap doesn't run properly. I'm about to makes all framebuffer's interfacing functions in C then implement the remaining in Ada but it will be a nice things if everything can be made with the same language. Any clues or opinion is welcome about. Francesco