Commit Graph

119 Commits

Author SHA1 Message Date
Bananymous dd636ffcb2 Kernel: Add support for SA_SIGINFO 2025-11-17 05:26:07 +02:00
Bananymous 09175d1799 Kernel: Fix 32 bit target
Rewrite some assembly and add some required casts
2025-11-17 02:33:00 +02:00
Bananymous 32f980e259 Kernel: Fix ACPI namespace lookup for multi segment names 2025-08-19 16:23:30 +03:00
Bananymous b6793cc6f2 Kernel: Add AML ConcatResOp 2025-08-15 18:54:17 +03:00
Bananymous 3804d4332b Kernel: Make _SEG, _BBN and _ADR lookup absolute 2025-08-15 17:02:15 +03:00
Bananymous 064aaef6c3 Kernel: Don't fail on creating reserved opregion 2025-08-15 17:02:15 +03:00
Bananymous ce262a5d2d Kernel: Allow ReturnOp in global scope 2025-08-15 17:02:15 +03:00
Bananymous d128f4d70b Kernel: Fix AML CreateField debug print 2025-08-15 17:02:15 +03:00
Bananymous 46d1ada708 Kernel: Allow AML package->package conversion 2025-08-15 17:02:15 +03:00
Bananymous 2819e5f647 Kernel: Make _STA and _INI lookup absolute 2025-08-15 17:02:15 +03:00
Bananymous c2017a5181 Kernel: Allow looking up devices with multiple eisa ids
Also match against _CIDs in addition to _HID
2025-08-15 17:02:15 +03:00
Bananymous 58ad839136 Kernel: Add support for ACPI Embedded Controllers 2025-08-15 17:02:15 +03:00
Bananymous 695262624d Kernel: Fix potential UB in AML OpRegion initialization 2025-08-11 03:45:38 +03:00
Bananymous 3aa20a3a32 Kernel: Fix ACPI _GPE calling
This adds patch adds support for extended GPEs and the second GPE
register block.
2025-08-07 19:35:13 +03:00
Bananymous 3960687f9d Kernel: Parse PCIConfig opregion address on read/write
I was testing on some hardware and _ADR does not have to exist in the
namespace when opregion is parsed :)
2025-07-16 15:34:36 +03:00
Bananymous 995dfa1455 Kernel: Fix AML PCIConfig OpRegion accesses
Apparently I'm not supposted to calculate device/function from the
offset, but parse them from the acpi namespace :)

This allows PCI PIN interrupt routing actually work
2025-07-04 13:21:02 +03:00
Bananymous 544c8dbc13 Kernel: Optimize AML interpreter stack usage
There is a very hacky no-inline hack that I am not proud of but it drops
the stack usage of few functions A LOT.

Previously Virtual Box could not boot with our 8 page stack, but these
changes allow it to boot on 5!
2025-07-03 00:49:23 +03:00
Bananymous 8a0269d29e Kernel: Remove kernel processes
Kernel can just use raw threads, pretty muchs the only thing that
process provides is syscalls which kernel threads of course don't
need.

Also this makes init process have pid 1 :D
2025-07-02 01:54:03 +03:00
Bananymous 1b2aa6c2da Kernel: Fix unaligned access in AML
Found with ubsan
2025-07-02 00:17:42 +03:00
Bananymous 32c35a822b BuildSystem: binutils1.39->1.44, gcc12.2.0->15.1.0 2025-06-19 19:00:50 +03:00
Bananymous 81ff71a97f Kernel: Track the number of recursive spinlocks a thread is holding 2025-06-06 06:51:15 +03:00
Bananymous eecdad50a6 Kernel: Fix most of mutex + block race conditions
All block functions now take an optional mutex parameter that is
atomically unlocked instead of having the user unlock it before hand.
This prevents a ton of race conditions everywhere in the code!
2025-06-06 03:59:22 +03:00
Bananymous 0e0d7016b3 Kernel: Rename has_hangup -> has_hungup 2025-05-17 12:39:23 +03:00
Bananymous 1bcd1edbf5 Kernel/LibC: Implement basic epoll
This implementation is on top of inodes instead of fds as linux does it.
If I start finding ports/software that relies on epoll allowing
duplicate inodes, I will do what linux does.

