{* IBM XA Code Planting routinespecs *} {******** Monitoring *********} { Parm CODE will cause a line by line decode of instructions } { Monitoring of all non-code planting is turned on by PMonOn or bit 1 of } { COMREG(26). Monitoring of code planting is turned on by bit 2 of COMREG(26) } { COMREG(26)=128 causes decoding of each instruction as planted } { COMREG(26)=256 causes decoding of the whole code area after fixups } {* The following routinespecs have been provided initially, corresponding to the *} {* formats given in the "Principles of Operation". *} %externalroutinespec PIX RR %alias "S#PIXRR" (%integer Op, R1, R2) { Plant RR format instruction } %externalroutinespec PIX RRE %alias "S#PIXRRE"(%integer Op, R1, R2) { Plant RRE format instruction } %externalroutinespec PIX RX %alias "S#PIXRX" (%integer Op, R1, X2, B2, D2) { Plant RX format instruction } %externalroutinespec PIX RS %alias "S#PIXRS" (%integer Op, R1, R3, B2, D2) { Plant RS format instruction } %externalroutinespec PIX SI %alias "S#PIXSI" (%integer Op, I2, B1, D1) { Plant SI format instruction } %externalroutinespec PIX S %alias "S#PIXS" (%integer Op, B2, D2) { Plant S format instruction } %externalroutinespec PIX SS %alias "S#PIXSS" (%integer Op, L1, L2, B1, D1, B2, D2) { Plant SS fromat instruction } { If L1 is zero the effect is to plant the long L form } %externalroutinespec PIX SSE %alias "S#PIXSSE"(%integer Op, B1, D1, B2, D2) { Plant SSE format instruction } {* Area initialisation *} { All areas are buffered as the ten new areas. } { The following consts represent these areas in this interface } %constinteger Code = 1, Gla = 2, { Unused = 3 } SST = 4, UST = 5, Diags = 6, Static = 7, IoTab = 8, ZGST = 9, Cnst = 10 %externalintegerfnspec PMarker %alias "S#PMarker"(%integer HalfWords) { Mark CA for future PSetOpd and reserve HalfWords of code for plugging } { Also used to identify points in code to be used in PFix. } %externalroutinespec PBReloc %alias "S#PBReloc"(%integer AreaLoc,BaseLoc) { A satisfied relocation request in a bound file. } { Binding has set word in AreaLoc>>24, displacement = (AreaLoc<<8)>>8, } { the address of area BaseLoc>>24, displacement = (BaseLoc<<8)>>8.} %externalroutinespec PSetOpD %alias "S#PSetOpD"(%integer Mark, Offset, HalfWord) { Plug HalfWord at Marked code address plus Offset halfwords } %externalroutinespec PLabel %alias "S#PLabel"(%integer LabelId) { Note a label at CA, LabelId being assigned by the code generator } %externalroutinespec PUsing %alias "S#PUsing"(%integer Reg) { Note that Reg has just been loaded with PC following BASR or BALR. } { Where Reg is already Used, a implicit PDrop is performed. } %externalroutinespec PDrop %alias "S#PDrop"(%integer Reg) { Note that PUsing of Reg no longer applies. } { If Reg is not Used, a warning is printed, NOT an error. } %externalroutinespec PJump %alias "S#PJump"(%integer Op, LabelId, Mask, Reg) { Plant jump instruction, using LabelId to associate a label } { Reg is a spare register if needed. } %externalroutinespec PJIndex %alias "S#PJIndex"(%integer Op, Label, Reg1, Reg3) { Plant instruction as if it was a Branch on Index type } { No chacking of the Op is done, although a warning will be } { generated if the expected format is not RS. It is the } { responsibility of the code generator to do a PUsing within } { range of the label and to preserve the Using register until } { this jump. } {* Switch support *} %externalroutinespec PSwitch %alias "S#PSwitch"(%integer SSTAd,Lower,Upper,Size) { Note a switch table from Lower to Upper is at SSTAd } { Element size in bytes is Size } %externalroutinespec PSwitchVal %alias "S#PSwitchVal"(%integer SSTAd, Index, Label) { Link Entry(Index) in switch table at SSTAd with Label } %externalroutinespec PSLabel %alias "S#PSLabel"(%integer SSTAd, Index) { Overwrite element no Index of switch at SSTAd with Ca } %externalroutinespec PSDefault %alias "S#PSDefault"(%integer SSTAd, Label) { Fill remaining elements of switch at SSTAd with Label's code offset } {* Put Interface Passing of Data * *} %externalroutinespec PCodeHalf %alias "S#PCodeHalf"(%integer Val) { Write 2 bytes to Code area at Ca, checking for overflow } %externalroutinespec PCodeWord %alias "S#PCodeWord"(%integer Val) { Write 4 bytes to Code area at Ca, with no validation } %externalroutinespec PCodeBytes %alias "S#PCodeBytes"(%integer Len, Ad) { Copy Len bytes from Ad into the Code area at Ca } %externalroutinespec PDBytes %alias "S#PDBytes"(%integer Area, Disp, Len, Ad) { Pass Len bytes of data from Ad to be placed at Disp in Area } { Areas used are the ten defined above } %externalroutinespec PD4 %alias "S#PD4"(%integer Area, Disp, Value) { Plant a 4 byte Value at Disp in Area, using buffered areas } %externalroutinespec PDPattern %alias "S#PDPattern"(%integer Area, Disp, NCopies, Len, Ad) { Make NCopies of Len bytes from Ad at Disp in Area } {* Put Interface RELOCATION and REFERENCES *} %externalintegerfnspec PXname %alias "S#PXname"(%integer Typ,%string(255)%name S,%integer GlAd) { Create an external code reference } { Xrefs are used many times so establish mapping to integer ID early} { and save on holding/passing of strings } { GlAd holds location at which code generator has placed a descriptor } { Type = 0 means normal spec, = 1 means dynamic spec } %externalroutinespec Pfix %alias "S#Pfix"(%integer Hostarea, HostDisp, TgtArea,TgtDisp) { A relocation request: set word in HostArea at offset HostDisp bytes, } { to the address of area TargetArea, displacement = TargetDisp.} { If area is Code, TargetDisp is assumed to be a PMarker value, unless } { TargetDisp is zero, when head of code is assumed. } %externalroutinespec PDXRef %alias "S#PDXRef"(%integer Type,Area,Disp,%string(31)%name ExtName) { Define an external data reference } { Relocate word at Disp in Area by external data ref ExtName } { Type holds min size in lowest byte } %externalroutinespec PDataEntry %alias "S#PDataEntry"(%string(255)%name Name, %integer Area, Maxlen, Disp) { Define a data entry in Area at Disp with Maxlen and called Name } {* The next five routinespecs deal with PROCEDURES *} %externalroutinespec PEntry %alias "S#PEntry"(%integer Index, %string(255)%name Iden) { Note a sideways entry point. If Index is zero make this the main EP } %externalroutinespec PProcEntry %alias "S#PProcEntry"(%integer COffset,GOffset,EPOffset,ParamW, %c %string(255)%name Name) { Add a complete procedure entry. Used by LINK, MODIFY etc. } { The 4 integers specify the four words of the external entry. } { Name gives its identifier. } %externalroutinespec PProc %alias "S#PProc"(%string(31)%name Name, %integer Props, ParamW, %integername Id) { Start a new procedure. If Id is <0 no spec has been given by PXName. } { PROPS&1 = external } { PROPS>>31 = Main entry } %externalroutinespec PMinMultiples %alias "S#PMinMultiples"(%integer NMults) { Specify a minimum number of 4k multiples to be planted at the } { head of the current body of code. This routine should be } { called immediately before PProcEnd if multiples are to be } { added in front of each procedure body or before PTerminate } { if multiples are only added once at the start of the whole } { code area. Whether or not it is called, sufficient multiples } { are planted to address the whole of the code area, if the } { appropriate bit of Properties is set for PInitialise. } %externalroutinespec PProcEnd %alias "S#PProcEnd" { End of routine } {* Put Interface - Miscellaneous *} %externalroutinespec PNewArea %alias "S#PNewArea"(%string(255)%name Name, %integer Iin, Props) { Note a new area identified by Iin with properties given by Props } %externalroutinespec PEndArea %alias "S#PEndArea"(%integer Id,Length,Props) { End a Fortran Common area } { Not implemented on XA yet } %externalroutinespec PHistory %alias "S#PHistory"(%integer Type, Ad) { Add a history record to the linked list. } { Type sets the type. Ad is the address of the information, } { viewed as a string by PHistory. } %externalroutinespec Pfaulty %alias "S#Pfaulty" { Code generator has encountered a user error. Code requests should no } { longer be checked and minimum work done in PUT } %externalroutinespec PLineStart %alias "S#PLineStart"(%integer Line) { Updates latest line number } %externalroutinespec PLineDecode %alias "S#PLINEDECODE" { Decodes from the last PLineStart or PLineDecode } %externalroutinespec PInitialise %alias "S#PINITIALISE"(%integer Language, Properties, SourceAd) { Start code generation } { If Language=-1 then SourceAd is compiler or other source string7s } { string's address. Otherwise no source identifier for history records } { Properties&1#0 means Put to add multiples at head of each code area. } { Properties&2#0 means output a new code area at each PProcEnd. } %externalintegerfnspec PTerminate %alias "S#PTerminate"(%integer AdAreaSizes, MSize) { Code generator closes with this call } { Set Code size etc. } {* PGENERATE - FINAL PHASE OF COMPILATION IS CREATE OBJECT FILE *} %externalroutinespec PGenerateObject %alias "S#PGenerateObject"(%string(255) %name objfilename ) { Output object file for target system } { No effect on Amdahl. Need not be called. } %externalroutinespec PMonOn %alias "S#PMonOn" { Switches on internal Put tracing } %externalroutinespec PMonOff %alias "S#PMonOff" { Switches off internal Put tracing } %externalroutinespec PTraceOn %alias "S#PTraceOn" %externalroutinespec PTraceOff %alias "S#PTraceOff" {* Pseudo - Operations *} %externalroutinespec PCNOP %alias "S#PCNOP"(%integer I, J) { Matches CNOP in assembler manual } %endoffile