Commit 8727ebaa authored by Mike Stephens's avatar Mike Stephens
Browse files

Merge in long command line support from Ursula kernel.

Look for LongCommandLine flag, command line size currently
set at 1k.
For HAL/32bit builds, the kernel buffer space is at high
(top bit set) address, which may break some code using signed
comparisons. So *beware* that there may be some latent
bugs in old kernel code using these buffers, not yet found.
One such bug, in s.Arthur2 found and fixed.
Tested moderately on ARM9 desktop build.
Lovely to reimplement things I did two and half years ago.

Version 5.35, 4.79.2.37. Tagged as 'Kernel-5_35-4_79_2_37'
parent a0f4966c
......@@ -60,6 +60,7 @@ FA300000 8K ABT stack
FA400000 8K UND stack
FAE00000 1M Reserved for physical memory accesses
FAF00000 256k reserved for DCache cleaner address space (eg. StrongARM)
FAF40000 64k kernel buffers (for long command lines, size defined by KbuffsMaxSize)
FAFE8000 32K HAL workspace
FAFF0000 32K "Cursor/System/Sound" block (probably becoming just "System")
FAFF8000 32K "Nowhere"
......
......@@ -13,12 +13,12 @@
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.35"
Module_Version SETA 535
Module_MinorVersion SETS "4.79.2.36"
Module_Date SETS "13 Jun 2001"
Module_ApplicationDate2 SETS "13-Jun-01"
Module_ApplicationDate4 SETS "13-Jun-2001"
Module_MinorVersion SETS "4.79.2.37"
Module_Date SETS "15 Jun 2001"
Module_ApplicationDate2 SETS "15-Jun-01"
Module_ApplicationDate4 SETS "15-Jun-2001"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.35 (4.79.2.36)"
Module_HelpVersion SETS "5.35 (13 Jun 2001) 4.79.2.36"
Module_FullVersion SETS "5.35 (4.79.2.37)"
Module_HelpVersion SETS "5.35 (15 Jun 2001) 4.79.2.37"
END
......@@ -4,19 +4,19 @@
*
*/
#define Module_MajorVersion_CMHG 5.35
#define Module_MinorVersion_CMHG 4.79.2.36
#define Module_Date_CMHG 13 Jun 2001
#define Module_MinorVersion_CMHG 4.79.2.37
#define Module_Date_CMHG 15 Jun 2001
#define Module_MajorVersion "5.35"
#define Module_Version 535
#define Module_MinorVersion "4.79.2.36"
#define Module_Date "13 Jun 2001"
#define Module_MinorVersion "4.79.2.37"
#define Module_Date "15 Jun 2001"
#define Module_ApplicationDate2 "13-Jun-01"
#define Module_ApplicationDate4 "13-Jun-2001"
#define Module_ApplicationDate2 "15-Jun-01"
#define Module_ApplicationDate4 "15-Jun-2001"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "RiscOS/Sources/Kernel"
#define Module_FullVersion "5.35 (4.79.2.36)"
#define Module_HelpVersion "5.35 (13 Jun 2001) (4.79.2.36)"
#define Module_FullVersion "5.35 (4.79.2.37)"
#define Module_HelpVersion "5.35 (15 Jun 2001) (4.79.2.37)"
......@@ -236,8 +236,7 @@ SVCStackSize * 32*1024
IRQStackSize * 8*1024
ABTStackSize * 8*1024
UNDStackSize * 8*1024
SVCStackAddress * &01C00000
KbuffsMaxSize * 64*1024
AplWorkMaxSize * &01C00000 ; 28M - temporary (need to decide this at boot time)
ScreenEndAdr * &24000000 ; temporary - run time allocate
......@@ -254,11 +253,14 @@ HALWorkspace * &FA000000
IRQStackAddress * &FA100000
[ {FALSE}
SVCStackAddress * &FA200000
|
SVCStackAddress * &01C00000
]
ABTStackAddress * &FA300000
UNDStackAddress * &FA400000
PhysicalAccess * &FAE00000
DCacheCleanAddress * &FAF00000 ; eg. for StrongARM, 256k of space, up to FAF40000
KbuffsBaseAddress * &FAF40000 ; kernel buffers for long command lines, size KbuffsMaxSize
[ {FALSE}
CursorChunkAddress * &FAFF0000
|
......@@ -309,6 +311,9 @@ ScreenMaxSize * 480*1024
FreePoolAddress * &06000000 ; may still go lower!
PhysRam * &05000000
;following dynamic area only used if LongCommandLines is {TRUE}
KbuffsBaseAddress * &2078000 ;just above reserved area for fake 480k screen
KbuffsMaxSize * &0088000 ;544k (takes us up to start of RMA)
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......@@ -1255,7 +1260,11 @@ MMUControlSoftCopy # 4 ; Soft copy of ARM600/700 control regist
AplWorkSize * AppSpaceDANode + DANode_Size
[ LongCommandLines
OldEnvString # 256 ;spare
|
EnvString # 256
]
[ :DEF: ShowWS
! 0, "Free space after EnvString = ":CC::STR:(&500-@)
......@@ -1378,7 +1387,11 @@ ExceptionDump # 4
; *If expression to be evaluated to control the *If
; Command line to be submited on the expression
; evaluating to non-zero (the THEN clause).
[ LongCommandLines
OldGeneralMOSBuffer # 256+4 ;spare
|
GeneralMOSBuffer # 256+4
]
[ AssemblingArthur :LAND: :DEF: ShowWS
! 0,"16 ":CC::STR:@
......@@ -1643,25 +1656,38 @@ MacExEndPtrs # 44
; are called while the buffer is held. Also used for module prefixes:
; Module called twice in this case.
AliasExpansionBuffer # 100
[ LongCommandLines
OldAliasExpansionBuffer # 100 ;spare, mjs: shouldn't this have been &100 ??!??
|
AliasExpansionBuffer # 100 ;mjs: shouldn't this be &100 ??!??
; *list/*type need an argument expansion buffer: ReadArgs called with it.
ArgumentBuffer * AliasExpansionBuffer
]
ArgumentBuffer * AliasExpansionBuffer
; EvaluateExpression space. Calls ReadUnsigned, BinaryToDecimal and ReadVarVal.
ExprWSpace * @
^ 0, R12
[ LongCommandLines
;ExprBuff moved to Kernel buffers area
|
ExprBuff # &100
]
exprBracDif # 2 ; keep exprSTRACC aligned
tos_op # 2 ; 1 byte for use as STRACC-1
ExprSVCstack # 4
exprSTRACC * @ - ExprBuff + ExprWSpace
[ LongCommandLines
;exprSTRACC moved to Kernel buffers area
ExprStackLimit * @ - exprBracDif + ExprWSpace + &100 ;keep 256 buffer zone for stack overflow
ExprStackStart * ScratchSpace + ScratchSpaceSize
|
exprSTRACC * @ - ExprBuff + ExprWSpace
ExprStackLimit * exprSTRACC + &100
ExprStackStart * ScratchSpace + ScratchSpaceSize
]
; Tutu needs some for argument substitution + expansion for run/load types
......@@ -1766,11 +1792,15 @@ MouseBuff |#| MouseBuffSize
; Oscli buffering
[ LongCommandLines
OldOscliBuffs |#| (16+1)*&100 ;spare
|
OscliBuffSize * &100
OscliNoBuffs * 16
OscliCircBuffLimit |#| 0
OscliCircBuffStart |#| OscliBuffSize * OscliNoBuffs
RedirectBuff |#| OscliBuffSize
]
; Default IRQ despatch moved here as a result of IOMD having an extra
; 6 interrupts for I/O and sound DMA (this is really IOMD specific, not
......@@ -1821,5 +1851,52 @@ Export_SysHeapStart # 0
ASSERT Export_SysHeapStart = SysHeapStart
ASSERT ?Export_SysHeapStart = ?SysHeapStart
; *****************************************************************************
[ LongCommandLines
ASSERT LongCLISize >= 256+4 ;minimum size of GeneralMOSBuffer
;Kernel buffers area
^ KbuffsBaseAddress
GeneralMOSBuffer # LongCLISize
EnvString # LongCLISize
AliasExpansionBuffer # LongCLISize
ArgumentBuffer * AliasExpansionBuffer
ExprBuff # LongCLISize
exprSTRACC # LongCLISize
OscliBuffSize * LongCLISize
OscliNoBuffs * 16
RedirectBuff # OscliBuffSize
OscliCircBuffStart # OscliBuffSize * OscliNoBuffs
OscliCircBuffLimit # 0
KbuffsEnd # 0
KbuffsSize * KbuffsEnd - KbuffsBaseAddress ;size of Kernel buffers area
ASSERT KbuffsSize <= KbuffsMaxSize
! 0, "Kbuffs at ":CC::STR:(KbuffsBaseAddress)
! 0, "Kbuffs Size is ":CC::STR:(KbuffsSize)
! 0, "GeneralMOSBuffer at ":CC::STR:(GeneralMOSBuffer)
! 0, "EnvString at ":CC::STR:(EnvString)
! 0, "AliasExpansionBuffer at ":CC::STR:(AliasExpansionBuffer)
! 0, "ArgumentBuffer at ":CC::STR:(ArgumentBuffer)
! 0, "ExprBuff at ":CC::STR:(ExprBuff)
! 0, "exprSTRACC at ":CC::STR:(exprSTRACC)
! 0, "RedirectBuff at ":CC::STR:(RedirectBuff)
! 0, "OscliCircBuffStart at ":CC::STR:(OscliCircBuffStart)
] ;LongCommandLines
OPT OldOpt
END
......@@ -200,6 +200,12 @@ OnlyKernelCanAccessHardwareVectors SETL {TRUE} ; if true, only the Kernel is pe
; while in 26-bit mode. If false, the whole ROM can (including BASIC
; and the Shared C Library - eg any memcpy!)
GBLL LongCommandLines ; first introduced for Ursula, merged into HAL kernel
LongCommandLines SETL {TRUE}
[ LongCommandLines
LongCLISize * 1024 ; buffer size for long commands
]
GBLL StrongARM
GBLL SAcleanflushbroken ;whether StrongARM single MCR for DC clean+flush broken (is always for SA110)
GBLL SASTMhatbroken ;whether ROM must support SA110's with broken STM^ (revision 3 should fix this)
......
......@@ -1234,8 +1234,17 @@ SetVarValue
; Process VarType_Expanded
[ LongCommandLines
MOV r0, stack, LSR #20 ; SVC stack base assumed on 1M boundary
SUB r0, sp, r0, LSL #20 ; amount of stack left
CMP r0, #LongCLISize + 2048 ; insist on 2k left after long buffer
MOVHS r2, #LongCLISize ; ok, got a long buffer
MOVLO r2, #256 ; stack full-ish, use a 256 buffer and hope it's big enough
SUB stack, stack, r2
|
SUB stack, stack, #256
MOV r2, #256
]
MOV r0, r1 ; ptr to expression
MOV r1, stack
......@@ -1308,8 +1317,17 @@ SetVarVal_NodeAlreadyExists
SetVarVal_AssignStringToCode
[ LongCommandLines
MOV r0, stack, LSR #20 ; SVC stack base assumed on 1M boundary
SUB r0, sp, r0, LSL #20 ; amount of stack left
CMP r0, #LongCLISize + 2048 ; insist on 2k left after long buffer
MOVHS r2, #LongCLISize ; ok, got a long buffer
MOVLO r2, #256 ; stack full-ish, use a 256 buffer and hope it's big enough
SUB stack, stack, r2
|
SUB stack, stack, #256
MOV r2, #256
]
; Expand string to stack frame then do it
MOV r0, r1
......
......@@ -240,8 +240,13 @@ ReadExpression ROUT
CLRPSR I_bit, R12 ; interrupts on, ta.
LDR R12, =ExprWSpace
STR R13, ExprSVCstack
[ LongCommandLines
LDR R1, =ExprBuff
MOV R2, #LongCLISize
|
ADR R1, ExprBuff
MOV R2, #256
]
ORR R2, R2, #(1 :SHL: 30) :OR: (1 :SHL: 31)
SWI XOS_GSTrans ; No | transformation, no " or space termination.
; so can never go wrong!
......@@ -520,8 +525,13 @@ Plus_Code ROUT ; integer+integer ; string+string
03
ADD R0, R2, R4
[ LongCommandLines
CMP R0, #LongCLISize
BGE StrOFloErr
|
CMP R0, #255
BGT StrOFloErr
]
LDR R3, =exprSTRACC
Push "R0" ; new length
ADD R0, R3, R0
......@@ -827,7 +837,12 @@ IntegerToString ROUT
Push "R1, lr"
MOV R0, R2
LDR R1, =exprSTRACC
[ LongCommandLines
MOV R2, #LongCLISize
SUB R2, R2, #1
|
MOV R2, #255
]
SWI XOS_BinaryToDecimal
MOV R0, #type_String
Pull "R1, PC"
......@@ -947,7 +962,12 @@ terminatename_map ; 1 means character allowed
BEQ NaffItemErr
LDR R1, =exprSTRACC ; overwrite name with value
MOV R0, R1 ; overwritten by VSet return
[ LongCommandLines
MOV R2, #LongCLISize
SUB R2, R2, #1
|
MOV R2, #255
]
MOV R3, #0
CMP R4, #VarType_Macro
MOVEQ R4, #VarType_Expanded
......
......@@ -62,6 +62,7 @@ AP_FreePool * 2 :OR: DynAreaFlags_NotCacheable ; user none, ~CB
]
AP_CursorChunk * 1 :OR: DynAreaFlags_NotCacheable :OR: DynAreaFlags_NotBufferable :OR: PageFlags_Unavailable
AP_PageZero * 0
[ MEMM_Type = "ARM600"
AP_L2PT * 2 :OR: DynAreaFlags_NotCacheable :OR: DynAreaFlags_NotBufferable ; user none, ~C~B
AP_L1PT * AP_L2PT :OR: PageFlags_Unavailable
......@@ -92,11 +93,7 @@ ChangeDyn_SpriteArea * 3
ChangeDyn_FontArea * 4
ChangeDyn_RamFS * 5
ChangeDyn_FreePool * 6
[ UseFreePool
ChangeDyn_MaxArea * 6
|
ChangeDyn_MaxArea * 5
]
; Area handler reason codes
......@@ -1221,7 +1218,7 @@ FixedAreasTable ; table of fixed areas (
|
& 0, AplWorkMaxSize ; application space
& UndStackSoftCamChunk, 1024*1024 ; undefined stack / soft cam map
& CursorChunkAddress, 64*1024 ; 32K for cursor, 32K for "nowhere"
& CursorChunkAddress, 1504*1024 ; cursor, Nowhere, cache cleaners, reserved (up to kernel buffers)
& L2PT, 4*1024*1024 ; L2PT (and L1PT)
[ OSROM_ImageSize > 8192
& &03000000, 8*1024*1024+OSROM_ImageSize*1024 ; I/O + ROM
......
......@@ -720,6 +720,13 @@ MMUon_nol1ptoverlap
LDR a3, =?SoundDMABuffers
BL Init_MapInRAM
[ LongCommandLines
LDR a1, =KbuffsBaseAddress
LDR a2, =(AP_Read * L2_APMult) + L2_C + L2_B
LDR a3, =(KbuffsSize + &FFF) :AND: &FFFFF000 ;(round to 4k)
BL Init_MapInRAM
]
[ MinorL2PThack
; Allocate backing L2PT for the free pool
MOV a1, #FreePoolAddress
......
......@@ -68,7 +68,11 @@ Error_CodeTag DCB "ErrSub", 0
Eval_Code ROUT
Push "lr"
LDR R1, =GeneralMOSBuffer
[ LongCommandLines
MOV R2, #LongCLISize
|
MOV R2, #256
]
SWI XOS_EvaluateExpression
Pull "PC", VS
[ :LNOT: International
......
......@@ -1621,6 +1621,22 @@ WallopDuffOnes
BL DynArea_Create ; ignore any error, we're stuffed if we get one!
Pull "r0-r12"
[ LongCommandLines :LAND: (:LNOT: HAL)
;sort out the Kernel buffers dynamic area
Push "r0-r12"
MOV r1, #ChangeDyn_Kbuffs ; Area number
MOV r2, #KbuffsSize ; Initial (and in fact permanent) size
LDR r3, =KbuffsBaseAddress ; Base address
MOV r4, #AP_Kbuffs ; Area flags
MOV r5, #KbuffsMaxSize ; Maximum size
MOV r6, #0 ; no handler
MOV r7, #0
ADRL r8, AreaName_Kbuffs ; Title string - node will have to be reallocated
; after module init, to internationalise it
BL DynArea_Create ; ignore any error, we're stuffed if we get one!
Pull "r0-r12"
]
; SpriteArea
Push "r0-r12"
MOV r0, #0 ; initialise SpriteSize to zero
......@@ -1632,7 +1648,7 @@ WallopDuffOnes
MOV r1, #ChangeDyn_SpriteArea ; Area number
MOV r3, #-1 ; Base address dynamic
MOV r4, #AP_Sprites ; Area flags
MOV r5, #-1 ; Maximum size
MOV r5, #16*1024*1024 ; Maximum size (changed from -1, address space preservation)
ADRL r6, DynAreaHandler_Sprites ; Pointer to handler
MOV r7, #-1 ; Use base address as workspace ptr
ADRL r8, AreaName_SpriteArea ; Title string - node will have to be reallocated
......
......@@ -185,10 +185,18 @@ VecOsCli ROUT
; Redirection setter ::= "{ " [ >= 1 Redirection spec] "}"
; where
; Redirection spec ::= "> "filename" " | "< "filename" " | ">> "filename" "
[ LongCommandLines
; Also check terminator in first LongCLISize chars.
|
; Also check terminator in first 256 chars.
]
SUB R11, R0, #1
MOV R1, #0
[ LongCommandLines
ADD R2, R0, #LongCLISize
|
ADD R2, R0, #256
]
02 LDRB R10, [R11], #1
CMP R11, R2
BEQ OscliLineTooLong
......@@ -372,7 +380,11 @@ oqa_loop2 ; bung in command, upper cased
;found alias
MOV R0,#-1 ; special, VarFindIt skipping call (r5,r6,r7 from VarFindIt_QA)
MOV R1,R3 ; output buffer
[ LongCommandLines
MOV R2,#LongCLISize
|
MOV R2,#256
]
MOV R3,#0
MOV R4,#VarType_Expanded
SWI XOS_ReadVarVal ; expand it
......@@ -447,7 +459,11 @@ oqa_treacletime
CMP R5, #0
BNE %BT34
MOV R1, R0 ; output buffer same as input!
[ LongCommandLines
MOV R2, #LongCLISize
|
MOV R2, #256
]
MOV R3, #0
MOV R4, #VarType_Expanded
SWI XOS_ReadVarVal
......@@ -904,13 +920,14 @@ nogstransingta
CMP R2, #0
BEQ preversion_detectified ; empty expansions are naff
ADD R10, R10, R2
ADD R6, R1, R10
nastycharscan
LDRB R2, [R1], #1
CMP R2, #&7F
CMPNE R2, #" "
BLE preversion_detectified
CMP R1, R10
BLT nastycharscan
CMP R1, R6
BLO nastycharscan
MOV R6, R0
Pull "R0-R2"
......
......@@ -911,7 +911,11 @@ Type_Code ALTENTRY
MOV R1, R0 ; args given
ADR R0, TypeArgs
LDR R2, =ArgumentBuffer
[ LongCommandLines
MOV R3, #LongCLISize
|
MOV R3, #256
]
SWI XOS_ReadArgs
Pull "R2, R3", VS
EXIT VS
......
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