summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/reg.h
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-05-01 01:05:25 +0000
committerpeter <peter@FreeBSD.org>2003-05-01 01:05:25 +0000
commit45949ccde13fb04ed597a5aef80b678ba16bcab7 (patch)
treedd665cefeba0e426ad2b212b76851de96f1ad18b /sys/amd64/include/reg.h
parent1fd7bc609e9a5249f7b7b558405e1c39aca79796 (diff)
downloadFreeBSD-src-45949ccde13fb04ed597a5aef80b678ba16bcab7.zip
FreeBSD-src-45949ccde13fb04ed597a5aef80b678ba16bcab7.tar.gz
Commit MD parts of a loosely functional AMD64 port. This is based on
a heavily stripped down FreeBSD/i386 (brutally stripped down actually) to attempt to get a stable base to start from. There is a lot missing still. Worth noting: - The kernel runs at 1GB in order to cheat with the pmap code. pmap uses a variation of the PAE code in order to avoid having to worry about 4 levels of page tables yet. - It boots in 64 bit "long mode" with a tiny trampoline embedded in the i386 loader. This simplifies locore.s greatly. - There are still quite a few fragments of i386-specific code that have not been translated yet, and some that I cheated and wrote dumb C versions of (bcopy etc). - It has both int 0x80 for syscalls (but using registers for argument passing, as is native on the amd64 ABI), and the 'syscall' instruction for syscalls. int 0x80 preserves all registers, 'syscall' does not. - I have tried to minimize looking at the NetBSD code, except in a couple of places (eg: to find which register they use to replace the trashed %rcx register in the syscall instruction). As a result, there is not a lot of similarity. I did look at NetBSD a few times while debugging to get some ideas about what I might have done wrong in my first attempt.
Diffstat (limited to 'sys/amd64/include/reg.h')
-rw-r--r--sys/amd64/include/reg.h102
1 files changed, 26 insertions, 76 deletions
diff --git a/sys/amd64/include/reg.h b/sys/amd64/include/reg.h
index 56f0f91..334dd37 100644
--- a/sys/amd64/include/reg.h
+++ b/sys/amd64/include/reg.h
@@ -41,66 +41,31 @@
#define _MACHINE_REG_H_
/*
- * Indices for registers in `struct trapframe' and `struct regs'.
- *
- * This interface is deprecated. In the kernel, it is only used in FPU
- * emulators to convert from register numbers encoded in instructions to
- * register values. Everything else just accesses the relevant struct
- * members. In userland, debuggers tend to abuse this interface since
- * they don't understand that `struct regs' is a struct. I hope they have
- * stopped accessing the registers in the trap frame via PT_{READ,WRITE}_U
- * and we can stop supporting the user area soon.
- */
-#define tFS (0)
-#define tES (1)
-#define tDS (2)
-#define tEDI (3)
-#define tESI (4)
-#define tEBP (5)
-#define tISP (6)
-#define tEBX (7)
-#define tEDX (8)
-#define tECX (9)
-#define tEAX (10)
-#define tERR (12)
-#define tEIP (13)
-#define tCS (14)
-#define tEFLAGS (15)
-#define tESP (16)
-#define tSS (17)
-
-/*
- * Indices for registers in `struct regs' only.
- *
- * Some registers live in the pcb and are only in an "array" with the
- * other registers in application interfaces that copy all the registers
- * to or from a `struct regs'.
- */
-#define tGS (18)
-
-/*
* Register set accessible via /proc/$pid/regs and PT_{SET,GET}REGS.
*/
struct reg {
- unsigned int r_fs;
- unsigned int r_es;
- unsigned int r_ds;
- unsigned int r_edi;
- unsigned int r_esi;
- unsigned int r_ebp;
- unsigned int r_isp;
- unsigned int r_ebx;
- unsigned int r_edx;
- unsigned int r_ecx;
- unsigned int r_eax;
- unsigned int r_trapno;
- unsigned int r_err;
- unsigned int r_eip;
- unsigned int r_cs;
- unsigned int r_eflags;
- unsigned int r_esp;
- unsigned int r_ss;
- unsigned int r_gs;
+ register_t r_r15;
+ register_t r_r14;
+ register_t r_r13;
+ register_t r_r12;
+ register_t r_r11;
+ register_t r_r10;
+ register_t r_r9;
+ register_t r_r8;
+ register_t r_rdi;
+ register_t r_rsi;
+ register_t r_rbp;
+ register_t r_rbx;
+ register_t r_rdx;
+ register_t r_rcx;
+ register_t r_rax;
+ register_t r_trapno;
+ register_t r_err;
+ register_t r_rip;
+ register_t r_cs;
+ register_t r_rflags;
+ register_t r_rsp;
+ register_t r_ss;
};
/*
@@ -112,30 +77,15 @@ struct fpreg {
* simplified struct. This may be too much detail. Perhaps
* an array of unsigned longs is best.
*/
- unsigned long fpr_env[7];
- unsigned char fpr_acc[8][10];
- unsigned long fpr_ex_sw;
- unsigned char fpr_pad[64];
+ unsigned long fpr_env[4];
+ unsigned char fpr_acc[8][16];
+ unsigned char fpr_xacc[16][16];
};
-/*
- * Register set accessible via /proc/$pid/dbregs.
- */
struct dbreg {
- unsigned int dr[8]; /* debug registers */
- /* Index 0-3: debug address registers */
- /* Index 4-5: reserved */
- /* Index 6: debug status */
- /* Index 7: debug control */
+ unsigned long grrr;
};
-#define DBREG_DR7_EXEC 0x00 /* break on execute */
-#define DBREG_DR7_WRONLY 0x01 /* break on write */
-#define DBREG_DR7_RDWR 0x03 /* break on read or write */
-#define DBREG_DRX(d,x) ((d)->dr[(x)]) /* reference dr0 - dr7 by
- register number */
-
-
#ifdef _KERNEL
/*
* XXX these interfaces are MI, so they should be declared in a MI place.
OpenPOWER on IntegriCloud