在IDT中安装C函数 [英] Installing a C function into the IDT

查看:72
本文介绍了在IDT中安装C函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿 -


我正在阅读关于中断的内容,我认为在程序范围内使用中断这将是一个真正的好的事情异常处理。我无法找到的是一个明确的指南或示例程序,用于如何在IDT中安装C函数
。传递参数会发生什么?


我想要这样的东西:


void malloc_failure();


假设我把它安装为中断插槽42,然后我可以这样做:


if(!(p =(int *)malloc(1000 * 4) )))// 1000个整数的数组

__asm __(" int $ 0x42");


这有什么理由不起作用吗?如何设置

中断?我需要root privelidges吗?


谢谢!!

Hey-

I was reading about interrupts, and I got to thinking it would be a real
neat thing to use interrupts for program-wide exception handling. What I
haven''t been able to find is a clear guide or example program for how to
install a C function into the IDT. And what happens about passing arguments?

I''d like to have something like this:

void malloc_failure();

Say I install this as interrupt slot 42, then I can do:

if(!(p=(int*)malloc(1000*4))) // array of 1000 ints
__asm__ ("int $0x42");

Is there any reason for this not to work? How do I set up the
interrupts? Would I need root privelidges to do that?

Thanks!!

推荐答案

0x42");


这有什么理由不起作用吗?如何设置

中断?我需要root privelidges吗?


谢谢!!
0x42");

Is there any reason for this not to work? How do I set up the
interrupts? Would I need root privelidges to do that?

Thanks!!


The Prisoner写道:
The Prisoner wrote:

嘿 -


我正在阅读关于中断的内容,我认为这将是一个真实的

整洁的事情使用中断进行程序范围的异常处理。我无法找到的是一个明确的指南或示例程序,用于如何在IDT中安装C函数
。关于传递

参数会发生什么?


我想要这样的东西:


void malloc_failure();


假设我把它安装为中断插槽42,然后我可以这样做:


if(!(p =( int *)malloc(1000 * 4)))// 1000个整数的数组

__asm __(" int
Hey-

I was reading about interrupts, and I got to thinking it would be a real
neat thing to use interrupts for program-wide exception handling. What I
haven''t been able to find is a clear guide or example program for how to
install a C function into the IDT. And what happens about passing
arguments?

I''d like to have something like this:

void malloc_failure();

Say I install this as interrupt slot 42, then I can do:

if(!(p=(int*)malloc(1000*4))) // array of 1000 ints
__asm__ ("int


0x42");


这有什么理由不起作用吗?如何设置

中断?我需要root privelidges吗?


谢谢!
0x42");

Is there any reason for this not to work? How do I set up the
interrupts? Would I need root privelidges to do that?

Thanks!!



这将是基于中断的异常处理......一个有风险的业务。


很难写出来C.正常中断服务

例程应该从中断指令返回,而不是像正常函数那样返回
。编译器需要

来支持...


此外,中断例程不应该销毁任何寄存器,并且

它应该保存的寄存器......


等。这种方法有很多问题。


-

jacob navia

jacob at jacob point remcomp point fr

logiciels / informatique
http://www.cs.virginia.edu/~lcc-win32


这篇关于在IDT中安装C函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