[metal] Some minor fixes and tweaks (#933)

* [metal] Ensure DF is clear when calling C from exception handler
* [metal] Mark some internal routines and declarations as `@internal`
* [metal] Fix crash under UEFI when command line string is NULL
* [metal] Fix argc & argv[] setting, & VM page freeing, for UEFI

Part of the memory occupied by the argv[] contents was
erroneously used for page tables & then later erroneously
freed.  The symptom was that argv[0] would show up as an
empty string ("").
This commit is contained in:
tkchia 2023-11-15 07:26:59 +08:00 committed by GitHub
parent 1c2e7c1333
commit eea601f346
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 76 additions and 20 deletions

View file

@ -5,6 +5,17 @@
#include "libc/log/color.internal.h"
/**
* @internal
* @fileoverview Declarations for bare metal code to interact with ACPI
*
* @see UEFI Forum, Inc. Advanced Configuration and Power Interface (ACPI)
* Specification, Version 6.5, 2022. https://uefi.org/specifications
* @see Intel Corporation. ACPI Component Architecture: User Guide and
* Programmer Reference, Revision 6.2, 2017. https://acpica.org
*/
/**
* @internal
* AcpiStatus values.
*/
#define kAcpiOk 0x0000
@ -13,11 +24,13 @@
#define kAcpiExBadChecksum 0x2003
/**
* @internal
* Flags for AcpiTableMadt::Flags.
*/
#define kAcpiMadtPcAtCompat 0x0001
/**
* @internal
* Flags for AcpiTableFadt::BootFlags.
*/
#define kAcpiFadtLegacyDevices 0x0001
@ -28,6 +41,7 @@
#define kAcpiFadtNoCmosRtc 0x0020
/**
* @internal
* Values for AcpiSubtableHeader::Type under an AcpiTableMadt.
*/
#define kAcpiMadtLocalApic 0
@ -36,15 +50,6 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
/**
* @fileoverview Declarations for bare metal code to interact with ACPI
*
* @see UEFI Forum, Inc. Advanced Configuration and Power Interface (ACPI)
* Specification, Version 6.5, 2022. https://uefi.org/specifications
* @see Intel Corporation. ACPI Component Architecture: User Guide and
* Programmer Reference, Revision 6.2, 2017. https://acpica.org
*/
COSMOPOLITAN_C_START_
/**