使用C进行登记 [英] Acessing registers with C

查看:77
本文介绍了使用C进行登记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hiya,


我希望能够使用C读取x86

类型处理器的寄存器中的值。


我可以在ASM中做到这一点,但我真的想在我的项目中使用C,我/ b $ b之前没有在C中做过这样的事情,并且有兴趣

学习如何。


虽然操作系统并不真正与纯C有关,但我怀疑b $ b怀疑它们之间会有什么区别* nix和windows产品,

我想我应该明确表示我想找出某个程序正在使用的空间

,两者都是*尼克斯和窗户。我不知道这是CX寄存器,只是不确定如何将它应用到

某个程序。


谢谢


Greg

Hiya,

I would like to be able to read the values in the registers of the x86
type processor, using C.

I could do this in ASM but I really want to use C for my project, I
havent done anything like this in C before and would be interested to
learn how to.

Although the operating system doesnt really relate to pure C, and I
doubt there will be any difference between *nix and windows products,
I think i should make it clear that I would like to find out the space
that is being used by a certain program, in both *nix and windows. I
no that this is the CX register just not sure how to apply it to a
certain program.

Thanks

Greg

推荐答案

gr ********** @ hotmail.com (jeff)写道:
gr**********@hotmail.com (jeff) wrote:
我希望能够使用C读取x86
类型处理器的寄存器中的值。


不能用于设计为可移植到其他的语言
$ b当b / b
语言诞生时,$ b处理器比单个处理器还要存在。

可以使用语言的扩展来执行此操作br />
由您的编译器提供,但这在comp.lang.c中是偏离主题的,

处理语言本身而不是各种各样的

不兼容的附加组件。再说一次,你的编译器可能根本不可能使用



你应该在一个专门的新闻组中提出这个问题,一个可以处理的问题。
。你的实现。

虽然操作系统并不真正与纯C有关,但我怀疑* nix和windows产品之间会有什么区别,
I would like to be able to read the values in the registers of the x86
type processor, using C.
Not possible in a language that was designed to be portable to other
processors than a single one which didn''t even exist when the language
was born.
It may be possible to do this using an extension to the language
provided by your compiler, but this would be off-topic in comp.lang.c,
which deals with the language itself and not with the various mutually
incompatible add-ons. Then again, it may not be possible at all using
your compiler.
You should ask this question in a specialised newsgroup, one that deals
with your implementation.
Although the operating system doesnt really relate to pure C, and I
doubt there will be any difference between *nix and windows products,



我不太确定。


Richard



I wouldn''t be so sure.

Richard




" jeff" < GR ********** @ hotmail.com>在留言中写道

news:cd ************************** @ posting.google.c om ...

"jeff" <gr**********@hotmail.com> wrote in message
news:cd**************************@posting.google.c om...
Hiya,

我希望能够使用C读取x86
类型处理器的寄存器中的值。


一个好的优化编译器不会在源头告诉你有意义的东西

级别关于寄存器中的内容。所以你最好的选择是实际编写一个汇编程序例程。

虽然操作系统并不真正与纯C相关,而且我只需要b $ b

怎么样?现在大多数操作系统都是用C编写的。

怀疑* nix和windows产品之间会有什么区别,
我想我应该说清楚我想找出空间
正在被* nix和windows中的某个程序使用。我不知道这是CX寄存器,只是不知道如何将它应用到某个程序。
Hiya,

I would like to be able to read the values in the registers of the x86
type processor, using C.

I could do this in ASM but I really want to use C for my project, I
havent done anything like this in C before and would be interested to
learn how to.
A good optimizing compiler won''t tell you meaningful things at the source
level about what''s in the registers at all times. So you''re best bet is to
actually code an assembler routine.
Although the operating system doesnt really relate to pure C, and I
How so? Most operating systems are written in C nowadays.
doubt there will be any difference between *nix and windows products,
I think i should make it clear that I would like to find out the space
that is being used by a certain program, in both *nix and windows. I
no that this is the CX register just not sure how to apply it to a
certain program.




如何应用CX寄存器你的程序?这没有任何意义




Tom



How to apply the CX register to your program? That doesn''t make any sense
whatsoever.

Tom


Tom St Denis写道:
Tom St Denis wrote:
" jeff" < GR ********** @ hotmail.com>在消息中写道
"jeff" <gr**********@hotmail.com> wrote in message



[...]


[...]

我怀疑* nix和windows产品之间会有什么区别,


* nix和Windows之间没有区别???


嗯,就纯ANSI C而言,这是真的。我担心,但我怀疑我如何访问CX寄存器?算作纯ANSI C。

我想我应该明确表示我想找出某个程序正在使用的空间
和窗户。我不知道这是CX寄存器,只是不确定如何将它应用到某个程序。
I doubt there will be any difference between *nix and windows products,
No difference between *nix and Windows???

Well, this is true as far as "pure ANSI C" is concerned, but I doubt
that "how do I access the CX register" counts as "pure ANSI C".
I think i should make it clear that I would like to find out the space
that is being used by a certain program, in both *nix and windows. I
no that this is the CX register just not sure how to apply it to a
certain program.



如何将CX寄存器应用到您的程序中?这没有任何意义



How to apply the CX register to your program? That doesn''t make any sense
whatsoever.




我认为他指的是微型MS-DOS程序的事实/>
(即:* .COM)从包含

可执行映像大小的CX寄存器开始。 (至少,这是我多年前所记得的。)


现在,这是如何适用于* nix和Windows,更不用说C一般,

我不知道。 (好吧,我知道。答案是它不会。)


-


+ ---- ----- + ---------------------------------- + --------- -------------------- +

|肯尼斯| kenbrody at spamcop.net | 表达的意见|

| J. | http://www.hvcomputer.com |这里不一定是|
|布罗迪| http://www.fptech.com |那些fP技术。 |

+ --------- + ------------------------------ ---- + ----------------------------- +



I think he''s referring to the fact that tiny-model MS-DOS programs
(ie: *.COM) start with the CX register containing the size of the
executable image. (At least, that''s what I recall from years ago.)

Now, how this applies to *nix and Windows, let alone C in general,
I don''t know. (Well, I do. The answer is "it doesn''t".)

--

+---------+----------------------------------+-----------------------------+
| Kenneth | kenbrody at spamcop.net | "The opinions expressed |
| J. | http://www.hvcomputer.com | herein are not necessarily |
| Brody | http://www.fptech.com | those of fP Technologies." |
+---------+----------------------------------+-----------------------------+

这篇关于使用C进行登记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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