OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:40 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: VM86 Doesn't work with paging
PostPosted: Sun Dec 02, 2018 4:53 pm 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
hi,
a long time ago i've implemented VM86, and after a lot of testing, i concluded that the interrupts were working fine.recently i've included paging(not the shown in my previous post, now it's PAE-Paging), and i've seen that the VM86 interrupts don't work if paging is enabled.The only error i got is in qemu: 'Unhandled interrupt/exception. System halted!'.i've seen that i have to load the kernel at an address that VM86 cannot access, use identity paging(which i didn't understand the explanation or even the code from Identity Paging ).What's the problem here?are the last options true?in case is that i have to load the kernel at an address that VM86 cannot access, i'll give you the error later(or the post is going to be too long), or if is the identity paging option,can you explain me how does it work, and how to implement it?

Thanks!


Top
 Profile  
 
 Post subject: Re: VM86 Doesn't work with paging
PostPosted: Sun Dec 02, 2018 5:39 pm 
Offline
Member
Member
User avatar

Joined: Mon Jan 15, 2018 2:27 pm
Posts: 201
If it's still the same code that you used before, then I have to tell you that it was extracted from paging enabled, high half kernel. It was working with and without PAE/PSE. What you need for it to work, in the simplest scenario, is to have first megabyte identity mapped (which means that 0th virtual byte is mapped to 0th physical, 6126th virtual byte is mapped to 6126th physical byte, etc.). Make sure that you don't trash any critical data in the first meg (like IVT, BDA, EBDA or shadowed ROM). Good choice is to load your kernel at over 1MiB.

To find which exception is fired add some kind of breakpoint in line 17 of /include/VM86/ints.c and check state->InterruptNumber.


Last edited by pvc on Mon Dec 03, 2018 3:12 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: VM86 Doesn't work with paging
PostPosted: Sun Dec 02, 2018 7:22 pm 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
it isn't the same(paging, if i dont mistake in what you refer to), now paging is with PAE enabled, but VM86 is exactly the same.also as i've said, i don't know how does identity mapping work, or how to use it. and loading the kernel over 1 MB, you say something like: jmp 0x000000C00:main?

Thanks!


Top
 Profile  
 
 Post subject: Re: VM86 Doesn't work with paging
PostPosted: Sun Dec 02, 2018 9:25 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
Why do you try to use a feature that you don't even understand? And how do you expect it to work with you copying and pasting code without understanding it?


Top
 Profile  
 
 Post subject: Re: VM86 Doesn't work with paging
PostPosted: Mon Dec 03, 2018 4:30 pm 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
i'm trying to use it because i want to make my kernel work properly.in this post, the idea wasn't copy and paste code, but understand how does it work, and then make it by myself.

Thanks!


Top
 Profile  
 
 Post subject: Re: VM86 Doesn't work with paging
PostPosted: Tue Dec 04, 2018 2:35 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
alberinfo wrote:
i'm trying to use it because i want to make my kernel work properly.

What's included in this "properly" of yours?

alberinfo wrote:
in this post, the idea wasn't copy and paste code, but understand how does it work, and then make it by myself.

Did you try reading up on both page translation and vm86? If you did, did you have any specific questions you were unable to find answers to? If you did, what are they?


Top
 Profile  
 
 Post subject: Re: VM86 Doesn't work with paging
PostPosted: Tue Dec 04, 2018 7:27 am 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
well in my properly definition for this case, i mean that EVERYTHING, and i recall EVERYTHING that's included in my OS, should work fine together, and not halt the system, throw triple faults, etc.i've readed Virtual Monitor(and also Virtual 8086 Mode, but it doesn't contain nothing for the problem i have).and they say the question i asked, and i have no answer.it says that i have to identity map the first MB, but, in Identity Paging, the explanation is almost nothing, and in the code, i didn't understand what first_pte was, and vaddr(it means virtual address, but how to declare it, i have my suspects that it's an void type)


Top
 Profile  
 
 Post subject: Re: VM86 Doesn't work with paging
PostPosted: Tue Dec 04, 2018 3:30 pm 
Offline
Member
Member
User avatar

Joined: Fri Aug 07, 2015 6:13 am
Posts: 1134
alberinfo wrote:
well in my properly definition for this case, i mean that EVERYTHING, and i recall EVERYTHING that's included in my OS, should work fine together, and not halt the system, throw triple faults, etc.i've readed Virtual Monitor(and also Virtual 8086 Mode, but it doesn't contain nothing for the problem i have).and they say the question i asked, and i have no answer.it says that i have to identity map the first MB, but, in Identity Paging, the explanation is almost nothing, and in the code, i didn't understand what first_pte was, and vaddr(it means virtual address, but how to declare it, i have my suspects that it's an void type)


To identity map means to make a physical address equal a virtual one.
0x0 = 0x0, 0x100000 = 0x100000, 0x1234 = 0x1234 etc...
So to ID map the first megabyte means to make everything from 0x0 to 0x100000 equal 0x0-0x100000 as if paging wasn’t enabled.
first_pte means first page table entry
I personally use uint32_t for virtual addresses and uint64_t for physical ones (since I use PAE which allows you to access physical addresses >4GB, on x86). If you were to use x64 then you could just declare them as uint64_t.

I think you should step back and learn some other (more important) things first.
Your project is a mess, source/object files inside include, random chunks of tutorial code everywhere, etc...
This is a clear example of https://wiki.osdev.org/Duct_von_Tape
I know it’s hard for a beginner to catch up with everything, but this hobby ain’t easy, learning something like this takes a lot of reading, practice, studying and most importantly time.
Virtual 8086 mode is not a beginners topic, it requires somewhat of an infrastructure.
Build your kernel in a way you understand it and them come back to this. One thing at a time.

_________________
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader


Top
 Profile  
 
 Post subject: Re: VM86 Doesn't work with paging
PostPosted: Fri Dec 14, 2018 4:37 pm 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
hi,
sorry for being without activity in the post.after a few days trying and working hard, the most i got, is at some moment(probrably when trying ID paging), the system hangs, or something like that, and after a few moments, it comes back to grub, without any error, even in bochs.Any thoughts?(yeah, i don't like to ask for help every time, but with almost no information that i can found in the web, i can't do much, almost not at all).

Thanks!

PD:i've updated the github repo, so any of you do not have to worry about my outdated repos :-P


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot] and 51 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group