首页 \ 问答 \ 如何编写从汇编代码调用的C函数(How to write a C function invoked from assembly code)

如何编写从汇编代码调用的C函数(How to write a C function invoked from assembly code)

我需要编写一个C函数,它将从linux内核中的汇编代码中调用。

应该考虑哪些特殊问题?

我有一些想法,但任何人都可以提供更多细节:

(1)召集会议

确保组件中的呼叫者和c中的被叫者握手良好。 但是我应该使用哪种调用约定? 如何声明c函数并在汇编代码中声明它?

(2)保护寄存器

在调用之前,应将某些寄存器保存在程序集中。 我粗略记得他们是eax,ecx和edx。 但我不需要保存它们,除非我需要在调用C函数之前引用旧值,对吧?

还有什么其他问题?


I need to write a C function that will be invoked from assembly code in linux kernel.

What special issues should be taken into account?

I have some in mind, but can anybody provide more details:

(1) Calling convention

Make sure the caller in assembly and the callee in c shake hands well. But which calling convention should I use? How can I declare the c function and declare it in assembly code?

(2) Protect registers

Some registers should be saved in the assembly before the invoke. I roughly remember they are eax, ecx and edx. But I don't have to save them unless I need to refer to the old value before the invoke to the C function, right?

What are other issues?


原文:https://stackoverflow.com/questions/10061324
更新时间:2022-03-27 21:03

最满意答案

您可以使用PHP Mailer Class发送带附件的邮件。


You can use PHP Mailer Class to send mails with attachments.

相关问答

更多
  • 试试这个- import smtplib import mimetypes from email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase from email.MIMEText import MIMEText from email.Utils import COMMASPACE, formatdate from email import Encoders filePath = "fileName.pdf ...
  • 您可以使用Gmail API检索附件: https : //developers.google.com/gmail/api/v1/reference/users/messages/attachments/get#examples You can use Gmail API to retrieve attachments: https://developers.google.com/gmail/api/v1/reference/users/messages/attachments/get#examples
  • 587端口显然需要打开,但它可能是(或者你不会得到详细的错误消息)。 Python 2.5 vs 2.6应该没有区别。 我认为这个问题与登录目前被拒绝的计算机上的一次“解决验证码”有关; 请按照错误消息中的网址中的详细说明进行操作,即http://mail.google.com/support/bin/answer.py?answer=14257 Port 587 obviously needs to be open, but it probably is (or you wouldn't have got ...
  • 那么phpMailer修复它。 $subject = "Bulk Order"; $message = "Hello!"; $mail = new Mail(); $mail->protocol = $this->config->get('config_mail_protocol'); $mail->parameter = $this->config->get('config_mail_parameter'); $mail->smtp_hostname = ...
  • 您可以使用PHP Mailer Class发送带附件的邮件。 You can use PHP Mailer Class to send mails with attachments.
  • Gmail不支持媒体查询(或