- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我收到一个简单的错误,因为我阅读了一个文档 ( https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html#x86-Function-Attributes ) 并希望正确地做事。在这份文件中指出:
An interrupt handler must be declared with a mandatory pointer argument:
struct interrupt_frame;
__attribute__ ((interrupt))
void
f (struct interrupt_frame *frame)
{
}and you must define struct interrupt_frame as described in the processor’s manual.
Exception handlers differ from interrupt handlers because the system pushes an error code on the stack. An exception handler declaration is similar to that for an interrupt handler, but with a different mandatory function signature. The compiler arranges to pop the error code off the stack before the IRET instruction.
#ifdef __x86_64__
typedef unsigned long long int uword_t;
#else
typedef unsigned int uword_t;
#endif
struct interrupt_frame;
__attribute__ ((interrupt))
void
f (struct interrupt_frame *frame, uword_t error_code)
{
...
}Exception handlers should only be used for exceptions that push an error code; you should use an interrupt handler in other cases. The system will crash if the wrong kind of handler is used.
struct InterruptFrame{
UINT64 rsp;
};
//Divide by zero error
__attribute__((interrupt)) void IDT::isr0(InterruptFrame* frame) {
asm volatile("hlt");
}
//Page fault
__attribute__((interrupt)) void IDT::isr14(InterruptFrame* frame, unsigned long long int errorCode) {
asm volatile("hlt");
}
这些只是示例,因为我有更多独立的 ISR。当我编译时
g++ -static -ffreestanding -nostdlib -mgeneral-regs-only -mno-red-zone -c -m64 Kernel/Source/IDT.cpp -oKernel/Object/IDT.o
我收到一个错误说明
error: interrupt service routine should have ‘unsigned long int’ as the second argument
即使我完全按照文档中的说明做了。即使对于当前具有 unsigned long long int 作为第二个参数的页面错误处理程序,我也会收到每个 ISR 的错误。我没有在网上找到太多关于错误的搜索,所以我想在这里问。
最佳答案
What is wrong?
error: interrupt service routine should have ‘unsigned long int’ as the second argument
根据该错误消息,我建议通过将“unsigned long int”作为第二个参数而不是 unsigned long long int 来解决问题。
错误消息的源代码揭示了使用哪种类型的条件:
gcc/config/i386/i386-options.c
error ("interrupt service routine should have %qs "
"as the second argument",
TARGET_64BIT
? (TARGET_X32 ? "unsigned long long int"
: "unsigned long int")
: "unsigned int");
所以,似乎unsigned int
定位 32 位 x86 时应使用,unsigned long long
当目标是 64 x86_64 和unsigned long
的 32 位 ABI 时应该使用当以 x86_64 的 64 位 ABI 为目标时。
Also, what members should the InterruptFrame struct contain for x86-64?
我认为您不一定需要定义结构,直到您打算访问它。但如果你这样做,AMD64 架构
程序员手册
第 2 卷:
系统编程 说道:
8.9 Long-Mode Interrupt Control Transfers
8.9.3 Interrupt Stack Frame
在上面,有关于内容的详细描述。
根据图表,以下似乎匹配(未经测试。我建议读者验证顺序是否正确或颠倒):struct interrupt_frame
{
std::uint64_t instruction_pointer;
std::uint64_t code_segment;
std::uint64_t rflags;
std::uint64_t register_stack_pointer;
std::uint64_t stack_segment;
}
关于c++ - 为什么我收到错误 : interrupt service routine should have ‘unsigned long int’ as the second argument?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68839642/
我需要根据模板化参数返回正确的类型。我收到如下错误:有人可以建议解决这个问题的方法是什么吗?提前致谢。 error: no matching function for call to âsecond:
这个问题已经有答案了: 已关闭10 年前。 Possible Duplicate: How to convert milliseconds to “hh:mm:ss” format? 我敢打赌很多人都
在脚本中,我使用 AJAX 从脚本请求数据。返回的数据以JSON格式返回。该脚本返回秒数,我正在寻找一种简单的方法来生成倒计时,显示返回值生成的分钟和秒数。 例如,如果脚本返回 90,我需要每秒显示一
为什么以下不抛出错误并返回 59 秒? # 2016-02-02T16:05:59+00:00 DateTime.strptime('02-02-2016 04:05:60 PM', '%d-%m-%
我想重新排列一个数据框,以便 1) 第一列始终保持在最前面,并且 2) 其余列的后半部分被拆分为每秒出现。 注意下面的例子 请查看示例数据: # Example data N # 1 A
我正在使用一个函数 HideFrame 来隐藏/显示两个 iframe 的左侧。该函数由使用按钮 image1 和 image2 的 onclick() 事件调用。 不幸的是,当我单击 image1
这个问题在这里已经有了答案: What is a non-capturing group in regular expressions? (18 个答案) 关闭 3 年前。 我正在尝试理解和练习以下
我可以请求一些关于子查询的帮助吗? 当我在本地 XAMP mySQL 数据库上运行查询时,查询需要 2 秒才能完成。然而,在我的网络服务器上使用相同的数据库,相同的查询需要 98 秒以上才能返回相同的
此处 unsigned long EVTime::seconds() 方法与 ptime p(d,seconds(s)); 冲突。如果我将 ptime seconds(s) 更改为分钟/小时,那么它工
GetSystemTimePreciseAsFileTime:以尽可能高的精度 (<1us) 检索当前系统日期和时间。 这给了我们一个 FILETIME 然后我们将它传递给:文件时间到系统时间这给了我
我现在面临的问题: 我有一个应用程序,它包含第一个 Activity MainActivity 和第二个名为 SecondActivity 的 Activity。现在,在这两个中我都需要一个单独的表:
我不明白为什么这个方法不起作用。使用 isEqualToDate: 时是否查看秒数和分秒数? //Test that the NSDate category's DatePlusDays: metho
在 http://www.cplusplus.com/reference/map/map/insert/ ,我对做 ret.first->second 的推理感到困惑或 it->second访问第二个
使用 Bash 脚本将 00:20:40.28 (HH:MM:SS) 转换为秒的简单方法是什么? 分秒可以剪掉,不是必须的。 最佳答案 试试 awk。作为奖励,您可以保留分秒。 echo "00:20
我正在尝试计算设定的日期时间对象和当前时间之间耗时。我希望它能够以这种格式出现 DD:HH:MM:SS 其中 DD 是天,HH 是小时,MM 是分钟,SS 是秒。我能够得到总天数、总小时数、总分钟数和
我仍然很新...所以, 我的问题的症结可以概括为:我正在准备将数据发送到远程API,这要求此字段为time.Duration类型,而我试图将其作为秒类型的字符串类型###s发送,并且time.Pars
我附和这个: php> echo date("Y-m-d\TH:i:s"); 2011-05-27T11:21:23 如何使用日期函数来获取这种日期格式: 2011-01-12T14:
我很好奇两者之间有什么区别。 irb(main):001:0> require 'active_support/core_ext' => true irb(main):002:0> 1.second.
浏览一些代码,我发现了两种每秒做某事的方法: for { fmt.Println("This is printed every second") time.Sleep(time.Sec
我正在使用 Sidekiq 在 AWS 服务器上创建 PDF 文档以在后台处理此作业。 在创建 PDF 文件的过程中,[Rails] 应用程序正在汇集数据库以检查是否创建了 PDF 文件(间隔:2 秒
我是一名优秀的程序员,十分优秀!