Displaying RAM contents using assembly

I got inspired by the disassembly feature so I tried to make my own.
The program's goal is to print the contents of the RAM.
The program gets compiled but does not work. It says 'ram.exe has stopped working correctly. Windows is checking for a solution'.
Is it due to the protected mode or is there any fault in the code ?
Here's the code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
%include "asm_io.inc"

segment .data
output_msg db "RAM contents : ",0
space db " : ",0

segment .text
global _asm_main
_asm_main: 
enter 0,0
pusha
mov eax, output_msg
call print_string
call print_nl
mov edx,10
mov ebx,0x00007c00
for:
mov eax,ebx
call print_int
mov eax, space
call print_string
mov al,[ebx]
call print_char
call print_nl
inc ebx
dec edx
cmp edx,0
jne for
popa
mov eax,0
leave
ret
AFAIK, you can't really do this. The OS isn't going to allow to just invade parts of RAM that isn't your programs. I could be wrong though, and I'm sure someone will correct me lol
I think ResidentBiscuit is right, although you could circumvent it by looking into writing a kernel mode driver. Not the easiest thing to do, though.

My OS is going to have an "elevate" system call to elevate programs into ring 0. Obviously it will require superuser privileges!
Last edited on
Topic archived. No new replies allowed.