fixed a bug with LINK instruction not saving address register
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
#set disassemble-next-line on
|
#set disassemble-next-line on
|
||||||
define tr
|
define tr
|
||||||
!killall m68k-bdm-gdbserver
|
#!killall m68k-bdm-gdbserver
|
||||||
target remote | m68k-bdm-gdbserver pipe /dev/bdmcf3
|
target remote | m68k-bdm-gdbserver pipe /dev/bdmcf3
|
||||||
|
#target remote localhost:1234
|
||||||
#target remote | m68k-bdm-gdbserver pipe /dev/tblcf3
|
#target remote | m68k-bdm-gdbserver pipe /dev/tblcf3
|
||||||
#target dbug /dev/ttyS0
|
#target dbug /dev/ttyS0
|
||||||
#monitor bdm-reset
|
#monitor bdm-reset
|
||||||
|
|||||||
@@ -208,7 +208,7 @@
|
|||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
.altmacro
|
.altmacro
|
||||||
.macro irq vector,int_mask,clr_int
|
.macro irq vector,int_mask,clr_int
|
||||||
move.w #0x2700,sr // disable interrupt
|
//move.w #0x2700,sr // disable interrupt
|
||||||
subq.l #8,a7
|
subq.l #8,a7
|
||||||
movem.l d0/a5,(a7) // save registers
|
movem.l d0/a5,(a7) // save registers
|
||||||
|
|
||||||
@@ -237,18 +237,18 @@
|
|||||||
* If anybody knows of any better way on how to do this - please do!
|
* If anybody knows of any better way on how to do this - please do!
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
.macro mchar st,a,b,c,d,tgt
|
.macro mchar st,a,b,c,d,tgt
|
||||||
\st #\a << 24|\b<<16|\c<<8|\d,\tgt
|
\st #\a << 24|\b<<16|\c<<8|\d,\tgt
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.text
|
.text
|
||||||
_vec_init:
|
_vec_init:
|
||||||
move.l a2,-(sp) // Backup registers
|
move.l a2,-(sp) // Backup registers
|
||||||
|
|
||||||
mov3q.l #-1,_rt_mod // rt_mod auf super
|
mov3q.l #-1,_rt_mod // rt_mod auf super
|
||||||
clr.l _rt_ssp
|
clr.l _rt_ssp
|
||||||
clr.l _rt_usp
|
clr.l _rt_usp
|
||||||
clr.l _rt_vbr
|
clr.l _rt_vbr
|
||||||
move.l #__RAMBAR0,d0 // exception vectors reside in rambar0
|
move.l #__RAMBAR0,d0 // exception vectors reside in rambar0
|
||||||
movec d0,VBR
|
movec d0,VBR
|
||||||
move.l d0,a0
|
move.l d0,a0
|
||||||
@@ -326,7 +326,7 @@ init_vec_loop:
|
|||||||
*/
|
*/
|
||||||
vector_table_start:
|
vector_table_start:
|
||||||
std_exc_vec:
|
std_exc_vec:
|
||||||
move.w #0x2700,sr // disable interrupt
|
//move.w #0x2700,sr // disable interrupt
|
||||||
subq.l #8,a7
|
subq.l #8,a7
|
||||||
movem.l d0/a5,(sp) // save registers
|
movem.l d0/a5,(sp) // save registers
|
||||||
move.w 8(sp),d0 // fetch vector
|
move.w 8(sp),d0 // fetch vector
|
||||||
@@ -365,9 +365,9 @@ noprint:
|
|||||||
move.l 4(sp),a5 // restore a5
|
move.l 4(sp),a5 // restore a5
|
||||||
move.l d0,4(a7) // store exception routine address
|
move.l d0,4(a7) // store exception routine address
|
||||||
|
|
||||||
move.w 10(a7),d0 // restore original SR
|
//move.w 10(a7),d0 // restore original SR
|
||||||
bset #13,d0 // set supervisor bit
|
//bset #13,d0 // set supervisor bit
|
||||||
move.w d0,sr //
|
//move.w d0,sr //
|
||||||
move.l (a7)+,d0 // restore d0
|
move.l (a7)+,d0 // restore d0
|
||||||
rts // jump to exception routine
|
rts // jump to exception routine
|
||||||
|
|
||||||
@@ -409,15 +409,15 @@ access_mmu:
|
|||||||
cmp.l #__FASTRAM_END,d0 // above max User RAM area?
|
cmp.l #__FASTRAM_END,d0 // above max User RAM area?
|
||||||
bge bus_error // -> bus error
|
bge bus_error // -> bus error
|
||||||
|
|
||||||
lea -5*4(sp),sp // save gcc scratch registers
|
lea -3 * 4(sp),sp // save gcc scratch registers
|
||||||
movem.l d0-d1/a0-a2,(sp)
|
movem.l d1/a0-a1,(sp)
|
||||||
|
|
||||||
move.l d0,-(sp) // fault address
|
move.l d0,-(sp) // fault address
|
||||||
jsr _mmutr_miss // else we have an MMU TLB miss
|
jsr _mmutr_miss // else we have an MMU TLB miss
|
||||||
addq.l #4,sp
|
addq.l #4,sp
|
||||||
|
|
||||||
movem.l (sp),d0-d1/a0-a2 // restore gcc scratch registers
|
movem.l (sp),d1/a0-a1 // restore gcc scratch registers
|
||||||
lea 5*4(sp),sp
|
lea 3 * 4(sp),sp
|
||||||
|
|
||||||
move.l (sp)+,d0 // restore register
|
move.l (sp)+,d0 // restore register
|
||||||
|
|
||||||
@@ -555,33 +555,33 @@ irq6: // MFP interrupt from FPGA
|
|||||||
// screen adr change timed out?
|
// screen adr change timed out?
|
||||||
move.l _video_sbt,d0
|
move.l _video_sbt,d0
|
||||||
beq irq6_non_sca // nothing to do if 0
|
beq irq6_non_sca // nothing to do if 0
|
||||||
sub.l #0x70000000,d0 // substract 14 seconds
|
sub.l #0x70000000,d0 // substract 14 seconds
|
||||||
lea MCF_SLT0_SCNT,a5
|
lea MCF_SLT0_SCNT,a5
|
||||||
cmp.l (a5),d0 // time reached?
|
cmp.l (a5),d0 // time reached?
|
||||||
ble irq6_non_sca // not yet
|
ble irq6_non_sca // not yet
|
||||||
|
|
||||||
lea -28(a7),a7 // save more registers
|
lea -28(a7),a7 // save more registers
|
||||||
movem.l d0-d4/a0-a1,(a7) //
|
movem.l d0-d4/a0-a1,(a7) //
|
||||||
clr.l d3 // beginn mit 0
|
clr.l d3 // beginn mit 0
|
||||||
jsr _flush_and_invalidate_caches
|
jsr _flush_and_invalidate_caches
|
||||||
|
|
||||||
// eintrag suchen
|
// eintrag suchen
|
||||||
irq6_next_sca:
|
irq6_next_sca:
|
||||||
move.l d3,d0
|
move.l d3,d0
|
||||||
move.l d0,MCF_MMU_MMUAR // addresse
|
move.l d0,MCF_MMU_MMUAR // addresse
|
||||||
move.l #0x106,d4
|
move.l #0x106,d4
|
||||||
move.l d4,MCF_MMU_MMUOR // suchen ->
|
move.l d4,MCF_MMU_MMUOR // suchen ->
|
||||||
nop
|
nop
|
||||||
move.l MCF_MMU_MMUOR,d4
|
move.l MCF_MMU_MMUOR,d4
|
||||||
clr.w d4
|
clr.w d4
|
||||||
swap d4
|
swap d4
|
||||||
move.l d4,MCF_MMU_MMUAR
|
move.l d4,MCF_MMU_MMUAR
|
||||||
mvz.w #0x10e,d4
|
mvz.w #0x10e,d4
|
||||||
move.l d4,MCF_MMU_MMUOR // einträge holen aus mmu
|
move.l d4,MCF_MMU_MMUOR // einträge holen aus mmu
|
||||||
nop
|
nop
|
||||||
move.l MCF_MMU_MMUTR,d4 // ID holen
|
move.l MCF_MMU_MMUTR,d4 // ID holen
|
||||||
lsr.l #2,d4 // bit 9 bis 2
|
lsr.l #2,d4 // bit 9 bis 2
|
||||||
cmp.w #sca_page_ID,d4 // ist screen change ID?
|
cmp.w #sca_page_ID,d4 // ist screen change ID?
|
||||||
bne irq6_sca_pn // nein -> page keine screen area next
|
bne irq6_sca_pn // nein -> page keine screen area next
|
||||||
// eintrag <EFBFBD>ndern
|
// eintrag <EFBFBD>ndern
|
||||||
add.l #std_mmutr,d0
|
add.l #std_mmutr,d0
|
||||||
@@ -652,7 +652,7 @@ irq6_sca_pn:
|
|||||||
move.l d0,_video_tlb // anfangszustand wieder herstellen
|
move.l d0,_video_tlb // anfangszustand wieder herstellen
|
||||||
clr.l _video_sbt // zeit löschen
|
clr.l _video_sbt // zeit löschen
|
||||||
|
|
||||||
movem.l (sp),d0-d4/a0-a1 // restore registers
|
movem.l (sp),d0-d4/a0-a1 // restore registers
|
||||||
lea 7 * 4(sp),sp
|
lea 7 * 4(sp),sp
|
||||||
|
|
||||||
irq6_non_sca:
|
irq6_non_sca:
|
||||||
@@ -757,8 +757,8 @@ acsi_dma_rl:
|
|||||||
move.l (a5),(a1)+ // read 4 bytes
|
move.l (a5),(a1)+ // read 4 bytes
|
||||||
move.l (a5),(a1)+ // read 4 bytes
|
move.l (a5),(a1)+ // read 4 bytes
|
||||||
|
|
||||||
moveq #'.',d1
|
moveq #'.',d1
|
||||||
move.b d1,MCF_PSC0_PSCTB_8BIT
|
move.b d1,MCF_PSC0_PSCTB_8BIT
|
||||||
|
|
||||||
sub.l #16,d0 // byt counter -16
|
sub.l #16,d0 // byt counter -16
|
||||||
bpl acsi_dma_rl
|
bpl acsi_dma_rl
|
||||||
@@ -771,8 +771,8 @@ acsi_dma_wl:
|
|||||||
move.l (a1)+,(a5) // write 4 byts
|
move.l (a1)+,(a5) // write 4 byts
|
||||||
move.l (a1)+,(a5) // write 4 byts
|
move.l (a1)+,(a5) // write 4 byts
|
||||||
|
|
||||||
moveq #'.',d1
|
moveq #'.',d1
|
||||||
move.b d1,MCF_PSC0_PSCTB_8BIT
|
move.b d1,MCF_PSC0_PSCTB_8BIT
|
||||||
|
|
||||||
sub.l #16,d0 // byt counter -16
|
sub.l #16,d0 // byt counter -16
|
||||||
bpl acsi_dma_wl
|
bpl acsi_dma_wl
|
||||||
@@ -871,7 +871,7 @@ handler_gpt0:
|
|||||||
blt sca_other //
|
blt sca_other //
|
||||||
|
|
||||||
lea MCF_SLT0_SCNT,a0
|
lea MCF_SLT0_SCNT,a0
|
||||||
move.l (a0),_video_sbt // save time
|
move.l (a0),_video_sbt // save time
|
||||||
|
|
||||||
// FIXME: don't we need to get out here?
|
// FIXME: don't we need to get out here?
|
||||||
|
|
||||||
@@ -944,13 +944,13 @@ video_copy_data_loop:
|
|||||||
|
|
||||||
// eintrag suchen
|
// eintrag suchen
|
||||||
move.l d0,MCF_MMU_MMUAR // adress
|
move.l d0,MCF_MMU_MMUAR // adress
|
||||||
move.l #0x106,d4
|
move.l #0x106,d4
|
||||||
move.l d4,MCF_MMU_MMUOR // search -> new one will be offered if not found
|
move.l d4,MCF_MMU_MMUOR // search -> new one will be offered if not found
|
||||||
nop
|
nop
|
||||||
move.l MCF_MMU_MMUOR,d4
|
move.l MCF_MMU_MMUOR,d4
|
||||||
clr.w d4
|
clr.w d4
|
||||||
swap d4
|
swap d4
|
||||||
move.l d4,MCF_MMU_MMUAR
|
move.l d4,MCF_MMU_MMUAR
|
||||||
move.l d0,d1
|
move.l d0,d1
|
||||||
add.l #MCF_MMU_MMUTR_ID(sca_page_ID)|std_mmutr,d0
|
add.l #MCF_MMU_MMUTR_ID(sca_page_ID)|std_mmutr,d0
|
||||||
add.l #0x60000000|writethrough_mmudr|MCF_MMU_MMUDR_LK,d1
|
add.l #0x60000000|writethrough_mmudr|MCF_MMU_MMUDR_LK,d1
|
||||||
@@ -991,20 +991,22 @@ video_chg_end:
|
|||||||
* low-level interrupt service routine for routines registered with
|
* low-level interrupt service routine for routines registered with
|
||||||
* isr_register_handler()
|
* isr_register_handler()
|
||||||
*/
|
*/
|
||||||
.global _lowlevel_isr_handler
|
.global _lowlevel_isr_handler
|
||||||
.extern _isr_execute_handler
|
.extern _isr_execute_handler
|
||||||
|
|
||||||
_lowlevel_isr_handler:
|
_lowlevel_isr_handler:
|
||||||
move.w #0x2700,sr // disable interrupts
|
move.w #0x2700,sr
|
||||||
link a6,#-4*4 // make room for
|
lea -5 * 4(sp),sp // make room for
|
||||||
movem.l d0-d1/a0-a1,(sp) // gcc scratch registers and save them
|
movem.l d0-d1/a0-a2,(sp) // gcc scratch registers and save them,
|
||||||
|
// other registers will be handled by gcc itself
|
||||||
|
|
||||||
move.w 4(a6),d0 // fetch vector number from stack
|
move.w 5 * 4(sp),d0 // fetch vector number from stack
|
||||||
lsr.l #2,d0 // move it in place
|
lsr.l #2,d0 // move it in place
|
||||||
andi.l #0x000000ff,d0 // mask it out
|
andi.l #0x000000ff,d0 // mask it out
|
||||||
move.l d0,-(sp) // push it
|
move.l d0,-(sp) // push it
|
||||||
jsr _isr_execute_handler // call the C handler
|
jsr _isr_execute_handler // call the C handler
|
||||||
lea 4(sp),sp // adjust stack
|
addq.l #4,sp // adjust stack
|
||||||
movem.l (sp),d0-d1/a0-a1 // restore registers
|
|
||||||
unlk a6 // cleanup stack
|
movem.l (sp),d0-d1/a0-a2 // restore registers
|
||||||
|
lea 5 * 4(sp),sp
|
||||||
rte
|
rte
|
||||||
|
|||||||
Reference in New Issue
Block a user