<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>That's useful to know. It makes implementing memory allocation very straight forward. All I'd need to implement would be some calls for setting aside pages of memory and setting their read/write status, which would be directly supported by the hardware.</div><div><br></div><div>It also occurs to me I'd have to write some sort of loader, which shouldn't be difficult as long as I can link the m3 program into some sort of monolithic "raw" format that I can just copy into a fixed place in memory and start executing.</div><div><br></div><div><br></div><br><div><div>On Jan 4, 2013, at 4:36 PM, Jay K wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; "><div dir="ltr">Clarification regarding mmap.<br> <br> <br>mmap has two fairly different purposes in Posix.<br> <br> <br> 1) to "map a file" into memory<span class="Apple-converted-space"> </span><br> 2) to "allocate memory", probably with address and size page-aligned, probably for relatively large allocations (i.e. ones you don't mind rounding up to a page size). <span class="Apple-converted-space"> </span><br> <br> #1 is the more obvious probably better known use. The one I knew of. The one it sounds like.<span class="Apple-converted-space"> </span><br> #2 is what we use it for. <span class="Apple-converted-space"> </span><br> <br> <br>If we ever autoconf-m3core, it'd probably be reasonable to do something like:<br> <br> <br>#if HAS_MMAP<br>return mmap(...);<br> <br>#elif HAS_CALLOC<br> <br>void** p = (void**)calloc(size + sizeof(void*));<br>if (!p) return p;<br>p[0] = p;<br>return p + 1;<br> <br>#else<br>#error<br>#endif<br> <br> <br>#if HAS_MMAP<br>munmap(...);<br> <br>#elif HAS_CALLOC<br> <br>if (p)<br> free(((void**)p)[-1]);<br> <br>#endif<br> <br> <br>alternatively though, look for every directory named "POSIX" and make a copy of it, and modify as needed.<br>Including assert(0) in places.<br>Invent your own value for "OS_TYPE".<br> <br> <br>Maybe<br> #define OS_TYPE_FOO<span class="Apple-converted-space"> </span><br> #include ../POSIX/Foo.c<span class="Apple-converted-space"> </span><br> <br>and #ifndef OS_TYPE_FOO in Foo.c, if it isn't too messy.<br> <br> <br>Sharing code can be good or bad.<br> <br> <br>We don't actually use "memory protection".<br>Er, well..maybe we do...we might have code that allocates stacks, and makes a page at either end inaccessible.<br>This is nice. It might be required for "safety".<br>It might also be a good idea to have a flag in Target.i3 that says the target needs calls in prologues to check for stack overflow, and use that instead.<br>More portable -- i.e. doesn't require hardware page protection -- but bigger/bloated/slower.<br> <br> <br> <br>Really you need to look at all the POSIX/PTHREAD/WIN32 directories, esp. in m3core and libm3.<br>You make a much different system, you get to do the port.<br>It is neither impossible nor a no-op.<br> <br> <br> - Jay<br><br><br><br><br> <br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">From:<span class="Apple-converted-space"> </span><a href="mailto:darko@darko.org">darko@darko.org</a><br>Date: Fri, 4 Jan 2013 12:09:26 -0800<br>To:<span class="Apple-converted-space"> </span><a href="mailto:dabenavidesd@yahoo.es">dabenavidesd@yahoo.es</a><br>CC:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>Subject: Re: [M3devel] Bare Metal Modula-3<br><br><div>It's not a realtime system, so that's not a problem. Have a look at my reply to Jay you'll see a fuller description of what I have in mind.</div><div><br></div><br><div><div>On Jan 4, 2013, at 10:46 AM, Daniel Alejandro Benavides D. wrote:</div><br class="ecxApple-interchange-newline"><blockquote><table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td valign="top" style="font: inherit; font-stretch: inherit; ">Hi all:<br>I think you just need runtime executive on top a machine would be enough.<br>For instance VAXELN.<span class="Apple-converted-space"> </span><br>Problem is you would need realtime core services at the language level (somehow SPIN services with no protection overhead caused by language).<br>Memory managament. and threading are core services in VAXELN as part of system, just need bindings for each language.<br>I guess you need and advanced distributed realtime system. Such was VMS 5 for rtVAX9000:<br><a href="http://books.google.com.co/books?id=TzUXAQAAMAAJ&dq=" target="_blank">http://books.google.com.co/books?id=TzUXAQAAMAAJ&dq=</a>"%2C+in+conjunction+with+VMS.+VAXELN%2C+which+provides+optimal+performance+for"&q="+which+provides+optimal+performance+for"#search_anchor<br><br>My hypothesis is that you can't bring up a realtime application in an embedded device like you want.<br>I know of realtime OS in Modula-3, there must be several ones I guess, based on what I have researched but you can not trust whether they are embedded, that's the problem.<br>Thanks in advance<br><br><br>--- El<span class="Apple-converted-space"> </span><b>vie, 4/1/13, Darko<span class="Apple-converted-space"> </span><i><<a href="mailto:darko@darko.org">darko@darko.org</a>></i></b><span class="Apple-converted-space"> </span>escribió:<br><blockquote style="padding-left: 5px; margin-left: 5px; "><br>De: Darko <<a href="mailto:darko@darko.org">darko@darko.org</a>><br>Asunto: [M3devel] Bare Metal Modula-3<br>Para: "m3devel developers" <<a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a>><br>Fecha: viernes, 4 de enero, 2013 04:16<br><br><div class="ecxplainMail">I'm interested in deploying M3 into a kind-of embedded environment where efficiency and performance are key and I want to avoid installing an OS beyond a simple supervisor that manages the hardware.<span class="Apple-converted-space"> </span><br><br>The services needed are threading, memory allocation and network access. I'm figuring the first two already exist in M3 and a network stack can be found.<br><br>The question I have is can all of the OS specific runtime can be removed? Beyond maybe a timer and possibly some memory protection functionality, what does M3 need to run threading and garbage collection?<br><br>- Darko<br><br></div></blockquote></td></tr></tbody></table></blockquote></div><br></div></div></div></span><br class="Apple-interchange-newline"></blockquote></div><br></body></html>