Deutsch English Français Italiano |
<vpu3m5$3804$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: "Paul Edwards" <mutazilah@gmail.com> Newsgroups: comp.lang.c Subject: Re: [OSDev] How to switch to long mode in x86 CPUs? Date: Sat, 1 Mar 2025 15:50:09 +1100 Organization: A noiseless patient Spider Lines: 59 Message-ID: <vpu3m5$3804$1@dont-email.me> References: <871pvje5yq.fsf@onesoftnet.eu.org> <vprtt6$3jah9$1@dont-email.me> Injection-Date: Sat, 01 Mar 2025 05:50:14 +0100 (CET) Injection-Info: dont-email.me; posting-host="fd6981845ebefaca8b0963f4073e1ef0"; logging-data="106500"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+UrBy+TxG0DPjImrWLkx94aeAyMllY2g=" Cancel-Lock: sha1:Qjyp0E+xArdp3Z6fcZuRhqP/wbE= X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 Bytes: 3517 "David Brown" <david.brown@hesbynett.no> wrote in message news:vprtt6$3jah9$1@dont-email.me... > On 27/02/2025 16:57, Ar Rakin wrote: > > I am trying to develop my own, simple operating system to learn more > > about how kernels work and low level stuff like that. However, I am > > stuck at setting up paging while switching long mode (64-bit protected > > mode) in x86 processors. > > Are you trying to learn about OS kernels, or about the complexities of > low-level x86 stuff? Those are different things. > > If you want to learn about how operating systems work, you might > consider starting on microcontrollers. There are lots of RTOS's > available to study, and it is much easier to understand what is going on > - there is none of the multi-layered disaster of x86 modes to deal with. > > Once you are happy with threads, context switches, locks, priorities, > and all the rest of that stuff, you can start moving up and adding > features for MMU's, SMP, and more, using bigger target processors. > > > On the other hand, if you are interested in learning the intricacies of > the x86 world, you need to look elsewhere for information - as Keith > says, it is not really C related when you are writing assembly. > comp.arch might be a helpful group. > > > However, it is possible to use C for almost all code here. But it will > not be standard C - it is not even standard free-standing C. You will > make use of compiler extensions, bits of inline assembly, pre-main C > code (so none of the library will be initialised, and program-lifetime > data will not be set up), and other such highly non-portable code. I'm not disputing anything you have said, I'm just offering a variation. Do you consider the concept of a BIOS (as seen as the IBM PC), "legitimate to use" and do you consider MSDOS (which uses that BIOS) to be an operating system? If so, then with a suitable BIOS (or pseudo-bios if you want to quibble what a BIOS is), you can have an operating system (memory management, file management, program loading, and an API) written in pure C90, except for the implementation of setjmp/longjmp which is necessarily assembler (or non-standard C). That's what PDOS-generic (at pdos.org) is. > I > remember reading once about LinuxBIOS (now coreboot) having just four > lines of assembly running out of reset, before everything else was in C. And that sounds like a BIOS - it's in the original name, not the OS proper. BFN. Paul.