Disabling Palm OS mem protection (was: Status of Palm III port?)

wirth at almaden.ibm.com wirth at almaden.ibm.com
Sun Aug 9 06:47:37 UTC 1998


Maurice Rabb responded:
......Have you been following the thread "Smalltalk in A PDA" on c.l.s?
Andrew
Brault has been working on a really interesting Smalltalk-- for the Pilot.
It is not Squeak, but it is very very small.  He mentions that he disables
memory protection to get around.
....
> I _think_ I have most of the memory problems worked out.  It all
> seems to boil down to turning memory protection off with
> MemSemaphoreReserve()  (gack!)
....
> Andrew Brault <ajb at tiac.net>
=========================

Maurice,

Thanks!!!  I took a quick look in my Palm programming library (about 4,000
pages of Palm programming docs, in Acrobat PDF and indexed) and found the
following three references to MemSemaphoreReserve:

In Darrin Massena's Pilot Hack Tutorial
(http://www.massena.com/darrin/pilot/PilotHackTutorial.htm):
======================================================
Very interesting! The first 32K of the Pilot's address space is RAM that is
 duplicated (simultaneously
mapped to) the range $1000000-$10007fff. The memory from $0000000-$00007fff
 can be read from,
written to, and executed from but the memory starting at $10000000 can only
 be read or executed -- no
writing without gaining permission from an API (I later discovered) called
MemSemaphoreReserve. The
Pilot appears to support at least a primitive form of hardware memory
protection which is used to
separate "Dynamic" (Palm's term) from "Storage" RAM and keep rogue programs
 from trashing
persistent system data structures, user data, and other programs
accidentally. This is not real data
security, just a very sensible precaution that should protect from the
majority of random software
happenings.

In the GNU Pilot Programming FAQ
(http://www.geocities.com/SiliconValley/Horizon/5249/GNU_Pilot_SDK.txt):
======================================================
7.3.2. Can I use a Database to simulate large memory chunks?
Yes you can. Take a look at the source code for Wes Cherry's
2-bits-per-pixel bitmap utilities at
<URL:http://www.scumby.com/scumbysoft/pilot/win2/>. The function
_Win2DoAllocScreen() in the file win2.c uses the API function
MemSemaphoreReserve() to accomplish this trick.

Note: This code contains the comment:
|    Note that you must call MemSemaphoreReserve(1) to gain write-access to
 the chunk
|    (call MemSemaphoreRelease(1) to restore protection)

And in the official Palm OS 3.0 docs, Developing Palm OS 3.0 Applications,
Part III: Memory and Communications Management
======================================================
          MemSemaphoreReserve
Prototype      Err MemSemaphoreReserve (Boolean writeAccess)
          WARMING(sic :-): This function for use by system software only.

======================================================

Guess I should have gone to the net to ask this question earlier :-)
Thanks for the help.  Now the question is when I'll have time to put any
work in on the port of Squeak to the Palm OS (since I'm working on another
port now).



Mike Wirth





More information about the Squeak-dev mailing list