OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 178 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10 ... 12  Next
Author Message
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Mon Jul 06, 2015 3:35 pm 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 1074
After months of trying to figure out why I couldn't read raw audio data in VirtualBox, I finally discovered, just now, that the code has been working the whole time. I just needed to read the TOC from the disc first, and then everything else started working...

Long story short, I now have an OS that can play CDs! *

AWWWWWW YEAH!!!

(* at least for a few seconds, then it locks up...)

_________________
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


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Sun Aug 09, 2015 1:06 pm 
Offline

Joined: Thu Sep 20, 2012 6:46 pm
Posts: 24
The floppy drive LED turned off automatically... AWWWW YEAH!
I'm implementing virtual mode to read sectors using BIOS interrupts, and i need the v86 task to intercept the IRQs. After using a separate task for the v86 monitor and having trouble with it (it gave warnings in Bochs and just locked in real hardware), I finally got it working by implementing the monitor in kernel mode and having it called exactly when an IRQ or interrupt happened. Now the BIOS code gets all the hardware interrupts and turns the floppy drive LED off after a few timer ticks. It also turns the keyboard LEDs on and off when pressing the lock keys, and it's the first time Ctrl+Alt+Del is able to restart the computer while my protected mode code is running.


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Fri Aug 14, 2015 12:08 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
Image
1840 LOC (both obiectumc and essentiac, blank lines and comments already excluded) for this...
PS. It's not OS dev, but something also complex - compiler dev.

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Fri Aug 14, 2015 1:47 pm 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 1074
Roman wrote:
Image
1840 LOC (both obiectumc and essentiac, blank lines and comments already excluded) for this...
PS. It's not OS dev, but something also complex - compiler dev.

It took me a few minutes to figure out WTH was going on here... but, Good Job!

What OS is this running on?

_________________
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


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Fri Aug 14, 2015 2:40 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
SpyderTL wrote:
It took me a few minutes to figure out WTH was going on here...
I'm developing a compiler for my custom language - Obiectum. The compiler (obiectumc) generates code in an intermediate bytecode representation, then essentiac translates it into the target assembly code, only x86_64 and OS X are supported at the moment.
SpyderTL wrote:
What OS is this running on?
OS X El Capitan.

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Fri Aug 14, 2015 8:46 pm 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 1074
I'm impressed. 8)

What language are obiectumc and essentiac written in?

How far along is the intermediate language? Does the intermediate language have a name?

I'm guessing that you aren't quite to the "Hello world" stage, yet. Correct?

_________________
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


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Fri Aug 14, 2015 10:20 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
SpyderTL wrote:
What language are obiectumc and essentiac written in?
C. I expect Obiectum to be mainly influenced by Objective-C (OOP, ARC) and Go (no headers, less braces, built-in multithreading).
SpyderTL wrote:
How far along is the intermediate language?
Implementation in parallel with design. I think the project is too complex for me to design perfectly before trying to implement (can't keep everything in mind, don't know some things).
SpyderTL wrote:
Does the intermediate language have a name?
Yes, Essentia.
SpyderTL wrote:
I'm guessing that you aren't quite to the "Hello world" stage, yet. Correct?
I think, I'm far enough from a "Hello, World!" program. The "package" directive is the first to be supported.

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Mon Aug 17, 2015 12:04 pm 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
Unsigned wrote:
The floppy drive LED turned off automatically... AWWWW YEAH!
I'm implementing virtual mode to read sectors using BIOS interrupts, and i need the v86 task to intercept the IRQs. After using a separate task for the v86 monitor and having trouble with it (it gave warnings in Bochs and just locked in real hardware), I finally got it working by implementing the monitor in kernel mode and having it called exactly when an IRQ or interrupt happened. Now the BIOS code gets all the hardware interrupts and turns the floppy drive LED off after a few timer ticks. It also turns the keyboard LEDs on and off when pressing the lock keys, and it's the first time Ctrl+Alt+Del is able to restart the computer while my protected mode code is running.
That sounds quite impressive, but nevertheless that isn't really the best way of doing things. With about the same amount of work, you should be able to replace the IRQs with similar handlers yourself and re-create (and improve upon) most of the core BIOS functions.

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Tue Aug 18, 2015 1:34 pm 
Offline

