Jun 25, 1999 onl50t: Solaris 2.6 cc ドライバのデバッグ. cc ドライバのデバッグ#01(その4) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (http://www-online.kek.jp/~inoue/CAMAC/ onl50t-sol2.6/Desktop/debug-step04.txt) 高エネルギー加速器研究機構 素粒子原子核研究所 物理、オンライングループ 井上 栄二 (1). 現状確認 (A). 株式会社ロジックハウスの白田様より SPARC CPU-50T を借用した。 (B). FORCE,CPU-50(UltraSPARC-IIi 300MHz)、に Solaris2.6 のシステムを インストールした。 (C). /etc の下の各設定、および /export/home の作成をやった。 (D). "Solaris2.6 Hardware: 5/98 SMCC Desktop 日本語版 SPARC版"では ディスクレス・クライアントを設定することはできないことを確認した。 (E). CPU-50T に Solaris2.6用の VMEドライバ、FRCvme-2.3.1 をインストール した。 (F). onl50t に ccドライバをインストールした。 (G). サンプル・プログラムを実行した。 (1). cam1、シングル・アクション 24ビット camac read/write の実行 NG. システムはパニックを起こしてリブートしてしまう。 (2). cam3、camac LAM割り込み処理の実行 NG. システムはパニックを起こしてリブートしてしまう。 (3). cam2、ブロック転送 16ビット read/write の実行 ok. 正常に実行できた。 (4). cam2、ブロック転送 24ビット read/write の実行 ok. 正常に実行できた。 (H). クラッシュ時の savecoreファイルを入手してデバッグを始めた。 (I). cam1プログラムのデバッグ、icc_ioctlルーチンを修正した。 ok. cam1プログラムは正常に実行できた。 (J). cam3プログラムのデバッグを始めた。 camac_s()ルーチンの中で "cc->k->dhr = *dat;" を実行したところでエラーになっている。 message構造体をcc_device構造体の中に入れてみたが改善されない。 (2). ここでやるべきこと cam3プログラムのデバッグをする(その2)。 kmem_alloc()を使ってみる。 (3). kmem_alloc()の使用 Dynamic Memory Allocation Device drivers must be prepared to simultaneously handle all attached devices that they claim to drive. There should be no driver limit on the number of devices that the driver handles, and all per-device information must be dynamically allocated. void *kmem_alloc(size_t size, int flag); The standard kernel memory allocation routine is kmem_alloc(9F). It is similar to the C library routine malloc(3C), with the addition of the flag argument. The flag argument can be either KM_SLEEP or KM_NOSLEEP, indicating whether the caller is willing to block if the requested size is not available. If KM_NOSLEEP is set, and memory is not available, kmem_alloc(9F) returns NULL. kmem_zalloc(9F) is similar to kmem_alloc(9F), but also clears the contents of the allocated memory. ---------------------------------------------------------------------------- Note. Kernel memory is a limited resource, not pageable, and competes with user applications and the rest of the kernel for physical memory. Drivers that allocate a large amount of kernel memory may cause system performance to degrade. ---------------------------------------------------------------------------- void kmem_free(void *cp, size_t size); Memory allocated by kmem_alloc(9F) or by kmem_zalloc(9F) is returned to the system with kmem_free(9F). This is similar to the C library routine free(3C), with the addition of the size argument. Drivers must keep track of the size of each object they allocate in order to call kmem_free(9F) later. ---- Storage Classes of Driver Data The storage class of data is a guide to whether the driver might need to take explicit steps to control access to the data. There are three types of data storage classes: Automatic (stack) data - Because every thread has a private stack, drivers never need to lock automatic variables. Global and static data - Global and static data can be shared by any number of threads in the driver; the driver might need to lock this type of data at times. Kernel heap data - Any number of threads in the driver might share kernel heap data, such as data allocated by kmem_alloc(9F). If this data is shared, the driver might need to protect it at times. --- Kernel Functions for Drivers kmem_alloc(9F) NAME kmem_alloc, kmem_zalloc, kmem_free - allocate kernel memory SYNOPSIS #include #include void *kmem_alloc(size_t size, int flag); void *kmem_zalloc(size_t size, int flag); void kmem_free(void *buf, size_t size); INTERFACE LEVEL Architecture independent level 1 (DDI/DKI). ARGUMENTS size Number of bytes to allocate. flag Determines whether caller can sleep for memory. Possible flags are KM_SLEEP to allow sleeping until memory is available, or KM_NOSLEEP to return NULL immediately if memory is not available. buf Pointer to allocated memory. DESCRIPTION kmem_alloc() allocates size bytes of kernel memory and returns a pointer to the allocated memory. The allocated memory is at least double-word aligned, so it can hold any C data structure. No greater alignment can be assumed. flag determines whether the caller can sleep for memory. KM_SLEEP allocations may sleep but are guaranteed to succeed. KM_NOSLEEP allocations are guaranteed not to sleep but may fail (return NULL) if no memory is currently avail- able. The initial contents of memory allocated using kmem_alloc() are random garbage. kmem_zalloc() is like kmem_alloc() but returns zero-filled memory. kmem_free() frees previously allocated kernel memory. The buffer address and size must exactly match the original allocation. Memory cannot be returned piecemeal. RETURN VALUES If successful, kmem_alloc() and kmem_zalloc() return a pointer to the allocated memory. If KM_NOSLEEP is set and memory cannot be allocated without sleeping, kmem_alloc() and kmem_zalloc() return NULL. SunOS 5.6 Last change: 20 Jul 1994 1 Kernel Functions for Drivers kmem_alloc(9F) CONTEXT kmem_alloc() and kmem_zalloc() can be called from interrupt context only if the KM_NOSLEEP flag is set. They can be called from user context with any valid flag. kmem_free() can be called from user or interrupt context. SEE ALSO copyout(9F), freerbuf(9F), getrbuf(9F) Writing Device Drivers WARNINGS Memory allocated using kmem_alloc() is not paged. Available memory is therefore limited by the total physical memory on the system. It is also limited by the available kernel vir- tual address space, which is often the more restrictive con- straint on large-memory configurations. Excessive use of kernel memory is likely to affect overall system performance. Overcommitment of kernel memory will cause the system to hang or panic. Misuse of the kernel memory allocator, such as writing past the end of a buffer, using a buffer after freeing it, free- ing a buffer twice, or freeing a null or invalid pointer, will corrupt the kernel heap and may cause the system to corrupt data and/or panic. The initial contents of memory allocated using kmem_alloc() are random garbage. This random garbage may include secure kernel data. Therefore, uninitialized kernel memory should be handled carefully. For example, never copyout(9F) a potentially uninitialized buffer. NOTES kmem_alloc(0, flag) always returns NULL. kmem_free(NULL, 0) is legal. SunOS 5.6 Last change: 20 Jul 1994 2 --- Kernel Functions for Drivers bioinit(9F) NAME bioinit - initialize a buffer structure SYNOPSIS #include #include void bioinit(struct buf *bp); INTERFACE LEVEL Solaris DDI specific (Solaris DDI). ARGUMENTS bp Pointer to the buffer header structure. DESCRIPTION The bioinit() function initializes a buf(9S) structure. A buffer structure contains state information which has to be initialized if the memory for the buffer was allocated using kmem_alloc(9F). This is not necessary for a buffer allo- cated using getrbuf(9F) because getrbuf() will call bioinit() directly. CONTEXT The bioinit() function can be called from any context. EXAMPLES struct buf *bp = kmem_alloc(biosize(), KM_SLEEP); bioinit(bp); /* use buffer */ SEE ALSO biofini(9F), bioreset(9F), biosize(9F), getrbuf(9F), kmem_alloc(9F), buf(9S) Writing Device Drivers SunOS 5.6 Last change: 20 Nov 1996 1 --- Kernel Functions for Drivers biofini(9F) NAME biofini - uninitialize a buffer structure SYNOPSIS #include #include void biofini(struct buf *bp); INTERFACE LEVEL Solaris DDI specific (Solaris DDI). ARGUMENTS bp Pointer to the buffer header structure. DESCRIPTION The biofini() function uninitializes a buf(9S) structure. If a buffer structure has been allocated and initialized using kmem_alloc(9F) and bioinit(9F) it needs to be uninitialized using biofini() before calling kmem_free(9F). It is not necessary to call biofini() before freeing a buffer struc- ture using freerbuf(9F) because freerbuf() will call biofini() directly. CONTEXT The biofini() function can be called from any context. EXAMPLES struct buf *bp = kmem_alloc(biosize(), KM_SLEEP); bioinit(bp); /* use buffer */ biofini(bp); kmem_free(bp, biosize()); SEE ALSO bioinit(9F), bioreset(9F), biosize(9F), freerbuf(9F), kmem_alloc(9F), kmem_free(9F), buf(9S) Writing Device Drivers SunOS 5.6 Last change: 20 Nov 1996 1 --- (4). kmem_alloc()を使用する前に camac_s()ルーチンを細かく見直してみる camac_s()ルーチン中にトレース用の文を追加する。 onl50t[45]% vi cc.c : static int camac_s(int unit, u_short mode, u_short naf, u_short *dat) { register struct cc_device *cc; /* register struct K_REG *k = cc->k; */ : case 0x0010: /* CAMAC write */ /* E.Inoue: from */ cmn_err(CE_NOTE," camac_s: debug step02. --- camac write"); /* E.Inoue: end */ cc->k->csr |= CC_WRITE; /* E.Inoue: from */ cmn_err(CE_NOTE," camac_s: debug step03. --- camac write, cc->k->csr |= CC_W RITE; ok."); /* E.Inoue: end */ cc->k->csr |= CC_GO; /* Go! */ /* E.Inoue: from */ cmn_err(CE_NOTE," camac_s: debug step04. --- camac write, cc->k->csr |= CC_G O; ok."); /* E.Inoue: end */ while ((cc->k->csr & (CC_RDY|CC_ERR)) == 0 && counter < CC_TIMEOUT_SINGL E) counter++; if ((cc->k->csr & CC_RDY) != 0) { if ((mode & CC_BIT16) == 0) { /* E.Inoue: from */ cmn_err(CE_NOTE," camac_s: debug step05. --- camac write, enter (mode & CC_B IT16) == 0) ok."); /* E.Inoue: end */ cc->k->dhr = *dat; /* E.Inoue: from */ cmn_err(CE_NOTE," camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok."); /* E.Inoue: end */ cc->k->dlr = *(dat + 1); /* E.Inoue: from */ cmn_err(CE_NOTE," camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok."); /* E.Inoue: end */ } else { /* E.Inoue: from */ cmn_err(CE_NOTE," camac_s: debug step08. --- camac write, enter (mode & CC_B IT16) != 0) ok."); /* E.Inoue: end */ cc->k->dlr = *dat; /* E.Inoue: from */ cmn_err(CE_NOTE," camac_s: debug step09. --- camac write, cc->k->dlr = *dat; ok."); /* E.Inoue: end */ } } break; default: /* NDT */ /* E.Inoue: from */ cmn_err(CE_NOTE," camac_s: debug step09. --- camac write, enter default "); /* E.Inoue: end */ cc->k->csr |= CC_GO; /* Go! */ break; } /* E.Inoue: from */ cmn_err(CE_NOTE," camac_s: debug step10. --- finish camac write"); /* E.Inoue: end */ while ((cc->k->csr & (CC_DONE | CC_ERR)) == 0 && counter < CC_TIMEOUT_SINGLE ) counter++; cc->camac_qx = cc->k->csr; if (counter >= CC_TIMEOUT_SINGLE) { : "cc.c" 2987 lines, 76954 characters onl50t[46]% make ./script/cc_build.sh [Building for sun4u] rm -f cc.o onl50t[47]% su Password: # csh onl50t# source /.cshrc onl50t# make unload ./script/cc_unload.sh [Removing CAMAC device driver] [Removing CAMAC device driver from system] [Deleting CAMAC device files] onl50t# make load ./script/cc_load.sh [Installing CAMAC device driver] [Adding CAMAC device driver to system] [Configuring CAMAC device driver] [Making CAMAC device files] sun4u onl50t# # onl50t[48]% onl50t[48]% cam3 cam3: cam3 begin cam3: CAM_Open ok. cam3: CSETBR ok. cam3: CSETCR ok. cam3: CGENC ok. cam3: CGENZ ok. cam3: CREMI ok. cam3: nafenalam ok. cam3プログラムはここでフリーズした。 システムはパニックを起こしてリブートしてしまった。 以下はコンソール上のメッセージ。 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_ioctl: debug step01. --- enter case CCIOC_ENABLE_LAM NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. 02ef7c8 addr=0x4 mmu_fsr=0x0 BAD TRAP occurred in module "cc" due to an illegal access to a user address. cam3: trap type = 0x31 addr=0x4 pid=423, pc=0x6095a768, sp=0x302ef858, tstate=0x4400001e02, context=0x308 g1-g7: 104124c8, 393d, 60c81418, 360, 0, 0, 60cccf40 Begin traceback... sp = 302ef858 Called from 60954010, fp=302ef8d0, args=0 0 3db1 4 0 60d8c000 Called from 100740d0, fp=302ef948, args=f00000 80046304 effff95c 100003 6004db60 60d8c000 Called from 10055f70, fp=302efa18, args=608212e0 302efa78 60cf9ba8 0 0 0 Called from 1002ec94, fp=302efa80, args=60821278 302efae0 104265a4 effff90c 0 0 Called from 11688, fp=effff8b8, args=3 80046304 effff95c effff90c 0 0 End traceback... panic[cpu0]/thread=0x60cccf40: trap syncing file systems... 4 1 done 3057 static and sysmap kernel pages 36 dynamic kernel data pages 258 kernel-pageable pages 0 segkmap kernel pages 0 segvn kernel pages 93 current user process pages 3444 total pages (3444 chunks) dumping to vp 601de4cc, offset 482822 3444 total pages, dump succeeded rebooting... Resetting ... FORCE,CPU-50(UltraSPARC-IIi 300MHz), No Keyboard OpenBoot 3.10.6, 256 MB memory installed, Serial #9180267. Ethernet address 0:80:42:b:a4:6b, Host ID: 808c146b. Executing last command: boot Drive not ready Boot device: net File and args: ok boot disk3 -r Boot device: /pci@1f,0/scsi@4/disk@3,0 File and args: -r SunOS Release 5.6 Version Generic_105181-05 [UNIX(R) System V Release 4.0] Copyright (c) 1983-1997, Sun Microsystems, Inc. configuring network interfaces: hme0. Hostname: onl50t The / file system (/dev/rdsk/c0t3d0s0) is being checked. /dev/rdsk/c0t3d0s0: 3960 files, 168950 used, 736910 free /dev/rdsk/c0t3d0s0: (398 frags, 92064 blocks, 0.0% fragmentation) The /usr file system (/dev/rdsk/c0t3d0s6) is being checked. /dev/rdsk/c0t3d0s6: 28673 files, 546573 used, 3798783 free /dev/rdsk/c0t3d0s6: (1903 frags, 474610 blocks, 0.0% fragmentation) Configuring the /devices directory FRCvme V2.3.1 VME Nexus ( Universe) NOTICE: VME: slavewin at vme=0x0, size=0x100000 space=0x302061f CAMAC device driver V1.3x, 1991-1993 by Y.TAKEUCHI (T.I.T.) cc0 at vme0: vme16d16 0xff00 VME level 4 vector 0xff sparc ipl 7 vmeplus0 at vme0: vme16d16 0x0 and vme24d16 0x0 and vme32d16 0x0 and vme16d32 0x 0 and vme24d32 0x0 and vme32d32 0x0 and space 0x2f offset 0x0 and space 0x6f offset 0x0 and space 0x10 offset 0x0 and space 0x11 offset 0x0 and space 0x50 offset 0x0 and space 0x51 offset 0x0 vmedma0 at vme0 vmefdma0 at vme0 vmedvma0 at vme0 vmectl0 at vme0 Configuring the /dev directory Configuring the /dev directory (compatibility devices) The system is coming up. Please wait. checking ufs filesystems /dev/rdsk/c0t3d0s5: is stable. /dev/rdsk/c0t3d0s4: is stable. /dev/rdsk/c0t3d0s7: is stable. /dev/rdsk/c0t3d0s3: 707 files, 30241 used, 641433 free /dev/rdsk/c0t3d0s3: (209 frags, 80153 blocks, 0.0% fragmentation) checking for crash dump...System went down at Thu Jun 24 14:47:28 1999 Saving 3444 pages of image in vmcore.13 3444 pages saved. Processing modules: Done. Constructing Namelist file: /var/crash/onl50t/unix.13 Namelist file complete. add net default: gateway ICCFP1 NIS domainname is kek.jp starting rpc services: rpcbind keyserv done. Setting netmask of hme0 to 255.255.248.0 Setting default interface for multicast: add net 224.0.0.0: gateway onl50t syslog service starting. Print services started. starting Kana-Kanji converters: cssd. volume management starting. Wnn6: Key License Server started.... Nihongo Multi Client Server (Wnn6 R2.30) Finished Reading Files The system is ready. onl50t console login: cc_writeルーチンをトレースする onl50t[51]% vi cc.c : cc->naf = naf = cc->message.naf; /* save iov, uio */ iovs->iov_base = iov->iov_base; iovs->iov_len = iov->iov_len; uios->uio_iovcnt = uio->uio_iovcnt; uios->uio_offset = uio->uio_offset; uios->uio_segflg = uio->uio_segflg; uios->uio_resid = uio->uio_resid; /* E.Inoue: from */ cmn_err(CE_NOTE," cc_write: debug step1. --- naf = 0x%x", naf); /* E.Inoue: end */ : "cc.c" 2991 lines, 77062 characters onl50t[52]% make ./script/cc_build.sh [Building for sun4u] rm -f cc.o onl50t[53]% onl50t[41]% cam3 cam3: cam3 begin cam3: CAM_Open ok. cam3: CSETBR ok. cam3: CSETCR ok. cam3: CGENC ok. cam3: CGENZ ok. cam3: CREMI ok. cam3: nafenalam ok. cam3プログラムはここでフリーズした。 システムはパニックを起こしてリブートしてしまった。 以下はコンソール上のメッセージ。 NOTICE: cc_write: debug step1. --- naf = 0x3c01 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c11 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c01 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c11 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c01 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c11 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x61a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_ioctl: debug step01. --- enter case CCIOC_ENABLE_LAM NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. bd7c8 addr=0x4 mmu_fsr=0x0 BAD TRAP occurred in module "cc" due to an illegal access to a user address. cam3: trap type = 0x31 addr=0x4 pid=464, pc=0x60962790, sp=0x301bd858, tstate=0x4400001e00, context=0x343 g1-g7: 104124c8, 176a4, 60884c38, 360, 0, 0, 60b7ee00 Begin traceback... sp = 301bd858 Called from 6095c038, fp=301bd8d0, args=0 0 3db1 4 0 60d86000 Called from 100740d0, fp=301bd948, args=f00000 80046304 effff95c 100003 6004daa0 60d86000 Called from 10055f70, fp=301bda18, args=60b992c8 301bda78 60ceb900 0 0 0 Called from 1002ec94, fp=301bda80, args=60b99260 301bdae0 104265a4 effff90c 0 0 Called from 11688, fp=effff8b8, args=3 80046304 effff95c effff90c 0 0 End traceback... panic[cpu0]/thread=0x60b7ee00: trap syncing file systems... [1] 4 1 done 3063 static and sysmap kernel pages 33 dynamic kernel data pages 255 kernel-pageable pages 0 segkmap kernel pages 0 segvn kernel pages 91 current user process pages 3442 total pages (3442 chunks) dumping to vp 601de4cc, offset 482854 3442 total pages, dump succeeded rebooting... Resetting ... FORCE,CPU-50(UltraSPARC-IIi 300MHz), No Keyboard OpenBoot 3.10.6, 256 MB memory installed, Serial #9180267. Ethernet address 0:80:42:b:a4:6b, Host ID: 808c146b. Executing last command: boot Drive not ready Boot device: net File and args: ok boot disk3 -r Boot device: /pci@1f,0/scsi@4/disk@3,0 File and args: -r SunOS Release 5.6 Version Generic_105181-05 [UNIX(R) System V Release 4.0] Copyright (c) 1983-1997, Sun Microsystems, Inc. configuring network interfaces: hme0. Hostname: onl50t The / file system (/dev/rdsk/c0t3d0s0) is being checked. /dev/rdsk/c0t3d0s0: INCORRECT BLOCK COUNT I=444886 (4 should be 0) (CORRECTED) /dev/rdsk/c0t3d0s0: FREE BLK COUNT(S) WRONG IN SUPERBLK (SALVAGED) /dev/rdsk/c0t3d0s0: 3962 files, 197549 used, 708311 free /dev/rdsk/c0t3d0s0: (391 frags, 88490 blocks, 0.0% fragmentation) The /usr file system (/dev/rdsk/c0t3d0s6) is being checked. /dev/rdsk/c0t3d0s6: 28673 files, 546574 used, 3798782 free /dev/rdsk/c0t3d0s6: (1902 frags, 474610 blocks, 0.0% fragmentation) Configuring the /devices directory FRCvme V2.3.1 VME Nexus ( Universe) NOTICE: VME: slavewin at vme=0x0, size=0x100000 space=0x302061f CAMAC device driver V1.3x, 1991-1993 by Y.TAKEUCHI (T.I.T.) cc0 at vme0: vme16d16 0xff00 VME level 4 vector 0xff sparc ipl 7 vmeplus0 at vme0: vme16d16 0x0 and vme24d16 0x0 and vme32d16 0x0 and vme16d32 0x 0 and vme24d32 0x0 and vme32d32 0x0 and space 0x2f offset 0x0 and space 0x6f offset 0x0 and space 0x10 offset 0x0 and space 0x11 offset 0x0 and space 0x50 offset 0x0 and space 0x51 offset 0x0 vmedma0 at vme0 vmefdma0 at vme0 vmedvma0 at vme0 vmectl0 at vme0 Configuring the /dev directory Configuring the /dev directory (compatibility devices) The system is coming up. Please wait. checking ufs filesystems /dev/rdsk/c0t3d0s5: is stable. /dev/rdsk/c0t3d0s4: is stable. /dev/rdsk/c0t3d0s7: is stable. /dev/rdsk/c0t3d0s3: 707 files, 30242 used, 641432 free /dev/rdsk/c0t3d0s3: (208 frags, 80153 blocks, 0.0% fragmentation) checking for crash dump...System went down at Thu Jun 24 16:09:22 1999 Saving 3442 pages of image in vmcore.14 3442 pages saved. Processing modules: Done. Constructing Namelist file: /var/crash/onl50t/unix.14 Namelist file complete. add net default: gateway ICCFP1 NIS domainname is kek.jp starting rpc services: rpcbind keyserv done. Setting netmask of hme0 to 255.255.248.0 Setting default interface for multicast: add net 224.0.0.0: gateway onl50t syslog service starting. Print services started. starting Kana-Kanji converters: cssd. volume management starting. Wnn6: Key License Server started.... Nihongo Multi Client Server (Wnn6 R2.30) Finished Reading Files The system is ready. onl50t console login: nafenalamの実行では camac_a()ルーチン中では cc->k->dhr = *dat; cc->k->dhr = *(dat + 1); の個所を実行することはない。 したがって、チェックの対象からはずす。 CGENC、CGENZ、CREMIの実行ではcc_write()ルーチンを通ったあと camac_a() ルーチン中で上記の個所を実行する。 しかし、この場合には何もエラーを 起こすことなく正常に実行されている。 cc_write() man のチェック Kernel Functions for Drivers copyin(9F) NAME copyin - copy data from a user program to a driver buffer SYNOPSIS #include #include int copyin(const void *userbuf, void *driverbuf, size_t cn); INTERFACE LEVEL Architecture independent level 1 (DDI/DKI). ARGUMENTS userbuf User program source address from which data is transferred. driverbuf Driver destination address to which data is transferred. cn Number of bytes transferred. DESCRIPTION copyin() copies data from a user program source address to a driver buffer. The driver developer must ensure that ade- quate space is allocated for the destination address. Addresses that are word-aligned are moved most efficiently. However, the driver developer is not obligated to ensure alignment. This function automatically finds the most effi- cient move according to address alignment. RETURN VALUES Under normal conditions a 0 is returned indicating a suc- cessful copy. Otherwise, a -1 is returned if one of the following occurs: o paging fault; the driver tried to access a page of memory for which it did not have read or write access o invalid user address, such as a user area or stack area o invalid address that would have resulted in data being copied into the user block If a -1 is returned to the caller, driver entry point rou- tines should return EFAULT. CONTEXT copyin() can be called from user context only. SunOS 5.6 Last change: 1 May 1996 1 Kernel Functions for Drivers copyin(9F) EXAMPLES A driver ioctl(9E) routine (line 10) can be used to get or set device attributes or registers. In the XX_GETREGS con- dition (line 17), the driver copies the current device register values to a user data area (line 18). If the specified argument contains an invalid address, an error code is returned. 1 struct device { /* layout of physical device registers */ 2 int control; /* physical device control word */ 3 int status; /* physical device status word */ 4 short recv_char; /* receive character from device */ 5 short xmit_char; /* transmit character to device */ 6 }; 7 8 extern struct device xx_addr[]; /* phys. device regs. location */ 9 . . . 10 xx_ioctl(dev_t dev, int cmd, int arg, int mode, 11 cred_t *cred_p, int *rval_p) 12 ... 13 { 14 register struct device *rp = &xx_addr[getminor(dev) >> 4]; 15 switch (cmd) { 16 17 case XX_SETREGS: /* copy device regs. to user program */ 18 if (copyin(arg, rp, sizeof(struct device))) 19 return(EFAULT); 20 break; 21 ... 22 } 23 ... 24 } SEE ALSO ioctl(9E), bcopy(9F), copyout(9F), ddi_copyin(9F), ddi_copyout(9F), uiomove(9F). Writing Device Drivers NOTES Driver writers who intend to support layered ioctls in their ioctl(9E) routines should use ddi_copyin(9F) instead. Driver defined locks should not be held across calls to this function. SunOS 5.6 Last change: 1 May 1996 2 --- Kernel Functions for Drivers ddi_copyin(9F) NAME ddi_copyin - copy data to a driver buffer SYNOPSIS #include #include #include int ddi_copyin(const void *buf, void *driverbuf, size_t cn, int flags); INTERFACE LEVEL Solaris DDI specific (Solaris DDI). ARGUMENTS buf Source address from which data is transferred. driverbuf Driver destination address to which data is transferred. cn Number of bytes transferred. flags Set of flag bits that provide address space infor- mation about buf. DESCRIPTION This routine is designed for use in driver ioctl(9E) rou- tines for drivers that support layered ioctls. ddi_copyin() copies data from a source address to a driver buffer. The driver developer must ensure that adequate space is allo- cated for the destination address. The flags argument is used to determine the address space information about buf. If the FKIOCTL flag is set, this indicates that buf is a kernel address, and ddi_copyin() behaves like bcopy(9F). Otherwise buf is interpreted as a user buffer address, and ddi_copyin() behaves like copyin(9F). Addresses that are word-aligned are moved most efficiently. However, the driver developer is not obliged to ensure alignment. This function automatically finds the most effi- cient move according to address alignment. RETURN VALUES ddi_copyin() returns 0, indicating a successful copy. It returns -1 if one of the following occurs: o paging fault; the driver tried to access a page of memory for which it did not have read or write access SunOS 5.6 Last change: 1 May 1996 1 Kernel Functions for Drivers ddi_copyin(9F) o invalid user address, such as a user area or stack area o invalid address that would have resulted in data being copied into the user block If a -1 is returned to the caller, driver entry point rou- tines should return EFAULT. CONTEXT ddi_copyin() can be called from user or kernel context only. EXAMPLES A driver ioctl(9E) routine (line 12) can be used to get or set device attributes or registers. For the XX_SETREGS con- dition (line 25), the driver copies the user data in arg to the device registers. If the specified argument contains an invalid address, an error code is returned. 1 struct device { /* layout of physical device registers */ 2 int control; /* physical device control word */ 3 int status; /* physical device status word */ 4 short recv_char; /* receive character from device */ 5 short xmit_char; /* transmit character to device */ 6 }; 7 struct device_state { 8 volatile struct device *regsp; /* pointer to device registers */ 9 kmutex_t reg_mutex; /* protect device registers */ . . . 10 }; 11 static void *statep; /* for soft state routines */ 12 xxioctl(dev_t dev, int cmd, int arg, int mode, 13 cred_t *cred_p, int *rval_p) 14 { 15 struct device_state *sp; 16 volatile struct device *rp; 17 struct device reg_buf;/* temporary buffer for registers */ 18 int instance; 19 instance = getminor(dev); 20 sp = ddi_get_soft_state(statep, instance); 21 if (sp == NULL) 22 return (ENXIO); 23 rp = sp->regsp; . . . 24 switch (cmd) { 25 case XX_SETREGS: /* copy data to temp. regs. buf */ 26 if (ddi_copyin(arg, ®_buf, SunOS 5.6 Last change: 1 May 1996 2 Kernel Functions for Drivers ddi_copyin(9F) 27 sizeof (struct device), mode) != 0) { 28 return (EFAULT); 29 } 30 mutex_enter(&sp->reg_mutex); 31 /* 32 * Copy data from temporary device register 33 * buffer to device registers. 34 * e.g. rp->control = reg_buf.control; 35 */ 36 mutex_exit(&sp->reg_mutex); 37 break; 38 } 39 } SEE ALSO ioctl(9E), bcopy(9F), copyin(9F), copyout(9F), ddi_copyout(9F), uiomove(9F) Writing Device Drivers NOTES The value of the flags argument to ddi_copyin() should be passed through directly from the mode argument of ioctl() untranslated. Driver defined locks should not be held across calls to this function. SunOS 5.6 Last change: 1 May 1996 3 (4-1). cc_ioctl()ルーチンの見直し cc_ioctl()ルーチン中で copyin()時に使用している driverbuf をcc_device 構造体の中に入れてみる。 (4-1-1). cc.cファイルを修正 onl50t[52]% vi cc.c : struct cc_device { int status; /* current system status */ int cc_busy; /* true if the device is busy */ : /* add E.Inoue */ int data1; /* end */ } ccdevice[NCC]; : static int cc_ioctl(dev_t dev, int cmd, int arg, int flag, cred_t *cred_p, int *rval_p) { /* register struct cc_device *cc = &ccdevice[0]; */ register struct cc_device *cc; /* register struct K_REG *k = cc->k; */ u_short sdat; /* int idat, *data = (int *)arg; */ /* E.Inoue int idat, data; end */ int idat; int s; minor_t unit; unit = getminor(dev); cc = ddi_get_soft_state(cc_state,unit); /* copyin((caddr_t)arg,(caddr_t)&data,sizeof(data)); */ copyin((caddr_t)arg,(caddr_t)&cc->data1,sizeof(cc->data1)); switch (cmd) { case CCIOC_CHK_BRANCH: /* E.Inoue data = cc->max_branch; */ cc->data1 = cc->max_branch; break; case CCIOC_SET_BRANCH: /* E.inoue if (data >= 0 && data < cc->max_branch) cc->cur_branch = data; */ if (cc->data1 >= 0 && cc->data1 < cc->max_branch) cc->cur_branch = cc->data1; break; case CCIOC_SET_CRATE: /* E.Inoue if (data >= 0 && data < MAX_CRATE) cc->cur_crate = data; */ if (cc->data1 >= 0 && cc->data1 < MAX_CRATE) cc->cur_crate = cc->data1; break; case CCIOC_WAIT_LAM : cc->interrupt = 0; cc->k->lamc = CC_INT_AUTO_CLEAR | CC_INT_ENABLE | intrpri; /* lock out clock */ /* by E.Inoue s = spl5(); */ if (cc->interrupt & CC_INT_LAM) { cc->interrupt &= ~CC_INT_LAM; return 0; } /* mutex_enter(&cc->mutex); */ /* start MUTEX */ /* E.Inoue cc->timeout_id = timeout(cc_timeout, (caddr_t)&unit, data * hz); */ cc->timeout_id = timeout(cc_timeout, (caddr_t)&unit, cc->data1 * hz); mutex_enter(&cc->mutex); /* start MUTEX */ /* wait interrupt */ /* cv_timedwait(&cc->cv, &cc->mutex, timeout); if (cc->interrupt == 0) cc->interrupt |= CC_INT_TIMEOUT; */ if (cv_wait_sig(&cc->cv, &cc->mutex) == 0) { untimeout(cc->timeout_id); mutex_exit(&cc->mutex); /* end MUTEX */ return EINTR; } mutex_exit(&cc->mutex); /* end MUTEX */ /* by E.Inoue splx(s); */ if( cc->interrupt & CC_INT_LAM ) { cc->interrupt &= ~CC_INT_LAM; } else if( cc->interrupt & CC_INT_TIMEOUT ) { cc->interrupt &= ~CC_INT_TIMEOUT; return CC_STA_SINGLE_TIMEOUT; /* set value to "errno" */ } break; case CCIOC_ENABLE_LAM : /* E.Inoue: from */ cmn_err(CE_NOTE," cc_ioctl: debug step01. --- enter case CCIOC_ENABLE_LAM"); /* E.Inoue: end */ /* E.Inoue camac_s(unit, CC_BIT24, NAF(30, 13, 17), (u_short *)data); */ camac_s(unit, CC_BIT24, NAF(30, 13, 17), (u_short *)cc->data1); /* E.Inoue: from */ cmn_err(CE_NOTE," cc_ioctl: debug step01. --- call camac_s(...NAF(30,13,17) ok."); /* E.Inoue: end */ camac_s(unit, CC_BIT16, NAF(30, 0, 1), &sdat); /* E.Inoue: from */ cmn_err(CE_NOTE," cc_ioctl: debug step02. --- call camac_s(...NAF(30,0,1) ok ."); /* E.Inoue: end */ sdat |= 0x100; camac_s(unit, CC_BIT16, NAF(30, 0, 17), &sdat); /* E.Inoue: from */ cmn_err(CE_NOTE," cc_ioctl: debug step03. --- call camac_s(...NAF(30,0,17) o k."); /* E.Inoue: end */ break; case CCIOC_DISABLE_LAM : cc->k->lamc = CC_INT_AUTO_CLEAR | intrpri; idat = 0; camac_s(unit, CC_BIT24, NAF(30, 13, 17), (u_short *)&idat); camac_s(unit, CC_BIT16, NAF(30, 0, 1), &sdat); sdat &= ~0x100; camac_s(unit, CC_BIT16, NAF(30, 0, 17), &sdat); break; case CCIOC_REG_DUMP : /* data[0] = k->cser; data[1] = k->docr; data[2] = k->sccr; data[3] = k->mtc; data[4] = k->machi; data[5] = k->maclo; data[6] = k->lamc; data[7] = k->donc; data[8] = k->empc; data[9] = k->aboc; data[10] = k->lamv; data[11] = k->donv; data[12] = k->empv; data[13] = k->abov; data[14] = k->amr; data[15] = k->cma; data[16] = k->cwc; data[17] = k->srr; data[18] = k->csr; */ break; case CCIOC_RESET : cc->k->csr = CC_RST; /* by E.Inoue from >>> */ /* set interrupt registers of K2917 */ cc->k->lamc = (u_short)(CC_INT_AUTO_CLEAR | intrpri); cc->k->donc = (u_short)(CC_INT_AUTO_CLEAR | intrpri); cc->k->empc = (u_short)(CC_INT_AUTO_CLEAR | intrpri); cc->k->aboc = (u_short)(CC_INT_AUTO_CLEAR | intrpri); cc->k->lamv = (u_short)intrvec; cc->k->donv = (u_short)intrvec; cc->k->empv = (u_short)intrvec; cc->k->abov = (u_short)intrvec; /* to <<< */ break; case CCIOC_READ_STATUS : /* data[0] = k->cser; data[1] = k->docr; data[2] = k->sccr; data[3] = k->mtc; data[4] = k->machi; data[5] = k->maclo; data[6] = k->lamc; data[7] = k->donc; data[8] = k->empc; data[9] = k->aboc; data[10] = k->lamv; data[11] = k->donv; data[12] = k->empv; data[13] = k->abov; data[14] = k->amr; data[15] = k->cma; data[16] = k->cwc; data[17] = k->srr; data[18] = k->csr; */ /* k->csr = CC_RST; */ break; case CCIOC_KINIT : cc->ptr_dir = 0; cc->ptr_cma = CC_KLIST_CMAINIT; break; default : break; } return 0; } (4-1-2). cc.cファイルをコンパイルしロードし直す onl50t[56]% make ./script/cc_build.sh [Building for sun4u] rm -f cc.o onl50t[57]% onl50t# make unload ./script/cc_unload.sh [Removing CAMAC device driver] [Removing CAMAC device driver from system] [Deleting CAMAC device files] onl50t# make load ./script/cc_load.sh [Installing CAMAC device driver] [Adding CAMAC device driver to system] [Configuring CAMAC device driver] [Making CAMAC device files] sun4u onl50t# (4-1-3). cam3プログラムを実行 onl50t[44]% cam3 cam3: cam3 begin cam3: CAM_Open ok. cam3: CSETBR ok. cam3: CSETCR ok. cam3: CGENC ok. cam3: CGENZ ok. cam3: CREMI ok. cam3: nafenalam ok. cam3プログラムはここでフリーズした。 システムはパニックを起こしてリブートしてしまった。 以下はコンソール上のメッセージ。 NOTICE: cc_write: debug step1. --- naf = 0x3c01 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c11 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c01 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c11 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c01 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c11 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x61a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_ioctl: debug step01. --- enter case CCIOC_ENABLE_LAM NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. 1bd7c8 addr=0x4 mmu_fsr=0x0 BAD TRAP occurred in module "cc" due to an illegal access to a user address. cam3: trap type = 0x31 addr=0x4 pid=760, pc=0x60d10808, sp=0x301bd858, tstate=0x4400001e05, context=0x561 g1-g7: 104124c8, 25608, 60c84998, 360, 0, 0, 60be6c60 Begin traceback... sp = 301bd858 Called from 60d0a0ac, fp=301bd8d0, args=0 0 3db1 4 0 60e7e000 Called from 100740d0, fp=301bd948, args=f00000 80046304 effff95c 100003 6004dc80 60e7e000 Called from 10055f70, fp=301bda18, args=60bd8088 301bda78 60ce3860 0 0 0 Called from 1002ec94, fp=301bda80, args=60bd8020 301bdae0 104265a4 effff90c 0 0 Called from 11688, fp=effff8b8, args=3 80046304 effff95c effff90c 0 0 End traceback... panic[cpu0]/thread=0x60be6c60: trap syncing file systems... 3 done 3142 static and sysmap kernel pages 40 dynamic kernel data pages 263 kernel-pageable pages 0 segkmap kernel pages 0 segvn kernel pages 92 current user process pages 3537 total pages (3537 chunks) dumping to vp 601de4cc, offset 481334 3537 total pages, dump succeeded rebooting... Resetting ... FORCE,CPU-50(UltraSPARC-IIi 300MHz), No Keyboard OpenBoot 3.10.6, 256 MB memory installed, Serial #9180267. Ethernet address 0:80:42:b:a4:6b, Host ID: 808c146b. Executing last command: boot Drive not ready Boot device: net File and args: ok ok boot disk3 -r Boot device: /pci@1f,0/scsi@4/disk@3,0 File and args: -r SunOS Release 5.6 Version Generic_105181-05 [UNIX(R) System V Release 4.0] Copyright (c) 1983-1997, Sun Microsystems, Inc. configuring network interfaces: hme0. Hostname: onl50t The / file system (/dev/rdsk/c0t3d0s0) is being checked. /dev/rdsk/c0t3d0s0: 3964 files, 226158 used, 679702 free /dev/rdsk/c0t3d0s0: (382 frags, 84915 blocks, 0.0% fragmentation) The /usr file system (/dev/rdsk/c0t3d0s6) is being checked. /dev/rdsk/c0t3d0s6: 28673 files, 546574 used, 3798782 free /dev/rdsk/c0t3d0s6: (1902 frags, 474610 blocks, 0.0% fragmentation) Configuring the /devices directory FRCvme V2.3.1 VME Nexus ( Universe) NOTICE: VME: slavewin at vme=0x0, size=0x100000 space=0x302061f CAMAC device driver V1.3x, 1991-1993 by Y.TAKEUCHI (T.I.T.) cc0 at vme0: vme16d16 0xff00 VME level 4 vector 0xff sparc ipl 7 vmeplus0 at vme0: vme16d16 0x0 and vme24d16 0x0 and vme32d16 0x0 and vme16d32 0x 0 and vme24d32 0x0 and vme32d32 0x0 and space 0x2f offset 0x0 and space 0x6f offset 0x0 and space 0x10 offset 0x0 and space 0x11 offset 0x0 and space 0x50 offset 0x0 and space 0x51 offset 0x0 vmedma0 at vme0 vmefdma0 at vme0 vmedvma0 at vme0 vmectl0 at vme0 Configuring the /dev directory Configuring the /dev directory (compatibility devices) The system is coming up. Please wait. checking ufs filesystems /dev/rdsk/c0t3d0s5: is stable. /dev/rdsk/c0t3d0s4: is stable. /dev/rdsk/c0t3d0s7: is stable. /dev/rdsk/c0t3d0s3: 707 files, 30242 used, 641432 free /dev/rdsk/c0t3d0s3: (208 frags, 80153 blocks, 0.0% fragmentation) checking for crash dump...System went down at Fri Jun 25 10:42:40 1999 Saving 3537 pages of image in vmcore.15 3537 pages saved. Processing modules: Done. Constructing Namelist file: /var/crash/onl50t/unix.15 Namelist file complete. add net default: gateway ICCFP1 NIS domainname is kek.jp starting rpc services: rpcbind keyserv done. Setting netmask of hme0 to 255.255.248.0 Setting default interface for multicast: add net 224.0.0.0: gateway onl50t syslog service starting. Print services started. starting Kana-Kanji converters: cssd. volume management starting. Wnn6: Key License Server started.... Nihongo Multi Client Server (Wnn6 R2.30) Finished Reading Files The system is ready. onl50t console login: (4-1-4). ioctl()の見直し(その2) ddi_copyin()を使ってみる。 onl50t[47]% make ./script/cc_build.sh [Building for sun4u] rm -f cc.o onl50t[48]% su Password: # csh onl50t# source /.cshrc onl50t# make unload ./script/cc_unload.sh [Removing CAMAC device driver] [Removing CAMAC device driver from system] [Deleting CAMAC device files] onl50t# make load ./script/cc_load.sh [Installing CAMAC device driver] [Adding CAMAC device driver to system] [Configuring CAMAC device driver] [Making CAMAC device files] sun4u onl50t# ls -l /dev/cc lrwxrwxrwx 1 root other 37 Jun 25 14:03 /dev/cc -> /devices/pci@1f ,0/vme@5/cc@2d,ff00:cc onl50t# onl50t[51]% cam3 cam3: cam3 begin cam3: CAM_Open ok. cam3: CSETBR ok. cam3: CSETCR ok. cam3: CGENC ok. cam3: CGENZ ok. cam3: CREMI ok. cam3: nafenalam ok. NOTICE: cc_write: debug step1. --- naf = 0x3c01 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c11 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c01 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c11 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c01 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c11 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x61a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_ioctl: debug step01. --- enter case CCIOC_ENABLE_LAM NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. p=0x302bf7c8 addr=0x4 mmu_fsr=0x0 BAD TRAP occurred in module "cc" due to an illegal access to a user address. cam3: trap type = 0x31 addr=0x4 pid=452, pc=0x60d40830, sp=0x302bf858, tstate=0x4400001e03, context=0x33d g1-g7: 104124c8, 5f3e, 60ee4fb8, 360, 0, 0, 60cb50a0 Begin traceback... sp = 302bf858 Called from 60d3a0c4, fp=302bf8d0, args=0 0 3db1 4 0 60dc4000 Called from 100740d0, fp=302bf948, args=f00000 80046304 effff95c 100003 6004dc80 60dc4000 Called from 10055f70, fp=302bfa18, args=6084f4e8 302bfa78 60ce3c70 0 0 0 Called from 1002ec94, fp=302bfa80, args=6084f480 302bfae0 104265a4 effff90c 0 0 Called from 11688, fp=effff8b8, args=3 80046304 effff95c effff90c 0 0 End traceback... panic[cpu0]/thread=0x60cb50a0: trap syncing file systems... [4] 4 done 3107 static and sysmap kernel pages 46 dynamic kernel data pages 261 kernel-pageable pages 0 segkmap kernel pages 0 segvn kernel pages 91 current user process pages 3505 total pages (3505 chunks) dumping to vp 601de4cc, offset 481846 3505 total pages, dump succeeded rebooting... Resetting ... FORCE,CPU-50(UltraSPARC-IIi 300MHz), No Keyboard OpenBoot 3.10.6, 256 MB memory installed, Serial #9180267. Ethernet address 0:80:42:b:a4:6b, Host ID: 808c146b. Executing last command: boot Drive not ready Boot device: net File and args: ok ok boot disk3 -r Boot device: /pci@1f,0/scsi@4/disk@3,0 File and args: -r SunOS Release 5.6 Version Generic_105181-05 [UNIX(R) System V Release 4.0] Copyright (c) 1983-1997, Sun Microsystems, Inc. configuring network interfaces: hme0. Hostname: onl50t The / file system (/dev/rdsk/c0t3d0s0) is being checked. /dev/rdsk/c0t3d0s0: INCORRECT BLOCK COUNT I=444926 (20 should be 0) (CORRECTED) /dev/rdsk/c0t3d0s0: LINK COUNT FILE I=186931 OWNER=root MODE=20600 /dev/rdsk/c0t3d0s0: SIZE=0 MTIME=Jun 25 14:03 1999 COUNT 2 SHOULD BE 1 (ADJUSTE D) /dev/rdsk/c0t3d0s0: LINK COUNT FILE I=444911 OWNER=root MODE=100444 /dev/rdsk/c0t3d0s0: SIZE=2744 MTIME=Jun 25 14:03 1999 COUNT 2 SHOULD BE 1 (ADJU STED) /dev/rdsk/c0t3d0s0: LINK COUNT FILE I=444946 OWNER=root MODE=100444 /dev/rdsk/c0t3d0s0: SIZE=2744 MTIME=Jun 25 14:03 1999 COUNT 2 SHOULD BE 1 (ADJU STED) /dev/rdsk/c0t3d0s0: FREE BLK COUNT(S) WRONG IN SUPERBLK (SALVAGED) /dev/rdsk/c0t3d0s0: 3968 files, 283844 used, 622016 free /dev/rdsk/c0t3d0s0: (392 frags, 77703 blocks, 0.0% fragmentation) The /usr file system (/dev/rdsk/c0t3d0s6) is being checked. /dev/rdsk/c0t3d0s6: 28673 files, 546574 used, 3798782 free /dev/rdsk/c0t3d0s6: (1902 frags, 474610 blocks, 0.0% fragmentation) Configuring the /devices directory FRCvme V2.3.1 VME Nexus ( Universe) NOTICE: VME: slavewin at vme=0x0, size=0x100000 space=0x302061f CAMAC device driver V1.3x, 1991-1993 by Y.TAKEUCHI (T.I.T.) cc0 at vme0: vme16d16 0xff00 VME level 4 vector 0xff sparc ipl 7 vmeplus0 at vme0: vme16d16 0x0 and vme24d16 0x0 and vme32d16 0x0 and vme16d32 0x 0 and vme24d32 0x0 and vme32d32 0x0 and space 0x2f offset 0x0 and space 0x6f offset 0x0 and space 0x10 offset 0x0 and space 0x11 offset 0x0 and space 0x50 offset 0x0 and space 0x51 offset 0x0 vmedma0 at vme0 vmefdma0 at vme0 vmedvma0 at vme0 vmectl0 at vme0 Configuring the /dev directory Could not read symbolic link /dev/cc Configuring the /dev directory (compatibility devices) The system is coming up. Please wait. checking ufs filesystems /dev/rdsk/c0t3d0s5: is stable. /dev/rdsk/c0t3d0s4: is stable. /dev/rdsk/c0t3d0s7: is stable. /dev/rdsk/c0t3d0s3: is stable. checking for crash dump...System went down at Fri Jun 25 14:04:04 1999 Saving 3505 pages of image in vmcore.17 3505 pages saved. Processing modules: Done. Constructing Namelist file: /var/crash/onl50t/unix.17 Namelist file complete. add net default: gateway ICCFP1 NIS domainname is kek.jp starting rpc services: rpcbind keyserv done. Setting netmask of hme0 to 255.255.248.0 Setting default interface for multicast: add net 224.0.0.0: gateway onl50t syslog service starting. Print services started. starting Kana-Kanji converters: cssd. volume management starting. Wnn6: Key License Server started.... Nihongo Multi Client Server (Wnn6 R2.30) Finished Reading Files The system is ready. onl50t console login: 症状に変化なし。 camac_s()コール時の4番目の引数にアドレスを指定する。 onl50t[36]% vi cc.c static int cc_ioctl(dev_t dev, int cmd, int arg, int flag, cred_t *cred_p, int *rval_p) { /* register struct cc_device *cc = &ccdevice[0]; */ register struct cc_device *cc; /* register struct K_REG *k = cc->k; */ u_short sdat; /* int idat, *data = (int *)arg; */ /* E.Inoue int idat, data; end */ int idat; int s; minor_t unit; unit = getminor(dev); cc = ddi_get_soft_state(cc_state,unit); /* E.Inoue copyin((caddr_t)arg,(caddr_t)&data,sizeof(data)); copyin((caddr_t)arg,(caddr_t)&cc->data1,sizeof(cc->data1)); */ ddi_copyin((caddr_t)arg,(caddr_t)&cc->data1,sizeof(cc->data1),flag); switch (cmd) { case CCIOC_CHK_BRANCH: /* E.Inoue data = cc->max_branch; */ cc->data1 = cc->max_branch; break; case CCIOC_SET_BRANCH: /* E.inoue if (data >= 0 && data < cc->max_branch) cc->cur_branch = data; */ if (cc->data1 >= 0 && cc->data1 < cc->max_branch) cc->cur_branch = cc->data1; break; case CCIOC_SET_CRATE: /* E.Inoue if (data >= 0 && data < MAX_CRATE) cc->cur_crate = data; */ if (cc->data1 >= 0 && cc->data1 < MAX_CRATE) cc->cur_crate = cc->data1; break; case CCIOC_WAIT_LAM : cc->interrupt = 0; cc->k->lamc = CC_INT_AUTO_CLEAR | CC_INT_ENABLE | intrpri; /* lock out clock */ /* by E.Inoue s = spl5(); */ if (cc->interrupt & CC_INT_LAM) { cc->interrupt &= ~CC_INT_LAM; return 0; } /* mutex_enter(&cc->mutex); */ /* start MUTEX */ /* E.Inoue cc->timeout_id = timeout(cc_timeout, (caddr_t)&unit, data * hz); */ cc->timeout_id = timeout(cc_timeout, (caddr_t)&unit, cc->data1 * hz); mutex_enter(&cc->mutex); /* start MUTEX */ /* wait interrupt */ /* cv_timedwait(&cc->cv, &cc->mutex, timeout); if (cc->interrupt == 0) cc->interrupt |= CC_INT_TIMEOUT; */ if (cv_wait_sig(&cc->cv, &cc->mutex) == 0) { untimeout(cc->timeout_id); mutex_exit(&cc->mutex); /* end MUTEX */ return EINTR; } mutex_exit(&cc->mutex); /* end MUTEX */ /* by E.Inoue splx(s); */ if( cc->interrupt & CC_INT_LAM ) { cc->interrupt &= ~CC_INT_LAM; } else if( cc->interrupt & CC_INT_TIMEOUT ) { cc->interrupt &= ~CC_INT_TIMEOUT; return CC_STA_SINGLE_TIMEOUT; /* set value to "errno" */ } break; case CCIOC_ENABLE_LAM : mutex_enter(&cc->mutex); /* start MUTEX */ ddi_copyin((caddr_t)arg,(caddr_t)&cc->data1,sizeof(cc->data1),flag); /* E.Inoue: from */ cmn_err(CE_NOTE," cc_ioctl: debug step01. --- enter case CCIOC_ENABLE_LAM"); cmn_err(CE_NOTE," cc_ioctl: debug step01. --- &cc->data1 = 0x%x", &cc->data1 ); cmn_err(CE_NOTE," cc_ioctl: debug step01. --- (u_short *)cc->data1 = 0x%x", (u_short *)cc->data1); /* E.Inoue: end */ /* E.Inoue camac_s(unit, CC_BIT24, NAF(30, 13, 17), (u_short *)data); */ camac_s(unit, CC_BIT24, NAF(30, 13, 17), (u_short *)&cc->data1); /* E.Inoue: from */ cmn_err(CE_NOTE," cc_ioctl: debug step01. --- call camac_s(...NAF(30,13,17) ok."); /* E.Inoue: end */ camac_s(unit, CC_BIT16, NAF(30, 0, 1), &sdat); /* E.Inoue: from */ cmn_err(CE_NOTE," cc_ioctl: debug step02. --- call camac_s(...NAF(30,0,1) ok ."); /* E.Inoue: end */ sdat |= 0x100; camac_s(unit, CC_BIT16, NAF(30, 0, 17), &sdat); /* E.Inoue: from */ cmn_err(CE_NOTE," cc_ioctl: debug step03. --- call camac_s(...NAF(30,0,17) o k."); /* E.Inoue: end */ mutex_exit(&cc->mutex); /* end MUTEX */ break; case CCIOC_DISABLE_LAM : cc->k->lamc = CC_INT_AUTO_CLEAR | intrpri; idat = 0; camac_s(unit, CC_BIT24, NAF(30, 13, 17), (u_short *)&idat); camac_s(unit, CC_BIT16, NAF(30, 0, 1), &sdat); sdat &= ~0x100; camac_s(unit, CC_BIT16, NAF(30, 0, 17), &sdat); break; case CCIOC_REG_DUMP : /* data[0] = k->cser; data[1] = k->docr; data[2] = k->sccr; data[3] = k->mtc; data[4] = k->machi; data[5] = k->maclo; data[6] = k->lamc; data[7] = k->donc; data[8] = k->empc; data[9] = k->aboc; data[10] = k->lamv; data[11] = k->donv; data[12] = k->empv; data[13] = k->abov; data[14] = k->amr; data[15] = k->cma; data[16] = k->cwc; data[17] = k->srr; data[18] = k->csr; */ break; case CCIOC_RESET : cc->k->csr = CC_RST; /* by E.Inoue from >>> */ /* set interrupt registers of K2917 */ cc->k->lamc = (u_short)(CC_INT_AUTO_CLEAR | intrpri); cc->k->donc = (u_short)(CC_INT_AUTO_CLEAR | intrpri); cc->k->empc = (u_short)(CC_INT_AUTO_CLEAR | intrpri); cc->k->aboc = (u_short)(CC_INT_AUTO_CLEAR | intrpri); cc->k->lamv = (u_short)intrvec; cc->k->donv = (u_short)intrvec; cc->k->empv = (u_short)intrvec; cc->k->abov = (u_short)intrvec; /* to <<< */ break; case CCIOC_READ_STATUS : /* data[0] = k->cser; data[1] = k->docr; data[2] = k->sccr; data[3] = k->mtc; data[4] = k->machi; data[5] = k->maclo; data[6] = k->lamc; data[7] = k->donc; data[8] = k->empc; data[9] = k->aboc; data[10] = k->lamv; data[11] = k->donv; data[12] = k->empv; data[13] = k->abov; data[14] = k->amr; data[15] = k->cma; data[16] = k->cwc; data[17] = k->srr; data[18] = k->csr; */ /* k->csr = CC_RST; */ break; case CCIOC_KINIT : cc->ptr_dir = 0; cc->ptr_cma = CC_KLIST_CMAINIT; break; default : break; } return 0; } onl50t[37]% cc.cファイルをコンパイルし、ロードし直す。 onl50t[38]% make ./script/cc_build.sh [Building for sun4u] rm -f cc.o onl50t[39]% su Password: # csh onl50t# source /.cshrc onl50t# make unload ./script/cc_unload.sh [Removing CAMAC device driver] [Removing CAMAC device driver from system] [Deleting CAMAC device files] onl50t# make load ./script/cc_load.sh [Installing CAMAC device driver] [Adding CAMAC device driver to system] [Configuring CAMAC device driver] [Making CAMAC device files] sun4u onl50t# cam3プログラムを実行する。 onl50t[40]% cam3 cam3: cam3 begin cam3: CAM_Open ok. cam3: CSETBR ok. cam3: CSETCR ok. cam3: CGENC ok. cam3: CGENZ ok. cam3: CREMI ok. cam3: nafenalam ok. cam3: CAM_EnableLAM ok. *** Now waiting LAM ... N=3 Loop=10 Timeout=0 sec cam3: CAM_WaitLAM. Interrupted !! count=1 cam3: CAM_WaitLAM. Interrupted !! count=2 cam3: CAM_WaitLAM. Interrupted !! count=3 cam3: CAM_WaitLAM. Interrupted !! count=4 cam3: CAM_WaitLAM. Interrupted !! count=5 cam3: CAM_WaitLAM. Interrupted !! count=6 cam3: CAM_WaitLAM. Interrupted !! count=7 cam3: CAM_WaitLAM. Interrupted !! count=8 cam3: CAM_WaitLAM. Interrupted !! count=9 cam3: CAM_WaitLAM. Interrupted !! count=10 *** cam3 nomal end. onl50t[41]% ok. cam3プログラムは正常に実行できた。 この時のコンソール上のメッセージは以下のとおり。 NOTICE: cc_write: debug step1. --- naf = 0x3c01 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c11 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step05. --- dat = 0x60d840d0 NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c01 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c11 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step05. --- dat = 0x60d840d0 NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c01 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x3c11 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step05. --- dat = 0x60d840d0 NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x61a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_ioctl: debug step01. --- enter case CCIOC_ENABLE_LAM NOTICE: cc_ioctl: debug step01. --- &cc->data1 = 0x60e04edc NOTICE: cc_ioctl: debug step01. --- (u_short *)cc->data1 = 0x4 NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step05. --- dat = 0x60e04edc NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_ioctl: debug step01. --- call camac_s(...NAF(30,13,17) ok. NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_ioctl: debug step02. --- call camac_s(...NAF(30,0,1) ok. NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step08. --- camac write, enter (mode & CC_BIT16) != 0) o k. NOTICE: camac_s: debug step09. --- camac write, cc->k->dlr = *dat; ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_ioctl: debug step03. --- call camac_s(...NAF(30,0,17) ok. NOTICE: cc_write: debug step1. --- naf = 0x60a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x60a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x60a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x60a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x60a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x60a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x60a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x60a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x60a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: cc_write: debug step1. --- naf = 0x60a NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step09. --- camac write, enter default NOTICE: camac_s: debug step10. --- finish camac write NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step05. --- camac write, enter (mode & CC_BIT16) == 0) o k. NOTICE: camac_s: debug step05. --- dat = 0x302c393c NOTICE: camac_s: debug step06. --- camac write, cc->k->dhr = *dat; ok. NOTICE: camac_s: debug step07. --- camac write, cc->k->dhr = *(dat + 1); ok. NOTICE: camac_s: debug step10. --- finish camac write NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac read NOTICE: camac_s: debug step10. --- finish camac write NOTICE: camac_s: debug step01. --- enter camac_s() NOTICE: camac_s: debug step02. --- camac write NOTICE: camac_s: debug step03. --- camac write, cc->k->csr |= CC_WRITE; ok. NOTICE: camac_s: debug step04. --- camac write, cc->k->csr |= CC_GO; ok. NOTICE: camac_s: debug step08. --- camac write, enter (mode & CC_BIT16) != 0) o k. NOTICE: camac_s: debug step09. --- camac write, cc->k->dlr = *dat; ok. NOTICE: camac_s: debug step10. --- finish camac write ---xxxx ここまでやった(継続中) --- (6). セクション (6-1). サブセクション (6-1-1). サブサブセクション