OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: problem to pass from asm to c
PostPosted: Sun Jul 04, 2021 5:28 am 
Offline

Joined: Sun Jul 04, 2021 5:16 am
Posts: 1
hi I am a dev who love try things and I have one project, it's to make an entire os with my friends but I have a problem and I don't know that who can answer it so I put it here:

when my machine start there is an blue screen which is normal but my machine is rebooting again and again I am on linux I use BOCHS os emulator an thats my code, https://github.com/Strong214356/LPOS the first code who load in the bios is bootloader.asm (the comp.sh file is my compiler script tell me if something could be wrong in it) and I am loocking at a youtube serie: https://www.youtube.com/playlist?list=PLxN4E629pPnKKqYsNVXpmCza8l0Jb6l8-

can someone help me or did I have to put my question on an another forum

thanks for your answers


Top
 Profile  
 
 Post subject: Re: problem to pass from asm to c
PostPosted: Sun Jul 04, 2021 11:27 pm 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
Welcome to OSDev forum!

Strong214356 wrote:
when my machine start there is an blue screen which is normal
No it's not normal. With bochs, you should see messages in white on black background.

Strong214356 wrote:
but my machine is rebooting again and again
That's because you made an error which causes an exception, but you haven't set up exception handlers yet, which cause another exception, so you end up with a triple fault, that reboots the CPU.

Strong214356 wrote:
I am on linux I use BOCHS os emulator
You can configure bochs to drop you in the debugger in case of a triple fault. It can also print the exceptions, so you can see where the first exception happens. Add these to your bochs.rc file:
Code:
info: action=report
error: action=report
panic: action=ask
If you really are on linux, then these won't work:
Code:
config_interface: win32config
display_library: win32
Replace them with correct drivers.

Strong214356 wrote:
Yeah, watching a youtube tutorial is not something that you do with OSDev. This isn't a user space application usage kind of thing, developing an OS is very very HARD, and requires lots and lots of knowledge and experience. Watching some video won't substitute that experience.

You probably should start by reading our wiki instead of watching youtube. Here are some links:
- Introduction
- Beginner Mistakes
- Getting Started
- Using Bochs

Now, about your bootloader.asm, there are so many things wrong with it.
- you assume that your code is loaded and executed at 0:0x7C00 (requires ORG 0x7C00), but it could be 0x7C0:0 (requires ORG 0) as well (read more about real mode segmentation to learn why these two result in the same linear address).
- you should start your code with a short jump, some BIOS checks for this
- you haven't set up the segment registers (you can't access data otherwise, and you haven't set up code segment either)
- you haven't set up a stack (you can't use the "call" instruction otherwise)
- you haven't set the CPU flags (most notably the direction and interrupt flags)

Cheers,
bzt


Top
 Profile  
 
 Post subject: Re: problem to pass from asm to c
PostPosted: Tue Jul 06, 2021 6:22 pm 
Offline
Member
Member
User avatar

Joined: Sat Sep 17, 2016 2:14 am
Posts: 83
Location: Moscow, Russia
Strong214356 wrote:
hi I am a dev who love try things and I have one project, it's to make an entire os with my friends but I have a problem and I don't know that who can answer it so I put it here:

when my machine start there is an blue screen which is normal but my machine is rebooting again and again I am on linux I use BOCHS os emulator an thats my code, https://github.com/Strong214356/LPOS the first code who load in the bios is bootloader.asm (the comp.sh file is my compiler script tell me if something could be wrong in it) and I am loocking at a youtube serie: https://www.youtube.com/playlist?list=PLxN4E629pPnKKqYsNVXpmCza8l0Jb6l8-

can someone help me or did I have to put my question on an another forum

thanks for your answers


Greetings and welcome to OSDev, where we help you understand OSDeving!
You can browse around the Interwebz if you are learning OSDev, Google will most certainly help you, but IOHO (In Our Honest Opinion), it's best you take some courses on YouTube, Codecademy in order to familiarise yourself with programming.
The best way is research source code, the Wiki has some resources to help you get started.
If you don't really know much stuff, no worries, copy and paste, it's totally acceptable here on OSDev Forum!
Bochs uses its own video driver embedded into SeaBIOS, but you can find some BIOS roms on the Web
Thank you,
Timothy. :D

_________________
Coffee is not airplane fuel.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: SemrushBot [Bot] and 72 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