Joined: Thu Sep 20, 2012 6:46 pm
Posts: 24
onlyonemac wrote:
That sounds quite impressive, but nevertheless that isn't really the best way of doing things. With about the same amount of work, you should be able to replace the IRQs with similar handlers yourself and re-create (and improve upon) most of the core BIOS functions.

That's a good advice, and it's in fact what I'm going to do if I implement DOS compatibility. But I forgot to say that it's just the bootloader, there's not enough space for all the disk drivers (IDE/ATAPI/SATA/USB), and I'm just using the BIOS giving it about the same privileges as in real mode. The actual kernel, which I haven't started yet, will use native 32-bit drivers for disk access. By the way, once I got it working, I find virtual mode relatively easy (the only difficulties were fixing my mistakes), and I think that writing all the disk drivers and BIOS functionality will be more difficult.


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Thu Aug 20, 2015 12:39 am 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
If it's a bootloader, then you probably don't need to be using protected mode/virtual mode. Normally one just loads the stuff in real mode and then switches to protected mode and enters the kernel. I needed a second stage bootloader as my kernel is being loaded higher up in RAM and I needed to set up paging before entering the kernel plus because of the kernel load location I needed to use protected mode thus the second stage bootloader needs to contain a floppy disk driver. Which is fine as I already had such a driver written and I'll easily be able to adapt it. So I guess that unless you're trying to load the kernel above the first megabyte of RAM, you don't need a protected mode bootloader, and if you do need a protected mode bootloader then using BIOS interrupts is really excessive; you could just write a small floppy disk driver. One good thing though as that it should be relatively easy to replace this virtual mode hack with the real thing when you're ready to.

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Thu Aug 20, 2015 11:07 am 
Offline

Joined: Thu Sep 20, 2012 6:46 pm
Posts: 24
But it is already about 33KB in size, and I still need to implement the different filesystem drivers. So no, I can't implement a FD driver, because that would mean I need to implement drivers for IDE, ATAPI, SATA, USB, USB floppy, USB mass storage, and new kinds of drives that may appear in the future (EDIT: and PnP/PCI/ACPI for detecting those), and that may make my code grow beyond the limit. The 32-bit module (written in C) is limited to 64KB minus the size of the 16-bit module (written in assembler) because the bootloader is loaded by the boot sector and I don't want it to be too big. If you don't know, my 16-bit module performs basic setup like enabling the A20 line, detecting the 386, etc., and then copies the 32-bit module (which is included in assembler using the %incbin directive) in the location it's linked to, and then it jumps to the entry point. My kernel will not be necessarily limited in size, so I can't assume it can be loaded all in the first MB. I want to be able to load it at any free region, possibly fragmented physically (therefore using paging). Aditionally, I want my bootloader to be universal, that's to say, able to load the kerner from any kind of drive the BIOS was already able to load the MBR and bootloader from. I don't want to update my bootloader as new drives are invented, so using the BIOS will work, since it will take care of the hardware internals. And yes, I need to use protected mode becuase GCC doesn't produce real mode code, and I personally don't fancy to write the filesystem drivers in assembler. I find C far more convenient.


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Fri Aug 21, 2015 8:43 am 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
Unsigned wrote:
But it is already about 33KB in size, and I still need to implement the different filesystem drivers. So no, I can't implement a FD driver, because that would mean I need to implement drivers for IDE, ATAPI, SATA, USB, USB floppy, USB mass storage, and new kinds of drives that may appear in the future (EDIT: and PnP/PCI/ACPI for detecting those), and that may make my code grow beyond the limit. The 32-bit module (written in C) is limited to 64KB minus the size of the 16-bit module (written in assembler) because the bootloader is loaded by the boot sector and I don't want it to be too big. If you don't know, my 16-bit module performs basic setup like enabling the A20 line, detecting the 386, etc., and then copies the 32-bit module (which is included in assembler using the %incbin directive) in the location it's linked to, and then it jumps to the entry point. My kernel will not be necessarily limited in size, so I can't assume it can be loaded all in the first MB. I want to be able to load it at any free region, possibly fragmented physically (therefore using paging). Aditionally, I want my bootloader to be universal, that's to say, able to load the kerner from any kind of drive the BIOS was already able to load the MBR and bootloader from. I don't want to update my bootloader as new drives are invented, so using the BIOS will work, since it will take care of the hardware internals. And yes, I need to use protected mode becuase GCC doesn't produce real mode code, and I personally don't fancy to write the filesystem drivers in assembler. I find C far more convenient.
I guess that's justifiable...

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Mon Aug 31, 2015 2:36 pm 
Offline
Member
Member
User avatar

