|
|
1.1 ! root 1: / $Header: /kernel/kersrc/io.286/ipcas.s,v 1.1 92/07/17 15:24:15 bin Exp Locker: bin $ ! 2: / ! 3: / The information contained herein is a trade secret of INETCO ! 4: / Systems, and is confidential information. It is provided under ! 5: / a license agreement, and may be copied or disclosed only under ! 6: / the terms of that agreement. Any reproduction or disclosure of ! 7: / this material without the express written authorization of ! 8: / INETCO Systems or persuant to the license agreement is unlawful. ! 9: / ! 10: / Copyright (c) 1985, 1984 ! 11: / An unpublished work by INETCO Systems, Ltd. ! 12: / All rights reserved. ! 13: / ! 14: ! 15: //////// ! 16: / ! 17: / System V Compatible Inter-Process Communication - Assembler Support ! 18: / ! 19: / ufcopy( base, off, sel, n ) -- copy n bytes from user base to sel:off. ! 20: / fucopy( off, sel, base, n ) -- copy n bytes from sel:off to user base. ! 21: / ! 22: / $Log: ipcas.s,v $ ! 23: / Revision 1.1 92/07/17 15:24:15 bin ! 24: / Initial revision ! 25: / ! 26: / Revision 2.1 88/09/03 13:06:24 src ! 27: / *** empty log message *** ! 28: / ! 29: / Revision 1.1 88/03/24 17:05:05 src ! 30: / Initial revision ! 31: / ! 32: / ! 33: / 85/07/19 Allan Cornish ! 34: / Inserted code to check user address for validity. ! 35: / Functions ufcopy and fucopy now return 0 if user address is invalid. ! 36: / Replaced 'jnc .+2;movsb' with 'rcl cx,$1;rep movsb' to improve pipelining. ! 37: / ! 38: / 85/07/03 Allan Cornish ! 39: / Functions renamed: uoscopy --> ufcopy, osucopy --> fucopy (f = far). ! 40: / Module moved from msgas.s to ipcas.s, to reflect its shared use. ! 41: / ! 42: //////// ! 43: ! 44: .globl ufcopy_ ! 45: .globl fucopy_ ! 46: ! 47: //////// ! 48: / ! 49: / ufcopy( base, off, sel, n ) -- copy n bytes from user base to sel:off. ! 50: / ! 51: / Input: base = offset in user memory to copy from ! 52: / off = offset in the destination segment ! 53: / sel = selector to access the destination segment ! 54: / n = number of bytes to copy ! 55: / ! 56: / Action: Copy 'n' bytes of data from offset 'base' in user memory ! 57: / to offset 'off' in the segment accessed by selector 'sel'. ! 58: / ! 59: / Return: Number of bytes copied, or 0 if invalid user address. ! 60: / ! 61: //////// ! 62: ! 63: ufcopy_: / ufcopy( base, off, sel, n ) ! 64: push si / ! 65: push di / unsigned base; ! 66: push bp / unsigned off; ! 67: mov bp, sp / saddr_t sel; ! 68: push ds / unsigned n; ! 69: push es / ! 70: / { ! 71: mov ax, 8(bp) / Validate user address. ! 72: dec ax / ! 73: add ax, 14(bp) / Wrap-around error? ! 74: jc fuerr / ! 75: cmp ax, udl_ / Address out of bounds error? ! 76: ja fuerr / ! 77: / ! 78: mov bx, uds_ / Map DS:SI into user (source) addr ! 79: mov ds, bx / ! 80: mov si, 8(bp) / ! 81: les di, 10(bp) / Map ES:DI into segment (dest) addr ! 82: mov cx, 14(bp) / Transfer count ! 83: / ! 84: cld / Auto Increment ! 85: clc / ! 86: rcr cx, $1 / Change byte count into word count ! 87: rep / Transfer data words ! 88: movsw / ! 89: rcl cx, $1 / If residual byte count ! 90: rep / Transfer last data byte. ! 91: movsb / ! 92: / ! 93: mov ax, 14(bp) / Return transfer count. ! 94: pop es / } ! 95: pop ds ! 96: pop bp ! 97: pop di ! 98: pop si ! 99: ret ! 100: ! 101: fuerr: sub ax, ax ! 102: pop es ! 103: pop ds ! 104: pop bp ! 105: pop di ! 106: pop si ! 107: ret ! 108: ! 109: //////// ! 110: / ! 111: / fucopy( off, sel, base, n ) -- copy n bytes from sel:off to user base. ! 112: / ! 113: / Input: off = offset is the source segment ! 114: / sel = selector to access the source segment ! 115: / base = offset in user memory to copy to ! 116: / n = number of bytes to copy ! 117: / ! 118: / Action: Copy 'n' bytes of data from offset 'off' in the segment ! 119: / accessed by selector 'sel' to offset 'base' in user memory. ! 120: / ! 121: / Return: Number of bytes copied, or 0 if invalid user address. ! 122: / ! 123: //////// ! 124: ! 125: fucopy_: / fucopy( off, sel, base, n ) ! 126: push si / ! 127: push di / unsigned off; ! 128: push bp / saddr_t sel; ! 129: mov bp, sp / unsigned base; ! 130: push ds / unsigned n; ! 131: push es / ! 132: / { ! 133: mov ax, 12(bp) / Validate user address. ! 134: dec ax / ! 135: add ax, 14(bp) / Wrap-around error? ! 136: jc fuerr / ! 137: cmp ax, udl_ / Address out of bounds error? ! 138: ja fuerr / ! 139: / ! 140: mov es, uds_ / Map ES:DI into user (dest) address ! 141: mov di, 12(bp) / ! 142: lds si, 8(bp) / Map DS:SI into segment (source) addr ! 143: mov cx, 14(bp) / Transfer count ! 144: / ! 145: cld / Auto Increment ! 146: clc / ! 147: rcr cx, $1 / Change byte count into word count ! 148: rep / ! 149: movsw / Transfer data words ! 150: rcl cx, $1 / If residual byte count ! 151: rep / Transfer last data byte. ! 152: movsb / ! 153: / ! 154: mov ax, 14(bp) / Return transfer count. ! 155: pop es / } ! 156: pop ds ! 157: pop bp ! 158: pop di ! 159: pop si ! 160: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.