Mercurial > hg > Members > kono > nitros9-code
changeset 1634:5ecf6e023a64
ioman.asm: Fixed bug where descriptor wasn't being unlinked in I$Detach if V$USRS > 0
fsrqmem.asm: Call now scans system DAT to update D.SysMem
krn.asm/krnp2.asm: fallram.asm moved from krn to krnp2 to make room
author | boisy |
---|---|
date | Mon, 12 Jul 2004 15:03:15 +0000 |
parents | 457765ff46f9 |
children | 8621ecec7368 |
files | level2/modules/ioman.asm level2/modules/kernel/fallram.asm level2/modules/kernel/fsrqmem.asm level2/modules/kernel/krn.asm level2/modules/kernel/krnp2.asm |
diffstat | 5 files changed, 93 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- a/level2/modules/ioman.asm Mon Jul 12 03:19:07 2004 +0000 +++ b/level2/modules/ioman.asm Mon Jul 12 15:03:15 2004 +0000 @@ -28,6 +28,10 @@ * 13r4 2003/04/09 Boisy G. Pitre * Fixed bug where wrong address was being put in V$STAT when driver's * INIT routine was called. +* +* 13r5 2004/07/12 Boisy G. Pitre +* Fixed bug where device descriptor wasn't being unlinked when V$USRS > 0 +* due to the value in X not being loaded. nam IOMan ttl NitrOS-9 Level 2 I/O Manager module @@ -40,7 +44,7 @@ tylg set Systm+Objct atrv set ReEnt+rev -rev set $04 +rev set $05 edition set 13 mod eom,name,tylg,atrv,start,size @@ -527,7 +531,7 @@ rts IDetach ldu R$U,u -* ldx V$DESC,u + ldx V$DESC,u this was incorrectly commented out in 13r4!! *** BUG FIX * The following two lines fix a long-standing bug in IOMan where * the I$Detach routine would deallocate the V$STAT area. This is @@ -573,10 +577,11 @@ addd #$00FF round up one page clrb clear lo byte os9 F$SRtMem return mem + +* Code here appears to be for Level III? + IFGT Level-2 ldx $01,s get old U on stack ldx V$DESC,x -* Code here appears to be for Level III? - IFGT Level-2 ldd M$Port,x beq L032B lbsr L01D1 @@ -648,6 +653,7 @@ sta P$State,x ENDC ENDC + L032B puls u,b ldx V$DESC,u get descriptor in X clr V$DESC,u clear out descriptor
--- a/level2/modules/kernel/fallram.asm Mon Jul 12 03:19:07 2004 +0000 +++ b/level2/modules/kernel/fallram.asm Mon Jul 12 15:03:15 2004 +0000 @@ -14,12 +14,12 @@ ldx <D.BlkMap Get ptr to start of block map L0974 leay ,x Point Y to current block ldb ,s Get # blocks requested -L0978 cmpx <D.BlkMap+2 Hit end of map yet? +srchblk cmpx <D.BlkMap+2 Hit end of map yet? bhs L0995 Yes, exit with No RAM error lda ,x+ Get block marker bne L0974 Already used, start over with next block up decb Dec # blocks still needed - bne L0978 Still more, keep checking + bne srchblk Still more, keep checking * Entry: Y=ptr to start of memory found * Note: Due to fact that block map always starts @ $200 (up to $2FF), we * don't need to calc A @@ -63,4 +63,3 @@ bne L09AB Still more needed, keep checking tfr x,y Found enough contigous blocks, move ptr to Y bra L0983 Go mark blocks as used, & return info to caller -
--- a/level2/modules/kernel/fsrqmem.asm Mon Jul 12 03:19:07 2004 +0000 +++ b/level2/modules/kernel/fsrqmem.asm Mon Jul 12 15:03:15 2004 +0000 @@ -3,8 +3,18 @@ * * Function: Request memory * -* It also updates 8K DAT blocks-if it finds an empty block, it re-does the 32 -* entries in the SMAP table to indicate that they are free +* F$SRqMem allocates memory from the system's 64K address space in 256 byte 'pages.' +* There are 256 of these '256 byte pages' in the system's RAM area (256*256=64K). +* The allocation map, pointed to by D.SysMem holds one byte per page, making the +* allocation map itself 256 bytes in size. +* +* Memory is allocated from the top of the system RAM map downwards. Rel/Boot/Krn +* also reside in this area, and are loaded from $ED00-$FFFF. Since this area is +* always allocated, we start searching for free pages from page $EB downward. +* +* F$SRqMem also updates the system memory map according to 8K DAT blocks. If an +* empty block is found, this routine re-does the 32 entries in the SMAP table to +* indicate that they are free. * * Input: D = Byte count * @@ -12,50 +22,54 @@ * * Error: CC = C bit set; B = error code * -FSRqMem ldd R$D,u get size requested - addd #$00FF round it up to nearest 256 byte page - clrb just keep # of pages (and start 8K block #) +FSRqMem ldd R$D,u get memory allocation size requested + addd #$00FF round it up to nearest 256 byte page (e.g. $1FF = $2FE) + clrb just keep # of pages (and start 8K block #, e.g. $2FE = $200) std R$D,u save rounded version back to user - IFGT Level-1 ldy <D.SysMem get ptr to SMAP table - leay $ED,y - ENDC - +* leay Bt.Start/256,y * leay $20,y skip Block 0 (always reserved for system) * Change to pshs a,b:use 1,s for block # to check, and ,s for TFM spot * incb skip block 0 (always reserved for system) pshs d reserve a byte & put 0 byte on stack - * This loop updates the SMAP table if anything can be marked as unused -*L082F ldx <D.SysDAT get pointer to system DAT block list -* lslb adjust block offset for 2 bytes/entry -* ldd b,x get block type/# from system DAT -* cmpd #DAT.Free Unused block? -* beq L0847 yes, mark it free in SMAP table -* ldx <D.BlkMap No, get ptr to MMAP table -* lda d,x Get block marker for 2 meg mem map -* cmpa #RAMinUse Is it in use (not free, ROM or used by module)? -* bne L0848 No, mark it as type it is in SMAP table -* leay $20,y Yes, move to next block in pages -* bra L084F move to next block & try again - -*L0847 clra Byte to fill system page map with (0=Not in use) -*L0848 sta ,s Put it on stack -* ldw #$0020 Get size of 8K block in pages -* tfm s,y+ Mark entire block's worth of pages with A -*L084F inc 1,s Bump up to next block to check -* ldb 1,s Get it -* cmpb #8 Done whole 64k system space? -* blo L082F no, keep checking +L082F ldx <D.SysDAT get pointer to system DAT block list + lslb adjust block offset for 2 bytes/entry + ldd b,x get block type/# from system DAT + cmpd #DAT.Free Unused block? + beq L0847 yes, mark it free in SMAP table + ldx <D.BlkMap No, get ptr to MMAP table + lda d,x Get block marker for 2 meg mem map + cmpa #RAMinUse Is it in use (not free, ROM or used by module)? + bne L0848 No, mark it as type it is in SMAP table + leay 32,y Yes, move to next block in pages + bra L084F move to next block & try again +* Free RAM: +L0847 clra Byte to fill system page map with (0=Not in use) +* NOT! RAMinUse: + IFNE H6309 +L0848 sta ,s Put it on stack + ldw #$0020 Get size of 8K block in pages + tfm s,y+ Mark entire block's worth of pages with A + ELSE +L0848 ldb #32 count = 32 pages +L084A sta ,y+ mark the RAM + decb + bne L084A + ENDC +L084F inc 1,s Bump up to next block to check + ldb 1,s Get it + cmpb #DAT.BlCt Done whole 64k system space? + blo L082F no, keep checking * Now we can actually attempt to allocate the system RAM requested * NOTE: Opt for Coco/TC9 OS9 ONLY: skip last 17 pages with leay -17,y since -* they are: Kernal (REL/BOOT/OS9P1 - 15 pages), vector RAM & I/O (2 pages) +* they are: Kernel (REL/BOOT/OS9P1 - 15 pages), vector RAM & I/O (2 pages) * (Already permanently marked @ L01D2) * At the start, Y is pointing to the end of the SMAP table+1 ldx <D.SysMem Get start of table ptr - ldb #$20 skip block 0: it's always full + ldb #32 skip block 0: it's always full abx same size, but faster than leax $20,x -* leay -17,y Skip Kernel, Vector RAM & I/O (Can't be free) + leay -17,y Skip Kernel, Vector RAM & I/O (Can't be free) L0857 ldb R$A,u Get # 256 byte pages requested * Loop (from end of system mem map) to look for # continuous pages requested L0859 equ * @@ -94,8 +108,9 @@ lbsr L09BE Allocate an image with our start/end block #'s bcs L0894 Couldn't, exit with error ldb R$A,u Get # pages requested - lda #RAMinUse Get SMAP in use flag -L088A sta ,y+ Mark all the pages requested as In Use +* lda #RAMinUse Get SMAP in use flag +*L088A sta ,y+ Mark all the pages requested as In Use +L088A inc ,y+ Since RAMinUse is 1, we can save space by INC'ing from 0->1 decb bne L088A lda 1,s Get MSB of ptr to start of newly allocated Sys RAM @@ -210,7 +225,8 @@ * * Error: CC = C bit set; B = error code * -FBoot lda #'t tried to boot +FBoot + lda #'t tried to boot jsr <D.BtBug coma Set boot flag lda <D.Boot we booted once before? @@ -287,18 +303,17 @@ L092D ldd M$ID,x get module ID cmpd #M$ID12 legal ID? bne L0954 no, keep looking + ldd M$Name,x find name offset pointer pshs x leax d,x +name.prt lda ,x+ get first character of the name + jsr <D.BtBug print it out + bpl name.prt + lda #C$SPAC a space + jsr <D.BtBug + puls x - bsr name.prt -*name.prt lda ,x+ get first character of the name -* jsr <D.BtBug print it out -* bpl name.prt -* lda #C$SPAC a space -* jsr <D.BtBug - - puls x IFNE H6309 ldd ,s offset into block subr d,x make X=offset into block @@ -331,12 +346,3 @@ leas 4,s purge stack clrb rts - - -name.prt lda ,x+ get first character of the name - jsr <D.BtBug print it out - bpl name.prt - lda #C$SPAC a space - jsr <D.BtBug - rts -
--- a/level2/modules/kernel/krn.asm Mon Jul 12 03:19:07 2004 +0000 +++ b/level2/modules/kernel/krn.asm Mon Jul 12 15:03:15 2004 +0000 @@ -17,6 +17,10 @@ * * 19r8 2004/05/22 Boisy G. Pitre * Renamed to 'krn' +* +* 19r9 2004/07/12 Boisy G. Pitre +* F$SRqMem now properly scans the DAT images of the system to update +* the D.SysMem map. nam krn ttl NitrOS-9 Level 2 Kernel @@ -26,7 +30,7 @@ ENDC * defines for customizations -Revision set 8 module revision +Revision set 9 module revision Edition set 19 module Edition Where equ $F000 absolute address of where Kernel starts in memory @@ -37,12 +41,15 @@ * FILL - all unused bytes are now here fcc /www.katvixen.com/ + fcc /www.katvixen.com/ + fcc /www.katvixen.com/ IFNE H6309 - fcc /0123456789ABCDEF/ - fcc /0123456789ABCDEF/ - fcc /0123456/ + fcc /www.katvixen.com/ + fcc /www.katvixen.com/ + fcc /www.katvixen.c/ ELSE - fcc /012345678/ + fcc /www.katvixen.com/ + fcc /01/ ENDC * Might as well have this here as just past the end of Kernel... @@ -368,7 +375,7 @@ bne L0127 L0170 ldx #Bt.Start start address of the boot track in memory - lda #$12 size of the boot track: B=$00 from L0127 loop, above + lda #18 size of the boot track: B=$00 from L0127 loop, above lbsr I.VBlock go verify it bsr L01D2 go mark system map @@ -399,7 +406,7 @@ * Mark kernel in system memory map as used memory (256 byte blocks) L01D2 ldx <D.SysMem Get system mem ptr - ldd #NotRAM*256+$ED $ED00 is the start of the boot + ldd #NotRAM*256+(Bt.Start/256) B = MSB of start of the boot abx point to Bt.Start - start of boot track comb we have $FF-$ED pages to mark as used sta b,x Mark I/O as not RAM @@ -454,8 +461,6 @@ ENDC fcb F$Move+SysState fdb FMove-*-2 - fcb F$AllRAM - fdb FAllRAM-*-2 fcb F$AllImg+SysState fdb FAllImg-*-2 fcb F$SetImg+SysState @@ -488,8 +493,6 @@ fdb FELink-*-2 fcb F$FModul+SysState fdb FFModul-*-2 - fcb F$AlHRAM+SysState - fdb FAlHRAM-*-2 fcb F$VBlock+SysState fdb FVBlock-*-2 IFNE H6309 @@ -723,7 +726,7 @@ use fsrqmem.asm - use fallram.asm +* use fallram.asm IFNE H6309 @@ -947,7 +950,7 @@ ENDC MapGrf equ * IFNE H6309 - aim #$fe,<D.TINIT switch GIME shadow to system state + aim #$FE,<D.TINIT switch GIME shadow to system state lda <D.TINIT set GIME again just in case timer is used ELSE lda <D.TINIT
--- a/level2/modules/kernel/krnp2.asm Mon Jul 12 03:19:07 2004 +0000 +++ b/level2/modules/kernel/krnp2.asm Mon Jul 12 15:03:15 2004 +0000 @@ -243,6 +243,10 @@ svctab fcb F$UnLink fdb FUnLink-*-2 + fcb F$AllRAM + fdb FAllRAM-*-2 + fcb F$AlHRAM+SysState + fdb FAlHRAM-*-2 fcb F$Fork fdb FFork-*-2 fcb F$Wait @@ -369,6 +373,8 @@ use fsleep.asm + use fallram.asm + use fsprior.asm use fid.asm