2021 pre-release
This commit is contained in:
parent
11059d5b6f
commit
a94708b3b5
42 changed files with 278 additions and 227 deletions
|
@ -1,7 +1,7 @@
|
|||
SRCS := start.S main.c
|
||||
bootblock.o: $(SRCS) Makefile
|
||||
@echo + CC $(SRCS)
|
||||
@gcc -m32 -Os -nostdlib -Ttext 0x7c00 -I$(AM_HOME)/am/src -o bootblock.o $(SRCS)
|
||||
@$(CROSS_COMPILE)gcc -static -m32 -fno-pic -Os -nostdlib -Ttext 0x7c00 -I$(AM_HOME)/am/src -o bootblock.o $(SRCS)
|
||||
@python3 genboot.py bootblock.o
|
||||
|
||||
clean:
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import sys, pathlib, subprocess
|
||||
import os, sys, pathlib, subprocess
|
||||
|
||||
f = pathlib.Path(sys.argv[1])
|
||||
try:
|
||||
objcopy = os.getenv('CROSS_COMPILE', '') + 'objcopy'
|
||||
data = subprocess.run(
|
||||
['objcopy', '-S', '-O', 'binary', '-j', '.text', f, '/dev/stdout'],
|
||||
[objcopy, '-S', '-O', 'binary', '-j', '.text', f, '/dev/stdout'],
|
||||
capture_output=True).stdout
|
||||
assert len(data) <= 510
|
||||
data += b'\0' * (510 - len(data)) + b'\x55\xaa'
|
||||
|
|
|
@ -14,7 +14,7 @@ static GateDesc32 idt[NR_IRQ];
|
|||
|
||||
IRQS(IRQHANDLE_DECL)
|
||||
void __am_irqall();
|
||||
void __amkcontext_start();
|
||||
void __am_kcontext_start();
|
||||
|
||||
void __am_irq_handle(struct trap_frame *tf) {
|
||||
Context *saved_ctx = &tf->saved_context;
|
||||
|
@ -141,13 +141,13 @@ Context* kcontext(Area kstack, void (*entry)(void *), void *arg) {
|
|||
|
||||
#if __x86_64__
|
||||
ctx->cs = KSEL(SEG_KCODE);
|
||||
ctx->rip = (uintptr_t)__amkcontext_start;
|
||||
ctx->rip = (uintptr_t)__am_kcontext_start;
|
||||
ctx->rflags = FL_IF;
|
||||
ctx->rsp = (uintptr_t)kstack.end;
|
||||
#else
|
||||
ctx->ds = KSEL(SEG_KDATA);
|
||||
ctx->cs = KSEL(SEG_KCODE);
|
||||
ctx->eip = (uintptr_t)__amkcontext_start;
|
||||
ctx->eip = (uintptr_t)__am_kcontext_start;
|
||||
ctx->eflags = FL_IF;
|
||||
ctx->esp = (uintptr_t)kstack.end;
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "x86-qemu.h"
|
||||
|
||||
.globl __amkcontext_start
|
||||
__amkcontext_start:
|
||||
.globl __am_kcontext_start
|
||||
__am_kcontext_start:
|
||||
// eax = arg, ebx = entry
|
||||
pushl %eax
|
||||
pushl $__am_panic_on_return
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "x86-qemu.h"
|
||||
|
||||
.globl __amkcontext_start
|
||||
__amkcontext_start:
|
||||
.globl __am_kcontext_start
|
||||
__am_kcontext_start:
|
||||
// rdi = arg, rsi = entry
|
||||
pushq $__am_panic_on_return
|
||||
jmpq *%rsi
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
#include "x86-qemu.h"
|
||||
|
||||
Area heap = {};
|
||||
volatile uint32_t *__am_lapic;
|
||||
int __am_ncpu = 0;
|
||||
struct cpu_local __am_cpuinfo[MAX_CPU];
|
||||
|
||||
int main(const char *args);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue