OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 2:15 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 61 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Wed May 03, 2017 11:32 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
john765 wrote:
I do know C and Assembly.
Then this whole thread is a waste of time, based on the Subject heading.

As if that wasn't already obvious.


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Wed May 03, 2017 11:44 am 
Offline
Member
Member

Joined: Thu Aug 13, 2015 4:57 pm
Posts: 384
john765 wrote:
It shows a blank screen. What's wrong with -fwritable-strings? I add it to my GCC parameters but shows an error.


Are you going to at some point put some effort into your messages? Like GCC shows what error? Try to think thru what possible information people would need so they can help you, but not spamming them with everything (like dumping your entire code on the forum)..

Honestly I thought this was yet another troll on the boards, I liked the earlier 1-10 list of how the troll threads go...

If it wasn't clear to everybody at this point, the best way to get people to help is to do the work yourself as much as possible. Like telling people all the relevant details, but leaving all irrelevant details out. Doing so makes helping easier to those who might want to help and it shows effort and commitment from the person asking for help.


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Wed May 03, 2017 1:38 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
john765 wrote:
Did DixiumOS get banned?


Not for creating a new account, no, as his old account was no longer valid (unlike AT555, he wsn't trying to circumvent a standing ban; he had deleted his old account login when he ragequit, so he couldn't use it any more when he decided to return). The mods did reprimand him for it, though, and IIRC he did get warned several times before then that he was likely to be banned if he didn't follow forum rules.

I don't recall if he'd actually gotten a temporary ban at one point, but he certainly came close - he was claiming he was under 13 years old, and there was some heated discussion over it because of the admins' legal obligations (there is a law in the US - which is where the forum is hosted - which forbids allowing children under 13 onto fora without written parental approval, due to the risk of identity theft, and the forum rules had included a ban on underaged members which had been in the example set of rules provided by phpBB when the site was created).

At the time, there was a lot of debate about the law's applicability and legal jurisdictions, as well as whether the law even made sense or not, but since most people thought he was just saying it to get attention, anyway, the mods let it slide. They did, I think, issue a statement about the rule itself, though.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Wed May 03, 2017 5:44 pm 
Offline
Member
Member

Joined: Mon Jul 25, 2016 6:54 pm
Posts: 223
Location: Adelaide, Australia
john765 wrote:
You wasted your time talking about these idiots who have no life? I would watch TV more if I wanted to hear this. Some people are evil enough to actually do things.

Andrew and Nuno's life stories are worth reading? Sure, I'll read them! By the way, why would there be so many people similar? Let me guess. It's probably a beginner.

I do know C and Assembly.

By the way, can you answer my question about the write_string() function please? It's in printing text in protected mode. I tried it out but it won't work. The -fwritable-strings doesn't work.

DoS and DDoS attacks are simple these days. Many people do them. The proper word for it is stress. People hack more things than others expect, no matter if a website just has info about fish.

Did DixiumOS get banned?


It's a beginner who can't take advice, has no interest in learning, and gets angry when someone else won't do all their work for them. Plenty of beginners don't do that.

How are you reaching protected mode? Are you sure your write_string() is actually getting called? What are you using to run your code, emulator? Does it reboot, or hang?
-fwritable-strings is a command line switch which allows you to edit strings declared in the source, I think. Regardless, it has nothing to do with your problem.


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Wed May 03, 2017 10:02 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
john765 wrote:
Schol-R-LEA wrote:
john765 wrote:
http://wiki.osdev.org/Printing_to_Screen seems hard. How do I do the parameter for write_string() function? In my main, do I do

Code:
write_string(0x07, "Hello World!");


or not?


Short answer, yes. [...] I am guessing that the real question is more along the lines of, "Why didn't this work for me?" If so, then we'd need more information on how you have things set up.


It shows a blank screen.


OK, we can work with that. The wiki page in question has a section entitled Troubleshooting, and the first subsection there discusses one possible cause.

This leads to the question of how you have the console initialized. How are you running the test program? Assuming you are running it in your own OS, how does your OS boot, and how does it set up the console? How is the OS built? Have you been able to get a displayed message at any point during or after booting?

