serpretetsky
2[H]4U
- Joined
- Dec 24, 2008
- Messages
- 2,180
I'm doing some basic assembly language programming for x86-64 using gcc on ubuntu 64.
Anyways, i've noticed that whenever i try to access memory i'm not supposed to, it breaks with a segmentation error.
This is not the problem i have. The problem is that i want someway to be able to check if a memory address is accessable to me without breaking out of my program and giving control back to the os.
this is purely educational, im just trying to learn how all of this works.
For example: i want to create a loop that simply goes through every single memory address and prints the contents out to me. I realize that most addresses i wont have access to, but i dont want my program to stop, i'd rather it just printed an error and continued.
how can i do this? ( something i can do in assembly, or some option in os where i can tell it to simply ignore seg faults and give my program some error code?)
I'm very much a noob to assembly.
also, something im confused about. Whats the point of separating the text segment (code) from the data segment (data). I accidently put one of my strings under .text and doesn't seem to make any difference from what i can tell. Is .text always read only or something?
Anyways, i've noticed that whenever i try to access memory i'm not supposed to, it breaks with a segmentation error.
This is not the problem i have. The problem is that i want someway to be able to check if a memory address is accessable to me without breaking out of my program and giving control back to the os.
this is purely educational, im just trying to learn how all of this works.
For example: i want to create a loop that simply goes through every single memory address and prints the contents out to me. I realize that most addresses i wont have access to, but i dont want my program to stop, i'd rather it just printed an error and continued.
how can i do this? ( something i can do in assembly, or some option in os where i can tell it to simply ignore seg faults and give my program some error code?)
I'm very much a noob to assembly.
also, something im confused about. Whats the point of separating the text segment (code) from the data segment (data). I accidently put one of my strings under .text and doesn't seem to make any difference from what i can tell. Is .text always read only or something?