diff --git a/kernel/cards.68k b/kernel/cards.68k index ae2e3a4..a71d413 100644 --- a/kernel/cards.68k +++ b/kernel/cards.68k @@ -2,6 +2,7 @@ | Finds the first card with the type in d0.b, and returns it's IO base address in a0, or 0 if not found | Clobbers d1 +| Warning to developers: This function must only use PC-relative addressing as it is called from early boot before the kernel is properly mapped. find_first_card: move.l #0xff0000, a0 | a0 holds the address of the current card ffc_loop: diff --git a/kernel/start.68k b/kernel/start.68k index b34c668..db137ee 100644 --- a/kernel/start.68k +++ b/kernel/start.68k @@ -5,7 +5,7 @@ _start: move.l d0, d2 | Move the number of program headers to d2 move.l a0, a1 | Move the program headaer pointer to a1 move.b #0x5, d0 | Get the pointer to the MMU card -bsr.w find_first_card_early +jsr (find_first_card - 0xC00000) cmpa.l #0, a0 | Abort if there is no MMU card beq.w no_mmu subq.w #0x1, d2 | Adjust the number of program headers for dbra @@ -59,23 +59,6 @@ jmp (higher_bridge - 0xC00000) | Jump to the lower-half equivalent of the bridgi no_mmu: stop #2700 | If there was no MMU card, halt the CPU -| Finds the first card with the type in d0.b, and returns it's IO base address in a0, or 0 if not found -| Clobbers d1 -find_first_card_early: - move.l #0xff0000, a0 | a0 holds the address of the current card -ffc_early_loop: - lea (0x100, a0), a0 | Move to the next card - move.b (0xff, a0), d1 | Load the type of the card into d1 - beq.b ffc_early_notfound | If the type is 0 (empty slot), we have scanned all cards, so exit the loop - cmp.b d0, d1 | If the card is the type we want, return with the address in a0 - beq.b ffc_early_done - bra.b ffc_early_loop | Loop back and check the next card -ffc_early_notfound: -move.l #0x0, a0 -ffc_early_done: - rts - - .text higher_bridge: move.w #1, (0x14, a0) | Enable the MMU