lkml.org 
[lkml]   [1998]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectQuestion re: Alpha asm code
All,

I have been struggling with kmod on Alpha linux for the past several days.
It's been an interesting experience trying to get kernel_fork() working!
I'm now passingly familiar with Alpha asm syntax, but there is so much
hidden between the lines (or just plain undocumented) that I've reached an
impasse.

The current kernel-mode fork just calls sys_fork(), which absolutely does
not work. I believe that the calling stack must be faked up in a manner
similar to __kernel_clone(), so I've attempted to cook up a working
kernel_fork() thusly:

/*
* kernel_fork
*/
.align 3
.ent do_kernel_fork
do_kernel_fork:
.frame $30, 0, $26
.prologue 0
subq $30,6*8,$30
stq $31,0($30)
stq $26,8($30)
stq $29,16($30)
stq $16,24($30)
stq $17,32($30)
stq $18,40($30)
bis $31,2,$0 /* Register v0: syscall nr for fork() */
SAVE_ALL
jsr $26,sys_fork
stq $0,0($30)
br $31,ret_from_sys_call
.end do_kernel_fork

/*
* __kernel_fork
*/
.align 3
.globl __kernel_fork
.ent __kernel_fork
__kernel_fork:
ldgp $29,0($27) /* we can be called from a module */
.frame $30, 1*8, $26
subq $30,1*8,$30
stq $26,0($30)
.prologue 1
bsr $26,do_kernel_fork
ldq $26,0($30)
addq $30,1*8,$30
ret $31,($26),1
ldgp $29,0($26)
bis $0,$0,$16
jsr $26,sys_exit
call_pal PAL_halt
.end __kernel_fork

This is not working, and my questions are many:

1) Where can I find documentation on the gas psuedo-ops:

.prologue
.frame

I found some vague comments in the gas sources, but it sorta dances a
complete circle around explaining what they do :-(.

2) What does the 'ldgp' mnemonic do? Is this just, as I suspect, another
way of saying 'ldq $29,nn($Rb)' ? If so, why the special syntax?

3) I'm totally confused with regard to the calling conventions for gcc
invoking asm functions, and with how function values are returned.

4) What is the cryptic "we can be called from a module" implying?

I have on hand, and have been scouring over:

- Alpha Architecture Guide (Ver. 3)
- gas assembler source
- Linux kernel 2.1.91 source
- gcc documentation

Forgive me if I've passed by anything obvious. I'd like to help get alpha
kmod operational but I am just not grasping enough of the low-level
details.


Steve





-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:42    [W:0.044 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site