|
|
1.1 root 1: /*++
2:
3: Copyright (c) 1992, 1993 Digital Equipment Corporation
4:
5:
6: Module:
7: kxalpha.h
8:
9: Abstract:
10: Contains alpha architecture constants and assembly macros.
11:
12: Author:
13: Joe Notarangelo 31-March-1992 (based on Dave Cutler's kxmips.h)
14:
15:
16: Revision History
17:
18: 16-July-1992 John DeRosa
19:
20: Removed fwcalpal.h hook.
21:
22:
23: 8-July-1992 John DeRosa
24:
25: Added fwcalpal.h hooks, defined HALT call_pal.
26:
27:
28: --*/
29:
30: //
31: // Define Sfw Interrupt Levels and masks
32: //
33:
34: #define APC_INTERRUPT 0x1
35: #define DISPATCH_INTERRUPT 0x2
36:
37: //
38: // Define standard integer registers.
39: //
40: // N.B. `at' is `AT' so it doesn't conflict with the `.set at' pseudo-op.
41: //
42:
43: #define v0 $0 // return value register
44: #define t0 $1 // caller saved (temporary) registers
45: #define t1 $2 //
46: #define t2 $3 //
47: #define t3 $4 //
48: #define t4 $5 //
49: #define t5 $6 //
50: #define t6 $7 //
51: #define t7 $8 //
52: #define s0 $9 // callee saved (nonvolatile) registers
53: #define s1 $10 //
54: #define s2 $11 //
55: #define s3 $12 //
56: #define s4 $13 //
57: #define s5 $14 //
58: #define fp $15 // frame pointer register, or s6
59: #define a0 $16 // argument registers
60: #define a1 $17 //
61: #define a2 $18 //
62: #define a3 $19 //
63: #define a4 $20 //
64: #define a5 $21 //
65: #define t8 $22 // caller saved (temporary) registers
66: #define t9 $23 //
67: #define t10 $24 //
68: #define t11 $25 //
69: #define ra $26 // return address register
70: #define t12 $27 // caller saved (temporary) registers
71: #define AT $28 // assembler temporary register
72: #define gp $29 // global pointer register
73: #define sp $30 // stack pointer register
74: #define zero $31 // zero register
75:
76: #ifndef PALCODE
77:
78: //
79: // Define standard floating point registers.
80: //
81:
82: #define f0 $f0 // return value register
83: #define f1 $f1 // return value register
84: #define f2 $f2 // callee saved (nonvolatile) registers
85: #define f3 $f3 //
86: #define f4 $f4 //
87: #define f5 $f5 //
88: #define f6 $f6 //
89: #define f7 $f7 //
90: #define f8 $f8 //
91: #define f9 $f9 //
92: #define f10 $f10 // caller saved (temporary) registers
93: #define f11 $f11 //
94: #define f12 $f12 //
95: #define f13 $f13 //
96: #define f14 $f14 //
97: #define f15 $f15 //
98: #define f16 $f16 // argument registers
99: #define f17 $f17 //
100: #define f18 $f18 //
101: #define f19 $f19 //
102: #define f20 $f20 //
103: #define f21 $f21 //
104: #define f22 $f22 // caller saved (temporary) registers
105: #define f23 $f23 //
106: #define f24 $f24 //
107: #define f25 $f25 //
108: #define f26 $f26 //
109: #define f27 $f27 //
110: #define f28 $f28 //
111: #define f29 $f29 //
112: #define f30 $f30 //
113: #define f31 $f31 // floating zero register
114: #define fzero $f31 // floating zero register (alias)
115:
116: #endif //!PALCODE
117:
118:
119: //
120: // Define procedure entry macros
121: //
122:
123: #define ALTERNATE_ENTRY(Name) \
124: .globl Name; \
125: Name:;
126:
127: #define LEAF_ENTRY(Name) \
128: .text; \
129: .align 4; \
130: .globl Name; \
131: .ent Name, 0; \
132: Name:; \
133: .frame sp, 0, ra; \
134: .prologue 0;
135:
136: #define NESTED_ENTRY(Name, fsize, retrg) \
137: .text; \
138: .align 4; \
139: .globl Name; \
140: .ent Name, 0; \
141: Name:; \
142: .frame sp, fsize, retrg;
143:
144: //
145: // Define global definition macros.
146: //
147:
148: #define END_REGION(Name) \
149: .globl Name; \
150: Name:;
151:
152: #define START_REGION(Name) \
153: .globl Name; \
154: Name:;
155:
156: //
157: // Define exception handling macros.
158: //
159:
160: #define EXCEPTION_HANDLER(Handler) \
161: .edata 1, Handler;
162:
163:
164: #define PROLOGUE_END .prologue 1;
165:
166: //
167: // Define save and restore floating state macros.
168: //
169:
170: #define SAVE_NONVOLATILE_FLOAT_STATE \
171: bsr ra, KiSaveNonVolatileFloatState
172:
173: //
174: // Define interfaces to pcr and palcode
175: //
176: // The interfaces defined in the following macros will be PALcode
177: // calls for some implemenations, but may be in-line code in others
178: // (eg. uniprocessor vs multiprocessor). At the current time all of
179: // the interfaces are PALcode calls.
180: //
181:
182: //
183: // Define interfaces for cache coherency
184: //
185:
186: //++
187: //
188: // IMB
189: //
190: // Macro Description:
191: //
192: // Issue the architecture-defined Instruction Memory Barrier. This
193: // instruction will make the processor instruction stream coherent with
194: // the system memory.
195: //
196: // Mode:
197: //
198: // Kernel and User.
199: //
200: // Arguments:
201: //
202: // None.
203: //
204: // Return Value:
205: //
206: // None.
207: //
208: // Registers Used:
209: //
210: // None.
211: //
212: //--
213:
214: #define IMB call_pal imb
215:
216: //
217: // Define PALcode Environment Transition Interfaces
218: //
219:
220: //++
221: //
222: // HALT
223: //
224: // Macro Description:
225: //
226: // Halt the processor and return to firmware.
227: //
228: // Mode:
229: //
230: // Kernel only.
231: //
232: // Arguments:
233: //
234: // None.
235: //
236: // Return Value:
237: //
238: // Does not return.
239: //
240: // Registers Used:
241: //
242: // None.
243: //
244: //--
245:
246: #define HALT call_pal halt
247:
248: //++
249: //
250: // RESTART
251: //
252: // Macro Description:
253: //
254: // Restart the processor with the processor state found in a
255: // restart block.
256: //
257: // Mode:
258: //
259: // Kernel only.
260: //
261: // Arguments:
262: //
263: // a0 - Supplies a pointer to an ARC restart block with an Alpha AXP
264: // saved state area.
265: //
266: // Return Value:
267: //
268: // If successful the call does not return. Otherwise, any return
269: // is considered a failure.
270: //
271: // Registers Used:
272: //
273: // None.
274: //
275: //--
276:
277: #define RESTART call_pal restart
278:
279: //++
280: //
281: // SWPPAL
282: //
283: // Macro Description:
284: //
285: // Swap the execution environment to a new PALcode image.
286: //
287: // Mode:
288: //
289: // Kernel only.
290: //
291: // Arguments:
292: //
293: // a0 - Supplies the physical address of the base of the new PALcode
294: // image.
295: //
296: // a1 - a5 - Supply arguments to the new PALcode environment.
297: //
298: // Return Value:
299: //
300: // Does not return.
301: //
302: // Registers Used:
303: //
304: // None.
305: //
306: //--
307:
308: #define SWPPAL call_pal swppal
309:
310: //
311: // Define IRQL and interrupt interfaces
312: //
313:
314: //++
315: //
316: // DISABLE_INTERRUPTS
317: //
318: // Macro Description:
319: //
320: // Disable all interrupts for the current processor and return the
321: // previous PSR.
322: //
323: // Mode:
324: //
325: // Kernel only.
326: //
327: // Arguments:
328: //
329: // None.
330: //
331: // Return Value:
332: //
333: // None.
334: //
335: // Registers Used:
336: //
337: // None.
338: //
339: //--
340:
341: #define DISABLE_INTERRUPTS call_pal di
342:
343: //++
344: //
345: // ENABLE_INTERRUPTS
346: //
347: // Macro Description:
348: //
349: // Enable interrupts according to the current PSR for the current
350: // processor.
351: //
352: // Mode:
353: //
354: // Kernel only.
355: //
356: // Arguments:
357: //
358: // None.
359: //
360: // Return Value:
361: //
362: // None.
363: //
364: // Registers Used:
365: //
366: // None.
367: //
368: //--
369:
370: #define ENABLE_INTERRUPTS call_pal ei
371:
372: //++
373: //
374: // SWAP_IRQL
375: //
376: // Macro Description:
377: //
378: // Swap the IRQL level for the current processor.
379: //
380: // Mode:
381: //
382: // Kernel only.
383: //
384: // Arguments:
385: //
386: // a0 - Supplies the new IRQL level.
387: //
388: // Return Value:
389: //
390: // v0 = previous IRQL level.
391: //
392: // Registers Used:
393: //
394: // AT, a1 - a3.
395: //
396: //--
397:
398: #define SWAP_IRQL call_pal swpirql
399:
400: //++
401: //
402: // GET_CURRENT_IRQL
403: //
404: // Macro Description:
405: //
406: // Return the current processor Interrupt Request Level (IRQL).
407: //
408: // Mode:
409: //
410: // Kernel only.
411: //
412: // Arguments:
413: //
414: // None.
415: //
416: // Return Value:
417: //
418: // v0 = current IRQL.
419: //
420: // Registers Used:
421: //
422: // AT.
423: //
424: //--
425:
426: #define GET_CURRENT_IRQL call_pal rdirql
427:
428:
429: //
430: // Define interfaces for software interrupts
431: //
432:
433: //++
434: //
435: // DEASSERT_SOFTWARE_INTERRUPT
436: //
437: // Macro Description:
438: //
439: // Deassert the software interrupts indicated in a0 for the current
440: // processor.
441: //
442: // Mode:
443: //
444: // Kernel only.
445: //
446: // Arguments:
447: //
448: // a0 - Supplies the mask for the software interrupt to be de-asserted.
449: // a0<1> - Deassert DISPATCH software interrupt.
450: // a0<0> - Deassert APC software interrupt.
451: //
452: // Return Value:
453: //
454: // None.
455: //
456: // Registers Used:
457: //
458: // AT, a1 - a3.
459: //
460: //--
461:
462: #define DEASSERT_SOFTWARE_INTERRUPT call_pal csir
463:
464: //++
465: //
466: // REQUEST_SOFTWARE_INTERRUPT
467: //
468: // Macro Description:
469: //
470: // Request software interrupts on the current processor according to
471: // the mask supplied in a0.
472: //
473: // Mode:
474: //
475: // Kernel only.
476: //
477: // Arguments:
478: //
479: // a0 - Supplies the mask of software interrupts to be requested.
480: // a0<1> - Request DISPATCH software interrupt.
481: // a0<0> - Request APC software interrupt.
482: //
483: // Return Value:
484: //
485: // None.
486: //
487: // Registers Used:
488: //
489: // AT, a1 - a3.
490: //
491: //--
492:
493: #define REQUEST_SOFTWARE_INTERRUPT call_pal ssir
494:
495: //
496: // Define interfaces to Processor Status Register
497: //
498:
499: //++
500: //
501: // GET_CURRENT_PROCESSOR_STATUS_REGISTER
502: //
503: // Macro Description:
504: //
505: // Return the current Processor Status Register (PSR) for the current
506: // processor.
507: //
508: // Mode:
509: //
510: // Kernel only.
511: //
512: // Arguments:
513: //
514: // None.
515: //
516: // Return Value:
517: //
518: // v0 = current PSR.
519: //
520: // Registers Used:
521: //
522: // AT.
523: //
524: //--
525:
526: #define GET_CURRENT_PROCESSOR_STATUS_REGISTER call_pal rdpsr
527:
528:
529: //
530: // Define current thread interface
531: //
532:
533: //++
534: //
535: // GET_THREAD_ENVIRONMENT_BLOCK
536: //
537: // Macro Description:
538: //
539: // Return the base address of the current Thread Environment Block (TEB),
540: // for the currently executing thread on the current processor.
541: //
542: // Mode;
543: //
544: // Kernel and User.
545: //
546: // Arguments:
547: //
548: // None.
549: //
550: // Return Value:
551: //
552: // v0 = TEB base address.
553: //
554: // Registers Used:
555: //
556: // None.
557: //
558: //--
559:
560: #define GET_THREAD_ENVIRONMENT_BLOCK call_pal rdteb
561:
562: //++
563: //
564: // GET_CURRENT_THREAD
565: //
566: // Macro Description:
567: //
568: // Return the thread object address for the currently executing thread
569: // on the current processor.
570: //
571: // Mode:
572: //
573: // Kernel only.
574: //
575: // Arguments:
576: //
577: // None.
578: //
579: // Return Value:
580: //
581: // v0 = PCR base address.
582: //
583: // Registers Used:
584: //
585: // AT.
586: //
587: //--
588:
589: #ifdef NT_UP
590:
591: //
592: // If uni-processor, retrieve current thread address from the global
593: // variable KiCurrentThread.
594: //
595:
596: #define GET_CURRENT_THREAD \
597: lda v0, KiCurrentThread; \
598: ldl v0, 0(v0)
599:
600: #else
601:
602: //
603: // If multi-processor, retrive per-processor current thread via a call pal.
604: //
605:
606: #define GET_CURRENT_THREAD call_pal rdthread
607:
608: #endif //NT_UP
609:
610: //
611: // Define per-processor data area routine interfaces
612: //
613:
614: //++
615: //
616: // GET_PROCESSOR_CONTROL_REGION_BASE
617: //
618: // Macro Description:
619: //
620: // Return the base address of the Process Control Region (PCR)
621: // for the current processor.
622: //
623: // Mode:
624: //
625: // Kernel only.
626: //
627: // Arguments:
628: //
629: // None.
630: //
631: // Return Value:
632: //
633: // v0 = PCR base address.
634: //
635: // Registers Used:
636: //
637: // AT.
638: //
639: //--
640:
641: #ifdef NT_UP
642:
643: //
644: // Uni-processor, address of PCR is in global variable.
645: //
646:
647: #define GET_PROCESSOR_CONTROL_REGION_BASE \
648: lda v0, KiPcrBaseAddress; \
649: ldl v0, 0(v0)
650:
651: #else
652:
653: //
654: // Multi-processor, get per-processor value via call pal.
655: //
656:
657: #define GET_PROCESSOR_CONTROL_REGION_BASE call_pal rdpcr
658:
659: #endif //NT_UP
660:
661: //++
662: //
663: // GET_PROCESSOR_CONTROL_BLOCK_BASE
664: //
665: // Macro Description:
666: //
667: // Return the Processor Control Block base address.
668: //
669: // Mode:
670: //
671: // Kernel only.
672: //
673: // Arguments:
674: //
675: // None.
676: //
677: // Return Value:
678: //
679: // v0 = PRCB base address.
680: //
681: // Registers Used:
682: //
683: // AT.
684: //
685: //--
686:
687: #define GET_PROCESSOR_CONTROL_BLOCK_BASE \
688: GET_PROCESSOR_CONTROL_REGION_BASE; \
689: ldl v0, PcPrcb(v0)
690:
691:
692: //
693: // Define kernel stack interfaces
694: //
695:
696: //++
697: //
698: // GET_INITIAL_KERNEL_STACK
699: //
700: // Macro Description:
701: //
702: // Return the initial kernel stack address for the current thread.
703: //
704: // Mode:
705: //
706: // Kernel only.
707: //
708: // Arguments:
709: //
710: // None.
711: //
712: // Return Value:
713: //
714: // v0 = initial kernel stack address.
715: //
716: // Registers Used:
717: //
718: // AT.
719: //
720: //--
721:
722: #define GET_INITIAL_KERNEL_STACK call_pal rdksp
723:
724: //++
725: //
726: // SET_INITIAL_KERNEL_STACK
727: //
728: // Macro Description:
729: //
730: // Set the initial kernel stack address for the current thread.
731: //
732: // Mode:
733: //
734: // Kernel only.
735: //
736: // Arguments:
737: //
738: // a0 - Supplies the new initial kernel stack address.
739: //
740: // Return Value:
741: //
742: // v0 - Previous initial kernel stack address.
743: //
744: // Registers Used:
745: //
746: // AT.
747: //
748: //--
749:
750: #define SET_INITIAL_KERNEL_STACK call_pal swpksp
751:
752: //
753: // Define initialization routine interfaces
754: //
755:
756: //++
757: //
758: // INITIALIZE_PAL
759: //
760: // Macro Description:
761: //
762: // Supply values to initialize the PALcode.
763: //
764: // Mode:
765: //
766: // Kernel only.
767: //
768: // Arguments:
769: //
770: // a0 - Supplies initial PageDirectoryBase (32-bit superpage address).
771: // a1 - Supplies PRCB Base Address (32-bit superpage address).
772: // a2 - Supplies address of initial kernel thread object.
773: // a3 - Supplies address of TEB for initial kernel thread object.
774: // gp - Supplies kernel image global pointer.
775: // sp - Supplies initial thread kernel stack pointer.
776: //
777: // Return Value:
778: //
779: // v0 = PAL base address in 32-bit super-page format (KSEG0).
780: //
781: // Registers Used:
782: //
783: // AT, a3.
784: //
785: //--
786:
787: #define INITIALIZE_PAL call_pal initpal
788:
789: //++
790: //
791: // WRITE_KERNEL_ENTRY_POINT
792: //
793: // Macro Description:
794: //
795: // Register the kernel entry point to receive control for a
796: // class of exceptions.
797: //
798: // Mode:
799: //
800: // Kernel only.
801: //
802: // Arguments:
803: //
804: // a0 - Supplies the address of the kernel entry point.
805: // a1 - Supplies the class of exception dispatched to this entry point.
806: // 0 = bug check conditions
807: // 1 = memory management faults
808: // 2 = interrupts
809: // 3 = system service calls
810: // 4 = general exception traps
811: //
812: // Return Value:
813: //
814: // None.
815: //
816: // Registers Used:
817: //
818: // AT, a2-a3.
819: //
820: //--
821:
822: #define WRITE_KERNEL_ENTRY_POINT call_pal wrentry
823:
824: //
825: // Define entry point values for the wrentry callpal function
826: //
827:
828: #define entryBugCheck 0
829: #define entryMM 1
830: #define entryInterrupt 2
831: #define entrySyscall 3
832: #define entryGeneral 4
833:
834: //++
835: //
836: // CACHE_PCR_VALUES
837: //
838: // Macro Description:
839: //
840: // Notify the PALcode that the PCR has been initialized by the
841: // kernel and the HAL and that the PALcode may now read values
842: // from the PCR and cache them inside the processor.
843: //
844: // N.B. - the PCR pointer must have already been established in
845: // initpal
846: //
847: // N.B. - This interface is a processor-specific implementation
848: // and cannot be assumed to be present on all processors.
849: // Currently implemented for the following processors:
850: //
851: // DECchip 21064
852: //
853: // Mode:
854: //
855: // Kernel only.
856: //
857: // Arguments:
858: //
859: // None.
860: //
861: // Return Value:
862: //
863: // None.
864: //
865: // Registers Used:
866: //
867: // AT, a0 - a3.
868: //
869: //--
870:
871: #define CACHE_PCR_VALUES call_pal initpcr
872:
873: //
874: // Define transition interfaces
875: //
876:
877: //++
878: //
879: // RETURN_FROM_TRAP_OR_INTERRUPT
880: //
881: // Macro Description:
882: //
883: // Return to execution thread after processing a trap or
884: // interrupt. Traps can be general exceptions (breakpoint,
885: // arithmetic traps, etc.) or memory management faults.
886: // This macro is also used to startup a thread of execution
887: // for the first time.
888: //
889: // Mode:
890: //
891: // Kernel only.
892: //
893: // Arguments:
894: //
895: // a0 - Supplies the previous processor status register.
896: // a1 - Supplies new software interrupt requests.
897: // a1<1> - Request a DISPATCH Interrupt.
898: // a1<0> - Request an APC Interrupt.
899: //
900: // Return Value:
901: //
902: // Does not return.
903: //
904: // Registers Used:
905: //
906: // None.
907: //
908: //--
909:
910: #define RETURN_FROM_TRAP_OR_INTERRUPT call_pal rfe
911:
912: //++
913: //
914: // RETURN_FROM_SYSTEM_CALL
915: //
916: // Macro Description:
917: //
918: // Return from a system service call.
919: //
920: // Mode:
921: //
922: // Kernel only.
923: //
924: // Arguments:
925: //
926: // a0 - Supplies the previous processor status register.
927: // a1 - Supplies new software interrupt requests.
928: // a1<1> - Request a DISPATCH Interrupt.
929: // a1<0> - Request an APC Interrupt.
930: //
931: // Return Value:
932: //
933: // Does not return.
934: //
935: // Registers Used:
936: //
937: // All volatile registers.
938: //
939: //--
940:
941: #define RETURN_FROM_SYSTEM_CALL call_pal retsys
942:
943: //++
944: //
945: // SYSCALL
946: //
947: // Macro Description:
948: //
949: // Call a system service.
950: //
951: // Mode:
952: //
953: // Kernel and User.
954: //
955: // Arguments:
956: //
957: // v0 - Supplies the system service number.
958: // [other arguments as per calling standard]
959: //
960: // Return Value:
961: //
962: // Will not return directly, returns via retsys, no return value.
963: //
964: // Registers Used:
965: //
966: // All volatile registers.
967: //
968: //--
969:
970: #define SYSCALL call_pal callsys
971:
972: //
973: // Define breakpoint interfaces
974: //
975:
976: //++
977: //
978: // BREAK
979: //
980: // Macro Description:
981: //
982: // Issue a user breakpoint which may be handled by a user-mode
983: // debugger.
984: //
985: // Mode:
986: //
987: // Kernel and User.
988: //
989: // Arguments:
990: //
991: // None.
992: //
993: // Return Value:
994: //
995: // Will not return directly, returns via rti, no return value.
996: //
997: // Registers Used:
998: //
999: // None.
1000: //
1001: //--
1002:
1003: #define BREAK call_pal bpt
1004:
1005: //++
1006: //
1007: // BREAK_DEBUG_STOP
1008: //
1009: // Macro Description:
1010: //
1011: // Issue a stop breakpoint to the kernel debugger.
1012: //
1013: // Mode:
1014: //
1015: // Kernel and User.
1016: //
1017: // Arguments:
1018: //
1019: // None.
1020: //
1021: // Return Value:
1022: //
1023: // Will not return directly, returns via rti, no return value.
1024: //
1025: // Registers Used:
1026: //
1027: // AT, v0.
1028: //
1029: //--
1030:
1031: #define BREAK_DEBUG_STOP \
1032: ldil v0, DEBUG_STOP_BREAKPOINT; \
1033: call_pal callkd
1034:
1035: //++
1036: //++
1037: //
1038: // BREAK_BREAKIN
1039: //
1040: // Macro Description:
1041: //
1042: // Issue a breakin breakpoint to the kernel debugger.
1043: //
1044: // Mode:
1045: //
1046: // Kernel and User.
1047: //
1048: // Arguments:
1049: //
1050: // None.
1051: //
1052: // Return Value:
1053: //
1054: // Will not return directly, returns via rti, no return value.
1055: //
1056: // Registers Used:
1057: //
1058: // AT, v0.
1059: //
1060: //--
1061:
1062: #define BREAK_BREAKIN \
1063: ldil v0, BREAKIN_BREAKPOINT; \
1064: call_pal callkd
1065:
1066: //++
1067: //
1068: // BREAK_DEBUG_LOAD_SYMBOLS
1069: //
1070: // Macro Description:
1071: //
1072: // Issue a load symbols breakpoint to the kernel debugger.
1073: //
1074: // Mode:
1075: //
1076: // Kernel and User.
1077: //
1078: // Arguments:
1079: //
1080: // None.
1081: //
1082: // Return Value:
1083: //
1084: // Will not return directly, returns via rti, no return value.
1085: //
1086: // Registers Used:
1087: //
1088: // AT, v0.
1089: //
1090: //--
1091:
1092: #define BREAK_DEBUG_LOAD_SYMBOLS \
1093: ldil v0, DEBUG_LOAD_SYMBOLS_BREAKPOINT; \
1094: call_pal callkd
1095:
1096: //++
1097: //
1098: // BREAK_DEBUG_UNLOAD_SYMBOLS
1099: //
1100: // Macro Description:
1101: //
1102: // Issue a unload symbols breakpoint to the kernel debugger.
1103: //
1104: // Mode:
1105: //
1106: // Kernel and User.
1107: //
1108: // Arguments:
1109: //
1110: // None.
1111: //
1112: // Return Value:
1113: //
1114: // Will not return directly, returns via rti, no return value.
1115: //
1116: // Registers Used:
1117: //
1118: // AT, v0.
1119: //
1120: //--
1121:
1122: #define BREAK_DEBUG_UNLOAD_SYMBOLS \
1123: ldil v0, DEBUG_UNLOAD_SYMBOLS_BREAKPOINT; \
1124: call_pal callkd
1125:
1126: //++
1127: //
1128: // BREAK_DEBUG_PRINT
1129: //
1130: // Macro Description:
1131: //
1132: // Cause a debug print breakpoint which will be interpreted by
1133: // the kernel debugger and will print a string to the kernel debugger
1134: // port.
1135: //
1136: // Mode:
1137: //
1138: // Kernel and User.
1139: //
1140: // Arguments:
1141: //
1142: // a0 - Supplies the address of ASCII string to print.
1143: // a1 - Supplies the length of the string to print.
1144: //
1145: // Return Value:
1146: //
1147: // Does not return directly, returns via rti, no return value.
1148: //
1149: // Registers Used:
1150: //
1151: // AT, v0.
1152: //
1153: //--
1154:
1155:
1156: #define BREAK_DEBUG_PRINT \
1157: ldil v0, DEBUG_PRINT_BREAKPOINT; \
1158: call_pal callkd
1159:
1160: //++
1161: //
1162: // BREAK_DEBUG_PROMPT
1163: //
1164: // Macro Description:
1165: //
1166: // Cause a debug print breakpoint which will be interpreted by
1167: // the kernel debugger and will receive a string from the kernel debugger
1168: // port after prompting for input.
1169: //
1170: // Mode:
1171: //
1172: // Kernel and User.
1173: //
1174: // Arguments:
1175: //
1176: // a0 - Supplies the address of ASCII string to print.
1177: // a1 - Supplies the length of the string to print.
1178: // a2 - Supplies the address of the buffer to receive the input string.
1179: // a3 - Supplies the maximum length of the input string.
1180: //
1181: // Return Value:
1182: //
1183: // Does not return directly, returns via rti, no return value.
1184: //
1185: // Registers Used:
1186: //
1187: // AT, v0.
1188: //
1189: //--
1190:
1191:
1192: #define BREAK_DEBUG_PROMPT \
1193: ldil v0, DEBUG_PROMPT_BREAKPOINT; \
1194: call_pal callkd
1195:
1196: //
1197: // Define tb manipulation interfaces
1198: //
1199:
1200: //++
1201: //
1202: // TB_INVALIDATE_ALL
1203: //
1204: // Macro Description:
1205: //
1206: // Invalidate all cached virtual address translations for the current
1207: // processor that are not fixed.
1208: // Some translations may be fixed in hardware and/or software and
1209: // these are not invalidated (eg. super-pages).
1210: //
1211: // Mode:
1212: //
1213: // Kernel only.
1214: //
1215: // Arguments:
1216: //
1217: // None.
1218: //
1219: // Return Value:
1220: //
1221: // None.
1222: //
1223: // Registers Used:
1224: //
1225: // a0 - a3.
1226: //
1227: //--
1228:
1229:
1230: #define TB_INVALIDATE_ALL call_pal tbia
1231:
1232: //++
1233: //
1234: // TB_INVALIDATE_SINGLE
1235: //
1236: // Macro Description:
1237: //
1238: // Invalidate any cached virtual address translations for a single
1239: // virtual address.
1240: //
1241: // Note - it is legal for an implementation to invalidate more
1242: // translations that the single one specified.
1243: //
1244: // Mode:
1245: //
1246: // Kernel only.
1247: //
1248: // Arguments:
1249: //
1250: // a0 - Supplies the Virtual Address of the translation to invalidate.
1251: //
1252: // Return Value:
1253: //
1254: // None.
1255: //
1256: // Registers Used:
1257: //
1258: // a1 - a3.
1259: //
1260: //--
1261:
1262: #define TB_INVALIDATE_SINGLE call_pal tbis
1263:
1264: //++
1265: //
1266: // DATA_TB_INVALIDATE_SINGLE
1267: //
1268: // Macro Description:
1269: //
1270: // Invalidate data stream translations for a single virtual address.
1271: //
1272: // Note - it is legal for an implementation to invalidate more
1273: // translations that the single one specified.
1274: //
1275: // Mode:
1276: //
1277: // Kernel only.
1278: //
1279: // Arguments:
1280: //
1281: // a0 - Supplies the Virtual Address of the translation to invalidate.
1282: //
1283: // Return Value:
1284: //
1285: // None.
1286: //
1287: // Registers Used:
1288: //
1289: // a1 - a3.
1290: //
1291: //--
1292:
1293: #define DATA_TB_INVALIDATE_SINGLE call_pal dtbis
1294:
1295: //
1296: // Define context switch interfaces
1297: //
1298:
1299: //++
1300: //
1301: // SWAP_THREAD_CONTEXT
1302: //
1303: // Macro Description:
1304: //
1305: //
1306: // Change to a new thread context. This will mean a new kernel stack,
1307: // new current thread address and a new thread environment block.
1308: //
1309: // Mode:
1310: //
1311: // Kernel only.
1312: //
1313: // Arguments:
1314: //
1315: // a0 - Supplies the Virtual Address of new initial kernel stack.
1316: // a1 - Supplies the address of new thread object.
1317: // a2 - Supplies the address of new thread environment block.
1318: // a3 - Supplies the PFN of the new page directory if the process
1319: // is to be swapped, -1 otherwise.
1320: // a4 - Supplies the ASN of the new processor if the process is to
1321: // be swapped, undefined otherwise.
1322: // a5 - Supplies the ASN wrap indicator if the process is to be swapped,
1323: // undefined otherwise.
1324: //
1325: // Return Value:
1326: //
1327: // None.
1328: //
1329: // Registers Used:
1330: //
1331: // AT.
1332: //
1333: //--
1334:
1335: #define SWAP_THREAD_CONTEXT call_pal swpctx
1336:
1337: //++
1338: //
1339: // SWAP_PROCESS_CONTEXT
1340: //
1341: // Macro Description:
1342: //
1343: // Change from one process address space to another.
1344: //
1345: // Mode:
1346: //
1347: // Kernel only.
1348: //
1349: // Arguments:
1350: //
1351: // a0 - Supplies the Pfn of Page Directory for new address space.
1352: // a1 - Supplies the Address Space Number for new address space.
1353: // a2 - Supplies the ASN wrap indicator (0 = no wrap, non-zero = wrap).
1354: //
1355: // Return Value:
1356: //
1357: // None.
1358: //
1359: // Registers Used:
1360: //
1361: // AT, a3.
1362: //
1363: //--
1364:
1365: #define SWAP_PROCESS_CONTEXT call_pal swpprocess
1366:
1367: //
1368: // Define access to DPC Active flag
1369: //
1370:
1371: //++
1372: //
1373: // GET_DPC_ACTIVE_FLAG
1374: //
1375: // Macro Description:
1376: //
1377: // Return the DPC Active Flag for the current processor.
1378: //
1379: // Mode:
1380: //
1381: // Kernel only.
1382: //
1383: // Arguments:
1384: //
1385: // None.
1386: //
1387: // Return Value:
1388: //
1389: // v0 = DPC Active Flag
1390: //
1391: // Registers Used:
1392: //
1393: // AT.
1394: //
1395: //--
1396:
1397: #define GET_DPC_ACTIVE_FLAG \
1398: GET_PROCESSOR_CONTROL_REGION_BASE; \
1399: ldl v0, PcDpcRoutineActive(v0)
1400:
1401: //++
1402: //
1403: // SET_DPC_ACTIVE_FLAG
1404: //
1405: // Macro Description:
1406: //
1407: // Set the DPC Active Flag for the current processor.
1408: //
1409: // Mode:
1410: //
1411: // Kernel only.
1412: //
1413: // Arguments:
1414: //
1415: // a0 = Supplies the DPC Active Flag Value to set.
1416: //
1417: // Return Value:
1418: //
1419: // None.
1420: //
1421: // Registers Used:
1422: //
1423: // AT.
1424: //
1425: //--
1426:
1427: #define SET_DPC_ACTIVE_FLAG \
1428: .set noat; \
1429: GET_PROCESSOR_CONTROL_REGION_BASE; \
1430: stl a0, PcDpcRoutineActive(v0); \
1431: .set at
1432:
1433:
1434: //
1435: // Define interfaces for generate trap
1436: //
1437:
1438: //++
1439: //
1440: // GENERATE_TRAP
1441: //
1442: // Macro Description:
1443: //
1444: // Generate a trap. Code has discovered an exception condition
1445: // and wants to raise a trap to indicate the condition. Anticipated
1446: // for use by compilers for divide by zero, etc..
1447: //
1448: // Mode:
1449: //
1450: // Kernel and User.
1451: //
1452: // Arguments:
1453: //
1454: // a0 = Supplies the trap number which identifies the exception.
1455: //
1456: // Return Value:
1457: //
1458: // Does not return, generates a trap to kernel mode, no return value.
1459: //
1460: // Registers Used:
1461: //
1462: // None.
1463: //
1464: //--
1465:
1466: #define GENERATE_TRAP call_pal gentrap
1467:
1468: //
1469: // Define performance and debug interfaces.
1470: //
1471:
1472: //++
1473: //
1474: // GET_INTERNAL_COUNTERS
1475: //
1476: // Macro Description:
1477: //
1478: // Read the internal processor event counters. The counter formats
1479: // and the events counted are processor implementation-dependent.
1480: //
1481: // N.B. - the counters will only be implemented for checked builds.
1482: //
1483: // Mode:
1484: //
1485: // Kernel.
1486: //
1487: // Arguments:
1488: //
1489: // a0 - Supplies the superpage 32 address of the buffer to receive
1490: // the counter data. The address must be quadword aligned.
1491: //
1492: // a1 - Supplies the length of the buffer allocated for the counters.
1493: //
1494: // Return Value:
1495: //
1496: // v0 - 0 is returned if the interface is not implemented.
1497: // If v0 <= a1 then v0 is the length of the data returned.
1498: // If v0 > a1 then v0 is the length of the processor implementation
1499: // counter record.
1500: //
1501: // Registers Used:
1502: //
1503: // AT, a2 - a3.
1504: //
1505: //--
1506:
1507: #define GET_INTERNAL_COUNTERS call_pal rdcounters
1508:
1509: //++
1510: //
1511: // GET_INTERNAL_PROCESSOR_STATE
1512: //
1513: // Macro Description:
1514: //
1515: // Read the internal processor state. The data values returned and
1516: // their format are processor implementation-dependent.
1517: //
1518: // Mode:
1519: //
1520: // Kernel.
1521: //
1522: // Arguments:
1523: //
1524: // a0 - Supplies the superpage 32 address of the buffer to receive
1525: // the processor state data. The address must be quadword aligned.
1526: //
1527: // a1 - Supplies the length of the buffer allocated for the state.
1528: //
1529: // Return Value:
1530: //
1531: // v0 - If v0 <= a1 then v0 is the length of the data returned.
1532: // If v0 > a1 then v0 is the length of the processor implementation
1533: // state record.
1534: //
1535: // Registers Used:
1536: //
1537: // AT, a2 - a3.
1538: //
1539: //--
1540:
1541: #define GET_INTERNAL_PROCESSOR_STATE call_pal rdstate
1542:
1543: //++
1544: //
1545: // WRITE_PERFORMANCE_COUNTERS
1546: //
1547: // Macro Description:
1548: //
1549: // Write the state of the internal processor performance counters.
1550: // The number of performance counters, the events they count, and their
1551: // usage is processor implementation-depedent.
1552: //
1553: // Mode:
1554: //
1555: // Kernel.
1556: //
1557: // Arguments:
1558: //
1559: // a0 - Supplies the number of the performance counter.
1560: //
1561: // a1 - Supplies a flag that indicates if the performance counter is
1562: // to be enabled or disabled (0 = disabled, non-zero = enabled).
1563: //
1564: // a2 - a5 - Supply processor implementation-dependent parameters.
1565: //
1566: // Return Value:
1567: //
1568: // v0 - 0 is returned if the operation is unsuccessful or the performance
1569: // counter does not exist. Otherwise, a non-zero value is returned.
1570: //
1571: // Registers Used:
1572: //
1573: // AT, a2 - a5.
1574: //
1575: //--
1576:
1577: #define WRITE_PERFORMANCE_COUNTERS call_pal wrperfmon
1578:
1579:
1580: //
1581: // Define interfaces for controlling the state of machine checks.
1582: //
1583:
1584: //++
1585: //
1586: // DRAIN_ABORTS
1587: //
1588: // Macro Description:
1589: //
1590: // Stall processor execution until all previous instructions have
1591: // executed to the point that any exceptions they may raise have been
1592: // signalled.
1593: //
1594: // Mode:
1595: //
1596: // Kernel.
1597: //
1598: // Arguments:
1599: //
1600: // None.
1601: //
1602: // Return Value:
1603: //
1604: // None.
1605: //
1606: // Registers Used:
1607: //
1608: // None.
1609: //
1610: //--
1611:
1612: #define DRAIN_ABORTS call_pal draina
1613:
1614:
1615: //++
1616: //
1617: // GET_MACHINE_CHECK_ERROR_SUMMARY
1618: //
1619: // Macro Description:
1620: //
1621: // Read the processor machine check error summary register.
1622: //
1623: // Mode:
1624: //
1625: // Kernel.
1626: //
1627: // Arguments:
1628: //
1629: // None.
1630: //
1631: // Return Value:
1632: //
1633: // v0 - The value of the MCES register.
1634: //
1635: // Registers Used:
1636: //
1637: // AT.
1638: //
1639: //--
1640:
1641: #define GET_MACHINE_CHECK_ERROR_SUMMARY call_pal rdmces
1642:
1643:
1644: //++
1645: //
1646: // WRITE_MACHINE_CHECK_ERROR_SUMMARY
1647: //
1648: // Macro Description:
1649: //
1650: // Write new values to the machine check error summary register.
1651: //
1652: // Mode:
1653: //
1654: // Kernel.
1655: //
1656: // Arguments:
1657: //
1658: // a0 - Supplies the values to write to the MCES register.
1659: //
1660: // Return Value:
1661: //
1662: // v0 - Previous value of the MCES register.
1663: //
1664: // Registers Used:
1665: //
1666: // AT, a1 - a3.
1667: //
1668: //--
1669:
1670: #define WRITE_MACHINE_CHECK_ERROR_SUMMARY call_pal wrmces
1671:
1672:
1673:
1674: //
1675: // Define subtitle macro
1676: //
1677:
1678: #define SBTTL(x)
1679:
1680: //
1681: // Define mnemonic for writing callpal in assembly language that will
1682: // fit in the opcode field.
1683: //
1684:
1685: #define callpal call_pal
1686:
1687: //
1688: // Define exception data section and align.
1689: //
1690: // Nearly all source files that include this header file need the following
1691: // few pseudo-ops and so, by default, they are placed once here rather than
1692: // repeated in every source file. If these pseudo-ops are not needed, then
1693: // define HEADER_FILE prior to including this file.
1694: //
1695: // Also the PALCODE environment uses this include file but cannot use
1696: // these definitions.
1697: //
1698:
1699: #if !defined(HEADER_FILE) && !defined(PALCODE)
1700:
1701: .edata 0
1702: .align 2
1703: .text
1704:
1705: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.