Skip to content

Commit

Permalink
bootloader: fix compatibility with thumb DLDI drivers
Browse files Browse the repository at this point in the history
It cannot be assumed that a driver will always be compiled to ARM code.
Use bx instead of ldr pc.
  • Loading branch information
lifehackerhansol committed Nov 5, 2024
1 parent 257c7f6 commit 3eff604
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 48 deletions.
30 changes: 18 additions & 12 deletions settings/bootloader/source/io_dldi.s
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,26 @@ _io_dldi:
.word _DLDI_shutdown @

_DLDI_startup:
mov r12, #0x06000000
ldr pc, [r12, #0x68]
mov r12, #0x06000000
ldr r12, [r12, #0x68]
bx r12
_DLDI_isInserted:
mov r12, #0x06000000
ldr pc, [r12, #0x6C]
mov r12, #0x06000000
ldr r12, [r12, #0x6C]
bx r12
_DLDI_readSectors:
mov r12, #0x06000000
ldr pc, [r12, #0x70]
mov r12, #0x06000000
ldr r12, [r12, #0x70]
bx r12
_DLDI_writeSectors:
mov r12, #0x06000000
ldr pc, [r12, #0x74]
mov r12, #0x06000000
ldr r12, [r12, #0x74]
bx r12
_DLDI_clearStatus:
mov r12, #0x06000000
ldr pc, [r12, #0x78]
mov r12, #0x06000000
ldr r12, [r12, #0x78]
bx r12
_DLDI_shutdown:
mov r12, #0x06000000
ldr pc, [r12, #0x7C]
mov r12, #0x06000000
ldr r12, [r12, #0x7C]
bx r12
30 changes: 18 additions & 12 deletions title/bootloader/source/io_dldi.s
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,26 @@ _io_dldi:
.word _DLDI_shutdown @

_DLDI_startup:
mov r12, #0x06000000
ldr pc, [r12, #0x68]
mov r12, #0x06000000
ldr r12, [r12, #0x68]
bx r12
_DLDI_isInserted:
mov r12, #0x06000000
ldr pc, [r12, #0x6C]
mov r12, #0x06000000
ldr r12, [r12, #0x6C]
bx r12
_DLDI_readSectors:
mov r12, #0x06000000
ldr pc, [r12, #0x70]
mov r12, #0x06000000
ldr r12, [r12, #0x70]
bx r12
_DLDI_writeSectors:
mov r12, #0x06000000
ldr pc, [r12, #0x74]
mov r12, #0x06000000
ldr r12, [r12, #0x74]
bx r12
_DLDI_clearStatus:
mov r12, #0x06000000
ldr pc, [r12, #0x78]
mov r12, #0x06000000
ldr r12, [r12, #0x78]
bx r12
_DLDI_shutdown:
mov r12, #0x06000000
ldr pc, [r12, #0x7C]
mov r12, #0x06000000
ldr r12, [r12, #0x7C]
bx r12
30 changes: 18 additions & 12 deletions universal/bootloader_app/source/io_dldi.s
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,26 @@ _io_dldi:
.word _DLDI_shutdown @

_DLDI_startup:
mov r12, #0x06000000
ldr pc, [r12, #0x68]
mov r12, #0x06000000
ldr r12, [r12, #0x68]
bx r12
_DLDI_isInserted:
mov r12, #0x06000000
ldr pc, [r12, #0x6C]
mov r12, #0x06000000
ldr r12, [r12, #0x6C]
bx r12
_DLDI_readSectors:
mov r12, #0x06000000
ldr pc, [r12, #0x70]
mov r12, #0x06000000
ldr r12, [r12, #0x70]
bx r12
_DLDI_writeSectors:
mov r12, #0x06000000
ldr pc, [r12, #0x74]
mov r12, #0x06000000
ldr r12, [r12, #0x74]
bx r12
_DLDI_clearStatus:
mov r12, #0x06000000
ldr pc, [r12, #0x78]
mov r12, #0x06000000
ldr r12, [r12, #0x78]
bx r12
_DLDI_shutdown:
mov r12, #0x06000000
ldr pc, [r12, #0x7C]
mov r12, #0x06000000
ldr r12, [r12, #0x7C]
bx r12
30 changes: 18 additions & 12 deletions universal/bootloader_menu/source/io_dldi.s
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,26 @@ _io_dldi:
.word _DLDI_shutdown @

_DLDI_startup:
mov r12, #0x06000000
ldr pc, [r12, #0x68]
mov r12, #0x06000000
ldr r12, [r12, #0x68]
bx r12
_DLDI_isInserted:
mov r12, #0x06000000
ldr pc, [r12, #0x6C]
mov r12, #0x06000000
ldr r12, [r12, #0x6C]
bx r12
_DLDI_readSectors:
mov r12, #0x06000000
ldr pc, [r12, #0x70]
mov r12, #0x06000000
ldr r12, [r12, #0x70]
bx r12
_DLDI_writeSectors:
mov r12, #0x06000000
ldr pc, [r12, #0x74]
mov r12, #0x06000000
ldr r12, [r12, #0x74]
bx r12
_DLDI_clearStatus:
mov r12, #0x06000000
ldr pc, [r12, #0x78]
mov r12, #0x06000000
ldr r12, [r12, #0x78]
bx r12
_DLDI_shutdown:
mov r12, #0x06000000
ldr pc, [r12, #0x7C]
mov r12, #0x06000000
ldr r12, [r12, #0x7C]
bx r12

0 comments on commit 3eff604

Please sign in to comment.