I'm probably missing multiple epoll_notify's which may cause hangs but
the system seems to work fine :dd:
2025-05-13 10:18:05 +03:00
Bananymous 9f3f8f950a Kernel: Add better panic message for failed shutdown
ACPI shutdown does not work on the web emulator and running `poweroff`
crashes on `ASSERT_NOT_REACHED()`.
2025-04-25 01:52:33 +03:00
Bananymous 27613da5ea Kernel: Route PCI Interrupt Link Device interrupts 2025-04-01 23:09:30 +03:00
Bananymous 28ac6c2267 Kernel: Implement AML FindSet{Left,Right}Bit 2025-04-01 23:09:30 +03:00
Bananymous ba74b352bd Kernel: Make BufferField actually access the buffer and not copy 2025-04-01 23:09:30 +03:00
Bananymous 0474ac4262 Kernel: Expose ACPI resolve_package_element to outside 2025-04-01 23:09:30 +03:00
Bananymous aba49cc93f Kernel: Add API to get ACPI reference paths 2025-04-01 23:09:30 +03:00
Bananymous b3b5b40163 Kernel: Add _OS an _REV to ACPI namespace 2025-04-01 23:09:30 +03:00
Bananymous 0e085b30cc Kernel: ACPI add easier API for calling methods with arguments 2025-04-01 23:09:30 +03:00
Bananymous 3800d5420e Kernel: Collect created AML nodes in add_{named,alias}...
This makes it harder to miss adding scoped objects. Before I was not
deleting all types of nodes on method return
2025-04-01 23:09:25 +03:00
Bananymous b145c1ab64 Kernel: Add easier api for evaluating ACPI nodes 2025-04-01 23:09:20 +03:00
Bananymous 83c66901f8 Kernel: Fix reboot when ACPI is disabled
If ACPI was disabled ACPI::reset() would page fault when accessing
namespace instead of checking wheter namespace is initialized :D
2025-02-11 21:53:20 +02:00
Bananymous 82978da5e3 Kernel: Cleanup AML code 2025-01-17 16:20:00 +02:00
Bananymous a5cf92b2ff Kernel: Use uint64_t instead of size_t for AML node conversion
This allows 32 bit to compile again :)
2024-12-30 06:27:49 +02:00
Bananymous d7b4f54983 Kernel: Check Control Method Battery _STA bit 4
This bit indicates wheter the battery is actually present.
2024-12-19 02:35:09 +02:00
Bananymous 00b0dcd306 Kernel: Reorder ACPI initialization method calls 2024-12-19 02:35:09 +02:00
Bananymous 53c356a940 Kernel: Implement AML MatchOp 2024-12-18 19:26:19 +02:00
Bananymous 3a6cdfff45 Kernel: Fix ACPI namespace initialization
Now _REG, _STA, _INI are called in the order my laptop expects them to
be called. This was kinda weird because what uACPI was doing did not
work.

\_SB_.PCI0.LPC0.EC0_.BAT0._STA required \_SB_.PCI0.LPC0.EC0_._REG to be
called
\_SB_.PCI0.LPC0.EC0_._REG required \_SB_.PCI0._STA to be called

Now I call all the _REG methods of a device after calling _STA/_INI and
after performing the whole _STA/_INI sequence i call rest of missing
_REG functions
2024-12-18 18:30:45 +02:00
Bananymous c26e347e91 Kernel: Fix AML FieldUnit conversion and NameString construction 2024-12-18 18:29:04 +02:00
Bananymous 4e364bd2f6 Kernel: Add support for ACPI Control Method Batteries
The implementation is kinda weird but it exposes some battery
information to userspace!
2024-12-18 14:06:32 +02:00
Bananymous 437fa45ca2 Kernel: Add helper to find ACPI devices with EISA id 2024-12-18 01:45:00 +02:00
Bananymous 85e215650c Kernel: Implement AML ToStringOp 2024-12-18 01:44:33 +02:00
Bananymous 7eb186dad4 Kernel: Add to_sv() helper for AML String 2024-12-18 01:43:46 +02:00
Bananymous 2259614640 Kernel: Remove unused function from ACPI namespace 2024-12-18 01:43:04 +02:00
Bananymous 869f4011a1 Kernel: Replace the old AML interpreter by a new, better one
The old AML interpreter was trash and did not follow value/reference
semantics at all. It was also super slow, one of my machines taking over
7 seconds to parse ACPI namespace and call _INI and _STA.
2024-12-17 03:36:33 +02:00
Bananymous 076001462e Kernel: Implement AML ConcatOp 2024-11-22 22:23:07 +02:00
Bananymous 30ceaa6bef Kernel: Implement AML ToHexStringOp 2024-11-22 22:22:27 +02:00