ia 32 - What happens when memory "wraps" on an IA-32 supporting machine? -
ia 32 - What happens when memory "wraps" on an IA-32 supporting machine? -
i'm creating 64-bit model of ia-32 , representing memory 0-based array of 2**64
bytes (the language i'm modeling in uses **
exponentiation operator). means valid indices array 0
2**64-1
. now, model possible modes of accessing memory, 1 can treat 1 element 8-bit number, 2 elements (little-endian) 16-bit number, etc.
my question is, should model if inquire 16-bit (or 32-bit, etc.) number location 2**64-1
? right now, model returned value memory(2**64-1) + (8 * memory(0))
. i'm not updating flags (which feels wrong). wrapping right behavior? should setting flags when wrapping happens?
i have re-create of intel-64-ia-32-isa.pdf i'm using reference, it's 1,479 pages, , i'm having hard time finding reply particular question.
i tested (did expect that?) 64bit numbers code:
mov dword [0], 0xdeadbeef mov dword [-4], 0x01020304 mov rdi, [-4] phone call writelonghex
in custom os, pages mapped appropriate, running in virtualbox. writelonghex
writes rdi
screen 16-digit hexadecimal number. result:
so yes, wrap. nil funny happens.
no flags should affected (though manual doesn't no flags should set address wrapping, mov reg, [mem]
doesn't impact them ever, , includes case), , no interrupt/trap/whatever happens (unless of course of study 1 or both pages touched not present).
memory ia-32
Comments
Post a Comment