Commit 425b0bf8 authored by Julian Kranz's avatar Julian Kranz

X86 Specification

- Segmentation
parent a6fb4122
...@@ -82,6 +82,14 @@ type signedness = ...@@ -82,6 +82,14 @@ type signedness =
Signed Signed
| Unsigned | Unsigned
#val segment-add address seg = do
# addr-with-segment <- mktemp;
# seg-sem <- return (semantic-register-of seg);
#
#end
#Todo: Für alle Größen automatische Erweiterung (Konfigurierbar auch bei read?)
#Todo: Segmentation, siehe oben und unten...
val conv-with conv sz x = val conv-with conv sz x =
let let
val conv-imm conv x = case conv of val conv-imm conv x = case conv of
...@@ -822,8 +830,10 @@ val sem-jrcxz x = sem-jregz x RCX ...@@ -822,8 +830,10 @@ val sem-jrcxz x = sem-jregz x RCX
val sem-jmp x = do val sem-jmp x = do
target-sz <- sizeof-flow x.opnd1; target-sz <- sizeof-flow x.opnd1;
#Todo: Richtig Größe an der richtigen Stelle (unten) [=> auch bei call/jcc?]
target <- read-flow target-sz x.opnd1; target <- read-flow target-sz x.opnd1;
#Todo: Jetzt in Instruktion => x.opndsz
opnd-sz <- static-flow-opnd-sz x.opnd1; opnd-sz <- static-flow-opnd-sz x.opnd1;
mode64 <- t-mode64?; mode64 <- t-mode64?;
......
...@@ -53,37 +53,12 @@ type seg_override = ...@@ -53,37 +53,12 @@ type seg_override =
SEG_DEFAULT SEG_DEFAULT
| SEG_OVERRIDE of register | SEG_OVERRIDE of register
val set-CS = do val set-CS = update@{segment=SEG_OVERRIDE CS}
m <- query $mode64; val set-DS = update@{segment=SEG_OVERRIDE DS}
if m then val set-ES = update@{segment=SEG_OVERRIDE ES}
return void
else
update@{segment=SEG_OVERRIDE CS}
end
val set-DS = do
m <- query $mode64;
if m then
return void
else
update@{segment=SEG_OVERRIDE DS}
end
val set-ES = do
m <- query $mode64;
if m then
return void
else
update@{segment=SEG_OVERRIDE ES}
end
val set-FS = update@{segment=SEG_OVERRIDE FS} val set-FS = update@{segment=SEG_OVERRIDE FS}
val set-GS = update@{segment=SEG_OVERRIDE GS} val set-GS = update@{segment=SEG_OVERRIDE GS}
val set-SS = do val set-SS = update@{segment=SEG_OVERRIDE SS}
m <- query $mode64;
if m then
return void
else
update@{segment=SEG_OVERRIDE SS}
end
val set-lock = update@{lock='1'} val set-lock = update@{lock='1'}
val set-addrsz = update@{addrsz='1'} val set-addrsz = update@{addrsz='1'}
...@@ -1880,21 +1855,17 @@ val segmentation-set-for-base base = ...@@ -1880,21 +1855,17 @@ val segmentation-set-for-base base =
end end
end end
in in
do case base of
mode64 <- mode64?; REG r: case r of
if not(mode64) then return void else SP : override-ss
case base of | ESP: override-ss
REG r: case r of | RSP: override-ss
SP : override-ss | BP : override-ss
| ESP: override-ss | EBP: override-ss
| RSP: override-ss | RBP: override-ss
| BP : override-ss
| EBP: override-ss
| RBP: override-ss
| _ : return void
end
| _ : return void | _ : return void
end end
| _ : return void
end end
end end
...@@ -1990,7 +1961,18 @@ val mem op = do ...@@ -1990,7 +1961,18 @@ val mem op = do
seg <- query $segment; seg <- query $segment;
case seg of case seg of
SEG_DEFAULT: return DS SEG_DEFAULT: return DS
| SEG_OVERRIDE r: return r | SEG_OVERRIDE r:
do
mode64 <- mode64?;
if mode64 then
case r of
FS: return r
| GS: return r
| _: return DS
end
else
return r
end
end end
end end
; ;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment