Compare commits
No commits in common. "34b10f61ce42bf266971c72748346b3d1484140a" and "687fa44effc5f75131cb8db96c80c5d79b98d6f1" have entirely different histories.
34b10f61ce
...
687fa44eff
|
@ -7,26 +7,22 @@
|
|||
|
||||
.global signal_trampoline
|
||||
signal_trampoline:
|
||||
ud2
|
||||
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
subl $8, %esp
|
||||
|
||||
pusha
|
||||
|
||||
movl 40(%esp), %edi
|
||||
movl 36(%esp), %eax
|
||||
|
||||
// align stack to 16 bytes
|
||||
movl %esp, %ebx
|
||||
andl $0x0F, %ebx
|
||||
subl %ebx, %esp
|
||||
|
||||
subl $12, %esp
|
||||
pushl %edi
|
||||
call *%eax
|
||||
addl $16, %esp
|
||||
|
||||
// restore stack
|
||||
addl %ebx, %esp
|
||||
popa
|
||||
|
||||
leave
|
||||
|
|
|
@ -82,18 +82,9 @@ boot_pdpt:
|
|||
boot_pd:
|
||||
.set i, 0
|
||||
.rept 512
|
||||
.long V2P(boot_pts) + i + (PG_READ_WRITE | PG_PRESENT)
|
||||
.long i + (PG_PAGE_SIZE | PG_READ_WRITE | PG_PRESENT)
|
||||
.long 0
|
||||
.set i, i + 0x1000
|
||||
.endr
|
||||
boot_pts:
|
||||
.set i, 0
|
||||
.rept 512
|
||||
.rept 512
|
||||
.long i + (PG_READ_WRITE | PG_PRESENT)
|
||||
.long 0
|
||||
.set i, i + 0x1000
|
||||
.endr
|
||||
.set i, i + 0x200000
|
||||
.endr
|
||||
|
||||
boot_gdt:
|
||||
|
|
|
@ -23,18 +23,12 @@ signal_trampoline:
|
|||
pushq %r14
|
||||
pushq %r15
|
||||
|
||||
// This is 16 byte aligned
|
||||
|
||||
movq 128(%rsp), %rdi
|
||||
movq 120(%rsp), %rax
|
||||
|
||||
// align stack to 16 bytes
|
||||
movq %rsp, %rbx
|
||||
andq $0x0F, %rbx
|
||||
subq %rbx, %rsp
|
||||
|
||||
call *%rax
|
||||
|
||||
// restore stack
|
||||
addq %rbx, %rsp
|
||||
popq %r15
|
||||
popq %r14
|
||||
popq %r13
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Kernel::ACPI::AML
|
|||
if (!buffer_size.has_value())
|
||||
return ParseResult::Failure;
|
||||
|
||||
uint32_t actual_buffer_size = BAN::Math::max<uint32_t>(buffer_size.value(), buffer_context.aml_data.size());
|
||||
uint32_t actual_buffer_size = BAN::Math::max(buffer_size.value(), buffer_context.aml_data.size());
|
||||
|
||||
auto buffer = MUST(BAN::RefPtr<Buffer>::create());
|
||||
MUST(buffer->buffer.resize(actual_buffer_size, 0));
|
||||
|
|
|
@ -103,7 +103,6 @@ namespace Kernel
|
|||
ASSERT(m_lock_depth == 0);
|
||||
}
|
||||
m_lock_depth++;
|
||||
return true;
|
||||
}
|
||||
|
||||
void unlock()
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace Kernel
|
|||
|
||||
private:
|
||||
static constexpr size_t m_kernel_stack_size = PAGE_SIZE * 64;
|
||||
static constexpr size_t m_userspace_stack_size = PAGE_SIZE * 64;
|
||||
static constexpr size_t m_userspace_stack_size = PAGE_SIZE * 4;
|
||||
BAN::UniqPtr<VirtualRange> m_kernel_stack;
|
||||
BAN::UniqPtr<VirtualRange> m_userspace_stack;
|
||||
const pid_t m_tid { 0 };
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
namespace Kernel::ACPI
|
||||
{
|
||||
|
||||
|
||||
static uint32_t* s_global_lock { nullptr };
|
||||
|
||||
// https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html#global-lock
|
||||
#if ARCH(x86_64)
|
||||
asm(R"(
|
||||
.global acpi_acquire_global_lock
|
||||
acpi_acquire_global_lock:
|
||||
|
@ -54,41 +54,6 @@ acpi_release_global_lock:
|
|||
|
||||
ret
|
||||
)");
|
||||
#elif ARCH(i686)
|
||||
asm(R"(
|
||||
.global acpi_acquire_global_lock
|
||||
acpi_acquire_global_lock:
|
||||
movl 4(%esp), %ecx
|
||||
movl (%ecx), %edx
|
||||
andl $(~1), %edx
|
||||
btsl $1, %edx
|
||||
adcl $0, %edx
|
||||
|
||||
lock cmpxchgl %edx, (%ecx)
|
||||
jnz acpi_acquire_global_lock
|
||||
|
||||
cmpb $3, %dl
|
||||
sbbl %eax, %eax
|
||||
negl %eax
|
||||
|
||||
ret
|
||||
|
||||
.global acpi_release_global_lock
|
||||
acpi_release_global_lock:
|
||||
movl 4(%esp), %ecx
|
||||
movl (%ecx), %eax
|
||||
movl %eax, %edx
|
||||
|
||||
andl $(~3), %edx
|
||||
|
||||
lock cmpxchgl %edx, (%ecx)
|
||||
jnz acpi_release_global_lock
|
||||
|
||||
andl $1, %eax
|
||||
|
||||
ret
|
||||
)");
|
||||
#endif
|
||||
|
||||
// returns true if lock was acquired successfully
|
||||
extern "C" bool acpi_acquire_global_lock(uint32_t* lock);
|
||||
|
|
|
@ -247,13 +247,6 @@ namespace Kernel
|
|||
uint8_t bsp_id = Kernel::Processor::current_id();
|
||||
dprintln("BSP lapic id: {}", bsp_id);
|
||||
|
||||
if (m_processors.size() == 1)
|
||||
{
|
||||
dprintln("Only one processor, skipping AP initialization");
|
||||
*g_ap_startup_done = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& processor : m_processors)
|
||||
{
|
||||
if (processor.apic_id == bsp_id)
|
||||
|
|
|
@ -335,9 +335,7 @@ namespace Kernel
|
|||
else if (signal_handler != (vaddr_t)SIG_DFL)
|
||||
{
|
||||
// call userspace signal handlers
|
||||
#if ARCH(x86_64)
|
||||
interrupt_stack.sp -= 128; // skip possible red-zone
|
||||
#endif
|
||||
write_to_stack(interrupt_stack.sp, interrupt_stack.ip);
|
||||
write_to_stack(interrupt_stack.sp, signal);
|
||||
write_to_stack(interrupt_stack.sp, signal_handler);
|
||||
|
|
|
@ -47,7 +47,6 @@ namespace Kernel
|
|||
IO::outb(TIMER0_CTL, (timer_reload >> 0) & 0xff);
|
||||
IO::outb(TIMER0_CTL, (timer_reload >> 8) & 0xff);
|
||||
|
||||
MUST(InterruptController::get().reserve_irq(PIT_IRQ));
|
||||
set_irq(PIT_IRQ);
|
||||
enable_interrupt();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue