Newsgroups: comp.os.linux.powerpc
From: Bo Hong <bohong...@gmail.com>
Date: Tue, 30 Nov 2010 11:29:55 -0800 (PST)
Local: Tues, Nov 30 2010 2:29 pm
Subject: problem accessing current->thread in assembly syscall handler
Hi all,
I met some serious problems when hacking linux on powerpc. Any I am working on a Power6 running fedora 12, kernel version I added a new field "unsigned long my_priority" to the end of I can access this field through my newly added system calls by So I moved on and tried to to access my_priority in the assembly Here is original codelet: . = 0xc00 Here is my first modification: . = 0xc00 mfspr r13, SPRN_SPRG_PACA // read paca of the current cpu >thread.my_priority ( paca+THREAD is current->thread_struct, my_priority is 336 bytes further down) cmpdi r0,0x1ebe My kernel will not boot with the four new instructions! Then I tried to identify what problem is, so I change the code to . = 0xc00 2. cmpdi r0, 324 // okay, will 4. mfspr r13, SPRN_SPRG_PACA // read paca of the current cpu >__current->thread, my_priority is 336 bytes further down, // so I expect r4 = paca->__current->thead.my_priority, not_sys_call_324: This time, the system boots - since no one will do syscall 324 and syscall 324, written in C, just printk the two parameters (passed Then I tested syscall 324 from a user program. to my surprise, / r3, when passed into the syscall handler, becomes "0x570daee0", the syscall also complained that "ld r4, (THREAD+336)(r3) " Here are my questions: 1. When the 64-bit __current is truncated to 32-bits when I load 2. could this be the reason that my first mod failed to boot? Many thanks in advance Bo Hong You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||