flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Accessing Liner frame Buffer from long mode

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Mac2004



Joined: 15 Dec 2003
Posts: 314
Mac2004 08 Mar 2008, 08:54
I was doing some long mode LFB testing sometime ago.
I fetched normally LFB start address and tried to access it while in long mode.
All access attemps caused hardware interrupt (=exception).
All accesses prior setting long mode are working as expected.


So the question is: Is there a way to access LFB while in long mode or do I have to switch everytime back to protected mode?

regards,
Mac2004


Last edited by Mac2004 on 12 Mar 2008, 18:22; edited 1 time in total
Post 08 Mar 2008, 08:54
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20519
Location: In your JS exploiting you and your system
revolution 08 Mar 2008, 09:05
Short answer: Yes, you can access LFB from long mode.

Long answer: Provide more information. Are you using paging? What do you mean by "hardware interrupts"? Show us some sample code so that we might be able to help you.
Post 08 Mar 2008, 09:05
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 08 Mar 2008, 11:19
Obviously he's using paging since he's in long mode - the question is whether he's set up a mapping for the framebuffer, which I guess he hasn't Smile
Post 08 Mar 2008, 11:19
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 08 Mar 2008, 17:11
Your best setting paging to 1 to1 mapping, as you must use paging in long mode Sad , that one of the reasons i do not use long mode, but if i did, i would map it 1 to 1 .
Post 08 Mar 2008, 17:11
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 08 Mar 2008, 17:49
Why do so many people have a problem with paging?
Post 08 Mar 2008, 17:49
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20519
Location: In your JS exploiting you and your system
revolution 08 Mar 2008, 17:51
f0dder wrote:
Obviously he's using paging since he's in long mode
My emphasis was meant to be on the third word: "Are you using paging?"
f0dder wrote:
Why do so many people have a problem with paging?
I love it, made my ARM OS a breeze to program.
Post 08 Mar 2008, 17:51
View user's profile Send private message Visit poster's website Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias 08 Mar 2008, 18:03
fudder wrote:
Why do so many people have a problem with paging?
I don't know that "so many people" do have a problem with it. I have a problem with it, for me, it is a step backwards, to those days of yesteryear when we did not have any hope of owning two or four gigabytes of ram. I remember, as if yesterday, how exciting it was to install 16 megabytes of RAM, as though I had just created a monster computer, ready to tackle the most ambitious computing task. Paging exists to overcome the LACK of memory. We no longer experience that deficit, hence we no longer require paging.
Post 08 Mar 2008, 18:03
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20519
Location: In your JS exploiting you and your system
revolution 08 Mar 2008, 18:14
tom tobias wrote:
Paging exists to overcome the LACK of memory. We no longer experience that deficit, hence we no longer require paging.
Paging has more uses than simply a stand-in for lack of memory. The ability to multi-task all binaries without having to re-base is one very useful advantage. Also task isolation and memory usage monitoring to name just a few.
Post 08 Mar 2008, 18:14
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 08 Mar 2008, 18:18
revolution wrote:
My emphasis was meant to be on the third word: "Are you using paging?"
Thought so, just wanted to make it explicit Smile

tom tobias: for me, the most important aspect of paging is the memory protection, not being able to do disk swapping. Obviously memory protection can be done in different ways, like through MTRRs, but it's not doable that way on x86.

Also, paging allows you to do some pretty advanced tricks - you could profile how "hot" your memory pages are by setting pages to not present, and keeping hit counters on #PF.
Post 08 Mar 2008, 18:18
View user's profile Send private message Visit poster's website Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 314
Mac2004 09 Mar 2008, 16:23
Ok, here's the source. It's based on Thomasz's example, but I have added several bits of code there. I hope the source provides enough documentation of the problem.


regards,
Mac2004


Description:
Download
Filename: lm.zip
Filesize: 50.73 KB
Downloaded: 260 Time(s)

Post 09 Mar 2008, 16:23
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 09 Mar 2008, 18:25
First thanks for the code. Now i notest that it says this
Code:
        ;--------------------------------------------------------        ;Put something to LFB memory while in long mode.        ;This filler does not work. Causes an exception to occur.     ;Exceptions turn on pc speaker.        ;--------------------------------------------------------    


So the LFB still does not work in long mode ?, it seams as if you do not map the LFB, only the first MB or so.
I think you need to map it.
Post 09 Mar 2008, 18:25
View user's profile Send private message Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 314
Mac2004 09 Mar 2008, 20:44
@Revolution: Yes, paging is set up in the code.

Dex4u wrote:
So the LFB still does not work in long mode ?, it seams as if you do not map the LFB, only the first MB or so.
I think you need to map it.


Thanx Dex4u for testing!

So it seems that LFB does not work in long mode without some extra remapping.
Personally I have used PM without paging because no special setting up is needed. Just simple accessing... Smile

regards,
Mac2004
Post 09 Mar 2008, 20:44
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 09 Mar 2008, 21:16
Umm... you shouldn't be able to use long mode at all without paging...
Post 09 Mar 2008, 21:16
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 09 Mar 2008, 21:56
First that demo does enable paging, but it does not map the LFB address.
Now i do not use paging in my OS, (Its pmode only), so your best get someone to addvise you about how to mapping the LFB address.
But i would say thats your problem.
Post 09 Mar 2008, 21:56
View user's profile Send private message Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 514
Location: Czech republic, Slovak republic
Feryno 12 Mar 2008, 09:47
http://board.flatassembler.net/topic.php?p=68630#68630
it uses 3-level mapping with 2 MB pages instead of 4-level with 4 kB pages (easier for me to do, less operations with less number of pages)
requires graphic card and monitor capable to do 1024*768 screen resolution with 32 bit color (or at least 24 bit color)
cut off bullshits and use only parts which you need
tested only on my PC, I don't know whether it runs in other PCs
Post 12 Mar 2008, 09:47
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 314
Mac2004 12 Mar 2008, 17:03
Feryno: Thank you. I downloaded your code a few secs ago and now I will take a look at it. Smile

regards,
Mac2004
Post 12 Mar 2008, 17:03
View user's profile Send private message Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 314
Mac2004 12 Mar 2008, 18:23
f0dder wrote:
Umm... you shouldn't be able to use long mode at all without paging...


You seem to be a big fan of paging, I see.Smile

regards,
Mac2004
Post 12 Mar 2008, 18:23
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 13 Mar 2008, 00:32
I wouldn't say I'm a big fan of it, it does the trick for x86 but Maverick got me thinking a bit and I'd prefer "a sizable amount" of flexible++ MTRRs and an implicit per-process base-address register...

Anyway, with the sentence above I meant simply that, afaik, you can't enter long mode without paging enabled.
Post 13 Mar 2008, 00:32
View user's profile Send private message Visit poster's website Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 314
Mac2004 13 Mar 2008, 18:09
f0dder wrote:
I wouldn't say I'm a big fan of it, it does the trick for x86 but Maverick got me thinking a bit and I'd prefer "a sizable amount" of flexible++ MTRRs and an implicit per-process base-address register...

Anyway, with the sentence above I meant simply that, afaik, you can't enter long mode without paging enabled.


@f0dder: ok, I see.

@Feryno:
Your example worked on my AMD64 3500+ as expected. With the help from your code I was able to fix my LFB problem. Thanx! Smile

Regards,
Mac2004
Post 13 Mar 2008, 18:09
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 13 Mar 2008, 19:32
Thanks Feryno, for the vesa long mode example, it worked on my AMD64 too.
Post 13 Mar 2008, 19:32
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.