1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258#include <linux/linkage.h>
259#include <linux/init.h>
260#include <asm/bootinfo.h>
261#include <asm/setup.h>
262#include <asm/entry.h>
263#include <asm/pgtable.h>
264#include <asm/page.h>
265#include <asm/asm-offsets.h>
266
267#ifdef CONFIG_MAC
268
269#include <asm/machw.h>
270
271
272
273
274
275#ifdef CONFIG_FRAMEBUFFER_CONSOLE
276#define CONSOLE
277#define CONSOLE_PENGUIN
278#endif
279
280
281
282
283
284#undef MAC_SERIAL_DEBUG
285
286
287
288
289
290#define MAC_USE_SCC_A
291#define MAC_USE_SCC_B
292
293#endif
294
295#undef MMU_PRINT
296#undef MMU_NOCACHE_KERNEL
297#define SERIAL_DEBUG
298#undef DEBUG
299
300
301
302
303
304#define FONT_8x8
305
306
307
308.globl kernel_pg_dir
309.globl availmem
310.globl m68k_pgtable_cachemode
311.globl m68k_supervisor_cachemode
312#ifdef CONFIG_MVME16x
313.globl mvme_bdid
314#endif
315#ifdef CONFIG_Q40
316.globl q40_mem_cptr
317#endif
318
319CPUTYPE_040 = 1
320CPUTYPE_060 = 2
321CPUTYPE_0460 = 3
322CPUTYPE_020 = 4
323
324
325TC_ENABLE = 0x8000
326TC_PAGE8K = 0x4000
327TC_PAGE4K = 0x0000
328
329
330TTR_ENABLE = 0x8000
331TTR_ANYMODE = 0x4000
332TTR_KERNELMODE = 0x2000
333TTR_USERMODE = 0x0000
334TTR_CI = 0x0400
335TTR_RW = 0x0200
336TTR_RWM = 0x0100
337TTR_FCB2 = 0x0040
338TTR_FCB1 = 0x0020
339TTR_FCB0 = 0x0010
340TTR_FCM2 = 0x0004
341TTR_FCM1 = 0x0002
342TTR_FCM0 = 0x0001
343
344
345CC6_ENABLE_D = 0x80000000
346CC6_FREEZE_D = 0x40000000
347CC6_ENABLE_SB = 0x20000000
348CC6_PUSH_DPI = 0x10000000
349CC6_HALF_D = 0x08000000
350CC6_ENABLE_B = 0x00800000
351CC6_CLRA_B = 0x00400000
352CC6_CLRU_B = 0x00200000
353CC6_ENABLE_I = 0x00008000
354CC6_FREEZE_I = 0x00004000
355CC6_HALF_I = 0x00002000
356CC3_ALLOC_WRITE = 0x00002000
357CC3_ENABLE_DB = 0x00001000
358CC3_CLR_D = 0x00000800
359CC3_CLRE_D = 0x00000400
360CC3_FREEZE_D = 0x00000200
361CC3_ENABLE_D = 0x00000100
362CC3_ENABLE_IB = 0x00000010
363CC3_CLR_I = 0x00000008
364CC3_CLRE_I = 0x00000004
365CC3_FREEZE_I = 0x00000002
366CC3_ENABLE_I = 0x00000001
367
368
369PAGESIZE = 4096
370PAGESHIFT = 12
371
372ROOT_TABLE_SIZE = 128
373PTR_TABLE_SIZE = 128
374PAGE_TABLE_SIZE = 64
375ROOT_INDEX_SHIFT = 25
376PTR_INDEX_SHIFT = 18
377PAGE_INDEX_SHIFT = 12
378
379#ifdef DEBUG
380
381#ifdef __STDC__
382#define L(name) .head.S.
383#else
384#define L(name) .head.S.name
385#endif
386#else
387#ifdef __STDC__
388#define L(name) .L
389#else
390#define L(name) .Lname
391#endif
392#endif
393
394
395#ifndef __INITDATA
396#define __INITDATA .data
397#define __FINIT .previous
398#endif
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414#define STACK %a6@(stackstart)
415#define ARG0 %a6@(4)
416#define ARG1 %a6@(8)
417#define ARG2 %a6@(12)
418#define ARG3 %a6@(16)
419#define ARG4 %a6@(20)
420
421.macro func_start name,saveregs,stack=0
422L(\name):
423 linkw %a6,
424 moveml \saveregs,%sp@-
425.set stackstart,-\stack
426
427.macro func_return_\name
428 moveml %sp@+,\saveregs
429 unlk %a6
430 rts
431.endm
432.endm
433
434.macro func_return name
435 func_return_\name
436.endm
437
438.macro func_call name
439 jbsr L(\name)
440.endm
441
442.macro move_stack nr,arg1,arg2,arg3,arg4
443.if \nr
444 move_stack "(\nr-1)",\arg2,\arg3,\arg4
445 movel \arg1,%sp@-
446.endif
447.endm
448
449.macro func_define name,nr=0
450.macro \name arg1,arg2,arg3,arg4
451 move_stack \nr,\arg1,\arg2,\arg3,\arg4
452 func_call \name
453.if \nr
454 lea %sp@(\nr*4),%sp
455.endif
456.endm
457.endm
458
459func_define mmu_map,4
460func_define mmu_map_tt,4
461func_define mmu_fixup_page_mmu_cache,1
462func_define mmu_temp_map,2
463func_define mmu_engage
464func_define mmu_get_root_table_entry,1
465func_define mmu_get_ptr_table_entry,2
466func_define mmu_get_page_table_entry,2
467func_define mmu_print
468func_define get_new_page
469
470func_define set_leds
471#endif
472
473.macro mmu_map_eq arg1,arg2,arg3
474 mmu_map \arg1,\arg1,\arg2,\arg3
475.endm
476
477.macro get_bi_record record
478 pea \record
479 func_call get_bi_record
480 addql
481.endm
482
483func_define serial_putc,1
484func_define console_putc,1
485
486func_define console_init
487func_define console_put_stats
488func_define console_put_penguin
489func_define console_plot_pixel,3
490func_define console_scroll
491
492.macro putc ch
493
494 pea \ch
495#endif
496#ifdef CONSOLE
497 func_call console_putc
498#endif
499#ifdef SERIAL_DEBUG
500 func_call serial_putc
501#endif
502
503 addql
504#endif
505.endm
506
507.macro dputc ch
508#ifdef DEBUG
509 putc \ch
510#endif
511.endm
512
513func_define putn,1
514
515.macro dputn nr
516#ifdef DEBUG
517 putn \nr
518#endif
519.endm
520
521.macro puts string
522
523 __INITDATA
524.Lstr\@:
525 .string "\string"
526 __FINIT
527 pea %pc@(.Lstr\@)
528 func_call puts
529 addql
530#endif
531.endm
532
533.macro dputs string
534#ifdef DEBUG
535 puts "\string"
536#endif
537.endm
538
539#define is_not_amiga(lab) cmpl &MACH_AMIGA,%pc@(m68k_machtype); jne lab
540#define is_not_atari(lab) cmpl &MACH_ATARI,%pc@(m68k_machtype); jne lab
541#define is_not_mac(lab) cmpl &MACH_MAC,%pc@(m68k_machtype); jne lab
542#define is_not_mvme147(lab) cmpl &MACH_MVME147,%pc@(m68k_machtype); jne lab
543#define is_not_mvme16x(lab) cmpl &MACH_MVME16x,%pc@(m68k_machtype); jne lab
544#define is_not_bvme6000(lab) cmpl &MACH_BVME6000,%pc@(m68k_machtype); jne lab
545#define is_mvme147(lab) cmpl &MACH_MVME147,%pc@(m68k_machtype); jeq lab
546#define is_mvme16x(lab) cmpl &MACH_MVME16x,%pc@(m68k_machtype); jeq lab
547#define is_bvme6000(lab) cmpl &MACH_BVME6000,%pc@(m68k_machtype); jeq lab
548#define is_not_hp300(lab) cmpl &MACH_HP300,%pc@(m68k_machtype); jne lab
549#define is_not_apollo(lab) cmpl &MACH_APOLLO,%pc@(m68k_machtype); jne lab
550#define is_not_q40(lab) cmpl &MACH_Q40,%pc@(m68k_machtype); jne lab
551#define is_not_sun3x(lab) cmpl &MACH_SUN3X,%pc@(m68k_machtype); jne lab
552
553#define hasnt_leds(lab) cmpl &MACH_HP300,%pc@(m68k_machtype); \
554 jeq 42f; \
555 cmpl &MACH_APOLLO,%pc@(m68k_machtype); \
556 jne lab ;\
557 42:\
558
559#define is_040_or_060(lab) btst &CPUTYPE_0460,%pc@(L(cputype)+3); jne lab
560#define is_not_040_or_060(lab) btst &CPUTYPE_0460,%pc@(L(cputype)+3); jeq lab
561#define is_040(lab) btst &CPUTYPE_040,%pc@(L(cputype)+3); jne lab
562#define is_060(lab) btst &CPUTYPE_060,%pc@(L(cputype)+3); jne lab
563#define is_not_060(lab) btst &CPUTYPE_060,%pc@(L(cputype)+3); jeq lab
564#define is_020(lab) btst &CPUTYPE_020,%pc@(L(cputype)+3); jne lab
565#define is_not_020(lab) btst &CPUTYPE_020,%pc@(L(cputype)+3); jeq lab
566
567
568
569
570.macro leds mask
571
572 hasnt_leds(.Lled\@)
573 pea \mask
574 func_call set_leds
575 addql
576.Lled\@:
577#endif
578.endm
579
580__HEAD
581ENTRY(_stext)
582
583
584
585
586 bras 1f
587
588 .long BOOTINFOV_MAGIC
589 .long MACH_AMIGA, AMIGA_BOOTI_VERSION
590 .long MACH_ATARI, ATARI_BOOTI_VERSION
591 .long MACH_MVME147, MVME147_BOOTI_VERSION
592 .long MACH_MVME16x, MVME16x_BOOTI_VERSION
593 .long MACH_BVME6000, BVME6000_BOOTI_VERSION
594 .long MACH_MAC, MAC_BOOTI_VERSION
595 .long MACH_Q40, Q40_BOOTI_VERSION
596 .long MACH_HP300, HP300_BOOTI_VERSION
597 .long 0
5981: jra __start
599
600.equ kernel_pg_dir,_stext
601
602.equ .,_stext+PAGESIZE
603
604ENTRY(_start)
605 jra __start
606__INIT
607ENTRY(__start)
608
609
610
611 lea %pc@(_stext),%sp
612
613
614
615
616 get_bi_record BI_MACHTYPE
617 lea %pc@(m68k_machtype),%a1
618 movel %a0@,%a1@
619
620 get_bi_record BI_FPUTYPE
621 lea %pc@(m68k_fputype),%a1
622 movel %a0@,%a1@
623
624 get_bi_record BI_MMUTYPE
625 lea %pc@(m68k_mmutype),%a1
626 movel %a0@,%a1@
627
628 get_bi_record BI_CPUTYPE
629 lea %pc@(m68k_cputype),%a1
630 movel %a0@,%a1@
631
632 leds 0x1
633
634#ifdef CONFIG_MAC
635
636
637
638
639
640 is_not_mac(L(test_notmac))
641
642 get_bi_record BI_MAC_VADDR
643 lea %pc@(L(mac_videobase)),%a1
644 movel %a0@,%a1@
645
646 get_bi_record BI_MAC_VDEPTH
647 lea %pc@(L(mac_videodepth)),%a1
648 movel %a0@,%a1@
649
650 get_bi_record BI_MAC_VDIM
651 lea %pc@(L(mac_dimensions)),%a1
652 movel %a0@,%a1@
653
654 get_bi_record BI_MAC_VROW
655 lea %pc@(L(mac_rowbytes)),%a1
656 movel %a0@,%a1@
657
658#ifdef MAC_SERIAL_DEBUG
659 get_bi_record BI_MAC_SCCBASE
660 lea %pc@(L(mac_sccbase)),%a1
661 movel %a0@,%a1@
662#endif
663
664
665
666
667
668 lea %pc@(L(mac_videobase)),%a0
669 movel %a0@,%a1
670 lea %pc@(L(mac_dimensions)),%a0
671 movel %a0@,%d1
672 swap %d1
673 andl
674 subl
675 lea %pc@(L(mac_rowbytes)),%a0
676loopy2:
677 movel %a0@,%d0
678 subql
679loopx2:
680 moveb
681 dbra %d0,loopx2
682 dbra %d1,loopy2
683#endif
684
685L(test_notmac):
686#endif
687
688
689
690
691
692
693
694
695 movel %pc@(m68k_cputype),%d0
696
697
698
699 clrl %d1
700
701
702
703
704 btst
705 jeq 1f
706 bset
707 bset
708 jra 3f
7091:
710
711
712
713 btst
714 jeq 2f
715 bset
716 bset
717 jra 3f
7182:
719
720
721
722 btst
723 jeq 3f
724 bset
725 jra 3f
7263:
727
728
729
730 lea %pc@(L(cputype)),%a0
731 movel %d1,%a0@
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748 clrl %d0
749 clrl %d1
750
751 is_not_040_or_060(L(save_cachetype))
752
753
754
755
756
757
758
759
760#ifdef CONFIG_060_WRITETHROUGH
761
762
763
764
765
766
767 is_not_060(1f)
768 movel
769 jra L(save_cachetype)
770#endif
7711:
772 movew
773
774 movel
775
776L(save_cachetype):
777
778
779 lea %pc@(m68k_supervisor_cachemode),%a0
780 movel %d0,%a0@
781 lea %pc@(m68k_pgtable_cachemode),%a0
782 movel %d1,%a0@
783
784
785
786
787 movew
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808#ifdef CONFIG_ATARI
809 is_not_atari(L(notypetest))
810
811
812 moveq
813 get_bi_record BI_ATARI_MCH_TYPE
814 tstl %d0
815 jbmi 1f
816 movel %a0@,%d3
817 lea %pc@(atari_mch_type),%a0
818 movel %d3,%a0@
8191:
820
821
822 moveq
823 cmpl
824 jbne 1f
825 movel
8261: lea %pc@(L(iobase)),%a0
827 movel %d0,%a0@
828
829L(notypetest):
830#endif
831
832#ifdef CONFIG_VME
833 is_mvme147(L(getvmetype))
834 is_bvme6000(L(getvmetype))
835 is_not_mvme16x(L(gvtdone))
836
837
838
839
840
841
842L(getvmetype):
843 get_bi_record BI_VME_TYPE
844 tstl %d0
845 jbmi 1f
846 movel %a0@,%d3
847 lea %pc@(vme_brdtype),%a0
848 movel %d3,%a0@
8491:
850#ifdef CONFIG_MVME16x
851 is_not_mvme16x(L(gvtdone))
852
853
854
855
856
857 get_bi_record BI_VME_BRDINFO
858 tstl %d0
859 jpl 1f
860
861
862 movel %d2,%sp@-
863 trap
864 .word 0x70
865 movel %sp@+,%a0
8661:
867 lea %pc@(mvme_bdid),%a1
868
869 movel %a0@+,%a1@+
870 movel %a0@+,%a1@+
871 movel %a0@+,%a1@+
872 movel %a0@+,%a1@+
873 movel %a0@+,%a1@+
874 movel %a0@+,%a1@+
875 movel %a0@+,%a1@+
876 movel %a0@+,%a1@+
877#endif
878
879L(gvtdone):
880
881#endif
882
883#ifdef CONFIG_HP300
884 is_not_hp300(L(nothp))
885
886
887 get_bi_record BI_HP300_UART_ADDR
888 tstl %d0
889 jbmi 1f
890 movel %a0@,%d3
891 lea %pc@(L(uartbase)),%a0
892 movel %d3,%a0@
893 get_bi_record BI_HP300_UART_SCODE
894 tstl %d0
895 jbmi 1f
896 movel %a0@,%d3
897 lea %pc@(L(uart_scode)),%a0
898 movel %d3,%a0@
8991:
900L(nothp):
901#endif
902
903
904
905
906 jbsr L(serial_init)
907
908
909
910
911#ifdef CONFIG_MAC
912 is_not_mac(L(nocon))
913#ifdef CONSOLE
914 console_init
915#ifdef CONSOLE_PENGUIN
916 console_put_penguin
917#endif
918 console_put_stats
919#endif
920L(nocon):
921#endif
922
923
924 putc '\n'
925 putc 'A'
926 leds 0x2
927 dputn %pc@(L(cputype))
928 dputn %pc@(m68k_supervisor_cachemode)
929 dputn %pc@(m68k_pgtable_cachemode)
930 dputc '\n'
931
932
933
934
935 lea %pc@(L(phys_kernel_start)),%a0
936 lea %pc@(_stext),%a1
937 subl
938 addl
939 movel %a1,%a0@
940
941 putc 'B'
942
943 leds 0x4
944
945
946
947
948
949
950
951
952
953 mmu_map
954 %pc@(m68k_supervisor_cachemode)
955
956 putc 'C'
957
958#ifdef CONFIG_AMIGA
959
960L(mmu_init_amiga):
961
962 is_not_amiga(L(mmu_init_not_amiga))
963
964
965
966
967 putc 'D'
968
969 is_not_040_or_060(1f)
970
971
972
973
974 mmu_map
975
976
977
978
979 mmu_map_tt
980
981 jbra L(mmu_init_done)
982
9831:
984
985
986
987 mmu_map
988 mmu_map_tt
989
990 jbra L(mmu_init_done)
991
992L(mmu_init_not_amiga):
993#endif
994
995#ifdef CONFIG_ATARI
996
997L(mmu_init_atari):
998
999 is_not_atari(L(mmu_init_not_atari))
1000
1001 putc 'E'
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017 moveq
1018 movel %pc@(atari_mch_type),%d3
1019 cmpl
1020 jbeq 2f
1021 cmpl
1022 jbne 1f
10232: movel
10241: movel %d0,%d3
1025
1026 is_040_or_060(L(spata68040))
1027
1028
1029
1030
1031
1032
1033
1034 mmu_map
1035
1036 jbra L(mmu_init_done)
1037
1038L(spata68040):
1039
1040 mmu_map
1041
1042 jbra L(mmu_init_done)
1043
1044L(mmu_init_not_atari):
1045#endif
1046
1047#ifdef CONFIG_Q40
1048 is_not_q40(L(notq40))
1049
1050
1051
1052
1053
1054
1055
1056 putc 'Q'
1057
1058 mmu_map_tt
1059 mmu_map_tt
1060
1061 jbra L(mmu_init_done)
1062
1063L(notq40):
1064#endif
1065
1066#ifdef CONFIG_HP300
1067 is_not_hp300(L(nothp300))
1068
1069
1070
1071
1072
1073
1074 is_040(1f)
1075
1076
1077
1078
1079 mmu_map
1080
1081 jbra L(mmu_init_done)
1082
10831:
1084
1085
1086
1087 mmu_map
1088
1089 jbra L(mmu_init_done)
1090
1091L(nothp300):
1092#endif
1093
1094#ifdef CONFIG_MVME147
1095
1096 is_not_mvme147(L(not147))
1097
1098
1099
1100
1101
1102
1103
1104
1105 mmu_map_tt
1106
1107 jbra L(mmu_init_done)
1108
1109L(not147):
1110#endif
1111
1112#ifdef CONFIG_MVME16x
1113
1114 is_not_mvme16x(L(not16x))
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129 mmu_map_tt
1130
1131 jbra L(mmu_init_done)
1132
1133L(not16x):
1134#endif
1135
1136#ifdef CONFIG_BVME6000
1137
1138 is_not_bvme6000(L(not6000))
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149 mmu_map_tt
1150
1151 jbra L(mmu_init_done)
1152
1153L(not6000):
1154#endif
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184#ifdef CONFIG_MAC
1185
1186L(mmu_init_mac):
1187
1188 is_not_mac(L(mmu_init_not_mac))
1189
1190 putc 'F'
1191
1192 is_not_040_or_060(1f)
1193
1194 moveq
1195 jbra 2f
11961:
1197 moveq
11982:
1199
1200
1201
1202
1203
1204 movel
1205 andl %pc@(L(mac_videobase)),%d0
1206
1207 mmu_map
1208
1209 mmu_map_eq
1210
1211 mmu_map_eq
1212
1213 mmu_map_tt
1214
1215 jbra L(mmu_init_done)
1216
1217L(mmu_init_not_mac):
1218#endif
1219
1220#ifdef CONFIG_SUN3X
1221 is_not_sun3x(L(notsun3x))
1222
1223
1224
1225
1226
1227
1228
1229 movel
1230 moveq
1231 lsrl %d1,%d0
1232 mmu_get_root_table_entry %d0
1233
1234 movel
1235 moveq
1236 lsrl %d1,%d0
1237 andl
1238 mmu_get_ptr_table_entry %a0,%d0
1239
1240 movel
1241 moveq
1242 lsrl %d1,%d0
1243 andl
1244 mmu_get_page_table_entry %a0,%d0
1245
1246
1247 movel 0xfefe00d4, %a1
1248 movel %a1@, %a1
1249
1250 movel
1251
12521:
1253 movel %a1@+, %d3
1254 movel %d3,%a0@+
1255 addl
1256 movel %d3,%a0@+
1257
1258 dbra %d1,1b
1259
1260
1261 mmu_map_tt
1262 jbra L(mmu_init_done)
1263
1264L(notsun3x):
1265#endif
1266
1267#ifdef CONFIG_APOLLO
1268 is_not_apollo(L(notapollo))
1269
1270 putc 'P'
1271 mmu_map
1272
1273L(notapollo):
1274 jbra L(mmu_init_done)
1275#endif
1276
1277L(mmu_init_done):
1278
1279 putc 'G'
1280 leds 0x8
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295L(mmu_fixup):
1296
1297 is_not_040_or_060(L(mmu_fixup_done))
1298
1299#ifdef MMU_NOCACHE_KERNEL
1300 jbra L(mmu_fixup_done)
1301#endif
1302
1303
1304
1305
1306 movel %pc@(L(phys_kernel_start)),%d0
1307 subl
1308 lea %pc@(_stext),%a0
1309 subl %d0,%a0
1310 mmu_fixup_page_mmu_cache %a0
1311
1312 movel %pc@(L(kernel_end)),%a0
1313 subl %d0,%a0
1314 movel %pc@(L(memory_start)),%a1
1315 subl %d0,%a1
1316 bra 2f
13171:
1318 mmu_fixup_page_mmu_cache %a0
1319 addw
13202:
1321 cmpl %a0,%a1
1322 jgt 1b
1323
1324L(mmu_fixup_done):
1325
1326#ifdef MMU_PRINT
1327 mmu_print
1328#endif
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392 putc 'H'
1393
1394 mmu_engage
1395
1396
1397
1398
1399
1400
1401
1402 movel L(memory_start),availmem
1403
1404#ifdef CONFIG_AMIGA
1405 is_not_amiga(1f)
1406
1407 clrl L(custom)
14081:
1409#endif
1410
1411#ifdef CONFIG_ATARI
1412 is_not_atari(1f)
1413
1414 movel
14151:
1416#endif
1417
1418#ifdef CONFIG_MAC
1419 is_not_mac(1f)
1420 movel
1421 andl L(mac_videobase),%d0
1422 addl
1423 movel %d0,L(mac_videobase)
1424
1425 movel %pc@(L(phys_kernel_start)),%d0
1426 subl
1427 subl %d0,L(console_font)
1428 subl %d0,L(console_font_data)
1429#endif
1430#ifdef MAC_SERIAL_DEBUG
1431 orl
1432#endif
14331:
1434#endif
1435
1436#ifdef CONFIG_HP300
1437 is_not_hp300(2f)
1438
1439
1440
1441 movel
1442
1443
1444
1445
1446 is_040(1f)
1447 movel
1448 jbra 2f
1449
1450
1451
1452
14531: movew
1454 movew
14552:
1456#endif
1457
1458#ifdef CONFIG_SUN3X
1459 is_not_sun3x(1f)
1460
1461
1462 oriw
14631:
1464#endif
1465
1466#ifdef CONFIG_APOLLO
1467 is_not_apollo(1f)
1468
1469
1470
1471
1472 movel
14731:
1474#endif
1475
1476 putc 'I'
1477 leds 0x10
1478
1479
1480
1481
1482
1483 is_not_040_or_060(L(cache_not_680460))
1484
1485L(cache680460):
1486 .chip 68040
1487 nop
1488 cpusha %bc
1489 nop
1490
1491 is_060(L(cache68060))
1492
1493 movel
1494
1495 movec %d0,%cacr
1496 jra L(cache_done)
1497
1498L(cache68060):
1499 movel
1500
1501 movec %d0,%cacr
1502
1503 moveq
1504 .chip 68060
1505 movec %d0,%pcr
1506
1507 jbra L(cache_done)
1508L(cache_not_680460):
1509L(cache68030):
1510 .chip 68030
1511 movel
1512 movec %d0,%cacr
1513
1514 jra L(cache_done)
1515 .chip 68k
1516L(cache_done):
1517
1518 putc 'J'
1519
1520
1521
1522
1523 lea init_task,%curptr
1524 lea init_thread_union+THREAD_SIZE,%sp
1525
1526 putc 'K'
1527
1528 subl %a6,%a6
1529
1530
1531
1532
1533 jbsr base_trap_init
1534
1535
1536
1537 putc '\n'
1538 leds 0x55
1539
1540 jbsr start_kernel
1541
1542
1543
1544
1545
1546
1547
1548func_start get_bi_record,%d1
1549
1550 movel ARG1,%d0
1551 lea %pc@(_end),%a0
15521: tstw %a0@(BIR_TAG)
1553 jeq 3f
1554 cmpw %a0@(BIR_TAG),%d0
1555 jeq 2f
1556 addw %a0@(BIR_SIZE),%a0
1557 jra 1b
15582: moveq
1559 movew %a0@(BIR_SIZE),%d0
1560 lea %a0@(BIR_DATA),%a0
1561 jra 4f
15623: moveq
1563 lea %a0@(BIR_SIZE),%a0
15644:
1565func_return get_bi_record
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630#ifdef MMU_PRINT
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641#define mmu_next_valid 0
1642#define mmu_start_logical 4
1643#define mmu_next_logical 8
1644#define mmu_start_physical 12
1645#define mmu_next_physical 16
1646
1647#define MMU_PRINT_INVALID -1
1648#define MMU_PRINT_VALID 1
1649#define MMU_PRINT_UNINITED 0
1650
1651#define putZc(z,n) jbne 1f; putc z; jbra 2f; 1: putc n; 2:
1652
1653func_start mmu_print,%a0-%a6/%d0-%d7
1654
1655 movel %pc@(L(kernel_pgdir_ptr)),%a5
1656 lea %pc@(L(mmu_print_data)),%a0
1657 movel
1658
1659 is_not_040_or_060(mmu_030_print)
1660
1661mmu_040_print:
1662 puts "\nMMU040\n"
1663 puts "rp:"
1664 putn %a5
1665 putc '\n'
1666
1667
1668
1669
1670
1671
1672
1673 movel
1674
1675 movel %a5@+,%d7 | Burn an entry to skip the kernel mappings,
1676 subql
1677#endif
16781: tstl %d5
1679 jbeq mmu_print_done
1680 subq
1681 movel %a5@+,%d7
1682 btst
1683 jbeq 1b
1684
16852: putn %d7
1686 andil
1687 movel %d7,%a4
1688 movel
1689 putc ' '
16903: tstl %d4
1691 jbeq 11f
1692 subq
1693 movel %a4@+,%d7
1694 btst
1695 jbeq 3b
1696
16974: putn %d7
1698 andil
1699 movel %d7,%a3
1700 movel
17015: movel
17026: tstl %d3
1703 jbeq 31f
1704 subq
1705 movel %a3@+,%d6
1706 btst
1707 jbeq 6b
17087: tstl %d2
1709 jbeq 8f
1710 subq
1711 putc ' '
1712 jbra 91f
17138: putc '\n'
1714 movel
17159: putc ' '
1716 dbra %d2,9b
1717 movel
171891: putn %d6
1719 jbra 6b
1720
172131: putc '\n'
1722 movel
172332: putc ' '
1724 dbra %d2,32b
1725 jbra 3b
1726
172711: putc '\n'
1728 jbra 1b
1729#endif
1730
1731 lea %pc@(kernel_pg_dir),%a5
1732 movel %a5,%a0
1733 movel
1734 moveql
173540:
1736
1737 movel %a4,%d5
1738 addil
1739 movel %a0@+,%d6
1740 btst
1741 jbne 41f
1742 jbsr mmu_print_tuple_invalidate
1743 jbra 48f
174441:
1745 movel
1746 andil
1747 movel %d6,%a1
174842:
1749 movel %a4,%d5
1750 addil
1751 movel %a1@+,%d6
1752 btst
1753 jbne 43f
1754 jbsr mmu_print_tuple_invalidate
1755 jbra 47f
175643:
1757 movel
1758 andil
1759 movel %d6,%a2
176044:
1761 movel %a4,%d5
1762 addil
1763 movel %a2@+,%d6
1764 btst
1765 jbne 45f
1766 jbsr mmu_print_tuple_invalidate
1767 jbra 46f
176845:
1769 moveml %d0-%d1,%sp@-
1770 movel %a4,%d0
1771 movel %d6,%d1
1772 andil
1773 lea %pc@(mmu_040_print_flags),%a6
1774 jbsr mmu_print_tuple
1775 moveml %sp@+,%d0-%d1
177646:
1777 movel %d5,%a4
1778 addq
1779 cmpib
1780 jbne 44b
178147:
1782 movel %d5,%a4
1783 addq
1784 cmpib
1785 jbne 42b
178648:
1787 movel %d5,%a4
1788 addq
1789 cmpib
1790 jbne 40b
1791
1792 .chip 68040
1793 movec %dtt1,%d0
1794 movel %d0,%d1
1795 andiw
1796 jbeq 1f
1797
1798 movel %d0,%d1
1799 andil
1800 putn %d1
1801 puts "=="
1802 putn %d1
1803
1804 movel %d0,%d6
1805 jbsr mmu_040_print_flags_tt
18061:
1807 movec %dtt0,%d0
1808 movel %d0,%d1
1809 andiw
1810 jbeq 1f
1811
1812 movel %d0,%d1
1813 andil
1814 putn %d1
1815 puts "=="
1816 putn %d1
1817
1818 movel %d0,%d6
1819 jbsr mmu_040_print_flags_tt
18201:
1821 .chip 68k
1822
1823 jbra mmu_print_done
1824
1825mmu_040_print_flags:
1826 btstl
1827 putZc(' ','G')
1828 btstl
1829 putZc(' ','S')
1830mmu_040_print_flags_tt:
1831 btstl
1832 jbne 3f
1833 putc 'C'
1834 btstl
1835 putZc('w','c')
1836 jbra 4f
18373:
1838 putc 'N'
1839 btstl
1840 putZc('s',' ')
18414:
1842 rts
1843
1844mmu_030_print_flags:
1845 btstl
1846 putZc('C','I')
1847 rts
1848
1849mmu_030_print:
1850 puts "\nMMU030\n"
1851 puts "\nrp:"
1852 putn %a5
1853 putc '\n'
1854 movel %a5,%d0
1855 andil
1856 movel %d0,%a0
1857 movel
1858 movel
185930:
1860 movel %a4,%d5
1861 addil
1862 movel %a0@+,%d6
1863 btst
1864 jbne 31f
1865 btst
1866 jbeq 1f
1867 jbsr mmu_030_print_helper
1868 jbra 38f
18691:
1870 jbsr mmu_print_tuple_invalidate
1871 jbra 38f
187231:
1873 movel
1874 andil
1875 movel %d6,%a1
187632:
1877 movel %a4,%d5
1878 addil
1879 movel %a1@+,%d6
1880 btst
1881 jbne 33f
1882 btst
1883 jbeq 1f
1884 jbsr mmu_030_print_helper
1885 jbra 37f
18861:
1887 jbsr mmu_print_tuple_invalidate
1888 jbra 37f
188933:
1890 movel
1891 andil
1892 movel %d6,%a2
189334:
1894 movel %a4,%d5
1895 addil
1896 movel %a2@+,%d6
1897 btst
1898 jbne 35f
1899 jbsr mmu_print_tuple_invalidate
1900 jbra 36f
190135:
1902 jbsr mmu_030_print_helper
190336:
1904 movel %d5,%a4
1905 addq
1906 cmpib
1907 jbne 34b
190837:
1909 movel %d5,%a4
1910 addq
1911 cmpib
1912 jbne 32b
191338:
1914 movel %d5,%a4
1915 addq
1916 cmpib
1917 jbne 30b
1918
1919mmu_print_done:
1920 puts "\n\n"
1921
1922func_return mmu_print
1923
1924
1925mmu_030_print_helper:
1926 moveml %d0-%d1,%sp@-
1927 movel %a4,%d0
1928 movel %d6,%d1
1929 lea %pc@(mmu_030_print_flags),%a6
1930 jbsr mmu_print_tuple
1931 moveml %sp@+,%d0-%d1
1932 rts
1933
1934mmu_print_tuple_invalidate:
1935 moveml %a0/%d7,%sp@-
1936
1937 lea %pc@(L(mmu_print_data)),%a0
1938 tstl %a0@(mmu_next_valid)
1939 jbmi mmu_print_tuple_invalidate_exit
1940
1941 movel
1942
1943 putn %a4
1944
1945 puts "##\n"
1946
1947mmu_print_tuple_invalidate_exit:
1948 moveml %sp@+,%a0/%d7
1949 rts
1950
1951
1952mmu_print_tuple:
1953 moveml %d0-%d7/%a0,%sp@-
1954
1955 lea %pc@(L(mmu_print_data)),%a0
1956
1957 tstl %a0@(mmu_next_valid)
1958 jble mmu_print_tuple_print
1959
1960 cmpl %a0@(mmu_next_physical),%d1
1961 jbeq mmu_print_tuple_increment
1962
1963mmu_print_tuple_print:
1964 putn %d0
1965 puts "->"
1966 putn %d1
1967
1968 movel %d1,%d6
1969 jbsr %a6@
1970
1971mmu_print_tuple_record:
1972 movel
1973
1974 movel %d1,%a0@(mmu_next_physical)
1975
1976mmu_print_tuple_increment:
1977 movel %d5,%d7
1978 subl %a4,%d7
1979 addl %d7,%a0@(mmu_next_physical)
1980
1981mmu_print_tuple_exit:
1982 moveml %sp@+,%d0-%d7/%a0
1983 rts
1984
1985mmu_print_machine_cpu_types:
1986 puts "machine: "
1987
1988 is_not_amiga(1f)
1989 puts "amiga"
1990 jbra 9f
19911:
1992 is_not_atari(2f)
1993 puts "atari"
1994 jbra 9f
19952:
1996 is_not_mac(3f)
1997 puts "macintosh"
1998 jbra 9f
19993: puts "unknown"
20009: putc '\n'
2001
2002 puts "cputype: 0"
2003 is_not_060(1f)
2004 putc '6'
2005 jbra 9f
20061:
2007 is_not_040_or_060(2f)
2008 putc '4'
2009 jbra 9f
20102: putc '3'
20119: putc '0'
2012 putc '\n'
2013
2014 rts
2015#endif
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026func_start mmu_map_tt,%d0/%d1/%a0,4
2027
2028 dputs "mmu_map_tt:"
2029 dputn ARG1
2030 dputn ARG2
2031 dputn ARG3
2032 dputn ARG4
2033 dputc '\n'
2034
2035 is_020(L(do_map))
2036
2037
2038
2039 bfffo ARG3{
2040 cmpw
2041 jcc L(do_map)
2042
2043
2044
2045 moveq
2046 lsrl %d1,%d0
2047 lsrl
2048
2049
2050
2051 movel %d0,%d1
2052 notl %d1
2053 andl ARG2,%d1
2054
2055
2056
2057 lsrl
2058 orl %d0,%d1
2059 clrw %d1
2060
2061 is_040_or_060(L(mmu_map_tt_040))
2062
2063
2064
2065
2066 orw
2067 movel ARG4,%d0
2068 btst
2069 jeq 1f
2070 orw
2071
20721: lea STACK,%a0
2073 dputn %d1
2074 movel %d1,%a0@
2075 .chip 68030
2076 tstl ARG1
2077 jne 1f
2078 pmove %a0@,%tt0
2079 jra 2f
20801: pmove %a0@,%tt1
20812: .chip 68k
2082 jra L(mmu_map_tt_done)
2083
2084
2085
2086L(mmu_map_tt_040):
2087 orw
2088 orl ARG4,%d1
2089 dputn %d1
2090
2091 .chip 68040
2092 tstl ARG1
2093 jne 1f
2094 movec %d1,%itt0
2095 movec %d1,%dtt0
2096 jra 2f
20971: movec %d1,%itt1
2098 movec %d1,%dtt1
20992: .chip 68k
2100
2101 jra L(mmu_map_tt_done)
2102
2103L(do_map):
2104 mmu_map_eq ARG2,ARG3,ARG4
2105
2106L(mmu_map_tt_done):
2107
2108func_return mmu_map_tt
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128func_start mmu_map,%d0-%d4/%a0-%a4
2129
2130 dputs "\nmmu_map:"
2131 dputn ARG1
2132 dputn ARG2
2133 dputn ARG3
2134 dputn ARG4
2135 dputc '\n'
2136
2137
2138
2139 movel ARG1,%d0
2140 andl
2141 movel %d0,%a3
2142
2143
2144
2145 movel ARG1,%a4
2146 addl ARG3,%a4
2147 subql
2148
2149
2150
2151 movel ARG2,%d0
2152 andl
2153 movel %d0,%a2
2154
2155
2156
2157 movel ARG4,%d0
2158 orw
2159 addw %d0,%a2
2160
2161 dputn %a2
2162 dputn %a3
2163 dputn %a4
2164
2165 is_not_040_or_060(L(mmu_map_030))
2166
2167 addw
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184L(mmu_map_040):
2185
2186
2187 movel %a3,%d0
2188 moveq
2189 lsrl %d1,%d0
2190 mmu_get_root_table_entry %d0
2191
2192
2193
2194 movel %a3,%d0
2195 moveq
2196 lsrl %d1,%d0
2197 andl
2198 mmu_get_ptr_table_entry %a0,%d0
2199
2200
2201
2202 movel %a3,%d0
2203 moveq
2204 lsrl %d1,%d0
2205 andl
2206 mmu_get_page_table_entry %a0,%d0
2207
2208
2209
2210 tstl %a0@
2211 jne L(mmu_map_error)
2212
2213
2214
2215 movel %a2,%a0@
22162:
2217 addw
2218 addw
2219
2220
2221
2222 lea %a3@(-1),%a0
2223 cmpl %a0,%a4
2224 jhi L(mmu_map_040)
2225 jra L(mmu_map_done)
2226
2227L(mmu_map_030):
2228
2229
2230 movel %a3,%d0
2231 moveq
2232 lsrl %d1,%d0
2233 mmu_get_root_table_entry %d0
2234
2235
2236
2237
2238 movel %a3,%d0
2239 andl
2240 jne 1f
2241
2242
2243
2244 lea %a3@(PTR_TABLE_SIZE*PAGE_TABLE_SIZE*PAGESIZE-1),%a1
2245 cmpl %a1,%a4
2246 jcs 1f
2247
2248 addql
2249
2250
2251
2252 tstl %a0@
2253 jne L(mmu_map_error)
2254
2255
2256
2257 dputs "early term1"
2258 dputn %a2
2259 dputn %a3
2260 dputn %a1
2261 dputc '\n'
2262 movel %a2,%a0@
2263
2264 movel %a1,%a3
2265 lea %a2@(PTR_TABLE_SIZE*PAGE_TABLE_SIZE*PAGESIZE),%a2
2266 jra L(mmu_mapnext_030)
22671:
2268
2269
2270 movel %a3,%d0
2271 moveq
2272 lsrl %d1,%d0
2273 andl
2274 mmu_get_ptr_table_entry %a0,%d0
2275
2276
2277
2278 tstl %a0@
2279 jne L(mmu_map_error)
2280
2281
2282
2283 dputs "early term2"
2284 dputn %a2
2285 dputn %a3
2286 dputc '\n'
2287 movel %a2,%a0@
2288
2289 addl
2290 addl
2291
2292L(mmu_mapnext_030):
2293
2294
2295 lea %a3@(-1),%a0
2296 cmpl %a0,%a4
2297 jhi L(mmu_map_030)
2298 jra L(mmu_map_done)
2299
2300L(mmu_map_error):
2301
2302 dputs "mmu_map error:"
2303 dputn %a2
2304 dputn %a3
2305 dputc '\n'
2306
2307L(mmu_map_done):
2308
2309func_return mmu_map
2310
2311
2312
2313
2314
2315
2316
2317
2318func_start mmu_fixup_page_mmu_cache,%d0/%a0
2319
2320 dputs "mmu_fixup_page_mmu_cache"
2321 dputn ARG1
2322
2323
2324
2325 movel ARG1,%d0
2326 moveq
2327 lsrl %d1,%d0
2328 mmu_get_root_table_entry %d0
2329
2330
2331
2332 movel ARG1,%d0
2333 moveq
2334 lsrl %d1,%d0
2335 andl
2336 mmu_get_ptr_table_entry %a0,%d0
2337
2338
2339
2340 movel ARG1,%d0
2341 moveq
2342 lsrl %d1,%d0
2343 andl
2344 mmu_get_page_table_entry %a0,%d0
2345
2346 movel %a0@,%d0
2347 andil
2348 orl %pc@(m68k_pgtable_cachemode),%d0
2349 movel %d0,%a0@
2350
2351 dputc '\n'
2352
2353func_return mmu_fixup_page_mmu_cache
2354
2355
2356
2357
2358
2359
2360
2361
2362func_start mmu_temp_map,%d0/%d1/%a0/%a1
2363
2364 dputs "mmu_temp_map"
2365 dputn ARG1
2366 dputn ARG2
2367 dputc '\n'
2368
2369 lea %pc@(L(temp_mmap_mem)),%a1
2370
2371
2372
2373 movel ARG2,%d0
2374 moveq
2375 lsrl %d1,%d0
2376 mmu_get_root_table_entry %d0
2377
2378
2379
2380 movel %a0@,%d0
2381 cmpl %pc@(L(memory_start)),%d0
2382 jcc 1f
2383
2384
2385
2386 movel %a1@,%d0
2387 addl
2388 orw
2389 movel %d0,%a0@
2390 dputs " (new)"
23911:
2392 dputn %d0
2393
2394
2395 andw
2396 movel %d0,%a0
2397
2398
2399
2400 movel ARG2,%d0
2401 moveq
2402 lsrl %d1,%d0
2403 andl
2404 lea %a0@(%d0*4),%a0
2405 dputn %a0
2406
2407
2408
2409 movel %a0@,%d0
2410 jne 1f
2411
2412
2413
2414 movel %a1@,%d0
2415
2416
2417 addl
2418 orw
2419 movel %d0,%a0@
2420 dputs " (new)"
24211:
2422 dputn %d0
2423
2424
2425 andw
2426 movel %d0,%a0
2427
2428
2429
2430 movel ARG2,%d0
2431 moveq
2432 lsrl %d1,%d0
2433 andl
2434 lea %a0@(%d0*4),%a0
2435 dputn %a0
2436
2437
2438
2439 movel ARG1,%d0
2440 andw
2441 orw
2442 movel %d0,%a0@
2443 dputn %d0
2444
2445 dputc '\n'
2446
2447func_return mmu_temp_map
2448
2449func_start mmu_engage,%d0-%d2/%a0-%a3
2450
2451 moveq
2452
2453 lea %pc@(L(kernel_pgdir_ptr)),%a0
2454 movel %a0@,%a2
2455 movel %pc@(L(memory_start)),%a1
2456 movel %a1,%a0@
2457 movel %a2,%a0
24581:
2459 movel %a0@+,%a1@+
2460 dbra %d0,1b
2461
2462 lea %pc@(L(temp_mmap_mem)),%a0
2463 movel %a1,%a0@
2464
2465 movew
24661:
2467 clrl %a1@+
2468 dbra %d0,1b
2469
2470 lea %pc@(1b),%a0
2471 movel
2472
2473 cmpl %a0,%a1
2474 jeq 1f
2475
2476 mmu_temp_map %a0,%a0
2477 mmu_temp_map %a0,%a1
2478
2479 addw
2480 addw
2481 mmu_temp_map %a0,%a0
2482 mmu_temp_map %a0,%a1
24831:
2484 movel %pc@(L(memory_start)),%a3
2485 movel %pc@(L(phys_kernel_start)),%d2
2486
2487 is_not_040_or_060(L(mmu_engage_030))
2488
2489L(mmu_engage_040):
2490 .chip 68040
2491 nop
2492 cinva %bc
2493 nop
2494 pflusha
2495 nop
2496 movec %a3,%srp
2497 movel
2498 movec %d0,%tc
2499 jmp 1f:l
25001: nop
2501 movec %a2,%srp
2502 nop
2503 cinva %bc
2504 nop
2505 pflusha
2506 .chip 68k
2507 jra L(mmu_engage_cleanup)
2508
2509L(mmu_engage_030_temp):
2510 .space 12
2511L(mmu_engage_030):
2512 .chip 68030
2513 lea %pc@(L(mmu_engage_030_temp)),%a0
2514 movel
2515 movel %a3,%a0@(4)
2516 movel
2517 movec %d0,%cacr
2518 pmove %a0@,%srp
2519 pflusha
2520
2521
2522
2523
2524 movel
2525 pmove %a0@(8),%tc
2526 jmp 1f:l
25271: movel %a2,%a0@(4)
2528 movel
2529 movec %d0,%cacr
2530 pmove %a0@,%srp
2531 pflusha
2532 .chip 68k
2533
2534L(mmu_engage_cleanup):
2535 subl
2536 subl %d2,%a2
2537 movel %a2,L(kernel_pgdir_ptr)
2538 subl %d2,%fp
2539 subl %d2,%sp
2540 subl %d2,ARG0
2541
2542func_return mmu_engage
2543
2544func_start mmu_get_root_table_entry,%d0/%a1
2545
2546
2547 dputs "mmu_get_root_table_entry:"
2548 dputn ARG1
2549 dputs " ="
2550#endif
2551
2552 movel %pc@(L(kernel_pgdir_ptr)),%a0
2553 tstl %a0
2554 jne 2f
2555
2556 dputs "\nmmu_init:"
2557
2558
2559
2560
2561
2562 get_bi_record BI_LAST
2563 addw
2564 movel %a0,%d0
2565 andw
2566
2567 dputn %d0
2568
2569 lea %pc@(L(memory_start)),%a0
2570 movel %d0,%a0@
2571 lea %pc@(L(kernel_end)),%a0
2572 movel %d0,%a0@
2573
2574
2575
2576
2577
2578 lea %pc@(_stext),%a0
2579 lea %pc@(L(mmu_cached_pointer_tables)),%a1
2580 movel %a0,%a1@
2581 addl
2582
2583 lea %pc@(L(mmu_num_pointer_tables)),%a1
2584 addql
2585
2586
2587
2588 movel %a0,%a1
2589 movew
25901:
2591 clrl %a1@+
2592 dbra %d0,1b
2593
2594 lea %pc@(L(kernel_pgdir_ptr)),%a1
2595 movel %a0,%a1@
2596
2597 dputn %a0
2598 dputc '\n'
25992:
2600 movel ARG1,%d0
2601 lea %a0@(%d0*4),%a0
2602
2603
2604 dputn %a0
2605 dputc '\n'
2606#endif
2607
2608func_return mmu_get_root_table_entry
2609
2610
2611
2612func_start mmu_get_ptr_table_entry,%d0/%a1
2613
2614
2615 dputs "mmu_get_ptr_table_entry:"
2616 dputn ARG1
2617 dputn ARG2
2618 dputs " ="
2619#endif
2620
2621 movel ARG1,%a0
2622 movel %a0@,%d0
2623 jne 2f
2624
2625
2626
2627 dputs "\nmmu_get_new_ptr_table:"
2628 lea %pc@(L(mmu_num_pointer_tables)),%a0
2629 movel %a0@,%d0
2630 addql
2631
2632
2633
2634 lea %pc@(L(mmu_cached_pointer_tables)),%a1
2635 andw
2636 jne 1f
2637
2638
2639
2640 get_new_page
2641 movel %a0,%a1@
26421:
2643
2644
2645 movel %a1@,%d0
2646 addl
2647
2648 dputn %d0
2649 dputc '\n'
2650
2651
2652
2653 movel ARG1,%a0
2654 orw
2655 movel %d0,%a0@
26562:
2657
2658
2659 andw
2660 movel %d0,%a0
2661 movel ARG2,%d0
2662 lea %a0@(%d0*4),%a0
2663
2664
2665 dputn %a0
2666 dputc '\n'
2667#endif
2668
2669func_return mmu_get_ptr_table_entry
2670
2671
2672func_start mmu_get_page_table_entry,%d0/%a1
2673
2674
2675 dputs "mmu_get_page_table_entry:"
2676 dputn ARG1
2677 dputn ARG2
2678 dputs " ="
2679#endif
2680
2681 movel ARG1,%a0
2682 movel %a0@,%d0
2683 jne 2f
2684
2685
2686
2687
2688
2689 get_new_page
2690 addw
2691
2692
2693
2694 movel ARG1,%d0
2695 andw
2696 movel %d0,%a1
2697
2698
2699
2700 moveq
27011:
2702 movel %a0,%a1@+
2703 lea %a0@(PAGE_TABLE_SIZE*4),%a0
2704 dbra %d0,1b
2705
2706
2707
2708 movel ARG1,%a0
2709 movel %a0@,%d0
27102:
2711
2712
2713 andw
2714 movel %d0,%a0
2715 movel ARG2,%d0
2716 lea %a0@(%d0*4),%a0
2717
2718
2719 dputn %a0
2720 dputc '\n'
2721#endif
2722
2723func_return mmu_get_page_table_entry
2724
2725
2726
2727
2728
2729
2730func_start get_new_page,%d0/%a1
2731
2732 dputs "\nget_new_page:"
2733
2734
2735
2736 lea %pc@(L(memory_start)),%a0
2737 movel %a0@,%a1
2738 addl
2739
2740
2741
2742 movel %a1,%a0
2743 movew
27441:
2745 clrl %a1@+
2746 dbra %d0,1b
2747
2748 dputn %a0
2749 dputc '\n'
2750
2751func_return get_new_page
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761#ifdef CONFIG_MAC
2762
2763L(scc_initable_mac):
2764 .byte 9,12
2765 .byte 4,0x44
2766 .byte 3,0xc0
2767 .byte 5,0xe2
2768 .byte 9,0
2769 .byte 10,0
2770 .byte 11,0x50
2771 .byte 12,10,13,0
2772 .byte 14,1
2773 .byte 3,0xc1
2774 .byte 5,0xea
2775 .byte -1
2776 .even
2777#endif
2778
2779#ifdef CONFIG_ATARI
2780
2781
2782
2783#define USE_MFP
2784
2785
2786#define USE_SCC
2787
2788L(scc_initable):
2789 .byte 9,12
2790 .byte 4,0x44
2791 .byte 3,0xc0
2792 .byte 5,0xe2
2793 .byte 9,0
2794 .byte 10,0
2795 .byte 11,0x50
2796 .byte 12,24,13,0
2797 .byte 14,2,14,3
2798 .byte 3,0xc1
2799 .byte 5,0xea
2800 .byte -1
2801 .even
2802#endif
2803
2804#ifdef USE_PRINTER
2805
2806LPSG_SELECT = 0xff8800
2807LPSG_READ = 0xff8800
2808LPSG_WRITE = 0xff8802
2809LPSG_IO_A = 14
2810LPSG_IO_B = 15
2811LPSG_CONTROL = 7
2812LSTMFP_GPIP = 0xfffa01
2813LSTMFP_DDR = 0xfffa05
2814LSTMFP_IERB = 0xfffa09
2815
2816
2817
2818LSCC_CTRL = 0xff8c85
2819LSCC_DATA = 0xff8c87
2820
2821
2822
2823LSCC_CTRL = 0xff8c81
2824LSCC_DATA = 0xff8c83
2825
2826
2827
2828LMFP_UCR = 0xfffa29
2829LMFP_TDCDR = 0xfffa1d
2830LMFP_TDDR = 0xfffa25
2831LMFP_TSR = 0xfffa2d
2832LMFP_UDR = 0xfffa2f
2833
2834#endif
2835#endif
2836
2837
2838
2839
2840
2841
2842
2843
2844func_start serial_init,%d0/%d1/%a0/%a1
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860#ifdef CONFIG_AMIGA
2861#define SERIAL_DTR 7
2862#define SERIAL_CNTRL CIABBASE+C_PRA
2863
2864 is_not_amiga(1f)
2865 lea %pc@(L(custom)),%a0
2866 movel
2867 bclr
2868 get_bi_record BI_AMIGA_SERPER
2869 movew %a0@,CUSTOMBASE+C_SERPER-ZTWOBASE
2870| movew
28711:
2872#endif
2873#ifdef CONFIG_ATARI
2874 is_not_atari(4f)
2875 movel %pc@(L(iobase)),%a1
2876
2877 bclr
2878 bclr
2879 moveb
2880 moveb
2881 moveb
2882 clrb %a1@(LPSG_WRITE)
2883 moveb
2884 moveb %a1@(LPSG_READ),%d0
2885 bset
2886 moveb %d0,%a1@(LPSG_WRITE)
2887
2888 lea %a1@(LSCC_CTRL),%a0
2889 lea %pc@(L(scc_initable)),%a1
28902: moveb %a1@+,%d0
2891 jmi 3f
2892 moveb %d0,%a0@
2893 moveb %a1@+,%a0@
2894 jra 2b
28953: clrb %a0@
2896
2897 bclr
2898 moveb
2899 andb
2900 moveb
2901 orb
2902 bset
2903#endif
2904 jra L(serial_init_done)
29054:
2906#endif
2907#ifdef CONFIG_MAC
2908 is_not_mac(L(serial_init_not_mac))
2909#ifdef MAC_SERIAL_DEBUG
2910
2911#define MAC_USE_SCC_B
2912#endif
2913#define mac_scc_cha_b_ctrl_offset 0x0
2914#define mac_scc_cha_a_ctrl_offset 0x2
2915#define mac_scc_cha_b_data_offset 0x4
2916#define mac_scc_cha_a_data_offset 0x6
2917
2918#ifdef MAC_USE_SCC_A
2919
2920 movel %pc@(L(mac_sccbase)),%a0
2921 lea %pc@(L(scc_initable_mac)),%a1
29225: moveb %a1@+,%d0
2923 jmi 6f
2924 moveb %d0,%a0@(mac_scc_cha_a_ctrl_offset)
2925 moveb %a1@+,%a0@(mac_scc_cha_a_ctrl_offset)
2926 jra 5b
29276:
2928#endif
2929
2930#ifdef MAC_USE_SCC_B
2931
2932#ifndef MAC_USE_SCC_A
2933 movel %pc@(L(mac_sccbase)),%a0
2934#endif
2935 lea %pc@(L(scc_initable_mac)),%a1
29367: moveb %a1@+,%d0
2937 jmi 8f
2938 moveb %d0,%a0@(mac_scc_cha_b_ctrl_offset)
2939 moveb %a1@+,%a0@(mac_scc_cha_b_ctrl_offset)
2940 jra 7b
29418:
2942#endif
2943#endif
2944
2945 jra L(serial_init_done)
2946L(serial_init_not_mac):
2947#endif
2948
2949#ifdef CONFIG_Q40
2950 is_not_q40(2f)
2951
2952
2953 lea %pc@(q40_mem_cptr),%a1
2954 move.l
2955 move.l
2956 cmp.b
2957 bne 2f
2958 addq.w
2959 cmp.b
2960 bne 2f
2961 addq.w
2962 cmp.b
2963 bne 2f
2964 addq.w
2965 cmp.b
2966 bne 2f
2967
2968 lea %pc@(L(q40_do_debug)),%a1
2969 tas %a1@
2970
29712:
2972#endif
2973
2974#ifdef CONFIG_APOLLO
2975
2976#endif
2977
2978#ifdef CONFIG_HP300
2979
2980#endif
2981
2982L(serial_init_done):
2983func_return serial_init
2984
2985
2986
2987
2988func_start serial_putc,%d0/%d1/%a0/%a1
2989
2990 movel ARG1,%d0
2991 cmpib
2992 jbne 1f
2993
2994
2995 serial_putc
29961:
2997
2998#ifdef CONFIG_AMIGA
2999 is_not_amiga(2f)
3000 andw
3001 oriw
3002 movel %pc@(L(custom)),%a0
3003 movew %d0,%a0@(CUSTOMBASE+C_SERDAT)
30041: movew %a0@(CUSTOMBASE+C_SERDATR),%d0
3005 andw
3006 jeq 1b
3007 jra L(serial_putc_done)
30082:
3009#endif
3010
3011#ifdef CONFIG_MAC
3012 is_not_mac(5f)
3013
3014#ifdef MAC_SERIAL_DEBUG
3015
3016#ifdef MAC_USE_SCC_A
3017 movel %pc@(L(mac_sccbase)),%a1
30183: btst
3019 jeq 3b
3020 moveb %d0,%a1@(mac_scc_cha_a_data_offset)
3021#endif
3022
3023#ifdef MAC_USE_SCC_B
3024#ifndef MAC_USE_SCC_A
3025 movel %pc@(L(mac_sccbase)),%a1
3026#endif
30274: btst
3028 jeq 4b
3029 moveb %d0,%a1@(mac_scc_cha_b_data_offset)
3030#endif
3031
3032#endif
3033
3034 jra L(serial_putc_done)
30355:
3036#endif
3037
3038#ifdef CONFIG_ATARI
3039 is_not_atari(4f)
3040 movel %pc@(L(iobase)),%a1
3041
30423: btst
3043 jne 3b
3044 moveb
3045 moveb %d0,%a1@(LPSG_WRITE)
3046 moveb
3047 moveb %a1@(LPSG_READ),%d0
3048 bclr
3049 moveb %d0,%a1@(LPSG_WRITE)
3050 nop
3051 nop
3052 bset
3053 moveb %d0,%a1@(LPSG_WRITE)
3054
30553: btst
3056 jeq 3b
3057 moveb %d0,%a1@(LSCC_DATA)
3058
30593: btst
3060 jeq 3b
3061 moveb %d0,%a1@(LMFP_UDR)
3062#endif
3063 jra L(serial_putc_done)
30644:
3065#endif
3066
3067#ifdef CONFIG_MVME147
3068 is_not_mvme147(2f)
30691: btst
3070 jeq 1b
3071 moveb %d0,M147_SCC_DATA_A
3072 jbra L(serial_putc_done)
30732:
3074#endif
3075
3076#ifdef CONFIG_MVME16x
3077 is_not_mvme16x(2f)
3078
3079
3080
3081
3082
3083
3084
3085 moveml %d0-%d7/%a2-%a6,%sp@-
3086 movel vme_brdtype,%d1
3087 jeq 1f | No tag - use the Bug
3088 cmpi
3089 jeq 6f
3090 cmpi
3091 jne 5f
3092
30936: btst
3094 nop
3095 nop
3096 nop
3097 jeq 6b
3098 moveb
3099 nop
3100 nop
3101 nop
3102 moveb %d0,M162_SCC_CTRL_A
3103 jra 3f
31045:
3105
3106 moveb
3107 moveb M167_CYIER,%d2
3108 moveb
31097:
3110 btst
3111 jeq 7b
3112 moveb M167_PCTPIACKR,%d1
3113 moveb M167_CYLICR,%d1
3114 jeq 8f
3115 moveb
3116 jra 7b
31178:
3118 moveb %d0,M167_CYTDR
3119 moveb
3120 moveb %d2,M167_CYIER
3121 jra 3f
31221:
3123 moveb %d0,%sp@-
3124 trap
3125 .word 0x0020
31263:
3127 moveml %sp@+,%d0-%d7/%a2-%a6
3128 jbra L(serial_putc_done)
31292:
3130#endif
3131
3132#ifdef CONFIG_BVME6000
3133 is_not_bvme6000(2f)
3134
3135
3136
31371: btst
3138 jeq 1b
3139 moveb %d0,BVME_SCC_DATA_A
3140 jbra L(serial_putc_done)
31412:
3142#endif
3143
3144#ifdef CONFIG_SUN3X
3145 is_not_sun3x(2f)
3146 movel %d0,-(%sp)
3147 movel 0xFEFE0018,%a1
3148 jbsr (%a1)
3149 addq
3150 jbra L(serial_putc_done)
31512:
3152#endif
3153
3154#ifdef CONFIG_Q40
3155 is_not_q40(2f)
3156 tst.l %pc@(L(q40_do_debug))
3157 beq 2f
3158 lea %pc@(q40_mem_cptr),%a1
3159 move.l %a1@,%a0
3160 move.b %d0,%a0@
3161 addq.l
3162 move.l %a0,%a1@
3163 jbra L(serial_putc_done)
31642:
3165#endif
3166
3167#ifdef CONFIG_APOLLO
3168 is_not_apollo(2f)
3169 movl %pc@(L(iobase)),%a1
3170 moveb %d0,%a1@(LTHRB0)
31711: moveb %a1@(LSRB0),%d0
3172 andb
3173 beq 1b
3174 jbra L(serial_putc_done)
31752:
3176#endif
3177
3178#ifdef CONFIG_HP300
3179 is_not_hp300(3f)
3180 movl %pc@(L(iobase)),%a1
3181 addl %pc@(L(uartbase)),%a1
3182 movel %pc@(L(uart_scode)),%d1
3183 jmi 3f
3184 cmpi
3185 jeq 2f
31861: moveb %a1@(DCALSR),%d1
3187 andb
3188 beq 1b
3189 moveb %d0,%a1@(DCADATA)
3190 jbra L(serial_putc_done)
31912: moveb %a1@(APCILSR),%d1
3192 andb
3193 beq 2b
3194 moveb %d0,%a1@(APCIDATA)
3195 jbra L(serial_putc_done)
31963:
3197#endif
3198
3199L(serial_putc_done):
3200func_return serial_putc
3201
3202
3203
3204
3205func_start puts,%d0/%a0
3206
3207 movel ARG1,%a0
3208 jra 2f
32091:
3210#ifdef CONSOLE
3211 console_putc %d0
3212#endif
3213#ifdef SERIAL_DEBUG
3214 serial_putc %d0
3215#endif
32162: moveb %a0@+,%d0
3217 jne 1b
3218
3219func_return puts
3220
3221
3222
3223
3224
3225func_start putn,%d0-%d2
3226
3227 putc ' '
3228
3229 movel ARG1,%d0
3230 moveq
32311: roll
3232 move %d0,%d2
3233 andb
3234 addb
3235 cmpb
3236 jls 2f
3237 addb
32382:
3239#ifdef CONSOLE
3240 console_putc %d2
3241#endif
3242#ifdef SERIAL_DEBUG
3243 serial_putc %d2
3244#endif
3245 dbra %d1,1b
3246
3247func_return putn
3248
3249#ifdef CONFIG_MAC
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263ENTRY(mac_serial_print)
3264 moveml %d0/%a0,%sp@-
3265
3266 move %sr,%sp@-
3267 ori
3268#endif
3269 movel %sp@(10),%a0
3270 jra 2f
32711: serial_putc %d0
32722: moveb %a0@+,%d0
3273 jne 1b
3274
3275 move %sp@+,%sr
3276#endif
3277 moveml %sp@+,%d0/%a0
3278 rts
3279#endif
3280
3281
3282func_start set_leds,%d0/%a0
3283 movel ARG1,%d0
3284#ifdef CONFIG_HP300
3285 is_not_hp300(1f)
3286 movel %pc@(L(iobase)),%a0
3287 moveb %d0,%a0@(0x1ffff)
3288 jra 2f
3289#endif
32901:
3291#ifdef CONFIG_APOLLO
3292 movel %pc@(L(iobase)),%a0
3293 lsll
3294 eorw
3295 moveb %d0,%a0@(LCPUCTRL)
3296#endif
32972:
3298func_return set_leds
3299#endif
3300
3301#ifdef CONSOLE
3302
3303
3304
3305
3306#define Lconsole_struct_cur_column 0
3307#define Lconsole_struct_cur_row 4
3308#define Lconsole_struct_num_columns 8
3309#define Lconsole_struct_num_rows 12
3310#define Lconsole_struct_left_edge 16
3311#define Lconsole_struct_penguin_putc 20
3312
3313func_start console_init,%a0-%a4/%d0-%d7
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328 lea %pc@(L(console_globals)),%a2
3329 movel %pc@(L(mac_videobase)),%a1
3330 movel %pc@(L(mac_rowbytes)),%d5
3331 movel %pc@(L(mac_dimensions)),%d3
3332 movel %d3,%d4
3333 swap %d4
3334 andl
3335 andl
3336
3337 movel %d5,%d6
3338| subl
3339 mulul %d4,%d6
3340 divul
3341 moveq
3342 subq
3343
3344L(console_clear_loop):
3345 movel %d0,%a1@+
3346 movel %d0,%a1@+
3347 dbra %d6,L(console_clear_loop)
3348
3349
3350
3351
3352 lea %pc@(font_vga_8x8),%a0
3353
3354 lea %pc@(font_vga_8x16),%a0
3355
3356 lea %pc@(font_vga_6x11),%a0
3357
3358 lea %pc@(font_vga_8x8),%a0
3359#else
3360 lea 0,%a0
3361#endif
3362
3363
3364
3365
3366
3367 lea %pc@(L(console_font)),%a1
3368 movel %a0,%a1@
3369 tstl %a0
3370 jeq 1f
3371 lea %pc@(L(console_font_data)),%a4
3372 movel %a0@(FONT_DESC_DATA),%d0
3373 subl
3374 addl %a1,%d0
3375 movel %d0,%a4@
3376
3377
3378
3379
3380
3381
3382
3383
3384 movel %d3,%d0
3385 divul %a0@(FONT_DESC_WIDTH),%d0
3386
3387 movel %d4,%d1
3388 divul %a0@(FONT_DESC_HEIGHT),%d1
3389
3390 movel %d0,%a2@(Lconsole_struct_num_columns)
3391 movel %d1,%a2@(Lconsole_struct_num_rows)
3392
3393
3394
3395
3396 clrl %a2@(Lconsole_struct_cur_column)
3397 clrl %a2@(Lconsole_struct_cur_row)
3398 clrl %a2@(Lconsole_struct_left_edge)
3399
3400
3401
3402
34031:
3404func_return console_init
3405
3406func_start console_put_stats,%a0/%d7
3407
3408
3409
3410
3411
3412 puts "\nMacLinux\n\n"
3413
3414#ifdef SERIAL_DEBUG
3415 puts " vidaddr:"
3416 putn %pc@(L(mac_videobase))
3417
3418 puts "\n _stext:"
3419 lea %pc@(_stext),%a0
3420 putn %a0
3421
3422 puts "\nbootinfo:"
3423 lea %pc@(_end),%a0
3424 putn %a0
3425
3426 puts "\ncpuid:"
3427 putn %pc@(L(cputype))
3428 putc '\n'
3429
3430#ifdef MAC_SERIAL_DEBUG
3431 putn %pc@(L(mac_sccbase))
3432 putc '\n'
3433#endif
3434
3435 jbsr mmu_print_machine_cpu_types
3436# endif
3437#endif
3438
3439func_return console_put_stats
3440
3441#ifdef CONSOLE_PENGUIN
3442func_start console_put_penguin,%a0-%a1/%d0-%d7
3443
3444
3445
3446
3447 lea %pc@(L(mac_dimensions)),%a0
3448 movel %a0@,%d0
3449 andil
3450 subil
3451 clrl %d1
3452 movel
3453 lea %pc@(L(that_penguin)),%a1
3454L(console_penguin_row):
3455 movel
3456L(console_penguin_pixel_pair):
3457 moveb %a1@,%d2
3458 lsrb
3459 console_plot_pixel %d0,%d1,%d2
3460 addq
3461 moveb %a1@+,%d2
3462 console_plot_pixel %d0,%d1,%d2
3463 addq
3464 dbra %d6,L(console_penguin_pixel_pair)
3465
3466 subil
3467 addq
3468 dbra %d7,L(console_penguin_row)
3469
3470func_return console_put_penguin
3471
3472
3473L(that_penguin):
3474#include "../mac/mac_penguin.S"
3475#endif
3476
3477
3478
3479
3480
3481
3482
3483func_start console_scroll,%a0-%a4/%d0-%d7
3484 lea %pc@(L(mac_videobase)),%a0
3485 movel %a0@,%a1
3486 movel %a1,%a2
3487 lea %pc@(L(mac_rowbytes)),%a0
3488 movel %a0@,%d5
3489 movel %pc@(L(console_font)),%a0
3490 tstl %a0
3491 jeq 1f
3492 mulul %a0@(FONT_DESC_HEIGHT),%d5
3493 addal %d5,%a2
3494
3495
3496
3497
3498 lea %pc@(L(mac_dimensions)),%a0
3499 movel %a0@,%d3
3500 movel %d3,%d4
3501 swap %d4
3502 andl
3503 andl
3504
3505
3506
3507
3508 lea %pc@(L(mac_rowbytes)),%a0
3509 movel %a0@,%d6
3510 movel %pc@(L(console_font)),%a0
3511 subl %a0@(FONT_DESC_HEIGHT),%d4
3512 mulul %d4,%d6
3513 divul
3514 subq
3515
3516L(console_scroll_loop):
3517 movel %a2@+,%a1@+
3518 movel %a2@+,%a1@+
3519 movel %a2@+,%a1@+
3520 movel %a2@+,%a1@+
3521 movel %a2@+,%a1@+
3522 movel %a2@+,%a1@+
3523 movel %a2@+,%a1@+
3524 movel %a2@+,%a1@+
3525 dbra %d6,L(console_scroll_loop)
3526
3527 lea %pc@(L(mac_rowbytes)),%a0
3528 movel %a0@,%d6
3529 movel %pc@(L(console_font)),%a0
3530 mulul %a0@(FONT_DESC_HEIGHT),%d6
3531 divul
3532 subq
3533
3534 moveq
3535L(console_scroll_clear_loop):
3536 movel %d0,%a1@+
3537 movel %d0,%a1@+
3538 movel %d0,%a1@+
3539 movel %d0,%a1@+
3540 movel %d0,%a1@+
3541 movel %d0,%a1@+
3542 movel %d0,%a1@+
3543 movel %d0,%a1@+
3544 dbra %d6,L(console_scroll_clear_loop)
3545
35461:
3547func_return console_scroll
3548
3549
3550func_start console_putc,%a0/%a1/%d0-%d7
3551
3552 is_not_mac(L(console_exit))
3553 tstl %pc@(L(console_font))
3554 jeq L(console_exit)
3555
3556
3557
3558 movel ARG1,%d7
3559 cmpib
3560 jbne 1f
3561
3562
3563 console_putc
35641:
3565 lea %pc@(L(console_globals)),%a0
3566
3567 cmpib
3568 jne L(console_not_lf)
3569 movel %a0@(Lconsole_struct_cur_row),%d0
3570 addil
3571 movel %d0,%a0@(Lconsole_struct_cur_row)
3572 movel %a0@(Lconsole_struct_num_rows),%d1
3573 cmpl %d1,%d0
3574 jcs 1f
3575 subil
3576 movel %d0,%a0@(Lconsole_struct_cur_row)
3577 console_scroll
35781:
3579 jra L(console_exit)
3580
3581L(console_not_lf):
3582 cmpib
3583 jne L(console_not_cr)
3584 clrl %a0@(Lconsole_struct_cur_column)
3585 jra L(console_exit)
3586
3587L(console_not_cr):
3588 cmpib
3589 jne L(console_not_home)
3590 clrl %a0@(Lconsole_struct_cur_row)
3591 clrl %a0@(Lconsole_struct_cur_column)
3592 jra L(console_exit)
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603L(console_not_home):
3604 movel %a0@(Lconsole_struct_cur_column),%d0
3605 addql
3606 movel %a0@(Lconsole_struct_num_columns),%d1
3607 cmpl %d1,%d0
3608 jcs 1f
3609 console_putc
36101:
3611 movel %a0@(Lconsole_struct_cur_row),%d1
3612
3613
3614
3615
3616
3617 movel %pc@(L(console_font)),%a0
3618 movel %pc@(L(console_font_data)),%a1
3619 andl
3620
3621 mulul %a0@(FONT_DESC_HEIGHT),%d7
3622 addl %d7,%a1
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634 mulul %a0@(FONT_DESC_WIDTH),%d0
3635 mulul %a0@(FONT_DESC_HEIGHT),%d1
3636 movel %a0@(FONT_DESC_HEIGHT),%d7
3637 subq
3638L(console_read_char_scanline):
3639 moveb %a1@+,%d3
3640
3641
3642 movel %a0@(FONT_DESC_WIDTH),%d6
3643 subql
3644
3645L(console_do_font_scanline):
3646 lslb
3647 scsb %d2
3648 console_plot_pixel %d0,%d1,%d2
3649 addq
3650 dbra %d6,L(console_do_font_scanline)
3651
3652
3653 subl %a0@(FONT_DESC_WIDTH),%d0
3654 addq
3655 dbra %d7,L(console_read_char_scanline)
3656
3657L(console_exit):
3658func_return console_putc
3659
3660
3661
3662
3663
3664
3665
3666
3667func_start console_plot_pixel,%a0-%a1/%d0-%d4
3668
3669 movel %pc@(L(mac_videobase)),%a1
3670 movel %pc@(L(mac_videodepth)),%d3
3671 movel ARG1,%d0
3672 movel ARG2,%d1
3673 mulul %pc@(L(mac_rowbytes)),%d1
3674 movel ARG3,%d2
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684L(test_1bit):
3685 cmpb
3686 jbne L(test_2bit)
3687 movel %d0,%d4
3688 divul
3689 addal %d0,%a1
3690 addal %d1,%a1
3691 andb
3692 eorb
3693 andb
3694 jbne L(white_1)
3695 bsetb %d4,%a1@
3696 jbra L(console_plot_pixel_exit)
3697L(white_1):
3698 bclrb %d4,%a1@
3699 jbra L(console_plot_pixel_exit)
3700
3701L(test_2bit):
3702 cmpb
3703 jbne L(test_4bit)
3704 movel %d0,%d4
3705 divul
3706 addal %d0,%a1
3707 addal %d1,%a1
3708 andb
3709 eorb
3710 lsll
3711 andb
3712 jbne L(white_2)
3713 bsetb %d4,%a1@
3714 addq
3715 bsetb %d4,%a1@
3716 jbra L(console_plot_pixel_exit)
3717L(white_2):
3718 bclrb %d4,%a1@
3719 addq
3720 bclrb %d4,%a1@
3721 jbra L(console_plot_pixel_exit)
3722
3723L(test_4bit):
3724 cmpb
3725 jbne L(test_8bit)
3726 movel %d0,%d4
3727 divul
3728 addal %d0,%a1
3729 addal %d1,%a1
3730 andb
3731 eorb
3732 lsll
3733 andb
3734 jbne L(white_4)
3735 bsetb %d4,%a1@
3736 addq
3737 bsetb %d4,%a1@
3738 addq
3739 bsetb %d4,%a1@
3740 addq
3741 bsetb %d4,%a1@
3742 jbra L(console_plot_pixel_exit)
3743L(white_4):
3744 bclrb %d4,%a1@
3745 addq
3746 bclrb %d4,%a1@
3747 addq
3748 bclrb %d4,%a1@
3749 addq
3750 bclrb %d4,%a1@
3751 jbra L(console_plot_pixel_exit)
3752
3753L(test_8bit):
3754 cmpb
3755 jbne L(test_16bit)
3756 addal %d0,%a1
3757 addal %d1,%a1
3758 andb
3759 jbne L(white_8)
3760 moveb
3761 jbra L(console_plot_pixel_exit)
3762L(white_8):
3763 clrb %a1@
3764 jbra L(console_plot_pixel_exit)
3765
3766L(test_16bit):
3767 cmpb
3768 jbne L(console_plot_pixel_exit)
3769 addal %d0,%a1
3770 addal %d0,%a1
3771 addal %d1,%a1
3772 andb
3773 jbne L(white_16)
3774 clrw %a1@
3775 jbra L(console_plot_pixel_exit)
3776L(white_16):
3777 movew
3778 jbra L(console_plot_pixel_exit)
3779
3780L(console_plot_pixel_exit):
3781func_return console_plot_pixel
3782#endif
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792L(showtest):
3793 moveml %a0/%d7,%sp@-
3794 puts "A="
3795 putn %a1
3796
3797 .long 0xf0119f15 | ptestr
3798
3799 puts "DA="
3800 putn %a0
3801
3802 puts "D="
3803 putn %a0@
3804
3805 puts "S="
3806 lea %pc@(L(mmu)),%a0
3807 .long 0xf0106200 | pmove %psr,%a0@
3808 clrl %d7
3809 movew %a0@,%d7
3810 putn %d7
3811
3812 putc '\n'
3813 moveml %sp@+,%a0/%d7
3814 rts
3815#endif
3816
3817__INITDATA
3818 .align 4
3819
3820
3821 defined(CONFIG_HP300) || defined(CONFIG_APOLLO)
3822L(custom):
3823L(iobase):
3824 .long 0
3825#endif
3826
3827
3828L(console_globals):
3829 .long 0
3830 .long 0
3831 .long 0
3832 .long 0
3833 .long 0
3834 .long 0
3835L(console_font):
3836 .long 0
3837L(console_font_data):
3838 .long 0
3839#endif
3840
3841
3842L(mmu_print_data):
3843 .long 0
3844 .long 0
3845 .long 0
3846 .long 0
3847 .long 0
3848#endif
3849
3850L(cputype):
3851 .long 0
3852L(mmu_cached_pointer_tables):
3853 .long 0
3854L(mmu_num_pointer_tables):
3855 .long 0
3856L(phys_kernel_start):
3857 .long 0
3858L(kernel_end):
3859 .long 0
3860L(memory_start):
3861 .long 0
3862L(kernel_pgdir_ptr):
3863 .long 0
3864L(temp_mmap_mem):
3865 .long 0
3866
3867
3868M147_SCC_CTRL_A = 0xfffe3002
3869M147_SCC_DATA_A = 0xfffe3003
3870#endif
3871
3872
3873M162_SCC_CTRL_A = 0xfff45005
3874M167_CYCAR = 0xfff450ee
3875M167_CYIER = 0xfff45011
3876M167_CYLICR = 0xfff45026
3877M167_CYTEOIR = 0xfff45085
3878M167_CYTDR = 0xfff450f8
3879M167_PCSCCTICR = 0xfff4201e
3880M167_PCTPIACKR = 0xfff42025
3881#endif
3882
3883
3884BVME_SCC_CTRL_A = 0xffb0000b
3885BVME_SCC_DATA_A = 0xffb0000f
3886#endif
3887
3888
3889L(mac_booter_data):
3890 .long 0
3891L(mac_videobase):
3892 .long 0
3893L(mac_videodepth):
3894 .long 0
3895L(mac_dimensions):
3896 .long 0
3897L(mac_rowbytes):
3898 .long 0
3899#ifdef MAC_SERIAL_DEBUG
3900L(mac_sccbase):
3901 .long 0
3902#endif
3903#endif
3904
3905
3906LSRB0 = 0x10412
3907LTHRB0 = 0x10416
3908LCPUCTRL = 0x10100
3909#endif
3910
3911
3912DCADATA = 0x11
3913DCALSR = 0x1b
3914APCIDATA = 0x00
3915APCILSR = 0x14
3916L(uartbase):
3917 .long 0
3918L(uart_scode):
3919 .long -1
3920#endif
3921
3922__FINIT
3923 .data
3924 .align 4
3925
3926availmem:
3927 .long 0
3928m68k_pgtable_cachemode:
3929 .long 0
3930m68k_supervisor_cachemode:
3931 .long 0
3932
3933mvme_bdid:
3934 .long 0,0,0,0,0,0,0,0
3935#endif
3936
3937q40_mem_cptr:
3938 .long 0
3939L(q40_do_debug):
3940 .long 0
3941#endif
3942