Commit ebcdb861 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Add ROM patches for the ADFS "disc error 20" fix

Detail:
  This set of changes adds a "disc error 20" fix to ADFS for RISC OS 3.50 thru 4.02, using similar code to that used for the fix that was applied to ADFS itself (in ADFS 3.54). This is to resolve issues with modern IDE devices which don't adhere to the DRQ timeout that old versions of the ATA spec mandated.
  File changes (all within Source/ROMPatch):
  - patches/s/ADFS354 - Generic assembler source for the disc error 20 fix
  - ihf2c/c/ihf2c - Source for a C utility that was used to help produce the ROM patch data
  - patches/adfs354,feb - Utility script for building the different versions of the ADFS patch and converting to ROMPatch form
  - patches/350/h/ADFSpatch, patches/360/h/ADFSpatch, patches/370/h/ADFSpatch, patches/371/h/ADFSpatch, patches/402/h/ADFSpatch - Added/updated ADFS patches
  - patches/350/h/patch, patches/371/h/patch, patches/402/h/patch - Include new ADFSpatch files where relevant
  - UK/h/messages - Update ROMPatch version numbers
  - c/rompatch, s/module - Add a word of writable workspace to the module which the ADFS patch can use
  - patches/402/h/CDSFTpatch - Remove duplicate patch (duplicate of RESLVpatch)
  - patches/402/h/MSGSpatch - Document the patches
  - ReadMe, Install/ROMPatch/!RunImage,ff8 - Remove redundant/outdated files (the main Boot makefile will build and install ROMPatch for us)
Admin:
  Tested on a RISC OS 3.70 StrongARM RiscPC with a CF-IDE adapter, disc error 20 is no more
  3.50/3.60/3.70/3.71/4.02 also tested under RPCEmu, manually provoking the different code paths to check hook points are correct


