Looks nice. I recently moved everything over to 64 bit as well. I'm at a stumbling block with recursive mapping though... Are you using mcmodel=large or kernel? I've played around with both, and can't seem to wrap my head around how to do the recursive mapping properly when using mcmodel=kernelf2 wrote:Finally got my 64-bit OS working! I had many troubles with paging. Implementing "recursive mapping" helped me a lot.
I'm focusing now on the 64-bit version. Next big step: adding UEFI support (won't be easy).
What does your OS look like? (Screen Shots..)
- crunch
- Member
- Posts: 81
- Joined: Wed Aug 31, 2016 9:53 pm
- Libera.chat IRC: crunch
- Location: San Diego, CA
Re: What does your OS look like? (Screen Shots..)
Some of my open-source projects:
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C
Re: What does your OS look like? (Screen Shots..)
I don't use gcc at all, my OS is entirely written in assembly!crunch wrote:Looks nice. I recently moved everything over to 64 bit as well. I'm at a stumbling block with recursive mapping though... Are you using mcmodel=large or kernel? I've played around with both, and can't seem to wrap my head around how to do the recursive mapping properly when using mcmodel=kernelf2 wrote:Finally got my 64-bit OS working! I had many troubles with paging. Implementing "recursive mapping" helped me a lot.
I'm focusing now on the 64-bit version. Next big step: adding UEFI support (won't be easy).
"Open source seems to embrace the dark side of human nature." - Ville Turjanmaa
Re: What does your OS look like? (Screen Shots..)
-mcmodel only affects the size of offsets that GCC generates, for example to access variables in your static data segment. In particular it does not interact with paging it all (other than restricting the addresses you can link your kernel to). -mcmodel should always be set to kernel (unless your static kernel image is larger than 2 GiB but I really hope that this is not the case ). It does not restrict the pointers you handle yourself.crunch wrote:Looks nice. I recently moved everything over to 64 bit as well. I'm at a stumbling block with recursive mapping though... Are you using mcmodel=large or kernel? I've played around with both, and can't seem to wrap my head around how to do the recursive mapping properly when using mcmodel=kernelf2 wrote:Finally got my 64-bit OS working! I had many troubles with paging. Implementing "recursive mapping" helped me a lot.
I'm focusing now on the 64-bit version. Next big step: adding UEFI support (won't be easy).
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
- crunch
- Member
- Posts: 81
- Joined: Wed Aug 31, 2016 9:53 pm
- Libera.chat IRC: crunch
- Location: San Diego, CA
Re: What does your OS look like? (Screen Shots..)
I'm aware of that, but using mcmodel=kernel necessitates that you can't put the recursive mapping in the last entry. I just haven't been able to successfully implement recursive mapping at a different location, but then again, I haven't put too much effort into it yetKorona wrote:-mcmodel only affects the size of offsets that GCC generates, for example to access variables in your static data segment. In particular it does not interact with paging it all (other than restricting the addresses you can link your kernel to). -mcmodel should always be set to kernel (unless your static kernel image is larger than 2 GiB but I really hope that this is not the case ). It does not restrict the pointers you handle yourself.crunch wrote:Looks nice. I recently moved everything over to 64 bit as well. I'm at a stumbling block with recursive mapping though... Are you using mcmodel=large or kernel? I've played around with both, and can't seem to wrap my head around how to do the recursive mapping properly when using mcmodel=kernelf2 wrote:Finally got my 64-bit OS working! I had many troubles with paging. Implementing "recursive mapping" helped me a lot.
I'm focusing now on the 64-bit version. Next big step: adding UEFI support (won't be easy).
Just curious, are you linking into elf format or just a flat binary blob?f2 wrote: I don't use gcc at all, my OS is entirely written in assembly!
Some of my open-source projects:
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C
Re: What does your OS look like? (Screen Shots..)
No it doesn't. What makes you think that?crunch wrote:I'm aware of that, but using mcmodel=kernel necessitates that you can't put the recursive mapping in the last entry. I just haven't been able to successfully implement recursive mapping at a different location, but then again, I haven't put too much effort into it yet
If a trainstation is where trains stop, what is a workstation ?
Re: What does your OS look like? (Screen Shots..)
My kernel is just a plain binary file.crunch wrote:Just curious, are you linking into elf format or just a flat binary blob?
"Open source seems to embrace the dark side of human nature." - Ville Turjanmaa
-
- Member
- Posts: 36
- Joined: Fri May 16, 2014 2:40 pm
- Libera.chat IRC: robbiedobbie
Re: What does your OS look like? (Screen Shots..)
You mean that putting your kernel on address -2gb results in not being able to recursive map your last entry. This however is no issue, just use another entry for recursive mapping (I used index 256). This gives me the following memory map:crunch wrote: I'm aware of that, but using mcmodel=kernel necessitates that you can't put the recursive mapping in the last entry. I just haven't been able to successfully implement recursive mapping at a different location, but then again, I haven't put too much effort into it yet
Code: Select all
| Start | End | Usage |
| ---------------- | ---------------- | --------------------------- |
| ffff800000000000 | ffff808000000000 | Recursive pagetable mapping |
| ffff808000000000 | _kernelBegin | Large static allocations |
| _kernelBegin | _kernelEnd | Kernel image |
| _kernelEnd | ffffffffffffffff | Kernel heap |
Calculating the address to acces a certain entry with the recursive mapping at a different entry can be done with:
Code: Select all
void* entriesToAddress(uint64_t pml4, uint64_t pdp, uint64_t pd, uint64_t pt) {
uint64_t address = (pml4 << 39);
if((address & (1ll << 47)) > 0) {
//We need to sign extend
address |= 0xFFFF000000000000UL;
}
address |= pdp << 30;
address |= pd << 21;
address |= pt << 12;
return (void*)address;
}
//Querying the different pagetable levels:
PageMapLevel4* pml4 = (PageMapLevel4*)entriesToAddress(RECURSIVE_ENTRY, RECURSIVE_ENTRY, RECURSIVE_ENTRY, RECURSIVE_ENTRY);
PageDirectoryPointer* pdp = (PageDirectoryPointer*)entriesToAddress(RECURSIVE_ENTRY, RECURSIVE_ENTRY, RECURSIVE_ENTRY, pml4Entry);
PageDirectory* pd = (PageDirectory*)entriesToAddress(RECURSIVE_ENTRY, RECURSIVE_ENTRY, pml4Entry, pdpEntry);
PageTable* pt = (PageTable*)entriesToAddress(RECURSIVE_ENTRY, pml4Entry, pdpEntry, pdEntry);
- crunch
- Member
- Posts: 81
- Joined: Wed Aug 31, 2016 9:53 pm
- Libera.chat IRC: crunch
- Location: San Diego, CA
Re: What does your OS look like? (Screen Shots..)
Thanks, this snippet of code cleared it up for me!robbiedobbie wrote: Calculating the address to acces a certain entry with the recursive mapping at a different entry can be done with:Code: Select all
//Querying the different pagetable levels: PageMapLevel4* pml4 = (PageMapLevel4*)entriesToAddress(RECURSIVE_ENTRY, RECURSIVE_ENTRY, RECURSIVE_ENTRY, RECURSIVE_ENTRY); PageDirectoryPointer* pdp = (PageDirectoryPointer*)entriesToAddress(RECURSIVE_ENTRY, RECURSIVE_ENTRY, RECURSIVE_ENTRY, pml4Entry); PageDirectory* pd = (PageDirectory*)entriesToAddress(RECURSIVE_ENTRY, RECURSIVE_ENTRY, pml4Entry, pdpEntry); PageTable* pt = (PageTable*)entriesToAddress(RECURSIVE_ENTRY, pml4Entry, pdpEntry, pdEntry);
Some of my open-source projects:
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C
Re: What does your OS look like? (Screen Shots..)
Finally added something to the taskbar:
Since this thing is single tasking (eventually having programs save their state when quitting so they can be restored when loaded back), all the "Apps" button does is just load the desktop application (what you see here). Really, not different from the home button on modern phones. Still seeing what to do with the rest of the taskbar (the idea was to add icons for recent programs but not sure how that'd pan out).
As for the calculator, got multiplication working now =P
Since this thing is single tasking (eventually having programs save their state when quitting so they can be restored when loaded back), all the "Apps" button does is just load the desktop application (what you see here). Really, not different from the home button on modern phones. Still seeing what to do with the rest of the taskbar (the idea was to add icons for recent programs but not sure how that'd pan out).
As for the calculator, got multiplication working now =P
- MajickTek
- Member
- Posts: 101
- Joined: Sat Dec 17, 2016 6:58 am
- Libera.chat IRC: MajickTek
- Location: The Internet
- Contact:
Re: What does your OS look like? (Screen Shots..)
Now that is really cool. I never even thought of something like that!Sik wrote:Finally added something to the taskbar:
Since this thing is single tasking (eventually having programs save their state when quitting so they can be restored when loaded back), all the "Apps" button does is just load the desktop application (what you see here). Really, not different from the home button on modern phones. Still seeing what to do with the rest of the taskbar (the idea was to add icons for recent programs but not sure how that'd pan out).
As for the calculator, got multiplication working now =P
Everyone should know how to program a computer, because it teaches you how to think! -Steve Jobs
Code: Select all
while ( ! ( succeed = try() ) );
- MajickTek
- Member
- Posts: 101
- Joined: Sat Dec 17, 2016 6:58 am
- Libera.chat IRC: MajickTek
- Location: The Internet
- Contact:
Re: What does your OS look like? (Screen Shots..)
It looks almost like the beginnings of ToaruOS to me. Nice work! I think the buttons are upside-down (light goes on top?) Other than that, it's simply amazing.szhou42 wrote:https://github.com/szhou42/osdev
My first GUI (looks familiar? )
Everyone should know how to program a computer, because it teaches you how to think! -Steve Jobs
Code: Select all
while ( ! ( succeed = try() ) );
Re: What does your OS look like? (Screen Shots..)
my first baby steps here. just got drawing pixels and terminal font support in
working on implementing a filesystem now, then I can finally start developing a way to open "windows" (small buffers of memory that you can draw on)
one question however: what is the best way to achieve screen "updates"? do you have a ticker that updates once every 1/60th a second or something?
working on implementing a filesystem now, then I can finally start developing a way to open "windows" (small buffers of memory that you can draw on)
one question however: what is the best way to achieve screen "updates"? do you have a ticker that updates once every 1/60th a second or something?
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: What does your OS look like? (Screen Shots..)
Personally, I redraw the screen whenever it needs an update, which is whenever the mouse cursor is moved, a window is dragged, or an application specifically requests a redraw after writing to the window canvas. I also support a locking technique that prevents the screen from being updated until the back buffer is entirely ready to be displayed. A heavily optimized SSE memcpy is always useful here.prasoc wrote:one question however: what is the best way to achieve screen "updates"? do you have a ticker that updates once every 1/60th a second or something?
You know your OS is advanced when you stop using the Intel programming guide as a reference.
- zesterer
- Member
- Posts: 59
- Joined: Mon Feb 22, 2016 4:40 am
- Libera.chat IRC: zesterer
- Location: United Kingdom
- Contact:
Re: What does your OS look like? (Screen Shots..)
Presumably though it doesn't redraw on *every* update though? You'd end up redrawing a ridiculous number of times. I presume it's capped at something reasonable like 50-60Hz?omarrx024 wrote:Personally, I redraw the screen whenever it needs an update, which is whenever the mouse cursor is moved, a window is dragged, or an application specifically requests a redraw after writing to the window canvas. I also support a locking technique that prevents the screen from being updated until the back buffer is entirely ready to be displayed. A heavily optimized SSE memcpy is always useful here.prasoc wrote:one question however: what is the best way to achieve screen "updates"? do you have a ticker that updates once every 1/60th a second or something?
Current developing Tupai, a monolithic x86 operating system
http://zesterer.homenet.org/projects.shtml
http://zesterer.homenet.org/projects.shtml
Re: What does your OS look like? (Screen Shots..)
That's really impressive. How long have you been working on this?prasoc wrote:my first baby steps here. just got drawing pixels and terminal font support in
working on implementing a filesystem now, then I can finally start developing a way to open "windows" (small buffers of memory that you can draw on)
one question however: what is the best way to achieve screen "updates"? do you have a ticker that updates once every 1/60th a second or something?
In some ways, you're ahead of me, and I've been doing this for around 8 years now...
The easiest approach is just to redraw everything as needed, but it's too slow for every day use.
Depending on whether you want to support transparency or non-rectangular render boundaries, there are some tricks you can use to speed things up. But essentially, you just want to update only what is strictly necessary, and draw things in reverse order, from furthest to nearest.
Eventually, if/when you get access to 2D/3D hardware acceleration, then you can really speed things up and add some impressive effects. But that's really probably one of the last things you should spend time on.
Still, nice work!
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott