kernel: add c++ support
This commit is contained in:
@@ -5,6 +5,10 @@
|
||||
#include <socks/status.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ACPI_MADT_LAPIC 0x00
|
||||
#define ACPI_MADT_IOAPIC 0x01
|
||||
#define ACPI_MADT_LAPIC_OVERRIDE 0x05
|
||||
@@ -56,12 +60,12 @@ struct acpi_sdt {
|
||||
|
||||
struct acpi_rsdt {
|
||||
struct acpi_sdt r_header;
|
||||
uint32_t r_tables[];
|
||||
uint32_t r_tables[1];
|
||||
} __packed;
|
||||
|
||||
struct acpi_xsdt {
|
||||
struct acpi_sdt x_header;
|
||||
uint64_t x_tables[];
|
||||
uint64_t x_tables[1];
|
||||
} __packed;
|
||||
|
||||
struct acpi_madt {
|
||||
@@ -95,4 +99,8 @@ extern kern_status_t smp_init(void);
|
||||
|
||||
extern struct acpi_sdt *acpi_find_sdt(uint32_t sig);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,14 @@
|
||||
#include <stddef.h>
|
||||
#include <arch/multiboot.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void e820_scan(multiboot_memory_map_t *mmap, size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
#include <socks/compiler.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NR_GDT_ENTRIES 5
|
||||
|
||||
#define GDT_A_PRESENT (1 << 7)
|
||||
@@ -39,4 +43,8 @@ struct gdt_ptr {
|
||||
extern int gdt_init(struct gdt *gdt, struct gdt_ptr *gdtp);
|
||||
extern int gdt_load(struct gdt_ptr *gdtp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
#include <socks/queue.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NR_IDT_ENTRIES 48
|
||||
|
||||
typedef enum irq_vector {
|
||||
@@ -68,4 +72,8 @@ extern int idt_load(struct idt_ptr *idtp);
|
||||
extern void hook_irq(irq_vector_t vec, irq_hook_t *hook);
|
||||
extern void unhook_irq(irq_vector_t vec, irq_hook_t *hook);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,8 +5,16 @@
|
||||
|
||||
#define MSR_GS_BASE 0xC0000101
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defined in cpu_ctrl.S */
|
||||
extern uint64_t rdmsr(uint32_t id);
|
||||
extern void wrmsr(uint32_t id, uint64_t val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
#include <socks/types.h>
|
||||
#include <socks/compiler.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PTE_PRESENT 0x01ULL
|
||||
#define PTE_RW 0x02ULL
|
||||
#define PTE_USR 0x04ULL
|
||||
@@ -52,4 +56,8 @@ typedef enum page_size {
|
||||
extern int gigabyte_pages(void);
|
||||
extern int enable_nx(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
#ifndef ARCH_PIT_H_
|
||||
#define ARCH_PIT_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void pit_start(unsigned int hz);
|
||||
extern void pit_stop(void);
|
||||
extern void pit_wait(unsigned int ticks);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern uint8_t inportb(uint16_t port);
|
||||
extern uint16_t inportw(uint16_t port);
|
||||
extern uint32_t inportl(uint16_t port);
|
||||
@@ -12,4 +16,8 @@ extern void outportl(uint16_t port, uint32_t data);
|
||||
extern void outportsw(uint16_t port, void *data, uint32_t size);
|
||||
extern void inportsw(uint16_t port, unsigned char *data, unsigned long size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#ifndef ARCH_SERIAL_H_
|
||||
#define ARCH_SERIAL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SERIAL_PORT_A 0x3F8
|
||||
#define SERIAL_PORT_B 0x2F8
|
||||
#define SERIAL_PORT_C 0x3E8
|
||||
@@ -14,4 +18,8 @@ extern char serial_recv_byte(int device);
|
||||
|
||||
extern int serial_rcvd(int device);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
#ifndef ARCH_VGACON_H_
|
||||
#define ARCH_VGACON_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void vgacon_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
#include <arch/gdt.h>
|
||||
#include <arch/irq.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ml_cpu_block_get_id(p) ((p)->c_cpu_id)
|
||||
|
||||
typedef struct ml_cpu_block {
|
||||
@@ -28,4 +32,8 @@ extern int ml_cpu_block_use(ml_cpu_block *p);
|
||||
extern void ml_halt_cpu(void);
|
||||
extern ml_cpu_block *ml_this_cpu(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
#define ML_HWLOCK_INIT (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int ml_hwlock_t;
|
||||
|
||||
extern void ml_hwlock_lock(ml_hwlock_t *lck);
|
||||
@@ -11,4 +15,8 @@ extern void ml_hwlock_unlock(ml_hwlock_t *lck);
|
||||
extern void ml_hwlock_lock_irqsave(ml_hwlock_t *lck, unsigned long *flags);
|
||||
extern void ml_hwlock_unlock_irqrestore(ml_hwlock_t *lck, unsigned long flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __X2(x) #x
|
||||
#define __X(x) __X2(x)
|
||||
|
||||
@@ -12,4 +16,8 @@
|
||||
|
||||
extern int ml_init(uintptr_t arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user