Version 1.26. Tagged as 'Boot-1_26'
parent 5af9987e
File deleted
New version of ROMPatch, introduced to patch 3.70,
and added to source tree for 3.71.
*** There is no proper make install - if changed, the ***
*** new !!ROMPatch obey file and ROMPatch directory ***
*** (from Install directory) should be placed in: ***
*** ***
*** Sources.SystemRes.Boot.RO360Hook.Boot.PreDesk ***
[ This release of ROMPatches also supports patching 3.60.
To achieve this, the !!ROMPatch obey file and the ROMPatch
directory should be in !Boot.Choices.Boot.Tasks in the
3.6 !Boot. ]
......@@ -15,11 +15,11 @@
/* UK/messages.h */
#define M_name350 "ROM patches 3.50/2"
#define M_name360 "ROM patches 3.60/2"
#define M_name370 "ROM patches 3.70/3"
#define M_name371 "ROM patches 3.71/1"
#define M_name402 "ROM patches 4.02/5"
#define M_name350 "ROM patches 3.50/3"
#define M_name360 "ROM patches 3.60/3"
#define M_name370 "ROM patches 3.70/4"
#define M_name371 "ROM patches 3.71/2"
#define M_name402 "ROM patches 4.02/6"
#define E_ROMunknown "No patches for this ROM\n"
#define E_malloc "Not enough memory (malloc)\n"
......
......@@ -46,7 +46,7 @@
#include "UK/messages.h"
/* implemented in assembler */
extern uint32 module,moduleend,myflush;
extern uint32 module,moduleend,myflush,adfs354_word;
extern uint32 modDAhandler,moddata;
extern uint32 svcarmid(void);
extern void svccopy(uint32 *src, uint32 *dest, int bytes);
......@@ -57,6 +57,9 @@ extern void svcsetROML1PT(uint32 *L1PTaddr, uint32 *L1PTvals, int count, void
/* currently considered ROM size in bytes */
uint32 ROMsize;
/* Patched up once module inserted */
uint32 adfs354_word_addr = 0;
/* ROMs and their patches */
#include "patches/patch.h"
......@@ -578,6 +581,7 @@ int main(int argc, char *argv[])
/* insert module first, since DAhandler code there */
RMAaddr = insert_ROMPatches_module();
DAhandler_addr = (uint32)(&modDAhandler) - (uint32)(&module) + RMAaddr;
adfs354_word_addr = (uint32)(&adfs354_word) - (uint32)(&module) + RMAaddr;
/* 1 extra page required for L2PT entries */
patchDAsize = (Npatchpages + 1) << 12;
......
/* Copyright 2018 Castle Technology Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* convert IHF file to style required for ROM patch
only copes with IHF files containing single segments! */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
if (argc != 3)
{
fprintf(stderr,"usage: ihf2c <infile> <outfile>\n");
exit(1);
}
FILE *in = fopen(argv[1],"r");
FILE *out = fopen(argv[2],"w");
if ((in == NULL) || (out == NULL))
{
fprintf(stderr,"failed to open file(s)\n");
exit(1);
}
char buf[1024];
unsigned long base = 0;
while(fgets(buf,1024,in))
{
if (strstr(buf," segment based at "))
{
base = strtoul(buf+strlen(buf)-10,NULL,16);
}
if ((buf[0] == ':') && (strlen(buf) > 13))
{
char *c = buf+12;
if (!base)
{
fprintf(stderr,"base not set\n");
exit(1);
}
while (strlen(c) > 8)
{
fprintf(out," {(uint32 *)0x%08x, 0xffffffff, 0x%.8s},\n",base,c);
base += 4;
c += 8;
}
}
}
fclose(in);
fclose(out);
}
/* Copyright 2018 Castle Technology Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* patches/350/ADFSpatch.h */
static patchentry_t *ADFSpatches350_proc(void *handle)
{
static patchentry_t ADFSpatches350[] =
{
/* addr old new */
/* Disc error 20 hook */
{(uint32 *)0x038FC528, 0x03A00020, 0x0A03FEB4},
{(uint32 *)0x038FC52C, 0x08BD437E, 0xE1A00000},
{(uint32 *)0x038FC530, 0x039EF201, 0xE1A00000},
/* Disc error 20 patch */
{(uint32 *)0x039fc000, 0xffffffff, 0xE3A0E302},
{(uint32 *)0x039fc004, 0xffffffff, 0xE11E000F},
{(uint32 *)0x039fc008, 0xffffffff, 0x013EF00F},
{(uint32 *)0x039fc00c, 0xffffffff, 0x13A0E000},
{(uint32 *)0x039fc010, 0xffffffff, 0xE59C120C},
{(uint32 *)0x039fc014, 0xffffffff, 0xE59F2098},
{(uint32 *)0x039fc018, 0xffffffff, 0xE5821000},
{(uint32 *)0x039fc01c, 0xffffffff, 0xE3A01001},
{(uint32 *)0x039fc020, 0xffffffff, 0xE58C120C},
{(uint32 *)0x039fc024, 0xffffffff, 0xE28F1008},
{(uint32 *)0x039fc028, 0xffffffff, 0xE58C1210},
{(uint32 *)0x039fc02c, 0xffffffff, 0xE13EF00F},
{(uint32 *)0x039fc030, 0xffffffff, 0xE8BD837E},
{(uint32 *)0x039fc034, 0xffffffff, 0xE92D4001},
{(uint32 *)0x039fc038, 0xffffffff, 0xE1A0000F},
{(uint32 *)0x039fc03c, 0xffffffff, 0xE33FF3C2},
{(uint32 *)0x039fc040, 0xffffffff, 0xE1A00000},
{(uint32 *)0x039fc044, 0xffffffff, 0xE92D49FF},
{(uint32 *)0x039fc048, 0xffffffff, 0xE59CB214},
{(uint32 *)0x039fc04c, 0xffffffff, 0xE59F3060},
{(uint32 *)0x039fc050, 0xffffffff, 0xE5932000},
{(uint32 *)0x039fc054, 0xffffffff, 0xE2522001},
{(uint32 *)0x039fc058, 0xffffffff, 0x0A00000F},
{(uint32 *)0x039fc05c, 0xffffffff, 0xE5DB0818},
{(uint32 *)0x039fc060, 0xffffffff, 0xE3100008},
{(uint32 *)0x039fc064, 0xffffffff, 0x05832000},
{(uint32 *)0x039fc068, 0xffffffff, 0x03A02001},
{(uint32 *)0x039fc06c, 0xffffffff, 0x0A000005},
{(uint32 *)0x039fc070, 0xffffffff, 0xE59C11FC},
{(uint32 *)0x039fc074, 0xffffffff, 0xE59C01DC},
{(uint32 *)0x039fc078, 0xffffffff, 0xE1A0E00F},
{(uint32 *)0x039fc07c, 0xffffffff, 0xE59CF22C},
{(uint32 *)0x039fc080, 0xffffffff, 0xE59F2028},
{(uint32 *)0x039fc084, 0xffffffff, 0xE58C2210},
{(uint32 *)0x039fc088, 0xffffffff, 0xE58C220C},
{(uint32 *)0x039fc08c, 0xffffffff, 0xE8BD49FF},
{(uint32 *)0x039fc090, 0xffffffff, 0xE13FF000},
{(uint32 *)0x039fc094, 0xffffffff, 0xE1A00000},
{(uint32 *)0x039fc098, 0xffffffff, 0xE8FD8001},
{(uint32 *)0x039fc09c, 0xffffffff, 0xE3A00020},
{(uint32 *)0x039fc0a0, 0xffffffff, 0xE59C21D0},
{(uint32 *)0x039fc0a4, 0xffffffff, 0xE59C31E8},
{(uint32 *)0x039fc0a8, 0xffffffff, 0xE5DC71BC},
{(uint32 *)0x039fc0ac, 0xffffffff, 0xEAFC018D},
{(uint32 *)0x039fc0b0, 0xffffffff, 0x038FC744},
{(uint32 *)0x039fc0b4, 0xffffffff, 0x00000000}, /* Patched with adfs354_word_addr below */
{(uint32 *)0,0,0}
};
ADFSpatches350[(sizeof(ADFSpatches350)/sizeof(patchentry_t))-2].newval = adfs354_word_addr;
return ADFSpatches350;
}
......@@ -25,6 +25,7 @@
#include "patches/350/IICMpatch.h"
#include "patches/350/FCREpatch.h"
#include "patches/350/COLPpatch.h"
#include "patches/350/ADFSpatch.h"
static patchlist_proc patchlist350[] =
{
......@@ -35,6 +36,7 @@ static patchlist_proc patchlist350[] =
IICMpatches350_proc,
FCREpatches350_proc,
COLPpatches350_proc,
ADFSpatches350_proc,
NULL
};
......
......@@ -22,11 +22,67 @@ static patchentry_t *ADFSpatches360_proc(void *handle)
{
/* addr old new */
/* ADFSBuffers */
{(uint32 *)0x03934440, 0xE3540502, 0xE3540501},
{(uint32 *)0x03934444, 0x23E04000, 0x23E04102},
/* Disc error 20 hook */
{(uint32 *)0x039345C0, 0x03A00020, 0x0A08B28E},
{(uint32 *)0x039345C4, 0x08BD437E, 0xE1A00000},
{(uint32 *)0x039345C8, 0x039EF201, 0xE1A00000},
/* Disc error 20 patch */
{(uint32 *)0x03b61000, 0xffffffff, 0xE3A0E302},
{(uint32 *)0x03b61004, 0xffffffff, 0xE11E000F},
{(uint32 *)0x03b61008, 0xffffffff, 0x013EF00F},
{(uint32 *)0x03b6100c, 0xffffffff, 0x13A0E000},
{(uint32 *)0x03b61010, 0xffffffff, 0xE59C1220},
{(uint32 *)0x03b61014, 0xffffffff, 0xE59F2098},
{(uint32 *)0x03b61018, 0xffffffff, 0xE5821000},
{(uint32 *)0x03b6101c, 0xffffffff, 0xE3A01001},
{(uint32 *)0x03b61020, 0xffffffff, 0xE58C1220},
{(uint32 *)0x03b61024, 0xffffffff, 0xE28F1008},
{(uint32 *)0x03b61028, 0xffffffff, 0xE58C1224},
{(uint32 *)0x03b6102c, 0xffffffff, 0xE13EF00F},
{(uint32 *)0x03b61030, 0xffffffff, 0xE8BD837E},
{(uint32 *)0x03b61034, 0xffffffff, 0xE92D4001},
{(uint32 *)0x03b61038, 0xffffffff, 0xE1A0000F},
{(uint32 *)0x03b6103c, 0xffffffff, 0xE33FF3C2},
{(uint32 *)0x03b61040, 0xffffffff, 0xE1A00000},
{(uint32 *)0x03b61044, 0xffffffff, 0xE92D49FF},
{(uint32 *)0x03b61048, 0xffffffff, 0xE59CB228},
{(uint32 *)0x03b6104c, 0xffffffff, 0xE59F3060},
{(uint32 *)0x03b61050, 0xffffffff, 0xE5932000},
{(uint32 *)0x03b61054, 0xffffffff, 0xE2522001},
{(uint32 *)0x03b61058, 0xffffffff, 0x0A00000F},
{(uint32 *)0x03b6105c, 0xffffffff, 0xE5DB0818},
{(uint32 *)0x03b61060, 0xffffffff, 0xE3100008},
{(uint32 *)0x03b61064, 0xffffffff, 0x05832000},
{(uint32 *)0x03b61068, 0xffffffff, 0x03A02001},
{(uint32 *)0x03b6106c, 0xffffffff, 0x0A000005},
{(uint32 *)0x03b61070, 0xffffffff, 0xE59C1208},
{(uint32 *)0x03b61074, 0xffffffff, 0xE59C01E8},
{(uint32 *)0x03b61078, 0xffffffff, 0xE1A0E00F},
{(uint32 *)0x03b6107c, 0xffffffff, 0xE59CF240},
{(uint32 *)0x03b61080, 0xffffffff, 0xE59F2028},
{(uint32 *)0x03b61084, 0xffffffff, 0xE58C2224},
{(uint32 *)0x03b61088, 0xffffffff, 0xE58C2220},
{(uint32 *)0x03b6108c, 0xffffffff, 0xE8BD49FF},
{(uint32 *)0x03b61090, 0xffffffff, 0xE13FF000},
{(uint32 *)0x03b61094, 0xffffffff, 0xE1A00000},
{(uint32 *)0x03b61098, 0xffffffff, 0xE8FD8001},
{(uint32 *)0x03b6109c, 0xffffffff, 0xE3A00020},
{(uint32 *)0x03b610a0, 0xffffffff, 0xE59C21D4},
{(uint32 *)0x03b610a4, 0xffffffff, 0xE59C31F4},
{(uint32 *)0x03b610a8, 0xffffffff, 0xE5DC71BC},
{(uint32 *)0x03b610ac, 0xffffffff, 0xEAF74DBA},
{(uint32 *)0x03b610b0, 0xffffffff, 0x03934818},
{(uint32 *)0x03b610b4, 0xffffffff, 0x00000000}, /* Patched with adfs354_word_addr below */
{(uint32 *)0,0,0}
};
ADFSpatches360[(sizeof(ADFSpatches360)/sizeof(patchentry_t))-2].newval = adfs354_word_addr;
return ADFSpatches360;
}
......@@ -22,11 +22,67 @@ static patchentry_t *ADFSpatches370_proc(void *handle)
{
/* addr old new */
/* ADFSBuffers */
{(uint32 *)0x0394B940, 0xE3540502, 0xE3540501},
{(uint32 *)0x0394B944, 0x23E04000, 0x23E04102},
/* Disc error 20 hook */
{(uint32 *)0x0394BAC0, 0x03A00020, 0x0A09694E},
{(uint32 *)0x0394BAC4, 0x08BD437E, 0xE1A00000},
{(uint32 *)0x0394BAC8, 0x039EF201, 0xE1A00000},
/* Disc error 20 patch */
{(uint32 *)0x03ba6000, 0xffffffff, 0xE3A0E302},
{(uint32 *)0x03ba6004, 0xffffffff, 0xE11E000F},
{(uint32 *)0x03ba6008, 0xffffffff, 0x013EF00F},
{(uint32 *)0x03ba600c, 0xffffffff, 0x13A0E000},
{(uint32 *)0x03ba6010, 0xffffffff, 0xE59C1220},
{(uint32 *)0x03ba6014, 0xffffffff, 0xE59F2098},
{(uint32 *)0x03ba6018, 0xffffffff, 0xE5821000},
{(uint32 *)0x03ba601c, 0xffffffff, 0xE3A01001},
{(uint32 *)0x03ba6020, 0xffffffff, 0xE58C1220},
{(uint32 *)0x03ba6024, 0xffffffff, 0xE28F1008},
{(uint32 *)0x03ba6028, 0xffffffff, 0xE58C1224},
{(uint32 *)0x03ba602c, 0xffffffff, 0xE13EF00F},
{(uint32 *)0x03ba6030, 0xffffffff, 0xE8BD837E},
{(uint32 *)0x03ba6034, 0xffffffff, 0xE92D4001},
{(uint32 *)0x03ba6038, 0xffffffff, 0xE1A0000F},
{(uint32 *)0x03ba603c, 0xffffffff, 0xE33FF3C2},
{(uint32 *)0x03ba6040, 0xffffffff, 0xE1A00000},
{(uint32 *)0x03ba6044, 0xffffffff, 0xE92D49FF},
{(uint32 *)0x03ba6048, 0xffffffff, 0xE59CB228},
{(uint32 *)0x03ba604c, 0xffffffff, 0xE59F3060},
{(uint32 *)0x03ba6050, 0xffffffff, 0xE5932000},
{(uint32 *)0x03ba6054, 0xffffffff, 0xE2522001},
{(uint32 *)0x03ba6058, 0xffffffff, 0x0A00000F},
{(uint32 *)0x03ba605c, 0xffffffff, 0xE5DB0818},
{(uint32 *)0x03ba6060, 0xffffffff, 0xE3100008},
{(uint32 *)0x03ba6064, 0xffffffff, 0x05832000},
{(uint32 *)0x03ba6068, 0xffffffff, 0x03A02001},
{(uint32 *)0x03ba606c, 0xffffffff, 0x0A000005},
{(uint32 *)0x03ba6070, 0xffffffff, 0xE59C1208},
{(uint32 *)0x03ba6074, 0xffffffff, 0xE59C01E8},
{(uint32 *)0x03ba6078, 0xffffffff, 0xE1A0E00F},
{(uint32 *)0x03ba607c, 0xffffffff, 0xE59CF240},
{(uint32 *)0x03ba6080, 0xffffffff, 0xE59F2028},
{(uint32 *)0x03ba6084, 0xffffffff, 0xE58C2224},
{(uint32 *)0x03ba6088, 0xffffffff, 0xE58C2220},
{(uint32 *)0x03ba608c, 0xffffffff, 0xE8BD49FF},
{(uint32 *)0x03ba6090, 0xffffffff, 0xE13FF000},
{(uint32 *)0x03ba6094, 0xffffffff, 0xE1A00000},
{(uint32 *)0x03ba6098, 0xffffffff, 0xE8FD8001},
{(uint32 *)0x03ba609c, 0xffffffff, 0xE3A00020},
{(uint32 *)0x03ba60a0, 0xffffffff, 0xE59C21D4},
{(uint32 *)0x03ba60a4, 0xffffffff, 0xE59C31F4},
{(uint32 *)0x03ba60a8, 0xffffffff, 0xE5DC71BC},
{(uint32 *)0x03ba60ac, 0xffffffff, 0xEAF696FA},
{(uint32 *)0x03ba60b0, 0xffffffff, 0x0394BD18},
{(uint32 *)0x03ba60b4, 0xffffffff, 0x00000000}, /* Patched with adfs354_word_addr below */
{(uint32 *)0,0,0}
};
ADFSpatches370[(sizeof(ADFSpatches370)/sizeof(patchentry_t))-2].newval = adfs354_word_addr;
return ADFSpatches370;
}
/* Copyright 2018 Castle Technology Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* patches/371/ADFSpatch.h */
static patchentry_t *ADFSpatches371_proc(void *handle)
{
static patchentry_t ADFSpatches371[] =
{
/* addr old new */
/* Disc error 20 hook */
{(uint32 *)0x0394F510, 0x03A00020, 0x0A0966BA},
{(uint32 *)0x0394F514, 0x08BD437E, 0xE1A00000},
{(uint32 *)0x0394F518, 0x039EF201, 0xE1A00000},
/* Disc error 20 patch */
{(uint32 *)0x03ba9000, 0xffffffff, 0xE3A0E302},
{(uint32 *)0x03ba9004, 0xffffffff, 0xE11E000F},
{(uint32 *)0x03ba9008, 0xffffffff, 0x013EF00F},
{(uint32 *)0x03ba900c, 0xffffffff, 0x13A0E000},
{(uint32 *)0x03ba9010, 0xffffffff, 0xE59C1220},
{(uint32 *)0x03ba9014, 0xffffffff, 0xE59F2098},
{(uint32 *)0x03ba9018, 0xffffffff, 0xE5821000},
{(uint32 *)0x03ba901c, 0xffffffff, 0xE3A01001},
{(uint32 *)0x03ba9020, 0xffffffff, 0xE58C1220},
{(uint32 *)0x03ba9024, 0xffffffff, 0xE28F1008},
{(uint32 *)0x03ba9028, 0xffffffff, 0xE58C1224},
{(uint32 *)0x03ba902c, 0xffffffff, 0xE13EF00F},
{(uint32 *)0x03ba9030, 0xffffffff, 0xE8BD837E},
{(uint32 *)0x03ba9034, 0xffffffff, 0xE92D4001},
{(uint32 *)0x03ba9038, 0xffffffff, 0xE1A0000F},
{(uint32 *)0x03ba903c, 0xffffffff, 0xE33FF3C2},
{(uint32 *)0x03ba9040, 0xffffffff, 0xE1A00000},
{(uint32 *)0x03ba9044, 0xffffffff, 0xE92D49FF},
{(uint32 *)0x03ba9048, 0xffffffff, 0xE59CB228},
{(uint32 *)0x03ba904c, 0xffffffff, 0xE59F3060},
{(uint32 *)0x03ba9050, 0xffffffff, 0xE5932000},
{(uint32 *)0x03ba9054, 0xffffffff, 0xE2522001},
{(uint32 *)0x03ba9058, 0xffffffff, 0x0A00000F},
{(uint32 *)0x03ba905c, 0xffffffff, 0xE5DB0818},
{(uint32 *)0x03ba9060, 0xffffffff, 0xE3100008},
{(uint32 *)0x03ba9064, 0xffffffff, 0x05832000},
{(uint32 *)0x03ba9068, 0xffffffff, 0x03A02001},
{(uint32 *)0x03ba906c, 0xffffffff, 0x0A000005},
{(uint32 *)0x03ba9070, 0xffffffff, 0xE59C1208},
{(uint32 *)0x03ba9074, 0xffffffff, 0xE59C01E8},
{(uint32 *)0x03ba9078, 0xffffffff, 0xE1A0E00F},
{(uint32 *)0x03ba907c, 0xffffffff, 0xE59CF240},
{(uint32 *)0x03ba9080, 0xffffffff, 0xE59F2028},
{(uint32 *)0x03ba9084, 0xffffffff, 0xE58C2224},
{(uint32 *)0x03ba9088, 0xffffffff, 0xE58C2220},
{(uint32 *)0x03ba908c, 0xffffffff, 0xE8BD49FF},
{(uint32 *)0x03ba9090, 0xffffffff, 0xE13FF000},
{(uint32 *)0x03ba9094, 0xffffffff, 0xE1A00000},
{(uint32 *)0x03ba9098, 0xffffffff, 0xE8FD8001},
{(uint32 *)0x03ba909c, 0xffffffff, 0xE3A00020},
{(uint32 *)0x03ba90a0, 0xffffffff, 0xE59C21D4},
{(uint32 *)0x03ba90a4, 0xffffffff, 0xE59C31F4},
{(uint32 *)0x03ba90a8, 0xffffffff, 0xE5DC71BC},
{(uint32 *)0x03ba90ac, 0xffffffff, 0xEAF6998E},
{(uint32 *)0x03ba90b0, 0xffffffff, 0x0394F768},
{(uint32 *)0x03ba90b4, 0xffffffff, 0x00000000}, /* Patched with adfs354_word_addr below */
{(uint32 *)0,0,0}
};
ADFSpatches371[(sizeof(ADFSpatches371)/sizeof(patchentry_t))-2].newval = adfs354_word_addr;
return ADFSpatches371;
}
......@@ -19,10 +19,12 @@
#include "patches/371/ROMcrc.h"
#include "patches/371/CLIBpatch.h"
#include "patches/371/ADFSpatch.h"
static patchlist_proc patchlist371[] =
{
CLIBpatches371_proc,
ADFSpatches371_proc,
NULL
};
......
/* Copyright 2018 Castle Technology Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* patches/402/ADFSpatch.h */
static patchentry_t *ADFSpatches402_proc(void *handle)
{
static patchentry_t ADFSpatches402[] =
{
/* addr old new */
/* Disc error 20 hook */
{(uint32 *)0x039C1748, 0x03A00020, 0x0A08B34B},
{(uint32 *)0x039C174C, 0x08BD437E, 0xE1A00000},
{(uint32 *)0x039C1750, 0x039EF201, 0xE1A00000},
/* Disc error 20 patch */
{(uint32 *)0x03bee47c, 0xffffffff, 0xE3A0E302},
{(uint32 *)0x03bee480, 0xffffffff, 0xE11E000F},
{(uint32 *)0x03bee484, 0xffffffff, 0x013EF00F},
{(uint32 *)0x03bee488, 0xffffffff, 0x13A0E000},
{(uint32 *)0x03bee48c, 0xffffffff, 0xE59C1220},
{(uint32 *)0x03bee490, 0xffffffff, 0xE59F2098},
{(uint32 *)0x03bee494, 0xffffffff, 0xE5821000},
{(uint32 *)0x03bee498, 0xffffffff, 0xE3A01001},
{(uint32 *)0x03bee49c, 0xffffffff, 0xE58C1220},
{(uint32 *)0x03bee4a0, 0xffffffff, 0xE28F1008},
{(uint32 *)0x03bee4a4, 0xffffffff, 0xE58C1224},
{(uint32 *)0x03bee4a8, 0xffffffff, 0xE13EF00F},
{(uint32 *)0x03bee4ac, 0xffffffff, 0xE8BD837E},
{(uint32 *)0x03bee4b0, 0xffffffff, 0xE92D4001},
{(uint32 *)0x03bee4b4, 0xffffffff, 0xE1A0000F},
{(uint32 *)0x03bee4b8, 0xffffffff, 0xE33FF3C2},
{(uint32 *)0x03bee4bc, 0xffffffff, 0xE1A00000},
{(uint32 *)0x03bee4c0, 0xffffffff, 0xE92D49FF},
{(uint32 *)0x03bee4c4, 0xffffffff, 0xE59CB228},
{(uint32 *)0x03bee4c8, 0xffffffff, 0xE59F3060},
{(uint32 *)0x03bee4cc, 0xffffffff, 0xE5932000},
{(uint32 *)0x03bee4d0, 0xffffffff, 0xE2522001},
{(uint32 *)0x03bee4d4, 0xffffffff, 0x0A00000F},
{(uint32 *)0x03bee4d8, 0xffffffff, 0xE5DB0818},
{(uint32 *)0x03bee4dc, 0xffffffff, 0xE3100008},
{(uint32 *)0x03bee4e0, 0xffffffff, 0x05832000},
{(uint32 *)0x03bee4e4, 0xffffffff, 0x03A02001},
{(uint32 *)0x03bee4e8, 0xffffffff, 0x0A000005},
{(uint32 *)0x03bee4ec, 0xffffffff, 0xE59C1208},
{(uint32 *)0x03bee4f0, 0xffffffff, 0xE59C01E8},
{(uint32 *)0x03bee4f4, 0xffffffff, 0xE1A0E00F},
{(uint32 *)0x03bee4f8, 0xffffffff, 0xE59CF240},
{(uint32 *)0x03bee4fc, 0xffffffff, 0xE59F2028},
{(uint32 *)0x03bee500, 0xffffffff, 0xE58C2224},
{(uint32 *)0x03bee504, 0xffffffff, 0xE58C2220},
{(uint32 *)0x03bee508, 0xffffffff, 0xE8BD49FF},
{(uint32 *)0x03bee50c, 0xffffffff, 0xE13FF000},
{(uint32 *)0x03bee510, 0xffffffff, 0xE1A00000},
{(uint32 *)0x03bee514, 0xffffffff, 0xE8FD8001},
{(uint32 *)0x03bee518, 0xffffffff, 0xE3A00020},
{(uint32 *)0x03bee51c, 0xffffffff, 0xE59C21D4},
{(uint32 *)0x03bee520, 0xffffffff, 0xE59C31F4},
{(uint32 *)0x03bee524, 0xffffffff, 0xE5DC71BC},
{(uint32 *)0x03bee528, 0xffffffff, 0xEAF74CFD},
{(uint32 *)0x03bee52c, 0xffffffff, 0x039C19A0},
{(uint32 *)0x03bee530, 0xffffffff, 0x00000000}, /* Patched with adfs354_word_addr below */
{(uint32 *)0,0,0}
};
ADFSpatches402[(sizeof(ADFSpatches402)/sizeof(patchentry_t))-2].newval = adfs354_word_addr;
return ADFSpatches402;
}
......@@ -38,9 +38,6 @@ static patchentry_t *CDSFTpatches402_proc(void *handle)
{(uint32 *)0x03BEE418, 0xFFFFFFFF, 0xEBFFC9F8},
{(uint32 *)0x03BEE41C, 0xFFFFFFFF, 0xEAFFC917},
{(uint32 *)0x03B02128, 0x41525421, 0x6C6C754E},
{(uint32 *)0x03B0212C, 0x00004543, 0x00004A3A},
{(uint32 *)0,0,0}
};
......
......@@ -26,11 +26,13 @@ static patchentry_t *MSGSpatches402_proc(void *handle)
{
/* addr old new */
/* Filer template fix */
{(uint32 *)0x03886DAC, 0x04D00D32, 0x00240D32},
{(uint32 *)0x03886DB0, 0x00020000, 0x01F20000},
{(uint32 *)0x03886DB4, 0x07D00000, 0x03280000},
{(uint32 *)0x03886DB8, 0x02FA0000, 0x04680000},
/* Bottom row of ptr_write fix */
{(uint32 *)0x03920524, 0x00015555, 0x00015455},
{(uint32 *)0,0,0}
......
......@@ -28,6 +28,7 @@
#include "patches/402/DESKpatch.h"
#include "patches/402/DRWFpatch.h"
#include "patches/402/MTRANpatch.h"
#include "patches/402/ADFSpatch.h"
static patchlist_proc patchlist402[] =
......@@ -42,6 +43,7 @@ static patchlist_proc patchlist402[] =
CDSFTpatches402_proc,
PINBpatches402_proc,
MTRANpatches402_proc,
ADFSpatches402_proc,
NULL
};
......
| Copyright 2018 Castle Technology Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
| Utility for building the different versions of the ADFS "disc error 20" patch
| Assumes you've built the ihf2c tool (ROMPatch.ihf2c) and have it on your path!
set Machine 26
objasm adfs354.s -pd "ROMVer SETA 350" -o adfs354_350.o
link -IHF adfs354_350.o -o adfs354_350_ihf
ihf2c adfs354_350_ihf adfs354_350
objasm adfs354.s -pd "ROMVer SETA 360" -o adfs354_360.o
link -IHF adfs354_360.o -o adfs354_360_ihf
ihf2c adfs354_360_ihf adfs354_360
objasm adfs354.s -pd "ROMVer SETA 370" -o adfs354_370.o
link -IHF adfs354_370.o -o adfs354_370_ihf
ihf2c adfs354_370_ihf adfs354_370
objasm adfs354.s -pd "ROMVer SETA 371" -o adfs354_371.o
link -IHF adfs354_371.o -o adfs354_371_ihf
ihf2c adfs354_371_ihf adfs354_371
objasm adfs354.s -pd "ROMVer SETA 402" -o adfs354_402.o
link -IHF adfs354_402.o -o adfs354_402_ihf
ihf2c adfs354_402_ihf adfs354_402
; Copyright 2018 Castle Technology Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; Source for ADFS "disc error 20" patch
;
; See ADFS 3.54 for the original patch:
; https://www.riscosopen.org/viewer/revisions/logs?ident=1511034689-054391.html
;
; This file can be used to generate the patches for arbitrary ROM versions, by
; configuring the appropriate constants below.
[ :LNOT: :DEF: ROMVer
GBLA ROMVer
ROMVer SETA 370
]
MACRO
$symbol BasedReg $reg, $offset
^ $offset, $reg
$symbol # 0
MEND
; ROM addresses
[ ROMVer = 350
PatchBase * &039FC000 ; Spare page at end of ROM
WinIDEIRQError * &038FC6E8
WinIDETimeout * &038FC744
ELIF ROMVer = 360
PatchBase * &03B61000 ; Spare page at end of ROM
WinIDEIRQError * &0393479C
WinIDETimeout * &03934818
ELIF ROMVer = 370
PatchBase * &03BA6000 ; Spare page at end of ROM
WinIDEIRQError * &0394BC9C
WinIDETimeout * &0394BD18
ELIF ROMVer = 371
PatchBase * &03BA9000 ; Spare page at end of ROM
WinIDEIRQError * &0394F6EC
WinIDETimeout * &0394F768
ELIF ROMVer = 402
PatchBase * &03BEE47C ; Already-patched page
WinIDEIRQError * &039C1924
WinIDETimeout * &039C19A0
]
; Workspace locations
[ ROMVer = 350
WinIDECommandCode BasedReg R12, 444
WinIDEDiscAddress BasedReg R12, 464
WinIDEBlockSize BasedReg R12, 476
WinIDEScatterPtr BasedReg R12, 488
WinIDETmpScatterEntry BasedReg R12, 508
WinTickCount BasedReg R12, 524
WinTickCallAddress BasedReg R12, 528
WinIDEPtr BasedReg R12, 532
WinIDEWritePtr BasedReg R12, 556
|
WinIDECommandCode BasedReg R12, 444
WinIDEDiscAddress BasedReg R12, 468
WinIDEBlockSize BasedReg R12, 488
WinIDEScatterPtr BasedReg R12, 500
WinIDETmpScatterEntry BasedReg R12, 520
WinTickCount BasedReg R12, 544
WinTickCallAddress BasedReg R12, 548
WinIDEPtr BasedReg R12, 552
WinIDEWritePtr BasedReg R12, 576
]
IDE RN R11
IDERegAltStatus BasedReg IDE, 2072
IDEStatusDRQ * 1:SHL:3
WinIDEErrNoDRQ * &20 ; no DRQ when expected
GBLS WinIDEIRQRegsA ; regs pushed
GBLS WinIDEIRQRegsB
WinIDEIRQRegsA SETS "R0"
WinIDEIRQRegsB SETS "R0-R8,IDE"
; Patch code
AREA |main|, CODE, READONLY
GET Hdr:ListOpts
GET Hdr:Macros
GET Hdr:System
; Patch entry, called on DRQ poll loop timeout
ORG PatchBase
; set up the TickerV DRQ poll routine
PHPSEI LR
LDR R1, WinTickCount ; preserve current timeout
LDR R2, WinIDEDRQTimeoutPtr
STR R1, [R2]
MOV R1, #1
STR R1, WinTickCount
ADR R1, WinIDEDRQPoll
STR R1, WinTickCallAddress
PLP LR
Pull "R1-R6,R8-R9,PC"
WinIDEDRQPoll ROUT
;
; Called every centisecond from TickerV when we're waiting for DRQ for the
; first sector of a write op.
;
; Entry:
; SB -> static workspace
; MODE: IRQ or SVC
; IRQs disabled
;
; Exit:
; All registers preserved
; Switch to SVC mode as will join main thread of IRQ
Push "$WinIDEIRQRegsA,LR" ; same regs as IRQHandler
WritePSRc SVC_mode :OR: I_bit,LR,,R0
; Now in SVC mode - save main regs
Push "$WinIDEIRQRegsB,LR" ; same regs as IRQHandler
; Set IDE -> IDE controller
LDR IDE,WinIDEPtr ; IDE -> IDE hardware
; Check for timeout
LDR R3,WinIDEDRQTimeoutPtr
LDR R2,[R3]
SUBS R2,R2,#1
BEQ %FT95
; Check for DRQ
LDRB R0,IDERegAltStatus
TST R0,#IDEStatusDRQ
STREQ R2,[R3]
MOVEQ R2,#1
BEQ %FT90
; got DRQ so write data
LDR R1,WinIDETmpScatterEntry ; R1 -> buffer
LDR R0,WinIDEBlockSize ; R0 = max bytes to move
; R0 = length to transfer (up to 512 bytes will be moved)
; R1 -> buffer
; Call data write routine
MOV LR,PC ; set link
LDR PC,WinIDEWritePtr ; (R0,R1,IDE->R0,R1)
; returns here
; Restore standard ticker routine
LDR R2,=WinIDETimeout
STR R2,WinTickCallAddress
90
STR R2,WinTickCount
; First restore SVC regs and switch back to original mode
Pull "$WinIDEIRQRegsB,LR"
RestPSR R0,,c
; Now back in original mode
Pull "$WinIDEIRQRegsA,PC",,^
95
MOV R0,#WinIDEErrNoDRQ ; R0 = error code
LDR R2,WinIDEDiscAddress ; R2 = disc address of start of op
LDR R3,WinIDEScatterPtr ; R3 -> scatter list
LDRB R7,WinIDECommandCode ; R7 = IDE command code
B WinIDEIRQError
LTORG
WinIDEDRQTimeoutPtr
DCD 0 ; Must be filled in by patcher to point somewhere writable
END
......@@ -30,9 +30,10 @@
EXPORT |modDAhandler|
EXPORT |moddata|
EXPORT |moduleend|
EXPORT |adfs354_word|
GBLS VersionString
VersionString SETS "2.06 (27 May 2013)"
VersionString SETS "2.07 (20 Nov 2017)"
GET Hdr:ListOpts
GET Hdr:Macros
......@@ -211,6 +212,8 @@ modL1PTentries
DCD 0
DCD 0
DCD 0
adfs354_word
DCD 0 ;Writable word needed by ADFS "disc error 20" patch
moduleend
......
/* (1.25)
/* (1.26)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.25
#define Module_MajorVersion_CMHG 1.26
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 16 Sep 2016
#define Module_Date_CMHG 02 Feb 2018
#define Module_MajorVersion "1.25"
#define Module_Version 125
#define Module_MajorVersion "1.26"
#define Module_Version 126
#define Module_MinorVersion ""
#define Module_Date "16 Sep 2016"
#define Module_Date "02 Feb 2018"
#define Module_ApplicationDate "16-Sep-16"
#define Module_ApplicationDate "02-Feb-18"
#define Module_ComponentName "Boot"
#define Module_ComponentPath "castle/RiscOS/Sources/SystemRes/Boot"
#define Module_FullVersion "1.25"
#define Module_HelpVersion "1.25 (16 Sep 2016)"
#define Module_LibraryVersionInfo "1:25"
#define Module_FullVersion "1.26"
#define Module_HelpVersion "1.26 (02 Feb 2018)"
#define Module_LibraryVersionInfo "1:26"
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