- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我试图在 Arch linux 上编译 xen 并收到以下错误:
src/stacks.c:342:5: error: 'asm' operand has impossible constraints
asm volatile(
^
这是导致错误的方法的代码:
void
run_thread(void (*func)(void*), void *data)
{
ASSERT32FLAT();
if (! CONFIG_THREADS || ! ThreadControl)
goto fail;
struct thread_info *thread;
thread = memalign_tmphigh(THREADSTACKSIZE, THREADSTACKSIZE);
if (!thread)
goto fail;
dprintf(DEBUG_thread, "/%08x\\ Start thread\n", (u32)thread);
thread->stackpos = (void*)thread + THREADSTACKSIZE;
struct thread_info *cur = getCurThread();
hlist_add_after(&thread->node, &cur->node);
asm volatile(
// Start thread
" pushl $1f\n" // store return pc
" pushl %%ebp\n" // backup %ebp
" movl %%esp, (%%edx)\n" // cur->stackpos = %esp
" movl (%%ebx), %%esp\n" // %esp = thread->stackpos
" calll *%%ecx\n" // Call func
// End thread
" movl %%ebx, %%eax\n" // %eax = thread
" movl 4(%%ebx), %%ebx\n" // %ebx = thread->node.next
" movl (%5), %%esp\n" // %esp = MainThread.stackpos
" calll %4\n" // call __end_thread(thread)
" movl -4(%%ebx), %%esp\n" // %esp = next->stackpos
" popl %%ebp\n" // restore %ebp
" retl\n" // restore pc
"1:\n"
: "+a"(data), "+c"(func), "+b"(thread), "+d"(cur)
: "m"(*(u8*)__end_thread), "m"(MainThread)
: "esi", "edi", "cc", "memory");
return;
fail:
func(data);
}
我不确定发生了什么。有懂行的大神帮忙看一下,看看这里有没有什么明显的问题?
更新:
你可以通过做两件事来修复这个错误:
将 COMMONCFLAGS += $(call cc-option,$(CC),-fstack-check=no,) 添加到 seabios makefile 中(如果您从 git AUR 构建 xen,则位置应为 xen/src/xen -4.5.1/tools/firmware/seabios-dir-remote/Makefile)
转到 stacks.c 并将 movl (%5), %%esp 更改为 movl %5, %%esp
最佳答案
直接原因可能是您没有直接或间接通过优化开关启用-fomit-frame-pointer
。因此,编译器用完了寄存器,因为 eax
、ebx
、ecx
和 edx
用于参数,esi
和 edi
是 clobber,ebp
是帧指针。因此,解决方案是确保启用此选项。
显然是 this code is part of SeaBIOS(感谢 Michael Petch 找到它)。 __end_thread
只是一个函数,而不是人们期望从那个施法魔法中得到的函数指针。因此,我认为这个构造的重点是解决任何最终的名称重整。不幸的是,它为此牺牲了一个寄存器。如果您知道您的环境不会破坏函数名称,您可以使用这个更简单的版本,它不需要额外的寄存器,并且在调试版本中也应该使用帧指针编译得很好:
asm volatile(
// Start thread
" pushl $1f\n" // store return pc
" pushl %%ebp\n" // backup %ebp
" movl %%esp, (%%edx)\n" // cur->stackpos = %esp
" movl (%%ebx), %%esp\n" // %esp = thread->stackpos
" calll *%%ecx\n" // Call func
// End thread
" movl %%ebx, %%eax\n" // %eax = thread
" movl 4(%%ebx), %%ebx\n" // %ebx = thread->node.next
" movl (%4), %%esp\n" // %esp = MainThread.stackpos
" call __end_thread\n" // call __end_thread(thread)
" movl -4(%%ebx), %%esp\n" // %esp = next->stackpos
" popl %%ebp\n" // restore %ebp
" retl\n" // restore pc
"1:\n"
: "+a"(data), "+c"(func), "+b"(thread), "+d"(cur)
: "m"(MainThread)
: "esi", "edi", "cc", "memory");
关于c - “asm”操作数具有不可能的约束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33888868/
我可以添加一个检查约束来确保所有值都是唯一的,但允许默认值重复吗? 最佳答案 您可以使用基于函数的索引 (FBI) 来实现此目的: create unique index idx on my_tabl
嗨,我在让我的约束在grails项目中工作时遇到了一些麻烦。我试图确保Site_ID的字段不留为空白,但仍接受空白输入。另外,我尝试设置字段显示的顺序,但即使尝试时也无法反射(reflect)在页面上
我似乎做错了,我正在尝试将一个字段修改为外键,并使用级联删除...我做错了什么? ALTER TABLE my_table ADD CONSTRAINT $4 FOREIGN KEY my_field
阅读目录 1、约束的基本概念 2、约束的案例实践 3、外键约束介绍 4、外键约束展示 5、删除
SQLite 约束 约束是在表的数据列上强制执行的规则。这些是用来限制可以插入到表中的数据类型。这确保了数据库中数据的准确性和可靠性。 约束可以是列级或表级。列级约束仅适用于列,表级约束被应用到整
我在 SerenityOS project 中偶然发现了这段代码: template void dbgln(CheckedFormatString&& fmtstr, const Parameters
我有表 tariffs,有两列:(tariff_id, reception) 我有表 users,有两列:(user_id, reception) 我的表 users_tariffs 有两列:(use
在 Derby 服务器中,如何使用模式的系统表中的信息来创建选择语句以检索每个表的约束名称? 最佳答案 相关手册是Derby Reference Manual .有许多可用版本:10.13 是 201
我正在使用 z3py 进行编码。请参阅以下示例。 from z3 import * x = Int('x') y = Int('y') s = Solver() s.add(x+y>3) if s.c
非常快速和简单的问题。我正在运行一个脚本来导入数据并声明了一个临时表并将检查约束应用于该表。显然,如果脚本运行不止一次,我会检查临时表是否已经存在,如果存在,我会删除并重新创建临时表。这也会删除并重新
我有一个浮点变量 x在一个线性程序中,它应该是 0或两个常量之间 CONSTANT_A和 CONSTANT_B : LP.addConstraint(x == 0 OR CONSTANT_A <= x
我在使用grails的spring-data-neo4j获得唯一约束时遇到了一些麻烦。 我怀疑这是因为我没有正确连接它,但是存储库正在扫描和连接,并且CRUD正在工作,所以我不确定我做错了什么。 我正
这个问题在这里已经有了答案: Is there a constraint that restricts my generic method to numeric types? (24 个回答) 7年前
我有一个浮点变量 x在一个线性程序中,它应该是 0或两个常量之间 CONSTANT_A和 CONSTANT_B : LP.addConstraint(x == 0 OR CONSTANT_A <= x
在iOS的 ScrollView 中将图像和带有动态文本(动态高度)的标签居中的最佳方法是什么? 我必须添加哪些约束?我真的无法弄清楚它是如何工作的,也许我无法处理它,因为我是一名 Android 开
考虑以下代码: class Foo f class Bar b newtype D d = D call :: Proxy c -> (forall a . c a => a -> Bool) ->
我有一个类型类,它强加了 KnownNat约束: class KnownNat (Card a) => HasFin a where type Card a :: Nat ... 而且,我有几
我知道REST原则上与HTTP无关。 HTTP是协议,REST是用于通过Web传输hypermedia的体系结构样式。 REST可以使用诸如HTTP,FTP等的任何应用程序层协议。关于REST的讨论很
我有这样的情况,我必须在数据库中存储复杂的数据编号。类似于 21/2011,其中 21 是文件编号,但 2011 是文件年份。所以我需要一些约束来处理唯一性,因为有编号为 21/2010 和 21/2
我有一个 MySql (InnoDb) 表,表示对许多类型的对象之一所做的评论。因为我正在使用 Concrete Table Inheritance ,对于下面显示的每种类型的对象(商店、类别、项目)
我是一名优秀的程序员,十分优秀!