Commit bde08062 authored by Steve Revill's avatar Steve Revill
Browse files

Optimisation of SWI stuff.

  Changed wacky immediate format.
Detail:
  SWI number stuff now uses an internal routine rather than a call
  to SWI OS_ConvertHex...

  When someone disassembles a wacky immediate, it is represented as
  "<OP> Rd,Rn,#&xx,x" rather than the non-standard
  "<OP> Rd,Rn,#&xx,ROR #x" format. This can then be assembled and
  conforms to ARM's standards.
Admin:
  Tested on RiscPC

  My editor blew-up in the middle of srccommit on Debugger-1_69 so
  don't use that version!

Version 1.70. Tagged as 'Debugger-1_70'
parent 1a5cd5a5
......@@ -11,14 +11,14 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.69"
Module_Version SETA 169
Module_MajorVersion SETS "1.70"
Module_Version SETA 170
Module_MinorVersion SETS ""
Module_Date SETS "21 Mar 2001"
Module_ApplicationDate2 SETS "21-Mar-01"
Module_ApplicationDate4 SETS "21-Mar-2001"
Module_ComponentName SETS "Debugger"
Module_ComponentPath SETS "RiscOS/Sources/Programmer/Debugger"
Module_FullVersion SETS "1.69"
Module_HelpVersion SETS "1.69 (21 Mar 2001)"
Module_FullVersion SETS "1.70"
Module_HelpVersion SETS "1.70 (21 Mar 2001)"
END
/* (1.69)
/* (1.70)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 1.69
#define Module_MajorVersion_CMHG 1.70
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 21 Mar 2001
#define Module_MajorVersion "1.69"
#define Module_Version 169
#define Module_MajorVersion "1.70"
#define Module_Version 170
#define Module_MinorVersion ""
#define Module_Date "21 Mar 2001"
......@@ -18,5 +18,5 @@
#define Module_ComponentName "Debugger"
#define Module_ComponentPath "RiscOS/Sources/Programmer/Debugger"
#define Module_FullVersion "1.69"
#define Module_HelpVersion "1.69 (21 Mar 2001)"
#define Module_FullVersion "1.70"
#define Module_HelpVersion "1.70 (21 Mar 2001)"
......@@ -849,8 +849,8 @@ Swi LDR R10, Mistake
BIC r0, r4, #&FF000000 ; Mask out SWI<cc>
SWI XOS_SWINumberToString ; This may give error (eg. Buffer over)
BVS InstructionEnd
MOV R3, #24
BL unknown_swis
not_thumb_swi
ADD r0, r1, r2
B InstructionEnd
......@@ -861,72 +861,65 @@ not_thumb_swi
; R0 - SWI number
; R1 - pointer to string
; R2 - offset to last char of string
; R3 - number of bits to print in SWI number
; Exit...
; R0 - corrupted
; R1 - preserved
; R2 - pointer to last char of string (may be different)
; R2 - offset to last char of string (may be different)
; R3 - preserved
; R8 - corrupted
;
unknown_swis
Push "R3, R12, LR"
Entry
; Ensure all bytes after the SWI name string up to the next word boundary are zero
BIC R12, R14, #&FC000003 ; This is 32-bit safe
MOV R14, #0
ADD R3, R1, R2
ADD R8, R1, R2
unk_swi_align
TST R3, #2_11
STRNEB R14, [R3], #1
TST R8, #2_11
STRNEB R14, [R8], #1
BNE unk_swi_align
; Compare this SWI name string against some pre-defined unknown SWI name strings
ADR R3, str_user
ADR R8, str_user
BL strcmp
ADRNE R8, str_xuser
BLNE strcmp
ADRNE R8, str_os_undefined
BLNE strcmp
ADRNE R8, str_xos_undefined
BLNE strcmp
BEQ unk_swi_replace
ADR R3, str_xuser
BL strcmp
BEQ unk_swi_replace
ADR R3, str_os_undefined
BL strcmp
BEQ unk_swi_replace
ADR R3, str_xos_undefined
BL strcmp
BEQ unk_swi_replace
SUB R2,R2,#1 ; Adjust to avoid taking the zero byte
Pull "R3, R12, PC"
SUB R2,R2,#1 ; Adjust to avoid taking the zero byte
EXIT
; Replace the SWI name string with the SWI number decoded as hexadecimal
unk_swi_replace
MOV R2, #ampersand
STRB R2, [R1], #1
MOV R2, #12
ADR R14, not_thumb_swi
BIC R14, R14, #&FC000003 ; This is 32-bit safe
TEQ R12, R14
SWIEQ XOS_ConvertHex6 ; If called from non-Thumb mode, do a 6 char hex number
SWINE XOS_ConvertHex2 ; If called from Thumb mode, do a 2 char hex number
SUB R2, R1, R0
SUB R1, R0, #1
ADD R2, R2, #1
Pull "R3, R12, PC"
MOV R8, R0
MOV R0, R1
SUB R2, R3, #4
BL StoreHex
SUB R2, R0, R1 ; Convert end pointer back to offset
EXIT
; Compare two word-aligned strings. They *must* be padded with zero or more null bytes after
; the terminator (which must also be null) up to the word boundary.
;
; Entry...
; R1 - pointer to first string
; R3 - pointer to second string
; R8 - pointer to second string
; Exit...
; R1 - preserved
; R3 - corrupted
; R8 - corrupted
; flags - EQ=match, NE=don't match
strcmp
Push "R0, R1, LR"
Entry "R0, R1"
strcmp_loop
LDR R0, [R1], #4
LDR R14, [R3], #4
LDR R14, [R8], #4
TEQ R0, R14
BNE strcmp_exit ; Conditional Pull is bad on newer ARMs, branch instead
TST R0, #&FF000000
BNE strcmp_loop
strcmp_exit
Pull "R0, R1, PC"
EXIT
; Some SWI names indicating that a SWI number was not recognised (in length order)
str_user
......@@ -2655,16 +2648,10 @@ msg8 = "M52",0 ; CP15,C8 : ARMv4 TLB Operations
WackyShift
AND r8, r4, #&FF ; Get unrotated byte back
TEQS r8, #0 ; 0,n prettified
AddChar "0",EQ
MOVNE r2, #8-4 ; Display unrotated byte,decimal rotate
BLNE StoreHex
;1.26 - Change layout to #0, ROR #nn
AddStr ShiftROR
MOV r2, #8-4 ; Display unrotated byte,decimal rotate
BL StoreHex
AddChar "#"
AddChar ","
MOV r8, r4, LSR #7 ; Extract shift part again
AND r8, r8, #30
......@@ -2723,7 +2710,6 @@ ShiftTypes
DCB ",LSL ", 0 ; 00x
DCB ",LSR ", 0 ; 01x
DCB ",ASR ", 0 ; 02x
ShiftROR ;used for wacky zero shifts
DCB ",ROR ", 0 ; 03x
ALIGN
......
......@@ -267,6 +267,7 @@ ThumbSWI
AND R0,R4,#&FF
SWI XOS_SWINumberToString
BVS ThumbInstEnd
MOV R3,#8
BL unknown_swis
ADD R0,R1,R2
B ThumbInstEnd
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment