|
|
researchv9-SUN3(old)
| @(#)s2map.s 1.1 86/02/03 Copyr 1983 Sun Micro | | Copyright (c) 1984 by Sun Microsystems, Inc. | | /* | * Memory Mapping and Paging on the Sun 2 | * | * This is intended to be used for both standalone code (ROM Monitor, | * Diagnostics, boot programs, etc) and for the Unix kernel. IF YOU HAVE | * TO CHANGE IT to fit your application, MOVE THE CHANGE BACK TO THE PUBLIC | * COPY, and make sure the change is upward-compatible. The last thing we | * need is seventeen different copies of this file, like we have with the | * Sun-1 header files. | * | * This file corresponds to version 1.0 of the Sun-2 Design Reference. | * (1 April 83) | */ | | /* | * Mapping registers are accessed thru the movs instruction in the Sun-2. | * | * The following subroutines accept any address in the mappable range | * (16 megs). They access the map for the current context register. They | * assume that currently we are running in supervisor state. | */ | | struct pgmapent | getpgmap(addr); | | setpgmap(addr, entry); NUMPMEGS = 256 LOWMASK = 0xfffff800 PMAPOFF = 0x0 SMAPOFF = 0x5 USERCONTEXTOFF = 0x7 SUPCONTEXTOFF = 0x6 CONTEXTMASK = 0x7 FC_MAP = 0x3 PME_INVALID = 0x80000000 .text .globl _getpgmap _getpgmap: movl sp@(4),d0 | Get access address andw #LOWMASK,d0 | Mask out low bits movl d0,a0 movc sfc,d1 | Save source function code lea FC_MAP,a1 | Get function code in a reg movc a1,sfc | Set source function code movsl a0@,d0 | Read page map entry movc d1,sfc | Restore source function code rts | done .globl _setpgmap _setpgmap: movl sp@(4),d0 | Get access address andw #LOWMASK,d0 | Mask out low bits movl d0,a0 lea FC_MAP,a1 | Get function code in a reg | The following code can be used to verify that the only page | table entries written to the Invalid Pmeg are invalid pages, since the | consequences of writing valid entries here are somewhat spectacular. movc sfc,d0 | Save source function code movc a1,sfc | Set source function code, too. movsb a0@(SMAPOFF),d1 | Get segment map entry number movc d0,sfc | Restore source function code | If debug code is removed, next line must remain! movl sp@(8),d0 | Get page map entry to write | More debug code cmpb #NUMPMEGS-1,d1 | Are we writing in the Invalid Pmeg? jne 1$ | Nope, go on. cmpl #PME_INVALID,d0 | Writing the Invalid Page Map Entry? jeq 1$ | Yes, it's ok. bras .-1 | Fault out, this is nasty thing to do. 1$: | End of debugging code. movc dfc,d1 | Save dest function code movc a1,dfc | Set destination function code movsl d0,a0@ | Write page map entry movc d1,dfc | Restore dest function code rts | done .globl _setkcontext _setkcontext: clrl d0 | Get context value to set movc dfc,d1 | Save dest function code lea FC_MAP,a1 | Get function code in a reg movc a1,dfc | Set destination function code movsb d0,USERCONTEXTOFF | Move value into context register movc d1,dfc | Restore dest function code rts
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.