[Info-vax] Virtual memory 101 (was Re: Android development...)

Stephen Hoffman seaohveh at hoffmanlabs.invalid
Tue Sep 23 21:30:49 EDT 2014


On 2014-09-23 23:41:54 +0000, JF Mezei said:

> So what happens between my application's "callbranch" instruction and 
> the first instruction in the system service transfer routine that 
> causes CALL_PAL CHMK instruction to magically be permitted ?

Basically, nothing special.   See figure 4 
<http://h71000.www7.hp.com/openvms/journal/v8/ssi.html>.

> How does it work on Alpha/VAX ?  Are there also memory pages that are 
> created with special privileges that enable certain assembler 
> instructions when they are executed from within those pages ? Or is 
> there another mechanism ?

The specific sequence involved is always based on and entirely 
dependent on the underlying hardware architecture.   All processor 
architectures providing two (or more) modes or rings and some form of 
memory management page protections will have some analog to a call gate 
or change mode.

On VAX and Alpha, the change-mode operation — an instruction on VAX, a 
PALcode call on Alpha — triggers what is called an exception, and the 
exception is then received and processed by the system service 
dispatcher, which looks at how it was called, and (it's a dispatcher, 
after all) dispatches to the system service.

Your next question undoubtedly being about the details of the change 
mode instruction and the PALcode operation and the exception handler, 
of course.  See DEC Standard 32 (EL-00032-00) 
<http://bitsavers.informatik.uni-stuttgart.de/pdf/dec/vax/archSpec/> 
and the Alpha architecture reference manual for those details 
<http://download.majix.org/dec/alpha_arch_ref.pdf>.

Feel free to check the IDSM or the VMS source listings for further 
details of the exception handler as well as of the system service 
dispatcher, as well.

Now as for where you're inevitably headed here, see some of the 
available resources including <http://en.wikipedia.org/wiki/Call_gate> 
and 
<http://stackoverflow.com/questions/6683276/task-gate-interrupt-gate-call-gate>, 
as well the Intel x86-64 documentation, and examples such as those in 
Linux or Minix 
<http://www.cis.syr.edu/~wedu/seed/Labs/Documentation/Minix3/System_call_sequence.pdf>. 


I've previously linked to computer architecture classes.  If you're at 
all interested in this stuff, that knowledge will help you understand 
what VMS and most other operating systems can or will provide, and how 
— combine that with Linux, BSD or Minix, as an example for you to 
study.  Learning from how VMS operates here probably isn't the best 
approach here, either.  Not unless you have the time and effort and 
source code or source listings access, and maybe not then.


-- 
Pure Personal Opinion | HoffmanLabs LLC




More information about the Info-vax mailing list