For now, I will work from the assumption that you are following the Bare Bones setup, and that you have the following set up and ready to go. I intend to cover things in pretty close and perhaps insultingly obvious detail, but this is not meant as a slight, I am merely being thorough.

  • A computer of some sort running either Windows, Linux, or MacOS X (OK, that's a gimme, I'm just being facetious. OTOH, if you are using someone else's computer - say, in a university computer lab - and might have to move your setup to a different one from time to time, you may want to let us know, as some of the usual advice involves installing software and you would need to set it up on a flash drive or something similar.)
  • An emulator or virtualizer such as Bochs, QEMU, HyperV, VirtualBox, etc. to test your OS in. While you can test on live hardware, the turnaround when working with a emu is much faster, and there is vastly less risk of overwriting the MBR of your development host.
  • A version-control program (e.g., git, Subversion, darcs, mercurial, bazaar - doesn't matter which, so long as you are comfortable with it) and an account on an offsite VCS host such as Github where you can set up a repo for your code. No, I am not kidding, and yes, you need one and you need to commit to it as often as reasonably possible. Trust me, this is absolutely vital, no matter how pointless it might seem now. The first time you trash your codebase (you will trash your codebase - EVERYBODY trashes their codebase from time to time), you'll regret it if you don't have one.
  • A working build toolchain - assembler, compiler, linker, etc. - targeting your development host. This should include a tool for raw-writing data to files and/or disks, such as the Unix dd(1) utility. Almost all Linux distros come with the Binutils toolchain, including GCC and gas, and can download tools like NASM pretty easily (presumably you'd know which distro you use and which package manager the distro uses). Under the GUI, MacOS X is also a Unixoid system, and should have binutils already too; if not, they are included in the XCode package. For Windows, if you are using the GNU toolchain, you will probably want to use the Cygwin package, which provides a Unix-like development environment and a port of the BASH shell. If you are using the Microsoft toolchain, there are pages on the wiki that give details for that as well.
  • A GCC Cross-Compiler targeting your the platform you are building your OS for, or the source code for a compiler you can then build for x-building. The xcompiler needs to be different from the dev host compiler - it can be the same compiler from the same source code, and can target the same hardware platform, in the same executable format, but you need the compiler and assembler output set up to build for your OS, and more importantly, you need to have it link to your OS's libraries, not the dev host's. You will eventually need to build an OS Specific Toolchain as well, but that's not immediately necessary and has to wait on the x-compiler anyway.
  • A Bootloader, either preexisting or one you wrote yourself. Since we're talking the Bare Bones suite, you want GRUB 2.


Look this over quickly and let me know if you have all of that ready. Otherwise, we can help you get it set up.

john765 wrote:
What's wrong with -fwritable-strings? I add it to my GCC parameters but shows an error.


Could you please post the error message? I am puzzled why you are using this switch, though, as, despite the similarities in the names, the switch is unrelated to the function.

As StudlyCaps mentioned, the switch enables writing to - that is to say, altering - strings initialized through string literals in the source code. String literals are normally kept in the program's .rodata section (read-only data preinitialized by the compiler or assembler, and set by the OS to set of a protection exception of the program writes to it after the data is loaded). The switch disables a number of optimizations and memory protection features which normally are better left on, but sometimes need to be disabled (mostly for debugging purposes, and almost never in production code).

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Thu May 04, 2017 3:12 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 10, 2016 7:35 am
Posts: 167
Location: Lancaster, England, Disunited Kingdom
The contributors to this thread really need to go on an elementary course in handling trolls. The J R R Tolkien solution of keeping them talking until dawn is really not the best approach on a forum.


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Thu May 04, 2017 3:12 am 
Offline
Member
Member

Joined: Wed Jun 17, 2015 9:40 am
Posts: 501
Location: Athens, Greece
Hi,


john765 is/was a andrewthompson555 puppet (according to Brendan). He has been banned I think.


Regards,
glauxosdever


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Thu May 04, 2017 4:18 am 
Offline
Member
Member

Joined: Mon May 01, 2017 3:56 am
Posts: 44
glauxosdever wrote:
Hi,


john765 is/was a andrewthompson555 puppet (according to Brendan). He has been banned I think.


Regards,
glauxosdever


For the last time, I am not andrewthompson555. Why would anyone think I am Andrew? Do you even have proof? It's like you think someone is this person if they are the same as 90% of the people on Earth.


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Thu May 04, 2017 4:23 am 
Offline
Member
Member

Joined: Mon May 01, 2017 3:56 am
Posts: 44
Quote:
OK, we can work with that. The wiki page in question has a section entitled Troubleshooting, and the first subsection there discusses one possible cause.

This leads to the question of how you have the console initialized. How are you running the test program? Assuming you are running it in your own OS, how does your OS boot, and how does it set up the console? How is the OS built? Have you been able to get a displayed message at any point during or after booting?

For now, I will work from the assumption that you are following the Bare Bones setup, and that you have the following set up and ready to go. I intend to cover things in pretty close and perhaps insultingly obvious detail, but this is not meant as a slight, I am merely being thorough.

  • A computer of some sort running either Windows, Linux, or MacOS X (OK, that's a gimme, I'm just being facetious. OTOH, if you are using someone else's computer - say, in a university computer lab - and might have to move your setup to a different one from time to time, you may want to let us know, as some of the usual advice involves installing software and you would need to set it up on a flash drive or something similar.)
  • An emulator or virtualizer such as Bochs, QEMU, HyperV, VirtualBox, etc. to test your OS in. While you can test on live hardware, the turnaround when working with a emu is much faster, and there is vastly less risk of overwriting the MBR of your development host.
  • A version-control program (e.g., git, Subversion, darcs, mercurial, bazaar - doesn't matter which, so long as you are comfortable with it) and an account on an offsite VCS host such as Github where you can set up a repo for your code. No, I am not kidding, and yes, you need one and you need to commit to it as often as reasonably possible. Trust me, this is absolutely vital, no matter how pointless it might seem now. The first time you trash your codebase (you will trash your codebase - EVERYBODY trashes their codebase from time to time), you'll regret it if you don't have one.
  • A working build toolchain - assembler, compiler, linker, etc. - targeting your development host. This should include a tool for raw-writing data to files and/or disks, such as the Unix dd(1) utility. Almost all Linux distros come with the Binutils toolchain, including GCC and gas, and can download tools like NASM pretty easily (presumably you'd know which distro you use and which package manager the distro uses). Under the GUI, MacOS X is also a Unixoid system, and should have binutils already too; if not, they are included in the XCode package. For Windows, if you are using the GNU toolchain, you will probably want to use the Cygwin package, which provides a Unix-like development environment and a port of the BASH shell. If you are using the Microsoft toolchain, there are pages on the wiki that give details for that as well.
  • A GCC Cross-Compiler targeting your the platform you are building your OS for, or the source code for a compiler you can then build for x-building. The xcompiler needs to be different from the dev host compiler - it can be the same compiler from the same source code, and can target the same hardware platform, in the same executable format, but you need the compiler and assembler output set up to build for your OS, and more importantly, you need to have it link to your OS's libraries, not the dev host's. You will eventually need to build an OS Specific Toolchain as well, but that's not immediately necessary and has to wait on the x-compiler anyway.
  • A Bootloader, either preexisting or one you wrote yourself. Since we're talking the Bare Bones suite, you want GRUB 2.


Look this over quickly and let me know if you have all of that ready. Otherwise, we can help you get it set up.

john765 wrote:
What's wrong with -fwritable-strings? I add it to my GCC parameters but shows an error.


Could you please post the error message? I am puzzled why you are using this switch, though, as, despite the similarities in the names, the switch is unrelated to the function.

As StudlyCaps mentioned, the switch enables writing to - that is to say, altering - strings initialized through string literals in the source code. String literals are normally kept in the program's .rodata section (read-only data preinitialized by the compiler or assembler, and set by the OS to set of a protection exception of the program writes to it after the data is loaded). The switch disables a number of optimizations and memory protection features which normally are better left on, but sometimes need to be disabled (mostly for debugging purposes, and almost never in production code).


http://wiki.osdev.org/Printing_to_Screen
The printing strings section is where you get the code.

Code:
void write_string( int colour, const char *string )
{
    volatile char *video = (volatile char*)0xB8000;
    while( *string != 0 )
    {
        *video++ = *string++;
        *video++ = colour;
    }
}


Then, I put in my kernel main (just this is in my kmain):
write_string(0x07, "Hello World!");

I try it out on VirtualBox but Hello World! won't show. It says if you have missing strings, you use -fwritable-strings. However, I add that parameter and it comes up with an error. Is there something wrong? Do I need to setup anything for this to work?

Why is this? How can I fix that?
By the way, I am not andrewthompson555 or Nunolava1998.

GitHub wouldn't be like this to me you know. Stackoverflow don't complain every single time.


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Thu May 04, 2017 5:00 am 
Offline
Member
Member
User avatar

Joined: Tue Aug 02, 2016 1:52 pm
Posts: 286
Location: East Riding of Yorkshire, UK
john765 wrote:
GitHub wouldn't be like this to me you know. Stackoverflow don't complain every single time.

If you think GitHub and SewageOverflow are better, why don't you go there instead? I don't go to either of those sites often (primarily because I got banned and an no longer welcome, but I digress), but I still doubt the telepathic ability of the users of any other website.

No matter where you go, you're still going to have to put some effort in to ask a good question. I find that usually after I've thought about the best way to ask a question, the answer comes to me anyway. It's a good exercise.

_________________
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Thu May 04, 2017 5:08 am 
Offline
Member
Member

Joined: Mon May 01, 2017 3:56 am
Posts: 44
Can someone tell me how to do write_string() please? I've posted everything in my last posts on this page! Why can't you just tell me? Why is the string not showing? I've posted all the info you know.

Here it is.

john765 wrote:
Quote:
OK, we can work with that. The wiki page in question has a section entitled Troubleshooting, and the first subsection there discusses one possible cause.

This leads to the question of how you have the console initialized. How are you running the test program? Assuming you are running it in your own OS, how does your OS boot, and how does it set up the console? How is the OS built? Have you been able to get a displayed message at any point during or after booting?

For now, I will work from the assumption that you are following the Bare Bones setup, and that you have the following set up and ready to go. I intend to cover things in pretty close and perhaps insultingly obvious detail, but this is not meant as a slight, I am merely being thorough.

  • A computer of some sort running either Windows, Linux, or MacOS X (OK, that's a gimme, I'm just being facetious. OTOH, if you are using someone else's computer - say, in a university computer lab - and might have to move your setup to a different one from time to time, you may want to let us know, as some of the usual advice involves installing software and you would need to set it up on a flash drive or something similar.)
  • An emulator or virtualizer such as Bochs, QEMU, HyperV, VirtualBox, etc. to test your OS in. While you can test on live hardware, the turnaround when working with a emu is much faster, and there is vastly less risk of overwriting the MBR of your development host.
  • A version-control program (e.g., git, Subversion, darcs, mercurial, bazaar - doesn't matter which, so long as you are comfortable with it) and an account on an offsite VCS host such as Github where you can set up a repo for your code. No, I am not kidding, and yes, you need one and you need to commit to it as often as reasonably possible. Trust me, this is absolutely vital, no matter how pointless it might seem now. The first time you trash your codebase (you will trash your codebase - EVERYBODY trashes their codebase from time to time), you'll regret it if you don't have one.
  • A working build toolchain - assembler, compiler, linker, etc. - targeting your development host. This should include a tool for raw-writing data to files and/or disks, such as the Unix dd(1) utility. Almost all Linux distros come with the Binutils toolchain, including GCC and gas, and can download tools like NASM pretty easily (presumably you'd know which distro you use and which package manager the distro uses). Under the GUI, MacOS X is also a Unixoid system, and should have binutils already too; if not, they are included in the XCode package. For Windows, if you are using the GNU toolchain, you will probably want to use the Cygwin package, which provides a Unix-like development environment and a port of the BASH shell. If you are using the Microsoft toolchain, there are pages on the wiki that give details for that as well.
  • A GCC Cross-Compiler targeting your the platform you are building your OS for, or the source code for a compiler you can then build for x-building. The xcompiler needs to be different from the dev host compiler - it can be the same compiler from the same source code, and can target the same hardware platform, in the same executable format, but you need the compiler and assembler output set up to build for your OS, and more importantly, you need to have it link to your OS's libraries, not the dev host's. You will eventually need to build an OS Specific Toolchain as well, but that's not immediately necessary and has to wait on the x-compiler anyway.
  • A Bootloader, either preexisting or one you wrote yourself. Since we're talking the Bare Bones suite, you want GRUB 2.


Look this over quickly and let me know if you have all of that ready. Otherwise, we can help you get it set up.

john765 wrote:
What's wrong with -fwritable-strings? I add it to my GCC parameters but shows an error.


Could you please post the error message? I am puzzled why you are using this switch, though, as, despite the similarities in the names, the switch is unrelated to the function.

As StudlyCaps mentioned, the switch enables writing to - that is to say, altering - strings initialized through string literals in the source code. String literals are normally kept in the program's .rodata section (read-only data preinitialized by the compiler or assembler, and set by the OS to set of a protection exception of the program writes to it after the data is loaded). The switch disables a number of optimizations and memory protection features which normally are better left on, but sometimes need to be disabled (mostly for debugging purposes, and almost never in production code).


http://wiki.osdev.org/Printing_to_Screen
The printing strings section is where you get the code.

Code:
void write_string( int colour, const char *string )
{
    volatile char *video = (volatile char*)0xB8000;
    while( *string != 0 )
    {
        *video++ = *string++;
        *video++ = colour;
    }
}


Then, I put in my kernel main (just this is in my kmain):
write_string(0x07, "Hello World!");

I try it out on VirtualBox but Hello World! won't show. It says if you have missing strings, you use -fwritable-strings. However, I add that parameter and it comes up with an error. Is there something wrong? Do I need to setup anything for this to work?

Why is this? How can I fix that?
By the way, I am not andrewthompson555 or Nunolava1998.

GitHub wouldn't be like this to me you know. Stackoverflow don't complain every single time.


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Thu May 04, 2017 5:29 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
We seem to have reached Stage 9.

It might help if you told us how you are booting the kernel, or show us a little of your code.


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Thu May 04, 2017 7:03 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
EDIT #2 - @john765, please read through to the end here, as I explain the mistakes made in this thread by myself and others. Also, I have started a discussion about fixes to the wiki in the "About the Wiki' sub-board.

I did some checking, and it seems that -fwritable-strings has been deprecated since version 3.0, and was removed in 4.0. This would certainly explain the error. I am somewhat embarrassed that it took so long for me to go and look this up. There are so many obscure switches that it isn't surprising on one here knew about it being removed, but that doesn't excuse this on my part.

I am still puzzled by one more thing though, as I can't figure out why VirtualBox would say that in the first place. The error message makes no sense at all, and even if it would have when GCC supported that switch, GCC 4.0 was released in 2005, two years before VirtualBox was even developed. That message should never have existed in the first place, even as a holdover from early development.

Can you post the message VirtualBox gives? Something really odd is going on here.

EDIT: Wholly Carp, the wiki mentions it too! I'm going to go fix that. Oh, wait... I suppose that you were talking about that, not a VirtualBox message, in which case we really have egg on our faces.

I sincerely apologize for this. This is a genuine failure on the part of this group, and points to a real need to review all of the older material in the wiki, especially in the parts aimed at new OS-Devvers.

In this case, the solution - which is the solution that the wiki should have emphasized more in the first place - is to add an .rodata section to your linker script.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Thu May 04, 2017 8:08 am 
Offline
Member
Member

Joined: Wed Oct 30, 2013 1:57 pm
Posts: 306
Location: Germany
Schol-R-LEA wrote:
In this case, the solution - which is the solution that the wiki should have emphasized more in the first place - is to add an .rodata section to your linker script.
If he had followed Bare Bones properly, this wouldn't be the case. We'll see whether your solution resolves the question.

@john765: Why are you into osdev now? Judging by the initial post in this thread it appears that you have next to no knowledge of C and Assembly whatsoever. Have you read Required_Knowledge? And please don't lie to me by saying you learned C properly and to the extent required in a couple of days.

_________________
managarm


Top
 Profile  
 
 Post subject: Re: Where would I learn C and Assembly?
PostPosted: Thu May 04, 2017 8:28 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
Note that no92 isn't saying you shouldn't be in OS dev, he is saying that it sounds like you are jumping the gun on getting into it. These are very different things.

If I say that a five-year-old shouldn't drive a car, I am not saying that they should never drive a car, I am saying that they are not ready to drive a car and won't be for several years.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 61 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 85 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group