OSDev.org

The Place to Start for Operating System Developers
It is currently Mon Mar 18, 2024 9:07 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 54 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Wed Jul 14, 2021 8:06 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
nullplan wrote:
bzt, you claimed wchar_t was an MSVC thing.
Never said that. Citation needed. I'm well aware the wc capabilities of libc because I had to implement those for POSIX-UEFI. BTW I don't care, because with transparent UTF-8 conversion this works out-of-the-box in POSIX-UEFI with char arguments.

Octocontrabass wrote:
bzt wrote:
I did show you examples with links, actually. Check out my previous post.

I'm asking specifically for examples of GCC or Clang mistakenly using a 32-bit wchar_t when targeting the Windows ABI.
Haha, funny. You can't target the Windows ABI with gcc, you have to create an ELF shared library and then convert that into PE using objconv. Otherwise you'd need a non-official gcc compiler, like cygwin or mingw for example (not part of GNU gcc, those are forks).

Octocontrabass wrote:
bzt wrote:
Show me where does the C standard allow defining strcpy with wchar_t for example.

Right here:
C standard draft N1548 wrote:
In a freestanding environment (in which C program execution may take place without any benefit of an operating system), the name and type of the function called at program startup are implementation-defined. Any library facilities available to a freestanding program, other than the minimal set required by clause 4, are implementation-defined.

The wording changes a bit depending on the draft you're looking at, but all of them say it's implementation-defined. GCC and Clang make no assumptions about C standard library functions in freestanding mode, aside from the four mem* functions, so you're free to redefine strcpy however you like.
First, it does not say that (where's that clause 4 they're referencing?).
Second, I've already said this, builtins are not working as they should be, just google about issues, you'll find plenty (gcc, Clang alike). It is not my job to teach you how to google, sorry.
Third, and most importantly, I don't care what's in the doc or what you're saying as long as my compiler are complaining. And it does if I'm not using the UTF-8 wrapper. End of discussion.

Cheers,
bzt


Top
 Profile  
 
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Wed Jul 14, 2021 8:57 am 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
bzt wrote:
Otherwise you'd need a non-official gcc compiler, like cygwin or mingw

Actually MinGW is integrated with GCC. Just run ./configure --target=x86_64-mingw32 (probably some extra options are needed as well, you could look at ReactOS)

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


Top
 Profile  
 
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Wed Jul 14, 2021 9:45 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5069
bzt wrote:
Haha, funny. You can't target the Windows ABI with gcc, you have to create an ELF shared library and then convert that into PE using objconv. Otherwise you'd need a non-official gcc compiler, like cygwin or mingw for example (not part of GNU gcc, those are forks).

Okay, whatever you say. Where are your examples of "hundreds" of people who have seen GCC or Clang default to 4-byte wchar_t when targeting the Windows ABI?

bzt wrote:
First, it does not say that (where's that clause 4 they're referencing?).

Yes it does. But you can find similar text in older versions of the standard as well, if C11 is too new for you. (Clause 4 is the section titled "Conformance" starting on page 8.)

bzt wrote:
Second, I've already said this, builtins are not working as they should be, just google about issues, you'll find plenty (gcc, Clang alike). It is not my job to teach you how to google, sorry.

I'm not asking for someone else's issues, I'm asking for your issues. Please, explain to me how built-in functions do not work the way the GCC and Clang documentation says they should.

bzt wrote:
Third, and most importantly, I don't care what's in the doc or what you're saying as long as my compiler are complaining. And it does if I'm not using the UTF-8 wrapper. End of discussion.

If the compiler is complaining, it's either a bug in your code or a bug in the compiler. Don't you want to fix the bug?


Top
 Profile  
 
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Wed Jul 14, 2021 1:31 pm 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
I'll answer one more time, but first I get my popcorn :-D :-D :-D

Octocontrabass wrote:
Where are your examples of "hundreds" of people who have seen GCC or Clang default to 4-byte wchar_t when targeting the Windows ABI?
I though you said UEFI was designed for any C compiler and not just for Microsoft ABI only MSVC... :-D :-D :-D We got into a little contradiction, aren't we? :-D :-D :-D
But to answer to your question, not targeting Windows ABI, but compiling ELF shared object and converting to PE as last step. I guess you have never ever used GNU-EFI in your entire life, otherwise you'd know. Maybe you should read about the required knowledge?

Octocontrabass wrote:
bzt wrote:
First, it does not say that (where's that clause 4 they're referencing?).

Yes it does. But you can find similar text in older versions of the standard as well, if C11 is too new for you. (Clause 4 is the section titled "Conformance" starting on page 8.)
Ok, I ask again, this time slowly so that you can understand :-D Where does that spec list the names of functions which are minimally required? On page 8 or on any other page? (It just lists C headers, string.h not among them, yet memset is a builtin and a required minimal function in all compilers for example). Maybe you should read about the required knowledge?

