Re: How to check if kernel sources are installed on a system?

From: Valdis . Kletnieks
Date: Mon May 29 2006 - 03:43:51 EST


On Mon, 29 May 2006 00:05:12 PDT, 4Front Technologies said:
> But regparm requires that ALL parts linked into the module need to have regparm
> defined. So it's another headache to write makefiles for the kernel independant
> part to figure out if the distro support regparm or not.

Not true at all.. Or at least not for the most infamous module out there:

% grep NV_API_CALL *.h | head
nv.h:#if !defined(NV_API_CALL)
nv.h:#define NV_API_CALL __attribute__((regparm(0)))
nv.h:#define NV_API_CALL
nv.h:void* NV_API_CALL nv_dma_to_mmap_token (nv_state_t *, NvU64);
nv.h:void* NV_API_CALL nv_alloc_kernel_mapping (nv_state_t *, NvU64, U032, void **);
nv.h:S032 NV_API_CALL nv_free_kernel_mapping (nv_state_t *, void *, void *);
nv.h:NvU64 NV_API_CALL nv_get_kern_phys_address (NvU64);
nv.h:NvU64 NV_API_CALL nv_get_user_phys_address (NvU64);
nv.h:void* NV_API_CALL nv_get_adapter_state (U016, U016);
nv.h:void NV_API_CALL nv_lock_rm (nv_state_t *);

So there's routines facing the rest of the kernel - those *do* need to have a
regparm that matches the kernel. But internal to the module, you can have some
other regparm value - the requirement is only that the prototype needs to have
the same regparm as the function body is actually compiled with.

I seem to remember that parts of the *mainline* kernel use 'asmlinkage'
for similar reasons.... ;)

Attachment: pgp00000.pgp
Description: PGP signature