meta: rename
This commit is contained in:
49
arch/x86_64/include/mango/machine/cpu.h
Normal file
49
arch/x86_64/include/mango/machine/cpu.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef MANGO_X86_64_CPU_H_
|
||||
#define MANGO_X86_64_CPU_H_
|
||||
|
||||
#include <arch/gdt.h>
|
||||
#include <arch/irq.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ML_BIG_ENDIAN 0
|
||||
|
||||
#define ml_cpu_block_get_id(p) ((p)->c_cpu_id)
|
||||
#define ml_cpu_block_get_data(p) ((p)->c_data)
|
||||
|
||||
struct cpu_data;
|
||||
|
||||
typedef struct ml_cpu_block {
|
||||
struct ml_cpu_block *c_this;
|
||||
|
||||
struct gdt c_gdt;
|
||||
struct gdt_ptr c_gdt_ptr;
|
||||
|
||||
struct idt_ptr c_idt_ptr;
|
||||
unsigned int c_cpu_id;
|
||||
|
||||
struct cpu_data *c_data;
|
||||
} ml_cpu_block;
|
||||
|
||||
#define ml_cpu_pause() __asm__ __volatile__("hlt")
|
||||
#define ml_cpu_relax() __asm__ __volatile__("pause")
|
||||
|
||||
#define ml_int_disable() __asm__ __volatile__("cli")
|
||||
#define ml_int_enable() __asm__ __volatile__("sti")
|
||||
|
||||
extern int ml_init_bootcpu(void);
|
||||
|
||||
extern int ml_cpu_block_init(ml_cpu_block *p);
|
||||
extern int ml_cpu_block_use(ml_cpu_block *p);
|
||||
|
||||
/* defined in cpu_ctrl.S */
|
||||
extern void ml_halt_cpu(void);
|
||||
extern ml_cpu_block *ml_this_cpu(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
22
arch/x86_64/include/mango/machine/hwlock.h
Normal file
22
arch/x86_64/include/mango/machine/hwlock.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef MANGO_X86_64_HWLOCK_H_
|
||||
#define MANGO_X86_64_HWLOCK_H_
|
||||
|
||||
#define ML_HWLOCK_INIT (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int ml_hwlock_t;
|
||||
|
||||
extern void ml_hwlock_lock(ml_hwlock_t *lck);
|
||||
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
|
||||
26
arch/x86_64/include/mango/machine/init.h
Normal file
26
arch/x86_64/include/mango/machine/init.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef MANGO_X86_64_INIT_H_
|
||||
#define MANGO_X86_64_INIT_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __X2(x) #x
|
||||
#define __X(x) __X2(x)
|
||||
|
||||
#define __define_initcall(fn, id) \
|
||||
static initcall_t __initcall_##fn##id __used \
|
||||
__section(".initcall" __X(id) ".init") = (fn)
|
||||
|
||||
extern int ml_init(uintptr_t arg);
|
||||
|
||||
extern const struct framebuffer_varinfo *bootfb_varinfo(void);
|
||||
extern const struct framebuffer_fixedinfo *bootfb_fixedinfo(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
5
arch/x86_64/include/mango/machine/irq.h
Normal file
5
arch/x86_64/include/mango/machine/irq.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#ifndef MANGO_X86_64_IRQ_H_
|
||||
#define MANGO_X86_64_IRQ_H_
|
||||
|
||||
|
||||
#endif
|
||||
12
arch/x86_64/include/mango/machine/panic.h
Normal file
12
arch/x86_64/include/mango/machine/panic.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef MANGO_X86_64_PANIC_H_
|
||||
#define MANGO_X86_64_PANIC_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct cpu_context;
|
||||
|
||||
extern void ml_print_cpu_state(struct cpu_context *ctx);
|
||||
extern void ml_print_stack_trace(uintptr_t ip);
|
||||
extern void ml_print_stack_trace_irq(struct cpu_context *ctx);
|
||||
|
||||
#endif
|
||||
9
arch/x86_64/include/mango/machine/pmap.h
Normal file
9
arch/x86_64/include/mango/machine/pmap.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef MANGO_X86_64_PMAP_H_
|
||||
#define MANGO_X86_64_PMAP_H_
|
||||
|
||||
#include <arch/paging.h>
|
||||
|
||||
typedef pml4t_ptr_t ml_pmap_t;
|
||||
typedef uint64_t ml_pfn_t;
|
||||
|
||||
#endif
|
||||
10
arch/x86_64/include/mango/machine/thread.h
Normal file
10
arch/x86_64/include/mango/machine/thread.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef MANGO_X86_64_THREAD_H_
|
||||
#define MANGO_X86_64_THREAD_H_
|
||||
|
||||
#include <mango/sched.h>
|
||||
|
||||
extern void switch_to(struct thread *from, struct thread *to);
|
||||
extern void prepare_stack(uintptr_t ip, uintptr_t *sp);
|
||||
extern void user_jump(uintptr_t ip, uintptr_t sp);
|
||||
|
||||
#endif
|
||||
24
arch/x86_64/include/mango/machine/vm.h
Normal file
24
arch/x86_64/include/mango/machine/vm.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef MANGO_X86_64_VM_H_
|
||||
#define MANGO_X86_64_VM_H_
|
||||
|
||||
/* kernel higher-half base virtual address. */
|
||||
#define VM_KERNEL_VOFFSET 0xFFFFFFFF80000000
|
||||
|
||||
/* direct page-mapping region.
|
||||
NOTE that these are the maximum bounds of this region.
|
||||
the actual size depends on the amount of physical
|
||||
memory present. */
|
||||
#define VM_PAGEMAP_BASE 0xFFFF888000000000
|
||||
#define VM_PAGEMAP_LIMIT 0xFFFFC87FFFFFFFFF
|
||||
|
||||
#define VM_PAGE_SIZE 0x1000
|
||||
#define VM_PAGE_MASK (VM_PAGE_SIZE-1)
|
||||
#define VM_PAGE_SHIFT 12
|
||||
|
||||
#define VM_PAGE_MIN_ORDER VM_PAGE_4K
|
||||
#define VM_PAGE_MAX_ORDER VM_PAGE_8M
|
||||
|
||||
#define VM_ZONE_MIN VM_ZONE_DMA
|
||||
#define VM_ZONE_MAX VM_ZONE_NORMAL
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user