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