Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Fixup tasking #39
Fixup tasking #39
Conversation
…ct context* in a task_small_t*
…is from the PIT (bad, I should have a system for post-EOI-signal interrupt callbacks)
…eded its allocated quantum
…e their parent's VMM. new VMMs are not actually created for tasks yet. also, add a round robin scheduler, and refactor function to context switch to a provided task
| @@ -104,7 +108,6 @@ void fill_screen(Screen* screen, Color color) { | ||
| if (screen->vmem) { | ||
| write_screen(screen); | ||
| } | ||
| reset_cursor_pos(); |
codyd51
Jul 12, 2018
Author
Owner
No reason for this to be here.
No reason for this to be here.
| @@ -119,19 +119,15 @@ void blit_layer_filled(ca_layer* dest, ca_layer* src, Rect dest_frame, Rect src_ | ||
|
|
||
| //figure out how many px we can actually transfer over, | ||
| //in case src_frame exceeds dest | ||
| int transferabble_px = src_frame.size.width * gfx_bpp(); | ||
| int overhang = (uint32_t)dest_row_start + (uint32_t)row_start + transferabble_px - rect_max_x(dest_frame); |
codyd51
Jul 12, 2018
Author
Owner
The math here pretty much makes no sense. dest_row_start and row_start point to two different malloc'd blocks. I have no idea what I was trying to achieve by adding them.
Additionally, blit_layer already handles sanity-checking the frames to try to prevent against any writes outside of the provided layers, so there should be no reason for this check at all.
The math here pretty much makes no sense. dest_row_start and row_start point to two different malloc'd blocks. I have no idea what I was trying to achieve by adding them.
Additionally, blit_layer already handles sanity-checking the frames to try to prevent against any writes outside of the provided layers, so there should be no reason for this check at all.
| @@ -69,35 +69,46 @@ uint8_t mouse_events() { | ||
| return mouse_state; | ||
| } | ||
|
|
||
| void update_mouse_position(int x, int y) { | ||
| void mouse_reset_cursorpos() { |
codyd51
Jul 12, 2018
Author
Owner
Lets try to keep to name spacing functions in the future.
Lets try to keep to name spacing functions in the future.
| running_y = MAX(running_y, 0); | ||
| running_y = MIN(running_y, dimensions.height - 5); | ||
| _mouse_constrain_to_screen_size(); | ||
| printk_dbg("mouse: (%d, %d)", running_x, running_y); |
codyd51
Jul 12, 2018
Author
Owner
Refactored some work in this method. I'm not sure what kind of sign it is that a lot of axle's code I'm seeing (that I myself wrote) is pretty clearly bad.
Refactored some work in this method. I'm not sure what kind of sign it is that a lot of axle's code I'm seeing (that I myself wrote) is pretty clearly bad.
| @@ -2,12 +2,16 @@ | ||
| #define PIT_H | ||
|
|
||
| #include <std/common.h> | ||
| #include <kernel/interrupts/interrupts.h> | ||
|
|
||
| #define PIT_INT_VECTOR INT_VECOR_IRQ0 |
codyd51
Jul 12, 2018
Author
Owner
We should start defining the interrupt vectors that drivers subscribe to.
We should start defining the interrupt vectors that drivers subscribe to.
| static void context_switch(register_state_t* regs); | ||
| static int tick_callback(register_state_t* regs) { | ||
| tick++; | ||
| _timer_handle_pit_tick(regs); |
codyd51
Jul 12, 2018
Author
Owner
The timer system is no longer coupled to the PIT driver.
The timer system is no longer coupled to the PIT driver.
| static timer_callback_t* pit_callback = 0; | ||
| const uint32_t _task_context_offset = offsetof(struct task_small, machine_state); |
codyd51
Jul 12, 2018
Author
Owner
We record the offset of the machine_state field as it's the simplest way to be able to reference the offset from context_switch (which is in assembly)
We record the offset of the machine_state field as it's the simplest way to be able to reference the offset from context_switch (which is in assembly)
| } | ||
| panic("couldn't find runnable task"); | ||
| } | ||
|
|
codyd51
Jul 12, 2018
Author
Owner
Simple round-robin scheduler. The MLFQ scheduler should be reenabled in the future once the responsiveness of the system would benefit from it.
Simple round-robin scheduler. The MLFQ scheduler should be reenabled in the future once the responsiveness of the system would benefit from it.
| running_y = s->resolution.height / 2; | ||
| running_x = 400; | ||
| running_y = 100; | ||
| } |
uroboro
Jul 13, 2018
Collaborator
What's going on here?
What's going on here?
| running_x = MIN(running_x, dimensions.width - 5); | ||
| running_y = MAX(running_y, 0); | ||
| running_y = MIN(running_y, dimensions.height - 5); | ||
| } |
uroboro
Jul 13, 2018
Collaborator
These macros could be fit into a single one, usually named clamp.
These macros could be fit into a single one, usually named clamp.
| if (!found) { | ||
| panic("tried to delete nonexistant interrupt callback. investigate!"); | ||
| } | ||
| memset(callback, 0, sizeof(int_notify_callback_t)); |
uroboro
Jul 13, 2018
Collaborator
It's a bit odd that callback is the one being cleared instead of callback_table[i] (even if they're the same).
It's a bit odd that callback is the one being cleared instead of callback_table[i] (even if they're the same).
| if ((iter)->next == NULL) { | ||
| return iter; | ||
| } | ||
| iter = (iter)->next; | ||
| } | ||
| panic("more than 16 tasks in runlist. increase me?"); | ||
| panic("more than MAX_TASKS tasks in runlist. increase me?"); |
uroboro
Jul 13, 2018
Collaborator
Does panic take varargs to be able to print the value of MAX_TASKS?
Does panic take varargs to be able to print the value of MAX_TASKS?
codyd51
Jul 13, 2018
Author
Owner
Unfortunately not, though it should in the future.
Unfortunately not, though it should in the future.
uroboro
Jul 13, 2018
Collaborator
How about panic("more than MAX_TASKS(" STR(MAX_TASKS) ") tasks in runlist. increase me?"); where STR expands the value of MAX_TASKS and then stringifies that with #?
How about panic("more than MAX_TASKS(" STR(MAX_TASKS) ") tasks in runlist. increase me?"); where STR expands the value of MAX_TASKS and then stringifies that with #?
also, when a frame for a new page table is allocated, it is immediately memset to 0 prevent garbage page mappings
| return new_task; | ||
| } | ||
| } |
filfat
Jan 3, 2019
Contributor
Double '}'.
Double '}'.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Major changes:
Deprecate existing multitasking code, and implement a new tasking system.
task_thas been superseded bytask_small_t. I have not removed existingtask_tcode so that it can be present for reference while enabling more preexisting kernel features, but all functions have been explicitly marked deprecated.Added a new system for invoking a callback when a specified interrupt vector is ran. Importantly, the callbacks are ran after the kernel's interrupt handling has completed. As a result of this, it is safe for these callbacks to do significant work: as the interrupt has been processed and the end-of-interrupt has been sent, it is safe for these callbacks to perform actions such as forcing a context switch. This system is mostly a copy of the timer callback system, with a hook into the global interrupt handler instead of into the PIT interrupt handler.
Thanks to the above, the timer system has been split from the PIT interrupt handler.
Mouse driver reenabled.