summaryrefslogtreecommitdiff
path: root/arch/x86/machine
diff options
context:
space:
mode:
authorMocramis <mocramis@gmail.com>2018-01-08 21:21:13 +0100
committerMocramis <mocramis@gmail.com>2018-01-08 21:21:13 +0100
commitbf5c783d4cad55ba41210ba71b3c8e28ce63cfa8 (patch)
tree63ad90bbc798f6cca9b8cf3d11614b480fc76c1b /arch/x86/machine
parent1ec3d3f143a201984d51f1cff91b0fe29cde2b71 (diff)
parent65f71c221037e468caa5921d23a86da34f3bd0a5 (diff)
Merge branch 'master' into perfmon
Diffstat (limited to 'arch/x86/machine')
-rw-r--r--arch/x86/machine/cga.c4
-rw-r--r--arch/x86/machine/cpu.c4
-rw-r--r--arch/x86/machine/ioapic.c2
-rw-r--r--arch/x86/machine/tcb.c2
-rw-r--r--arch/x86/machine/tcb.h2
-rw-r--r--arch/x86/machine/tcb_asm.S11
6 files changed, 10 insertions, 15 deletions
diff --git a/arch/x86/machine/cga.c b/arch/x86/machine/cga.c
index d086326..b519ba1 100644
--- a/arch/x86/machine/cga.c
+++ b/arch/x86/machine/cga.c
@@ -216,7 +216,7 @@ static void
cga_bbuf_redraw(struct cga_bbuf *bbuf)
{
size_t size;
- __unused int error;
+ int error;
size = CGA_MEMORY_SIZE;
error = cbuf_read(&bbuf->cbuf, bbuf->view, cga_memory, &size);
@@ -298,7 +298,7 @@ cga_bbuf_newline(struct cga_bbuf *bbuf)
{
uint16_t cursor = 0, spaces[CGA_COLUMNS];
size_t i, nr_spaces, offset, size;
- __unused int error;
+ int error;
cga_bbuf_reset_view(bbuf);
diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c
index c733daa..54a2676 100644
--- a/arch/x86/machine/cpu.c
+++ b/arch/x86/machine/cpu.c
@@ -502,9 +502,7 @@ cpu_init(struct cpu *cpu)
cpu->phys_addr_width = 0;
cpu->virt_addr_width = 0;
- if (max_basic == 0) {
- panic("cpu: unsupported maximum input value for basic information");
- }
+ assert(max_basic >= 1);
eax = 1;
cpu_cpuid(&eax, &ebx, &ecx, &edx);
diff --git a/arch/x86/machine/ioapic.c b/arch/x86/machine/ioapic.c
index d70ec92..82fbd6d 100644
--- a/arch/x86/machine/ioapic.c
+++ b/arch/x86/machine/ioapic.c
@@ -209,7 +209,7 @@ ioapic_create(unsigned int apic_id, uintptr_t addr, unsigned int gsi_base)
return ioapic;
}
-__unused static bool
+static bool
ioapic_has_gsi(const struct ioapic *ioapic, unsigned int gsi)
{
return ((gsi >= ioapic->first_gsi) && (gsi <= ioapic->last_gsi));
diff --git a/arch/x86/machine/tcb.c b/arch/x86/machine/tcb.c
index 6978811..10bbac6 100644
--- a/arch/x86/machine/tcb.c
+++ b/arch/x86/machine/tcb.c
@@ -49,7 +49,6 @@ tcb_stack_forge(struct tcb *tcb, void (*fn)(void *), void *arg)
tcb_stack_push(tcb, (uintptr_t)arg);
tcb_stack_push(tcb, (uintptr_t)fn);
tcb_stack_push(tcb, (uintptr_t)tcb_start); /* Return address */
- tcb_stack_push(tcb, CPU_EFL_ONE); /* RFLAGS */
tcb_stack_push(tcb, 0); /* RBX */
tcb_stack_push(tcb, 0); /* R12 */
tcb_stack_push(tcb, 0); /* R13 */
@@ -65,7 +64,6 @@ tcb_stack_forge(struct tcb *tcb, void (*fn)(void *), void *arg)
tcb_stack_push(tcb, (uintptr_t)arg);
tcb_stack_push(tcb, (uintptr_t)fn);
tcb_stack_push(tcb, (uintptr_t)tcb_start); /* Return address */
- tcb_stack_push(tcb, CPU_EFL_ONE); /* EFLAGS */
tcb_stack_push(tcb, 0); /* EBX */
tcb_stack_push(tcb, 0); /* EDI */
tcb_stack_push(tcb, 0); /* ESI */
diff --git a/arch/x86/machine/tcb.h b/arch/x86/machine/tcb.h
index 004cf92..2e9493d 100644
--- a/arch/x86/machine/tcb.h
+++ b/arch/x86/machine/tcb.h
@@ -52,7 +52,7 @@ struct tcb {
* Build a TCB.
*
* Prepare the given stack for execution. The context is defined so that it
- * will call thread_main(fn, arg) with interrupts disabled when loaded.
+ * will call thread_main(fn, arg) when loaded.
*
* In addition, initialize any thread-local machine-specific data.
*/
diff --git a/arch/x86/machine/tcb_asm.S b/arch/x86/machine/tcb_asm.S
index a6e31da..2d2bcd5 100644
--- a/arch/x86/machine/tcb_asm.S
+++ b/arch/x86/machine/tcb_asm.S
@@ -64,12 +64,12 @@ ASM_ENTRY(tcb_start)
ASM_END(tcb_start)
ASM_ENTRY(tcb_context_switch)
- pushfq /* store registers as required by ABI */
- pushq %rbx
+ pushq %rbx /* store registers as required by ABI */
pushq %r12
pushq %r13
pushq %r14
pushq %r15
+
movq %rbp, (%rdi) /* store frame pointer into prev TCB */
movq %rsp, 8(%rdi) /* store stack pointer into prev TCB */
movq (%rsi), %rbp /* load frame pointer from next TCB */
@@ -82,7 +82,6 @@ tcb_context_restore:
popq %r13
popq %r12
popq %rbx
- popfq
ret
ASM_END(tcb_context_switch)
@@ -101,10 +100,11 @@ ASM_END(tcb_start)
ASM_ENTRY(tcb_context_switch)
movl 4(%esp), %eax /* load prev TCB address */
movl 8(%esp), %ecx /* load next TCB address */
- pushfl /* store registers as required by ABI */
- pushl %ebx
+
+ pushl %ebx /* store registers as required by ABI */
pushl %edi
pushl %esi
+
movl %ebp, (%eax) /* store frame pointer into prev TCB */
movl %esp, 4(%eax) /* store stack pointer into prev TCB */
movl (%ecx), %ebp /* load frame pointer from next TCB */
@@ -120,7 +120,6 @@ tcb_context_restore:
popl %esi
popl %edi
popl %ebx
- popfl
ret
ASM_END(tcb_context_switch)