Commit 95896f97 authored by Tim Roddis's avatar Tim Roddis
Browse files

Added a flag for word-aligned buffers

Version 0.27. Tagged as 'Buffers-0_27'
parent 1c1e0039
......@@ -47,7 +47,7 @@ TARGET = rm.Buffers
TARGETSA = rm.BuffersSA
EXPORTS = ${EXP_HDR}.Buffer
RESOURCES = LocalRes:Messages
RESOURCES = Resources.UK.Messages
#
# Generic rules:
......
......@@ -5,3 +5,4 @@ E03:Buffer manager in use
E04:Unable to detach current owner of this buffer
E05:Buffer handle already in use
E06:Buffer too small
E07:Buffer must be word aligned
......@@ -5,8 +5,8 @@
GBLA Module_Version
GBLS Module_MinorVersion
GBLS Module_Date
Module_MajorVersion SETS "0.26"
Module_Version SETA 26
Module_MajorVersion SETS "0.27"
Module_Version SETA 27
Module_MinorVersion SETS ""
Module_Date SETS "29 Sep 1998"
Module_Date SETS "15 Dec 1998"
END
/* (0.26)
/* (0.27)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.26
#define Module_MajorVersion_CMHG 0.27
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 29 Sep 1998
#define Module_Date_CMHG 15 Dec 1998
#define Module_MajorVersion "0.26"
#define Module_Version 26
#define Module_MajorVersion "0.27"
#define Module_Version 27
#define Module_MinorVersion ""
#define Module_Date "29 Sep 1998"
#define Module_Date "15 Dec 1998"
......@@ -51,6 +51,7 @@ BufferFlags_NotDormant * 1 :SHL: 0
BufferFlags_GenerateOutputEmpty * 1 :SHL: 1
BufferFlags_GenerateInputFull * 1 :SHL: 2
BufferFlags_SendThresholdUpCalls * 1 :SHL: 3
BufferFlags_WordAlignedInserts * 1 :SHL: 4
; Reason codes for BufferManager service routine.
......
......@@ -104,6 +104,7 @@
GET Hdr:MsgTrans
GET Hdr:Proc
GET Hdr:ResourceFS
GET Hdr:HostFS
GBLL hostvdu
GBLL debug
......@@ -123,19 +124,19 @@ international SETL true
dormant_on_last_byte SETL true
init SETD false
final SETD false
final SETD true;false
service SETD false
register SETD false
register SETD true
deregister SETD false
getinfo SETD false
modflags SETD false
link SETD false
unlink SETD false
blkinsert SETD false
blkinsert SETD true
blkremove SETD false
findhandle SETD false
cnpv SETD false
insv SETD false
insv SETD true;false
remv SETD false
makebuffer SETD false
zapbuffer SETD false
......@@ -209,7 +210,8 @@ buffer_Flags # 4 ; = flags for buffer
; bit 1 = 1 => buffer generates "output buffer empty" events
; bit 2 = 1 => buffer generates "input buffer full" events
; bit 3 = 1 => buffer generates threshold upcalls
;
; bit 4 = 1 => word-aligned data buffer
; bit 8 = 1 => threshold currently exceeded
buffer_Start # 4 ; -> start of buffer in memory
......@@ -237,6 +239,7 @@ b_NotDormant * 1:SHL:0 ; 0 => dormant, 1 => awake
b_GenerateOutputEmpty * 1:SHL:1 ; 1 => generate OutputEmpty events
b_GenerateInputFull * 1:SHL:2 ; 1 => generate InputFull events
b_SendThresholdUpCalls * 1:SHL:3 ; 1 => send upcalls when free goes above or below threshold
b_WordAligned * 1:SHL:4 ; 1 => word-aligned data buffer
b_ThresholdExceeded * 1:SHL:8 ; =0 free >= threshold, =1 free < threshold (only maintained if bit 2 set)
......@@ -699,6 +702,11 @@ b_Create ENTRY "r0-r4"
PullEnv LE
BLE BufferTooSmall
TST r0, #b_WordAligned
TSTNE r1, #3
PullEnv NE
BNE BufferNotAligned
MOV r4, r2 ; r4 = handle to be used
MOV r0, #ModHandReason_Claim
......@@ -730,6 +738,11 @@ BufferTooSmall
DoError
MakeErrorBlock BufferManager_BufferTooSmall
BufferNotAligned
ADR r0, ErrorBlock_BufferManager_BufferNotAligned
DoError
MakeErrorBlock BufferManager_BufferNotAligned
LTORG
......@@ -804,6 +817,17 @@ b_Register ENTRY "r0-r3"
; r2 -> buffer end
; r3 = handle to be used, =-1 if undefined
TST r0, #b_WordAligned
BEQ %FT05
TST r1, #3
PullEnv NE
BNE BufferNotAligned
TST r2, #3
PullEnv NE
BNE BufferNotAligned
05
SUBS lr, r2, r1 ; lr = size of buffer
PullEnv LE ; if size <= 0 then silly
BLE BufferTooSmall
......@@ -857,7 +881,7 @@ b_Register ENTRY "r0-r3"
STR r10, [r11, #buffer_Handle]
SUB r2, r2, r1 ; lr = buffer size
AND r0, r0, #&0F ; set high-up (internal) flag bits to zero
AND r0, r0, #&1F ; set high-up (internal) flag bits to zero
ASSERT buffer_Flags = 4
ASSERT buffer_Start = buffer_Flags +4
......@@ -1527,8 +1551,19 @@ s_InsertBlock ; r11 and return address already
ASSERT buffer_RemoveIndex = buffer_Flags +16
LDMIB r11, {r4-r8} ; r4=flags, r5->start, r6=size, r7=ins, r8=rem
TST r4, #b_WordAligned
BNE %FT20
SUBS r8, r8, #1 ; real insert limit
SUBLO r8, r6, #1 ; if -ve then wrap to end of buffer
B %FT30
20
Debug insv,"word-aligned insert"
SUBS r8, r8, #4 ; real insert limit
SUBLO r8, r6, #4 ; if -ve then wrap to end of buffer
30
TEQ r7, r8 ; if ins=rem-1
BEQ %FT80 ; then buffer full
......@@ -1992,19 +2027,31 @@ s_UsedSpace ; r11 and return address already
; all other registers preserved
;
s_FreeSpace ; r11 and return address already stacked
Push "r0,r1"
Push "r4-r8"
Debug cnpv,"Returning free space in buffer",r11
ASSERT buffer_InsertIndex = buffer_Size +4
ASSERT buffer_RemoveIndex = buffer_Size +8
ADD r11, r11, #buffer_Size
LDMIA r11, {r0-r2} ; r0=size, r1=ins, r2=rem
ASSERT buffer_Flags = 4
ASSERT buffer_Start = buffer_Flags +4
ASSERT buffer_Size = buffer_Flags +8
ASSERT buffer_InsertIndex = buffer_Flags +12
ASSERT buffer_RemoveIndex = buffer_Flags +16
LDMIA r11, {r4-r8} ; r4=flags, r5->start, r6=size, r7=ins, r8=rem
TST r4, #b_WordAligned
BEQ %FT21
SUB r2, r8, #4
SUBS r2, r2, r7
ADDLT r2, r2, r6
Pull "r4-r8,r11,pc"
21
CLC
SBCS r2, r2, r1 ; r2=rem-ins-1
ADDCC r2, r2, r0 ; if -ve then add size
Pull "r0,r1,r11,pc"
Pull "r4-r8,r11,pc"
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
......
......@@ -35,6 +35,7 @@ $label ORR$cc.S pc, lr, #VFlag
AddError BufferManager_UnableToDetach, "E04"
AddError BufferManager_HandleAlreadyUsed, "E05"
AddError BufferManager_BufferTooSmall, "E06"
AddError BufferManager_BufferNotAligned, "E07"
AddError BufferManager_BadParm, "BadParm"
|
^ ErrorBase_BufferManager
......
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