Joined: Wed Aug 05, 2015 5:33 pm
Posts: 159
Location: Drenthe, Netherlands
After about three weeks hanging around here these are my moments:

1) Getting to see your assembly raw boot sector written from scratch putting a zero terminated string on the screen and accurately reading floppy sectors. The moment I got that far I got a major high of it.

2) Wondering what would happen if you followed the barebone but while compiling gcc adding go as one of the languages & seeing it actually kinda working although only visible by it not rebooting and repeated bochs magic breakpoints. (Hint: While there's even a post on this forum somewhere of me more or less claiming it was near impossible.)

3) Discovering I could use pascal functions compiled in to allow Go to access memory & portio like this:
Code:
function addrToPtr(addr: DWord): PtrUInt; cdecl; [public, alias: 'fpc_addrToPtr'];
begin
  addrToPtr := PtrUInt(addr);
end;


4) After more then a week of putting sh*itloads of effort into trying to port a libc library and/or libgo finding out I could hack myself around the problem using simple a simple pascal function like this & seeing it actually working:
Code:
function go_new(const td: PtrUInt; size: DWord): PtrUInt; cdecl; [public, alias: '__go_new'];
begin
  go_new := PtrUInt(krn_memstart + krn_mempos);
  krn_mempos += size;
end;


5) Seeing it (very) slowly but certainly coming together
https://bitbucket.org/nutterts/golos/src/cc76c8b7294dcc663030330eaec10cef137ecedb/src/arch/i586-elf/krnout.go?at=master

Edit: Just realized my repository isn't up to date. I fixed the math (eg: x % 10) mistake in krnout and changed the pascal functions to the cdecl calling convention. Don't know why I used stdcall instead of cdecl but I had a weird stack corruption problem that I'm almost sure was caused by that mistake.

_________________
"Always code as if the guy who ends up maintaining it will be a violent psychopath who knows where you live." - John F. Woods

Failed project: GoOS - https://github.com/nutterts/GoOS


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Mon Aug 31, 2015 3:01 pm 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
@Nutterts: Please don't tell me you're planning on writing your OS in *pascal*... *shudder*

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: What's your OSDev AWWWW YEAH! moment?
PostPosted: Mon Aug 31, 2015 3:09 pm 
Offline
Member
Member
User avatar

Joined: Wed Aug 05, 2015 5:33 pm
Posts: 159
Location: Drenthe, Netherlands
onlyonemac wrote:
@Nutterts: Please don't tell me you're planning on writing your OS in *pascal*... *shudder*


[mode=sarcasme]
Of course not, that would be silly... I'm writing it in Go. :p

_________________
"Always code as if the guy who ends up maintaining it will be a violent psychopath who knows where you live." - John F. Woods

Failed project: GoOS - https://github.com/nutterts/GoOS


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 178 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10 ... 12  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 37 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