Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Work Issues
  4. How we print registers

How we print registers

Scheduled Pinned Locked Moved Work Issues
linuxquestion
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kokabgujjar
    wrote on last edited by
    #1

    I am trying to access registers using C in linux I am using Linux ver 2.4.7-10. the code is as following #include #include #define REG mn.uc_mcontext.gregs char *reg[]={"GS", "FS", "ES", "DS","EDI", "ESI", "EBP", "ESP", "EBX", "EDX", "ECX","EAX", "TRAPNO", "ERR", "EIP", "CS", "EFL", "UES P", "SS"}; int abc(void); main() { ucontext_t mn; int i; i = abc(); getcontext(&mn); printf("INT size = %d\n", sizeof(int)); for(i=0;i<19;i++) printf("%s = 0X%X\n", reg[i], REG[REG_GS]); printf("Address of main is =%X\n", main); } int abc(void) { return 1; } the results are GS = 0X400361E4 FS = 0X0 ES = 0X3 DS = 0XBFFFF970 EDI = 0XBFFFFAA4 ESI = 0X400168E4 EBP = 0XBFFFFA38 ESP = 0XBFFFF8B0 EBX = 0X40169154 EDX = 0XBFFFFAAC ECX = 0X0 EAX = 0X0 TRAPNO = 0X4003E514 ERR = 0X400361E4 EIP = 0X80484D5 CS = 0X3 EFL = 0X40032268 UESP = 0X1 SS = 0X8048180 how i can verify is it corret result? KOKAB WAQAS

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups