免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 3913 | 回复: 11
打印 上一主题 下一主题

紧急求教:BSD下面的汇编 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-11-21 12:24 |只看该作者 |倒序浏览
项目就要到期了,结果,别人的代码还没有看懂,请各位大虾帮帮忙:
下面的代码中,我对汇编部分不懂。请你们指点,在线等:

再 laio_api.c中:
int
laio_syscall(int number, ...)
{
        if (!_setjmp(sched_data.env)) {
                assert(current_thread);
                sched_data.mb.km_curthread = current_thread;
                thread_desc = current_thread;
                //rv = syscall(number, arg_list);
                //the asm code here
                {asm (
                        " \
                                pop %ecx; \
                                pop %eax; \
                                push %ecx; \
                                int $0x80; \
                                push %ecx; \
                                jb 1f; \
                                jmp 2f; \
                        1: \
                                pushl %ebx; \
                                call 1f; \
                        1: \
                                popl %ebx; \
                                addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx; \
                                jmp .cerror@PLT; \
                        2: \
                        ");
                }
                sched_data.mb.km_curthread = NULL;
                thread_desc = (void *) 0;
                asm("ret");
                assert(0);
        }
        else {
                laio_desc_bg = thread_desc;
                errno = EINPROGRESS;
                return (-1);
        }

        /* does not come here */
        assert(0);
        return (0);
}

在 laio_syscall.S中
/* $Id: laio_syscall.S,v 1.4 2004/01/13 00:18:26 anupamc Exp $ */
/*
.LC0:
        .string "env = %p\n"
*/
        .text
        .p2align 2,,3
.globl laio_syscall
        .type   laio_syscall, @function
laio_syscall:
/*
        pushl   $sched_data+96
        pushl   $.LC0
        call    printf
        addl    $8, %esp
*/
        pushl   $sched_data+96
        call    _setjmp
        addl    $4, %esp
        testl   %eax, %eax
        jne     .L2
        movl    current_thread, %eax
        movl    %eax, sched_data+4
        movl    (%esp), %eax
        movl    %eax, foo
        movl    $.L1, (%esp)
        jmp     syscall
.L1:
        movl    $0, sched_data+4
.L3:
        jmp     *foo
.L2:
        call    __error
        movl    $36, (%eax)
        movl    $-1, %eax
        jmp     .L3
        .size   laio_syscall, .-laio_syscall

很着急,多谢了。

[ 本帖最后由 ericazhangjun 于 2006-11-21 13:05 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-11-21 12:38 |只看该作者
问题?

论坛徽章:
0
3 [报告]
发表于 2006-11-21 12:55 |只看该作者
能给我详细讲解一下,其中的汇编code吗?多谢了。

论坛徽章:
0
4 [报告]
发表于 2006-11-21 13:07 |只看该作者
抱歉,我时间有限。

论坛徽章:
2
亥猪
日期:2014-03-19 16:36:35午马
日期:2014-11-23 23:48:46
5 [报告]
发表于 2006-11-21 13:10 |只看该作者
Orz
LS 这是我注册CU以来遇到的最牛的问题 和 最牛的回答

论坛徽章:
2
亥猪
日期:2014-03-19 16:36:35午马
日期:2014-11-23 23:48:46
6 [报告]
发表于 2006-11-21 13:15 |只看该作者
什么项目?
我以小人之心枉自猜测:
估计是想学kylin抄某处的代码 去骗经费。或者,自己的东西没做出来,项目马上结题了,只能找现成的去充数。

论坛徽章:
0
7 [报告]
发表于 2006-11-21 13:23 |只看该作者
不好意思,其是这是我的课程实习.因为实在不会了,才来这里问的. 就是想知道,这段汇编里面是否通过某种操作对syscall是否block进行了检测?多谢了.

论坛徽章:
0
8 [报告]
发表于 2006-11-21 13:59 |只看该作者
原帖由 gvim 于 2006-11-21 13:10 发表
Orz
LS 这是我注册CU以来遇到的最牛的问题 和 最牛的回答

一般般,一般般

论坛徽章:
0
9 [报告]
发表于 2006-11-21 14:23 |只看该作者
为什么没有人回答呢?
Detect 该用户已被删除
10 [报告]
发表于 2006-11-21 14:58 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP