Conversation
| @@ -1,25 +1,30 @@ | |||
| ENTRY(main) | |||
| PHDRS { | |||
There was a problem hiding this comment.
These linker files aren't used AFAIR, we can get rid of them entirely
|
|
||
| USE_FB=true | ||
| USE_NET=false | ||
| USE_FB=false |
| } __attribute__((packed)) t_clunk; | ||
|
|
||
| bool Virtio9PDriver::clunk(virtio_device *dev, uint32_t fid, uint16_t tag) { | ||
| t_clunk *cmd = (t_clunk*)kalloc(dev->memory_page, sizeof(t_clunk), ALIGN_4KB, MEM_PRIV_KERNEL); |
There was a problem hiding this comment.
9p now uses the p9_helper to create packet, to avoid alignment issues on new versions of qemu
| //https://www.qemu.org/docs/master/system/arm/raspi.html | ||
| //raspi4b has no pcie root | ||
| //TODO use DTB as source | ||
| #if QEMU |
There was a problem hiding this comment.
PCI(e) needs some work. the real pi has pcie, qemu does not, let's leave it as is for now
| extern char __bss_start[]; | ||
| extern char __bss_end[]; | ||
| void kernel_main(uint64_t board_type, uint64_t dtb_pa) { | ||
| for (uintptr_t p = (uintptr_t)__bss_start; p < (uintptr_t)__bss_end; p += 8) *(uint64_t*)p = 0; |
There was a problem hiding this comment.
Could this be a memset call? Slightly more optimal, cleaner and open to future optimization
| { "monitor", monitor_procs }, | ||
| }; | ||
|
|
||
| process_t* load_proc(const char *full_name, const char *prog_name, int argc, const char *argv[]){ |
There was a problem hiding this comment.
There's some new logic that needs to be included if you merge:
- Any program that specifies a full path gets loaded from that path, there's some extra logic to set its bundle (.red) if it's part of the path. So if we try to exec /shared/applications/doom.red/doom.elf, it'll load that exact executable and everything before the doom.elf as the bundle
- Any program that's just an executable name (ping, test, read) gets loaded as such from the bin folder
- Any program not found in the bin folder gets loaded from the ones hardcoded here if it exists
| if (buf->write_index == buf->read_index) | ||
| buf->read_index = (buf->read_index + 1) % INPUT_BUFFER_CAPACITY; | ||
|
|
||
| if (focused_proc->sleeping) wake_process(focused_proc); |
There was a problem hiding this comment.
Don't wake the proces in here or register event, it'll mess with any waiting logic, and the input is registered anyway.
| gpu_set_cursor_pressed(last_cursor_state); | ||
| gpu_update_cursor(mouse_loc, true); | ||
| } | ||
| if (focused_proc && focused_proc->sleeping) wake_process(focused_proc); |
|
|
||
| if (buf->write_index == buf->read_index) | ||
| buf->read_index = (buf->read_index + 1) % INPUT_BUFFER_CAPACITY; | ||
| if (focused_proc->sleeping) wake_process(focused_proc); |
|
|
||
| proc->pc = PHYS_TO_VIRT(((uintptr_t)func)); | ||
| kprintf("Kernel process %s (%i) allocated with address at %llx, stack at %llx-%llx, heap at %llx. %i argument(s)", (uintptr_t)name, proc->id, proc->pc, proc->sp - proc->stack_size, proc->sp, proc->heap, argc); | ||
| proc->output = (kaddr_t)palloc(PROC_OUT_BUF, MEM_PRIV_KERNEL, MEM_RW, true); |
There was a problem hiding this comment.
Output has been moved to being generated in the scheduler when writing to it
|
|
||
| extern "C" void init_usb_process(){ | ||
| if (!input_driver->use_interrupts) | ||
| USBDriver *driver = input_driver; |
There was a problem hiding this comment.
Should be possible to put this part in a function, or even on initialization
| return false; | ||
| } | ||
|
|
||
| memset(disk_cmd, 0, sizeof(virtio_blk_req)); |
There was a problem hiding this comment.
mem is always zero'd. Here and in the header files there's no need for explicit memset or default initialize alloc'd values
| draw_ctx* gpu_get_ctx(){ | ||
| if (!gpu_ready()) return 0; | ||
| return gpu_driver->get_ctx(); | ||
| draw_ctx *ctx = gpu_driver->get_ctx(); |
| } | ||
|
|
||
| sizedptr audio_request_buffer(uint32_t device){ | ||
| if (!audio_driver || !audio_driver->out_dev) panic("audio not ready", 0); |
There was a problem hiding this comment.
In this and the other funcs, should be enough to return an error, not panic
No description provided.