1 INTERFACE [ia32 || amd64 || ux]:
3 EXTENSION class Mem_layout
6 enum { Io_port_max = (1UL << 16) };
9 IMPLEMENTATION [ia32 || amd64 || ux]:
11 #include "static_assert.h"
13 PUBLIC static inline NEEDS["static_assert.h"]
14 template< typename V >
16 Mem_layout::read_special_safe(V const *address, V &v)
18 static_assert(sizeof(v) <= sizeof(Mword), "wrong sized argument");
21 asm volatile ("clc; mov (%[adr]), %[val]; setnc %b[ex] \n"
22 : [val] "=acd" (value), [ex] "=r" (res)
23 : [adr] "acdbSD" (address)
29 PUBLIC static inline NEEDS["static_assert.h"]
30 template< typename T >
32 Mem_layout::read_special_safe(T const *a)
34 static_assert(sizeof(T) <= sizeof(Mword), "wrong sized return type");
36 asm volatile ("mov (%1), %0 \n\t"
37 : "=acd" (res) : "acdbSD" (a) : "cc");
44 Mem_layout::is_special_mapped(void const *a)
46 // Touch the state to page in the TCB. If we get a pagefault here,
47 // the handler doesn't handle it but returns immediatly after
48 // setting eax to 0xffffffff
51 "clc; mov (%2), %0 \n\t"
53 : "=acd" (pagefault_if_0)
54 : "0"(0UL), "acdbSD"(a)
56 return pagefault_if_0;