[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: IMG_2680.png (314 KB, 661x623)
314 KB PNG
This general is for operating systems development, if you have a question, want to share a resource or want to show us something you made, feel free to do so here.

IRC: irc.libera.chat #osdevers

>The OS wiki
https://osdev.wiki/wiki/Expanded_Main_Page

>Operating systems books
https://pages.cs.wisc.edu/~remzi/OS
https://github.com/dreamportdev/Osdev-Notes
Modern Operating Systems by Andrew Tanenbaum
Operating System Concepts by Abraham Silberschatz and James Peterson (The dinosaur book)

>Computer architecture books
Computer Architecture: A Quantitative Approach by John L. Hennessy, and David A. Patterson
Structured Computer Organization by Andrew S. Tanenbaum, and Todd Austin
Advanced Computer architecture by Kai Hwang

>Assembly
Programming from the Ground Up

>x86 and amd64 instructions
https://www.felixcloutier.com/x86/

>RISC-V assembly
https://www.robertwinkler.com/proje

>C
The C programming language by K&R
C programming a modern approach by K.N. King
https://beej.us/guide/bgc/

>Open source operating systems’ source codes
Linux
https://git.kernel.org/
FreeBSD
https://cgit.freebsd.org/
ReactOS
https://git.reactos.org/
Plan9(discontinued)
https://9p.io/sources/plan9/
9front (plan9 fork actively maintained)
https://git.9front.org/plan9front/9front/HEAD/info.html
Haiku
https://github.com/haiku/haiku
Minix
https://git.minix3.org/index.cgi?p=
xv6
https://github.com/mit-pdos/xv6-riscv
FreeRTOS
https://github.com/FreeRTOS/FreeRTOS
Zephyr
https://github.com/zephyrproject-rtos/zephyr

Previous >>109867906
>>
>>109879799
just want to say i like that these generals are being made. keep it up and i will kiss you anon
>>
File: 1.png (193 KB, 1280x720)
193 KB PNG
>>109880292
Probably the best thread in the hubris that is 4chan nowadays.
>>
File: friendslop.jpg (122 KB, 1011x702)
122 KB JPG
>>109880292
>>109880538
Love you guys
>>
>>109881477
The OP even read my advice and set the link to new osdev.wiki.
This is the general that will save the /g/.
>>
File: tips-hat.jpg (63 KB, 825x413)
63 KB JPG
bumo
i use an os. and thats my whole contribution to this thread

unless you wanna hear about some opencl autism
>>
I spend the last few weeks measuring the Windows 2000 UI to pixel-perfect, now I'm ready to start building it.
>>
>>109880292
>>109880538
>>109881477
>>109881500
samefag
>>
>>109882065
just look at https://github.com/yair-k/Win2000SRC/tree/main lol lmao
>>
File: IMG_2682.jpg (76 KB, 1179x500)
76 KB JPG
>>109882071
Nigga
>>
File: mint fantome.jpg (140 KB, 850x1328)
140 KB JPG
>>109879799
The MAIDS compiler on MAIDS OS breaks when code is too large. I am trying to fix this. I will need to be able to compile 1M+ lines in a single file. Possible 10M or 100M or more even. Large code file compilation is required for the system to do what I want.
>>
File: mint fantome2.jpg (217 KB, 1081x1513)
217 KB JPG
>>109882410
Also, I am not the only maid making a compiler/OS. If you make the OP image a maid, more of them will come here.
>>
>>109882566
you need to make your own general already
also your first post is uninformative as fuck
at least state your project, narcissistic faggot
dont take it as baseline default that everyone follows religiously what you do

fukken rtfm how to human ffs
>>
Guys hop onto #osdevers, I'm tired of being alone there. Makes me sad.
>>
File: IMG_2662.jpg (88 KB, 978x1024)
88 KB JPG
Im not that much into Os dev, but i know unix tried to have an “everything is a file” approach (plan9 fully committed to it)… but this approach is opposed to what? What other alternatives are there it? The unix approach makes sense to me but I don’t if thats because its a good approach or because im biased
>>
>>109882957
Damn i made many typos…don’t use 4chan on the bus lol
>>
>>109882957
An alternative is having a programming interface (like some C functions) which you use to call to obtain all the information you need.
No need to do string parsing, you obtain everything in a type safe manner.
>>
>>109883051
So basically a system level API? Isn’t that what windows uses if im not mistaken?
>>
>>109883107
Yes, it's another approach than having everything a file.
>>
File: world is a kawaii.gif (83 KB, 781x784)
83 KB GIF
>>109882957
Everything is a string.
>>
>>109879799
>>RISC-V assembly
>https://www.robertwinkler.com/proje
Fuck is that? Use this one
>An Introduction to Assembly Programming with RISC-V
https://riscv-programming.org/book/riscv-book.html
>>
>>109882957
Everything should an object.
>>
>>109883727
FUCKKK My bad its this one
https://www.robertwinkler.com/projects/riscv_book/riscv_book.pdf
The other book looks good too i will add it next time
>>
>>109883921
Studying assembly is mostly pointless. You don't really need it beyond writing VM code that makes assembly, and most of the time it is just as easy to go from VM code to machine code directly. Assembly is kind of bloat.
>>
>>109884095
You need to know a little assembly to write short functions to handle the privileged operations of the processor.
>>
>>109879799
>Programming from the Ground Up
There is a newer book from the same author called "Learn to Program with Assembly" which covers x64.
>>
File: 1759831713385813.jpg (50 KB, 593x680)
50 KB JPG
i've been experimenting with making my ThreadX abstraction layer support a time-triggered execution model
for this i'm using an event group and (at thread init) binding each flag to a release/period time
the event flags are activated by a timer that runs every OS tick (1ms)
multiple threads with equal period time share the same event flag, so the construct supports 32 unique period times
more than enough for a small embedded system

flag allocator
/*!
* \brief Allocate and retrieve event group flag
*/
[[nodiscard]] uint32_t thread_activation_group_c::get_flag(os_clock_s::duration period) noexcept
{
for (auto& flag : this->flags_)
{
if (flag.period == period)
{
return flag.bit;
}

if (flag.period == os_clock_s::duration::max())
{
flag.period = period;
++this->number_of_allocated_flags_;
return flag.bit;
}
}

return flag_s::bit_type_t{0UL}; // No available flag
}

/*!
* \brief Timer callback
*/
[[nodiscard]] bool thread_activation_group_c::set(uint32_t current_tick) noexcept
{
auto combined_flags = 0UL;
for (auto flag_index : std::views::iota(0UL, this->number_of_allocated_flags_))
{
if (flag_index < this->flags_.size())
{
const auto& flag = this->flags_.at(flag_index);
if (0UL == (current_tick % flag.period.count()))
{
// This flag is to be activated at this tick
combined_flags |= flag.bit;
}
}
}

if (0UL != combined_flags)
{
this->error_ = tx_event_flags_set(std::addressof(this->event_group_), combined_flags, TX_OR);
return (TX_SUCCESS == this->error_);
}

return true;
}
>>
>>109881500
whats the difference between the wikis?
>>
>>109886408
the thread entry is quite simple then too
i'm using a type erased model for the actual thread init/entry/exit implementations so the actual entry tied to ThreadX is the same for all
easy to pend on the event flag that's been allocated to a thread

*!
* \brief The OS entry function for a periodic thread
*/
static void thread_entry_function(uint32_t args) noexcept
{
auto& self = *reinterpret_cast<periodic_thread_c*>(args);

thread_init(self.thread_wrapper_);

// supervision starts once this thread's own init is done, so init time never counts against its first activation
// assume rate-monotonic priorities
self.thread_observer_.arm();

while (self.active_)
{
// Pend self on event group activation
if (periodic_thread_c::activation_group_.get(self.flag_, thread_activation_group_c::wait_mode_e::e_and_clear, wait_forever_k))
{
self.thread_observer_.thread_start();

thread_entry(self.thread_wrapper_);

self.thread_observer_.thread_end();
}
}

thread_exit(self.thread_wrapper_);
self.exit();
}
>>
>>109886408
>object-oriented osdev
jesus fucking fuck
>>
>>109879799
AI in 2 years is going to oneshot your homemade operating system with a flash model, better than all of you working together combined, then it's going to steal your atoms.
>>
>>109886553
it gets better
check this out

class thread_wrapper_c
{
using thread_fn_t = void(void const*) noexcept;
using attr_getter_fn_t = thread_attributes_s(void const*) noexcept;

attr_getter_fn_t* const attr_getter_k{nullptr};
thread_fn_t* const external_entry_function_k{nullptr};
thread_fn_t* const external_init_function_k{nullptr};
thread_fn_t* const external_exit_function_k{nullptr};
void* const thread_k{nullptr};

friend void thread_entry(thread_wrapper_c const& object) noexcept { object.external_entry_function_k(object.thread_k); }
friend void thread_init(thread_wrapper_c const& object) noexcept { object.external_init_function_k(object.thread_k); }
friend void thread_exit(thread_wrapper_c const& object) noexcept { object.external_exit_function_k(object.thread_k); }
friend thread_attributes_s thread_attr(thread_wrapper_c const& object) noexcept { return object.attr_getter_k(object.thread_k); }

public:
template <typename T>
thread_wrapper_c(T& thread) noexcept
: attr_getter_k{[](void const* object) noexcept -> thread_attributes_s { return (*static_cast<T const*>(object)).attributes; }}
, external_entry_function_k{[](void const* object) noexcept -> void { thread_entry(*static_cast<T const*>(object)); }}
, external_init_function_k{[](void const* object) noexcept -> void { thread_init(*static_cast<T const*>(object)); }}
, external_exit_function_k{[](void const* object) noexcept -> void { thread_exit(*static_cast<T const*>(object)); }}
, thread_k{std::addressof(thread)}
{
}
};
>>
>>109879799
>https://pages.cs.wisc.edu/~remzi/OS
Says "Url you requested was not found on our server"

>>109882957
>“everything is a file” approach (plan9 fully committed to it)… but this approach is opposed to what?
Well the Lisp machine's OS was a Lisp program, and running a program on it was just calling a Lisp function. That's the approach I'd take.

>>109884095
>Studying assembly is mostly pointless.
Well inspired by JonasForth, I'm currently attempting to write my own programming language in assembly, just enough of a thin layer over assembly that I can write the rest of the language in itself.
And the ultimate test of it will be using it freestanding, running it as an OS.

>>109884588
>There is a newer book from the same author called "Learn to Program with Assembly" which covers x64.
Gas AT&T syntax ugh. I think the best beginner assembly book is "x86-64 Assembly Language Programming With Ubuntu" by Ed Jorgensen.
>>
>>109886791
Wtf another broken link i will have to rewrite everything next time
https://pages.cs.wisc.edu/~remzi/OSTEP/



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.