Thread: How to access processor regosters

  1. #1
    Registered User
    Join Date
    Jul 2007
    Location
    Hyderabad
    Posts
    35

    How to access processor regosters

    Hi,

    i want to access processor registeres using c.but i donot know processor information(how many registres and all).

    could you please tell me how to access processor info

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    You could do it with inline assembly.

    Why do you want to know?

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    If you don't know how to access them or how many there are you probably shouldn't be accessing them.

  4. #4
    Registered User
    Join Date
    Jul 2007
    Location
    Hyderabad
    Posts
    35
    i written a small code

    Code:
    struct REGS inregs, outregs;
    int86(18,&inregs,&outregs);
    memory=outregs.x.ax;
    printf("memory:%d',memory);
    but on linux it is giving compiler error on init86.the same i have implement on linux.

    how should i do it.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Jul 2007
    Location
    Hyderabad
    Posts
    35
    yeah the same thing iam looking for. thank you for link.

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Of course, calling the BIOS from Linux won't work anyways, so it's kind of pointless discussion. That only works in DOS - the same wouldn't work in Windows either [although in a DOS-box you can do that sort of thing, if you wish, because DOS emulation in Windows supports running most BIOS calls].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. access to devices
    By pastitprogram in forum C++ Programming
    Replies: 1
    Last Post: 06-06-2008, 11:16 PM
  2. Order of access labels in class definition
    By Mario F. in forum C++ Programming
    Replies: 10
    Last Post: 06-16-2006, 07:13 AM
  3. ww hosting and SSH access
    By spoon_ in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 04-07-2005, 08:49 AM
  4. Replies: 3
    Last Post: 09-22-2003, 09:48 PM