mirror of
https://github.com/gatieme/LDD-LinuxDeviceDrivers.git
synced 2026-08-23 16:09:43 +08:00
21 lines
267 B
C
21 lines
267 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
// 不指定寄存器实现两个整数相加
|
|
int Add(int a, int b)
|
|
{
|
|
__asm__ __volatile__
|
|
(
|
|
//"lock;\n"
|
|
"addl %1,%0;\n"
|
|
: "=m"(a)
|
|
: "r"(b), "m"(a)
|
|
// :
|
|
);
|
|
|
|
return a;
|
|
}
|
|
|