summaryrefslogtreecommitdiff
path: root/kern/usermem_asm.S
blob: 0eee6f8c45f63cb8a2fb5300cbafeead6e628e57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/** @file usermem_asm.S
 *
 *  @brief userspace r/w functions.
 *
 *  @author Hanjie Wu (hanjiew)
 *  @bug No functional bugs
 */

.text

.global try_read
.type try_read, %function
try_read:
    mov 0x4(%esp), %eax
    mov 0x8(%esp), %esi
    mov (%eax), %al
    mov %al, (%esi)
    xor %eax, %eax
    ret

.global try_write
.type try_write, %function
try_write:
    mov 0x4(%esp), %eax
    mov 0x8(%esp), %edx
    mov %dl, (%eax)
    xor %eax, %eax
    ret

/* unsuccessful r/w will jump to this function and we return 1 */
.global usermem_fail
.type usermem_fail, %function
usermem_fail:
    mov $0xffffffff, %eax
    ret