Hi John,

Thank you for your responds. I'm porting to 2.6.12.2. I'll pull down your 2.4 code it may give me some insight into other problems I'm running into. Due to the problem with gmail I went ahead and wrote the following "savesegment" code:

/*
 * Save a segment register away
 */
#define savesegment(seg, value) \
        asm volatile("movw %%" #seg ",%0":"=m" (value))

Not sure if it'll work until I finish the rest of the port. I am stuck right now trying to figure out how to get "kernel_thread" to call "kernel_thread_with_pid" with the extra argument in assembly code and have "kernel_thread_with_pid" call "__do_fork" with the extra argument. Fun stuff this assembly code.... I've spent 12 years in the unix kernel and managed to stay away from the platform specific/assembly code. Guess it is time to get my feet wet. Yuck!

- John Steinman (Retired - DEC/Compaq/HP Filesystems Engineer)

On 10/5/06, John Byrne <john.l.byrne@hp.com > wrote:

We never released it, but I did have OpenSSI x86_64 working in the
RHEL3U4  kernel at one point. I defined my own savesegment macro. You
can check out the ci/openssi kernel directories on the
OPENSSI-RHEL-1-2-STABLE branch from the SF repository and have a look at
what I did. Unfortunately, this is for 2.4 and it looks like I never did
the work for 2.6 so I don't know how much help it will be to you.

John Byrne

John Steinman wrote:
> Hi all,
>
> I am attempting to port OpenSSI to x86_64. I'm hitting a platform specific
> call "savesegment" from OpenSSI kernel code that doesn't appear to be
> defined in x86_64 that appears to be in i386 platform code.
>
>  CC      cluster/ssi/vproc/rproc_cli _pproc.o
> In file included from cluster/ssi/vproc/rproc_cli_pproc.c:47:
> cluster/ssi/vproc/arch/rproc_arch.c: In function
> `rproc_arch_data_load_msg':
> cluster/ssi/vproc/arch/rproc_arch.c:58: warning: implicit declaration of
> function `savesegment'
>
>> From "include/asm-i386/system.h" the savesegment is defined as:
>
> /*
> * Save a segment register away
> */
> #define savesegment(seg, value) \
>        asm volatile("mov %%" #seg ",%0":"=m" (value))
>
> I decided to look at how the process state was saved during a context
> switch
> but looking at how we save the processor state for x86_64 and i386 the
> "movw" is used to save the segment registers not "mov":
>
> 1386:
>
> asm volatile ("movw %%fs, %0" : "=m" (ctxt->fs));
> asm volatile ("movw %%gs, %0" : "=m" (ctxt->gs));
>
> x86_64:
>
> void __save_processor_state(struct saved_context *ctxt)
> {
>        kernel_fpu_begin();
>
>        /*
>         * descriptor tables
>         */
>        asm volatile ("sgdt %0" : "=m" (ctxt->gdt_limit));
>        asm volatile ("sidt %0" : "=m" (ctxt->idt_limit));
>        asm volatile ("sldt %0" : "=m" (ctxt->ldt));
>        asm volatile ("str %0"  : "=m" (ctxt->tr));
>
>        /* XMM0..XMM15 should be handled by kernel_fpu_begin(). */
>        /* EFER should be constant for kernel version, no need to handle it.
> */
>        /*
>         * segment registers
>         */
>        asm volatile ("movw %%ds, %0" : "=m" (ctxt->ds));
>        asm volatile ("movw %%es, %0" : "=m" (ctxt->es));
>        asm volatile ("movw %%fs, %0" : "=m" (ctxt->fs));
>        asm volatile ("movw %%gs, %0" : "=m" (ctxt->gs));
>        asm volatile ("movw %%ss, %0" : "=m" (ctxt->ss));
>
>        rdmsrl(MSR_FS_BASE, ctxt->fs_base);
>        rdmsrl(MSR_GS_BASE, ctxt->gs_base);
>        rdmsrl(MSR_KERNEL_GS_BASE, ctxt->gs_kernel_base);
>
>        /*
>         * control registers
>         */
>        asm volatile ("movq %%cr0, %0" : "=r" (ctxt->cr0));
>        asm volatile ("movq %%cr2, %0" : "=r" (ctxt->cr2));
>        asm volatile ("movq %%cr3, %0" : "=r" (ctxt->cr3));
>        asm volatile ("movq %%cr4, %0" : "=r" (ctxt->cr4));
> }
>
> What is the correct way to save the segment register for both processor
> types for OpenSSI "savesegment"?
>
>
>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ssic-linux-devel mailing list
> ssic-linux-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ssic-linux-devel




--
John F. Steinman