[Galaxy 3 Android Development] Arakmar:
Here is the kernel panic I obtain with your original g3d module (without static vars) :

$ Unable to handle kernel paging request at virtual address fffffff4
pgd = cebec000
[fffffff4] *pgd=20e0c021, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1]
last sysfs file: /sys/power/wait_for_fb_sleep
Modules linked in: s3c_g3d Si4709_driver vibrator param(P) storage(P) modemctl svnet onedram tun rfs_fat(P) rfs_glue(P) fsr_stl(P) fsr(P)
CPU: 0 Tainted: P (2.6.32.9 #Test_Version_321)
PC is at s3c_g3d_mmap+0x28/0x100 [s3c_g3d]
LR is at 0x45c63000
pc : [<bf15657c>] lr : [<45c63000>] psr: 60000013
sp : cec17ea8 ip : bf15656c fp : cec17ec4
r10: cdc8dc20 r9 : 00080000 r8 : cd021f00
r7 : 000000ff r6 : cdb6ae00 r5 : 45c63000 r4 : ffffff78
r3 : 45ce3000 r2 : 00000003 r1 : cdc8dd10 r0 : cd021f00
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Control: 00c5387d Table: 2ebec008 DAC: 00000015

SP: 0xcec17e28:
7e28 cd021f00 cdbdb1f0 cec17e74 cec17e40 c03dd618 c03b56b8 ffffffff cec17e94
7e48 cdb6ae00 000000ff cec17ec4 cec17e60 c032aaac c032a288 cd021f00 cdc8dd10
7e68 00000003 45ce3000 ffffff78 45c63000 cdb6ae00 000000ff cd021f00 00080000
7e88 cdc8dc20 cec17ec4 bf15656c cec17ea8 45c63000 bf15657c 60000013 ffffffff
7ea8 000000ff cd021f00 00080000 cdc8dd10 cec17f2c cec17ec8 c03cbf30 bf156560
7ec8 000000ff 00000000 cd021f00 00000000 00000000 00000000 cf401090 00000001
7ee8 45ce3000 cdc8dc08 cdbdb1f0 cdc8dc24 00000080 00000000 cd021f00 45c63000
7f08 cd021f00 000000ff 00000001 00080000 00000000 cdb6ae00 cec17f74 cec17f30

FP: 0xcec17e44:
7e44 cec17e94 cdb6ae00 000000ff cec17ec4 cec17e60 c032aaac c032a288 cd021f00
7e64 cdc8dd10 00000003 45ce3000 ffffff78 45c63000 cdb6ae00 000000ff cd021f00
7e84 00080000 cdc8dc20 cec17ec4 bf15656c cec17ea8 45c63000 bf15657c 60000013
7ea4 ffffffff 000000ff cd021f00 00080000 cdc8dd10 cec17f2c cec17ec8 c03cbf30
7ec4 bf156560 000000ff 00000000 cd021f00 00000000 00000000 00000000 cf401090
7ee4 00000001 45ce3000 cdc8dc08 cdbdb1f0 cdc8dc24 00000080 00000000 cd021f00
7f04 45c63000 cd021f00 000000ff 00000001 00080000 00000000 cdb6ae00 cec17f74
7f24 cec17f30 c03cc3e4 c03cbc88 000000ff 00000000 00000001 00000080 00000003

R0: 0xcd021e80:
1e80 ffffffff 00000002 00020000 0000001d 00000000 00000000 deaf1eed ffffffff
1ea0 ffffffff 00000000 00000000 00000000 00000000 00000000 cdc9d580 00000000
1ec0 00000000 00000000 00000000 00000000 00000000 00000000 ffffffff ffffffff
1ee0 00000000 00000000 ccdb6ba0 cd021eec cd021eec cf477b58 00000000 00000000
1f00 cd226d20 cd8b84a0 cd9a5700 cf6a3240 bf156c8c 00000001 dead4ead ffffffff
1f20 ffffffff 00000003 00021002 0000001f 00000000 00000000 deaf1eed ffffffff
1f40 ffffffff 00000000 00000000 00000000 00000000 00000000 cdc9d580 00000000
1f60 00000000 00000000 00000000 00000000 00000000 00000000 ffffffff ffffffff

R1: 0xcdc8dc90:
dc90 00000000 cd327a10 cdc8dcec cd327a00 c082ea90 00000032 cdaedd20 00000000
dcb0 00000000 e3c11c80 cdb6ae00 80700000 80732000 cdc8dc60 0000030f 08100075
dcd0 cdc8dbc9 cdc8dc78 cdc8db70 cdc8dcdc cdc8dcdc cdc8dc84 00000000 cdc8dc94
dcf0 cd327a10 cd327a00 c082ea90 00000000 cdaedd20 00000000 00000000 e3500000
dd10 cdb6ae00 45c63000 45ce3000 00000000 0000038f 000000ff 00000000 00000000
dd30 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dd50 00000000 00000000 cd021f00 00000000 00000000 e5941000 cdc8ddc0 e3c1100c
dd70 e3811e40 e5841000 e3500000 0b003f9e eb003f9f e5941004 e3c113b8 e3811002

R4: 0xfffffef8:
fef8 ******** ******** ******** ******** ******** ******** ******** ********
ff18 ******** ******** ******** ******** ******** ******** ******** ********
ff38 ******** ******** ******** ******** ******** ******** ******** ********
ff58 ******** ******** ******** ******** ******** ******** ******** ********
ff78 ******** ******** ******** ******** ******** ******** ******** ********
ff98 ******** ******** ******** ******** ******** ******** ******** ********
ffb8 ******** ******** ******** ******** ******** ******** ******** ********
ffd8 ******** ******** ******** ******** ******** ******** ******** ********

R6: 0xcdb6ad80:
ad80 beaa7fe9 0000000f beaa7d5b 00000000 00000000 00000000 00000000 00000000
ada0 00000000 c0a73a04 00000001 0000035f 00000005 00000000 00000000 00000000
adc0 0000008d 00000000 00000001 dead4ead ffffffff ffffffff 00000000 00000000
ade0 00000000 006c006c 00740065 00730020 006e006f 00200074 00630061 00650063
ae00 cec1f108 cec076f8 cec1fdc0 c033385c c03c97e8 40000000 bf000000 00002000
ae20 45ce3000 cebec000 0000000a 00000001 000000db ffffffff 00000001 dead4ead
ae40 ffffffff ffffffff cdb6ae48 cdb6ae48 00000001 dead4ead ffffffff ffffffff
ae60 cdb6ae60 cdb6ae60 00000998 00000a57 000013ce 00006fc8 00006fc8 00000000

R8: 0xcd021e80:
1e80 ffffffff 00000002 00020000 0000001d 00000000 00000000 deaf1eed ffffffff
1ea0 ffffffff 00000000 00000000 00000000 00000000 00000000 cdc9d580 00000000
1ec0 00000000 00000000 00000000 00000000 00000000 00000000 ffffffff ffffffff
1ee0 00000000 00000000 ccdb6ba0 cd021eec cd021eec cf477b58 00000000 00000000
1f00 cd226d20 cd8b84a0 cd9a5700 cf6a3240 bf156c8c 00000001 dead4ead ffffffff
1f20 ffffffff 00000003 00021002 0000001f 00000000 00000000 deaf1eed ffffffff
1f40 ffffffff 00000000 00000000 00000000 00000000 00000000 cdc9d580 00000000
1f60 00000000 00000000 00000000 00000000 00000000 00000000 ffffffff ffffffff

R10: 0xcdc8dba0:
dba0 cdc0d6e0 00000000 00000000 e5941000 cdb6ae00 80600000 80604000 cdc8db58
dbc0 0000030f 08100075 cec070c8 cdc8dcd0 cdc8d5f0 cdc8dbd4 cdc8dbd4 cdc8db7c
dbe0 00000000 cdc8db8c cd3279f0 cd3279e0 c082ea90 00000000 cdc0d6e0 00000000
dc00 00000000 e3811940 cdb6ae00 45ba7000 45c63000 cec1fdc0 00000387 400844ff
dc20 cdc8db18 00000000 00000000 cdc8dc2c cdc8dc2c cdc8dc2c 00000000 00000000
dc40 00000000 00000000 00000000 0002fa00 cdc0d8c0 00000000 00000000 1afffff5
dc60 cdb6ae00 80732000 80733000 cec070b0 0000030f 08100077 cdc8dcd0 00000000
dc80 00000000 cdc8dcdc cdc8dc84 cdc8dc84 00000000 cd327a10 cdc8dcec cd327a00
Process SurfaceFlinger (pid: 2785, stack limit = 0xcec16268)
Stack: (0xcec17ea8 to 0xcec18000)
7ea0: 000000ff cd021f00 00080000 cdc8dd10 cec17f2c cec17ec8
7ec0: c03cbf30 bf156560 000000ff 00000000 cd021f00 00000000 00000000 00000000
7ee0: cf401090 00000001 45ce3000 cdc8dc08 cdbdb1f0 cdc8dc24 00000080 00000000
7f00: cd021f00 45c63000 cd021f00 000000ff 00000001 00080000 00000000 cdb6ae00
7f20: cec17f74 cec17f30 c03cc3e4 c03cbc88 000000ff 00000000 00000001 00000080
7f40: 00000003 00000007 c0825610 cd021f00 cec16000 00000001 00080000 00000000
7f60: cec16000 00000003 cec17fa4 cec17f78 c03c1aa0 c03cc138 00000001 00000000
7f80: 00000020 00000000 8072d124 000000c0 c032b10c 00000000 00000000 cec17fa8
7fa0: c032aee0 c03c1a0c 00000020 00000000 00000000 00080000 00000003 00000001
7fc0: 00000020 00000000 8072d124 000000c0 459a7000 a811ec4d 00100000 00000001
7fe0: 45aa6cc0 45aa6cb0 afd17587 afd0b814 40000010 00000000 d90d4298 9a001c39
[<bf15657c>] (s3c_g3d_mmap+0x28/0x100 [s3c_g3d]) from [<c03cbf30>] (mmap_region+0x2b4/0x4b0)
[<c03cbf30>] (mmap_region+0x2b4/0x4b0) from [<c03cc3e4>] (do_mmap_pgoff+0x2b8/0x318)
[<c03cc3e4>] (do_mmap_pgoff+0x2b8/0x318) from [<c03c1aa0>] (sys_mmap_pgoff+0xa0/0xd0)
[<c03c1aa0>] (sys_mmap_pgoff+0xa0/0xd0) from [<c032aee0>] (ret_fast_syscall+0x0/0x2c)
Code: e5903088 e591e004 e5934000 e5913008 (e594207c)
---[ end trace 7d24bd9e83bc3587 ]---
Kernel panic - not syncing: Fatal exception
[<c03314d8>] (unwind_backtrace+0x0/0xe4) from [<c0822804>] (dump_stack+0x20/0x24)
[<c0822804>] (dump_stack+0x20/0x24) from [<c082285c>] (panic+0x54/0x120)
[<c082285c>] (panic+0x54/0x120) from [<c032f664>] (die+0x278/0x2b8)
[<c032f664>] (die+0x278/0x2b8) from [<c033251c>] (__do_kernel_fault+0x74/0x84)
[<c033251c>] (__do_kernel_fault+0x74/0x84) from [<c0332704>] (do_page_fault+0x1d8/0x1f8)
[<c0332704>] (do_page_fault+0x1d8/0x1f8) from [<c032a2c0>] (do_DataAbort+0x44/0xa8)
[<c032a2c0>] (do_DataAbort+0x44/0xa8) from [<c032aaac>] (__dabt_svc+0x4c/0x60)
Exception stack(0xcec17e60 to 0xcec17ea8)
7e60: cd021f00 cdc8dd10 00000003 45ce3000 ffffff78 45c63000 cdb6ae00 000000ff
7e80: cd021f00 00080000 cdc8dc20 cec17ec4 bf15656c cec17ea8 45c63000 bf15657c
7ea0: 60000013 ffffffff
[<c032aaac>] (__dabt_svc+0x4c/0x60) from [<bf15657c>] (s3c_g3d_mmap+0x28/0x100 [s3c_g3d])
[<bf15657c>] (s3c_g3d_mmap+0x28/0x100 [s3c_g3d]) from [<c03cbf30>] (mmap_region+0x2b4/0x4b0)
[<c03cbf30>] (mmap_region+0x2b4/0x4b0) from [<c03cc3e4>] (do_mmap_pgoff+0x2b8/0x318)
[<c03cc3e4>] (do_mmap_pgoff+0x2b8/0x318) from [<c03c1aa0>] (sys_mmap_pgoff+0xa0/0xd0)
[<c03c1aa0>] (sys_mmap_pgoff+0xa0/0xd0) from [<c032aee0>] (ret_fast_syscall+0x0/0x2c)

FATAL: term closed
term_exitfunc: reset failed for dev UNKNOWN: Input/output error

According to that, the memory area of the data structure seems to be invalid in the mmap.

Have you any idea of where is the problem ?