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 #include <linux/linkage.h>
55 #include <asm/bootinfo.h>
56
57 .text
58 .globl SYMBOL_NAME(kernel_pg_dir), SYMBOL_NAME(kpt)
59 .globl SYMBOL_NAME(availmem), SYMBOL_NAME(is_medusa)
60 .globl SYMBOL_NAME(m68k_pgtable_cachemode)
61 .globl SYMBOL_NAME(kernel_pmd_table), SYMBOL_NAME(swapper_pg_dir)
62
63 PAGESIZE = 4096
64 BI_CPU = 4
65 BI_MACH = 0
66 BI_AMIGA_ECLK = 1234
67 LF = 10
68 CR = 13
69 BI_BIT040 = 2
70 BI_BIT060 = 3
71 BIT0460 = 16
72 BIT060 = 17
73 D6VAL_040 = 0x00010000
74 D6VAL_060 = 0x00030000
75
76
77
78
79
80
81
82 TC_ENABLE = 0x8000
83 TC_PAGE8K = 0x4000
84 TC_PAGE4K = 0x0000
85
86
87 TTR_ENABLE = 0x8000
88
89
90
91
92
93 CM_CACHE_WT = 0x0000
94 CM_CACHE_CB = 0x0020
95 CM_NONCACHE_SER = 0x0040
96 CM_NONCACHE = 0x0060
97 CM_MASK = 0xffffff9f
98
99 MODIFIED = 0x0010
100 WRITE_PROT = 0x0004
101 USED = 0x0008
102 GLOBAL = 0x0400
103 SV_ONLY = 0x0080
104 PAGEDESC = 0x0001
105 TABLEDESC = 0x0002
106 INVALID = 0x0000
107
108
109 I_HALF = 0x00002000
110 I_FREEZE = 0x00004000
111 I_ENABLE = 0x00008000
112 BC_CLRU = 0x00200000
113 BC_CLRA = 0x00400000
114 BC_ENABLE = 0x00800000
115 D_HALF = 0x08000000
116 PUSH_DPI = 0x10000000
117 SB_ENABLE = 0x20000000
118 D_FREEZE = 0x40000000
119 D_ENABLE = 0x80000000
120
121
122 PAGE_MASK = (~(PAGESIZE-1))
123
124 ROOT_TABLE_SIZE = 128
125 PTR_TABLE_SIZE = 128
126 PAGE_TABLE_SIZE = 64
127 ROOT_INDEX_SHIFT = 25
128 PAGE_INDEX_SHIFT = 12
129
130 ENTRY(_stext)
131 ENTRY(_start)
132 bras 1f
133
134
135
136
137 .long BOOTINFOV_MAGIC
138 .long MACH_AMIGA, AMIGA_BOOTI_VERSION
139 .long MACH_ATARI, ATARI_BOOTI_VERSION
140 .long 0
141
142 1:
143
144
145
146
147
148 movew #0x2700,%sr
149
150
151
152
153 lea %pc@(SYMBOL_NAME(_start)),%sp
154
155
156 lea %pc@(mmu),%a0
157 clrl %a0@
158 frestore %a0@
159
160
161
162
163 lea %pc@(SYMBOL_NAME(_end)),%a0
164 lea %pc@(SYMBOL_NAME(boot_info)),%a1
165 movel %pc@(SYMBOL_NAME(bisize)),%d0
166 subql #1,%d0
167 1: moveb %a0@+,%a1@+
168 dbra %d0,1b
169
170
171
172
173 lea %pc@(SYMBOL_NAME(boot_info)),%a0
174 movel %a0@(BI_MACH),%d4
175 movel %a0@(BI_CPU),%d0
176 movel %a0@(BI_CPU),%d6
177
178 btst #BI_BIT060,%d0
179 beq 1f
180
181 movel #(D6VAL_060+CM_NONCACHE),%d6
182 bra 2f
183 1: btst #BI_BIT040,%d0
184 beq 1f
185
186 movel #(D6VAL_040+CM_CACHE_WT),%d6
187 bra 2f
188 1:
189 moveq #0,%d6
190
191 2: lea %pc@(SYMBOL_NAME(m68k_pgtable_cachemode)),%a0
192 movel %d6,%a0@
193 andl #0x0000ffff,%a0@
194
195
196
197
198 jbsr Lserial_init
199
200 moveq #CR,%d7
201 jbsr Lserial_putc
202 moveq #LF,%d7
203 jbsr Lserial_putc
204 moveq #'A',%d7
205 jbsr Lserial_putc
206
207
208
209
210
211 lea %pc@(SYMBOL_NAME(_end)),%a0
212 movel %a0,%d0
213 addl #(PAGESIZE-1),%d0
214 andl #PAGE_MASK,%d0
215 movel %d0,%a6
216
217 moveq #'B',%d7
218 jbsr Lserial_putc
219
220
221
222
223 lea %pc@(SYMBOL_NAME(kernel_pg_dir)),%a4
224 movel %a4,%a0
225 moveq #0,%d0
226 moveq #(ROOT_TABLE_SIZE-1),%d1
227 1: movel %d0,%a0@+
228 dbra %d1,1b
229
230
231
232
233
234 movel %a6,%a5
235 addw #PAGESIZE,%a6
236
237 movel %a5,%a0
238 addql #TABLEDESC,%a0
239 movel %a0,%a4@
240
241 moveq #'C',%d7
242 jbsr Lserial_putc
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261 movel %a5,%a0
262 moveq #0,%d0
263 moveq #(PTR_TABLE_SIZE-1),%d1
264 1: movel %d0,%a0@+
265 dbra %d1,1b
266
267 movel %a5,%a0
268 moveq #15,%d1
269
270
271
272
273
274
275 btst #BIT0460,%d6
276 bne 1f
277
278
279 lea %pc@(SYMBOL_NAME(_stext)-PAGESIZE:w),%a1
280 addql #PAGEDESC,%a1
281 movel #0x40000,%d2
282 bra 2f
283
284 1:
285 movel %a6,%a1
286 addw #PAGESIZE,%a6
287 lea %pc@(SYMBOL_NAME(kpt)),%a3
288 movel %a1,%a3@
289 addql #TABLEDESC,%a1
290 movel #256,%d2
291
292 2: movel %a1,%a0@+
293 addl %d2,%a1
294 dbra %d1,2b
295
296 moveq #'D',%d7
297 jbsr Lserial_putc
298
299
300
301
302
303
304
305
306
307 btst #BIT0460,%d6
308 jeq Lnot040
309
310 moveq #'F',%d7
311 jbsr Lserial_putc
312
313 movel %pc@(SYMBOL_NAME(kpt)),%a0
314 lea %pc@(SYMBOL_NAME(_stext)-PAGESIZE:w),%a1
315
316 addw #(GLOBAL+CM_CACHE_CB+PAGEDESC),%a1
317 movew #((PAGESIZE/4)-1),%d1
318 movel #PAGESIZE,%d2
319
320 1: movel %a1,%a0@+
321 addl %d2,%a1
322 dbra %d1,1b
323
324
325
326
327
328
329
330
331 lea %pc@(SYMBOL_NAME(_stext)-PAGESIZE:w),%a0
332 movel %a4,%d0
333 subl %a0,%d0
334 moveq #PAGE_INDEX_SHIFT,%d1
335 lsrl %d1,%d0
336 movel %pc@(SYMBOL_NAME(kpt)),%a0
337 lea %a0@(%d0:l:4),%a0
338 movel %a0@,%d1
339 andl #CM_MASK,%d1
340 orw %d6,%d1
341 movel %d1,%a0@+
342
343 movel %a0@,%d1
344 bclr #5,%d1
345 bset #6,%d1
346 movel %d1,%a0@
347
348 Lnot040:
349
350
351
352 moveq #MACH_AMIGA,%d0
353 cmpl %d4,%d0
354 bne Lnotami
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369 moveq #'H',%d7
370 jbsr Lserial_putc
371
372 move.w #PAGESIZE,%sp
373
374 btst #BIT0460,%d6
375 bne Lspami68040
376
377
378
379
380
381
382
383
384 moveq #'I',%d7
385 jbsr Lserial_putc
386
387 moveq #0x41,%d0
388 movel %d0,%a4@(64*4)
389
390 bra Lmapphys
391
392 Lspami68040:
393
394
395
396
397
398
399
400
401
402 lea %a5@(512),%a0
403 moveq #0,%d0
404 moveq #(PTR_TABLE_SIZE-1),%d1
405 1: movel %d0,%a0@+
406 dbra %d1,1b
407
408
409 movel %a6,%a3
410 addw #(4*PAGESIZE),%a6
411
412
413 lea %a5@(512),%a0
414 movel %a3,%a1
415 addql #TABLEDESC,%a1
416 movel #256,%d2
417 moveq #(PAGE_TABLE_SIZE-1),%d1
418
419 1: movel %a1,%a0@+
420 addl %d2,%a1
421 dbra %d1,1b
422
423
424 lea %a5@(512),%a0
425 addql #TABLEDESC,%a0
426 movel %a0,%a4@(256)
427
428
429
430
431
432
433 movel %a3,%a0
434 movew #(GLOBAL+CM_NONCACHE_SER+PAGEDESC),%a1
435 movel #PAGESIZE,%d2
436 movew #PAGESIZE-1,%d1
437
438 1: movel %a1,%a0@+
439 addl %d2,%a1
440 dbra %d1,1b
441
442
443
444
445
446
447 movel %a3,%d0
448 lea %pc@(SYMBOL_NAME(_stext)-PAGESIZE:w),%a0
449 subl %a0,%d0
450 moveq #PAGE_INDEX_SHIFT,%d1
451 lsrl %d1,%d0
452 movel %pc@(SYMBOL_NAME(kpt)),%a0
453 movel #3,%d2
454 1: lea %a0@(%d0:l:4),%a1
455 movel %a1@,%d1
456 bclr #5,%d1
457 bset #6,%d1
458 movel %d1,%a1@
459 addql #1,%d0
460 dbra %d2,1b
461
462 bra Lmapphys
463
464
465 Lnotami:
466
467 moveq #MACH_ATARI,%d0
468 cmpl %d4,%d0
469 bne Lnotatari
470
471 move.w #PAGESIZE,%sp
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491 moveq #0,%d3
492 movec %d3,%vbr
493 lea %pc@(Ltest_berr),%a0
494 movel %a0,0x8
495 movel %sp,%a0
496 moveb 0x0,%d1
497 clrb 0x0
498 nop
499 moveb %d1,0x0
500 nop
501 tstb 0x00ff82fe
502 nop
503 movel #0xff000000,%d3
504 Ltest_berr:
505 movel %a0,%sp
506 lea %pc@(SYMBOL_NAME(is_medusa)),%a0
507 movel %d3,%a0@
508
509
510 lea %a5@(512),%a0
511 addl #TABLEDESC,%a0
512 movel %a0,%a4@(508)
513
514
515 lea %a5@(512),%a0
516 movel #0,%d0
517 movel #63,%d2
518 1: movel %d0,%a0@+
519 dbra %d2,1b
520
521 btst #BIT0460,%d6
522 bne Lspata68040
523
524
525
526 movel #0x40000,%d1
527 movel #63,%d2
528 movel %d3,%d0
529 addl #PAGEDESC,%d0
530 1: movel %d0,%a0@+
531 addl %d1,%d0
532 dbra %d2,1b
533 moveq #0x40,%d0
534 addl %d0,%a5@(1020)
535
536 addl %d0,%a5@(1008)
537
538 bra Lmapphys
539
540 Lspata68040:
541
542 movel %a6,%a3
543 addw #(4*PAGESIZE),%a6
544
545
546 movel %a3,%a1
547 addql #TABLEDESC,%a1
548 movel #256,%d2
549 moveq #63,%d1
550 1: movel %a1,%a0@+
551 addl %d2,%a1
552 dbra %d1,1b
553
554
555 movel %a3,%a0
556 movel %d3,%a1
557 addw #(GLOBAL+CM_NONCACHE_SER+PAGEDESC),%a1
558 movel #PAGESIZE,%d2
559 movew #(PAGESIZE-1),%d1
560 1: movel %a1,%a0@+
561 addl %d2,%a1
562 dbra %d1,1b
563
564
565
566
567
568
569 movel %a3,%d0
570 lea %pc@(SYMBOL_NAME(_stext)-PAGESIZE:w),%a0
571 subl %a0,%d0
572 moveq #PAGE_INDEX_SHIFT,%d1
573
574 lsrl %d1,%d0
575 movel %pc@(SYMBOL_NAME(kpt)),%a0
576 moveq #3,%d2
577 1: lea %a0@(%d0:l:4),%a1
578 movel %a1@,%d1
579 andl #CM_MASK,%d1
580 orw %d6,%d1
581 movel %d1,%a1@
582 addql #1,%d0
583 dbra %d2,1b
584
585 Lnotatari:
586
587
588
589
590
591
592
593 Lmapphys:
594 moveq #'J',%d7
595 jbsr Lserial_putc
596
597 clrl %d5
598
599 cmpl #MACH_AMIGA,%d4
600 bne Lmapphysnotamiga
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617 btst #BIT0460,%d6
618 bne Lamimmu68040
619
620 moveq #'K',%d7
621 jbsr Lserial_putc
622
623 lea %pc@(mmu),%a0
624 movel #0x80000002,%a0@
625 movel %a4,%a0@(4)
626 pmove %a0@,%srp
627 pmove %a0@,%crp
628
629
630
631
632 movel #0x82c07760,%a0@
633
634
635 lea %pc@(Ldoit030ami),%a2
636 lea Ldoit030ami,%a1
637
638 moveq #CR,%d7
639 jbsr Lserial_putc
640 moveq #LF,%d7
641 jbsr Lserial_putc
642 movel %a2,%d7
643 jbsr Lserial_putnum
644 moveq #' ',%d7
645 jbsr Lserial_putc
646 movel %a1,%d7
647 jbsr Lserial_putnum
648
649 bra LdoitAmiga
650
651 #ifdef __ELF__
652 .align 16
653 #else
654 .align 4
655 #endif
656 Ldoit030ami:
657 pmove %a0@,%tc
658 jra LdoneMMUenable
659
660 Lamimmu68040:
661 moveq #'L',%d7
662 jbsr Lserial_putc
663
664 .word 0xf4d8
665 .word 0xf518
666 .long 0x4e7bc807
667 .long 0x4e7bc806
668 movel #(TC_ENABLE+TC_PAGE4K),%d0
669
670
671 lea Ldoit040ami,%a1
672 lea %pc@(Ldoit040ami),%a2
673 bra LdoitAmiga
674
675 #ifdef __ELF__
676 .align 16
677 #else
678 .align 4
679 #endif
680 Ldoit040ami:
681 .long 0x4e7b0003
682 jra LdoneMMUenable
683
684 LdoitAmiga:
685
686 movel %a2@,%a1@
687 movel %a2@(4),%a1@(4)
688
689
690
691
692 lea %pc@(SYMBOL_NAME(_stext)-PAGESIZE:w),%a3
693
694
695 jmp %a1@
696
697 Lmapphysnotamiga:
698
699 cmpl #MACH_ATARI,%d4
700 bne Lmapphysnotatari
701
702 lea %pc@(SYMBOL_NAME(_stext)-PAGESIZE),%a0
703 tstl %a0
704 jeq Lnophys2
705
706
707
708
709
710
711 btst #BIT0460,%d6
712 jeq 1f
713
714
715
716
717
718
719 movel %a0,%d2
720 andl #0xff000000,%d2
721 orw #0xc040,%d2
722 .long 0x4e7b2004
723 .long 0x4e7b2006
724
725
726
727
728
729 jra Lnophys2
730
731
732
733
734 1:
735
736 moveq #1,%d5
737
738
739
740
741 movel %a0,%d2
742 andl #0xff000000,%d2
743 jeq 1f
744 orw #0x8143,%d2
745 lea %pc@(mmu),%a0
746 movel %d2,%a0@
747 pmove %a0@,%tt0
748 jra Lnophys2
749 1:
750
751
752
753
754 movel %a0,%d2
755 moveq #ROOT_INDEX_SHIFT,%d1
756 lsrl %d1,%d2
757 movel %a4@(%d2:l:4),%d0
758 andw #0xfff0,%d0
759 movel %d0,%a1
760 movel %a0,%d2
761 andl #0x01ffffff,%d2
762 moveq #(ROOT_INDEX_SHIFT-7),%d1
763 lsrl %d1,%d2
764 movel %a0,%d0
765 addql #PAGEDESC,%d0
766 movel %a1@(%d2:l:4),%a2
767 movel %d0,%a1@(%d2:l:4)
768
769 Lnophys2:
770
771
772
773 lea %pc@(SYMBOL_NAME(_stext)-PAGESIZE:w),%a3
774
775 btst #BIT0460,%d6
776 jne Latarimmu68040
777
778 moveq #'K',%d7
779 jbsr Lserial_putc
780
781 lea %pc@(mmu),%a0
782 movel #0x80000002,%a0@
783 movel %a4,%a0@(4)
784 pmove %a0@,%srp
785 pmove %a0@,%crp
786
787
788
789
790 movel #0x82c07760,%a0@
791 pmove %a0@,%tc
792
793
794 jmp LdoneMMUenable
795
796 Latarimmu68040:
797 moveq #'L',%d7
798 jbsr Lserial_putc
799
800 .word 0xf4d8
801 .word 0xf518
802 .long 0x4e7bc807
803 .long 0x4e7bc806
804 movel #(TC_ENABLE+TC_PAGE4K),%d0
805
806
807 .long 0x4e7b0003
808 jmp LdoneMMUenable
809
810
811 Lmapphysnotatari:
812
813
814 LdoneMMUenable:
815
816
817
818
819
820
821
822
823
824 addl #0x80000000,Lcustom
825
826
827 movel #0xff000000,Liobase
828
829 moveq #'M',%d7
830 jbsr Lserial_putc
831
832
833
834
835 movel SYMBOL_NAME(kpt),%d1
836 subl %a3,%d1
837 movel %d1,SYMBOL_NAME(kpt)
838
839
840
841
842
843 subl %a3,%a6
844
845
846 movel %a6,SYMBOL_NAME(kernel_pmd_table)
847 addl #PAGESIZE,%a6
848 movel %a6,SYMBOL_NAME(availmem)
849
850 moveq #'N',%d7
851 jbsr Lserial_putc
852
853
854
855
856
857 tstl %d5
858 jeq Lnoclean
859
860 btst #BIT0460,%d6
861 jne Loff040
862
863
864
865
866 cmpl #MACH_AMIGA,%d4
867 jeq Lclean030
868 cmpl #MACH_ATARI,%d4
869 jne Lnoclean
870
871 movel %a3,%d2
872 andl #0xff000000,%d2
873 jeq 1f
874
875 lea %pc@(mmu),%a0
876 clrl %a0@
877 pmove %a0@,%tt0
878 jra Lnoclean
879 1:
880 movel %a3,%d2
881 moveq #ROOT_INDEX_SHIFT,%d1
882 lsrl %d1,%d2
883 movel %a4@(%d2:l:4),%d0
884 andw #0xfff0,%d0
885 subl %a3,%d0
886 movel %d0,%a0
887 movel %a3,%d2
888 andl #0x01ffffff,%d2
889 moveq #(ROOT_INDEX_SHIFT-7),%d1
890 lsrl %d1,%d2
891 movel %a2,%a0@(%d2:l:4)
892 jra Lnoclean
893
894 Lclean030:
895 movel %a0,%d2
896 moveq #25,%d3
897 lsrl %d3,%d2
898 moveq #0,%d0
899 movel %d0,%a4@(%d2:l:4)
900
901 jra Lnoclean
902
903 Loff040:
904
905 moveq #0,%d0
906 .long 0x4e7b0004
907 .long 0x4e7b0006
908
909 Lnoclean:
910 moveq #'O',%d7
911 jbsr Lserial_putc
912
913
914
915
916
917 btst #BIT0460,%d6
918 jne Lcache680460
919
920 movel #0x00001919,%d0
921 movec %d0,%cacr
922 jra 1f
923
924 Lcache680460:
925 btst #BIT060,%d6
926 jne Lcache68060
927
928 .word 0xf4d8
929 movel #I_ENABLE+D_ENABLE,%d0
930
931 movec %d0,%cacr
932 jra 1f
933
934 Lcache68060:
935 .word 0xf4d8
936 movel #I_ENABLE+D_ENABLE+SB_ENABLE+PUSH_DPI+BC_ENABLE+BC_CLRA,%d0
937
938 movec %d0,%cacr
939
940 moveq #1,%d0
941 .long 0x4e7b0808
942
943 1:
944
945
946
947
948 lea SYMBOL_NAME(init_user_stack)+PAGESIZE,%sp
949
950
951
952 jbsr SYMBOL_NAME(start_kernel)
953
954 #if 0
955 tmp_fault_handler:
956 lea %pc@(tfh_1st_str),%a0
957 jbsr Lserial_puts
958 move.l %sp@(2),%d7
959 jbsr Lserial_putnum
960 move.w %sp@(0xa),%d7
961 swap %d7
962 move.w %sp@(0x6),%d7
963 jbsr Lserial_putnum
964 lea %pc@(tfh_2nd_str),%a0
965 jbsr Lserial_puts
966 move.l %sp@(0x10),%d7
967 jbsr Lserial_putnum
968 moveq #CR,%d7
969 jbsr Lserial_putc
970 moveq #LF,%d7
971 jbsr Lserial_putc
972 1: jra 1b
973
974 tfh_1st_str:
975 .byte CR
976 .byte LF
977 .ascii "Access fault occurred. PC = "
978 .byte 0
979
980 tfh_2nd_str:
981 .byte CR
982 .byte LF
983 .ascii "FaultAddress = "
984 .byte 0
985 #endif
986
987
988
989
990 LSERPER = 0xdff032
991 LSERDAT = 0xdff030
992 LSERDATR = 0xdff018
993 LNTSC_PERIOD = 371
994 LPAL_PERIOD = 368/2
995 LNTSC_ECLOCK = 7159090
996 LSERIAL_CNTRL = 0xbfd000
997 LSERIAL_DTR = 7
998
999
1000
1001
1002
1003
1004
1005
1006
1007 #define USE_MFP
1008
1009 #ifdef USE_PRINTER
1010
1011 LPSG_SELECT = 0xff8800
1012 LPSG_READ = 0xff8800
1013 LPSG_WRITE = 0xff8802
1014 LPSG_IO_A = 14
1015 LPSG_IO_B = 15
1016 LPSG_CONTROL = 7
1017 LSTMFP_GPIP = 0xfffa01
1018 LSTMFP_DDR = 0xfffa05
1019 LSTMFP_IERB = 0xfffa09
1020
1021 #elif defined(USE_SCC)
1022
1023 LSCC_CTRL_B = 0xff8c85
1024 LSCC_DATA_B = 0xff8c87
1025
1026
1027 scc_initable:
1028 .byte 9,12
1029 .byte 4,0x44
1030 .byte 3,0xc0
1031 .byte 5,0xe2
1032 .byte 9,0
1033 .byte 10,0
1034 .byte 11,0x50
1035 .byte 12,24,13,0
1036 .byte 14,2,14,3
1037 .byte 3,0xc1
1038 .byte 5,0xea
1039 .byte -1
1040 .even
1041
1042 #elif defined(USE_MFP)
1043
1044 LMFP_UCR = 0xfffa29
1045 LMFP_TDCDR = 0xfffa1d
1046 LMFP_TDDR = 0xfffa25
1047 LMFP_TSR = 0xfffa2d
1048 LMFP_UDR = 0xfffa2f
1049
1050 #endif
1051
1052
1053
1054
1055
1056
1057 .even
1058 Lserial_init:
1059 cmpil #MACH_AMIGA,%d4
1060 jne 1f
1061 bclr #LSERIAL_DTR,LSERIAL_CNTRL
1062 movew #LNTSC_PERIOD,LSERPER
1063 cmpl #LNTSC_ECLOCK,%a0@(BI_AMIGA_ECLK)
1064 jeq 9f
1065 movew #LPAL_PERIOD,LSERPER
1066 jra 9f
1067 1: cmpil #MACH_ATARI,%d4
1068 jne 9f
1069 #ifdef USE_PRINTER
1070 bclr #0,LSTMFP_IERB
1071 bclr #0,LSTMFP_DDR
1072 moveb #LPSG_CONTROL,LPSG_SELECT
1073 moveb #0xff,LPSG_WRITE
1074 moveb #LPSG_IO_B,LPSG_SELECT
1075 clrb LPSG_WRITE
1076 moveb #LPSG_IO_A,LPSG_SELECT
1077 moveb LPSG_READ,%d0
1078 bset #5,%d0
1079 moveb %d0,LPSG_WRITE
1080 #elif defined(USE_SCC)
1081 lea LSCC_CTRL_B,%a0
1082 lea %pc@(scc_initable:w),%a1
1083 2: moveb %a1@+,%d0
1084 jmi 3f
1085 moveb %d0,%a0@
1086 moveb %a1@+,%a0@
1087 jra 2b
1088 3: clrb %a0@
1089 #elif defined(USE_MFP)
1090 bclr #1,LMFP_TSR
1091 moveb #0x88,LMFP_UCR
1092 andb #0x70,LMFP_TDCDR
1093 moveb #2,LMFP_TDDR
1094 orb #1,LMFP_TDCDR
1095 bset #1,LMFP_TSR
1096 #endif
1097 9:
1098 rts
1099
1100
1101
1102
1103
1104 Lserial_putc:
1105 moveml %a0/%a1,%sp@-
1106 cmpil #MACH_AMIGA,%d4
1107 jne 2f
1108 andw #0x00ff,%d7
1109 oriw #0x0100,%d7
1110 movel %pc@(Lcustom),%a1
1111 movew %d7,%a1@(LSERDAT)
1112 1: movew %a1@(LSERDATR),%d7
1113 andw #0x2000,%d7
1114 jeq 1b
1115 jra 9f
1116 2: cmpil #MACH_ATARI,%d4
1117 jne 9f
1118 movel %pc@(Liobase),%a1
1119 #ifdef USE_PRINTER
1120 3: btst #0,%a1@(LSTMFP_GPIP)
1121 jne 3b
1122 moveb #LPSG_IO_B,%a1@(LPSG_SELECT)
1123 moveb %d7,%a1@(LPSG_WRITE)
1124 moveb #LPSG_IO_A,%a1@(LPSG_SELECT)
1125 moveb %a1@(LPSG_READ),%d7
1126 bclr #5,%d7
1127 moveb %d7,%a1@(LPSG_WRITE)
1128 nop
1129 nop
1130 bset #5,%d7
1131 moveb %d7,%a1@(LPSG_WRITE)
1132 #elif defined(USE_SCC)
1133 3: btst #2,%a1@(LSCC_CTRL_B)
1134 jeq 3b
1135 moveb %d7,%a1@(LSCC_DATA_B)
1136 #elif defined(USE_MFP)
1137 3: btst #7,%a1@(LMFP_TSR)
1138 jeq 3b
1139 moveb %d7,%a1@(LMFP_UDR)
1140 #endif
1141 9:
1142 moveml %sp@+,%a0/%a1
1143 rts
1144
1145
1146
1147
1148
1149 Lserial_puts:
1150 movel %d7,%sp@-
1151 1: moveb %a0@+,%d7
1152 jeq 2f
1153 jbsr Lserial_putc
1154 jra 1b
1155 2: movel %sp@+,%d7
1156 rts
1157
1158
1159
1160
1161
1162
1163
1164 Lserial_putnum:
1165 moveml %d0-%d2/%d7,%sp@-
1166 movel %d7,%d1
1167 moveq #4,%d0
1168 moveq #7,%d2
1169 L1: roll %d0,%d1
1170 moveb %d1,%d7
1171 andb #0x0f,%d7
1172 cmpb #0x0a,%d7
1173 bccs 1f
1174 addb #'0',%d7
1175 jra 2f
1176 1: addb #'A'-10,%d7
1177 2: jbsr Lserial_putc
1178 dbra %d2,L1
1179 moveq #32,%d7
1180 jbsr Lserial_putc
1181 moveml %sp@+,%d0-%d2/%d7
1182 rts
1183 #if 0
1184 .globl showtest
1185 showtest:
1186 moveml %a1/%d7,%sp@-
1187 moveq #'A',%d7
1188 jbsr Lserial_putc
1189 moveq #'=',%d7
1190 jbsr Lserial_putc
1191 movel %a0,%d7
1192 jbsr Lserial_putnum
1193
1194 ptestr #5,%a0@,#7,%a1
1195
1196 moveq #'D',%d7
1197 jbsr Lserial_putc
1198 moveq #'A',%d7
1199 jbsr Lserial_putc
1200 moveq #'=',%d7
1201 jbsr Lserial_putc
1202
1203 movel %a1,%d7
1204 jbsr Lserial_putnum
1205
1206 moveq #'D',%d7
1207 jbsr Lserial_putc
1208 moveq #'=',%d7
1209 jbsr Lserial_putc
1210 movel %a1@,%d7
1211 jbsr Lserial_putnum
1212
1213 moveq #'S',%d7
1214 jbsr Lserial_putc
1215 moveq #'=',%d7
1216 jbsr Lserial_putc
1217
1218 lea %pc@(mmu),%a1
1219 pmove %psr,%a1@
1220 clrl %d7
1221 movew %a1@,%d7
1222 jbsr Lserial_putnum
1223
1224 moveq #CR,%d7
1225 jbsr Lserial_putc
1226 moveq #LF,%d7
1227 jbsr Lserial_putc
1228
1229 moveml %sp@+,%a1/%d7
1230 rts
1231 #endif
1232
1233 #ifdef __ELF__
1234 .align 512
1235 #else
1236 .align 9
1237 #endif
1238
1239
1240
1241
1242 SYMBOL_NAME_LABEL(swapper_pg_dir)
1243 .skip ROOT_TABLE_SIZE * 4
1244 SYMBOL_NAME_LABEL(kernel_pg_dir)
1245 .skip ROOT_TABLE_SIZE * 4
1246
1247 .data
1248 .even
1249 Lcustom:
1250 .long 0
1251 Liobase:
1252 .long 0
1253 mmu: .quad 0
1254 SYMBOL_NAME_LABEL(kernel_pmd_table)
1255 .long 0
1256 SYMBOL_NAME_LABEL(kpt)
1257 .long 0
1258 SYMBOL_NAME_LABEL(availmem)
1259 .long 0
1260 SYMBOL_NAME_LABEL(is_medusa)
1261 .long 0
1262 SYMBOL_NAME_LABEL(m68k_pgtable_cachemode)
1263 .long 0