Sun Java Solaris Communities My SDN Account Join SDN
 
White Paper

Notes on 64-bit Drivers and STREAMS

 
CHAPTER 1

Kernel Programming


Compiling, Installing, and Testing

- Register Symbol Problem

Instructions for compiling and installing existing drivers, STREAMS, and other kernel components for the 32-bit kernel are unchanged.

Drivers, STREAMS modules and other kernel components intended for the 64-bit SPARC kernel should be built using the following compile line:

% cc -D_KERNEL -xarch=v9 -xcode=abs32 -xregs=no%appl -xO3 -c fileN.c

For each file that makes up the component, followed by an invocation of the linker on all the files to create the module:

% ld -r -o modulename file*.o

For files intended for the 64-bit Intel kernel, substitute -xarch=ia64 for -xarch=v9.

The solution adopted for separating 64-bit modules from 32- bit modules is to put them into subdirectories of the existing kernel directories. The subdirectory sparcv9 has been introduced in each of the kernel drv and strmod directories to contain the 64-bit versions of the modules on SPARC platforms. For Intel platforms, the directory is ia64.

The module should then be copied into place on the appropriate target platform by using one of the following:

% cp drivermodulename /kernel/drv/sparcv9/.
% cp drivermodulename /kernel/drv/ia64/.

Then run add_drv(1M) (the first time) in the usual way to cause the system to register the device driver. There is one shared .conf configuration file for 32-bit and 64-bit versions of a driver or module. For example, /kernel/drv/sd.conf

After the driver is loaded onto the 64-bit kernel, testing should cover the full range of ioctl calls supported by the driver with both 32-bit and 64-bit applications. Make sure that the full range of data types and pointer values is explored by test programs, as truncation and sign extension bugs can cause problems.

Register Symbol Problem

The following problem was introduced in the Solaris 7 operating environment and has been fixed in the Solaris 7 5/99 Update.

When loading an unbundled device driver, STREAMS module, file system, or other kernel module, you might see the following error message:

kernel_module_path: undefined symbol
WARNING: mod_load: cannot load module 'kernel_module_path'
The kernel runtime linker does not recognize the new register symbol type introduced in the SC5.0 FSC compilers and assemblers for 64-bit SPARC binaries.

If you receive this warning you must verify that the error message was generated because the kernel runtime linker did not recognize the new register symbol type. To do this, type:

# nm kernel_module_path | grep REGI
If this is the problem, the output from this command is a table that shows one row with 2 in the Value column and REGI in the Type column and another row with 3 in the Value column and REGI in the Type column. For example:
   [154]   |	     2| 	0|REGI  |GLOB  |0   |UNDEF |
   [155]   |	     3| 	0|REGI  |GLOB  |0   |UNDEF |

To correct the problem:

  • If you have the source code for the kernel module, recompile the kernel module with -xregs=no%appl option, or, if it is written in assembly language, assemble it with -xregsym=no option.

  • If you do not have the source code, contact the provider of the kernel module to report the problem.

<< Previous | Contents | Next >> [TOP]