flat assembler
Message board for the users of flat assembler.

Index > Linux > Framebuffer, putpixel, segfault

Author
Thread Post new topic Reply to topic
lavrin



Joined: 22 Dec 2009
Posts: 2
lavrin 22 Dec 2009, 00:40
Hello, everyone!

I've got a question to ask about a framebuffer program I'm trying to put together for a low-level programming course at my university.

To the point. Target architecture is x86-64. I've managed to map the framebuffer device file /dev/fb0 to memory. However, when I try put a pixel on screen, the program segfaults. I haven't got even a vague idea what may be the cause.

I would be grateful for any hints. My situation is pretty hard, as I don't know anyone skilled in this field. The source is accessible here [1].

Regards,
Radosław Szymczyszyn

--
[1]: http://ernie.icslab.agh.edu.pl/~lavrin/fb.asm
Post 22 Dec 2009, 00:40
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20343
Location: In your JS exploiting you and your system
revolution 22 Dec 2009, 00:51
I think your problem is here:
Code:
    mov   dword [fb + rbp], 0xeeeeee00
...
        fb        rq  1    
'fb' is allocated as only one qword but you are writing to it with offsets in rbp.

Perhaps you can try something like this:
Code:
    mov   rax,[fb]
    mov   dword [rax + rbp], 0xeeeeee00    
Post 22 Dec 2009, 00:51
View user's profile Send private message Visit poster's website Reply with quote
lavrin



Joined: 22 Dec 2009
Posts: 2
lavrin 22 Dec 2009, 00:56
You're perfectly right. Thanks!
Post 22 Dec 2009, 00:56
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.