extmem.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Author(s)......: Carsten Otte <[email protected]>
  4. * Rob M van der Heij <[email protected]>
  5. * Steven Shultz <[email protected]>
  6. * Bugreports.to..: <[email protected]>
  7. * Copyright IBM Corp. 2002, 2004
  8. */
  9. #define KMSG_COMPONENT "extmem"
  10. #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
  11. #include <linux/kernel.h>
  12. #include <linux/string.h>
  13. #include <linux/spinlock.h>
  14. #include <linux/list.h>
  15. #include <linux/slab.h>
  16. #include <linux/export.h>
  17. #include <linux/memblock.h>
  18. #include <linux/ctype.h>
  19. #include <linux/ioport.h>
  20. #include <linux/refcount.h>
  21. #include <linux/pgtable.h>
  22. #include <asm/diag.h>
  23. #include <asm/page.h>
  24. #include <asm/ebcdic.h>
  25. #include <asm/errno.h>
  26. #include <asm/extmem.h>
  27. #include <asm/cpcmd.h>
  28. #include <asm/setup.h>
  29. #define DCSS_PURGESEG 0x08
  30. #define DCSS_LOADSHRX 0x20
  31. #define DCSS_LOADNSRX 0x24
  32. #define DCSS_FINDSEGX 0x2c
  33. #define DCSS_SEGEXTX 0x38
  34. #define DCSS_FINDSEGA 0x0c
  35. struct qrange {
  36. unsigned long start; /* last byte type */
  37. unsigned long end; /* last byte reserved */
  38. };
  39. struct qout64 {
  40. unsigned long segstart;
  41. unsigned long segend;
  42. int segcnt;
  43. int segrcnt;
  44. struct qrange range[6];
  45. };
  46. struct qin64 {
  47. char qopcode;
  48. char rsrv1[3];
  49. char qrcode;
  50. char rsrv2[3];
  51. char qname[8];
  52. unsigned int qoutptr;
  53. short int qoutlen;
  54. };
  55. struct dcss_segment {
  56. struct list_head list;
  57. char dcss_name[8];
  58. char res_name[16];
  59. unsigned long start_addr;
  60. unsigned long end;
  61. refcount_t ref_count;
  62. int do_nonshared;
  63. unsigned int vm_segtype;
  64. struct qrange range[6];
  65. int segcnt;
  66. struct resource *res;
  67. };
  68. static DEFINE_MUTEX(dcss_lock);
  69. static LIST_HEAD(dcss_list);
  70. static char *segtype_string[] = { "SW", "EW", "SR", "ER", "SN", "EN", "SC",
  71. "EW/EN-MIXED" };
  72. static int loadshr_scode = DCSS_LOADSHRX;
  73. static int loadnsr_scode = DCSS_LOADNSRX;
  74. static int purgeseg_scode = DCSS_PURGESEG;
  75. static int segext_scode = DCSS_SEGEXTX;
  76. /*
  77. * Create the 8 bytes, ebcdic VM segment name from
  78. * an ascii name.
  79. */
  80. static void
  81. dcss_mkname(char *name, char *dcss_name)
  82. {
  83. int i;
  84. for (i = 0; i < 8; i++) {
  85. if (name[i] == '\0')
  86. break;
  87. dcss_name[i] = toupper(name[i]);
  88. }
  89. for (; i < 8; i++)
  90. dcss_name[i] = ' ';
  91. ASCEBC(dcss_name, 8);
  92. }
  93. /*
  94. * search all segments in dcss_list, and return the one
  95. * namend *name. If not found, return NULL.
  96. */
  97. static struct dcss_segment *
  98. segment_by_name (char *name)
  99. {
  100. char dcss_name[9];
  101. struct list_head *l;
  102. struct dcss_segment *tmp, *retval = NULL;
  103. BUG_ON(!mutex_is_locked(&dcss_lock));
  104. dcss_mkname (name, dcss_name);
  105. list_for_each (l, &dcss_list) {
  106. tmp = list_entry (l, struct dcss_segment, list);
  107. if (memcmp(tmp->dcss_name, dcss_name, 8) == 0) {
  108. retval = tmp;
  109. break;
  110. }
  111. }
  112. return retval;
  113. }
  114. /*
  115. * Perform a function on a dcss segment.
  116. */
  117. static inline int
  118. dcss_diag(int *func, void *parameter,
  119. unsigned long *ret1, unsigned long *ret2)
  120. {
  121. unsigned long rx, ry;
  122. int rc;
  123. rx = (unsigned long) parameter;
  124. ry = (unsigned long) *func;
  125. diag_stat_inc(DIAG_STAT_X064);
  126. asm volatile(
  127. " diag %0,%1,0x64\n"
  128. " ipm %2\n"
  129. " srl %2,28\n"
  130. : "+d" (rx), "+d" (ry), "=d" (rc) : : "cc");
  131. *ret1 = rx;
  132. *ret2 = ry;
  133. return rc;
  134. }
  135. static inline int
  136. dcss_diag_translate_rc (int vm_rc) {
  137. if (vm_rc == 44)
  138. return -ENOENT;
  139. return -EIO;
  140. }
  141. /* do a diag to get info about a segment.
  142. * fills start_address, end and vm_segtype fields
  143. */
  144. static int
  145. query_segment_type (struct dcss_segment *seg)
  146. {
  147. unsigned long dummy, vmrc;
  148. int diag_cc, rc, i;
  149. struct qout64 *qout;
  150. struct qin64 *qin;
  151. qin = kmalloc(sizeof(*qin), GFP_KERNEL | GFP_DMA);
  152. qout = kmalloc(sizeof(*qout), GFP_KERNEL | GFP_DMA);
  153. if ((qin == NULL) || (qout == NULL)) {
  154. rc = -ENOMEM;
  155. goto out_free;
  156. }
  157. /* initialize diag input parameters */
  158. qin->qopcode = DCSS_FINDSEGA;
  159. qin->qoutptr = (unsigned long) qout;
  160. qin->qoutlen = sizeof(struct qout64);
  161. memcpy (qin->qname, seg->dcss_name, 8);
  162. diag_cc = dcss_diag(&segext_scode, qin, &dummy, &vmrc);
  163. if (diag_cc < 0) {
  164. rc = diag_cc;
  165. goto out_free;
  166. }
  167. if (diag_cc > 1) {
  168. pr_warn("Querying a DCSS type failed with rc=%ld\n", vmrc);
  169. rc = dcss_diag_translate_rc (vmrc);
  170. goto out_free;
  171. }
  172. if (qout->segcnt > 6) {
  173. rc = -EOPNOTSUPP;
  174. goto out_free;
  175. }
  176. if (qout->segcnt == 1) {
  177. seg->vm_segtype = qout->range[0].start & 0xff;
  178. } else {
  179. /* multi-part segment. only one type supported here:
  180. - all parts are contiguous
  181. - all parts are either EW or EN type
  182. - maximum 6 parts allowed */
  183. unsigned long start = qout->segstart >> PAGE_SHIFT;
  184. for (i=0; i<qout->segcnt; i++) {
  185. if (((qout->range[i].start & 0xff) != SEG_TYPE_EW) &&
  186. ((qout->range[i].start & 0xff) != SEG_TYPE_EN)) {
  187. rc = -EOPNOTSUPP;
  188. goto out_free;
  189. }
  190. if (start != qout->range[i].start >> PAGE_SHIFT) {
  191. rc = -EOPNOTSUPP;
  192. goto out_free;
  193. }
  194. start = (qout->range[i].end >> PAGE_SHIFT) + 1;
  195. }
  196. seg->vm_segtype = SEG_TYPE_EWEN;
  197. }
  198. /* analyze diag output and update seg */
  199. seg->start_addr = qout->segstart;
  200. seg->end = qout->segend;
  201. memcpy (seg->range, qout->range, 6*sizeof(struct qrange));
  202. seg->segcnt = qout->segcnt;
  203. rc = 0;
  204. out_free:
  205. kfree(qin);
  206. kfree(qout);
  207. return rc;
  208. }
  209. /*
  210. * get info about a segment
  211. * possible return values:
  212. * -ENOSYS : we are not running on VM
  213. * -EIO : could not perform query diagnose
  214. * -ENOENT : no such segment
  215. * -EOPNOTSUPP: multi-part segment cannot be used with linux
  216. * -ENOMEM : out of memory
  217. * 0 .. 6 : type of segment as defined in include/asm-s390/extmem.h
  218. */
  219. int
  220. segment_type (char* name)
  221. {
  222. int rc;
  223. struct dcss_segment seg;
  224. if (!MACHINE_IS_VM)
  225. return -ENOSYS;
  226. dcss_mkname(name, seg.dcss_name);
  227. rc = query_segment_type (&seg);
  228. if (rc < 0)
  229. return rc;
  230. return seg.vm_segtype;
  231. }
  232. /*
  233. * check if segment collides with other segments that are currently loaded
  234. * returns 1 if this is the case, 0 if no collision was found
  235. */
  236. static int
  237. segment_overlaps_others (struct dcss_segment *seg)
  238. {
  239. struct list_head *l;
  240. struct dcss_segment *tmp;
  241. BUG_ON(!mutex_is_locked(&dcss_lock));
  242. list_for_each(l, &dcss_list) {
  243. tmp = list_entry(l, struct dcss_segment, list);
  244. if ((tmp->start_addr >> 20) > (seg->end >> 20))
  245. continue;
  246. if ((tmp->end >> 20) < (seg->start_addr >> 20))
  247. continue;
  248. if (seg == tmp)
  249. continue;
  250. return 1;
  251. }
  252. return 0;
  253. }
  254. /*
  255. * real segment loading function, called from segment_load
  256. * Must return either an error code < 0, or the segment type code >= 0
  257. */
  258. static int
  259. __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long *end)
  260. {
  261. unsigned long start_addr, end_addr, dummy;
  262. struct dcss_segment *seg;
  263. int rc, diag_cc, segtype;
  264. start_addr = end_addr = 0;
  265. segtype = -1;
  266. seg = kmalloc(sizeof(*seg), GFP_KERNEL | GFP_DMA);
  267. if (seg == NULL) {
  268. rc = -ENOMEM;
  269. goto out;
  270. }
  271. dcss_mkname (name, seg->dcss_name);
  272. rc = query_segment_type (seg);
  273. if (rc < 0)
  274. goto out_free;
  275. if (segment_overlaps_others(seg)) {
  276. rc = -EBUSY;
  277. goto out_free;
  278. }
  279. seg->res = kzalloc(sizeof(struct resource), GFP_KERNEL);
  280. if (seg->res == NULL) {
  281. rc = -ENOMEM;
  282. goto out_free;
  283. }
  284. seg->res->flags = IORESOURCE_BUSY | IORESOURCE_MEM;
  285. seg->res->start = seg->start_addr;
  286. seg->res->end = seg->end;
  287. memcpy(&seg->res_name, seg->dcss_name, 8);
  288. EBCASC(seg->res_name, 8);
  289. seg->res_name[8] = '\0';
  290. strlcat(seg->res_name, " (DCSS)", sizeof(seg->res_name));
  291. seg->res->name = seg->res_name;
  292. segtype = seg->vm_segtype;
  293. if (segtype == SEG_TYPE_SC ||
  294. ((segtype == SEG_TYPE_SR || segtype == SEG_TYPE_ER) && !do_nonshared))
  295. seg->res->flags |= IORESOURCE_READONLY;
  296. /* Check for overlapping resources before adding the mapping. */
  297. if (request_resource(&iomem_resource, seg->res)) {
  298. rc = -EBUSY;
  299. goto out_free_resource;
  300. }
  301. rc = vmem_add_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
  302. if (rc)
  303. goto out_resource;
  304. if (do_nonshared)
  305. diag_cc = dcss_diag(&loadnsr_scode, seg->dcss_name,
  306. &start_addr, &end_addr);
  307. else
  308. diag_cc = dcss_diag(&loadshr_scode, seg->dcss_name,
  309. &start_addr, &end_addr);
  310. if (diag_cc < 0) {
  311. dcss_diag(&purgeseg_scode, seg->dcss_name,
  312. &dummy, &dummy);
  313. rc = diag_cc;
  314. goto out_mapping;
  315. }
  316. if (diag_cc > 1) {
  317. pr_warn("Loading DCSS %s failed with rc=%ld\n", name, end_addr);
  318. rc = dcss_diag_translate_rc(end_addr);
  319. dcss_diag(&purgeseg_scode, seg->dcss_name,
  320. &dummy, &dummy);
  321. goto out_mapping;
  322. }
  323. seg->start_addr = start_addr;
  324. seg->end = end_addr;
  325. seg->do_nonshared = do_nonshared;
  326. refcount_set(&seg->ref_count, 1);
  327. list_add(&seg->list, &dcss_list);
  328. *addr = seg->start_addr;
  329. *end = seg->end;
  330. if (do_nonshared)
  331. pr_info("DCSS %s of range %px to %px and type %s loaded as "
  332. "exclusive-writable\n", name, (void*) seg->start_addr,
  333. (void*) seg->end, segtype_string[seg->vm_segtype]);
  334. else {
  335. pr_info("DCSS %s of range %px to %px and type %s loaded in "
  336. "shared access mode\n", name, (void*) seg->start_addr,
  337. (void*) seg->end, segtype_string[seg->vm_segtype]);
  338. }
  339. goto out;
  340. out_mapping:
  341. vmem_remove_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
  342. out_resource:
  343. release_resource(seg->res);
  344. out_free_resource:
  345. kfree(seg->res);
  346. out_free:
  347. kfree(seg);
  348. out:
  349. return rc < 0 ? rc : segtype;
  350. }
  351. /*
  352. * this function loads a DCSS segment
  353. * name : name of the DCSS
  354. * do_nonshared : 0 indicates that the dcss should be shared with other linux images
  355. * 1 indicates that the dcss should be exclusive for this linux image
  356. * addr : will be filled with start address of the segment
  357. * end : will be filled with end address of the segment
  358. * return values:
  359. * -ENOSYS : we are not running on VM
  360. * -EIO : could not perform query or load diagnose
  361. * -ENOENT : no such segment
  362. * -EOPNOTSUPP: multi-part segment cannot be used with linux
  363. * -EBUSY : segment cannot be used (overlaps with dcss or storage)
  364. * -ERANGE : segment cannot be used (exceeds kernel mapping range)
  365. * -EPERM : segment is currently loaded with incompatible permissions
  366. * -ENOMEM : out of memory
  367. * 0 .. 6 : type of segment as defined in include/asm-s390/extmem.h
  368. */
  369. int
  370. segment_load (char *name, int do_nonshared, unsigned long *addr,
  371. unsigned long *end)
  372. {
  373. struct dcss_segment *seg;
  374. int rc;
  375. if (!MACHINE_IS_VM)
  376. return -ENOSYS;
  377. mutex_lock(&dcss_lock);
  378. seg = segment_by_name (name);
  379. if (seg == NULL)
  380. rc = __segment_load (name, do_nonshared, addr, end);
  381. else {
  382. if (do_nonshared == seg->do_nonshared) {
  383. refcount_inc(&seg->ref_count);
  384. *addr = seg->start_addr;
  385. *end = seg->end;
  386. rc = seg->vm_segtype;
  387. } else {
  388. *addr = *end = 0;
  389. rc = -EPERM;
  390. }
  391. }
  392. mutex_unlock(&dcss_lock);
  393. return rc;
  394. }
  395. /*
  396. * this function modifies the shared state of a DCSS segment. note that
  397. * name : name of the DCSS
  398. * do_nonshared : 0 indicates that the dcss should be shared with other linux images
  399. * 1 indicates that the dcss should be exclusive for this linux image
  400. * return values:
  401. * -EIO : could not perform load diagnose (segment gone!)
  402. * -ENOENT : no such segment (segment gone!)
  403. * -EAGAIN : segment is in use by other exploiters, try later
  404. * -EINVAL : no segment with the given name is currently loaded - name invalid
  405. * -EBUSY : segment can temporarily not be used (overlaps with dcss)
  406. * 0 : operation succeeded
  407. */
  408. int
  409. segment_modify_shared (char *name, int do_nonshared)
  410. {
  411. struct dcss_segment *seg;
  412. unsigned long start_addr, end_addr, dummy;
  413. int rc, diag_cc;
  414. start_addr = end_addr = 0;
  415. mutex_lock(&dcss_lock);
  416. seg = segment_by_name (name);
  417. if (seg == NULL) {
  418. rc = -EINVAL;
  419. goto out_unlock;
  420. }
  421. if (do_nonshared == seg->do_nonshared) {
  422. pr_info("DCSS %s is already in the requested access "
  423. "mode\n", name);
  424. rc = 0;
  425. goto out_unlock;
  426. }
  427. if (refcount_read(&seg->ref_count) != 1) {
  428. pr_warn("DCSS %s is in use and cannot be reloaded\n", name);
  429. rc = -EAGAIN;
  430. goto out_unlock;
  431. }
  432. release_resource(seg->res);
  433. if (do_nonshared)
  434. seg->res->flags &= ~IORESOURCE_READONLY;
  435. else
  436. if (seg->vm_segtype == SEG_TYPE_SR ||
  437. seg->vm_segtype == SEG_TYPE_ER)
  438. seg->res->flags |= IORESOURCE_READONLY;
  439. if (request_resource(&iomem_resource, seg->res)) {
  440. pr_warn("DCSS %s overlaps with used memory resources and cannot be reloaded\n",
  441. name);
  442. rc = -EBUSY;
  443. kfree(seg->res);
  444. goto out_del_mem;
  445. }
  446. dcss_diag(&purgeseg_scode, seg->dcss_name, &dummy, &dummy);
  447. if (do_nonshared)
  448. diag_cc = dcss_diag(&loadnsr_scode, seg->dcss_name,
  449. &start_addr, &end_addr);
  450. else
  451. diag_cc = dcss_diag(&loadshr_scode, seg->dcss_name,
  452. &start_addr, &end_addr);
  453. if (diag_cc < 0) {
  454. rc = diag_cc;
  455. goto out_del_res;
  456. }
  457. if (diag_cc > 1) {
  458. pr_warn("Reloading DCSS %s failed with rc=%ld\n",
  459. name, end_addr);
  460. rc = dcss_diag_translate_rc(end_addr);
  461. goto out_del_res;
  462. }
  463. seg->start_addr = start_addr;
  464. seg->end = end_addr;
  465. seg->do_nonshared = do_nonshared;
  466. rc = 0;
  467. goto out_unlock;
  468. out_del_res:
  469. release_resource(seg->res);
  470. kfree(seg->res);
  471. out_del_mem:
  472. vmem_remove_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
  473. list_del(&seg->list);
  474. dcss_diag(&purgeseg_scode, seg->dcss_name, &dummy, &dummy);
  475. kfree(seg);
  476. out_unlock:
  477. mutex_unlock(&dcss_lock);
  478. return rc;
  479. }
  480. /*
  481. * Decrease the use count of a DCSS segment and remove
  482. * it from the address space if nobody is using it
  483. * any longer.
  484. */
  485. void
  486. segment_unload(char *name)
  487. {
  488. unsigned long dummy;
  489. struct dcss_segment *seg;
  490. if (!MACHINE_IS_VM)
  491. return;
  492. mutex_lock(&dcss_lock);
  493. seg = segment_by_name (name);
  494. if (seg == NULL) {
  495. pr_err("Unloading unknown DCSS %s failed\n", name);
  496. goto out_unlock;
  497. }
  498. if (!refcount_dec_and_test(&seg->ref_count))
  499. goto out_unlock;
  500. release_resource(seg->res);
  501. kfree(seg->res);
  502. vmem_remove_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
  503. list_del(&seg->list);
  504. dcss_diag(&purgeseg_scode, seg->dcss_name, &dummy, &dummy);
  505. kfree(seg);
  506. out_unlock:
  507. mutex_unlock(&dcss_lock);
  508. }
  509. /*
  510. * save segment content permanently
  511. */
  512. void
  513. segment_save(char *name)
  514. {
  515. struct dcss_segment *seg;
  516. char cmd1[160];
  517. char cmd2[80];
  518. int i, response;
  519. if (!MACHINE_IS_VM)
  520. return;
  521. mutex_lock(&dcss_lock);
  522. seg = segment_by_name (name);
  523. if (seg == NULL) {
  524. pr_err("Saving unknown DCSS %s failed\n", name);
  525. goto out;
  526. }
  527. sprintf(cmd1, "DEFSEG %s", name);
  528. for (i=0; i<seg->segcnt; i++) {
  529. sprintf(cmd1+strlen(cmd1), " %lX-%lX %s",
  530. seg->range[i].start >> PAGE_SHIFT,
  531. seg->range[i].end >> PAGE_SHIFT,
  532. segtype_string[seg->range[i].start & 0xff]);
  533. }
  534. sprintf(cmd2, "SAVESEG %s", name);
  535. response = 0;
  536. cpcmd(cmd1, NULL, 0, &response);
  537. if (response) {
  538. pr_err("Saving a DCSS failed with DEFSEG response code "
  539. "%i\n", response);
  540. goto out;
  541. }
  542. cpcmd(cmd2, NULL, 0, &response);
  543. if (response) {
  544. pr_err("Saving a DCSS failed with SAVESEG response code "
  545. "%i\n", response);
  546. goto out;
  547. }
  548. out:
  549. mutex_unlock(&dcss_lock);
  550. }
  551. /*
  552. * print appropriate error message for segment_load()/segment_type()
  553. * return code
  554. */
  555. void segment_warning(int rc, char *seg_name)
  556. {
  557. switch (rc) {
  558. case -ENOENT:
  559. pr_err("DCSS %s cannot be loaded or queried\n", seg_name);
  560. break;
  561. case -ENOSYS:
  562. pr_err("DCSS %s cannot be loaded or queried without "
  563. "z/VM\n", seg_name);
  564. break;
  565. case -EIO:
  566. pr_err("Loading or querying DCSS %s resulted in a "
  567. "hardware error\n", seg_name);
  568. break;
  569. case -EOPNOTSUPP:
  570. pr_err("DCSS %s has multiple page ranges and cannot be "
  571. "loaded or queried\n", seg_name);
  572. break;
  573. case -EBUSY:
  574. pr_err("%s needs used memory resources and cannot be "
  575. "loaded or queried\n", seg_name);
  576. break;
  577. case -EPERM:
  578. pr_err("DCSS %s is already loaded in a different access "
  579. "mode\n", seg_name);
  580. break;
  581. case -ENOMEM:
  582. pr_err("There is not enough memory to load or query "
  583. "DCSS %s\n", seg_name);
  584. break;
  585. case -ERANGE:
  586. pr_err("DCSS %s exceeds the kernel mapping range (%lu) "
  587. "and cannot be loaded\n", seg_name, VMEM_MAX_PHYS);
  588. break;
  589. default:
  590. break;
  591. }
  592. }
  593. EXPORT_SYMBOL(segment_load);
  594. EXPORT_SYMBOL(segment_unload);
  595. EXPORT_SYMBOL(segment_save);
  596. EXPORT_SYMBOL(segment_type);
  597. EXPORT_SYMBOL(segment_modify_shared);
  598. EXPORT_SYMBOL(segment_warning);