在mainbord上我们有一个中断控制器(IRC),它作为设备之间的多路复用器,可以引发中断和CPU:
|--------|
|-----------| | |
-(0)------| IRC _____|______| CPU |
-(...)----| ____/ | | |
-(15)-----|/ | |--------|
|-----------|
Run Code Online (Sandbox Code Playgroud)
每个设备都与IRQ(左侧的数字)相关联.每次执行后,CPU都会检测到中断请求线.如果检测到信号,将执行状态保存,并且CPU加载中断处理程序例程,该例程可以在位于存储器中固定地址的中断向量中找到.据我所知,中断向量中的IRQ数和向量数不一样,因为我的网卡已经注册到IRQ 8.在Intel Pentium处理器上,这将指向一个使用的例程发出一个错误信号,因此必须有一个指向正确处理程序的映射.
问题:
1)如果我写一个设备驱动程序并为它注册一个IRQ X. 系统从哪里知道应该处理哪个设备?例如,我可以使用IRQ编号为10的request_irq(),但系统如何知道处理程序应该用于鼠标或键盘,或者用于编写驱动程序的任何内容?
2)中断向量看起来如何?我的意思是如果我将IRQ 10用于我的设备,这将覆盖用于表中错误处理的标准处理程序(根据Silberschatz(操作系统概念),第一个可用的是32).
3)谁最初设置了IRQ?Bios?操作系统?
4)谁负责IRQ与中断向量中的偏移的匹配?
5)可以共享IRQS.怎么可能?主板上有硬件通道,用于将设备连接到中断控制器.如何将通道配置为相同的中断?必须有一个表格,表示第2道和第3道处理IRQ15,例如该表位于何处以及如何调用?
我查看了缓冲区溢出漏洞的基础知识,并尝试了解堆栈的工作原理.为此,我想编写一个简单的程序,将返回地址的地址更改为某个值.任何人都可以帮我弄清楚基本指针的大小以获得第一个参数的偏移量吗?
void foo(void)
{
char ret;
char *ptr;
ptr = &ret; //add some offset value here
*ptr = 0x00;
}
int main(int argc, char **argv)
{
foo();
return 1;
}
Run Code Online (Sandbox Code Playgroud)
生成的汇编程序代码如下所示:
.file "test.c"
.text
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
leaq -9(%rbp), %rax
movq %rax, -8(%rbp)
movq -8(%rbp), %rax
movb $0, (%rax)
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size foo, .-foo
.globl main
.type …
Run Code Online (Sandbox Code Playgroud) 有人可以解释一下为什么'this'在下面指向DOM对象而不是Window?
$("a").click(function() {
console.log(this);
});
Run Code Online (Sandbox Code Playgroud)
这导致:
<a id="first" href="http://jquery.com">
Run Code Online (Sandbox Code Playgroud)
考虑以下应该是相同的场景:
function Foo() {
this.click = function(f) {
f();
}
}
var obj = new Foo();
obj.click(function() {
console.log(this);
});
Run Code Online (Sandbox Code Playgroud)
我们得到的是Window Object(我所期待的).
我正在编写一个跟踪用户位置的测试应用程序.我的想法是,我可以启动一项服务,然后注册位置更新.现在我正在使用IntentService.
服务代码(不起作用......)看起来像这样:
public class GpsGatheringService extends IntentService {
// vars
private static final String TAG = "GpsGatheringService";
private boolean stopThread;
// constructors
public GpsGatheringService() {
super("GpsGatheringServiceThread");
stopThread = false;
}
// methods
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(TAG, "onStartCommand()");
return super.onStartCommand(intent, flags, startId);
}
@Override
protected void onHandleIntent(Intent arg0) {
// this is running in a dedicated thread
Log.d(TAG, "onHandleIntent()");
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
LocationListener locationListener = new LocationListener() {
@Override
public void onStatusChanged(String …
Run Code Online (Sandbox Code Playgroud) 我正在对GPGPU进行一些研究,目前正在努力解决特斯拉和CUDA究竟是什么问题.在"NVIDIA Tesla:统一图形和计算架构"一文中,它说特斯拉架构是随GeForce 8800推出的.随着进一步的阅读,我确信它是NVIDIA显卡的整体架构.不幸的是,事实并非如此.在http://www.nvidia.com/object/why-choose-tesla.html上,他们明确地分离了GeForce,Quadro和Tesla.那么与CUDA有什么关系呢?它只是Cuda-C硬件支持的GPU上的一般计算的扩展吗?SM,SIMT,线程同步,共享内存,Warp等概念到底是什么相关的?CUDA?特斯拉?此外http://nvidia.custhelp.com/app/answers/detail/a_id/2133/~/what-is-the-difference-between-tesla-and-cuda%3F特斯拉是一系列专为产品设计的产品高性能计算和CUDA只是软件.有人能澄清一下吗?
我想使用Raspberry PI和Raspbian OS为ARMv6指令集架构编写一个简单的缓冲区溢出示例.我首先看一下堆栈框架的布局.很遗憾,我无法找到回邮地址.请考虑以下示例:
void foo
(int b)
{
int c = 3;
}
int main
(int argc, char **argv)
{
int a = 1;
foo(2);
a = 4;
}
Run Code Online (Sandbox Code Playgroud)
我编译它:
gcc exploit_me.c -g -O0 -o exploit_me
Run Code Online (Sandbox Code Playgroud)
使用gdb调试代码可以获得以下信息:
gdb exploit_me
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by …
Run Code Online (Sandbox Code Playgroud)