summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-20 02:37:02 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-20 02:43:48 +0100
commit84bf93fa103eb9e2ed914b67cd5d2c7058d30b42 (patch)
tree0a347a557ed9e16fd7fd901b3cf6537be633c2ca /i386
parent0410dd9e3fe657ef3d8334394180eac5956d407d (diff)
Use long types
* ddb/db_examine.c (db_xcdump): Do not cast addr before passing to db_read_bytes. * ddb/db_macro.c (db_arg_variable): Return long. * ddb/db_macro.h (db_arg_variable): Likewise. * ddb/db_sym.c (db_maxoff): Set type to unsigned long. * ddb/db_task_thread.c (db_set_default_thread, db_get_task_thread): Return long. * ddb/db_variables.h (db_variable): Make fcn function field to return long. (FCN_NULL): Make function type return long. * i386/i386/db_interface.c (int_regs): Set field sizes to long. * i386/i386/db_machdep.h (db_expr_t): Set type to long. * i386/i386/db_trace.c (db_i386_reg_value): Return long. Use long types. (i386_frame, i386_kregs, interrupt_frame, db_nextframe): Set field sizes to long. (db_regs, i386_kregs): Use long * pointers. (db_lookup_i386_kreg): Return long *. (db_numargs, db_nextframe, db_stack_trace_cmd, db_i386_stack_trace): Use long types. * i386/i386/debug_i386.c (dump_ss): Fix format. * i386/i386/ktss.c (ktss_init): Use long type. * i386/i386/pcb.c (set_user_regs): Likewise. * i386/i386/thread.h (i386_saved_state, v86_segs, i386_kernel_state, i386_interrupt_state): Set field sizes to long. * i386/i386/trap.c (kernel_trap, user_trap): Fix formats. * kern/ast.h (ast_t): Set type to long. * kern/boot_script.c (create_task, resume_task, prompt_resume_task, boot_script_set_variable): Use long types. * kern/boot_script.h (boot_script_set_variable): Use long type. * kern/bootstrap.c (bootstrap_create): Pass long type. * kern/lock.c (simple_lock, simple_lock_try): Use long type. * linux/dev/kernel/softirq.c (linux_soft_intr): Fix format.
Diffstat (limited to 'i386')
-rw-r--r--i386/i386/db_interface.c8
-rw-r--r--i386/i386/db_machdep.h2
-rw-r--r--i386/i386/db_trace.c129
-rw-r--r--i386/i386/debug_i386.c14
-rw-r--r--i386/i386/ktss.c2
-rw-r--r--i386/i386/pcb.c2
-rw-r--r--i386/i386/thread.h78
-rw-r--r--i386/i386/trap.c8
8 files changed, 123 insertions, 120 deletions
diff --git a/i386/i386/db_interface.c b/i386/i386/db_interface.c
index c07884d..66cc8b5 100644
--- a/i386/i386/db_interface.c
+++ b/i386/i386/db_interface.c
@@ -188,10 +188,10 @@ kdb_trap(
* instead of those at its call to KDB.
*/
struct int_regs {
- int edi;
- int esi;
- int ebp;
- int ebx;
+ long edi;
+ long esi;
+ long ebp;
+ long ebx;
struct i386_interrupt_state *is;
};
diff --git a/i386/i386/db_machdep.h b/i386/i386/db_machdep.h
index 95e3797..1dba2cd 100644
--- a/i386/i386/db_machdep.h
+++ b/i386/i386/db_machdep.h
@@ -39,7 +39,7 @@
#include <i386/trap.h>
typedef vm_offset_t db_addr_t; /* address - unsigned */
-typedef int db_expr_t; /* expression - signed */
+typedef long db_expr_t; /* expression - signed */
typedef struct i386_saved_state db_regs_t;
db_regs_t ddb_regs; /* register state */
diff --git a/i386/i386/db_trace.c b/i386/i386/db_trace.c
index c4019b5..4e3bea3 100644
--- a/i386/i386/db_trace.c
+++ b/i386/i386/db_trace.c
@@ -45,7 +45,7 @@
#include "trap.h"
-int
+long
db_i386_reg_value(
struct db_variable *vp,
db_expr_t *valuep,
@@ -56,22 +56,22 @@ db_i386_reg_value(
* Machine register set.
*/
struct db_variable db_regs[] = {
- { "cs", (int *)&ddb_regs.cs, db_i386_reg_value },
- { "ds", (int *)&ddb_regs.ds, db_i386_reg_value },
- { "es", (int *)&ddb_regs.es, db_i386_reg_value },
- { "fs", (int *)&ddb_regs.fs, db_i386_reg_value },
- { "gs", (int *)&ddb_regs.gs, db_i386_reg_value },
- { "ss", (int *)&ddb_regs.ss, db_i386_reg_value },
- { "eax",(int *)&ddb_regs.eax, db_i386_reg_value },
- { "ecx",(int *)&ddb_regs.ecx, db_i386_reg_value },
- { "edx",(int *)&ddb_regs.edx, db_i386_reg_value },
- { "ebx",(int *)&ddb_regs.ebx, db_i386_reg_value },
- { "esp",(int *)&ddb_regs.uesp,db_i386_reg_value },
- { "ebp",(int *)&ddb_regs.ebp, db_i386_reg_value },
- { "esi",(int *)&ddb_regs.esi, db_i386_reg_value },
- { "edi",(int *)&ddb_regs.edi, db_i386_reg_value },
- { "eip",(int *)&ddb_regs.eip, db_i386_reg_value },
- { "efl",(int *)&ddb_regs.efl, db_i386_reg_value },
+ { "cs", (long *)&ddb_regs.cs, db_i386_reg_value },
+ { "ds", (long *)&ddb_regs.ds, db_i386_reg_value },
+ { "es", (long *)&ddb_regs.es, db_i386_reg_value },
+ { "fs", (long *)&ddb_regs.fs, db_i386_reg_value },
+ { "gs", (long *)&ddb_regs.gs, db_i386_reg_value },
+ { "ss", (long *)&ddb_regs.ss, db_i386_reg_value },
+ { "eax",(long *)&ddb_regs.eax, db_i386_reg_value },
+ { "ecx",(long *)&ddb_regs.ecx, db_i386_reg_value },
+ { "edx",(long *)&ddb_regs.edx, db_i386_reg_value },
+ { "ebx",(long *)&ddb_regs.ebx, db_i386_reg_value },
+ { "esp",(long *)&ddb_regs.uesp,db_i386_reg_value },
+ { "ebp",(long *)&ddb_regs.ebp, db_i386_reg_value },
+ { "esi",(long *)&ddb_regs.esi, db_i386_reg_value },
+ { "edi",(long *)&ddb_regs.edi, db_i386_reg_value },
+ { "eip",(long *)&ddb_regs.eip, db_i386_reg_value },
+ { "efl",(long *)&ddb_regs.efl, db_i386_reg_value },
};
struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
@@ -82,8 +82,8 @@ struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
struct i386_frame {
struct i386_frame *f_frame;
- int f_retaddr;
- int f_arg0;
+ long f_retaddr;
+ long f_arg0;
};
#define TRAP 1
@@ -99,18 +99,18 @@ boolean_t db_trace_symbols_found = FALSE;
struct i386_kregs {
char *name;
- int offset;
+ long offset;
} i386_kregs[] = {
- { "ebx", (int)(&((struct i386_kernel_state *)0)->k_ebx) },
- { "esp", (int)(&((struct i386_kernel_state *)0)->k_esp) },
- { "ebp", (int)(&((struct i386_kernel_state *)0)->k_ebp) },
- { "edi", (int)(&((struct i386_kernel_state *)0)->k_edi) },
- { "esi", (int)(&((struct i386_kernel_state *)0)->k_esi) },
- { "eip", (int)(&((struct i386_kernel_state *)0)->k_eip) },
+ { "ebx", (long)(&((struct i386_kernel_state *)0)->k_ebx) },
+ { "esp", (long)(&((struct i386_kernel_state *)0)->k_esp) },
+ { "ebp", (long)(&((struct i386_kernel_state *)0)->k_ebp) },
+ { "edi", (long)(&((struct i386_kernel_state *)0)->k_edi) },
+ { "esi", (long)(&((struct i386_kernel_state *)0)->k_esi) },
+ { "eip", (long)(&((struct i386_kernel_state *)0)->k_eip) },
{ 0 },
};
-int *
+long *
db_lookup_i386_kreg(
char *name,
int *kregp)
@@ -119,19 +119,19 @@ db_lookup_i386_kreg(
for (kp = i386_kregs; kp->name; kp++) {
if (strcmp(name, kp->name) == 0)
- return (int *)((int)kregp + kp->offset);
+ return (long *)((long)kregp + kp->offset);
}
return 0;
}
-int
+long
db_i386_reg_value(
struct db_variable *vp,
db_expr_t *valuep,
int flag,
db_var_aux_param_t ap)
{
- int *dp = 0;
+ long *dp = 0;
db_expr_t null_reg = 0;
register thread_t thread = ap->thread;
extern unsigned int_stack_high;
@@ -153,15 +153,15 @@ db_i386_reg_value(
} else if ((thread->state & TH_SWAPPED) == 0 &&
thread->kernel_stack) {
dp = db_lookup_i386_kreg(vp->name,
- (int *)(STACK_IKS(thread->kernel_stack)));
+ (long *)(STACK_IKS(thread->kernel_stack)));
if (dp == 0)
dp = &null_reg;
} else if ((thread->state & TH_SWAPPED) &&
thread->swap_func != thread_exception_return) {
/*.....this breaks t/t $taskN.0...*/
/* only EIP is valid */
- if (vp->valuep == (int *) &ddb_regs.eip) {
- dp = (int *)(&thread->swap_func);
+ if (vp->valuep == (long *) &ddb_regs.eip) {
+ dp = (long *)(&thread->swap_func);
} else {
dp = &null_reg;
}
@@ -170,8 +170,8 @@ db_i386_reg_value(
if (dp == 0) {
if (thread->pcb == 0)
db_error("no pcb\n");
- dp = (int *)((int)(&thread->pcb->iss) +
- ((int)vp->valuep - (int)&ddb_regs));
+ dp = (long *)((long)(&thread->pcb->iss) +
+ ((long)vp->valuep - (long)&ddb_regs));
}
if (flag == DB_VAR_SET)
*dp = *valuep;
@@ -212,18 +212,18 @@ db_numargs(
struct i386_frame *fp,
task_t task)
{
- int *argp;
- int inst;
- int args;
+ long *argp;
+ long inst;
+ long args;
extern char etext[];
- argp = (int *)db_get_task_value((int)&fp->f_retaddr, 4, FALSE, task);
- if (argp < (int *)VM_MIN_KERNEL_ADDRESS || argp > (int *)etext)
+ argp = (long *)db_get_task_value((long)&fp->f_retaddr, sizeof(long), FALSE, task);
+ if (argp < (long *)VM_MIN_KERNEL_ADDRESS || argp > (long *)etext)
args = db_numargs_default;
- else if (!DB_CHECK_ACCESS((int)argp, 4, task))
+ else if (!DB_CHECK_ACCESS((long)argp, sizeof(long), task))
args = db_numargs_default;
else {
- inst = db_get_task_value((int)argp, 4, FALSE, task);
+ inst = db_get_task_value((long)argp, sizeof(long), FALSE, task);
if ((inst & 0xff) == 0x59) /* popl %ecx */
args = 1;
else if ((inst & 0xffff) == 0xc483) /* addl %n, %esp */
@@ -236,16 +236,16 @@ db_numargs(
struct interrupt_frame {
struct i386_frame *if_frame; /* point to next frame */
- int if_retaddr; /* return address to _interrupt */
- int if_unit; /* unit number */
+ long if_retaddr; /* return address to _interrupt */
+ long if_unit; /* unit number */
spl_t if_spl; /* saved spl */
- int if_iretaddr; /* _return_to_{iret,iret_i} */
- int if_edx; /* old sp(iret) or saved edx(iret_i) */
- int if_ecx; /* saved ecx(iret_i) */
- int if_eax; /* saved eax(iret_i) */
- int if_eip; /* saved eip(iret_i) */
- int if_cs; /* saved cs(iret_i) */
- int if_efl; /* saved efl(iret_i) */
+ long if_iretaddr; /* _return_to_{iret,iret_i} */
+ long if_edx; /* old sp(iret) or saved edx(iret_i) */
+ long if_ecx; /* saved ecx(iret_i) */
+ long if_eax; /* saved eax(iret_i) */
+ long if_eip; /* saved eip(iret_i) */
+ long if_cs; /* saved cs(iret_i) */
+ long if_efl; /* saved efl(iret_i) */
};
/*
@@ -263,7 +263,7 @@ db_nextframe(
struct i386_frame **lfp, /* in/out */
struct i386_frame **fp, /* in/out */
db_addr_t *ip, /* out */
- int frame_type, /* in */
+ long frame_type, /* in */
thread_t thread) /* in */
{
struct i386_saved_state *saved_regs;
@@ -277,7 +277,7 @@ db_nextframe(
* it is an (struct i386_saved_state *).
*/
saved_regs = (struct i386_saved_state *)
- db_get_task_value((int)&((*fp)->f_arg0),4,FALSE,task);
+ db_get_task_value((long)&((*fp)->f_arg0),sizeof(long),FALSE,task);
db_printf(">>>>> %s (%d) at ",
trap_name(saved_regs->trapno), saved_regs->trapno);
db_task_printsym(saved_regs->eip, DB_STGY_PROC, task);
@@ -310,10 +310,10 @@ db_nextframe(
default:
miss_frame:
*ip = (db_addr_t)
- db_get_task_value((int)&(*fp)->f_retaddr, 4, FALSE, task);
+ db_get_task_value((long)&(*fp)->f_retaddr, sizeof(long), FALSE, task);
*lfp = *fp;
*fp = (struct i386_frame *)
- db_get_task_value((int)&(*fp)->f_frame, 4, FALSE, task);
+ db_get_task_value((long)&(*fp)->f_frame, sizeof(long), FALSE, task);
break;
}
}
@@ -401,7 +401,7 @@ db_stack_trace_cmd(
} else {
frame = (struct i386_frame *)addr;
th = (db_default_thread)? db_default_thread: current_thread();
- callpc = (db_addr_t)db_get_task_value((int)&frame->f_retaddr, 4,
+ callpc = (db_addr_t)db_get_task_value((long)&frame->f_retaddr, sizeof(long),
FALSE,
(th == THREAD_NULL) ? TASK_NULL : th->task);
}
@@ -420,13 +420,13 @@ db_i386_stack_trace(
{
task_t task;
boolean_t kernel_only;
- int *argp;
- int user_frame = 0;
+ long *argp;
+ long user_frame = 0;
struct i386_frame *lastframe;
int frame_type;
char *filename;
int linenum;
- extern unsigned int db_maxoff;
+ extern unsigned long db_maxoff;
if (count == -1)
count = 65535;
@@ -438,7 +438,7 @@ db_i386_stack_trace(
if (!db_trace_symbols_found)
db_find_trace_symbols();
- if (!INKERNEL((unsigned)callpc) && !INKERNEL((unsigned)frame)) {
+ if (!INKERNEL((unsigned long)callpc) && !INKERNEL((unsigned long)frame)) {
db_printf(">>>>> user space <<<<<\n");
user_frame++;
}
@@ -449,7 +449,7 @@ db_i386_stack_trace(
char * name;
db_expr_t offset;
- if (INKERNEL((unsigned)callpc) && user_frame == 0) {
+ if (INKERNEL((unsigned long)callpc) && user_frame == 0) {
db_addr_t call_func = 0;
db_sym_t sym_tmp;
@@ -474,7 +474,7 @@ db_i386_stack_trace(
frame_type = 0;
narg = db_numargs(frame, task);
}
- } else if (INKERNEL((unsigned)callpc) ^ INKERNEL((unsigned)frame)) {
+ } else if (INKERNEL((unsigned long)callpc) ^ INKERNEL((unsigned long)frame)) {
frame_type = 0;
narg = -1;
} else {
@@ -492,7 +492,7 @@ db_i386_stack_trace(
argp = &frame->f_arg0;
while (narg > 0) {
- db_printf("%x", db_get_task_value((int)argp,4,FALSE,task));
+ db_printf("%x", db_get_task_value((long)argp,sizeof(long),FALSE,task));
argp++;
if (--narg != 0)
db_printf(",");
@@ -519,7 +519,7 @@ db_i386_stack_trace(
break;
}
if (!INKERNEL(lastframe) ||
- (!INKERNEL((unsigned)callpc) && !INKERNEL((unsigned)frame)))
+ (!INKERNEL((unsigned long)callpc) && !INKERNEL((unsigned long)frame)))
user_frame++;
if (user_frame == 1) {
db_printf(">>>>> user space <<<<<\n");
@@ -570,6 +570,7 @@ static void db_cproc_state(
}
/* offsets in a cproc structure */
+/* TODO: longs? */
int db_cproc_next_offset = 0 * 4;
int db_cproc_incarnation_offset = 1 * 4;
int db_cproc_list_offset = 2 * 4;
diff --git a/i386/i386/debug_i386.c b/i386/i386/debug_i386.c
index f3e1883..937d7b4 100644
--- a/i386/i386/debug_i386.c
+++ b/i386/i386/debug_i386.c
@@ -30,19 +30,21 @@
void dump_ss(struct i386_saved_state *st)
{
printf("Dump of i386_saved_state %p:\n", st);
- printf("EAX %08x EBX %08x ECX %08x EDX %08x\n",
+ printf("EAX %08lx EBX %08lx ECX %08lx EDX %08lx\n",
st->eax, st->ebx, st->ecx, st->edx);
- printf("ESI %08x EDI %08x EBP %08x ESP %08x\n",
+ printf("ESI %08lx EDI %08lx EBP %08lx ESP %08lx\n",
st->esi, st->edi, st->ebp, st->uesp);
- printf("CS %04x SS %04x DS %04x ES %04x FS %04x GS %04x\n",
+ printf("CS %04lx SS %04lx "
+ "DS %04lx ES %04lx "
+ "FS %04lx GS %04lx\n",
st->cs & 0xffff, st->ss & 0xffff,
st->ds & 0xffff, st->es & 0xffff,
st->fs & 0xffff, st->gs & 0xffff);
- printf("v86: DS %04x ES %04x FS %04x GS %04x\n",
+ printf("v86: DS %04lx ES %04lx FS %04lx GS %04lx\n",
st->v86_segs.v86_ds & 0xffff, st->v86_segs.v86_es & 0xffff,
st->v86_segs.v86_gs & 0xffff, st->v86_segs.v86_gs & 0xffff);
- printf("EIP %08x EFLAGS %08x\n", st->eip, st->efl);
- printf("trapno %d: %s, error %08x\n",
+ printf("EIP %08lx EFLAGS %08lx\n", st->eip, st->efl);
+ printf("trapno %ld: %s, error %08lx\n",
st->trapno, trap_name(st->trapno),
st->err);
}
diff --git a/i386/i386/ktss.c b/i386/i386/ktss.c
index e2c4425..453aad9 100644
--- a/i386/i386/ktss.c
+++ b/i386/i386/ktss.c
@@ -58,7 +58,7 @@ ktss_init()
/* Initialize the master TSS. */
ktss.tss.ss0 = KERNEL_DS;
- ktss.tss.esp0 = (unsigned)(exception_stack+1024);
+ ktss.tss.esp0 = (unsigned long)(exception_stack+1024);
ktss.tss.io_bit_map_offset = IOPB_INVAL;
/* Set the last byte in the I/O bitmap to all 1's. */
ktss.barrier = 0xff;
diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c
index dfe0444..4f34391 100644
--- a/i386/i386/pcb.c
+++ b/i386/i386/pcb.c
@@ -810,7 +810,7 @@ set_user_regs(stack_base, stack_size, exec_info, arg_size)
arg_addr = stack_base + stack_size - arg_size;
saved_state = USER_REGS(current_thread());
- saved_state->uesp = (int)arg_addr;
+ saved_state->uesp = (long)arg_addr;
saved_state->eip = exec_info->entry;
return (arg_addr);
diff --git a/i386/i386/thread.h b/i386/i386/thread.h
index f2ae8bf..eddd25c 100644
--- a/i386/i386/thread.h
+++ b/i386/i386/thread.h
@@ -51,31 +51,31 @@
*/
struct i386_saved_state {
- unsigned int gs;
- unsigned int fs;
- unsigned int es;
- unsigned int ds;
- unsigned int edi;
- unsigned int esi;
- unsigned int ebp;
- unsigned int cr2; /* kernel esp stored by pusha -
+ unsigned long gs;
+ unsigned long fs;
+ unsigned long es;
+ unsigned long ds;
+ unsigned long edi;
+ unsigned long esi;
+ unsigned long ebp;
+ unsigned long cr2; /* kernel esp stored by pusha -
we save cr2 here later */
- unsigned int ebx;
- unsigned int edx;
- unsigned int ecx;
- unsigned int eax;
- unsigned int trapno;
- unsigned int err;
- unsigned int eip;
- unsigned int cs;
- unsigned int efl;
- unsigned int uesp;
- unsigned int ss;
+ unsigned long ebx;
+ unsigned long edx;
+ unsigned long ecx;
+ unsigned long eax;
+ unsigned long trapno;
+ unsigned long err;
+ unsigned long eip;
+ unsigned long cs;
+ unsigned long efl;
+ unsigned long uesp;
+ unsigned long ss;
struct v86_segs {
- unsigned int v86_es; /* virtual 8086 segment registers */
- unsigned int v86_ds;
- unsigned int v86_fs;
- unsigned int v86_gs;
+ unsigned long v86_es; /* virtual 8086 segment registers */
+ unsigned long v86_ds;
+ unsigned long v86_fs;
+ unsigned long v86_gs;
} v86_segs;
};
@@ -97,12 +97,12 @@ struct i386_exception_link {
*/
struct i386_kernel_state {
- int k_ebx; /* kernel context */
- int k_esp;
- int k_ebp;
- int k_edi;
- int k_esi;
- int k_eip;
+ long k_ebx; /* kernel context */
+ long k_esp;
+ long k_ebp;
+ long k_edi;
+ long k_esi;
+ long k_eip;
};
/*
@@ -144,16 +144,16 @@ struct v86_assist_state {
*/
struct i386_interrupt_state {
- int gs;
- int fs;
- int es;
- int ds;
- int edx;
- int ecx;
- int eax;
- int eip;
- int cs;
- int efl;
+ long gs;
+ long fs;
+ long es;
+ long ds;
+ long edx;
+ long ecx;
+ long eax;
+ long eip;
+ long cs;
+ long efl;
};
/*
diff --git a/i386/i386/trap.c b/i386/i386/trap.c
index d594907..0ca0a3f 100644
--- a/i386/i386/trap.c
+++ b/i386/i386/trap.c
@@ -220,7 +220,7 @@ dump_ss(regs);
|| (subcode >= (long)_start
&& subcode < (long)etext)) {
printf("Kernel page fault at address 0x%x, "
- "eip = 0x%x\n",
+ "eip = 0x%lx\n",
subcode, regs->eip);
goto badtrap;
}
@@ -328,7 +328,7 @@ dump_ss(regs);
printf("%s trap", trap_type[type]);
else
printf("trap %d", type);
- printf(", eip 0x%x\n", regs->eip);
+ printf(", eip 0x%lx\n", regs->eip);
#if MACH_TTD
if (kttd_enabled && kttd_trap(type, code, regs))
return;
@@ -362,7 +362,7 @@ int user_trap(regs)
if ((vm_offset_t)thread < phys_last_addr) {
printf("user_trap: bad thread pointer 0x%p\n", thread);
- printf("trap type %d, code 0x%x, va 0x%x, eip 0x%x\n",
+ printf("trap type %ld, code 0x%lx, va 0x%lx, eip 0x%lx\n",
regs->trapno, regs->err, regs->cr2, regs->eip);
asm volatile ("1: hlt; jmp 1b");
}
@@ -540,7 +540,7 @@ printf("user trap %d error %d sub %08x\n", type, code, subcode);
return 0;
#endif /* MACH_KDB */
splhigh();
- printf("user trap, type %d, code = %x\n",
+ printf("user trap, type %d, code = %lx\n",
type, regs->err);
dump_ss(regs);
panic("trap");