Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JINUE_X86_ -> JINUE_I686_
Browse files Browse the repository at this point in the history
phaubertin committed Oct 21, 2024
1 parent cd0b127 commit 3ce88ee
Showing 6 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions include/jinue/shared/asm/i686.h
Original file line number Diff line number Diff line change
@@ -69,18 +69,18 @@
#define JINUE_STACK_START (JINUE_STACK_BASE - JINUE_STACK_SIZE)

/** interrupt vector for system call software interrupt */
#define JINUE_X86_SYSCALL_IRQ 0x80
#define JINUE_I686_SYSCALL_IRQ 0x80

/** slow/safe interrupt-based system call implementation */
#define JINUE_X86_HOWSYSCALL_INTERRUPT 0
#define JINUE_I686_HOWSYSCALL_INTERRUPT 0

/** AMD's fast system call implementation (SYSCALL/SYSLEAVE) */
#define JINUE_X86_HOWSYSCALL_FAST_AMD 1
#define JINUE_I686_HOWSYSCALL_FAST_AMD 1

/** Intel's fast system call implementation (SYSENTER/SYSEXIT) */
#define JINUE_X86_HOWSYSCALL_FAST_INTEL 2
#define JINUE_I686_HOWSYSCALL_FAST_INTEL 2

/** last system call implementation index */
#define JINUE_X86_HOWSYSCALL_LAST 2
#define JINUE_I686_HOWSYSCALL_LAST 2

#endif
8 changes: 4 additions & 4 deletions kernel/infrastructure/i686/init.c
Original file line number Diff line number Diff line change
@@ -129,7 +129,7 @@ static void init_idt(void) {
/* set interrupt gate flags */
unsigned int flags = SEG_TYPE_INTERRUPT_GATE | SEG_FLAG_NORMAL_GATE;

if(idx == JINUE_X86_SYSCALL_IRQ) {
if(idx == JINUE_I686_SYSCALL_IRQ) {
flags |= SEG_FLAG_USER;
}
else {
@@ -222,7 +222,7 @@ static void select_syscall_implementation(void) {
if(cpu_has_feature(CPU_FEATURE_SYSCALL)) {
uint64_t msrval;

syscall_implementation = JINUE_X86_HOWSYSCALL_FAST_AMD;
syscall_implementation = JINUE_I686_HOWSYSCALL_FAST_AMD;

msrval = rdmsr(MSR_EFER);
msrval |= MSR_FLAG_EFER_SCE;
@@ -235,7 +235,7 @@ static void select_syscall_implementation(void) {
wrmsr(MSR_STAR, msrval);
}
else if(cpu_has_feature(CPU_FEATURE_SYSENTER)) {
syscall_implementation = JINUE_X86_HOWSYSCALL_FAST_INTEL;
syscall_implementation = JINUE_I686_HOWSYSCALL_FAST_INTEL;

wrmsr(MSR_IA32_SYSENTER_CS, SEG_SELECTOR(GDT_KERNEL_CODE, RPL_KERNEL));
wrmsr(MSR_IA32_SYSENTER_EIP, (uint64_t)(uintptr_t)fast_intel_entry);
@@ -244,7 +244,7 @@ static void select_syscall_implementation(void) {
wrmsr(MSR_IA32_SYSENTER_ESP, (uint64_t)(uintptr_t)NULL);
}
else {
syscall_implementation = JINUE_X86_HOWSYSCALL_INTERRUPT;
syscall_implementation = JINUE_I686_HOWSYSCALL_INTERRUPT;
}
}

2 changes: 1 addition & 1 deletion kernel/interface/i686/interrupt.c
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ void dispatch_interrupt(trapframe_t *trapframe) {
panic("caught exception");
}

if(ivt == JINUE_X86_SYSCALL_IRQ) {
if(ivt == JINUE_I686_SYSCALL_IRQ) {
/* interrupt-based system call implementation */
dispatch_syscall((jinue_syscall_args_t *)&trapframe->msg_arg0);
}
2 changes: 1 addition & 1 deletion userspace/lib/jinue/i686/stubs.asm
Original file line number Diff line number Diff line change
@@ -180,7 +180,7 @@ jinue_syscall_intr:
mov esi, [edi+ 8] ; arg2 (message pointer)
mov edi, [edi+12] ; arg3 (message size)

int JINUE_X86_SYSCALL_IRQ
int JINUE_I686_SYSCALL_IRQ
; restore arguments structure pointer
mov ebp, [esp+20]
10 changes: 5 additions & 5 deletions userspace/lib/jinue/i686/syscalls.c
Original file line number Diff line number Diff line change
@@ -34,15 +34,15 @@
#include "stubs.h"

static jinue_syscall_stub_t syscall_stubs[] = {
[JINUE_X86_HOWSYSCALL_INTERRUPT] = jinue_syscall_intr,
[JINUE_X86_HOWSYSCALL_FAST_AMD] = jinue_syscall_fast_amd,
[JINUE_X86_HOWSYSCALL_FAST_INTEL] = jinue_syscall_fast_intel
[JINUE_I686_HOWSYSCALL_INTERRUPT] = jinue_syscall_intr,
[JINUE_I686_HOWSYSCALL_FAST_AMD] = jinue_syscall_fast_amd,
[JINUE_I686_HOWSYSCALL_FAST_INTEL] = jinue_syscall_fast_intel
};

static int syscall_stub_index = JINUE_X86_HOWSYSCALL_INTERRUPT;
static int syscall_stub_index = JINUE_I686_HOWSYSCALL_INTERRUPT;

int jinue_init(int implementation, int *perrno) {
if(implementation < 0 || implementation > JINUE_X86_HOWSYSCALL_LAST) {
if(implementation < 0 || implementation > JINUE_I686_HOWSYSCALL_LAST) {
*perrno = JINUE_EINVAL;
return -1;
}
8 changes: 4 additions & 4 deletions userspace/testapp/debug.c
Original file line number Diff line number Diff line change
@@ -154,12 +154,12 @@ static const char *auxv_type_name(int type) {

static const char *syscall_implementation_name(int implementation) {
const char *names[] = {
[JINUE_X86_HOWSYSCALL_INTERRUPT] = "interrupt",
[JINUE_X86_HOWSYSCALL_FAST_AMD] = "SYSCALL/SYSRET (fast AMD)",
[JINUE_X86_HOWSYSCALL_FAST_INTEL] = "SYSENTER/SYSEXIT (fast Intel)"
[JINUE_I686_HOWSYSCALL_INTERRUPT] = "interrupt",
[JINUE_I686_HOWSYSCALL_FAST_AMD] = "SYSCALL/SYSRET (fast AMD)",
[JINUE_I686_HOWSYSCALL_FAST_INTEL] = "SYSENTER/SYSEXIT (fast Intel)"
};

if(implementation < 0 || implementation > JINUE_X86_HOWSYSCALL_LAST) {
if(implementation < 0 || implementation > JINUE_I686_HOWSYSCALL_LAST) {
return "?";
}

0 comments on commit 3ce88ee

Please sign in to comment.