Octocontrabass wrote:
I'm not asking for someone else's issues, I'm asking for your issues. Please, explain to me how built-in functions do not work the way the GCC and Clang documentation says they should.
Use the source Luke! Clang has builtin_strlen for example, any many other string functions, see tests here, neither accepts wchar_t as argument, and there's no builtin for wclen or mbstowcs for example. Maybe you should read about the required knowledge?

Octocontrabass wrote:
If the compiler is complaining, it's either a bug in your code or a bug in the compiler. Don't you want to fix the bug?
Neither. It is perfectly normal if the compiler complains about "strcmp(wchar_t *s1, wchar_t *s1);", and it's not a bug. And I'll try to write slowly so you can comprehend: I don't care, since I've implemented UTF-8 wrapper :-P

Cheers,
bzt


Top
 Profile  
 
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Wed Jul 14, 2021 2:07 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5069
bzt wrote:
I though you said UEFI was designed for any C compiler and not just for Microsoft ABI only MSVC... :-D :-D :-D We got into a little contradiction, aren't we? :-D :-D :-D

Where did I say that?

bzt wrote:
But to answer to your question, not targeting Windows ABI, but compiling ELF shared object and converting to PE as last step. I guess you have never ever used GNU-EFI in your entire life, otherwise you'd know. Maybe you should read about the required knowledge?

We're not talking about GNU-EFI and its ugly hacks. We're talking about a cross-compiler that targets the Windows ABI.

bzt wrote:
Ok, I ask again, this time slowly so that you can understand :-D Where does that spec list the names of functions which are minimally required? On page 8 or on any other page? (It just lists C headers, string.h not among them, yet memset is a builtin and a required minimal function in all compilers for example). Maybe you should read about the required knowledge?

There are none, so you can ignore clause 4 and focus on the rest of that sentence:
C standard draft N1548 wrote:
Any library facilities available to a freestanding program, other than the minimal set required by clause 4, are implementation-defined.

For implementation-defined behavior, refer to the GCC documentation.

bzt wrote:
Use the source Luke! Clang has builtin_strlen for example, any many other string functions, see tests here, neither accepts wchar_t as argument, and there's no builtin for wclen or mbstowcs for example. Maybe you should read about the required knowledge?

I still don't understand. Is the problem that you're not able to redefine the built-in functions? Or is the problem that the built-in functions you want don't exist?

bzt wrote:
It is perfectly normal if the compiler complains about "strcmp(wchar_t *s1, wchar_t *s1);", and it's not a bug.

If the compiler is complaining when you do that, it means either you're not passing "-ffreestanding" to the compiler, or you've found a compiler bug.


Top
 Profile  
 
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Wed Jul 14, 2021 4:03 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
I would think that, if it were specifically for any one particular compiler, it would be the Intel Optimizing C++ Compiler. Especially since UEFI was originally called "Intel Boot Initiative", and was aimed at supporting the Itanium platform, not x86. I am not aware of whether MSVC ever supported Itanium (MS do not, to the best of my knowledge, use MSVC as their in-house C compiler, IIUC they have a separate and purely trade-secret toolchain for building Windows), but both IOCC and GCC certainly did.

This is just speculation, though, but quite honestly, that's all any of you seem to have, too. I can safely say that Microsoft wasn't involved in the design until after the original EFI ABI and API were developed, though, since prior to 2005 there was no UEFI Consortium - AFAICT, Intel didn't share the design until well into the development lifecycle. All the functions Bzt seems convinced are from MSVC seem to predate any involvement by Microsoft, and while that doesn't mean it wasn't influenced by MSVC, it does seem to indicate against it being something Microsoft demanded or dictated.

As for the naming, well, Intel has their own history of names of this sort, mostly dating to the period when the expected Ada to be the dominant HLL, and developed independent of Microsoft.

_________________
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: i want to learn how to make an os in pure assembly
PostPosted: Sun Jul 18, 2021 7:26 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
Androv wrote:
alexfru wrote:
You need to understand that making an OS requires a number of different things:
- understanding the basics of programming
- understanding the basics of CPU/computer architecture/operation
- assembly skills
- knowledge of some directly applicable hardware details (how your computer would boot your OS, how your OS would work with various computer devices such as keyboard, display, disks, etc)
- OS concepts

So, you should probably roll up your sleeves and work on those smaller things before you can put everything together knowing what you're doing and why.


i know the basics of programming basics of computer architecture/operation so what is the best source to study assembly in which it's from details and scratch

and from your own experiment how you exactly learned all of that


I learned the fundamentals of assembly programming early on when I had performance and size restrictions that I couldn't do much about in BASIC, Pascal or C. I began with Z80 (BASIC + asm), then learned 8051 (asm only, no memory for e.g. Pascal), then 80x86 (Pascal + asm and later C), then others...

Before I got into OS dev, I'd been studying misc programming topics, anything interesting I could learn more about (including algorithms and file formats) and playing with PC devices, learning how various DOS utilities and games did this or that cool thing. I think it took some eight years to arrive to C and OS dev from knowing nearly nothing about programming. Then I read Tanenbaum's MINIX book, wrote some protected mode examples/tutorials, etc.

IOW, there was no particular plan or anticipation, I just learned lots of things out of curiosity and they happened to have become the perfect foundation for OS dev. Assembly programming was covered well before OS dev.

You can improve your asm skills independently of OS dev. Or rather, you may be doing some asm coding and reading a book on OS design in parallel without combining the two things initially.


Top
 Profile  
 
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Tue Aug 17, 2021 11:30 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
Schol-R-LEA wrote:
Especially since UEFI was originally called "Intel Boot Initiative", and was aimed at supporting the Itanium platform
Exactly, just like the first 64 bit Windows: https://news.microsoft.com/2000/07/12/microsoft-and-intel-announce-preview-release-of-64-bit-windows-for-intel-itanium-processor/ (release date mid-2000, before EFI)

Schol-R-LEA wrote:
I can safely say that Microsoft wasn't involved in the design until after the original EFI ABI and API were developed
I don't know what makes you think that's "safe to say", when the Intel's EFI specification (release date 2002, 3 years before UEFI) mentions Microsoft's involvement literally, on Page ii, section "Acknowledgements":
Code:
this specification were developed in close consultation with Microsoft
and
Code:
Microsoft has made significant contributions to the interface definitions presented here

In fact, it was more than a close consultation, because key components like the EFI executable format and the EFI ESP spec (release date Dec 2000, 5 years before UEFI) were published directly by Microsoft., not by Intel at all.

Cheers,
bzt


Top
 Profile  
 
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Tue Aug 17, 2021 11:32 am 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
There isn't anything wrong with Microsoft contributing to the spec. After all, they are the software giant. Why do you think that bad? Who else is there, the FSF? I wouldn't consult the FSF if they were the only software company in the whole world....

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


Top
 Profile  
 
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Tue Aug 17, 2021 11:36 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
@nexos: for your information, I've reported you for trolling.

Have a nice day,
bzt


Top
 Profile  
 
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Tue Aug 17, 2021 12:47 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
And you wonder why you keep getting banned.

Accusing someone of trolling when they are merely stating an opinion different to yours is worse than trolling.

You deserve another ban for that post - possibly a permanent one as you demonstrate that you are just not able to relate to other users in a civilized manner.


Top
 Profile  
 
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Tue Aug 17, 2021 12:49 pm 
Offline
Member
Member

Joined: Sun Aug 01, 2021 5:24 pm
Posts: 51
Ok so I can give you my 2 cents since I am doing that rn.

Learning asm without knowledge of other languages is a pure nightmare, you would need to do the compiler job in addition of the software programming aspect (manage registers (not) used, stack, code/data alignment, label management ect)

Ive made the mistake a decade ago of writing in assembly with only assembly knowledge.

And the language I am talking about isn't C, because C will not help you making a better asm code, or just the basic but not enough for complex software as an OS.

The language I am referring is OOP language, C# was my first experience and I was surprised how improvement Ive done in my asm coding ability.

The basic example of how OOP knowledge is important, is the label management aka name mangling for compiler.

It's super important if you want to structure your code, because no compiler will help you in that, you have to do this job from scratch.

NASM do have a nice local label management, it's basic but it does a good job.

Also yes, never fall in the trap of writing macro that try to mimic HAL features, it will just disgust you of assembly.


Top
 Profile  
 
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Tue Aug 17, 2021 1:35 pm 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
iansjack wrote:
And you wonder why you keep getting banned.

Accusing someone of trolling when they are merely stating an opinion different to yours is worse than trolling.

You deserve another ban for that post - possibly a permanent one as you demonstrate that you are just not able to relate to other users in a civilized manner.

Thanks for responding in a way that is much more civilized then how I wanted to respond to bzt and his, well, political comment.
@Rukog - writing an OS in assembly gives me shivers! I have to say, I admire people with the ability to write pure ASM OSes.

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


Top
 Profile  
 
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Tue Aug 17, 2021 2:57 pm 
Offline
Member
Member

Joined: Sun Aug 01, 2021 5:24 pm
Posts: 51
nexos wrote:
@Rukog - writing an OS in assembly gives me shivers! I have to say, I admire people with the ability to write pure ASM OSes.


Yep tough task to do, else Ive changed my mind about that recently and I will use C# for the dev of drivers, GUI and some complex stuff but will try to keep asm for some OS part for the nostalgia purpose 8)


Top
 Profile  
 
 Post subject: Re: i want to learn how to make an os in pure assembly
PostPosted: Wed Aug 18, 2021 8:19 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
iansjack wrote:
Accusing someone of trolling when they are merely stating an opinion different to yours is worse than trolling.
Look who is talking. I've reported you too.

I said EFI was influenced by Microsoft. Someone questioned that, so I provided evidence with links to the spec. Nexos' and your response too was about nothing else than trying to provoke fight, so yes, you're trolls, without a doubt. Period.

Have a nice day!
bzt


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

All times are UTC - 6 hours


Who is online

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